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 23af97b38..ccc5dc444 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 @@ -379,4 +379,37 @@ public interface DistributionSignforMapper extends BaseMapper selectPushOldInventoryPackageLoading(@Param("reservationId")Long reservationId,@Param("deliveryId") Long deliveryId); + /** + * 查询推送库存品签收包件 + * @param reservationId + * @param deliveryId + * @return + */ + List selectPushOldInventoryPackageSigning(@Param("reservationId")Long reservationId,@Param("deliveryId") Long deliveryId); + + /** + * 查询推送单个库存品装车包件 + * @param reservationId + * @param deliveryId + * @return + */ + List selectPushOldSingleInventoryPackageLoading(@Param("reservationId")Long reservationId,@Param("deliveryId") Long deliveryId,@Param("orderPackageCode") String orderPackageCode); + + /** + * 查询推送单个库存品签收包件 + * @param reservationId + * @param deliveryId + * @return + */ + List selectPushOldSingleInventoryPackageSigning(@Param("reservationId")Long reservationId,@Param("deliveryId") Long deliveryId,@Param("orderPackageCode") String orderPackageCode); + + + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml index 366294c04..be98e1163 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml @@ -1266,7 +1266,7 @@ lddl.train_number AS transNo, ldpl.waybill_number AS waybillNo, ldpl.order_code AS orderSelfNum, - IFNULL(ldpl.order_package_code ,'')AS unitNo, + IFNULL(ldpl.order_package_code ,ldpl.order_code)AS unitNo, ldpl.quantity AS num, ldl.signfor_state AS type, ldl.scan_time AS operateTime, @@ -1298,7 +1298,7 @@ lddl.train_number AS transNo, ldpl.waybill_number AS waybillNo, ldpl.order_code AS orderSelfNum, - IFNULL(ldpl.order_package_code ,'')AS unitNo, + IFNULL(ldpl.order_package_code ,ldpl.order_code)AS unitNo, ldpl.quantity AS num, ldl.signfor_state AS type, ldl.signing_time AS operateTime, @@ -1658,4 +1658,140 @@ WHERE lds.id = #{id} AND lds.is_deleted = 0 + + + + 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 906765f13..b7e7036b9 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 @@ -6562,27 +6562,26 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl 0) { -// -// //查询库存品扫描签收 -// List loadingPushOldInventory = distributionSignforMapper.selectLoadingPushOldInventory(distributionSignforEntity.getReservationId(), distributionSignforEntity.getDeliveryId()); -// List signingPushOldInventory = distributionSignforMapper.selectSigningPushOldInventory(distributionSignforEntity.getReservationId(), distributionSignforEntity.getDeliveryId()); -// if (Func.isNotEmpty(loadingPushOldInventory)) { -// buildNameAndPhone(loadingPushOldInventory); -// signPushDataUnitDTOS.addAll(loadingPushOldInventory); -// } -// -// if (Func.isNotEmpty(signingPushOldInventory)) { -// buildNameAndPhone(signingPushOldInventory); -// signPushDataUnitDTOS.addAll(signingPushOldInventory); -// } -// } + if (distributionReservationEntity.getReservationStockListNum() > 0) { + //查询是否存在转的库存品 + List pushOldInventoryPackageLoading = distributionSignforMapper.selectPushOldInventoryPackageLoading(distributionSignforEntity.getReservationId(), distributionSignforEntity.getDeliveryId()); + List pushOldInventoryPackageSigning = distributionSignforMapper.selectPushOldInventoryPackageSigning(distributionSignforEntity.getReservationId(), distributionSignforEntity.getDeliveryId()); + if (Func.isNotEmpty(pushOldInventoryPackageLoading)) { + buildNameAndPhone(pushOldInventoryPackageLoading); + signPushDataUnitDTOS.addAll(pushOldInventoryPackageLoading); + } + if (Func.isNotEmpty(pushOldInventoryPackageSigning)) { + buildNameAndPhone(pushOldInventoryPackageSigning); + signPushDataUnitDTOS.addAll(pushOldInventoryPackageSigning); + } + + } //查询签收图片 List distributionSignPrintVOS = distributionSignforMapper.selectSignImgsUrl(distributionReservationEntity.getId()); @@ -6806,24 +6805,153 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl clerkInventoryCheckPushData(String orderPackageCode) { - //查询此包件 - List loadscaninvnEntityList = distributionLoadscaninvnService.list(Wrappers.query().lambda() - .eq(DistributionLoadscaninvnEntity::getOrderPackageCode, orderPackageCode) - .ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) - ); - if (!loadscaninvnEntityList.isEmpty()) { - //未进行装车 - } - if (loadscaninvnEntityList.size()>1) { - //存在多个记录 - } - DistributionLoadscaninvnEntity loadscaninvnEntity = loadscaninvnEntityList.get(0); + Map resultMap = new HashMap<>(); + try { + //查询此包件 + List loadscaninvnEntityList = distributionLoadscaninvnService.list(Wrappers.query().lambda() + .eq(DistributionLoadscaninvnEntity::getOrderPackageCode, orderPackageCode) + .ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) + ); + if (!loadscaninvnEntityList.isEmpty()) { + //未进行装车 + resultMap.put("result", false); + resultMap.put("msg", orderPackageCode+"没有装车扫描记录"); + + return resultMap; + } + if (loadscaninvnEntityList.size()>1) { + //存在多个记录 + resultMap.put("result", false); + resultMap.put("msg", orderPackageCode+"存在多个装车扫描记录"); + return resultMap; + } + DistributionLoadscaninvnEntity loadscaninvnEntity = loadscaninvnEntityList.get(0); + //查询signfor + DistributionSignforEntity signforEntity = this.getOne(Wrappers.query().lambda() + .eq(DistributionSignforEntity::getReservationId, loadscaninvnEntity.getReservationId()) + ); + if (Func.isEmpty(signforEntity)) { + //存在多个记录 + resultMap.put("result", false); + resultMap.put("msg", orderPackageCode+"查询signfor数据错误,id:"+loadscaninvnEntity.getReservationId()); + return resultMap; + } + // 得到配送计划 + DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(loadscaninvnEntity.getDeliveryId()); + if (ObjectUtil.isEmpty(distributionDeliveryListEntity)) { + log.info(">>>>>>>>>>> clerkCheckPushDataHandler distributionDeliveryListEntity {}", distributionDeliveryListEntity); + resultMap.put("result", false); + resultMap.put("msg", "没有配送计划 distributionDeliveryListEntity"); + return resultMap; + } + // 得到配送客户 + DistributionReservationEntity distributionReservationEntity = distributionReservationMapper.selectById(loadscaninvnEntity.getReservationId()); + if (ObjectUtil.isEmpty(distributionReservationEntity)) { + log.info(">>>>>>>>>>>> clerkCheckPushDataHandler distributionReservationEntity {}", distributionReservationEntity); + resultMap.put("result", false); + resultMap.put("msg", "没有配送客户 distributionReservationEntity"); + return resultMap; + } - return null; + //组合配送信息 + SignPushDataDTO delivery = distributionDeliveryListMapper.selectPushOldDelivery(loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getDeliveryId()); + + WarehouseEntity warehouseEntity = warehouseClient.findByName(distributionReservationEntity.getWarehouseName()); + if (ObjectUtils.isNotNull(warehouseEntity)) { + // 需要增加老系统的仓库ID + delivery.setWarehouseId(Long.parseLong(warehouseEntity.getId() + "")); + delivery.setWarehouseName(warehouseEntity.getTitle()); + } + //还需要配送的出库人、配送人、操作人信息 + if (Func.isNotEmpty(delivery)) { + if ("1".equals(delivery.getKind())) { + //自主配送 + DistributionDeliverySelfEntity distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectOne(Wrappers.query().lambda() + .eq(DistributionDeliverySelfEntity::getDeliveryId, delivery.getId()) + .eq(DistributionDeliverySelfEntity::getIsMaster, 2) + ); + if (Func.isNotEmpty(distributionDeliverySelfEntity)) { + delivery.setOutId(Long.parseLong(distributionDeliverySelfEntity.getDriverId())); + delivery.setOutName(distributionDeliverySelfEntity.getDriverName()); + delivery.setOutPhone(distributionDeliverySelfEntity.getDriverPhone()); + } + } else { + //外协 + DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper.selectOne(Wrappers.query().lambda().eq(DistributionDeliveryTripartiteEntity::getDeliveryId, delivery.getId())); + if (Func.isNotEmpty(distributionDeliveryTripartiteEntity)) { + delivery.setOutName(distributionDeliveryTripartiteEntity.getDriverName()); + delivery.setOutPhone(distributionDeliveryTripartiteEntity.getDriverPhone()); + } + } + R userR = userClient.userInfoById(delivery.getAdministratorsId()); + if (Func.isNotEmpty(userR)) { + User user = userR.getData(); + delivery.setAdministratorsName(user.getName()); + delivery.setAdministratorsPhone(user.getPhone()); + } + DistributionStockupEntity distributionStockupEntity = distributionReservationMapper.selectStockup(loadscaninvnEntity.getReservationId()); + if (Func.isNotEmpty(distributionStockupEntity)) { + if (distributionStockupEntity.getAssignStatus().equals(StockAssignStatusConstant.yizhipai.getValue())) { + delivery.setOutToId(distributionStockupEntity.getStockupUserId()); + delivery.setOutToName(distributionStockupEntity.getStockupUser()); + } + + } + + //查询客户信息 + List customer = distributionReservationMapper.selectPushOldCustomer(loadscaninvnEntity.getReservationId()); + if (Func.isNotEmpty(customer)) { + //查询客户订单 + List signPushDataUnitDTOS = new ArrayList<>(); + if (distributionReservationEntity.getReservationStockListNum() > 0) { + //查询包件扫描签收 + //查询包件扫描签收 + List pushOldInventoryPackageLoading = distributionSignforMapper.selectPushOldSingleInventoryPackageLoading(loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getDeliveryId(),orderPackageCode); + List pushOldInventoryPackageSigning = distributionSignforMapper.selectPushOldSingleInventoryPackageSigning(loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getDeliveryId(),orderPackageCode); + if (Func.isNotEmpty(pushOldInventoryPackageLoading)) { + buildNameAndPhone(pushOldInventoryPackageLoading); + signPushDataUnitDTOS.addAll(pushOldInventoryPackageLoading); + } + if (Func.isNotEmpty(pushOldInventoryPackageSigning)) { + buildNameAndPhone(pushOldInventoryPackageSigning); + signPushDataUnitDTOS.addAll(pushOldInventoryPackageSigning); + } + } + + //查询签收图片 + List distributionSignPrintVOS = distributionSignforMapper.selectSignImgsUrl(distributionReservationEntity.getId()); + + if (Func.isNotEmpty(signPushDataUnitDTOS)) { + SignPushDataContactDTO signPushDataContactDTO = customer.get(0); + signPushDataContactDTO.setSignPushDataUnitDTOs(signPushDataUnitDTOS); + if (Func.isNotEmpty(distributionSignPrintVOS)) { + String urls = distributionSignPrintVOS.stream().map(DistributionSignPrintVO::getUrlRoute).collect(Collectors.joining(",")); + signPushDataContactDTO.setImage(urls); + } + if (Func.isNotEmpty(signforEntity.getClerkSignRemarks())) { + signPushDataContactDTO.setContact(signforEntity.getClerkSignRemarks()); + } + } + buildReservationNameAndPhone(customer); + //完成客户信息添加 + delivery.setSignPushDataContactDTOs(customer); + } + } + log.info(">>>> clerkCheckPushData SignPushDataDTO :{}", delivery); + resultMap = oldSystemDataPushClient.pushOldSystemSignInfo(delivery); + return resultMap; + }catch (Exception e) { + resultMap.put("result", false); + resultMap.put("msg", "数据准备错误"+e.getMessage()); + log.error(">>>>> 推送老系统签收信息报错", e); + } + resultMap.put("result", false); + resultMap.put("msg", "未知错误"); + return resultMap; } private void buildNameAndPhone(List pushOldPackageSigning) {