diff --git a/blade-service-api/logpm-aftersales-api/src/main/java/com/logpm/aftersales/vo/DealWithAbnormalVO.java b/blade-service-api/logpm-aftersales-api/src/main/java/com/logpm/aftersales/vo/DealWithAbnormalVO.java index ee2bb23c1..481741a63 100644 --- a/blade-service-api/logpm-aftersales-api/src/main/java/com/logpm/aftersales/vo/DealWithAbnormalVO.java +++ b/blade-service-api/logpm-aftersales-api/src/main/java/com/logpm/aftersales/vo/DealWithAbnormalVO.java @@ -18,4 +18,6 @@ public class DealWithAbnormalVO implements Serializable { private Long userId; + private String remark; + } diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/RetentionCarsLoadVO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/RetentionCarsLoadVO.java new file mode 100644 index 000000000..6a2083cf1 --- /dev/null +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/RetentionCarsLoadVO.java @@ -0,0 +1,19 @@ +package com.logpm.trunkline.vo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class RetentionCarsLoadVO implements Serializable { + + + private Long scanId; + private Long loadId; + private String loadCode; + private String orderPackageCode; + private Long warehouseId; + private String warehouseName; + + +} diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/feign/AftersalesAbnormalRecordClient.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/feign/AftersalesAbnormalRecordClient.java index f34849e41..399c729c5 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/feign/AftersalesAbnormalRecordClient.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/feign/AftersalesAbnormalRecordClient.java @@ -71,6 +71,7 @@ public class AftersalesAbnormalRecordClient implements IAftersalesAbnormalRecord String warehouseName = dealWithAbnormalVO.getWarehouseName(); String nickName = dealWithAbnormalVO.getNickName(); Long userId = dealWithAbnormalVO.getUserId(); + String remark = dealWithAbnormalVO.getRemark(); List abnormalRecordEntities = aftersalesAbnormalRecordService.findListByOrderPackageCodes(orderPackageCodes); diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java index 754279061..a5029c698 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java @@ -391,6 +391,8 @@ public class AftersalesAbnormalRecordServiceImpl extends BaseServiceImpl loadScanIds = loadCarsDTO.getLoadScanIds(); + + try{ + + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + if(Objects.isNull(myCurrentWarehouse)){ + log.warn(method+"请选择指定仓库"); + return R.fail(405,"请选择指定仓库"); + } + Long warehouseId = myCurrentWarehouse.getId(); + String warehouseName = myCurrentWarehouse.getName(); + + return carsLoadService.retentionCarsLoadPackage(loadScanIds,warehouseId,warehouseName); + }catch (CustomerException e){ + log.error(e.message,e); + return R.fail(e.code,e.message); + }catch (Exception e){ + log.error(method+"系统异常",e); + return R.fail(500,"系统异常"); + } + } + + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java index 9dd6fc76c..87642e298 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java @@ -3056,7 +3056,4 @@ public class CarsLoadController { } } - - - } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadLineMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadLineMapper.java index d8a3fecf3..5f94747be 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadLineMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadLineMapper.java @@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.math.BigDecimal; +import java.util.Date; import java.util.List; @Mapper @@ -25,4 +26,5 @@ public interface TrunklineCarsLoadLineMapper extends BaseMapper + + update logpm_trunkline_cars_load_line + set start_date = #{date}, + node_status = #{nodeStatus}, + start_user_id = #{userId}, + start_user_name = #{nickName} + where load_id = #{lineId} + and id = #{lineId} + + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java index 3505cd571..16d3e5ab9 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java @@ -201,4 +201,6 @@ public interface TrunklineCarsLoadScanMapper extends BaseMapper findListByIdsAndType(@Param("carsLoadScanIdList") List carsLoadScanIdList, @Param("type") int type); void updateWaybillInfoByOrderPackageCodes(@Param("orderPackageCodeList") List orderPackageCodeList, @Param("waybillId") Long waybillId, @Param("waybillNo") String waybillNo); + + List findRetentionPackage(@Param("orderPackageCode") String orderPackageCode, @Param("warehouseId") Long warehouseId); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml index 0c5ee9dea..719f4dff6 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml @@ -1202,5 +1202,20 @@ + + + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadLineService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadLineService.java index 6abcff9ad..ff3e2c8e2 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadLineService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadLineService.java @@ -4,6 +4,7 @@ import com.logpm.trunkline.entity.TrunklineCarsLoadLineEntity; import org.springblade.core.mp.base.BaseService; import java.math.BigDecimal; +import java.util.Date; import java.util.List; public interface ITrunklineCarsLoadLineService extends BaseService { @@ -28,4 +29,5 @@ public interface ITrunklineCarsLoadLineService extends BaseService findListByIdsAndType(List carsLoadScanIdList, int type); void updateWaybillInfoByOrderPackageCodes(List orderPackageCodeList, Long waybillId, String waybillNo); + + List findRetentionPackage(String orderPackageCode, Long warehouseId); + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java index 94c747ffe..f3d80ccf3 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java @@ -279,4 +279,7 @@ public interface ITrunklineCarsLoadService extends BaseService loadScanIds, Long warehouseId, String warehouseName); + R findRetentionCarsLoadPackage(String orderPackageCode, Long warehouseId, String warehouseName); + + R retentionCarsLoadPackage(List loadScanIds, Long warehouseId, String warehouseName); } 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 f86689e9f..b3358f0c9 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 @@ -1474,6 +1474,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService { InputStream inputStream = file.getInputStream(); List pacakgeDetailExcelDTOS = EasyExcel.read(inputStream).head(PacakgeDetailExcelDTO.class).sheet(0).headRowNumber(2).doReadSync(); + pacakgeDetailExcelDTOS.forEach(dto -> { + dto.setOrderCode(dto.getOrderCode().trim()); + dto.setOrderPackageCode(dto.getOrderPackageCode().trim()); + }); //排除pacakgeDetailExcelDTOS中的orderPackageCode为空的元素 pacakgeDetailExcelDTOS = pacakgeDetailExcelDTOS.stream().filter(item -> StringUtil.isNotBlank(item.getOrderPackageCode())).collect(Collectors.toList()); //把importStandardOuPaiDTOS中orderPackageCode相同的元素去重 @@ -1841,6 +1845,12 @@ public class OpenOrderServiceImpl implements IOpenOrderService { long start = System.currentTimeMillis(); List importCustomizedOuPaiDTOS = EasyExcel.read(inputStream).head(ImportCustomizedOuPaiDTO.class).sheet(0).headRowNumber(1).doReadSync(); + //把importCustomizedOuPaiDTOS中orderCode和orderPackageCode去空格 + importCustomizedOuPaiDTOS.forEach(dto -> { + dto.setOrderCode(dto.getOrderCode().trim()); + dto.setOrderPackageCode(dto.getOrderPackageCode().trim()); + }); + //判断importCustomizedOuPaiDTOS中firstsName有值的数量 long countWithMaterialName = importCustomizedOuPaiDTOS.stream() .filter(dto -> StringUtil.isNotBlank(dto.getFirstsName())) @@ -1854,6 +1864,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService { importCustomizedOuPaiDTOS = importCustomizedOuPaiDTOS.stream().filter(item -> StringUtil.isNotBlank(item.getOrderPackageCode())).collect(Collectors.toList()); //把importStandardOuPaiDTOS中orderPackageCode相同的元素去重 importCustomizedOuPaiDTOS = importCustomizedOuPaiDTOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ImportCustomizedOuPaiDTO::getOrderPackageCode))), ArrayList::new)); + //去除importCustomizedOuPaiDTOS中字段的空格 + + //提取出合包码不为空的数据 List mergeDataList = importCustomizedOuPaiDTOS.stream().filter(item -> StringUtil.isNotBlank(item.getMergeCode())).collect(Collectors.toList()); @@ -2188,6 +2201,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService { //读取inputStream中Excel的表头数据 List importStandardOuPaiDTOS = EasyExcel.read(inputStream).head(ImportStandardOuPaiDTO.class).sheet(0).headRowNumber(1).doReadSync(); + importStandardOuPaiDTOS.forEach(dto -> { + dto.setOrderCode(dto.getOrderCode().trim()); + dto.setOrderPackageCode(dto.getOrderPackageCode().trim()); + }); //判断importStandardOuPaiDTOS中materialName有值的数量 long countWithMaterialName = importStandardOuPaiDTOS.stream() .filter(dto -> StringUtil.isNotBlank(dto.getMaterialName())) @@ -3125,6 +3142,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService { InputStream inputStream = file.getInputStream(); List importOrderNoPackageExcelDTOS = EasyExcel.read(inputStream).head(ImportOrderNoPackageExcelDTO.class).sheet(0).headRowNumber(2).doReadSync(); + importOrderNoPackageExcelDTOS.forEach(dto -> { + dto.setOrderCode(dto.getOrderCode().trim()); + }); //过滤掉importOrderNoPackageExcelDTOS中orderCode为空的数据 importOrderNoPackageExcelDTOS = importOrderNoPackageExcelDTOS.stream().filter(item -> StringUtil.isNotBlank(item.getOrderCode())).collect(Collectors.toList()); @@ -3375,7 +3395,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService { InputStream inputStream = file.getInputStream(); List importOrderNoPackageExcelDTOS = EasyExcel.read(inputStream).head(ImportOrderNoPackageExcelDTO.class).sheet(0).headRowNumber(2).doReadSync(); - + importOrderNoPackageExcelDTOS.forEach(dto -> { + dto.setOrderCode(dto.getOrderCode().trim()); + }); //过滤掉importOrderNoPackageExcelDTOS中orderCode为空的数据 importOrderNoPackageExcelDTOS = importOrderNoPackageExcelDTOS.stream().filter(item -> StringUtil.isNotBlank(item.getOrderCode())).collect(Collectors.toList()); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadLineServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadLineServiceImpl.java index 2242d5bfe..cdfcac177 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadLineServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadLineServiceImpl.java @@ -10,6 +10,7 @@ import org.springblade.core.mp.base.BaseServiceImpl; import org.springframework.stereotype.Service; import java.math.BigDecimal; +import java.util.Date; import java.util.List; @Slf4j @@ -77,4 +78,9 @@ public class TrunklineCarsLoadLineServiceImpl extends BaseServiceImpl findRetentionPackage(String orderPackageCode, Long warehouseId) { + return baseMapper.findRetentionPackage(orderPackageCode,warehouseId); + } + } 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 3f54dab45..65db4975d 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 @@ -305,11 +305,11 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl !Objects.isNull(scan.getWarehouseId())).mapToInt(TrunklineCarsLoadScanEntity::getNum).sum(); ///把scanList中scanStatus不为1的unloadNum值求和 为空则用0代替 - Integer realUnloadingNum = scanList.stream().filter(scan -> !Objects.isNull(scan.getScanStatus()) && !scan.getScanStatus().equals("1")).mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum(); + Integer realUnloadingNum = scanList.stream().filter(scan -> !Objects.isNull(scan.getScanStatus()) && !scan.getScanStatus().equals("1") && !scan.getScanStatus().equals("4")).mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum(); Integer stockCarNum = scanList.stream().filter(scan -> !Objects.isNull(scan.getScanStatus()) && scan.getScanStatus().equals("1")).mapToInt(TrunklineCarsLoadScanEntity::getNum).sum(); carsLoadEntity.setPlanLoadingNumber(loadPlanNum); @@ -1649,7 +1644,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl !Objects.isNull(scan.getWarehouseId()) && NumberUtil.equals(nodeId,scan.getWarehouseId())).mapToInt(TrunklineCarsLoadScanEntity::getNum).sum(); - Integer lineRealUnloadingNum = scanList.stream().filter(scan -> !Objects.isNull(scan.getScanStatus()) && !scan.getScanStatus().equals("1") && !Objects.isNull(scan.getUnloadNodeId()) && NumberUtil.equals(nodeId,scan.getUnloadNodeId())).mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum(); + Integer lineRealUnloadingNum = scanList.stream().filter(scan -> !Objects.isNull(scan.getScanStatus()) && !scan.getScanStatus().equals("1") && !scan.getScanStatus().equals("4") && !Objects.isNull(scan.getUnloadNodeId()) && NumberUtil.equals(nodeId,scan.getUnloadNodeId())).mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum(); carsLoadLineEntity.setPlanLoadingNumber(planNum); carsLoadLineEntity.setRealLoadingNumber(lineRealLoadingNum); carsLoadLineEntity.setUnloadNumber(lineRealUnloadingNum); @@ -1668,7 +1663,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl !Objects.isNull(scan.getWarehouseId()) && NumberUtil.equals(nodeId,scan.getWarehouseId()) && StringUtil.equals(orderCode,scan.getOrderCode()) && StringUtil.equals(waybillNo,scan.getWaybillNo())).mapToInt(TrunklineCarsLoadScanEntity::getNum).sum(); - Integer carsOrderRealUnloadingNum = scanList.stream().filter(scan -> !Objects.isNull(scan.getScanStatus()) && !scan.getScanStatus().equals("1") && StringUtil.equals(orderCode,scan.getOrderCode()) && StringUtil.equals(waybillNo,scan.getWaybillNo())).mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum(); + Integer carsOrderRealUnloadingNum = scanList.stream().filter(scan -> !Objects.isNull(scan.getScanStatus()) && !scan.getScanStatus().equals("1") && !scan.getScanStatus().equals("4") && StringUtil.equals(orderCode,scan.getOrderCode()) && StringUtil.equals(waybillNo,scan.getWaybillNo())).mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum(); Integer carsOrderRealSignNum = scanList.stream().filter(scan -> !Objects.isNull(scan.getScanStatus()) && scan.getScanStatus().equals("3") && StringUtil.equals(orderCode,scan.getOrderCode()) && StringUtil.equals(waybillNo,scan.getWaybillNo())).mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum(); carsOrderEntity.setRealNum(carsOrderRealLoadingNum); carsOrderEntity.setUnloadNum(carsOrderRealUnloadingNum); @@ -4117,6 +4112,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl { List trunklineCarsLoadScanVOS = noWaybillNoTrunklineCarsLoadScanMapByOrderCode.get(orderCode); //把trunklineCarsLoadScanVOS中所有元素的num加起来,如果num为空则用0代替 - Integer loadingNum = trunklineCarsLoadScanVOS.stream().filter(t-> Objects.isNull(t.getWarehouseId())).map(TrunklineCarsLoadScanVO::getNum).reduce(0, Integer::sum); + Integer loadingNum = trunklineCarsLoadScanVOS.stream().filter(t-> !Objects.isNull(t.getWarehouseId())).map(TrunklineCarsLoadScanVO::getNum).reduce(0, Integer::sum); Integer unloadNum = trunklineCarsLoadScanVOS.stream().map(TrunklineCarsLoadScanVO::getUnloadNum).reduce(0, Integer::sum); Integer signNum = trunklineCarsLoadScanVOS.stream().filter(t-> t.getScanStatus().equals("3")).map(TrunklineCarsLoadScanVO::getUnloadNum).reduce(0, Integer::sum); @@ -5309,6 +5306,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl retentionList = trunklineCarsLoadScanService.findRetentionPackage(orderPackageCode,warehouseId); + + return R.data(retentionList); + } + + @Override + public R retentionCarsLoadPackage(List loadScanIds, Long warehouseId, String warehouseName) { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("id", loadScanIds) + .eq("scan_status","1"); + List carsLoadScanEntityList = trunklineCarsLoadScanService.list(queryWrapper); + if (CollUtil.isEmpty(carsLoadScanEntityList)) { + log.warn("##################removeCarsLoadScan: 没有滞留的数据 carsLoadScanIds={}", loadScanIds); + return R.fail(405, "没有滞留的数据"); + } + + //把carsLoadScanEntityList通过loadId分组 + Map> groupedByLoadId = carsLoadScanEntityList.stream() + .collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getLoadId)); + Set loadIdSet = groupedByLoadId.keySet(); + + List trunklineCarsLoadEntities = baseMapper.selectBatchIds(loadIdSet); + //把trunklineCarsLoadEntities转化成以id为key的Map + Map map = trunklineCarsLoadEntities.stream().collect(Collectors.toMap(TrunklineCarsLoadEntity::getId, Function.identity())); + + List updateParceListList = new ArrayList<>(); + List updateStockArticleList = new ArrayList<>(); + List updateScanList = new ArrayList<>(); + + groupedByLoadId.keySet().forEach(loadId -> { + List loadScanEntityList = groupedByLoadId.get(loadId); + if(CollUtil.isNotEmpty(loadScanEntityList)){ + //把loadScanEntityList通过fromNodeId进行分组 + Map> groupedByFromWarehouseId = loadScanEntityList.stream().filter(carsLoadScanEntity-> !Objects.isNull(carsLoadScanEntity.getFromWarehouseId())) + .collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getFromWarehouseId)); + groupedByFromWarehouseId.keySet().forEach(fromWarehouseId -> { + BasicdataWarehouseEntity fromWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(fromWarehouseId); + String fromWarehouseEntityName = fromWarehouseEntity.getName(); + + List loadScanEntityList1 = groupedByFromWarehouseId.get(fromWarehouseId); + if(CollUtil.isNotEmpty(loadScanEntityList1)){ + //把trunklineCarsLoadScanEntities通过orderCode进行分组 + Map> groupedByOrderCode = loadScanEntityList1.stream().filter(carsLoadScanEntity-> !Objects.isNull(carsLoadScanEntity.getOrderCode())) + .collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getOrderCode)); + groupedByOrderCode.keySet().forEach(orderCode -> { + DistributionStockArticleEntity distributionStockArticle = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode, fromWarehouseId); + List loadScanEntityList2 = groupedByOrderCode.get(orderCode); + if(CollUtil.isNotEmpty(loadScanEntityList2)){ + + TrunklineCarsLoadScanEntity carsLoadScanEntity = loadScanEntityList2.get(0); + Long loadId1 = carsLoadScanEntity.getLoadId(); + String loadCode = carsLoadScanEntity.getLoadCode(); + + //把loadScanEntityList2的num进行累加 + Integer num = loadScanEntityList2.stream().map(TrunklineCarsLoadScanEntity::getNum).reduce(0, Integer::sum); + //把loadScanEntityList2中所有元素的scanCode放入一个List + List scanCodeList = loadScanEntityList2.stream().map(TrunklineCarsLoadScanEntity::getScanCode).collect(Collectors.toList()); + + FindParamterDTO findParamterDTO = new FindParamterDTO(); + findParamterDTO.setOrderPackageCodeList(scanCodeList); + findParamterDTO.setWarehouseId(fromWarehouseId); + List parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO); + parcelListEntityList.forEach(parcelListEntity -> { + DistributionParcelListEntity updateParceList = new DistributionParcelListEntity(); + updateParceList.setId(parcelListEntity.getId()); + updateParceList.setOrderPackageStatus("20"); + updateParceList.setWarehouseId(parcelListEntity.getWarehouseId()); + updateParceList.setOrderCode(parcelListEntity.getOrderCode()); + updateParceListList.add(updateParceList); + }); + loadScanEntityList2.forEach(trunklineCarsLoadScanEntity -> { + TrunklineCarsLoadScanEntity updateEntity = new TrunklineCarsLoadScanEntity(); + updateEntity.setId(trunklineCarsLoadScanEntity.getId()); + updateEntity.setScanStatus("4"); + updateScanList.add(updateEntity); + String trayCode = trunklineCarsLoadScanEntity.getTrayCode(); + String scanCode = trunklineCarsLoadScanEntity.getScanCode(); + if (StringUtil.isNotBlank(trayCode)) { + updownTypeClient.downPackageOrDelTray(scanCode, warehouseId, "包件下架解托"); + } + }); + + + DistributionStockArticleEntity updateStockArticle = new DistributionStockArticleEntity(); + updateStockArticle.setId(distributionStockArticle.getId()); + updateStockArticle.setHandQuantity(distributionStockArticle.getHandQuantity()+num); + updateStockArticleList.add(updateStockArticle); + + TrunklineCarsLoadEntity carsLoadEntity = map.get(loadId1); + if(!Objects.isNull(carsLoadEntity)){ + String loadType = carsLoadEntity.getLoadType(); + if(!StringUtils.equals(loadType, "4")){ + String content = "包件在 " + warehouseName + "滞留 ,车次号:"+loadCode+",配载计划目的仓 " + fromWarehouseEntityName; + packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), scanCodeList, warehouseId, warehouseName, WorkNodeEnums.CANCEL_INITIAL_WAREHOUSE_LOADING.getCode(), content); + } + }else{ + String content = "包件在 " + warehouseName + "滞留 ,车次号:"+loadCode+",配载计划目的仓 " + fromWarehouseEntityName; + packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), scanCodeList, warehouseId, warehouseName, WorkNodeEnums.CANCEL_INITIAL_WAREHOUSE_LOADING.getCode(), content); + } + } + }); + } + }); + } + }); + //更新装车明细 + if (CollUtil.isNotEmpty(updateScanList)){ + trunklineCarsLoadScanService.updateBatchById(updateScanList); + } + if(CollUtil.isNotEmpty(updateStockArticleList)){ + distributionStockArticleClient.updateByBatchId(updateStockArticleList); + } + if(CollUtil.isNotEmpty(updateParceListList)){ + distributionParcelListClient.updateList(updateParceListList); + } + if(CollUtil.isNotEmpty(loadIdSet)){ + loadIdSet.forEach(loadId -> { + updateNumByLoadId(loadId); + }); + } + + //把carsLoadScanEntityList通过finalNodeId分组 + Map> groupedByFinalNodeId = carsLoadScanEntityList.stream().filter(carsLoadScanEntity-> !Objects.isNull(carsLoadScanEntity.getFinalNodeId())) + .collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getFinalNodeId)); + + groupedByFinalNodeId.keySet().forEach(finalNodeId -> { + List trunklineCarsLoadScanEntities = groupedByFinalNodeId.get(finalNodeId); + if(CollUtil.isNotEmpty(trunklineCarsLoadScanEntities)){ + //把trunklineCarsLoadScanEntities中所有元素的scanCode放入一个List + List scanCodeList = trunklineCarsLoadScanEntities.stream().map(TrunklineCarsLoadScanEntity::getScanCode).collect(Collectors.toList()); + DealWithAbnormalVO dealWithAbnormalVO = new DealWithAbnormalVO(); + dealWithAbnormalVO.setOrderPackageCodes(scanCodeList); + dealWithAbnormalVO.setWarehouseName(warehouseName); + dealWithAbnormalVO.setNickName(AuthUtil.getNickName()); + dealWithAbnormalVO.setRemark("滞留同步系统自动处理("+warehouseName+" "+" "+AuthUtil.getNickName()+")"); + abnormalRecordClient.dealwithOrderPackageCodes(dealWithAbnormalVO); + } + }); + + return R.success("滞留成功"); + } + private void updateParcelListToWarehouse(TrunklineAdvanceDetailEntity advanceDetailEntity, Long warehouseId, String status) { String orderPackageCode = advanceDetailEntity.getOrderPackageCode(); String orderCode = advanceDetailEntity.getOrderCode(); @@ -5396,6 +5542,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl saveScanList = new ArrayList<>(); + List updateList = new ArrayList<>(); parcelListEntityList.forEach(parcelListEntity -> { + String orderPackageCode = parcelListEntity.getOrderPackageCode(); Long waybillId = parcelListEntity.getWaybillId(); String waybillNo = parcelListEntity.getWaybillNumber(); @@ -9939,9 +10089,23 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl { @@ -10533,6 +10699,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl