From cc3bcdbee2837a759ddde3f52c1b6e8201ec27ea Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Thu, 13 Jun 2024 14:29:22 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=BC=80=E5=8D=95=E9=80=BB=E8=BE=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/IOpenOrderAsyncService.java | 2 + .../ITrunklineBillladingWaybillService.java | 2 + .../impl/OpenOrderAsyncServiceImpl.java | 76 ++++++++++++++++++- .../service/impl/OpenOrderServiceImpl.java | 51 +------------ .../impl/TrunklineAdvanceServiceImpl.java | 11 ++- ...TrunklineBillladingWaybillServiceImpl.java | 10 +++ .../TrunklineWaybillPackageServiceImpl.java | 24 +++--- 7 files changed, 110 insertions(+), 66 deletions(-) diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderAsyncService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderAsyncService.java index be21ae505..a2447b480 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderAsyncService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderAsyncService.java @@ -26,4 +26,6 @@ public interface IOpenOrderAsyncService { void sendOpenWaybillFanout(WarehouseWaybillEntity waybillEntity, List details, List advanceIds); void sendUpdateWaybillFanout(WarehouseWaybillEntity waybillEntity, List details, List advanceIds); + + void dealwithBillladingInfo(List advanceIds,Long warehouseId,String warehouseName,Long waybillId,String waybillNo); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineBillladingWaybillService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineBillladingWaybillService.java index 2251baff1..f8f1ff4f9 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineBillladingWaybillService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineBillladingWaybillService.java @@ -39,4 +39,6 @@ public interface ITrunklineBillladingWaybillService extends BaseService findNoFinishWaybillByBillladingId(Long billladingId); TrunklineBillladingNumVO getNumVOByBillladingId(Long billladingId); + + List getNoDataWaybillByBillladingIds(List billladingIds); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java index 8dfddd14d..7b87e3174 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java @@ -7,10 +7,9 @@ import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity; import com.logpm.basicdata.feign.IBasicdataClientClient; import com.logpm.basicdata.feign.IBasicdataStoreBusinessClient; import com.logpm.trunkline.dto.InComingDTO; -import com.logpm.trunkline.entity.TrunklineCarsLoadEntity; -import com.logpm.trunkline.entity.TrunklineCarsLoadLineEntity; -import com.logpm.trunkline.entity.TrunklineWaybillTrackEntity; +import com.logpm.trunkline.entity.*; import com.logpm.trunkline.service.*; +import com.logpm.trunkline.vo.BillladingPackageVO; import com.logpm.trunkline.vo.LoadScanWaybillVO; import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO; import com.logpm.warehouse.entity.WarehouseWayBillDetail; @@ -33,6 +32,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; import java.util.stream.Collectors; @Service @@ -62,6 +62,10 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService { private IBasicdataClientClient basicdataClientClient; @Autowired private IBasicdataStoreBusinessClient basicdataStoreBusinessClient; + @Autowired + private ITrunklineBillladingWaybillService trunklineBillladingWaybillService; + @Autowired + private ITrunklineBillladingService trunklineBillladingService; @LogpmAsync("asyncExecutor") @Override @@ -815,6 +819,72 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService { } + @LogpmAsync("asyncExecutor") + @Override + public void dealwithBillladingInfo(List advanceIds,Long warehouseId,String warehouseName,Long waybillId,String waybillNo) { + + List billladingPackageList = advanceDetailService.findBillladingPackageByAdvanceIdsAnd(advanceIds); + List addBillladingWaybillEntities = new ArrayList<>(); + List updateBillladingWaybillEntities = new ArrayList<>(); + + List updateFeeBilllading = new ArrayList<>(); + + //把billladingPackageList转化成以billladingId为key的Map,以billladingId为key,value为BillladingPackageVO + Map billladingPackageMap = billladingPackageList.stream().collect(Collectors.toMap(BillladingPackageVO::getBillladingId, Function.identity())); + + List billladingIds = new ArrayList<>(billladingPackageMap.keySet()); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("id", billladingIds) + .eq("is_deleted", 0) + .eq("billlading_status", "2"); + List billladingEntities = trunklineBillladingService.list(queryWrapper); + + //把billladingEntities转化成以id为key的Map + Map billladingMap = billladingEntities.stream().collect(Collectors.toMap(TrunklineBillladingEntity::getId, Function.identity())); + + List billladingWaybillEntities = trunklineBillladingWaybillService.getNoDataWaybillByBillladingIds(billladingIds); + + //把billladingWaybillEntities转化成以billladingId为key的Map + Map billladingWaybillMap = billladingWaybillEntities.stream().collect(Collectors.toMap(TrunklineBillladingWaybillEntity::getId, Function.identity())); + + billladingPackageMap.keySet().forEach(billladingId -> { + BillladingPackageVO billladingPackageVO = billladingPackageMap.get(billladingId); + Integer num = billladingPackageVO.getNum(); + TrunklineBillladingWaybillEntity billladingWaybillEntity = billladingWaybillMap.get(billladingId); + if(!Objects.isNull(billladingWaybillEntity)){ + TrunklineBillladingEntity billladingEntity = billladingMap.get(billladingId); + Integer realNum = billladingWaybillEntity.getRealNum(); + if (realNum > num) { + billladingWaybillEntity.setRealNum(realNum - num); + } else if (realNum.equals(num)) { + billladingWaybillEntity.setRealNum(0); + billladingWaybillEntity.setIsDeleted(1); + } + updateBillladingWaybillEntities.add(billladingWaybillEntity); + TrunklineBillladingWaybillEntity addbillladingWaybillEntity = new TrunklineBillladingWaybillEntity(); + addbillladingWaybillEntity.setWarehouseId(warehouseId); + addbillladingWaybillEntity.setWarehouseName(warehouseName); + addbillladingWaybillEntity.setBillladingId(billladingId); + addbillladingWaybillEntity.setBilladingCode(billladingEntity.getBillladingCode()); + addbillladingWaybillEntity.setWaybillId(waybillId); + addbillladingWaybillEntity.setWaybillNo(waybillNo); + addbillladingWaybillEntity.setRealNum(num); + addbillladingWaybillEntity.setRealVolume(BigDecimal.ZERO); + addbillladingWaybillEntity.setRealWeight(BigDecimal.ZERO); + addBillladingWaybillEntities.add(addbillladingWaybillEntity); + updateFeeBilllading.add(billladingEntity); + } + }); + + trunklineBillladingWaybillService.updateBatchById(updateBillladingWaybillEntities); + trunklineBillladingWaybillService.saveBatch(addBillladingWaybillEntities); + + //更新提货单对应的运单的提货费用 + for (TrunklineBillladingEntity billladingEntity : updateFeeBilllading) { + trunklineBillladingWaybillService.updateBillladingFeeByBillladingId(billladingEntity); + } + } } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java index 91a6a7d7b..6e5bb7afd 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java @@ -579,54 +579,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceService.updateBatchById(advanceEntityList); //计算扫码入库的包件是否需要把运单和提货单挂上 - List billladingPackageList = advanceDetailService.findBillladingPackageByAdvanceIdsAnd(advanceIds); - List billladingWaybillEntities = new ArrayList<>(); - - List updateFeeBilllading = new ArrayList<>(); - - for (BillladingPackageVO billladingPackageVO : billladingPackageList) { - Long billladingId = billladingPackageVO.getBillladingId(); - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("id", billladingId) - .eq("is_deleted", 0) - .eq("billlading_status", "2"); - TrunklineBillladingEntity billladingEntity = trunklineBillladingService.getOne(queryWrapper); - if (Objects.isNull(billladingEntity)) { - log.info("#################openWaybill: 提货单信息不存在 billladingId={}", billladingId); - continue; - } - Integer num = billladingPackageVO.getNum(); - TrunklineBillladingWaybillEntity trunklineBillladingWaybillEntity = trunklineBillladingWaybillService.getNoDataWaybillByBillladingId(billladingId); - - if (!Objects.isNull(trunklineBillladingWaybillEntity)) { - Integer realNum = trunklineBillladingWaybillEntity.getRealNum(); - if (realNum > num) { - trunklineBillladingWaybillEntity.setRealNum(realNum - num); - } else if (realNum.equals(num)) { - trunklineBillladingWaybillEntity.setRealNum(0); - trunklineBillladingWaybillEntity.setIsDeleted(1); - } - trunklineBillladingWaybillService.updateById(trunklineBillladingWaybillEntity); - TrunklineBillladingWaybillEntity billladingWaybillEntity = new TrunklineBillladingWaybillEntity(); - billladingWaybillEntity.setWarehouseId(warehouseId); - billladingWaybillEntity.setWarehouseName(basicdataWarehouseEntity.getName()); - billladingWaybillEntity.setBillladingId(billladingId); - billladingWaybillEntity.setBilladingCode(billladingEntity.getBillladingCode()); - billladingWaybillEntity.setWaybillId(waybillId); - billladingWaybillEntity.setWaybillNo(waybillNo); - billladingWaybillEntity.setRealNum(num); - billladingWaybillEntity.setRealVolume(BigDecimal.ZERO); - billladingWaybillEntity.setRealWeight(BigDecimal.ZERO); - billladingWaybillEntities.add(billladingWaybillEntity); - updateFeeBilllading.add(billladingEntity); - } - } - trunklineBillladingWaybillService.saveBatch(billladingWaybillEntities); - - //更新提货单对应的运单的提货费用 - for (TrunklineBillladingEntity billladingEntity : updateFeeBilllading) { - trunklineBillladingWaybillService.updateBillladingFeeByBillladingId(billladingEntity); - } + openOrderAsyncService.dealwithBillladingInfo(advanceIds,warehouseId,warehouseName,waybillId,waybillNo); //判断是否是开单及入库的配置 Boolean aBoolean = basicdataOpenIncomingClient.checkOpenIncoming(warehouseId, brandId); @@ -646,7 +599,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Integer totalCount = waybillEntity.getTotalCount(); Integer stockCount = waybillEntity.getStockCount(); - if (totalCount.equals(stockCount)) { + if (stockCount > 0) { createOperationRemark = "运单入库:" + stockCount + "/" + totalCount + ",入库类型:【开单前已入库】,入库时间:" + CommonUtil.dateToStringGeneral(new Date()); openOrderAsyncService.saveLog(waybillId, waybillNo, "20", "已入库", createOperationRemark, nickName, userId, warehouseId, warehouseName); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java index d4c6dfc4e..b7b6cea73 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java @@ -675,7 +675,10 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl updateWaybillList = new ArrayList<>(); parcelListEntityMap.keySet().forEach(waybillNo->{ + WarehouseWaybillEntity updateWaybill = new WarehouseWaybillEntity(); WarehouseWaybillEntity waybillEntity = waybillEntityMap.get(waybillNo); if(!Objects.isNull(waybillEntity)){ @@ -1001,8 +1005,9 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.eq("waybill_no","————") + .eq("billlading_id",billladingId) .eq("is_deleted",0); return baseMapper.selectOne(queryWrapper); } @@ -149,4 +150,13 @@ public class TrunklineBillladingWaybillServiceImpl extends BaseServiceImpl getNoDataWaybillByBillladingIds(List billladingIds) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("waybill_no","————") + .in("billlading_id",billladingIds) + .eq("is_deleted",0); + return baseMapper.selectList(queryWrapper); + } + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java index fbb9aaf5f..5f93638e5 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java @@ -74,6 +74,8 @@ public class TrunklineWaybillPackageServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.eq("waybill_no",waybillEntity.getWaybillNo()) .eq("is_deleted",0); @@ -104,44 +106,44 @@ public class TrunklineWaybillPackageServiceImpl extends BaseServiceImpl 0){ if(signNum == size){ - waybillEntity.setWaybillStatus("100"); + updateWaybillEntity.setWaybillStatus("100"); }else{ - waybillEntity.setWaybillStatus("90"); + updateWaybillEntity.setWaybillStatus("90"); } }else{ if(deliveryNum > 0){ if (deliveryNum == size){ - waybillEntity.setWaybillStatus("80"); + updateWaybillEntity.setWaybillStatus("80"); }else { - waybillEntity.setWaybillStatus("70"); + updateWaybillEntity.setWaybillStatus("70"); } }else{ if(unloadNum > 0){ if (unloadNum == size){ - waybillEntity.setWaybillStatus("60"); + updateWaybillEntity.setWaybillStatus("60"); }else { - waybillEntity.setWaybillStatus("50"); + updateWaybillEntity.setWaybillStatus("50"); } }else{ if(transferNum > 0){ if (transferNum == size){ - waybillEntity.setWaybillStatus("40"); + updateWaybillEntity.setWaybillStatus("40"); }else { - waybillEntity.setWaybillStatus("30"); + updateWaybillEntity.setWaybillStatus("30"); } }else{ if(incomingNum > 0){ if (incomingNum == size){ - waybillEntity.setWaybillStatus("20"); + updateWaybillEntity.setWaybillStatus("20"); }else { - waybillEntity.setWaybillStatus("10"); + updateWaybillEntity.setWaybillStatus("10"); } } } } } } - warehouseWaybillClient.updateEntity(waybillEntity); + warehouseWaybillClient.updateEntity(updateWaybillEntity); } @Override