|
|
@ -1109,7 +1109,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private NodeFanoutMsg<DistributionLoadVO> buildNodeFanoutMsgByPackage(DistributionDeliveryListEntity distributionDeliveryListEntity, List<DistributionLoadscanEntity> pushNodeList) { |
|
|
|
private NodeFanoutMsg<DistributionLoadVO> buildNodeFanoutMsgByPackage(DistributionDeliveryListEntity distributionDeliveryListEntity, List<DistributionLoadscanEntity> pushNodeList) { |
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = new NodeFanoutMsg(); |
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = new NodeFanoutMsg(); |
|
|
|
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); |
|
|
|
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); |
|
|
@ -3592,7 +3591,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull |
|
|
|
@NotNull |
|
|
|
private DistributionTaskVO getDistributionTaskVO(DistributionDeliveryListEntity distributionDeliveryListEntity) { |
|
|
|
private DistributionTaskVO getDistributionTaskVO(DistributionDeliveryListEntity distributionDeliveryListEntity) { |
|
|
|
DistributionTaskVO distributionTaskVO = new DistributionTaskVO(); |
|
|
|
DistributionTaskVO distributionTaskVO = new DistributionTaskVO(); |
|
|
@ -3610,7 +3608,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean checkList(List<DistributionReservationPackageEntity> list, Long id, Long stockArticleId, String orderPackageCode) { |
|
|
|
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)); |
|
|
|
return list.stream().anyMatch(e -> e.getStockArticleId().equals(stockArticleId) && e.getPacketBarCode().equals(orderPackageCode) && e.getReservationId().equals(id)); |
|
|
@ -4721,6 +4718,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 发车日志记录 |
|
|
|
* 发车日志记录 |
|
|
|
|
|
|
|
* |
|
|
|
* @param distributionDeliveryListEntity |
|
|
|
* @param distributionDeliveryListEntity |
|
|
|
* @param user |
|
|
|
* @param user |
|
|
|
* @param myCurrentWarehouse |
|
|
|
* @param myCurrentWarehouse |
|
|
@ -6236,7 +6234,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Resp.scanSuccess("装车成功", str.toString()); |
|
|
|
return Resp.scanSuccess("装车成功", str.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -6276,8 +6273,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib |
|
|
|
distributionLoadVO.setTrainNumber(distributionDeliveryListEntity.getTrainNumber()); |
|
|
|
distributionLoadVO.setTrainNumber(distributionDeliveryListEntity.getTrainNumber()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<PackageData> data = new ArrayList<>(); |
|
|
|
List<PackageData> data = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
for (DistributionLoadscanEntity distributionLoadscanEntity : pushNodeList) { |
|
|
|
for (DistributionLoadscanEntity distributionLoadscanEntity : pushNodeList) { |
|
|
@ -9258,6 +9253,166 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib |
|
|
|
return Resp.scanSuccess("操作成功", "异常" + abnormalTotal + "件"); |
|
|
|
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) { |
|
|
|
private void updateZeroLoadingEntity(DistributionLoadscanEntity loadscanEntity, DistributionParcelNumberDTO parcelListDTO, BasicdataWarehouseEntity myCurrentWarehouse, Map<Long, DistributionParcelNumberEntity> zeroPackageMap) { |
|
|
|
//维护零担出库数量
|
|
|
|
//维护零担出库数量
|
|
|
|
DistributionParcelNumberEntity parcelNumberEntity = zeroPackageMap.get(parcelListDTO.getParcelListId()); |
|
|
|
DistributionParcelNumberEntity parcelNumberEntity = zeroPackageMap.get(parcelListDTO.getParcelListId()); |
|
|
@ -9388,6 +9543,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib |
|
|
|
loadscanEntity.setDeliveryId(deliveryListEntity.getId()); |
|
|
|
loadscanEntity.setDeliveryId(deliveryListEntity.getId()); |
|
|
|
loadscanEntity.setOrderId(parcelListEntity.getStockArticleId()); |
|
|
|
loadscanEntity.setOrderId(parcelListEntity.getStockArticleId()); |
|
|
|
loadscanEntity.setScanTime(now); |
|
|
|
loadscanEntity.setScanTime(now); |
|
|
|
|
|
|
|
loadscanEntity.setIsZero(Integer.parseInt(IsOrNoConstant.no.getValue())); |
|
|
|
loadscanEntity.setScanUser(user.getNickName()); |
|
|
|
loadscanEntity.setScanUser(user.getNickName()); |
|
|
|
loadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId() + ""); |
|
|
|
loadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId() + ""); |
|
|
|
loadscanEntity.setIsAbnormalLoading(1); |
|
|
|
loadscanEntity.setIsAbnormalLoading(1); |
|
|
|