完善APMS接口。
This commit is contained in:
parent
6be427ba79
commit
82704c9eb3
@ -1,5 +1,6 @@
|
|||||||
package com.mt.wms.empty.controller;
|
package com.mt.wms.empty.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.http.HttpResponse;
|
import cn.hutool.http.HttpResponse;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.hutool.json.JSON;
|
import cn.hutool.json.JSON;
|
||||||
@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,6 +42,7 @@ public class ApmsController extends BaseController {
|
|||||||
private CommunicationLogServiceBiz communicationLogServiceBiz;
|
private CommunicationLogServiceBiz communicationLogServiceBiz;
|
||||||
|
|
||||||
static String Token = "";
|
static String Token = "";
|
||||||
|
static LocalDateTime TokenExpireTime = LocalDateTime.now();
|
||||||
static String ApiAddress = "http://59.110.171.25:9010";
|
static String ApiAddress = "http://59.110.171.25:9010";
|
||||||
|
|
||||||
@PostMapping(value = "apmsPostOrder")
|
@PostMapping(value = "apmsPostOrder")
|
||||||
@ -47,8 +50,9 @@ public class ApmsController extends BaseController {
|
|||||||
public R apmsPostOrder(@Validated @RequestBody OrderParamForApms apmsPostOrderParam) {
|
public R apmsPostOrder(@Validated @RequestBody OrderParamForApms apmsPostOrderParam) {
|
||||||
CommunicationLog communicationLog = new CommunicationLog();
|
CommunicationLog communicationLog = new CommunicationLog();
|
||||||
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
||||||
communicationLog.setLogName("Wms接收Apms订单");
|
communicationLog.setLogName("WMS接收APMS订单");
|
||||||
communicationLog.setContent(apmsPostOrderParam.toString());
|
communicationLog.setContent(apmsPostOrderParam.toString());
|
||||||
|
communicationLog.setType(3);
|
||||||
setCommonField(communicationLog);
|
setCommonField(communicationLog);
|
||||||
communicationLogServiceBiz.save(communicationLog);
|
communicationLogServiceBiz.save(communicationLog);
|
||||||
return orderInfoService.apmsPostOrder(apmsPostOrderParam);
|
return orderInfoService.apmsPostOrder(apmsPostOrderParam);
|
||||||
@ -60,6 +64,7 @@ public class ApmsController extends BaseController {
|
|||||||
CommunicationLog communicationLog = new CommunicationLog();
|
CommunicationLog communicationLog = new CommunicationLog();
|
||||||
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
||||||
communicationLog.setLogName("APMS作废订单");
|
communicationLog.setLogName("APMS作废订单");
|
||||||
|
communicationLog.setType(3);
|
||||||
communicationLog.setContent(idenCardNum);
|
communicationLog.setContent(idenCardNum);
|
||||||
setCommonField(communicationLog);
|
setCommonField(communicationLog);
|
||||||
communicationLogServiceBiz.save(communicationLog);
|
communicationLogServiceBiz.save(communicationLog);
|
||||||
@ -67,19 +72,21 @@ public class ApmsController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "apmsCompleteOrder")
|
@PostMapping(value = "apmsCompleteOrder")
|
||||||
@ApiOperation(value = "APMS完成订单")
|
@ApiOperation(value = "APMS完成订单,返回加工单检验结果")
|
||||||
public R apmsCompleteOrder(@Validated @RequestBody ApmsCompleteOrder apmsCompleteOrder) {
|
public R apmsCompleteOrder(@Validated @RequestBody ApmsCompleteOrder apmsCompleteOrder) {
|
||||||
CommunicationLog communicationLog = new CommunicationLog();
|
CommunicationLog communicationLog = new CommunicationLog();
|
||||||
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
||||||
communicationLog.setLogName("APMS完成订单");
|
communicationLog.setLogName("APMS完成订单,返回WMS加工单检验结果");
|
||||||
|
communicationLog.setType(3);
|
||||||
communicationLog.setContent(apmsCompleteOrder.toString());
|
communicationLog.setContent(apmsCompleteOrder.toString());
|
||||||
setCommonField(communicationLog);
|
setCommonField(communicationLog);
|
||||||
communicationLogServiceBiz.save(communicationLog);
|
communicationLogServiceBiz.save(communicationLog);
|
||||||
|
//APMS完成订单,返回检验结果,更新结果和后续处理
|
||||||
return orderInfoService.apmsCompleteOrder(apmsCompleteOrder);
|
return orderInfoService.apmsCompleteOrder(apmsCompleteOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "createProcessSheet")
|
@PostMapping(value = "createProcessSheet")
|
||||||
@ApiOperation(value = "APMS创建生产单接口")
|
@ApiOperation(value = "通知APMS创建生产单接口")
|
||||||
public R createProcessSheet(@Validated @RequestBody ApmsCreateProcessSheet apmsCreateProcess) {
|
public R createProcessSheet(@Validated @RequestBody ApmsCreateProcessSheet apmsCreateProcess) {
|
||||||
checkToken();
|
checkToken();
|
||||||
HashMap<String, Object> paramMap = new HashMap<>();
|
HashMap<String, Object> paramMap = new HashMap<>();
|
||||||
@ -88,8 +95,9 @@ public class ApmsController extends BaseController {
|
|||||||
.header("token", Token).form(paramMap).execute();
|
.header("token", Token).form(paramMap).execute();
|
||||||
CommunicationLog communicationLog = new CommunicationLog();
|
CommunicationLog communicationLog = new CommunicationLog();
|
||||||
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
||||||
communicationLog.setLogName("APMS创建生产单");
|
communicationLog.setLogName("WMS通知APMS创建生产单");
|
||||||
communicationLog.setContent(paramMap.toString());
|
communicationLog.setType(2);
|
||||||
|
communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body());
|
||||||
setCommonField(communicationLog);
|
setCommonField(communicationLog);
|
||||||
communicationLogServiceBiz.save(communicationLog);
|
communicationLogServiceBiz.save(communicationLog);
|
||||||
return successful(response);
|
return successful(response);
|
||||||
@ -105,15 +113,16 @@ public class ApmsController extends BaseController {
|
|||||||
.header("token", Token).form(paramMap).execute();
|
.header("token", Token).form(paramMap).execute();
|
||||||
CommunicationLog communicationLog = new CommunicationLog();
|
CommunicationLog communicationLog = new CommunicationLog();
|
||||||
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
||||||
communicationLog.setLogName("通知APMS生产单开始处理");
|
communicationLog.setLogName("WMS通知APMS生产单开始处理");
|
||||||
communicationLog.setContent(paramMap.toString());
|
communicationLog.setType(2);
|
||||||
|
communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body());
|
||||||
setCommonField(communicationLog);
|
setCommonField(communicationLog);
|
||||||
communicationLogServiceBiz.save(communicationLog);
|
communicationLogServiceBiz.save(communicationLog);
|
||||||
return successful(response);
|
return successful(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "endProcess")
|
@PostMapping(value = "endProcess")
|
||||||
@ApiOperation(value = "通知APMS订单结束处理")
|
@ApiOperation(value = "通知APMS生产单结束处理")
|
||||||
public R endProcess(@Validated @RequestBody ApmsEndProcess apmsEndProcess) {
|
public R endProcess(@Validated @RequestBody ApmsEndProcess apmsEndProcess) {
|
||||||
checkToken();
|
checkToken();
|
||||||
HashMap<String, Object> paramMap = new HashMap<>();
|
HashMap<String, Object> paramMap = new HashMap<>();
|
||||||
@ -122,8 +131,9 @@ public class ApmsController extends BaseController {
|
|||||||
.header("token", Token).form(paramMap).execute();
|
.header("token", Token).form(paramMap).execute();
|
||||||
CommunicationLog communicationLog = new CommunicationLog();
|
CommunicationLog communicationLog = new CommunicationLog();
|
||||||
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
||||||
communicationLog.setLogName("通知APMS订单结束处理");
|
communicationLog.setLogName("WMS通知APMS生产单结束处理");
|
||||||
communicationLog.setContent(paramMap.toString());
|
communicationLog.setType(2);
|
||||||
|
communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body());
|
||||||
setCommonField(communicationLog);
|
setCommonField(communicationLog);
|
||||||
communicationLogServiceBiz.save(communicationLog);
|
communicationLogServiceBiz.save(communicationLog);
|
||||||
return successful(response);
|
return successful(response);
|
||||||
@ -139,8 +149,9 @@ public class ApmsController extends BaseController {
|
|||||||
.header("token", Token).form(paramMap).execute();
|
.header("token", Token).form(paramMap).execute();
|
||||||
CommunicationLog communicationLog = new CommunicationLog();
|
CommunicationLog communicationLog = new CommunicationLog();
|
||||||
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
||||||
communicationLog.setLogName("通知APMS完成生产单接口");
|
communicationLog.setLogName("WMS通知APMS完成生产单");
|
||||||
communicationLog.setContent(paramMap.toString());
|
communicationLog.setType(2);
|
||||||
|
communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body());
|
||||||
setCommonField(communicationLog);
|
setCommonField(communicationLog);
|
||||||
communicationLogServiceBiz.save(communicationLog);
|
communicationLogServiceBiz.save(communicationLog);
|
||||||
return successful(response);
|
return successful(response);
|
||||||
@ -155,11 +166,14 @@ public class ApmsController extends BaseController {
|
|||||||
String result = HttpUtil.get(ApiAddress + "/platform/api/getToken", paramMap);
|
String result = HttpUtil.get(ApiAddress + "/platform/api/getToken", paramMap);
|
||||||
JSON parse = JSONUtil.parse(result);
|
JSON parse = JSONUtil.parse(result);
|
||||||
Object token = parse.getByPath("token");
|
Object token = parse.getByPath("token");
|
||||||
|
String expireTime = parse.getByPath("expireTime").toString();
|
||||||
Token = token.toString();
|
Token = token.toString();
|
||||||
|
TokenExpireTime = LocalDateTimeUtil.parse(expireTime);
|
||||||
CommunicationLog communicationLog = new CommunicationLog();
|
CommunicationLog communicationLog = new CommunicationLog();
|
||||||
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
||||||
communicationLog.setLogName("获取APMS Token");
|
communicationLog.setLogName("WMS获取APMS Token");
|
||||||
communicationLog.setContent(paramMap.toString());
|
communicationLog.setType(2);
|
||||||
|
communicationLog.setContent("param:" + paramMap + "\nresult:" + result);
|
||||||
setCommonField(communicationLog);
|
setCommonField(communicationLog);
|
||||||
communicationLogServiceBiz.save(communicationLog);
|
communicationLogServiceBiz.save(communicationLog);
|
||||||
return successful(result);
|
return successful(result);
|
||||||
@ -173,10 +187,12 @@ public class ApmsController extends BaseController {
|
|||||||
paramMap.put("workShopCode", workShopCode);
|
paramMap.put("workShopCode", workShopCode);
|
||||||
HttpResponse response = HttpUtil.createGet(ApiAddress + "/platform/api/getStoveCodeByWorkShopCode")
|
HttpResponse response = HttpUtil.createGet(ApiAddress + "/platform/api/getStoveCodeByWorkShopCode")
|
||||||
.header("token", Token).form(paramMap).execute();
|
.header("token", Token).form(paramMap).execute();
|
||||||
|
System.out.println(response.body());
|
||||||
CommunicationLog communicationLog = new CommunicationLog();
|
CommunicationLog communicationLog = new CommunicationLog();
|
||||||
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
communicationLog.setCode("APMS" + System.currentTimeMillis());
|
||||||
communicationLog.setLogName("APMS通过车间编码获取炉号信息");
|
communicationLog.setLogName("APMS通过车间编码获取炉号信息");
|
||||||
communicationLog.setContent(paramMap.toString());
|
communicationLog.setType(2);
|
||||||
|
communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body());
|
||||||
setCommonField(communicationLog);
|
setCommonField(communicationLog);
|
||||||
communicationLogServiceBiz.save(communicationLog);
|
communicationLogServiceBiz.save(communicationLog);
|
||||||
return successful(response);
|
return successful(response);
|
||||||
@ -187,5 +203,9 @@ public class ApmsController extends BaseController {
|
|||||||
{
|
{
|
||||||
getApmsToken();
|
getApmsToken();
|
||||||
}
|
}
|
||||||
|
else if (TokenExpireTime.isBefore(LocalDateTime.now()))
|
||||||
|
{
|
||||||
|
getApmsToken();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import lombok.experimental.Accessors;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@ApiModel(value = "apms订单对象", description = "用于推送新的订单信息")
|
@ApiModel(value = "apms订单对象", description = "用于APMS推送新的订单信息")
|
||||||
public class OrderParamForApms extends BaseParam {
|
public class OrderParamForApms extends BaseParam {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -68,10 +68,10 @@ public class OrderParamForApms extends BaseParam {
|
|||||||
@ApiModelProperty(value = "工艺要求")
|
@ApiModelProperty(value = "工艺要求")
|
||||||
private String craftIll;
|
private String craftIll;
|
||||||
|
|
||||||
@ApiModelProperty(value = "加工数量")
|
@ApiModelProperty(value = "加工数量", required = true)
|
||||||
private Float quantity;
|
private Float quantity;
|
||||||
|
|
||||||
@ApiModelProperty(value = "加工重量")
|
@ApiModelProperty(value = "加工重量", required = true)
|
||||||
private Float weight;
|
private Float weight;
|
||||||
|
|
||||||
@ApiModelProperty(value = "单位")
|
@ApiModelProperty(value = "单位")
|
||||||
|
@ -11,8 +11,10 @@ import com.mt.wms.basic.vo.KilnInfoVo;
|
|||||||
import com.mt.wms.basic.vo.VehicleVo;
|
import com.mt.wms.basic.vo.VehicleVo;
|
||||||
import com.mt.wms.core.api.Assert;
|
import com.mt.wms.core.api.Assert;
|
||||||
import com.mt.wms.core.base.BaseService;
|
import com.mt.wms.core.base.BaseService;
|
||||||
|
import com.mt.wms.core.dal.entity.ApmsCheckResult;
|
||||||
import com.mt.wms.core.dal.entity.CurrTaskDet;
|
import com.mt.wms.core.dal.entity.CurrTaskDet;
|
||||||
import com.mt.wms.core.dal.entity.OrderInfo;
|
import com.mt.wms.core.dal.entity.OrderInfo;
|
||||||
|
import com.mt.wms.core.dal.service.ApmsCheckResultServiceBiz;
|
||||||
import com.mt.wms.core.dal.service.CommunicationLogServiceBiz;
|
import com.mt.wms.core.dal.service.CommunicationLogServiceBiz;
|
||||||
import com.mt.wms.core.dal.service.OrderInfoServiceBiz;
|
import com.mt.wms.core.dal.service.OrderInfoServiceBiz;
|
||||||
import com.mt.wms.core.params.IdParam;
|
import com.mt.wms.core.params.IdParam;
|
||||||
@ -34,6 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -69,6 +72,9 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
CommunicationLogServiceBiz communicationLogServiceBiz;
|
CommunicationLogServiceBiz communicationLogServiceBiz;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ApmsCheckResultServiceBiz apmsCheckResultServiceBiz;
|
||||||
@Autowired
|
@Autowired
|
||||||
ApmsController apmsControl;
|
ApmsController apmsControl;
|
||||||
|
|
||||||
@ -201,6 +207,14 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R apmsCompleteOrder(ApmsCompleteOrder apmsCompleteOrder) {
|
public R apmsCompleteOrder(ApmsCompleteOrder apmsCompleteOrder) {
|
||||||
return null;
|
//通过标识卡号与生产单号进行更新检验结果
|
||||||
|
ApmsCheckResult one = apmsCheckResultServiceBiz.getOne(new QueryWrapper<ApmsCheckResult>().eq(ApmsCheckResult.IDEN_CARD_NUM, apmsCompleteOrder.getIdenCardNum()).eq(ApmsCheckResult.SHEET_NO, apmsCompleteOrder.getSheetNo()));
|
||||||
|
one.setMetallography(apmsCompleteOrder.getMetallographic());
|
||||||
|
one.setHeartHardness(apmsCompleteOrder.getHeartHardness());
|
||||||
|
one.setHardness(apmsCompleteOrder.getHardness());
|
||||||
|
one.setUpdateTime(LocalDateTime.now());
|
||||||
|
apmsCheckResultServiceBiz.updateById(one);
|
||||||
|
OrderInfo one1 = orderInfoService.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, apmsCompleteOrder.getIdenCardNum()));
|
||||||
|
return completeOrder(IdParam.builder().id(one1.getId()).build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user