|
|
|
@ -1173,8 +1173,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
throw new CustomerException(400, "已经确认过卸车"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//修改已卸车数据为确认状态
|
|
|
|
|
trunklineCarsLoadScanService.updateUnloadCheckByLoadIdAndWarehouseId(loadId, warehouseId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TrunklineCarsLoadLineEntity updateUnloadStatus = new TrunklineCarsLoadLineEntity(); |
|
|
|
|
WorkNodeEnums node = null; |
|
|
|
@ -1252,7 +1251,10 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
.ne("scan_status", "1") |
|
|
|
|
.isNull("unload_tray_code"); |
|
|
|
|
|
|
|
|
|
List<TrunklineCarsLoadScanEntity> carsLoadScanEntityList = trunklineCarsLoadScanService.list(queryWrapper); |
|
|
|
|
List<TrunklineCarsLoadScanEntity> allList = trunklineCarsLoadScanService.list(queryWrapper); |
|
|
|
|
//把carsLoadScanEntityList过滤掉scanStatus等于3的数据
|
|
|
|
|
List<TrunklineCarsLoadScanEntity> carsLoadScanEntityList = allList.stream().filter(e -> !"3".equals(e.getScanStatus())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(carsLoadScanEntityList)){ |
|
|
|
|
//把carsLoadScanEntityList通过orderCode进行分组
|
|
|
|
|
Map<String, List<TrunklineCarsLoadScanEntity>> orderCodemap = carsLoadScanEntityList.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getOrderCode)); |
|
|
|
@ -1456,6 +1458,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//修改已卸车数据为确认状态
|
|
|
|
|
trunklineCarsLoadScanService.updateUnloadCheckByLoadIdAndWarehouseId(loadId, warehouseId); |
|
|
|
|
|
|
|
|
|
//无装车记录异常日志记录
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
@ -2519,6 +2524,14 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
log.warn("###############updateCarsLoadBasicData: 配载计划节点不存在 loadId={} nodeId={}", loadId, warehouseId); |
|
|
|
|
return R.fail(405, "配载计划节点不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String nodeStatus = currentLoadLineEntity.getNodeStatus(); |
|
|
|
|
if(!"10".equals(nodeStatus)){ |
|
|
|
|
log.warn("###############updateCarsLoadBasicData: 车次不在当前仓 loadId={} nodeStatus={}", loadId, nodeStatus); |
|
|
|
|
return R.fail(405, "车次不在当前仓"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StringBuilder str = new StringBuilder(); |
|
|
|
|
if (oldCountTransportCost.compareTo(countTransportCost) != 0) { |
|
|
|
|
str = new StringBuilder("运输费用: 由【" + oldCountTransportCost + "】改为" + countTransportCost + "。"); |
|
|
|
@ -9357,14 +9370,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
|
|
|
|
|
Integer pacakagNum = 0; |
|
|
|
|
Integer zeroNum = 0; |
|
|
|
|
for (LoadingPackageDTO loadingPackageDTO : packageList) { |
|
|
|
|
String orderPackageCode = loadingPackageDTO.getOrderPackageCode(); |
|
|
|
|
R r = loadingScan(loadId, warehouseId, orderPackageCode, trayCode, "托盘正常装车"); |
|
|
|
|
if(r.getCode() != 200){ |
|
|
|
|
String msg = r.getMsg(); |
|
|
|
|
throw new CustomerException(r.getCode(),orderPackageCode+msg); |
|
|
|
|
} |
|
|
|
|
pacakagNum = pacakagNum + 1; |
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(packageList)){ |
|
|
|
|
|
|
|
|
|
Integer loadingPackageNum = loadingTrayPackageList(loadId,warehouseId,packageList,trayCode,"托盘正常装车"); |
|
|
|
|
|
|
|
|
|
pacakagNum = loadingPackageNum; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (LoadingZeroDTO loadingZeroDTO : zeroList) { |
|
|
|
@ -9381,6 +9392,259 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
return Resp.scanSuccess("整托装车成功", "装车成功包件" + pacakagNum + "件,零担" + zeroNum + "件"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Integer loadingTrayPackageList(Long loadId, Long warehouseId, List<LoadingPackageDTO> packageList, String trayCode, String remark) { |
|
|
|
|
|
|
|
|
|
TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId); |
|
|
|
|
if (Objects.isNull(carsLoadEntity)) { |
|
|
|
|
log.warn("##################loadingTrayPackageList: 配载or三方计划不存在 loadId={}", loadId); |
|
|
|
|
throw new CustomerException(405, "计划不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String carsNo = carsLoadEntity.getCarsNo(); |
|
|
|
|
|
|
|
|
|
TrunklineCarsLoadLineEntity carsLoadLineEntity = trunklineCarsLoadLineService.findEntityByLoadIdAndNodeId(loadId, warehouseId); |
|
|
|
|
if (Objects.isNull(carsLoadLineEntity)) { |
|
|
|
|
log.warn("##################loadingTrayPackageList: 节点信息不存在 loadId={} warehouseId={}", loadId, warehouseId); |
|
|
|
|
throw new CustomerException(405, "节点信息不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String nodeStatus = carsLoadLineEntity.getNodeStatus(); |
|
|
|
|
if (!"10".equals(nodeStatus)) { |
|
|
|
|
log.warn("##################loadingTrayPackageList: 节点不是到车状态 nodeStatus={}", nodeStatus); |
|
|
|
|
throw new CustomerException(405, "节点不是到车状态"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//限制装车之前上传图片
|
|
|
|
|
// Integer isLoadingPhoto = carsLoadLineEntity.getIsLoadingPhoto();
|
|
|
|
|
// if(NumberUtil.equals(isLoadingPhoto,0)){
|
|
|
|
|
// log.warn("##############loadingScan: 当前节点还未上传装车前照片 isLoadingPhoto={}", isLoadingPhoto);
|
|
|
|
|
// return R.fail(405, "当前节点还未上传装车前照片");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId); |
|
|
|
|
if (Objects.isNull(basicdataWarehouseEntity)) { |
|
|
|
|
log.warn("##################loadingTrayPackageList: 仓库信息不存在 warehouseId={}", warehouseId); |
|
|
|
|
throw new CustomerException(405, "仓库信息不存在"); |
|
|
|
|
} |
|
|
|
|
String warehouseName = basicdataWarehouseEntity.getName(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Long trayId; |
|
|
|
|
String trayName; |
|
|
|
|
|
|
|
|
|
if (!StringUtil.isBlank(trayCode)) { |
|
|
|
|
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode(trayCode); |
|
|
|
|
if (!Objects.isNull(basicdataTrayEntity)) { |
|
|
|
|
trayId = basicdataTrayEntity.getId(); |
|
|
|
|
trayName = basicdataTrayEntity.getPalletName(); |
|
|
|
|
} else { |
|
|
|
|
trayName = ""; |
|
|
|
|
trayId = null; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
trayName = ""; |
|
|
|
|
trayId = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//把packageList中所有orderPackageCode放入一个List
|
|
|
|
|
List<String> orderPackageCodes = packageList.stream() |
|
|
|
|
.map(LoadingPackageDTO::getOrderPackageCode) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
//查询包件有信息
|
|
|
|
|
FindParamterDTO findParamterDTO = new FindParamterDTO(); |
|
|
|
|
findParamterDTO.setOrderPackageCodeList(orderPackageCodes); |
|
|
|
|
findParamterDTO.setWarehouseId(warehouseId); |
|
|
|
|
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO); |
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(parcelListEntityList)){ |
|
|
|
|
|
|
|
|
|
//把parcelListEntityList转化成以orderPackageCode为key的Map
|
|
|
|
|
Map<String, DistributionParcelListEntity> parcelMap = parcelListEntityList.stream() |
|
|
|
|
.collect(Collectors.toMap(DistributionParcelListEntity::getOrderPackageCode, Function.identity())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//把parcelListEntityList中所有orderCode放入一个Set
|
|
|
|
|
Set<String> orderCodeSet = parcelListEntityList.stream() |
|
|
|
|
.map(DistributionParcelListEntity::getOrderCode) |
|
|
|
|
.collect(Collectors.toSet()); |
|
|
|
|
findParamterDTO.setOrderCodeSet(orderCodeSet); |
|
|
|
|
List<DistributionStockArticleEntity> stockArticleEntityList = distributionStockArticleClient.findListByOrderCodesAndWarehouseId(findParamterDTO); |
|
|
|
|
//把stockArticleEntityList转化成以orderCode为key的Map
|
|
|
|
|
Map<String, DistributionStockArticleEntity> stockArticleMap = stockArticleEntityList.stream() |
|
|
|
|
.collect(Collectors.toMap(DistributionStockArticleEntity::getOrderCode, Function.identity())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<TrunklineCarsOrderEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("load_id", loadId) |
|
|
|
|
.eq("node_id", warehouseId); |
|
|
|
|
List<TrunklineCarsOrderEntity> carsOrderList = trunklineCarsOrderService.list(queryWrapper); |
|
|
|
|
|
|
|
|
|
//把carsOrderList通过orderCode和waybillNo拼接作为key的Map
|
|
|
|
|
Map<String, TrunklineCarsOrderEntity> carsOrderMap = carsOrderList.stream() |
|
|
|
|
.collect(Collectors.toMap(orderCodeAndWaybillNo -> orderCodeAndWaybillNo.getOrderCode() +"&&"+ orderCodeAndWaybillNo.getWaybillNo(), Function.identity())); |
|
|
|
|
|
|
|
|
|
//把carsOrderList的finlNodeId放入一个List
|
|
|
|
|
List<Long> warehouseIds = carsOrderList.stream() |
|
|
|
|
.map(TrunklineCarsOrderEntity::getFinalNodeId) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
Map<Long,String> warehouseMap = basicdataWarehouseClient.findNamesMapByIds(warehouseIds); |
|
|
|
|
|
|
|
|
|
//提出parcelListEntityList中状态不等于20的包件
|
|
|
|
|
List<DistributionParcelListEntity> noStockParcelListEntityList = parcelListEntityList.stream() |
|
|
|
|
.filter(parcelListEntity -> !"20".equals(parcelListEntity.getStatus())) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(noStockParcelListEntityList)){ |
|
|
|
|
log.warn("##################loadingTrayPackageList: 存在不在库的包件 warehouseId={}", warehouseId); |
|
|
|
|
throw new CustomerException(405, "存在不在库的包件"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<String> noPlanPackageList = new ArrayList<>(); |
|
|
|
|
//判断是否有不在计划中的包件
|
|
|
|
|
for (DistributionParcelListEntity parcelList : parcelListEntityList) { |
|
|
|
|
|
|
|
|
|
String orderCode = parcelList.getOrderCode(); |
|
|
|
|
String waybillNumber = parcelList.getWaybillNumber(); |
|
|
|
|
String orderPackageCode = parcelList.getOrderPackageCode(); |
|
|
|
|
|
|
|
|
|
for (TrunklineCarsOrderEntity carsOrderEntity : carsOrderList) { |
|
|
|
|
String orderCode1 = carsOrderEntity.getOrderCode(); |
|
|
|
|
String waybillNo = carsOrderEntity.getWaybillNo(); |
|
|
|
|
Integer planNum = carsOrderEntity.getPlanNum(); |
|
|
|
|
Integer realNum = carsOrderEntity.getRealNum(); |
|
|
|
|
if(orderCode1.equals(orderCode) && waybillNo.equals(waybillNumber)){ |
|
|
|
|
int totalNum = realNum + 1; |
|
|
|
|
if(totalNum > planNum){ |
|
|
|
|
noPlanPackageList.add(orderPackageCode); |
|
|
|
|
carsOrderEntity.setRealNum(totalNum); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(CollUtil.isNotEmpty(noPlanPackageList)){ |
|
|
|
|
log.warn("##################loadingTrayPackageList: 存在不在计划的包件 noPlanPackageList={}", noPlanPackageList); |
|
|
|
|
throw new CustomerException(405, "存在不在计划的包件"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<TrunklineCarsLoadScanEntity> saveScanList = new ArrayList<>(); |
|
|
|
|
parcelListEntityList.forEach(parcelListEntity -> { |
|
|
|
|
String orderPackageCode = parcelListEntity.getOrderPackageCode(); |
|
|
|
|
Long waybillId = parcelListEntity.getWaybillId(); |
|
|
|
|
String waybillNo = parcelListEntity.getWaybillNumber(); |
|
|
|
|
String orderCode = parcelListEntity.getOrderCode(); |
|
|
|
|
TrunklineCarsOrderEntity carsOrderEntity = carsOrderMap.get(orderCode + "&&" + waybillNo); |
|
|
|
|
Long finalNodeId = carsOrderEntity.getFinalNodeId(); |
|
|
|
|
DistributionStockArticleEntity stockArticle = stockArticleMap.get(orderCode); |
|
|
|
|
|
|
|
|
|
TrunklineCarsLoadScanEntity carsLoadScanEntity = new TrunklineCarsLoadScanEntity(); |
|
|
|
|
carsLoadScanEntity.setWarehouseId(warehouseId); |
|
|
|
|
carsLoadScanEntity.setWarehouseName(basicdataWarehouseEntity.getName()); |
|
|
|
|
carsLoadScanEntity.setLoadId(loadId); |
|
|
|
|
carsLoadScanEntity.setLoadCode(carsNo); |
|
|
|
|
carsLoadScanEntity.setScanCode(orderPackageCode); |
|
|
|
|
carsLoadScanEntity.setScanStatus("1"); |
|
|
|
|
|
|
|
|
|
carsLoadScanEntity.setTrayId(trayId); |
|
|
|
|
carsLoadScanEntity.setTrayName(trayName); |
|
|
|
|
carsLoadScanEntity.setTrayCode(trayCode); |
|
|
|
|
carsLoadScanEntity.setNum(1); |
|
|
|
|
carsLoadScanEntity.setType(1); |
|
|
|
|
carsLoadScanEntity.setIsSupple(0); |
|
|
|
|
carsLoadScanEntity.setUnloadCheck(0); |
|
|
|
|
carsLoadScanEntity.setUnloadNum(0); |
|
|
|
|
carsLoadScanEntity.setIsData(1); |
|
|
|
|
carsLoadScanEntity.setWaybillId(waybillId); |
|
|
|
|
carsLoadScanEntity.setWaybillNo(waybillNo); |
|
|
|
|
carsLoadScanEntity.setOrderCode(orderCode); |
|
|
|
|
carsLoadScanEntity.setFromWarehouseId(warehouseId); |
|
|
|
|
carsLoadScanEntity.setLoadingAbnormal(0); |
|
|
|
|
String finalName = warehouseMap.get(finalNodeId); |
|
|
|
|
carsLoadScanEntity.setFinalNodeId(finalNodeId); |
|
|
|
|
carsLoadScanEntity.setFinalNodeName(finalName); |
|
|
|
|
carsLoadScanEntity.setCustomerName(stockArticle.getCustomerName()); |
|
|
|
|
carsLoadScanEntity.setCustomerTelephone(stockArticle.getCustomerTelephone()); |
|
|
|
|
carsLoadScanEntity.setCustomerAddress(stockArticle.getCustomerAddress()); |
|
|
|
|
carsLoadScanEntity.setFirsts(parcelListEntity.getFirsts()); |
|
|
|
|
carsLoadScanEntity.setSenconds(parcelListEntity.getSecond()); |
|
|
|
|
carsLoadScanEntity.setThirds(parcelListEntity.getThirdProduct()); |
|
|
|
|
carsLoadScanEntity.setMaterialCode(parcelListEntity.getMaterialCode()); |
|
|
|
|
carsLoadScanEntity.setMaterialName(parcelListEntity.getMaterialName()); |
|
|
|
|
carsLoadScanEntity.setLoadingUserName(AuthUtil.getNickName()); |
|
|
|
|
saveScanList.add(carsLoadScanEntity); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
trunklineCarsLoadScanService.saveBatch(saveScanList); |
|
|
|
|
|
|
|
|
|
updateNumByLoadId(loadId); |
|
|
|
|
|
|
|
|
|
//把saveScanList通过finalNodeId进行分组
|
|
|
|
|
Map<Long, List<TrunklineCarsLoadScanEntity>> finalNodeIdMap = saveScanList.stream() |
|
|
|
|
.collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getFinalNodeId)); |
|
|
|
|
|
|
|
|
|
finalNodeIdMap.keySet().forEach(finalNodeId -> { |
|
|
|
|
List<TrunklineCarsLoadScanEntity> trunklineCarsLoadScanEntities = finalNodeIdMap.get(finalNodeId); |
|
|
|
|
|
|
|
|
|
//把trunklineCarsLoadScanEntities的scanCode放入一个List
|
|
|
|
|
List<String> scanCodeList = trunklineCarsLoadScanEntities.stream() |
|
|
|
|
.map(TrunklineCarsLoadScanEntity::getScanCode) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String finalNodeName = warehouseMap.get(finalNodeId); |
|
|
|
|
|
|
|
|
|
String loadType = carsLoadEntity.getLoadType(); |
|
|
|
|
String content = null; |
|
|
|
|
|
|
|
|
|
if(!"4".equals(loadType)){ |
|
|
|
|
content = "包件在 " + warehouseName + " " + (StringUtil.isBlank(trayName) ? "扫码" : "托盘(" + trayName + ")") + " 装车, 车次号:"+carsNo+" ,配载计划目的仓 " + finalNodeName + ",数据来源仓库 " + warehouseName; |
|
|
|
|
}else{ |
|
|
|
|
content = "包件在 " + warehouseName + " " + (StringUtil.isBlank(trayName) ? "扫码" : "托盘(" + trayName + ")") + " 装车, 车次号:"+carsNo+" ,数据来源仓库 " + warehouseName; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), scanCodeList, warehouseId, warehouseName, WorkNodeEnums.INITIAL_WAREHOUSE_LOADING.getCode(), content); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunklineCarsLoadScanEntities.forEach(carsLoadScanEntity -> { |
|
|
|
|
|
|
|
|
|
String scanCode = carsLoadScanEntity.getScanCode(); |
|
|
|
|
|
|
|
|
|
// 推送包件装车数据到工厂
|
|
|
|
|
pushFactoryOrderData(warehouseId, scanCode, carsLoadScanEntity.getOrderCode()); |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
DistributionParcelListEntity parcelList = parcelMap.get(scanCode); |
|
|
|
|
JSONObject main = new JSONObject(); |
|
|
|
|
main.put("trainNumber",carsNo); |
|
|
|
|
main.put("waybillNumber",carsLoadScanEntity.getWaybillNo()); |
|
|
|
|
NodePushMsg nodePushMsg = NodePushMsg.builder() |
|
|
|
|
.operator(AuthUtil.getNickName()) |
|
|
|
|
.operatorTime(new Date()) |
|
|
|
|
.address("在【" + warehouseName + "】出库") |
|
|
|
|
.brand(BrandEnums.getByValue(parcelList.getBrandName())) |
|
|
|
|
.node(WorkNodeEnums.INITIAL_WAREHOUSE_LOADING) |
|
|
|
|
.main(JSONUtil.toJsonStr(main)) |
|
|
|
|
.content(Collections.singletonList(PushData.builder() |
|
|
|
|
.packageCode(carsLoadScanEntity.getScanCode()) |
|
|
|
|
.orderCode(carsLoadScanEntity.getOrderCode()) |
|
|
|
|
.warehouseName(warehouseName) |
|
|
|
|
.destinationWarehouse(parcelList.getAcceptWarehouseName()) |
|
|
|
|
.build())) |
|
|
|
|
.build(); |
|
|
|
|
factoryDataMessageSender.sendNodeDataByBrand(nodePushMsg); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("推送数据失败",e); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
trunklineCarsLoadingLogService.savaLoadingLogBatch(trunklineCarsLoadScanEntities, remark); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return parcelListEntityList.size(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R findCarsLoadingDetail(Long loadId, Long warehouseId) { |
|
|
|
|
log.info("################findCarsLoadingDetail: 查询配载计划装车详情"); |
|
|
|
|