diff --git a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java index e2a76c42..1c22a971 100644 --- a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java @@ -79,7 +79,11 @@ public class IoAddInoutService { @Resource private IoOrderDetailCodeDao orderDetailCodeDao; - //新增扫码单据处理 + /** + * 新增扫码单据处理 + * + * @param orderEntity + */ public void dealProcess(IoOrderEntity orderEntity) { orderEntity.setErrMsg("正在处理!"); @@ -699,98 +703,68 @@ public class IoAddInoutService { } - - //duims上传单据 + /** + * udims上传单据 + * + * @param postOrderRequest + */ @Transactional public void creatOrderByUdims(PostUdimsOrderRequest postOrderRequest) { List postOrders = postOrderRequest.getOrderBeans(); if (postOrders != null && postOrders.size() > 0) { for (int i = 0; i < postOrders.size(); i++) { PostUdimsOrderRequest.OrderBean postOrder = postOrders.get(i); - //创建单据 - IoOrderEntity orderEntity = orderService.findByBillNo(postOrder.getOrderId()); - if (orderEntity != null) { - //已包含业务单据校验 -// orderEntity.setUpdateUser(postOrderRequest.getUserId() + ""); - orderEntity.setUpdateTime(new Date()); - orderService.update(orderEntity); - List pdaCodeEntities = postOrder.getCodes(); - if (pdaCodeEntities != null && pdaCodeEntities.size() > 0) { - PostUdimsOrderRequest.OrderBean.CodeBean pdaCodeEntity = pdaCodeEntities.get(0); - //写入条码 - List ioCodeEnttities = new ArrayList<>(); - for (int index = 0; index < pdaCodeEntities.size(); index++) { - IoCodeTempEntity codeEnttity = new IoCodeTempEntity(); - BeanUtils.copyProperties(pdaCodeEntities.get(index), codeEnttity); - codeEnttity.setAction(orderEntity.getAction()); - codeEnttity.setMainAction(orderEntity.getMainAction()); - codeEnttity.setDeptCode(orderEntity.getDeptCode()); - codeEnttity.setOrderId(orderEntity.getBillNo()); - codeEnttity.setInvCode(orderEntity.getInvCode()); - codeEnttity.setReCount(codeEnttity.getCount() * udiCalCountUtil.getActCount(codeEnttity.getNameCode())); - codeEnttity.setUpdateTime(new Date()); - codeEnttity.setCreateTime(DateUtil.parseDate(pdaCodeEntity.getActDate())); - ioCodeEnttities.add(codeEnttity); - } - codeTempService.insertBatch(ioCodeEnttities); - dealProcess(orderEntity); - if (!ioCheckInoutService.checkManual(orderEntity.getBillNo())) { - ioCheckInoutService.check(orderEntity.getBillNo()); - } - } - } else { - //创建新单据 - BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(postOrder.getAction()); - String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix()), "yyyyMMdd")); - IoOrderEntity orderSaveRequest = new IoOrderEntity(); - orderSaveRequest.setBillNo(orderNo); - orderSaveRequest.setMainAction(postOrder.getMainAction()); - orderSaveRequest.setAction(postOrder.getAction()); - orderSaveRequest.setCorpOrderId(postOrder.getCorpOrderId()); - orderSaveRequest.setFromCorp(postOrder.getFromCorp()); - orderSaveRequest.setCustomerId(postOrderRequest.getCustomerId()); - orderSaveRequest.setDeptCode(postOrder.getDeptCode()); - orderSaveRequest.setInvCode(postOrder.getInvStorageCode()); - orderSaveRequest.setStatus(ConstantStatus.ORDER_STATUS_PROCESS); - orderSaveRequest.setDealStatus(ConstantStatus.ORDER_DEAL_POST); + //创建新单据 + BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(postOrder.getAction()); + String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix()), "yyyyMMdd")); + IoOrderEntity orderSaveRequest = new IoOrderEntity(); + orderSaveRequest.setBillNo(orderNo); + orderSaveRequest.setMainAction(postOrder.getMainAction()); + orderSaveRequest.setAction(postOrder.getAction()); + orderSaveRequest.setCorpOrderId(postOrder.getOrderId()); + orderSaveRequest.setFromCorp(postOrder.getFromCorp()); + orderSaveRequest.setCustomerId(postOrderRequest.getCustomerId()); + orderSaveRequest.setDeptCode(postOrder.getDeptCode()); + orderSaveRequest.setInvCode(postOrder.getInvStorageCode()); + orderSaveRequest.setStatus(ConstantStatus.ORDER_STATUS_PROCESS); + orderSaveRequest.setDealStatus(ConstantStatus.ORDER_DEAL_POST); // orderSaveRequest.setCreateUser(postOrderRequest.getUserId() + ""); // orderSaveRequest.setUpdateUser(postOrderRequest.getUserId() + ""); - orderSaveRequest.setUpdateTime(new Date()); - orderSaveRequest.setBusType(bussinessTypeEntity.getBusType()); - orderSaveRequest.setOrderType(ConstantStatus.ORDER_TYPE_SCAN); - orderSaveRequest.setFromType(ConstantStatus.FROM_UDIMS); - List pdaCodeEntities = postOrder.getCodes(); - if (pdaCodeEntities != null && pdaCodeEntities.size() > 0) { - PostUdimsOrderRequest.OrderBean.CodeBean pdaCodeEntity = pdaCodeEntities.get(0); - if (pdaCodeEntity.getActDate() != null) { - orderSaveRequest.setCreateTime(DateUtil.parseDate(pdaCodeEntity.getActDate())); - } - //写入条码 - List ioCodeEnttities = new ArrayList<>(); - for (int index = 0; index < pdaCodeEntities.size(); index++) { - IoCodeTempEntity codeEnttity = new IoCodeTempEntity(); - BeanUtil.copyProperties(pdaCodeEntities.get(index), codeEnttity); - codeEnttity.setAction(orderSaveRequest.getAction()); - codeEnttity.setMainAction(orderSaveRequest.getMainAction()); - codeEnttity.setDeptCode(orderSaveRequest.getDeptCode()); - codeEnttity.setOrderId(orderSaveRequest.getBillNo()); - codeEnttity.setInvCode(orderSaveRequest.getInvCode()); - codeEnttity.setReCount(codeEnttity.getCount() * udiCalCountUtil.getActCount(codeEnttity.getNameCode())); - codeEnttity.setUpdateTime(new Date()); - codeEnttity.setCreateTime(DateUtil.parseDate(pdaCodeEntity.getActDate())); - ioCodeEnttities.add(codeEnttity); - } - codeTempService.insertBatch(ioCodeEnttities); + orderSaveRequest.setUpdateTime(new Date()); + orderSaveRequest.setBusType(bussinessTypeEntity.getBusType()); + orderSaveRequest.setOrderType(ConstantStatus.ORDER_TYPE_SCAN); + orderSaveRequest.setFromType(ConstantStatus.FROM_UDIMS); + List msCodeEntities = postOrder.getCodes(); + if (msCodeEntities != null && msCodeEntities.size() > 0) { + PostUdimsOrderRequest.OrderBean.CodeBean msCodeEntity = msCodeEntities.get(0); + if (msCodeEntity.getActDate() != null) { + orderSaveRequest.setCreateTime(DateUtil.parseDate(msCodeEntity.getActDate())); } - orderService.insertOrder(orderSaveRequest); - dealProcess(orderSaveRequest); - if (!ioCheckInoutService.checkManual(orderEntity.getBillNo())) { - ioCheckInoutService.check(orderEntity.getBillNo()); + //写入条码 + List ioCodeEnttities = new ArrayList<>(); + for (int index = 0; index < msCodeEntities.size(); index++) { + IoCodeTempEntity codeEnttity = new IoCodeTempEntity(); + BeanUtil.copyProperties(msCodeEntities.get(index), codeEnttity); + codeEnttity.setAction(orderSaveRequest.getAction()); + codeEnttity.setMainAction(orderSaveRequest.getMainAction()); + codeEnttity.setDeptCode(orderSaveRequest.getDeptCode()); + codeEnttity.setOrderId(orderSaveRequest.getBillNo()); + codeEnttity.setInvCode(orderSaveRequest.getInvCode()); + codeEnttity.setReCount(codeEnttity.getCount() * udiCalCountUtil.getActCount(codeEnttity.getNameCode())); + codeEnttity.setUpdateTime(new Date()); + codeEnttity.setCreateTime(DateUtil.parseDate(msCodeEntity.getActDate())); + ioCodeEnttities.add(codeEnttity); } + codeTempService.insertBatch(ioCodeEnttities); + } + orderService.insertOrder(orderSaveRequest); + dealProcess(orderSaveRequest); + if (!ioCheckInoutService.checkManual(orderSaveRequest.getBillNo())) { + ioCheckInoutService.check(orderSaveRequest.getBillNo()); } + } - } } } diff --git a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java index e4a9e21b..64efb7a9 100644 --- a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java @@ -78,7 +78,11 @@ public class IoCheckInoutService { @Resource IoAddInoutService addInoutService; - //判断是否需要手动校验 + /** + * 判断是否需要手动校验 + * @param billNo + * @return + */ public boolean checkManual(String billNo) { IoOrderEntity orderEntity = orderService.findByBillNo(billNo); BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction()); @@ -126,7 +130,10 @@ public class IoCheckInoutService { } } - //校验流程 //一次校验 + /** + * 校验流程 | 一次校验 + * @param orderId + */ public void check(String orderId) { IoOrderEntity orderEntity = orderService.findByBillNo(orderId); //过滤非未校验或校验异常