From 0a34af7c00297de2cdcb96ffd08e5d756f13ed4e Mon Sep 17 00:00:00 2001 From: Lin-XCC <754310653@QQ.COM> Date: Wed, 29 Dec 2021 08:53:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96apms=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E6=97=B6=E5=8F=91=E7=8E=B0=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/empty/controller/ApmsController.java | 20 +++++++++++-------- .../java/com/mt/wms/empty/params/Iden.java | 18 +++++++++++++++++ .../service/impl/OrderInfoServiceImpl.java | 19 +++++++++++++++--- 3 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 6.program/wms-empty/src/main/java/com/mt/wms/empty/params/Iden.java diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java index f338057..b280fdb 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java @@ -58,24 +58,27 @@ public class ApmsController extends BaseController { CommunicationLog communicationLog = new CommunicationLog(); communicationLog.setCode("APMS" + System.currentTimeMillis()); communicationLog.setLogName("WMS接收APMS推送订单信息"); - communicationLog.setContent(apmsPostOrderParam.toString()); communicationLog.setType(3); setCommonField(communicationLog); + R stringR = orderInfoService.apmsPostOrder(apmsPostOrderParam); + communicationLog.setContent("param:" + apmsPostOrderParam.toString() + "\nresult:" + stringR.toString()); communicationLogServiceBiz.save(communicationLog); - return orderInfoService.apmsPostOrder(apmsPostOrderParam); + return stringR; } @PostMapping(value = "apmsVoidOrder") @ApiOperation(value = "WMS接收APMS作废订单信息") - public R apmsVoidOrder(@Validated @RequestBody String idenCardNum) { + public R apmsVoidOrder(@Validated @RequestBody Iden idenCardNum) { + //todo 改动为json值 CommunicationLog communicationLog = new CommunicationLog(); communicationLog.setCode("APMS" + System.currentTimeMillis()); communicationLog.setLogName("WMS接收APMS作废订单信息"); communicationLog.setType(3); - communicationLog.setContent(idenCardNum); setCommonField(communicationLog); + R stringR = orderInfoService.apmsVoidOrder(idenCardNum.getIdenCardNum()); + communicationLog.setContent("param:" + idenCardNum + "\nresult:" + stringR.toString()); communicationLogServiceBiz.save(communicationLog); - return orderInfoService.apmsVoidOrder(idenCardNum); + return stringR; } @PostMapping(value = "apmsCompleteOrder") @@ -85,11 +88,12 @@ public class ApmsController extends BaseController { communicationLog.setCode("APMS" + System.currentTimeMillis()); communicationLog.setLogName("WMS接收APMS加工单检验结果"); communicationLog.setType(3); - communicationLog.setContent(apmsCompleteOrder.toString()); setCommonField(communicationLog); - communicationLogServiceBiz.save(communicationLog); //APMS完成订单,返回检验结果,更新结果和后续处理 - return orderInfoService.apmsCompleteOrder(apmsCompleteOrder); + R stringR = orderInfoService.apmsCompleteOrder(apmsCompleteOrder); + communicationLog.setContent("param:" + apmsCompleteOrder + "\nresult:" + stringR.toString()); + communicationLogServiceBiz.save(communicationLog); + return stringR; } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/Iden.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/Iden.java new file mode 100644 index 0000000..77ca8a3 --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/Iden.java @@ -0,0 +1,18 @@ +package com.mt.wms.empty.params; + +import com.mt.wms.core.base.BaseParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "Apms作废生产单", description = "Apms作废生产单") +public class Iden extends BaseParam { + private static final long serialVersionUID = 1L; + @ApiModelProperty(value = "标识卡号", required = true) + private String idenCardNum; +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java index ce8a061..2cb8d8f 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java @@ -95,6 +95,12 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic //设定来源信息为apms orderInfo.setOrderSource(OrderSourceEnum.APMS.getValue()); orderInfo.setInterCode(IDGenerator.gen("DD", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "ORDER_CODE")); + //检查是否为重复的单号 + OrderInfo one = orderInfoService.getOne(new QueryWrapper().eq(OrderInfo.ORDER_NO, apmsPostOrderParam.getOrderNo()).eq(OrderInfo.IDEN_CARD_NUM, apmsPostOrderParam.getIdenCardNum())); + if (one != null) + { + return failed("操作失败,接收到重复订单信息:" + apmsPostOrderParam.getOrderNo()); + } orderInfoService.save(orderInfo); return successful("Wms接收Apms订单成功。"); } @@ -249,22 +255,29 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic byId.setInterCode(IDGenerator.gen("DDHIS", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "ORDER_HIS_CODE")); setCommonField(byId); orderInfoHisService.save(byId); - return successful("成功,订单状态置为完成。"); + return successful("操作成功,订单状态置为完成。"); } @Override public R voidOrder(IdParam idParam) { OrderInfo byId = orderInfoService.getById(idParam.getId()); - Assert.notNull("未找到订单信息。", byId); + if (byId.getOrderVoid() == 0) + { + return failed("操作失败,该订单已经处于作废状态。"); + } byId.setUpdateTime(LocalDateTime.now()); byId.setOrderVoid(0); orderInfoService.updateById(byId); - return successful("成功,订单状态置为作废。"); + return successful("操作成功,订单状态置为作废。"); } @Override public R apmsVoidOrder(String idenCardNum) { OrderInfo byId = orderInfoService.getOne(new QueryWrapper().eq(OrderInfo.IDEN_CARD_NUM, idenCardNum)); + if (byId == null) + { + return failed("未找到该标识卡:" + idenCardNum + "下的订单信息!"); + } //确定是否有订单在生产 List taskDetailsByIdenCardNum = currTaskDetService.getTaskDetailsByIdenCardNum(idenCardNum); if (taskDetailsByIdenCardNum.size() > 0)