diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java index fe69d7e7f..7d29406d2 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java @@ -128,6 +128,18 @@ public class DistributionSignforController extends BladeController { return r; } + /** + * 异常装车包件列表 + */ + @PostMapping("/loadingAbnormalPackageListTurnDown") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "详情", notes = "传入distributionSignfor") + public R loadingAbnormalPackageListTurnDown(@RequestParam("ids") String ids) { + R r = distributionSignforService.loadingAbnormalPackageListTurnDown(ids); + return r; + } + + /** * 签收管理 签收订单统计 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.java index 64999690c..23af97b38 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.java @@ -376,4 +376,7 @@ public interface DistributionSignforMapper extends BaseMapper + + UPDATE logpm_distribution_signfor lds set lds.loaded_number = ( lds.loaded_number - #{loadingNum} ),received_quantity = (lds.received_quantity - #{signforNum}) WHERE + lds.is_deleted =0 and lds.reservation_id = #{reservationId} and loaded_number !=0 and lds.delivery_id = + #{deliveryId} + DELETE FROM logpm_distribution_signfor diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java index 9c3fad969..652542e27 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java @@ -357,4 +357,12 @@ public interface IDistributionSignforService extends BaseService exportDistributionSignforInventoryList(Long id); + + /** + * 异常驳回 + * @param ids + * @return + */ + R loadingAbnormalPackageListTurnDown(String ids); + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java index aea27bf4c..10f6c71fd 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java @@ -3145,7 +3145,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { } pushInstallDTO.setOrder(orderList); pushInstallDTO.setOrder_detail(orderDetailList); - log.info(">>>>>>>>>>>>>>安装推送整理数据",JSONObject.toJSON(pushInstallDTO)); + log.info(">>>>>>>>>>>>>>安装推送整理数据:{}",JSONObject.toJSON(pushInstallDTO)); String jsonString = JSONObject.toJSONString(pushInstallDTO); rabbitTemplate.convertAndSend(RabbitConstant.PUSH_INSTALL_PLATFORM_EXCHANGE, RabbitConstant.PUSH_INSTALL_PLATFORM_ROUTING, jsonString); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java index b113fb5d1..1fc94d6e5 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java @@ -6479,6 +6479,90 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl list = Func.toLongList(ids); + List abnormalEntities = distributionLoadscanAbnormalService.listByIds(list); + + int loadingNum = 0; + int signforNum = 0; + List packageIdList = new ArrayList<>(); + List orderIds = new ArrayList<>(); + Long reservationId = null; + Long deliveryId = null; + if (!abnormalEntities.isEmpty()) { + List rIds = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getReservationId).distinct().collect(Collectors.toList()); + List dIds = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getDeliveryListId).distinct().collect(Collectors.toList()); + List packageIds = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getPackageId).distinct().collect(Collectors.toList()); + if (rIds.size()>1){ + log.error(method+"查询出多个reservatyionId:{}",rIds); + return R.fail("数据错误,请联系管理员"); + } + if (dIds.size()>1){ + log.error(method+"查询出多个deliveryId:{}",dIds); + return R.fail("数据错误,请联系管理员"); + } + reservationId = rIds.get(0); + deliveryId = dIds.get(0); + List loadscanEntityList = distributionLoadscanService.list(Wrappers.query().lambda() + .in(DistributionLoadscanEntity::getPackageId, packageIds) + .eq(DistributionLoadscanEntity::getReservationId, reservationId) + .eq(DistributionLoadscanEntity::getDeliveryId, deliveryId) + .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) + ); + List updateList = new ArrayList<>(); + if (!loadscanEntityList.isEmpty()) { + Map loadscanMap = loadscanEntityList.stream().collect(Collectors.toMap(DistributionLoadscanEntity::getPackageId, Function.identity(), (k, v) -> k)); + //存在异常列表 + //进行异常列表的清理 + for (DistributionLoadscanAbnormalEntity abnormalEntity : abnormalEntities) { + abnormalEntity.setAuditingStatus(3); + abnormalEntity.setAuditingUser(AuthUtil.getNickName()); + abnormalEntity.setAuditingTime(new Date()); + abnormalEntity.setIsDeleted(1); + updateList.add(abnormalEntity); + //收集需要进行维护的包件 + packageIdList.add(abnormalEntity.getPackageId()); + //查询是否进行签收 +// 统计需要进行扣减的签收数量 + if (Func.isNotEmpty(loadscanMap.get(abnormalEntity.getPackageId()))){ + //获取装车记录 + DistributionLoadscanEntity distributionLoadscanEntity = loadscanMap.get(abnormalEntity.getPackageId()); + orderIds.add(distributionLoadscanEntity.getOrderId()); + if (distributionLoadscanEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())){ + signforNum++; + } + }else { + //异常驳回无装车记录 + log.error(method+"异常驳回无装车记录"); + throw new RuntimeException("异常驳货列表存在无装车信息"); + } + loadingNum++; + } + } + //进行装车记录的统计 + } + //扣减装车和签收数 + distributionSignforMapper.deductionLoadingAndSignforPacjageNum(reservationId,deliveryId,loadingNum,signforNum); + //恢复包件数据 + distributionParcelListService.update(Wrappers.update().lambda() + .in(DistributionParcelListEntity::getId,packageIdList) + .set(DistributionParcelListEntity::getOrderPackageReservationStatus,OrderPackageReservationStatusConstant.daiyuyue.getValue()) + .set(DistributionParcelListEntity::getOrderPackageLoadingStatus,OrderPackageLoadingStatusConstant.weizhuancghe.getValue()) + .set(DistributionParcelListEntity::getOrderPackageStatus,OrderPackageStatusConstant.yiruku.getValue()) + .set(DistributionParcelListEntity::getOrderPackageStockupStatus,OrderPackageStockupStatusConstant.daibeihuo.getValue()) + ); + + //维护相关的订单信息 + distributionStockArticleService.maintenanceOrderInfoByIds(orderIds); + return R.success("异常驳回成功"); + } + private void buildNameAndPhone(List pushOldPackageSigning) { for (SignPushDataUnitDTO signPushDataUnitDTO : pushOldPackageSigning) { User user = bladeRedis.get(RedisKeyConstant.USER_NAME_PHONE_KEY + signPushDataUnitDTO.getAdministratorsId());