From 433de655190dcad32a24f3203ecbeb6cf4cb2b14 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Thu, 18 Jul 2024 15:47:41 +0800 Subject: [PATCH] =?UTF-8?q?1.bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../distribution/vo/OrderCodeDataVO.java | 1 + .../DistributionStockArticleServiceImpl.java | 22 +++ .../impl/TrunklineCarsLoadServiceImpl.java | 135 +++++++++--------- 3 files changed, 93 insertions(+), 65 deletions(-) diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/OrderCodeDataVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/OrderCodeDataVO.java index 3410ca6c4..1f74fe21b 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/OrderCodeDataVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/OrderCodeDataVO.java @@ -19,5 +19,6 @@ public class OrderCodeDataVO { @ApiModelProperty(value = "模板填充内容") private List> dataList; + private List moldList; } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java index 2d744b305..23cb05820 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java @@ -2480,6 +2480,18 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl moldList = new ArrayList<>(); + data.forEach(map -> { + try { + String popHtml = TemplateUtil.popTemplate("订单码", map, html); + moldList.add(popHtml); + } catch (Exception e) { + throw new RuntimeException(e); + } + }); + orderCodeDataVO.setMoldList(moldList); + + return orderCodeDataVO; } @@ -2545,6 +2557,16 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl moldList = new ArrayList<>(); + data.forEach(map -> { + try { + String popHtml = TemplateUtil.popTemplate("订单码", map, html); + moldList.add(popHtml); + } catch (Exception e) { + throw new RuntimeException(e); + } + }); + return orderCodeDataVO; } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java index dbd82f7df..abdb5f4d0 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java @@ -4517,76 +4517,81 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl carsOrderEntityList = trunklineCarsOrderService.listByIds(carsOrderIdList); //移除carsOrderEntityList中signNum不为0的元素 carsOrderEntityList.removeIf(e -> e.getSignNum() != 0); - //把carsOrderEntityList通过signOrderId进行分组 - Map> collect = carsOrderEntityList.stream().collect(Collectors.groupingBy(TrunklineCarsOrderEntity::getSignOrderId)); - Set signOrderIds = collect.keySet(); - List signOrderEntityList = trunklineLoadSignOrderService.listByIds(signOrderIds); - //把signOrderEntityList转化成id为key的Map - Map signOrderEntityMap = signOrderEntityList.stream().collect(Collectors.toMap(TrunklineLoadSignOrderEntity::getId, Function.identity())); - - - List updateCarsOrderList = new ArrayList<>(); - List updateSignOrderList = new ArrayList<>(); - List delSignOrderList = new ArrayList<>(); - - Long finalLoadId1 = loadId; - collect.keySet().forEach(signOrderId -> { - List list = collect.get(signOrderId); - TrunklineLoadSignOrderEntity trunklineLoadSignOrderEntity = signOrderEntityMap.get(signOrderId); - //把list中所有元素的realNum求和 - int sumLoading = list.stream().mapToInt(TrunklineCarsOrderEntity::getRealNum).sum(); - int sumPlan = list.stream().mapToInt(TrunklineCarsOrderEntity::getPlanNum).sum(); - Integer planNum = trunklineLoadSignOrderEntity.getPlanNum(); - Integer loadingNum = trunklineLoadSignOrderEntity.getLoadingNum(); - Integer signNum = trunklineLoadSignOrderEntity.getSignNum(); - if(sumPlan < planNum){ - //只是更新不删除 - TrunklineLoadSignOrderEntity updateSignOrderEntity = new TrunklineLoadSignOrderEntity(); - updateSignOrderEntity.setId(trunklineLoadSignOrderEntity.getId()); - int diff = planNum - sumPlan; - updateSignOrderEntity.setPlanNum(diff); - updateSignOrderEntity.setLoadingNum(loadingNum-sumLoading); - if(signNum >= diff){ - updateSignOrderEntity.setSignStatus("20"); - }else if(signNum == 0){ - updateSignOrderEntity.setSignStatus("0"); + if(CollUtil.isNotEmpty(carsOrderEntityList)){ + //把carsOrderEntityList通过signOrderId进行分组 + Map> collect = carsOrderEntityList.stream().collect(Collectors.groupingBy(TrunklineCarsOrderEntity::getSignOrderId)); + Set signOrderIds = collect.keySet(); + List signOrderEntityList = trunklineLoadSignOrderService.listByIds(signOrderIds); + //把signOrderEntityList转化成id为key的Map + Map signOrderEntityMap = signOrderEntityList.stream().collect(Collectors.toMap(TrunklineLoadSignOrderEntity::getId, Function.identity())); + + + List updateCarsOrderList = new ArrayList<>(); + List updateSignOrderList = new ArrayList<>(); + List delSignOrderList = new ArrayList<>(); + + Long finalLoadId1 = loadId; + collect.keySet().forEach(signOrderId -> { + List list = collect.get(signOrderId); + TrunklineLoadSignOrderEntity trunklineLoadSignOrderEntity = signOrderEntityMap.get(signOrderId); + //把list中所有元素的realNum求和 + int sumLoading = list.stream().mapToInt(TrunklineCarsOrderEntity::getRealNum).sum(); + int sumPlan = list.stream().mapToInt(TrunklineCarsOrderEntity::getPlanNum).sum(); + Integer planNum = trunklineLoadSignOrderEntity.getPlanNum(); + Integer loadingNum = trunklineLoadSignOrderEntity.getLoadingNum(); + Integer signNum = trunklineLoadSignOrderEntity.getSignNum(); + if(sumPlan < planNum){ + //只是更新不删除 + TrunklineLoadSignOrderEntity updateSignOrderEntity = new TrunklineLoadSignOrderEntity(); + updateSignOrderEntity.setId(trunklineLoadSignOrderEntity.getId()); + int diff = planNum - sumPlan; + updateSignOrderEntity.setPlanNum(diff); + updateSignOrderEntity.setLoadingNum(loadingNum-sumLoading); + if(signNum >= diff){ + updateSignOrderEntity.setSignStatus("20"); + }else if(signNum == 0){ + updateSignOrderEntity.setSignStatus("0"); + }else{ + updateSignOrderEntity.setSignStatus("10"); + } + updateSignOrderList.add(updateSignOrderEntity); }else{ - updateSignOrderEntity.setSignStatus("10"); + //删除 + delSignOrderList.add(signOrderId); } - updateSignOrderList.add(updateSignOrderEntity); - }else{ - //删除 - delSignOrderList.add(signOrderId); - } - - list.forEach(e -> { - TrunklineCarsOrderEntity carsOrderEntity = new TrunklineCarsOrderEntity(); - carsOrderEntity.setId(e.getId()); - carsOrderEntity.setOrderCode(e.getOrderCode()); - carsOrderEntity.setWaybillNo(e.getWaybillNo()); - carsOrderEntity.setLoadId(finalLoadId1); - carsOrderEntity.setNodeId(e.getNodeId()); - updateCarsOrderList.add(carsOrderEntity); - }); - }); + list.forEach(e -> { + TrunklineCarsOrderEntity carsOrderEntity = new TrunklineCarsOrderEntity(); + carsOrderEntity.setId(e.getId()); + carsOrderEntity.setOrderCode(e.getOrderCode()); + carsOrderEntity.setWaybillNo(e.getWaybillNo()); + carsOrderEntity.setLoadId(finalLoadId1); + carsOrderEntity.setNodeId(e.getNodeId()); + updateCarsOrderList.add(carsOrderEntity); + }); - if(CollUtil.isNotEmpty(updateSignOrderList)){ - trunklineLoadSignOrderService.updateBatchById(updateSignOrderList); - } - if(CollUtil.isNotEmpty(delSignOrderList)){ - trunklineLoadSignOrderService.deleteListBySignOrderIds(delSignOrderList); - } - if(CollUtil.isNotEmpty(updateCarsOrderList)){ - //把updateCarsOrderIdList所有的id放入一个List - List updateCarsOrderIdList = updateCarsOrderList.stream().map(TrunklineCarsOrderEntity::getId).collect(Collectors.toList()); - trunklineCarsOrderService.updateNoCustomer(updateCarsOrderIdList); - updateCarsOrderList.forEach(e -> { - Long nodeId = e.getNodeId(); - String orderCode = e.getOrderCode(); - String waybillNo = e.getWaybillNo(); - trunklineCarsLoadScanService.clearSignOrderIdByLoadIdAndWarehouseIdAndOrderCodeAndWaybillNo(finalLoadId1,nodeId,orderCode,waybillNo); }); + + if(CollUtil.isNotEmpty(updateSignOrderList)){ + trunklineLoadSignOrderService.updateBatchById(updateSignOrderList); + } + if(CollUtil.isNotEmpty(delSignOrderList)){ + trunklineLoadSignOrderService.deleteListBySignOrderIds(delSignOrderList); + } + if(CollUtil.isNotEmpty(updateCarsOrderList)){ + //把updateCarsOrderIdList所有的id放入一个List + List updateCarsOrderIdList = updateCarsOrderList.stream().map(TrunklineCarsOrderEntity::getId).collect(Collectors.toList()); + trunklineCarsOrderService.updateNoCustomer(updateCarsOrderIdList); + updateCarsOrderList.forEach(e -> { + Long nodeId = e.getNodeId(); + String orderCode = e.getOrderCode(); + String waybillNo = e.getWaybillNo(); + trunklineCarsLoadScanService.clearSignOrderIdByLoadIdAndWarehouseIdAndOrderCodeAndWaybillNo(finalLoadId1,nodeId,orderCode,waybillNo); + }); + } + }else{ + log.warn("###############updateWaybillOrderIsCustemer: 订单已有签收数据不能移除"); + return R.fail(405,"订单已有签收数据,不能移除"); } }