|
|
|
@ -973,10 +973,10 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
throw new CustomerException(400, "配载计划已终点卸车确认"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!"20".equals(loadStatus) && !"40".equals(loadStatus)) { |
|
|
|
|
log.warn("#############unloadByLoadId: 配载计划暂未到车 loadStatus={}", loadStatus); |
|
|
|
|
throw new CustomerException(400, "配载计划暂未到车"); |
|
|
|
|
} |
|
|
|
|
// if (!"20".equals(loadStatus) && !"40".equals(loadStatus)) {
|
|
|
|
|
// log.warn("#############unloadByLoadId: 配载计划暂未到车 loadStatus={}", loadStatus);
|
|
|
|
|
// throw new CustomerException(400, "配载计划暂未到车");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
TrunklineCarsLoadLineEntity currentCarsLoadLineEntity = trunklineCarsLoadLineService.findEntityByLoadIdAndNodeId(loadId, nowWarehouseId); |
|
|
|
|
if (Objects.isNull(currentCarsLoadLineEntity)) { |
|
|
|
@ -5957,7 +5957,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
return R.fail(405, "暂未有权限进行操作"); |
|
|
|
|
} |
|
|
|
|
String loadStatus = carsLoadEntity.getLoadStatus(); |
|
|
|
|
if (!"0".equals(loadStatus) && !"20".equals(loadStatus) && !"40".equals(loadStatus)) { |
|
|
|
|
if (!"0".equals(loadStatus) && !"20".equals(loadStatus) && !"40".equals(loadStatus) && !"100".equals(loadStatus)) { |
|
|
|
|
log.warn("##################removeCarsLoadScan: 当前配载计划不属于到车状态 loadStatus={} warehouseId={}", loadStatus, warehouseId); |
|
|
|
|
return R.fail(405, "当前配载计划不属于到车状态"); |
|
|
|
|
} |
|
|
|
@ -6025,9 +6025,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
distributionParcelListClient.update(parcelListEntity); |
|
|
|
|
if (StringUtil.isNotBlank(trayCode)) { |
|
|
|
|
updownTypeClient.downPackageOrDelTray(scanCode, warehouseId, "包件下架解托"); |
|
|
|
|
} |
|
|
|
|
// if (StringUtil.isNotBlank(trayCode)) {
|
|
|
|
|
// updownTypeClient.downPackageOrDelTray(scanCode, warehouseId, "包件下架解托");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
List<String> orderPackageCodes = new ArrayList<>(); |
|
|
|
|
orderPackageCodes.add(scanCode); |
|
|
|
@ -6035,9 +6035,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), orderPackageCodes, warehouseId, warehouseName, WorkNodeEnums.CANCEL_INITIAL_WAREHOUSE_LOADING.getCode(), content); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
if (StringUtil.isNotBlank(trayCode)) { |
|
|
|
|
trayTypeClient.deleteZeroOrderByTrayCode(orderCode, trayCode, warehouseId, "零担解托"); |
|
|
|
|
} |
|
|
|
|
// if (StringUtil.isNotBlank(trayCode)) {
|
|
|
|
|
// trayTypeClient.deleteZeroOrderByTrayCode(orderCode, trayCode, warehouseId, "零担解托");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -6100,6 +6100,147 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
return R.data(pageList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public R removeCarsLoadScanListByCancelLoad(List<Long> carsLoadScanIdList, Long loadId, Long warehouseId) { |
|
|
|
|
|
|
|
|
|
TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId); |
|
|
|
|
if (Objects.isNull(carsLoadEntity)) { |
|
|
|
|
log.warn("##################removeCarsLoadScanListByCancelLoad: 配载计划不存在 loadId={}", loadId); |
|
|
|
|
return R.fail(405, "配载计划不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Long nowWarehouseId = carsLoadEntity.getNowWarehouseId(); |
|
|
|
|
|
|
|
|
|
if (!nowWarehouseId.equals(warehouseId)) { |
|
|
|
|
log.warn("##################removeCarsLoadScanListByCancelLoad: 暂未有权限进行操作 nowWarehouseId={} warehouseId={}", nowWarehouseId, warehouseId); |
|
|
|
|
return R.fail(405, "暂未有权限进行操作"); |
|
|
|
|
} |
|
|
|
|
String loadStatus = carsLoadEntity.getLoadStatus(); |
|
|
|
|
if (!"100".equals(loadStatus)) { |
|
|
|
|
log.warn("##################removeCarsLoadScanListByCancelLoad: 当前配载计划不属于取消配载状态 loadStatus={} warehouseId={}", loadStatus, warehouseId); |
|
|
|
|
return R.fail(405, "当前配载计划不属于取消配载状态"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TrunklineCarsLoadLineEntity carsLoadLineEntity = trunklineCarsLoadLineService.findEntityByLoadIdAndNodeId(loadId, warehouseId); |
|
|
|
|
if (Objects.isNull(carsLoadLineEntity)) { |
|
|
|
|
log.warn("##################removeCarsLoadScanListByCancelLoad: 当前节点信息不存在 loadId={} warehouseId={}", loadId, warehouseId); |
|
|
|
|
return R.fail(405, "当前节点信息不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String nodeStatus = carsLoadLineEntity.getNodeStatus(); |
|
|
|
|
if (!"10".equals(nodeStatus)) { |
|
|
|
|
log.warn("##################removeCarsLoadScanListByCancelLoad: 当前节点不是到车状态 nodeStatus={} warehouseId={}", nodeStatus, warehouseId); |
|
|
|
|
return R.fail(405, "当前节点不是到车状态"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BasicdataWarehouseEntity basicdataWarehouse = basicdataWarehouseClient.getEntityWarehouseId(warehouseId); |
|
|
|
|
if(Objects.isNull(basicdataWarehouse)){ |
|
|
|
|
log.warn("##################removeCarsLoadScanListByCancelLoad: 仓库信息不存在 warehouseId={}", warehouseId); |
|
|
|
|
return R.fail(405, "仓库信息不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String warehouseName = basicdataWarehouse.getName(); |
|
|
|
|
|
|
|
|
|
List<TrunklineCarsLoadScanEntity> trunklineCarsLoadScanEntities = trunklineCarsLoadScanService.listByIds(carsLoadScanIdList); |
|
|
|
|
|
|
|
|
|
//把trunklineCarsLoadScanEntities只提取isData等于1的数据
|
|
|
|
|
List<TrunklineCarsLoadScanEntity> hasDataScanEntites = trunklineCarsLoadScanEntities.stream().filter(carsLoadScanEntity -> carsLoadScanEntity.getIsData() == 1).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//把hasDataScanEntites通过fromWarehouseId进行分组
|
|
|
|
|
Map<Long, List<TrunklineCarsLoadScanEntity>> fromWarehouseIdMap = hasDataScanEntites.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getFromWarehouseId)); |
|
|
|
|
|
|
|
|
|
List<DistributionStockArticleEntity> updateStockArticleList = new ArrayList<>(); |
|
|
|
|
List<DistributionParcelListEntity> updateParcelListList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
fromWarehouseIdMap.keySet().forEach(fromWarehouseId -> { |
|
|
|
|
List<TrunklineCarsLoadScanEntity> scanEntities = fromWarehouseIdMap.get(fromWarehouseId); |
|
|
|
|
//把scanEntities中所有元素的以orderCode进行分组
|
|
|
|
|
Map<String, List<TrunklineCarsLoadScanEntity>> orderCodeMap = scanEntities.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getOrderCode)); |
|
|
|
|
Set<String> orderCodeSet = orderCodeMap.keySet(); |
|
|
|
|
FindParamterDTO findParamterDTO = new FindParamterDTO(); |
|
|
|
|
findParamterDTO.setOrderCodeSet(orderCodeSet); |
|
|
|
|
findParamterDTO.setWarehouseId(fromWarehouseId); |
|
|
|
|
List<DistributionStockArticleEntity> stockArticleEntityList = distributionStockArticleClient.findListByOrderCodesAndWarehouseId(findParamterDTO); |
|
|
|
|
//把stockArticleEntityList转化成OrderCode为key的Map
|
|
|
|
|
Map<String, DistributionStockArticleEntity> stockArticleMap = stockArticleEntityList.stream().collect(Collectors.toMap(DistributionStockArticleEntity::getOrderCode, Function.identity())); |
|
|
|
|
|
|
|
|
|
orderCodeMap.keySet().forEach(orderCode -> { |
|
|
|
|
DistributionStockArticleEntity stockArticle = stockArticleMap.get(orderCode); |
|
|
|
|
if(!Objects.isNull(stockArticle)){ |
|
|
|
|
List<TrunklineCarsLoadScanEntity> orderCodeEntities = orderCodeMap.get(orderCode); |
|
|
|
|
//把orderCodeEntities中所有元素的num求和
|
|
|
|
|
Integer num = orderCodeEntities.stream().map(TrunklineCarsLoadScanEntity::getNum).reduce(Integer::sum).get(); |
|
|
|
|
DistributionStockArticleEntity updateStockArticle = new DistributionStockArticleEntity(); |
|
|
|
|
updateStockArticle.setId(stockArticle.getId()); |
|
|
|
|
updateStockArticle.setHandQuantity(stockArticle.getHandQuantity() + num); |
|
|
|
|
updateStockArticleList.add(updateStockArticle); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
//把scanEntities通过只保留type等于1的数据
|
|
|
|
|
List<TrunklineCarsLoadScanEntity> type1ScanEntities = scanEntities.stream().filter(carsLoadScanEntity -> carsLoadScanEntity.getType() == 1).collect(Collectors.toList()); |
|
|
|
|
//把type1ScanEntities中所有元素的scanCode放入一个Set
|
|
|
|
|
Set<String> scanCodeSet = type1ScanEntities.stream().map(TrunklineCarsLoadScanEntity::getScanCode).collect(Collectors.toSet()); |
|
|
|
|
findParamterDTO.setOrderPackageCodeList(new ArrayList<>(scanCodeSet)); |
|
|
|
|
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO); |
|
|
|
|
parcelListEntityList.forEach(parcelListEntity -> { |
|
|
|
|
Long waybillId = parcelListEntity.getWaybillId(); |
|
|
|
|
DistributionParcelListEntity parcelList = new DistributionParcelListEntity(); |
|
|
|
|
parcelList.setId(parcelListEntity.getId()); |
|
|
|
|
parcelList.setOrderPackageStatus("20"); |
|
|
|
|
if(!Objects.isNull(waybillId)){ |
|
|
|
|
Long acceptWarehouseId = parcelListEntity.getAcceptWarehouseId(); |
|
|
|
|
if(acceptWarehouseId.equals(fromWarehouseId)){ |
|
|
|
|
parcelList.setIsTransfer(0); |
|
|
|
|
}else{ |
|
|
|
|
parcelList.setIsTransfer(1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
updateParcelListList.add(parcelList); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(updateStockArticleList)){ |
|
|
|
|
distributionStockArticleClient.updateByBatchId(updateStockArticleList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(updateParcelListList)){ |
|
|
|
|
distributionParcelListClient.updateList(updateParcelListList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(carsLoadScanIdList)){ |
|
|
|
|
trunklineCarsLoadScanService.deleteListByCarsLoadScanIds(carsLoadScanIdList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(trunklineCarsLoadScanEntities)){ |
|
|
|
|
//把trunklineCarsLoadScanEntities中所有元素保留type等于1的数据
|
|
|
|
|
List<TrunklineCarsLoadScanEntity> type1ScanEntities = trunklineCarsLoadScanEntities.stream().filter(carsLoadScanEntity -> carsLoadScanEntity.getType() == 1).collect(Collectors.toList()); |
|
|
|
|
//把type1ScanEntities通过finalNodeId进行分组
|
|
|
|
|
Map<String, List<TrunklineCarsLoadScanEntity>> finalNodeIdMap = type1ScanEntities.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getFinalNodeName)); |
|
|
|
|
finalNodeIdMap.keySet().forEach(finalNodeName -> { |
|
|
|
|
List<TrunklineCarsLoadScanEntity> finalNodeIdEntities = finalNodeIdMap.get(finalNodeName); |
|
|
|
|
List<String> orderPackageCodes = new ArrayList<>(); |
|
|
|
|
finalNodeIdEntities.forEach(carsLoadScanEntity -> { |
|
|
|
|
Integer type = carsLoadScanEntity.getType(); |
|
|
|
|
if(type.equals(1)){ |
|
|
|
|
orderPackageCodes.add(carsLoadScanEntity.getScanCode()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
String content = "包件在 " + warehouseName + "取消装车,配载计划目的仓 " + finalNodeName; |
|
|
|
|
packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), orderPackageCodes, warehouseId, warehouseName, WorkNodeEnums.CANCEL_INITIAL_WAREHOUSE_LOADING.getCode(), content); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!Objects.isNull(loadId)) { |
|
|
|
|
updateNumByLoadId(loadId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return R.success("删除成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R unloadPackage(Long loadId, String orderPackageCode, Long warehouseId, Integer unbindTray, String remark, Integer incomingType) { |
|
|
|
|
log.info("#############unloadPackage: 卸车包件"); |
|
|
|
|