|
|
|
@ -1053,7 +1053,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(pushNodeList)){ |
|
|
|
|
if (CollUtil.isNotEmpty(pushNodeList)) { |
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListService.getById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1109,7 +1109,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private NodeFanoutMsg<DistributionLoadVO> buildNodeFanoutMsgByPackage(DistributionDeliveryListEntity distributionDeliveryListEntity, List<DistributionLoadscanEntity> pushNodeList) { |
|
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = new NodeFanoutMsg(); |
|
|
|
|
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); |
|
|
|
@ -1200,7 +1199,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
return jsonArray; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private NodeFanoutMsg<DistributionLoadVO> buildNodeFanoutMsgByStock(DistributionDeliveryListEntity distributionDeliveryListEntity,DistributionReservationEntity reservationEntity, List<DistributionLoadscaninvnEntity> ts) { |
|
|
|
|
private NodeFanoutMsg<DistributionLoadVO> buildNodeFanoutMsgByStock(DistributionDeliveryListEntity distributionDeliveryListEntity, DistributionReservationEntity reservationEntity, List<DistributionLoadscaninvnEntity> ts) { |
|
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = new NodeFanoutMsg(); |
|
|
|
|
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); |
|
|
|
|
nodeFanoutMsg.setNode(WorkNodeEnums.DISTRIBUTION_LOADING); |
|
|
|
@ -1259,7 +1258,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
packageData.setMallName(stockListEntity.getMallName()); |
|
|
|
|
|
|
|
|
|
BasicMaterialEntity materialOwnId = basicMaterialClient.getMaterialOwnId(stockListEntity.getMaterialId()); |
|
|
|
|
if(materialOwnId!=null){ |
|
|
|
|
if (materialOwnId != null) { |
|
|
|
|
packageData.setMaterialCode(materialOwnId.getProductCode()); |
|
|
|
|
} |
|
|
|
|
packageData.setMaterialName(stockListEntity.getDescriptionGoods()); |
|
|
|
@ -1967,7 +1966,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListService.getById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationService.getById(distrilbutionloadingscanDTO.getReservationId()); |
|
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = buildNodeFanoutMsgByStock(deliveryListEntity,reservationEntity, ts); |
|
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = buildNodeFanoutMsgByStock(deliveryListEntity, reservationEntity, ts); |
|
|
|
|
distributionNodeWorkService.nodeLoading(nodeFanoutMsg, AuthUtil.getUser()); |
|
|
|
|
String msg = getLoadingMsg(distrilbutionloadingscanDTO); |
|
|
|
|
return Resp.scanSuccess("扫描成功", msg); |
|
|
|
@ -2685,7 +2684,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
reservationEntity.setLoadingStatus(ReservationLoadingStatusConstant.daizhuangche.getValue()); |
|
|
|
|
reservationEntity.setSigningStatus(ReservationSigningStatusConstant.daiqianshou.getValue()); |
|
|
|
|
reservationEntity.setStatus(1); |
|
|
|
|
Map<String,List> map = new HashMap<>(); |
|
|
|
|
Map<String, List> map = new HashMap<>(); |
|
|
|
|
String waybillNumbers = v.stream().map(DistributionStockArticleEntity::getWaybillNumber).distinct().collect(Collectors.joining(",")); |
|
|
|
|
String storeCodes = v.stream().map(DistributionStockArticleEntity::getStoreCode).distinct().collect(Collectors.joining(",")); |
|
|
|
|
List<Long> waybillIds = v.stream().map(DistributionStockArticleEntity::getWaybillId).distinct().collect(Collectors.toList()); |
|
|
|
@ -2878,7 +2877,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (!zeroPackageEntityList.isEmpty()) { |
|
|
|
|
map.put("2",zeroPackageEntityList); |
|
|
|
|
map.put("2", zeroPackageEntityList); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
log.error("########################订单isZero字段错误,订单ID:{}", s.getId()); |
|
|
|
@ -2930,7 +2929,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
distributionReservationMapper.updateById(reservationEntity); |
|
|
|
|
//推送广播
|
|
|
|
|
//进行节点推送
|
|
|
|
|
NodeFanoutMsg<ReservationVO> nodeFanoutMsg = distributionReservationService.buildNodeFanoutMsgByReservation(reservationEntity,map,BizOperationEnums.ADD); |
|
|
|
|
NodeFanoutMsg<ReservationVO> nodeFanoutMsg = distributionReservationService.buildNodeFanoutMsgByReservation(reservationEntity, map, BizOperationEnums.ADD); |
|
|
|
|
distributionNodeWorkService.planReservation(nodeFanoutMsg, user); |
|
|
|
|
deliveryWarehouseName.add(reservationEntity.getWarehouseName()); |
|
|
|
|
deliveryPackageTotal.getAndAdd(reservationEntity.getReservationNum()); |
|
|
|
@ -3573,7 +3572,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public NodeFanoutMsg<DistributionTaskVO> buildNodeFanoutMsgForPlan(DistributionDeliveryListEntity distributionDeliveryListEntity, BladeUser user, BizOperationEnums bizOperation){ |
|
|
|
|
public NodeFanoutMsg<DistributionTaskVO> buildNodeFanoutMsgForPlan(DistributionDeliveryListEntity distributionDeliveryListEntity, BladeUser user, BizOperationEnums bizOperation) { |
|
|
|
|
NodeFanoutMsg<DistributionTaskVO> nodeFanoutMsg = new NodeFanoutMsg(); |
|
|
|
|
nodeFanoutMsg.setBizOperation(bizOperation); |
|
|
|
|
nodeFanoutMsg.setNode(WorkNodeEnums.PLAN_DELIVERY); |
|
|
|
@ -3592,9 +3591,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull |
|
|
|
|
private DistributionTaskVO getDistributionTaskVO(DistributionDeliveryListEntity distributionDeliveryListEntity) { |
|
|
|
|
private DistributionTaskVO getDistributionTaskVO(DistributionDeliveryListEntity distributionDeliveryListEntity) { |
|
|
|
|
DistributionTaskVO distributionTaskVO = new DistributionTaskVO(); |
|
|
|
|
distributionTaskVO.setId(distributionDeliveryListEntity.getId()); |
|
|
|
|
distributionTaskVO.setTrainNumber(distributionDeliveryListEntity.getTrainNumber()); |
|
|
|
@ -3603,14 +3601,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
distributionTaskVO.setDistributionCompany(distributionDeliveryListEntity.getDistributionCompany()); |
|
|
|
|
distributionTaskVO.setTaskTime(distributionDeliveryListEntity.getTaskTime()); |
|
|
|
|
|
|
|
|
|
List<ReservationVO> reservationVOList= distributionDeliveryListService.getDeliveryreBroadcastData(distributionDeliveryListEntity.getId(), distributionDeliveryListEntity.getWarehouseId()); |
|
|
|
|
List<ReservationVO> reservationVOList = distributionDeliveryListService.getDeliveryreBroadcastData(distributionDeliveryListEntity.getId(), distributionDeliveryListEntity.getWarehouseId()); |
|
|
|
|
distributionTaskVO.setReservationVOList(reservationVOList); |
|
|
|
|
|
|
|
|
|
return distributionTaskVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean checkList(List<DistributionReservationPackageEntity> list, Long id, Long stockArticleId, String orderPackageCode) { |
|
|
|
|
|
|
|
|
|
return list.stream().anyMatch(e -> e.getStockArticleId().equals(stockArticleId) && e.getPacketBarCode().equals(orderPackageCode) && e.getReservationId().equals(id)); |
|
|
|
@ -4605,7 +4602,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R loadingStart(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { |
|
|
|
|
String method = "#########################DistributionStockArticleController.loadingStart"; |
|
|
|
|
String method = "#########################DistributionStockArticleController.loadingStart"; |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getDeliveryId())) { |
|
|
|
|
log.error(method + "参数缺失DeliveryId()"); |
|
|
|
|
return Resp.fail("参数缺失,请联系管理员"); |
|
|
|
@ -4624,7 +4621,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
return Resp.scanFail("该车次已发车!", "该车次已发车!"); |
|
|
|
|
} |
|
|
|
|
Boolean isDriverFlag = judgeIsDriver(user); |
|
|
|
|
if (!isDriverFlag){ |
|
|
|
|
if (!isDriverFlag) { |
|
|
|
|
return Resp.scanFail("当前操作人必须是司机!", "当前操作人必须是司机!"); |
|
|
|
|
} |
|
|
|
|
String format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date()); |
|
|
|
@ -4633,12 +4630,12 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
Boolean isEnd = false; |
|
|
|
|
//防止司机进行重复发车点击
|
|
|
|
|
Long isRepeat = bladeRedis.get(AuthUtil.getTenantId() + "warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + distributionDeliveryListEntity.getTrainNumber() + "driverId:"); |
|
|
|
|
if (Func.isNotEmpty(isRepeat)){ |
|
|
|
|
return Resp.scanFail("请勿重复发车","请勿重复发车"); |
|
|
|
|
if (Func.isNotEmpty(isRepeat)) { |
|
|
|
|
return Resp.scanFail("请勿重复发车", "请勿重复发车"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ("1".equals(distributionDeliveryListEntity.getKind())) { |
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(distributionDeliveryListEntity,user,distrilbutionloadingscanDTO,isDriverFlag); |
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(distributionDeliveryListEntity, user, distrilbutionloadingscanDTO, isDriverFlag); |
|
|
|
|
distributionDeliverySelfEntity.setDepartureTime(format); |
|
|
|
|
b = distributionDeliverySelfService.updateById(distributionDeliverySelfEntity); |
|
|
|
|
isEnd = isEndDriver(distributionDeliveryListEntity.getId()); |
|
|
|
@ -4651,13 +4648,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//处理最后一个司机进行发车
|
|
|
|
|
//判断是否是最后一个司机点发车
|
|
|
|
|
distributionDeliveryListEntity.setIsStart(DeliveryStartStatusConstant.bufenfache.getValue()); |
|
|
|
|
if (isEnd){ |
|
|
|
|
if (isEnd) { |
|
|
|
|
distributionDeliveryListEntity.setIsStart(DeliveryStartStatusConstant.yifache.getValue()); |
|
|
|
|
//进行实际装车和计划数据比对
|
|
|
|
|
contrastPlanAndLoading(distributionDeliveryListEntity,myCurrentWarehouse); |
|
|
|
|
contrastPlanAndLoading(distributionDeliveryListEntity, myCurrentWarehouse); |
|
|
|
|
//进行发车日志记录
|
|
|
|
|
} |
|
|
|
|
bladeRedis.setEx(AuthUtil.getTenantId() + "warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + distributionDeliveryListEntity.getTrainNumber() + "driverId:" , user.getUserId(),60L*30L); |
|
|
|
|
bladeRedis.setEx(AuthUtil.getTenantId() + "warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + distributionDeliveryListEntity.getTrainNumber() + "driverId:", user.getUserId(), 60L * 30L); |
|
|
|
|
//修改主表状态
|
|
|
|
|
distributionDeliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.peisongzhong.getValue()); |
|
|
|
|
baseMapper.updateById(distributionDeliveryListEntity); |
|
|
|
@ -4711,9 +4708,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 消息推送失败~ 请联系管理员! ", customerException); |
|
|
|
|
} |
|
|
|
|
//发车日志记录
|
|
|
|
|
handleLoadingStartLog(distributionDeliveryListEntity,user,myCurrentWarehouse,builder.toString()); |
|
|
|
|
NodeFanoutMsg<CarStartVO> nodeFanoutMsg = builderNodeFanoutMsgByCarStart(distributionDeliveryListEntity,user); |
|
|
|
|
distributionNodeWorkService.carStart(nodeFanoutMsg,user); |
|
|
|
|
handleLoadingStartLog(distributionDeliveryListEntity, user, myCurrentWarehouse, builder.toString()); |
|
|
|
|
NodeFanoutMsg<CarStartVO> nodeFanoutMsg = builderNodeFanoutMsgByCarStart(distributionDeliveryListEntity, user); |
|
|
|
|
distributionNodeWorkService.carStart(nodeFanoutMsg, user); |
|
|
|
|
|
|
|
|
|
// 推送数据
|
|
|
|
|
return Resp.scanSuccess("发车成功", builder.toString()); |
|
|
|
@ -4721,12 +4718,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 发车日志记录 |
|
|
|
|
* |
|
|
|
|
* @param distributionDeliveryListEntity |
|
|
|
|
* @param user |
|
|
|
|
* @param myCurrentWarehouse |
|
|
|
|
*/ |
|
|
|
|
private void handleLoadingStartLog(DistributionDeliveryListEntity distributionDeliveryListEntity, BladeUser user, BasicdataWarehouseEntity myCurrentWarehouse,String str) { |
|
|
|
|
String content = user.getNickName()+"在"+myCurrentWarehouse.getName()+"点击发车,"+str; |
|
|
|
|
private void handleLoadingStartLog(DistributionDeliveryListEntity distributionDeliveryListEntity, BladeUser user, BasicdataWarehouseEntity myCurrentWarehouse, String str) { |
|
|
|
|
String content = user.getNickName() + "在" + myCurrentWarehouse.getName() + "点击发车," + str; |
|
|
|
|
DistributionPlanLogEntity distributionPlanLogEntity = new DistributionPlanLogEntity(); |
|
|
|
|
distributionPlanLogEntity.setContent(content); |
|
|
|
|
distributionPlanLogEntity.setRefId(distributionDeliveryListEntity.getId()); |
|
|
|
@ -4741,26 +4739,26 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
/** |
|
|
|
|
* 比对计划和实际装车进行装车异常数据记录 |
|
|
|
|
*/ |
|
|
|
|
private void contrastPlanAndLoading(DistributionDeliveryListEntity distributionDeliveryList,BasicdataWarehouseEntity warehouseEntity) { |
|
|
|
|
private void contrastPlanAndLoading(DistributionDeliveryListEntity distributionDeliveryList, BasicdataWarehouseEntity warehouseEntity) { |
|
|
|
|
List<DistributionParcelListEntity> distributionParcelListEntities = baseMapper.selectPackageListByDeliveryListId(distributionDeliveryList.getId()); |
|
|
|
|
List<DistributionLoadscanAbnormalEntity> abnormalEntityList = new ArrayList<>(); |
|
|
|
|
if (!distributionParcelListEntities.isEmpty()) { |
|
|
|
|
for (DistributionParcelListEntity distributionParcelListEntity : distributionParcelListEntities) { |
|
|
|
|
DistributionLoadscanAbnormalEntity packageLoadscanAbnormalEntity =createdPakcageAbnormal(distributionDeliveryList,distributionParcelListEntity,warehouseEntity); |
|
|
|
|
DistributionLoadscanAbnormalEntity packageLoadscanAbnormalEntity = createdPakcageAbnormal(distributionDeliveryList, distributionParcelListEntity, warehouseEntity); |
|
|
|
|
abnormalEntityList.add(packageLoadscanAbnormalEntity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
List<DisStockListDetailEntity> disStockListDetailEntities = baseMapper.selectInventoryListByDeliveryListId(distributionDeliveryList.getId()); |
|
|
|
|
if (!disStockListDetailEntities.isEmpty()) { |
|
|
|
|
for (DisStockListDetailEntity disStockListDetailEntity : disStockListDetailEntities) { |
|
|
|
|
DistributionLoadscanAbnormalEntity inventoryLoadscanAbnormalEntity = createdInventoryPakcageAbnormal(distributionDeliveryList,disStockListDetailEntity,warehouseEntity); |
|
|
|
|
DistributionLoadscanAbnormalEntity inventoryLoadscanAbnormalEntity = createdInventoryPakcageAbnormal(distributionDeliveryList, disStockListDetailEntity, warehouseEntity); |
|
|
|
|
abnormalEntityList.add(inventoryLoadscanAbnormalEntity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//零担
|
|
|
|
|
List<DistributionLoadscanAbnormalEntity> zeroLoadscanAbnormalList = baseMapper.selectZeroListByDeliveryId(distributionDeliveryList.getId()); |
|
|
|
|
if (!zeroLoadscanAbnormalList.isEmpty()){ |
|
|
|
|
abnormalEntityList.addAll(zeroLoadscanAbnormalList); |
|
|
|
|
if (!zeroLoadscanAbnormalList.isEmpty()) { |
|
|
|
|
abnormalEntityList.addAll(zeroLoadscanAbnormalList); |
|
|
|
|
} |
|
|
|
|
if (!abnormalEntityList.isEmpty()) { |
|
|
|
|
//进行装车异常生成
|
|
|
|
@ -4812,7 +4810,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
.eq(DistributionDeliverySelfEntity::getDeliveryId, deliveryId) |
|
|
|
|
); |
|
|
|
|
if (!deliverySelfEntities.isEmpty()) { |
|
|
|
|
return deliverySelfEntities.stream().allMatch(f -> !Objects.isNull(f.getDepartureTime())); |
|
|
|
|
return deliverySelfEntities.stream().allMatch(f -> !Objects.isNull(f.getDepartureTime())); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
@ -4822,7 +4820,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
.eq(DistributionDeliverySelfEntity::getDeliveryId, deliveryId) |
|
|
|
|
); |
|
|
|
|
if (!deliverySelfEntities.isEmpty()) { |
|
|
|
|
return deliverySelfEntities.stream().allMatch(f -> Objects.isNull(f.getDepartureTime())); |
|
|
|
|
return deliverySelfEntities.stream().allMatch(f -> Objects.isNull(f.getDepartureTime())); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
@ -5850,7 +5848,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
trunklinePackageTrackLogClient.addPackageTrackLog(aaa); |
|
|
|
|
|
|
|
|
|
// 发送作业节点数据
|
|
|
|
|
if(CollUtil.isNotEmpty(pushNodeList)){ |
|
|
|
|
if (CollUtil.isNotEmpty(pushNodeList)) { |
|
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = buildNodeFanoutMsgByPackage(deliveryListEntity, pushNodeList); |
|
|
|
|
distributionNodeWorkService.abnormalLoading(nodeFanoutMsg, AuthUtil.getUser()); |
|
|
|
|
} |
|
|
|
@ -6229,14 +6227,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(pushNodeList)){ |
|
|
|
|
if (CollUtil.isNotEmpty(pushNodeList)) { |
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListService.getById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = buildNodeFanoutMsgByZeroOrder(deliveryListEntity, pushNodeList); |
|
|
|
|
distributionNodeWorkService.nodeLoading(nodeFanoutMsg, AuthUtil.getUser()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Resp.scanSuccess("装车成功", str.toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -6276,8 +6273,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
distributionLoadVO.setTrainNumber(distributionDeliveryListEntity.getTrainNumber()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<PackageData> data = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (DistributionLoadscanEntity distributionLoadscanEntity : pushNodeList) { |
|
|
|
@ -7969,13 +7964,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
@Transactional |
|
|
|
|
public R cancelStart(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { |
|
|
|
|
String method = "######################DistributionDeliveryListServiceImpl.cancelStart"; |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getDeliveryId())){ |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getDeliveryId())) { |
|
|
|
|
log.error(method + "参数缺失DeliveryId"); |
|
|
|
|
return Resp.fail("参数缺失,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
if (Objects.isNull(myCurrentWarehouse)){ |
|
|
|
|
return R.fail(403,"未授权!!!"); |
|
|
|
|
if (Objects.isNull(myCurrentWarehouse)) { |
|
|
|
|
return R.fail(403, "未授权!!!"); |
|
|
|
|
} |
|
|
|
|
//获取当前用户司机
|
|
|
|
|
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
@ -7988,11 +7983,11 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//校验当前人是否为司机
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
Boolean driver = judgeIsDriver(user); |
|
|
|
|
if (!driver){ |
|
|
|
|
if (!driver) { |
|
|
|
|
return Resp.scanFail("此按钮只能司机操作!", "此按钮只能司机操作!"); |
|
|
|
|
} |
|
|
|
|
DistributionDeliverySelfEntity deliverySelfEntity = getDriver(distributionDeliveryListEntity, user, distrilbutionloadingscanDTO, driver); |
|
|
|
|
if (Objects.isNull(deliverySelfEntity)){ |
|
|
|
|
if (Objects.isNull(deliverySelfEntity)) { |
|
|
|
|
return Resp.scanFail("当前司机不属于该车次!", "当前司机不属于该车次!"); |
|
|
|
|
} |
|
|
|
|
Boolean b = false; |
|
|
|
@ -8021,12 +8016,12 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
baseMapper.updateById(distributionDeliveryListEntity); |
|
|
|
|
//取消发车日志记录
|
|
|
|
|
handleCancelStartLog(distributionDeliveryListEntity,deliverySelfEntity,user,myCurrentWarehouse); |
|
|
|
|
handleCancelStartLog(distributionDeliveryListEntity, deliverySelfEntity, user, myCurrentWarehouse); |
|
|
|
|
return R.success("取消发车成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void handleCancelStartLog(DistributionDeliveryListEntity distributionDeliveryListEntity, DistributionDeliverySelfEntity deliverySelfEntity, BladeUser user, BasicdataWarehouseEntity myCurrentWarehouse) { |
|
|
|
|
String content = user.getNickName()+"在"+myCurrentWarehouse.getName()+"对配送计划:"+distributionDeliveryListEntity.getTrainNumber()+"取消发车,当前配送司机配置-->["+distributionDeliveryListEntity.getDriverName()+"]"; |
|
|
|
|
String content = user.getNickName() + "在" + myCurrentWarehouse.getName() + "对配送计划:" + distributionDeliveryListEntity.getTrainNumber() + "取消发车,当前配送司机配置-->[" + distributionDeliveryListEntity.getDriverName() + "]"; |
|
|
|
|
DistributionPlanLogEntity distributionPlanLogEntity = new DistributionPlanLogEntity(); |
|
|
|
|
distributionPlanLogEntity.setContent(content); |
|
|
|
|
distributionPlanLogEntity.setRefId(distributionDeliveryListEntity.getId()); |
|
|
|
@ -8040,7 +8035,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
private void deletedAbnormalData(Long deliveryId) { |
|
|
|
|
distributionLoadscanAbnormalService.remove(Wrappers.<DistributionLoadscanAbnormalEntity>update().lambda() |
|
|
|
|
.eq(DistributionLoadscanAbnormalEntity::getDeliveryListId,deliveryId) |
|
|
|
|
.eq(DistributionLoadscanAbnormalEntity::getDeliveryListId, deliveryId) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -8390,17 +8385,17 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
if (!broadcastDataByArticles.isEmpty()) { |
|
|
|
|
|
|
|
|
|
broadcastDataByArticles.forEach(map -> { |
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationService.getById(map.get("reservationId").toString()); |
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationService.getById(map.get("reservationId").toString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ReservationVO reservationVO = checkListForReservationVO(data, reservationEntity); |
|
|
|
|
|
|
|
|
|
List<PackageData> packageDataList = reservationVO.getPackageDataList(); |
|
|
|
|
if(packageDataList==null){ |
|
|
|
|
if (packageDataList == null) { |
|
|
|
|
packageDataList = new ArrayList<>(); |
|
|
|
|
reservationVO.setPackageDataList(packageDataList); |
|
|
|
|
} |
|
|
|
|
PackageData packageData =new PackageData(); |
|
|
|
|
PackageData packageData = new PackageData(); |
|
|
|
|
packageData.setPackageCode((String) map.get("packageCode")); |
|
|
|
|
PackageTypeEnums type = PackageTypeEnums.CMP; |
|
|
|
|
packageData.setPackageType(type); |
|
|
|
@ -8416,12 +8411,12 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
if (!broadcastDataByStock.isEmpty()) { |
|
|
|
|
|
|
|
|
|
for (Map<String, Object> map : broadcastDataByStock) { |
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationService.getById(map.get("reservationId").toString()); |
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationService.getById(map.get("reservationId").toString()); |
|
|
|
|
|
|
|
|
|
ReservationVO reservationVO = checkListForReservationVO(data, reservationEntity); |
|
|
|
|
|
|
|
|
|
List<PackageData> packageDataList = reservationVO.getPackageDataList(); |
|
|
|
|
if(packageDataList==null){ |
|
|
|
|
if (packageDataList == null) { |
|
|
|
|
packageDataList = new ArrayList<>(); |
|
|
|
|
reservationVO.setPackageDataList(packageDataList); |
|
|
|
|
} |
|
|
|
@ -8438,12 +8433,12 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
List<Map<String, Object>> broadcastDataByZeroOrder = baseMapper.getBroadcastDataByZeroOrder(id, warehouseId); |
|
|
|
|
if (!broadcastDataByZeroOrder.isEmpty()) { |
|
|
|
|
broadcastDataByZeroOrder.forEach(map -> { |
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationService.getById(map.get("reservationId").toString()); |
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationService.getById(map.get("reservationId").toString()); |
|
|
|
|
|
|
|
|
|
ReservationVO reservationVO = checkListForReservationVO(data, reservationEntity); |
|
|
|
|
|
|
|
|
|
List<PackageData> packageDataList = reservationVO.getPackageDataList(); |
|
|
|
|
if(packageDataList==null){ |
|
|
|
|
if (packageDataList == null) { |
|
|
|
|
packageDataList = new ArrayList<>(); |
|
|
|
|
reservationVO.setPackageDataList(packageDataList); |
|
|
|
|
} |
|
|
|
@ -8482,8 +8477,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(temp==null){ |
|
|
|
|
temp=distributionReservationService.getReservationVO(reservationEntity); |
|
|
|
|
if (temp == null) { |
|
|
|
|
temp = distributionReservationService.getReservationVO(reservationEntity); |
|
|
|
|
data.add(temp); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -8614,8 +8609,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//日志信息收集
|
|
|
|
|
List<JSONObject> packageLogs = new ArrayList<>(); |
|
|
|
|
//查询司机信息
|
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(deliveryListEntity,user,distrilbutionloadingscanDTO,isDriverFlag); |
|
|
|
|
if (Objects.isNull(distributionDeliverySelfEntity)){ |
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(deliveryListEntity, user, distrilbutionloadingscanDTO, isDriverFlag); |
|
|
|
|
if (Objects.isNull(distributionDeliverySelfEntity)) { |
|
|
|
|
return Resp.fail("当前操作人不合法"); |
|
|
|
|
} |
|
|
|
|
switch (type) { |
|
|
|
@ -8656,7 +8651,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
Boolean isAbnormalLoadingFlag = judgeIsAbnormalLoading(deliveryId, parcelListEntity, reservationId); |
|
|
|
|
if (isAbnormalLoadingFlag) { |
|
|
|
|
log.info("异常装车判定成功>>>>>>packageCode:{},reservationId:{}", distrilbutionloadingscanDTO.getBarcode(), distrilbutionloadingscanDTO.getReservationId()); |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getReservationId())){ |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getReservationId())) { |
|
|
|
|
return Resp.scanFail("请指定客户进行异常装车", "请指定客户进行异常装车"); |
|
|
|
|
} |
|
|
|
|
return R.fail(5000, "异常装车"); |
|
|
|
@ -8837,9 +8832,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
String inventoryPackageCode = distrilbutionloadingscanDTO.getBarcode(); |
|
|
|
|
//查询库存品
|
|
|
|
|
reservationId = baseMapper.selectInventoryPackageByDeliveryIdAndInventoryPackageCode(deliveryId,inventoryPackageCode); |
|
|
|
|
if (Objects.isNull(reservationId)){ |
|
|
|
|
parcelListEntity = distributionParcelListMapper.selectByOrderPackageCode(inventoryPackageCode, myCurrentWarehouse.getId()); |
|
|
|
|
reservationId = baseMapper.selectInventoryPackageByDeliveryIdAndInventoryPackageCode(deliveryId, inventoryPackageCode); |
|
|
|
|
if (Objects.isNull(reservationId)) { |
|
|
|
|
parcelListEntity = distributionParcelListMapper.selectByOrderPackageCode(inventoryPackageCode, myCurrentWarehouse.getId()); |
|
|
|
|
if (!Objects.isNull(parcelListEntity)) { |
|
|
|
|
return Resp.scanFail("请在定制品页面扫描此码", "请在定制品页面扫描此码"); |
|
|
|
|
} else { |
|
|
|
@ -9085,27 +9080,27 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
return Resp.scanFail("仓库信息不能为空", "仓库信息不能为空"); |
|
|
|
|
} |
|
|
|
|
String barcode = distrilbutionloadingscanDTO.getBarcode(); |
|
|
|
|
Long deliveryId= distrilbutionloadingscanDTO.getDeliveryId(); |
|
|
|
|
Long deliveryId = distrilbutionloadingscanDTO.getDeliveryId(); |
|
|
|
|
Long reservationId = distrilbutionloadingscanDTO.getReservationId(); |
|
|
|
|
//校验配送任务是否正常
|
|
|
|
|
DistributionDeliveryListVO deliveryList = this.getDeliveryList(deliveryId); |
|
|
|
|
if (Objects.isNull(deliveryList)){ |
|
|
|
|
log.error(method + "QUERY DELIVERY IS FAIL,DELIVERYID:{}",deliveryId); |
|
|
|
|
if (Objects.isNull(deliveryList)) { |
|
|
|
|
log.error(method + "QUERY DELIVERY IS FAIL,DELIVERYID:{}", deliveryId); |
|
|
|
|
return Resp.fail("参数缺失,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
if (Integer.parseInt(IsOrNoConstant.yes.getValue())== deliveryList.getIsStart()){ |
|
|
|
|
log.error(method + "QUERY DELIVERY IS FAIL,DELIVERYID:{}",deliveryId); |
|
|
|
|
return Resp.scanFail("异常装车失败,当前车次已发车","异常装车失败,当前车次已发车"); |
|
|
|
|
if (Integer.parseInt(IsOrNoConstant.yes.getValue()) == deliveryList.getIsStart()) { |
|
|
|
|
log.error(method + "QUERY DELIVERY IS FAIL,DELIVERYID:{}", deliveryId); |
|
|
|
|
return Resp.scanFail("异常装车失败,当前车次已发车", "异常装车失败,当前车次已发车"); |
|
|
|
|
} |
|
|
|
|
//校验此包件是否存在
|
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListMapper.selectByOrderPackageCode(barcode, myCurrentWarehouse.getId()); |
|
|
|
|
if (Objects.isNull(parcelListEntity)){ |
|
|
|
|
return Resp.scanFail("系统无编码","系统无编码"); |
|
|
|
|
if (Objects.isNull(parcelListEntity)) { |
|
|
|
|
return Resp.scanFail("系统无编码", "系统无编码"); |
|
|
|
|
} |
|
|
|
|
//查询当前异常包件锁关联的订单信息
|
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(parcelListEntity.getStockArticleId()); |
|
|
|
|
if (Objects.isNull(parcelListEntity)){ |
|
|
|
|
return Resp.scanFail("订单信息错误","订单信息错误"); |
|
|
|
|
if (Objects.isNull(parcelListEntity)) { |
|
|
|
|
return Resp.scanFail("订单信息错误", "订单信息错误"); |
|
|
|
|
} |
|
|
|
|
//查询是否在本车次进行异常装车
|
|
|
|
|
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda() |
|
|
|
@ -9116,13 +9111,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
if (!Objects.isNull(loadscanEntityList)) { |
|
|
|
|
//校验是否重复扫描
|
|
|
|
|
boolean isRepeatFlag = loadscanEntityList.stream().anyMatch(f -> reservationId.equals(f.getReservationId())); |
|
|
|
|
if (isRepeatFlag){ |
|
|
|
|
if (isRepeatFlag) { |
|
|
|
|
//当前客户存在异常装车
|
|
|
|
|
return Resp.scanFail("重复扫描","重复扫描"); |
|
|
|
|
}else { |
|
|
|
|
return Resp.scanFail("重复扫描", "重复扫描"); |
|
|
|
|
} else { |
|
|
|
|
//校验是否在其他车次存在异常
|
|
|
|
|
String abnormalTrainNumber = loadscanEntityList.stream().map(DistributionLoadscanEntity::getTrainNumber).distinct().collect(Collectors.joining(",")); |
|
|
|
|
return Resp.scanFail("此包件在"+abnormalTrainNumber+"存在异常操作","此包件在"+abnormalTrainNumber+"存在异常操作"); |
|
|
|
|
return Resp.scanFail("此包件在" + abnormalTrainNumber + "存在异常操作", "此包件在" + abnormalTrainNumber + "存在异常操作"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
@ -9131,7 +9126,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
List<String> orderPackageCodes = new ArrayList<>(); |
|
|
|
|
List<JSONObject> aaa = new ArrayList<>(); |
|
|
|
|
//查询当前司机信息
|
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(deliveryList,user,distrilbutionloadingscanDTO,isDriverFlag); |
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(deliveryList, user, distrilbutionloadingscanDTO, isDriverFlag); |
|
|
|
|
DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity(); |
|
|
|
|
DistributionReservationEntity reservationEntity = null; |
|
|
|
|
switch (deliveryList.getType()) { |
|
|
|
@ -9161,7 +9156,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//市配
|
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
log.error(method+"DELIVERY TYPE IS UNKONWN,DELIVERYID IS :{}",deliveryList.getId()); |
|
|
|
|
log.error(method + "DELIVERY TYPE IS UNKONWN,DELIVERYID IS :{}", deliveryList.getId()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
DistributionLoadscanEntity distributionLoadscanEntity = createdDistributionLoadscanEntity(deliveryList, distributionDeliverySelfEntity, reservationId, parcelListEntity, myCurrentWarehouse, user); |
|
|
|
@ -9258,6 +9253,166 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
return Resp.scanSuccess("操作成功", "异常" + abnormalTotal + "件"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R newCancelLoadingscan(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { |
|
|
|
|
String method = "######################DistributionDeliveryServiceImpl.newCancelLoadingscan"; |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getBarcode())) { |
|
|
|
|
log.error(method + "参数缺失Barcode"); |
|
|
|
|
return Resp.fail("参数缺失,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getDeliveryId())) { |
|
|
|
|
log.error(method + "参数缺失DeliveryId"); |
|
|
|
|
return Resp.fail("参数缺失,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getReservationId())) { |
|
|
|
|
log.error(method + "参数缺失ReservationId"); |
|
|
|
|
return Resp.fail("参数缺失,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getType())) { |
|
|
|
|
log.error(method + "参数缺失Type"); |
|
|
|
|
return Resp.fail("参数缺失,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
if (Objects.isNull(myCurrentWarehouse)) { |
|
|
|
|
log.error(method + "参数缺失Type()"); |
|
|
|
|
return R.fail(403, "未授权!!!"); |
|
|
|
|
} |
|
|
|
|
Long deliveryId = distrilbutionloadingscanDTO.getDeliveryId(); |
|
|
|
|
Long reservationId = distrilbutionloadingscanDTO.getReservationId(); |
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = this.getById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
if (Objects.isNull(deliveryListEntity)) { |
|
|
|
|
log.error(method + "查询配送失败,deliveryId:{}", deliveryId); |
|
|
|
|
return Resp.fail("配送信息错误,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
if (!DeliveryStartStatusConstant.daifache.getValue().equals(deliveryListEntity.getIsStart())) { |
|
|
|
|
return Resp.scanFail("当前车次已发车", "当前车次已发车"); |
|
|
|
|
} |
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationService.getById(reservationId); |
|
|
|
|
if (Objects.isNull(deliveryListEntity)) { |
|
|
|
|
log.error(method + "查询预约失败,reservationId:{}", reservationId); |
|
|
|
|
return Resp.fail("预约计划错误,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
switch (distrilbutionloadingscanDTO.getType()) { |
|
|
|
|
case 1: |
|
|
|
|
//订制品
|
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getPackageIds())) { |
|
|
|
|
log.error(method + "参数缺失PackageIds()"); |
|
|
|
|
return Resp.fail("参数缺失,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
List<Long> ids = Func.toLongList(distrilbutionloadingscanDTO.getPackageIds()); |
|
|
|
|
//校验包件是否存在签收包件
|
|
|
|
|
List<DistributionParcelListEntity> parcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda() |
|
|
|
|
.in(DistributionParcelListEntity::getId, ids) |
|
|
|
|
.eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId()) |
|
|
|
|
); |
|
|
|
|
if (parcelListEntities.isEmpty()) { |
|
|
|
|
log.error(method + "查询包件失败:packageIds:{}", ids); |
|
|
|
|
return Resp.scanFail("包件数据错误,请联系管理员", "包件数据错误,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
boolean isSignfor = parcelListEntities.stream().anyMatch(f -> OrderPackageStatusConstant.yiqianshou.getValue().equals(f.getOrderPackageStatus())); |
|
|
|
|
if (isSignfor) { |
|
|
|
|
//存在签收包件 无法继续进行取消操作
|
|
|
|
|
String errorOrderPackageCode = parcelListEntities.stream().filter(f -> OrderPackageStatusConstant.yiqianshou.getValue().equals(f.getOrderPackageStatus())).map(DistributionParcelListEntity::getOrderPackageCode).collect(Collectors.joining(",")); |
|
|
|
|
return Resp.fail("操作失败," + errorOrderPackageCode + "已签收"); |
|
|
|
|
} |
|
|
|
|
boolean isLoading = parcelListEntities.stream().anyMatch(f -> OrderPackageLoadingStatusConstant.weizhuancghe.getValue().equals(f.getOrderPackageLoadingStatus())); |
|
|
|
|
if (isLoading) { |
|
|
|
|
//存在签收包件 无法继续进行取消操作
|
|
|
|
|
String errorOrderPackageCode = parcelListEntities.stream().filter(f -> OrderPackageLoadingStatusConstant.weizhuancghe.getValue().equals(f.getOrderPackageLoadingStatus())).map(DistributionParcelListEntity::getOrderPackageCode).collect(Collectors.joining(",")); |
|
|
|
|
return Resp.fail("操作失败," + errorOrderPackageCode + "未装车"); |
|
|
|
|
} |
|
|
|
|
//进行装车取消
|
|
|
|
|
distributionLoadscanService.remove(Wrappers.<DistributionLoadscanEntity>update().lambda() |
|
|
|
|
.eq(DistributionLoadscanEntity::getDeliveryId, deliveryId) |
|
|
|
|
.eq(DistributionLoadscanEntity::getReservationId, reservationId) |
|
|
|
|
.in(DistributionLoadscanEntity::getPackageId, ids) |
|
|
|
|
); |
|
|
|
|
//包件状态维护
|
|
|
|
|
distributionParcelListService.update(Wrappers.<DistributionParcelListEntity>update().lambda() |
|
|
|
|
.in(DistributionParcelListEntity::getId, ids) |
|
|
|
|
.set(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.weizhuancghe.getValue()) |
|
|
|
|
); |
|
|
|
|
//维护订单
|
|
|
|
|
String orderCode = parcelListEntities.stream().map(DistributionParcelListEntity::getOrderCode).collect(Collectors.joining(",")); |
|
|
|
|
distributionStockArticleService.maintenanceOrderInfo(orderCode, myCurrentWarehouse.getId()); |
|
|
|
|
//增加日志
|
|
|
|
|
List<JSONObject> cancelPackageLogList = handleCancelPackagelog(parcelListEntities, myCurrentWarehouse, deliveryListEntity.getTrainNumber(), reservationEntity.getReservationCode()); |
|
|
|
|
if (!cancelPackageLogList.isEmpty()) { |
|
|
|
|
trunklinePackageTrackLogClient.addPackageTrackLog(cancelPackageLogList); |
|
|
|
|
} |
|
|
|
|
//扣减装车数量
|
|
|
|
|
distributionSignforMapper.deductionLoadingPacjageNum(reservationId,deliveryId,parcelListEntities.size()); |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
//零担
|
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getPackageIds())) { |
|
|
|
|
log.error(method + "参数缺失PackageIds()"); |
|
|
|
|
return Resp.fail("参数缺失,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
List<Long> inventoryPackageIds = Func.toLongList(distrilbutionloadingscanDTO.getPackageIds()); |
|
|
|
|
//查询库存品包件信息
|
|
|
|
|
List<DisStockListDetailEntity> disStockListDetailEntities = disStockListDetailService.listByIds(inventoryPackageIds); |
|
|
|
|
if (!disStockListDetailEntities.isEmpty()) { |
|
|
|
|
log.error(method + "查询库存品包件失败:inventoryPackageIds:{}", inventoryPackageIds); |
|
|
|
|
return Resp.scanFail("库存品包件数据错误,请联系管理员", "库存品包件数据错误,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
//查询是否存在签收
|
|
|
|
|
boolean inventoryIsSignfor = disStockListDetailEntities.stream().anyMatch(f -> InventorySigningStatusConstant.yiqianshou.getValue().equals(f.getStockSignfoStatus())); |
|
|
|
|
if (inventoryIsSignfor) { |
|
|
|
|
String errorInventoryCode = disStockListDetailEntities.stream() |
|
|
|
|
.filter(f -> InventorySigningStatusConstant.yiqianshou.getValue() |
|
|
|
|
.equals(f.getStockSignfoStatus())).map(DisStockListDetailEntity::getStockPackageCode) |
|
|
|
|
.collect(Collectors.joining(",")); |
|
|
|
|
return Resp.fail("操作失败," + errorInventoryCode + "已签收"); |
|
|
|
|
} |
|
|
|
|
boolean inventoryIsLoading= disStockListDetailEntities.stream().anyMatch(f -> InventoryLoadingStatusConstant.weizhuangche.getValue().equals(f.getStockLockingStatus())); |
|
|
|
|
if (inventoryIsLoading) { |
|
|
|
|
String errorInventoryCode = disStockListDetailEntities.stream() |
|
|
|
|
.filter(f -> InventoryLoadingStatusConstant.weizhuangche.getValue().equals(f.getStockLockingStatus())).map(DisStockListDetailEntity::getStockPackageCode) |
|
|
|
|
.collect(Collectors.joining(",")); |
|
|
|
|
return Resp.fail("操作失败," + errorInventoryCode + "未装车"); |
|
|
|
|
} |
|
|
|
|
//进行装车取消
|
|
|
|
|
distributionLoadscaninvnService.remove(Wrappers.<DistributionLoadscaninvnEntity>update().lambda() |
|
|
|
|
.eq(DistributionLoadscaninvnEntity::getDeliveryId,deliveryId) |
|
|
|
|
.eq(DistributionLoadscaninvnEntity::getReservationId,reservationId) |
|
|
|
|
.in(DistributionLoadscaninvnEntity::getInventoryPackageId,inventoryPackageIds) |
|
|
|
|
.set(DistributionLoadscaninvnEntity::getScanStatus,LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
); |
|
|
|
|
//维护库存品包件状态
|
|
|
|
|
disStockListDetailService.update(Wrappers.<DisStockListDetailEntity>update().lambda() |
|
|
|
|
.in(DisStockListDetailEntity::getId,inventoryPackageIds) |
|
|
|
|
.set(DisStockListDetailEntity::getStockLockingStatus,InventoryLoadingStatusConstant.weizhuangche.getValue()) |
|
|
|
|
); |
|
|
|
|
//装车数量扣减
|
|
|
|
|
distributionSignforMapper.deductionLoadingPacjageNum(reservationId,deliveryId,inventoryPackageIds.size()); |
|
|
|
|
//库存品
|
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
log.error(method + "未知Type:{}", distrilbutionloadingscanDTO.getType()); |
|
|
|
|
return Resp.scanFail("操作失败", "操作失败"); |
|
|
|
|
} |
|
|
|
|
//维护预约计划
|
|
|
|
|
distributionReservationService.maintenanceReservationInfo(reservationId); |
|
|
|
|
//维护配送计划
|
|
|
|
|
this.maintenanceDeliveryInfo(deliveryId); |
|
|
|
|
return Resp.scanSuccess("操作成功","操作成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<JSONObject> handleCancelPackagelog(List<DistributionParcelListEntity> parcelListEntities, BasicdataWarehouseEntity warehouse, String trainNumber, String reservationCode) { |
|
|
|
|
List<JSONObject> packageLogList = new ArrayList<>(); |
|
|
|
|
String content = "包件在" + warehouse.getName() + "由" + AuthUtil.getNickName() + "取消装车,配送车次号:" + trainNumber + "预约任务号:" + reservationCode; |
|
|
|
|
for (DistributionParcelListEntity parcelListEntity : parcelListEntities) { |
|
|
|
|
JSONObject trunklinePackageTrackLog = handleLogJSONObject(warehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_CANCEL_LOADING.getCode()); |
|
|
|
|
packageLogList.add(trunklinePackageTrackLog); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return packageLogList; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateZeroLoadingEntity(DistributionLoadscanEntity loadscanEntity, DistributionParcelNumberDTO parcelListDTO, BasicdataWarehouseEntity myCurrentWarehouse, Map<Long, DistributionParcelNumberEntity> zeroPackageMap) { |
|
|
|
|
//维护零担出库数量
|
|
|
|
|
DistributionParcelNumberEntity parcelNumberEntity = zeroPackageMap.get(parcelListDTO.getParcelListId()); |
|
|
|
@ -9388,6 +9543,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
loadscanEntity.setDeliveryId(deliveryListEntity.getId()); |
|
|
|
|
loadscanEntity.setOrderId(parcelListEntity.getStockArticleId()); |
|
|
|
|
loadscanEntity.setScanTime(now); |
|
|
|
|
loadscanEntity.setIsZero(Integer.parseInt(IsOrNoConstant.no.getValue())); |
|
|
|
|
loadscanEntity.setScanUser(user.getNickName()); |
|
|
|
|
loadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId() + ""); |
|
|
|
|
loadscanEntity.setIsAbnormalLoading(1); |
|
|
|
@ -9440,7 +9596,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//查看是否存在满足条件的预约单
|
|
|
|
|
boolean flag = reservationEntityList.stream().anyMatch(r -> Func.isNotEmpty(r.getConsignee()) && r.getConsignee().equals(stockArticleEntity.getCustomerName()) && r.getDeliveryAddress().equals(stockArticleEntity.getCustomerAddress()) && r.getDeliveryPhone().equals(stockArticleEntity.getCustomerTelephone()) && r.getMallName().equals(stockArticleEntity.getMallName()) && r.getId().equals(reservationId)); |
|
|
|
|
//存在多个,操作人指定具体客户即可
|
|
|
|
|
if ( flag) { |
|
|
|
|
if (flag) { |
|
|
|
|
List<DistributionReservationEntity> reservationEntities = reservationEntityList.stream().filter(r -> Func.isNotEmpty(r.getConsignee()) && r.getConsignee().equals(stockArticleEntity.getCustomerName()) && r.getDeliveryAddress().equals(stockArticleEntity.getCustomerAddress()) && r.getDeliveryPhone().equals(stockArticleEntity.getCustomerTelephone()) && r.getMallName().equals(stockArticleEntity.getMallName()) && r.getId().equals(reservationId)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|