From 8f6b3ef5e1b8ea419847b4ccbbcfd80b10a37ffa Mon Sep 17 00:00:00 2001 From: anthonyywj2 <353682448@qq.com> Date: Wed, 1 Jun 2022 15:53:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E8=A1=A1=E8=A1=A5=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/inout/WareHouseController.java | 109 ++++++++++++------ .../service/inout/impl/OrderServiceImpl.java | 2 + 2 files changed, 78 insertions(+), 33 deletions(-) diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java index da45d65..51aad1e 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java @@ -371,33 +371,58 @@ public class WareHouseController { if (StrUtil.isNotEmpty(newCode)) { if (newCode.startsWith("10")) { if (StrUtil.isNotEmpty(originUdiEntity.getBatchNo())) { - BaseResponse baseResponse = ResultVOUtils.error(501, "DI格式错误"); + BaseResponse baseResponse = ResultVOUtils.error(501, "批次号重复添加"); baseResponse.setData(originCode); return baseResponse; + } else { + String msg = checkNewCode(originUdiEntity, newCode); + if (msg != null) { + BaseResponse baseResponse = ResultVOUtils.error(501, msg); + baseResponse.setData(originCode); + return baseResponse; + } } } else if (newCode.startsWith("17")) { if (StrUtil.isNotEmpty(originUdiEntity.getExpireDate())) { - BaseResponse baseResponse = ResultVOUtils.error(501, "DI格式错误"); + BaseResponse baseResponse = ResultVOUtils.error(501, "失效日期重复添加"); baseResponse.setData(originCode); return baseResponse; + } else { + String msg = checkNewCode(originUdiEntity, newCode); + if (msg != null) { + BaseResponse baseResponse = ResultVOUtils.error(501, msg); + baseResponse.setData(originCode); + return baseResponse; + } } } else if (newCode.startsWith("11")) { if (StrUtil.isNotEmpty(originUdiEntity.getProduceDate())) { - BaseResponse baseResponse = ResultVOUtils.error(501, "DI格式错误"); + BaseResponse baseResponse = ResultVOUtils.error(501, "生产日期重复添加"); baseResponse.setData(originCode); return baseResponse; + } else { + String msg = checkNewCode(originUdiEntity, newCode); + if (msg != null) { + BaseResponse baseResponse = ResultVOUtils.error(501, msg); + baseResponse.setData(originCode); + return baseResponse; + } } } else if (newCode.startsWith("21")) { if (StrUtil.isNotEmpty(originUdiEntity.getSerialNo())) { - BaseResponse baseResponse = ResultVOUtils.error(501, "DI格式错误"); + BaseResponse baseResponse = ResultVOUtils.error(501, "序列号重复添加"); baseResponse.setData(originCode); return baseResponse; + } else { + String msg = checkNewCode(originUdiEntity, newCode); + if (msg != null) { + BaseResponse baseResponse = ResultVOUtils.error(501, msg); + baseResponse.setData(originCode); + return baseResponse; + } } -// else { -// return ResultVOUtils.success(code); -// } } else { - BaseResponse baseResponse = ResultVOUtils.error(501, "DI格式错误"); + BaseResponse baseResponse = ResultVOUtils.error(501, "格式错误"); baseResponse.setData(originCode); return baseResponse; } @@ -408,7 +433,7 @@ public class WareHouseController { UdiEntity udiEntity = FilterUdiUtils.getUdi(code); if (udiEntity == null) { - BaseResponse baseResponse = ResultVOUtils.error(501, "DI格式错误"); + BaseResponse baseResponse = ResultVOUtils.error(501, "UDI码格式错误"); baseResponse.setData(originCode); return baseResponse; } @@ -419,30 +444,31 @@ public class WareHouseController { } } + UdiRelevanceResponse checkUdi = udiRelevanceService.selectByNameCode(udiEntity.getUdi()); if (checkUdi == null) { return ResultVOUtils.error(500, "耗材字典不存在此产品!"); } boolean checkSuccess = true; + String lostMsg = ""; //校验条码完整性 - if (("是".equals(checkUdi.getScbssfbhph()) && StrUtil.isEmpty(udiEntity.getBatchNo()))) { - if (!checkUdi.isAllowNoBatch()) - checkSuccess = false; + if (!checkUdi.isAllowNoBatch() && StrUtil.isEmpty(udiEntity.getBatchNo())) { + checkSuccess = false; + lostMsg = lostMsg + ",批次号"; } - if (("是".equals(checkUdi.getScbssfbhscrq()) && StrUtil.isEmpty(udiEntity.getProduceDate())) - ) { - if (!checkUdi.isAllowNoProduct()) - checkSuccess = false; + if (!checkUdi.isAllowNoProduct() && StrUtil.isEmpty(udiEntity.getProduceDate())) { + checkSuccess = false; + lostMsg = lostMsg + ",生产日期"; } - if (("是".equals(checkUdi.getScbssfbhsxrq()) && StrUtil.isEmpty(udiEntity.getExpireDate())) - ) { - if (!checkUdi.isAllowNoExpire()) - checkSuccess = false; + if (!checkUdi.isAllowNoExpire() && StrUtil.isEmpty(udiEntity.getExpireDate())) { + checkSuccess = false; + lostMsg = lostMsg + ",失效日期"; } if (("是".equals(checkUdi.getScbssfbhxlh()) && StrUtil.isEmpty(udiEntity.getSerialNo())) ) { checkSuccess = false; + lostMsg = lostMsg + ",序列号"; } if (StrUtil.isNotEmpty(udiEntity.getSerialNo()) && udiEntity.getSerialNo().length() > 20) { checkSuccess = false; @@ -462,7 +488,10 @@ public class WareHouseController { return ResultVOUtils.success(code); } else { if (newCode.startsWith("21")) { - BaseResponse baseResponse = ResultVOUtils.error(503, "当前条码未完成,是否继续添加?"); + if (StrUtil.isEmpty(lostMsg)) { + lostMsg = ","; + } + BaseResponse baseResponse = ResultVOUtils.error(503, "条码完整性错误" + lostMsg.substring(1) + ",是否继续添加?"); baseResponse.setData(code); return baseResponse; } @@ -472,6 +501,25 @@ public class WareHouseController { return baseResponse; } + public String checkNewCode(UdiEntity originEnity, String newCode) { + UdiEntity newEntity = FilterUdiUtils.getUdi(originEnity.getUdi() + newCode); + if (newEntity == null || originEnity == null) { + return null; + } + if (StrUtil.isNotEmpty(originEnity.getBatchNo()) && StrUtil.isNotEmpty(newEntity.getBatchNo())) { + return "批次号重复添加!"; + } + if (StrUtil.isNotEmpty(originEnity.getProduceDate()) && StrUtil.isNotEmpty(newEntity.getProduceDate())) { + return "生产日期重复添加!"; + } + if (StrUtil.isNotEmpty(originEnity.getExpireDate()) && StrUtil.isNotEmpty(newEntity.getExpireDate())) { + return "失效日期重复添加!"; + } + if (StrUtil.isNotEmpty(originEnity.getSerialNo()) && StrUtil.isNotEmpty(newEntity.getSerialNo())) { + return "序列号重复添加!"; + } + return null; + } //网页端数据上传调用接口 @AuthRuleAnnotation("") @@ -571,8 +619,8 @@ public class WareHouseController { return ResultVOUtils.error(500, "超出预验收库存数量"); } } - }else { - if(invProductDetailEntity.getCount()<1){ + } else { + if (invProductDetailEntity.getCount() < 1) { return ResultVOUtils.error(500, "超出预验收库存数量"); } } @@ -828,20 +876,15 @@ public class WareHouseController { String errMsg = ""; UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByNameCode(udiEntity.getUdi()); - if (StrUtil.isEmpty(udiEntity.getBatchNo()) && - "是".equals(udiRelevanceResponse.getScbssfbhph()) && !udiRelevanceResponse.isAllowNoBatch()) { + if (StrUtil.isEmpty(udiEntity.getBatchNo()) && !udiRelevanceResponse.isAllowNoBatch()) { errMsg = errMsg + ",批次号"; } - if (StrUtil.isEmpty(udiEntity.getProduceDate()) && - "是".equals(udiRelevanceResponse.getScbssfbhscrq()) && !udiRelevanceResponse.isAllowNoProduct()) { + if (StrUtil.isEmpty(udiEntity.getProduceDate()) && !udiRelevanceResponse.isAllowNoProduct()) { errMsg = errMsg + ",生产日期"; } - if (StrUtil.isEmpty(udiEntity.getExpireDate()) && - "是".equals(udiRelevanceResponse.getScbssfbhsxrq()) && !udiRelevanceResponse.isAllowNoExpire()) { + if (StrUtil.isEmpty(udiEntity.getExpireDate()) && !udiRelevanceResponse.isAllowNoExpire()) { errMsg = errMsg + ",失效日期"; } - - if (StrUtil.isEmpty(udiEntity.getSerialNo()) && "是".equals(udiRelevanceResponse.getScbssfbhxlh())) { errMsg = errMsg + ",序列号"; @@ -892,11 +935,11 @@ public class WareHouseController { try { String customerId = getCustomerId(); - if(customerId.equals("110")){ + if (customerId.equals("110")) { Integer userId = customerService.getUserId(); postOrderRequest.setCustomerId(customerId); postOrderRequest.setUserId(userId); - }else { + } else { postOrderRequest.setUserId(null); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/OrderServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/OrderServiceImpl.java index 20da7d8..4efb4ad 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/OrderServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/OrderServiceImpl.java @@ -284,6 +284,8 @@ public class OrderServiceImpl implements OrderService { //更新数据 try { orderDao.insertOrder(supplementOrder); + order.setSupplementNo(supplementOrder.getId()); + orderDao.updateOrder(order); //更新配货单表对应单据的补单单号 stockOrderDao.updateSupplementNoByBillNo(billNo, supplementOrderNo); codesTempDao.insertCodesTemp(supplementCodes);