diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java b/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java index 13a14e86a..f3c21af39 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java @@ -421,6 +421,20 @@ public abstract class FanoutConstants { } } + + /** + * 异常审核 + * @see org.springblade.common.model.ReservationVO + */ + interface DeliveryAbnormalReview { + + String EXCHANGE = "fanout.distribution.abnormal " + ModuleNameConstant.DEVAUTH; + + interface QUEUE { + String REPORT = "fanout.distribution.DeliveryAbnormalReview.report" + ModuleNameConstant.DEVAUTH; + } + } + } diff --git a/blade-biz-common/src/main/java/org/springblade/common/enums/BizOperationEnums.java b/blade-biz-common/src/main/java/org/springblade/common/enums/BizOperationEnums.java index 0b744f973..9dbc4324d 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/enums/BizOperationEnums.java +++ b/blade-biz-common/src/main/java/org/springblade/common/enums/BizOperationEnums.java @@ -14,6 +14,7 @@ public enum BizOperationEnums implements IDict { MODIFY(2, "修改"), DELETE(3, "删除"), REMOVE(4, "移除"), + ABNORMAL(5, "异常"), ; BizOperationEnums(Integer code, String value) { diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/AbnormalPackageVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/AbnormalPackageVO.java new file mode 100644 index 000000000..7f5784cca --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/model/AbnormalPackageVO.java @@ -0,0 +1,57 @@ +package org.springblade.common.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springblade.common.enums.PackageTypeEnums; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 提送数据 + * + * @author zhaoqiaobo + * @create 2024-03-18 0:45 + */ +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +public class AbnormalPackageVO implements Serializable { + + /** + * 审核状态 1-未审核 2-已审核 3-已驳回 4-已取消 5 - 拒签 + */ + private Integer auditingStatus; + /** + * 包条码 + */ + private String packageCode; + /** + * 车次号 + */ + private String trainNumber; + /** + * 异常类型 1-装车异常(计划内 未装车) + * 2-计划异常(计划外进行装车) + * 3-签收异常(计划外未装车进行签收) + * 4-异常签收失败(满足异常签收但是进行拒签) + * 5-取消异常计划(取消此次配送计划) + */ + private Integer abnormalType; + /** + * 操作时间 + */ + private Date auditingTime; + /** + * 审核操作人 + */ + private String auditingUser; + + private ReservationVO reservationVO; + + +} diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/PackageData.java b/blade-biz-common/src/main/java/org/springblade/common/model/PackageData.java index 6d1be8c22..b3877ef89 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/model/PackageData.java +++ b/blade-biz-common/src/main/java/org/springblade/common/model/PackageData.java @@ -162,5 +162,7 @@ public class PackageData implements Serializable { private Long finalNodeId; private String finalNodeName; + private Integer examine; + } diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/ReservationVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/ReservationVO.java index aa79446ff..23396d321 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/model/ReservationVO.java +++ b/blade-biz-common/src/main/java/org/springblade/common/model/ReservationVO.java @@ -86,4 +86,5 @@ public class ReservationVO { + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionNodeWorkService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionNodeWorkService.java index db2c816e1..b238e9736 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionNodeWorkService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionNodeWorkService.java @@ -144,4 +144,10 @@ public interface IDistributionNodeWorkService { */ void fail(); + + /** + * 异常签收 + */ + void abnormalDeliveryAbnormalReview(NodeFanoutMsg nodeFanoutMsg, BladeUser user); + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionNodeWorkServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionNodeWorkServiceImpl.java index e23426cc8..b01707bd7 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionNodeWorkServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionNodeWorkServiceImpl.java @@ -12,16 +12,7 @@ import com.logpm.factorydata.vo.PushData; import lombok.extern.slf4j.Slf4j; import org.springblade.common.constant.WorkNodeEnums; import org.springblade.common.constant.broadcast.FanoutConstants; -import org.springblade.common.model.CarStartVO; -import org.springblade.common.model.ConsigneeArriveVO; -import org.springblade.common.model.DistributionLoadVO; -import org.springblade.common.model.DistributionReCheckSignVO; -import org.springblade.common.model.DistributionSignforVO; -import org.springblade.common.model.DistributionTaskVO; -import org.springblade.common.model.FanoutMsg; -import org.springblade.common.model.NodeFanoutMsg; -import org.springblade.common.model.ReservationVO; -import org.springblade.common.model.StockUpVO; +import org.springblade.common.model.*; import org.springblade.common.model.workNode.DeliveryOfPickupPlanVO; import org.springblade.common.model.workNode.FinishDistributionTrainVO; import org.springblade.common.model.workNode.PickUpByReCheckVO; @@ -275,6 +266,17 @@ public class DistributionNodeWorkServiceImpl implements IDistributionNodeWorkSer } + @Override + public void abnormalDeliveryAbnormalReview(NodeFanoutMsg nodeFanoutMsg, BladeUser user) { + try { + if (distributionProperties.getSendFanoutMsg()) { + rabbitTemplate.convertAndSend(FanoutConstants.distribution.DeliveryAbnormalReview.EXCHANGE, null, com.alibaba.fastjson.JSONObject.toJSONString(nodeFanoutMsg)); + } + } catch (AmqpException e) { + log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 消息推送失败~ 请联系管理员! ", e); + } + } + @Retryable(value = Exception.class, maxAttempts = 3, backoff = @Backoff(value = 3000, multiplier = 1.5)) private void sendFanoutMsg(FanoutMsg fanoutMsg) { diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java index cd1cc884c..ed0f34446 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java @@ -3686,6 +3686,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl map = new HashMap<>(); map.put("1", Collections.singletonList(reservationPackageEntity)); - NodeFanoutMsg nodeFanoutMsg = distributionReservationService.buildNodeFanoutMsgByReservation(reservationEntity, map, BizOperationEnums.ADD); - distributionNodeWorkService.planReservation(nodeFanoutMsg,AuthUtil.getUser()); + NodeFanoutMsg nodeFanoutMsg = buildNodeFanoutMsgByAbnormalPackage(reservationEntity, map,distributionLoadscanAbnormalEntity); + distributionNodeWorkService.abnormalDeliveryAbnormalReview(nodeFanoutMsg,AuthUtil.getUser()); //维护包件的预约状态 DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(distributionLoadscanAbnormalEntity.getPackageId()); parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue()); @@ -6902,6 +6902,45 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl buildNodeFanoutMsgByAbnormalPackage(DistributionReservationEntity reservationEntity, Map map,DistributionLoadscanAbnormalEntity distributionLoadscanAbnormalEntity) { + NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg(); + if (LoadingAbnormalTypeConstant.jihuayichang.getValue().equals(distributionLoadscanAbnormalEntity.getAbnormalType())){ + nodeFanoutMsg.setNode(WorkNodeEnums.DISTRIBUTION_ABNORMAL_LOADING); + }else if (LoadingAbnormalTypeConstant.qianshouyichang.getValue().equals(distributionLoadscanAbnormalEntity.getAbnormalType())){ + nodeFanoutMsg.setNode(WorkNodeEnums.DISTRIBUTION_ABNORMAL_SIGN_FOR); + }else { + nodeFanoutMsg.setNode(WorkNodeEnums.DISTRIBUTION_ABNORMAL_LOADING); + } + nodeFanoutMsg.setNode(WorkNodeEnums.PLANNED_RESERVATION); + nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); + nodeFanoutMsg.setOperator(AuthUtil.getNickName()); + nodeFanoutMsg.setOperatorTime(new Date()); + nodeFanoutMsg.setWarehouse(reservationEntity.getWarehouseName()); + nodeFanoutMsg.setWarehouseId(reservationEntity.getWarehouseId()); + nodeFanoutMsg.setTenantId(AuthUtil.getTenantId()); + AbnormalPackageVO abnormalPackageVO = new AbnormalPackageVO(); + abnormalPackageVO.setAbnormalType(distributionLoadscanAbnormalEntity.getAbnormalType()); + abnormalPackageVO.setPackageCode(distributionLoadscanAbnormalEntity.getPackageCode()); + abnormalPackageVO.setTrainNumber(distributionLoadscanAbnormalEntity.getTrainNumber()); + abnormalPackageVO.setAuditingTime(distributionLoadscanAbnormalEntity.getAuditingTime()); + abnormalPackageVO.setAuditingStatus(distributionLoadscanAbnormalEntity.getAuditingStatus()); + abnormalPackageVO.setAuditingUser(distributionLoadscanAbnormalEntity.getAuditingUser()); + ReservationVO reservationVO = distributionReservationService.getReservationVO(reservationEntity); + List packageDataList = new ArrayList<>(); + List list = map.get("1"); + for (DistributionReservationPackageEntity distributionReservationPackageEntity : list) { + PackageData packageData = new PackageData(); + packageData.setPackageCode(distributionReservationPackageEntity.getPacketBarCode()); + packageData.setPackageType(PackageTypeEnums.CMP); + packageData.setNumber(1); + packageDataList.add(packageData); + } + abnormalPackageVO.setReservationVO(reservationVO); + reservationVO.setPackageDataList(packageDataList); + nodeFanoutMsg.setMain(abnormalPackageVO); + return nodeFanoutMsg; + } + @NotNull private static DistributionReservationPackageEntity getDistributionReservationPackageEntity(DistributionReservationEntity reservationEntity, DistributionLoadscanAbnormalEntity distributionLoadscanAbnormalEntity) { DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity(); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java index c2c84e910..24cb21dcd 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java @@ -137,10 +137,9 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl packageAllowCount ? packageAllowCount : packageAllowCount - 1; if (packageAllowCount < taskNumber) { - return R.fail("拆单包件数量不足,请重新填写,目前可拆单数量:" + tipNumber); - } - if (packageAllCount <= taskNumber) { - return R.fail("拆单数需要小于订单总数量,请重新填写,目前可拆单数量:" + tipNumber); + return R.fail("拆单包件数量不足,请重新填写,目前可拆单数量:" + packageAllowCount); } taskLock(stockArticleId, () -> { @@ -272,7 +267,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpllambdaQuery() .in(DistributionParcelListEntity::getOrderPackageCode, packageCodes) - .ne(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue()) + .eq(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiruku.getValue()) .eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue()) .eq(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.weizhuancghe.getValue()) .eq(DistributionParcelListEntity::getOrderPackageFreezeStatus, OrderPackageFreezeStatusConstant.weidongjie.getValue()) @@ -968,24 +963,30 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl res = new HashMap<>(); + DistributionSplitOrderTaskEntity task = getById(taskId); res.put("packageList", PackageOrderList.getData()); res.put("logList", logList); - res.put("info", getById(taskId)); + res.put("info", task); + res.put("allInfo", distributionSplitOrderAllTaskService.getById(task.getSplitOrderAllTaskId())); return R.data(res); } public long getSplitOrderAllowCount(Long stockArticleId) { - return distributionParcelListService.count( + long splitOrderAllCount = getSplitOrderAllCount(stockArticleId); + + long allowCount = distributionParcelListService.count( Wrappers.lambdaQuery() .in(DistributionParcelListEntity::getStockArticleId, stockArticleId) - .ne(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue()) + .eq(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiruku.getValue()) .eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue()) .eq(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.weizhuancghe.getValue()) .eq(DistributionParcelListEntity::getOrderPackageFreezeStatus, OrderPackageFreezeStatusConstant.weidongjie.getValue()) .eq(DistributionParcelListEntity::getIsTransfer, 0) ); + + return allowCount >= splitOrderAllCount ? allowCount - 1 : allowCount; } public long getSplitOrderAllCount(Long stockArticleId) { @@ -1020,10 +1021,9 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl '2024-10-22 00:00:00' and lww.document_making_time > '2024-10-22 00:00:00' and lww.departure_warehouse_id != lww.destination_warehouse_id @@ -2879,7 +2894,16 @@ left join logpm_trunkline_advance lta on lta.id = ltad.advance_id left join logpm_warehouse_waybill lww on lww.id = ltad.waybill_id left join logpm_warehouse_warehouse waw on waw.id = ltad.warehouse_id - left join logpm_trunkline_cars_load_scan ltcls on ltcls.scan_code = ltad.order_package_code and ltcls.warehouse_id = ltad.warehouse_id and ltcls.type = 1 and ltcls.scan_status != 4 + left join ( + SELECT + t1.* + FROM logpm_trunkline_cars_load_scan t1 + LEFT JOIN logpm_trunkline_cars_load_scan t2 ON t1.scan_code = t2.scan_code + AND ((t2.warehouse_id IS NOT NULL AND t1.warehouse_id IS NULL) + OR(t1.warehouse_id IS NOT NULL and t2.warehouse_id IS NOT NULL AND t1.create_time < t2.create_time)) + WHERE + t2.scan_code IS NULL + ) ltcls on ltcls.scan_code = ltad.order_package_code and ltcls.warehouse_id = ltad.warehouse_id and ltcls.type = 1 and ltcls.scan_status != 4 left join logpm_trunkline_cars_load_line ltcll on ltcll.load_id = ltcls.load_id and ltcll.node_id = ltcls.warehouse_id where ltad.create_time > '2024-10-22 00:00:00' and lww.document_making_time > '2024-10-22 00:00:00' diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java index 5946e2af6..17d636f55 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java @@ -547,17 +547,20 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService { } + Map parcelMap = new HashMap<>(); List addList = new ArrayList<>(); List noUnloadList = trunklineCarsLoadScanService.findUnloadCheckAbnormalNoUnloadList(loadId, warehouseId); //把noUnloadList中所有元素的scanCode放入一个List List scanCodeList = noUnloadList.stream().map(TrunklineCarsLoadScanEntity::getScanCode).collect(Collectors.toList()); - FindParamterDTO findParamterDTO = new FindParamterDTO(); - findParamterDTO.setOrderPackageCodeList(scanCodeList); - findParamterDTO.setWarehouseId(warehouseId); - List parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO); - //把parcelListEntityList转化成以orderPackageCode作为key的Map - Map parcelMap = parcelListEntityList.stream() - .collect(Collectors.toMap(DistributionParcelListEntity::getOrderPackageCode, Function.identity())); + if(CollUtil.isNotEmpty(scanCodeList)){ + FindParamterDTO findParamterDTO = new FindParamterDTO(); + findParamterDTO.setOrderPackageCodeList(scanCodeList); + findParamterDTO.setWarehouseId(warehouseId); + List parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO); + //把parcelListEntityList转化成以orderPackageCode作为key的Map + parcelMap = parcelListEntityList.stream() + .collect(Collectors.toMap(DistributionParcelListEntity::getOrderPackageCode, Function.identity())); + } for (TrunklineCarsLoadScanEntity trunklineCarsLoadScanEntity : noUnloadList) { String loadCode = trunklineCarsLoadScanEntity.getLoadCode(); 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 8aa67349c..e4a5a7055 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 @@ -13570,11 +13570,15 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl advanceMap = new HashMap<>(); //把allAdvanceDetailList中所有advanceId放入一个Set集合 Set advanceIdSet = allAdvanceDetailList.stream().map(TrunklineAdvanceDetailEntity::getAdvanceId).collect(Collectors.toSet()); - List advanceEntities = advanceService.findListByIds(new ArrayList<>(advanceIdSet)); - //把advanceEntities转化成id为key的Map - Map advanceMap = advanceEntities.stream().collect(Collectors.toMap(TrunklineAdvanceEntity::getId, Function.identity())); + if(CollUtil.isNotEmpty(advanceIdSet)){ + List advanceEntities = advanceService.findListByIds(new ArrayList<>(advanceIdSet)); + //把advanceEntities转化成id为key的Map + advanceMap = advanceEntities.stream().collect(Collectors.toMap(TrunklineAdvanceEntity::getId, Function.identity())); + } + //把allAdvanceDetailList转化成orderPackageCode为key的Map @@ -13586,6 +13590,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl orderPackageCodeList = new ArrayList<>(); Set orderPackageCodeSet = new HashSet<>(); + Map finalAdvanceMap = advanceMap; carsLoadScanEntities.forEach(carsLoadScanEntity -> { String orderPackageCode = carsLoadScanEntity.getScanCode(); Date unloadTime = carsLoadScanEntity.getUnloadTime(); @@ -13610,7 +13615,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl