From 39ecc2eecae664100753cf87e826246aa3b9fa7e Mon Sep 17 00:00:00 2001 From: PigBaoBei <2739175034@qq.com> Date: Tue, 24 Sep 2024 23:23:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E8=A3=85=E8=BD=A6BUG=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/DistributionSignPrintEntity.java | 12 + .../DistributionBillLadingAppController.java | 2 - .../DistributionLoadscanAbnormalMapper.java | 9 + .../DistributionLoadscanAbnormalMapper.xml | 3 + .../mapper/DistributionLoadscanMapper.xml | 4 +- .../mapper/DistributionSignforMapper.xml | 99 +- .../IDistributionLoadscanAbnormalService.java | 9 + .../DistributionDeliveryListServiceImpl.java | 26 +- ...stributionLoadscanAbnormalServiceImpl.java | 5 + .../DistributionParcelListServiceImpl.java | 7 + .../DistributionReservationServiceImpl.java | 10 +- .../impl/DistributionSignforServiceImpl.java | 2141 +++++++++-------- 12 files changed, 1250 insertions(+), 1077 deletions(-) diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionSignPrintEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionSignPrintEntity.java index d2a332749..bdf3db3f5 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionSignPrintEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionSignPrintEntity.java @@ -82,4 +82,16 @@ public class DistributionSignPrintEntity extends TenantEntity { @ApiModelProperty(value = "预约id") private Long reservationId; + /** + * 操作人ID + */ + @ApiModelProperty(value = "操作人ID") + private Long operatorId; + + /** + * 操作人名称 + */ + @ApiModelProperty(value = "操作人名称") + private String operatorUsername; + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionBillLadingAppController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionBillLadingAppController.java index 79d1b41d7..3e6935598 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionBillLadingAppController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionBillLadingAppController.java @@ -250,6 +250,4 @@ public class DistributionBillLadingAppController extends BladeController { R b = distrilbutionBillLadingService.getReceivedImage(billLadingAppDTO); return b; } - - } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanAbnormalMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanAbnormalMapper.java index 4980df8f8..6740e567b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanAbnormalMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanAbnormalMapper.java @@ -59,4 +59,13 @@ public interface DistributionLoadscanAbnormalMapper extends BaseMapper SELECT * FROM logpm_distribution_loadscan_abnormal ${ew.customSqlSegment} + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanMapper.xml index 00a2e4bce..37df7ed41 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanMapper.xml @@ -130,9 +130,9 @@ (IF((SELECT sum(loaded_nub) FROM logpm_distribution_loadscaninvn WHERE reservation_id = #{reservationId} AND scan_state != 1 AND signfor_state = 2)is null,0,(SELECT sum(loaded_nub) FROM logpm_distribution_loadscaninvn WHERE reservation_id = #{reservationId} AND scan_state != 1 AND signfor_state = 2))) SELECT ldr.id id, GROUP_CONCAT( DISTINCT CONCAT( ldr.receiving_unit, '(', ldr.consignee ), ')' ) AS consignee, - ldr.delivery_phone AS phone, - ldr.delivery_address AS address, - ldr.remarks AS remarks, + ldr.delivery_phone AS phone, + ldr.delivery_address AS address, + ldr.remarks AS remarks, COALESCE ( ldr.reservation_num + ldr.reservation_stock_list_num, 0 ) planNumber, ( SELECT COALESCE @@ -2105,9 +2117,16 @@ ldrs.reservation_id = ldr.id AND ldrs.stock_article_status IN ( 1, 3 ) ) orderNumber, - IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 ), 0 ) AS loadingQuantity, - IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 AND signfor_state = 2), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 AND signfor_state = 2 ), 0 ) AS signforQuantity, - ( SELECT IFNULL( GROUP_CONCAT( stockup_area ), '无备货区' ) FROM logpm_distribution_stock WHERE reservation_id = ldr.id AND is_deleted = 0 ) AS stockupArea, + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND + is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM + logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = + 0 ), 0 ) AS loadingQuantity, + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND + is_deleted = 0 AND scan_status != 1 AND signfor_state = 2), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM + logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = + 0 AND signfor_state = 2 ), 0 ) AS signforQuantity, + ( SELECT IFNULL( GROUP_CONCAT( stockup_area ), '无备货区' ) FROM logpm_distribution_stock WHERE reservation_id = + ldr.id AND is_deleted = 0 ) AS stockupArea, IF (( ldr.reservation_num + ldr.reservation_stock_list_num @@ -2132,9 +2151,9 @@ SELECT ldr.id id, GROUP_CONCAT( DISTINCT CONCAT( ldr.receiving_unit, '(', ldr.consignee ), ')' ) AS consignee, - ldr.delivery_phone AS phone, - ldr.delivery_address AS address, - ldr.remarks AS remarks, + ldr.delivery_phone AS phone, + ldr.delivery_address AS address, + ldr.remarks AS remarks, COALESCE ( ldr.reservation_num + ldr.reservation_stock_list_num, 0 ) planNumber, ( SELECT COALESCE @@ -2145,9 +2164,16 @@ ldrs.reservation_id = ldr.id AND ldrs.stock_article_status IN ( 1, 3 ) ) orderNumber, - IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 ), 0 ) AS loadingQuantity, - IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 AND signfor_state = 2), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 AND signfor_state = 2 ), 0 ) AS signforQuantity, - ( SELECT IFNULL( GROUP_CONCAT( stockup_area ), '无备货区' ) FROM logpm_distribution_stock WHERE reservation_id = ldr.id AND is_deleted = 0 ) AS stockupArea, + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND + is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM + logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = + 0 ), 0 ) AS loadingQuantity, + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND + is_deleted = 0 AND scan_status != 1 AND signfor_state = 2), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM + logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = + 0 AND signfor_state = 2 ), 0 ) AS signforQuantity, + ( SELECT IFNULL( GROUP_CONCAT( stockup_area ), '无备货区' ) FROM logpm_distribution_stock WHERE reservation_id = + ldr.id AND is_deleted = 0 ) AS stockupArea, IF (( ldr.reservation_num + ldr.reservation_stock_list_num @@ -2169,16 +2195,15 @@ SELECT ldsl.id id, ldsl.sku sku, - ldsld.stock_locking_status sku, CASE ldsld.stock_signfo_status - WHEN '10' THEN '待签收' - WHEN '20' THEN '已签收' + WHEN '10' THEN '待签收' + WHEN '20' THEN '已签收' ELSE '未知' END signingStatusName, CASE ldsld.stock_locking_status - WHEN '10' THEN '待装车' - WHEN '20' THEN '已装车' + WHEN '10' THEN '待装车' + WHEN '20' THEN '已装车' ELSE '未知' END loadingStatusName, @@ -2258,7 +2283,7 @@ ldpl.order_package_reservation_status AS orderPackageReservationStatus, ldpl.order_package_loading_status AS orderPackageLoadingStatus, ldpl.material_name AS materialName, - ldpl.id AS packageId, + ldla.package_id AS packageId, CASE ldla.abnormal_type WHEN 1 THEN diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionLoadscanAbnormalService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionLoadscanAbnormalService.java index 7681b9025..cf94e01c6 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionLoadscanAbnormalService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionLoadscanAbnormalService.java @@ -57,4 +57,13 @@ public interface IDistributionLoadscanAbnormalService extends BaseService 0){ return Resp.scanFail("当前车次存在签收数据","当前车次存在签收数据"); } @@ -9014,6 +9014,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl 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)); + 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())); //存在多个,操作人指定具体客户即可 if (flag) { List 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; } else { return false; @@ -10057,7 +10064,12 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl r.getReceivingUnit().equals(stockArticleEntity.getConsigneeUnit()) && r.getMallName().equals(stockArticleEntity.getMallName())); if (flag) { - List 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()); + List 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()) + ).collect(Collectors.toList()); return true; } else { return false; diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionLoadscanAbnormalServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionLoadscanAbnormalServiceImpl.java index 88b38fe93..c7486eaff 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionLoadscanAbnormalServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionLoadscanAbnormalServiceImpl.java @@ -61,4 +61,9 @@ public class DistributionLoadscanAbnormalServiceImpl extends BaseServiceImpl logList = new ArrayList<>(); + JSONObject logJS = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_FAIL.getCode()); + logList.add(logJS); + trunklinePackageTrackLogClient.addPackageTrackLog(logList); return update; } 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 5bf43d790..bc495eb6d 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 @@ -3857,19 +3857,21 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl>>>>>>>>>>>>>>>>>reservationId:{}", distributionCancelReservationPackageDTO.getReservationId()); return R.fail("请联系管理员...."); } + if (Func.isEmpty(distributionCancelReservationPackageDTO.getPackageIds())) { + log.error(method + "packageId参数缺失"); + return R.fail("请联系管理员...."); + } List list = Func.toLongList(distributionCancelReservationPackageDTO.getPackageIds()); log.info(method + "取消包件>>>>:{}", distributionCancelReservationPackageDTO.getPackageIds()); switch (distributionCancelReservationPackageDTO.getType()) { case 1: + //取消包件 String[] split = distributionCancelReservationPackageDTO.getPackageIds().split(","); List distributionParcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionCancelReservationPackageDTO.getReservationId()); 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 635553333..9b247ff2c 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 @@ -45,6 +45,7 @@ import com.logpm.distribution.service.*; import com.logpm.distribution.vo.DistributionSignforVO; import com.logpm.distribution.vo.*; import com.logpm.distribution.vo.app.*; +import com.logpm.distribution.wrapper.DistributionDisStockListWrapper; import com.logpm.distribution.wrapper.DistributionParcelListAppWrapper; import com.logpm.distribution.wrapper.DistributionParcelListWrapper; import com.logpm.distribution.wrapper.DistributionStockArticleWrapper; @@ -68,6 +69,7 @@ import org.apache.commons.lang.StringUtils; import org.jetbrains.annotations.NotNull; import org.springblade.common.constant.*; import org.springblade.common.constant.Inventory.InventoryLoadingStatusConstant; +import org.springblade.common.constant.Inventory.InventoryPackageStatusConstant; import org.springblade.common.constant.Inventory.InventorySigningStatusConstant; import org.springblade.common.constant.billLading.BillLadingStatusConstant; import org.springblade.common.constant.common.IsOrNoConstant; @@ -688,7 +690,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl loadscanAbnormalEntityList = distributionLoadscanAbnormalService.list(Wrappers.query().lambda() @@ -729,7 +731,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(DistributionSignPrintEntity::getReservationId,reservationEntity.getId()); - lambdaQueryWrapper.eq(DistributionSignPrintEntity::getIsDeleted,0); + lambdaQueryWrapper.eq(DistributionSignPrintEntity::getReservationId, reservationEntity.getId()); + lambdaQueryWrapper.eq(DistributionSignPrintEntity::getIsDeleted, 0); List list1 = iDistributionSignPrintService.list(lambdaQueryWrapper); // 将集合中的url_route 采用,拼接在一起 - String urlRoute = list1.stream().filter(f->!f.getUrlRoute().contains("blob:")).map(DistributionSignPrintEntity::getUrlRoute).distinct().collect(Collectors.joining(",")); + String urlRoute = list1.stream().filter(f -> !f.getUrlRoute().contains("blob:")).map(DistributionSignPrintEntity::getUrlRoute).distinct().collect(Collectors.joining(",")); distributionLoadVO.setImages(urlRoute); @@ -851,41 +853,33 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl loadscanAbnormalEntityList = distributionLoadscanAbnormalService.list(Wrappers.query().lambda() + .eq(DistributionLoadscanAbnormalEntity::getReservationId, signforEntity.getReservationId()) + .eq(DistributionLoadscanAbnormalEntity::getWarehouseId, myCurrentWarehouse.getId()) + .ne(DistributionLoadscanAbnormalEntity::getComplete, Integer.parseInt(IsOrNoConstant.yes.getValue())) + ); + if (!loadscanAbnormalEntityList.isEmpty()) { + return R.fail("当前客户存在异常未完成"); + } + } - //判断该客户是否具备进行复核 - //需要满足条件,存在包件或者以备货库存品未装车和签收 boolean flag = judgmentSignIsHavePackage(signforEntity.getReservationId()); if (flag) { //该客户的包件和库存品都进行装车、签收 return R.data(200, "直接进行复核操作", "直接进行复核操作"); } else { - BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); - if (Func.isEmpty(myCurrentWarehouse)) { - return R.fail(403, "未授权!!!"); - } - WarehouseConfigEntity warehouseConfig = warehouseConfigClient.getWarehouseConfig(myCurrentWarehouse.getId()); - Integer isAutoRelease = warehouseConfig.getIsAutoRelease(); - if (Integer.parseInt(IsOrNoConstant.no.getValue()) == isAutoRelease){ - //进行异常判断拦截 - //查询是否存在异常 - List loadscanAbnormalEntityList = distributionLoadscanAbnormalService.list(Wrappers.query().lambda() - .eq(DistributionLoadscanAbnormalEntity::getReservationId, signforEntity.getReservationId()) - .eq(DistributionLoadscanAbnormalEntity::getWarehouseId, myCurrentWarehouse.getId()) - .ne(DistributionLoadscanAbnormalEntity::getComplete, Integer.parseInt(IsOrNoConstant.yes.getValue())) - ); - if (!loadscanAbnormalEntityList.isEmpty()) { - return R.fail("当前客户存在异常未完成"); - } - } - //存在满足进行资源释放的包件,返回前端进行提示确认后 return R.data(200, "此任务存在未完成包件,请确认", "此任务存在未完成包件,请确认"); + } } @@ -2984,7 +2978,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl buildDistributionSignforVOByStock(DistributionDeliveryListEntity distributionDeliveryListEntity, List pushList,String operatMode) { + private NodeFanoutMsg buildDistributionSignforVOByStock(DistributionDeliveryListEntity distributionDeliveryListEntity, List pushList, String operatMode) { NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg(); nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); @@ -3039,7 +3033,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl buildDistributionSignforVO(DistributionDeliveryListEntity distributionDeliveryListEntity, DistributionReservationEntity distributionReservationEntity, List pushList,String operatMode) { + private NodeFanoutMsg buildDistributionSignforVO(DistributionDeliveryListEntity distributionDeliveryListEntity, DistributionReservationEntity distributionReservationEntity, List pushList, String operatMode) { NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg(); nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); @@ -3426,7 +3420,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl nodeFanoutMsg = buildDistributionSignforVO(deliveryListEntity, distributionReservationEntity, pushDatas,OperatModeConstant.BATCH); + NodeFanoutMsg nodeFanoutMsg = buildDistributionSignforVO(deliveryListEntity, distributionReservationEntity, pushDatas, OperatModeConstant.BATCH); iDistributionNodeWorkService.signFor(nodeFanoutMsg, AuthUtil.getUser()); @@ -3881,7 +3875,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl nodeFanoutMsg = buildDistributionSignforVO(distributionDeliveryListEntity, reservationEntity, pushList,OperatModeConstant.SCAN); + NodeFanoutMsg nodeFanoutMsg = buildDistributionSignforVO(distributionDeliveryListEntity, reservationEntity, pushList, OperatModeConstant.SCAN); iDistributionNodeWorkService.signFor(nodeFanoutMsg, AuthUtil.getUser()); return Resp.scanSuccess("操作成功", s); @@ -4264,7 +4258,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl nodeFanoutMsg = buildDistributionSignforVOByStock(deliveryListEntity, pushList,OperatModeConstant.SCAN); + NodeFanoutMsg nodeFanoutMsg = buildDistributionSignforVOByStock(deliveryListEntity, pushList, OperatModeConstant.SCAN); iDistributionNodeWorkService.signFor(nodeFanoutMsg, AuthUtil.getUser()); @@ -4787,7 +4781,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl nodeFanoutMsg = buildConsigneeArriveVO(deliveryListEntity, reservationEntity, add, user); @@ -4808,7 +4802,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl abnormalEntities = distributionLoadscanAbnormalService.list(Wrappers.query().lambda() .eq(DistributionLoadscanAbnormalEntity::getReservationId, distributionSignfor.getReservationId()) - .ne(DistributionLoadscanAbnormalEntity::getAbnormalType, LoadingAbnormalTypeConstant.zhuangcheyichang.getValue()) + .eq(DistributionLoadscanAbnormalEntity::getComplete, Integer.parseInt(IsOrNoConstant.yes.getValue())) ); if (!abnormalEntities.isEmpty()) { boolean isAuditing = abnormalEntities.stream().anyMatch(a -> LoadingAbnormalAuditingStatusConstant.daishenhe.getValue().equals(a.getAuditingStatus())); - if (isAuditing){ - return Resp.scanFail("当前客户存在异常未操作","当前客户存在异常未操作"); - }else { + if (isAuditing) { + return Resp.scanFail("当前客户存在异常未操作", "当前客户存在异常未操作"); + } else { boolean isComplete = abnormalEntities.stream().anyMatch(b -> b.getComplete() != 1); - if (isComplete){ - return Resp.scanFail("当前客户存在回库未完成","当前客户存在回库未完成"); + if (isComplete) { + return Resp.scanFail("当前客户存在回库未完成", "当前客户存在回库未完成"); } } } - int loadingPackageNum = 0; - int loadingInventoryNum = 0; - int signingPackageNum = 0; - int signingInventoryNum = 0; - List jsonObjects = new ArrayList<>(); - -// ------------------------------------2023-09-08 一键签收调整------------------------------------------ - //1、查询本次一键签收操作是否有效 ---- > 这里一件签收针对的就是制定的任务下的包件和库存品 - // 无效 -- > 直接提示该次操作无效 无效的场景快速点击操作两次签收的动作,司机已经进行了所有的包件签收扫描但是还未进行签收确认的动作 - // 有效 -- > - // 查询该车次任务中装车的包件和库存品 此时一键签收就需要将该车次中的所有包件和库存品都进行签收 -// 此时考虑多种场景: -// 1、存在库存品 库存品未进行备货操作无法进行一件装车,但是对于已备货的库存品可以进行装车 -// 2、多个车次的配送任务进行一件签收状态、在没有进行装车操作的时候 -// -// 3、对于已经装车的库存品或者包件在一件签收的时候需要进行过滤 - this.updatePicture(distributionSignfor); - List distributionLoadscaninvnEntityLists = new ArrayList<>(); - List distributionLoadscanEntityLists = new ArrayList<>(); - //2、维护状态 DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(distributionSignfor.getReservationId()); if (Func.isEmpty(reservationEntity)) { - log.error(method + "reservationEntity参数错误:{}", reservationEntity); - return R.fail("服务器正忙~~"); + return R.fail("查询预约计划失败"); + } + DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distributionSignfor.getDeliveryId()); + if (Func.isEmpty(distributionDeliveryListEntity)) { + log.error(method + "查询配送单失败deliveryId:{}", reservationEntity); + return R.fail("查询配送计划失败"); } - Long batchLock = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + "reservationId:"+reservationEntity.getId()); + Long batchLock = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + "reservationId:" + reservationEntity.getId()); if (!Objects.isNull(batchLock)) { return R.fail("请不要重复操作"); } @@ -5382,464 +5360,494 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl jsonObjects = new ArrayList<>(); + if (SignforStatusConstant.yiqianshou.getValue().equals(distributionSignfor.getSigningStatus())) { + return Resp.scanFail("当前客户已完成复核", "当前客户已完成复核"); } - DistributionDeliverySelfEntity distributionDeliverySelfEntity = null; - if ("1".equals(distributionDeliveryListEntity.getKind())) { - //自主 - distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectOne(new QueryWrapper().lambda() - .eq(DistributionDeliverySelfEntity::getIsMaster, 2) - .eq(DistributionDeliverySelfEntity::getDeliveryId, distributionSignfor.getDeliveryId()) + List packageIds = new ArrayList<>(); + List packageCodes = new ArrayList<>(); + List aaa = new ArrayList<>(); + List orderCodes = new ArrayList<>(); + List distributionLoadscaninvnEntityLists = new ArrayList<>(); + List distributionLoadscanEntityLists = new ArrayList<>(); + int loadingPackageNum = 0; + int loadingInventoryNum = 0; + int signingPackageNum = 0; + int signingInventoryNum = 0; + if (Integer.parseInt(IsOrNoConstant.yes.getValue()) == isStrictLoading) { + Integer receivedinQuantity = distributionSignfor.getReceivedinQuantity(); + Integer receivedQuantity = distributionSignfor.getReceivedQuantity(); + //对装车数据进行查询然后批量进行签收并记录司机 + List packageLoadingData = distributionLoadscanService.list(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getReservationId, reservationEntity.getId()) + .eq(DistributionLoadscanEntity::getDriverId, deliverySelfEntity.getDeliveryId()) + .eq(DistributionLoadscanEntity::getScanUser, deliverySelfEntity.getDriverName()) + .eq(DistributionLoadscanEntity::getVehicleName, deliverySelfEntity.getVehicleNub()) + .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) ); - } else { - //三方 - DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper.selectOne(new QueryWrapper().lambda() - .eq(DistributionDeliveryTripartiteEntity::getDeliveryId, distributionSignfor.getDeliveryId()) + if (!packageLoadingData.isEmpty()) { + receivedinQuantity += packageLoadingData.stream().mapToInt(DistributionLoadscanEntity::getPackageNub).sum(); + //进行订制品和零担的批量签收 + handlePackageLoadingData(packageLoadingData, user, distributionLoadscanEntityLists, orderCodes); + } + List inventoryLoadingData = distributionLoadscaninvnService.list(Wrappers.query().lambda() + .eq(DistributionLoadscaninvnEntity::getReservationId, reservationEntity.getId()) + .eq(DistributionLoadscaninvnEntity::getDriverId, deliverySelfEntity.getDeliveryId()) + .eq(DistributionLoadscaninvnEntity::getScanUser, deliverySelfEntity.getDriverName()) + .eq(DistributionLoadscaninvnEntity::getVehicleName, deliverySelfEntity.getVehicleNub()) + .ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) ); - distributionDeliverySelfEntity = Func.copy(distributionDeliveryTripartiteEntity, DistributionDeliverySelfEntity.class); -// BeanUtils.copyProperties(distributionDeliveryTripartiteEntity, distributionDeliverySelfEntity); - } - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - if (Func.equals(distributionSignforEntity.getDriverSigning(), SignforDriverSigningStatusConstant.yiqianshou.getValue())) { - log.error(method + "重复签收deliveryId:{}", reservationEntity); - return R.fail("签收失败"); - } - //处理库存品 - //查询出该客户下的库存品信息 - List detailEntities = distributionReservationMapper.selectInventoryListByReservation(distributionSignforEntity.getReservationId()); - if (!detailEntities.isEmpty() && Func.isNotEmpty(detailEntities)) { - loadingInventoryNum += detailEntities.stream().mapToInt(DisStockListDetailEntity::getNum).sum(); - signingInventoryNum += detailEntities.stream().mapToInt(DisStockListDetailEntity::getNum).sum(); - boolean flag = detailEntities.stream().allMatch(s -> Func.isNotEmpty(s.getStockPackageCode())); - //只要库存品没有进行备货操作则不能进行一件装车操作 - if (flag) { - for (DisStockListDetailEntity detailEntity : detailEntities) { - DistributionLoadscaninvnEntity loadscaninvnEntity = distributionLoadscaninvnService.getOne(Wrappers.query().lambda() - .eq(DistributionLoadscaninvnEntity::getReservationId, detailEntity.getReservationId()) - .eq(DistributionLoadscaninvnEntity::getInventoryId, detailEntity.getStockListId()) - .eq(DistributionLoadscaninvnEntity::getOrderPackageCode, detailEntity.getStockPackageCode()) - .eq(DistributionLoadscaninvnEntity::getInventoryPackageId, detailEntity.getId()) - .ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) - ); - if (Func.isNotEmpty(loadscaninvnEntity)) { - if (!loadscaninvnEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) { - //存在库存品装车数据,这里进行签收状态修改 - loadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); - loadscaninvnEntity.setReceivedQuantity(detailEntity.getNum()); - loadscaninvnEntity.setOneClick(1); - loadscaninvnEntity.setOneQclick(2); - loadscaninvnEntity.setSigningUser(user.getNickName()); - loadscaninvnEntity.setSigningUserId(user.getUserId()); - loadscaninvnEntity.setReceivedQuantity(detailEntity.getNum()); - loadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date())); - distributionLoadscaninvnService.updateById(loadscaninvnEntity); - Integer j = distributionSignforMapper.updatesignforByinvn(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub()); - //更新签收人 - Integer m = distributionSignforMapper.updateSignUser(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), AuthUtil.getUser()); - packageLockIds.add(loadscaninvnEntity.getInventoryPackageId()); - distributionLoadscaninvnEntityLists.add(loadscaninvnEntity); + if (!inventoryLoadingData.isEmpty()) { + receivedinQuantity += inventoryLoadingData.stream().mapToInt(DistributionLoadscaninvnEntity::getPackageNub).sum(); + //进行订制品和零担的批量签收 + handleInventoryLoadingData(inventoryLoadingData, user, distributionLoadscaninvnEntityLists); + } + //维护签收数量 + distributionSignforEntity.setReceivedinQuantity(receivedinQuantity); + distributionSignforEntity.setReceivedQuantity(receivedQuantity); + if (Func.isNotEmpty(distributionSignfor.getDriverRemarks())) { + StringBuilder builder = new StringBuilder(); + builder.append(distributionSignforEntity.getDriverRemarks()).append(deliverySelfEntity.getDriverName() + ":" + distributionSignfor.getDriverRemarks()); + distributionSignforEntity.setDriverRemarks(builder.toString()); + } + } else { + if (deliverySelfEntity.getIsMaster().equals(1)) { + return Resp.scanFail("操作失败", "当前操作由主司机操作"); + } + //查询是否存在有异常未进行审核的包件 + boolean isHaveAbnormalFlag = distributionLoadscanAbnormalService.isHaveAbnormalPackage(reservationEntity.getId(), distributionDeliveryListEntity.getId(), myCurrentWarehouse.getId()); + if (isHaveAbnormalFlag) { + return Resp.scanFail("存在异常未处理", "存在异常未处理"); + } + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + //处理库存品 + //查询出该客户下的库存品信息 + List detailEntities = distributionReservationMapper.selectInventoryListByReservation(distributionSignforEntity.getReservationId()); + if (!detailEntities.isEmpty() && Func.isNotEmpty(detailEntities)) { + loadingInventoryNum += detailEntities.stream().mapToInt(DisStockListDetailEntity::getNum).sum(); + signingInventoryNum += detailEntities.stream().mapToInt(DisStockListDetailEntity::getNum).sum(); + boolean flag = detailEntities.stream().allMatch(s -> Func.isNotEmpty(s.getStockPackageCode())); + //只要库存品没有进行备货操作则不能进行一件装车操作 + if (flag) { + for (DisStockListDetailEntity detailEntity : detailEntities) { + DistributionLoadscaninvnEntity loadscaninvnEntity = distributionLoadscaninvnService.getOne(Wrappers.query().lambda() + .eq(DistributionLoadscaninvnEntity::getReservationId, detailEntity.getReservationId()) + .eq(DistributionLoadscaninvnEntity::getInventoryId, detailEntity.getStockListId()) + .eq(DistributionLoadscaninvnEntity::getOrderPackageCode, detailEntity.getStockPackageCode()) + .eq(DistributionLoadscaninvnEntity::getInventoryPackageId, detailEntity.getId()) + .ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) + ); + if (Func.isNotEmpty(loadscaninvnEntity)) { + if (!loadscaninvnEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) { + //存在库存品装车数据,这里进行签收状态修改 + loadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); + loadscaninvnEntity.setReceivedQuantity(detailEntity.getNum()); + loadscaninvnEntity.setOneClick(1); + loadscaninvnEntity.setOneQclick(2); + loadscaninvnEntity.setSigningUser(user.getNickName()); + loadscaninvnEntity.setSigningUserId(user.getUserId()); + loadscaninvnEntity.setReceivedQuantity(detailEntity.getNum()); + loadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date())); + distributionLoadscaninvnService.updateById(loadscaninvnEntity); + Integer j = distributionSignforMapper.updatesignforByinvn(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub()); + //更新签收人 + Integer m = distributionSignforMapper.updateSignUser(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), AuthUtil.getUser()); + packageLockIds.add(loadscaninvnEntity.getInventoryPackageId()); + distributionLoadscaninvnEntityLists.add(loadscaninvnEntity); + } + } else { + DistributionLoadscaninvnEntity newLoadscaninvnEntity = new DistributionLoadscaninvnEntity(); + if (Func.isNotEmpty(deliverySelfEntity.getDriverId())) { + newLoadscaninvnEntity.setDriverId(deliverySelfEntity.getDriverId()); + } + if (Func.isNotEmpty(deliverySelfEntity.getDriverName())) { + newLoadscaninvnEntity.setDriverName(deliverySelfEntity.getDriverName()); + } + if (Func.isNotEmpty(deliverySelfEntity.getVehicleId())) { + newLoadscaninvnEntity.setVehicleId(deliverySelfEntity.getVehicleId()); + } + if (Func.isNotEmpty(deliverySelfEntity.getVehicleNub())) { + newLoadscaninvnEntity.setVehicleName(deliverySelfEntity.getVehicleNub()); + } + if (Func.isNotEmpty(deliverySelfEntity.getDriverPhone())) { + newLoadscaninvnEntity.setDriverPhone(deliverySelfEntity.getDriverPhone()); + } + newLoadscaninvnEntity.setLoadingId(deliverySelfEntity.getId().toString()); + newLoadscaninvnEntity.setOrderPackageCode(detailEntity.getStockPackageCode()); + newLoadscaninvnEntity.setInventoryId(detailEntity.getStockListId()); + newLoadscaninvnEntity.setDeliveryId(distributionSignforEntity.getDeliveryId()); + newLoadscaninvnEntity.setReservationId(distributionSignforEntity.getReservationId()); + newLoadscaninvnEntity.setInventoryPackageId(detailEntity.getId()); + newLoadscaninvnEntity.setScanUser(user.getNickName()); + newLoadscaninvnEntity.setScanTime(simpleDateFormat.format(new Date())); + newLoadscaninvnEntity.setPackageNub(detailEntity.getNum()); + newLoadscaninvnEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue()); + newLoadscaninvnEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue()); + newLoadscaninvnEntity.setScanType("1"); + newLoadscaninvnEntity.setType(2); + newLoadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); + newLoadscaninvnEntity.setIsSignfor(1); + newLoadscaninvnEntity.setReceivedQuantity(detailEntity.getNum()); + newLoadscaninvnEntity.setOneClick(2); + newLoadscaninvnEntity.setOneQclick(2); + newLoadscaninvnEntity.setWarehouseId(myCurrentWarehouse.getId()); + newLoadscaninvnEntity.setWarehouseName(myCurrentWarehouse.getName()); + newLoadscaninvnEntity.setSigningUser(user.getNickName()); + newLoadscaninvnEntity.setSigningUserId(user.getUserId()); + newLoadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date())); + if (distributionSignfor.getIsClerk()) { + newLoadscaninvnEntity.setMsg("文员一键签收数据补录"); + } else { + newLoadscaninvnEntity.setMsg("司机一键签收数据补录"); + } + distributionLoadscaninvnService.save(newLoadscaninvnEntity); + distributionLoadscaninvnEntityLists.add(newLoadscaninvnEntity); + packageLockIds.add(newLoadscaninvnEntity.getInventoryPackageId()); + Integer j = distributionSignforMapper.updatesignforByinvn(newLoadscaninvnEntity.getDeliveryId(), newLoadscaninvnEntity.getReservationId(), newLoadscaninvnEntity.getPackageNub()); + + //维护预约库存品数据 + //扣减库存 + DistributionStockListEntity stockListEntity = distributionStockListService.getById(detailEntity.getStockListId()); + stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() - newLoadscaninvnEntity.getPackageNub()); + stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - newLoadscaninvnEntity.getPackageNub()); + stockListEntity.setOutboundQuantity(stockListEntity.getOutboundQuantity() + newLoadscaninvnEntity.getPackageNub()); + distributionStockListService.updateById(stockListEntity); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("code", detailEntity.getStockPackageCode()); + jsonObject.put("warehouseId", myCurrentWarehouse.getId()); + jsonObject.put("taskId", distributionSignforEntity.getReservationId()); + jsonObject.put("type", 2); + jsonObject.put("num", 1); + jsonObject.put("remark", "批量签收下架"); + jsonObjects.add(jsonObject); } + //不存在装车数据 这里需要进行装车数据的补录 + detailEntity.setStockLockingStatus(InventoryLoadingStatusConstant.yizhuangche.getValue()); + detailEntity.setStockSignfoStatus(InventorySigningStatusConstant.yiqianshou.getValue()); + disStockListDetailService.updateById(detailEntity); + } + } else { + log.error("################库存品未进行备货操作+{}", detailEntities); + return R.fail("库存品未进行备货操作"); + } + } + //查询出该签收任务下的客户对应的所有包件和零担 + List parcelListEntityList = distributionReservationMapper.selectPackageListByReservationId(distributionSignforEntity.getReservationId()); + //查询该客户下的所有零担信息 + List parcelNumberEntityList = distributionReservationMapper.selectZeroPackageListByReservationId(distributionSignforEntity.getReservationId()); + if (Func.isNotEmpty(parcelNumberEntityList)) { +// loadingPackageNum += parcelNumberEntityList.stream().mapToInt(DistributionParcelNumberDTO::getReservationNum).sum(); +// signingPackageNum += parcelNumberEntityList.stream().mapToInt(DistributionParcelNumberDTO::getReservationNum).sum(); + for (DistributionParcelNumberDTO parcelNumberEntity : parcelNumberEntityList) { + DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(parcelNumberEntity.getParcelListId()); + DistributionLoadscanEntity distributionLoadscanEntity = distributionLoadscanService.getOne(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getReservationId, distributionSignforEntity.getReservationId()) + .eq(DistributionLoadscanEntity::getPackageId, parcelNumberEntity.getParcelListId()) + .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); + DistributionParcelNumberEntity parcelNumberServiceById = distributionParcelNumberService.getOne(Wrappers.query().lambda() + .eq(DistributionParcelNumberEntity::getParcelListId, parcelNumberEntity.getId()) + ); +// Integer outboundQuantity = 0; +// Integer signinQuantity = 0; +// Integer deliveryQuantity = 0; +// Integer handQuantity = 0; + int num = 0; + if (Func.isNotEmpty(distributionLoadscanEntity)) { + //情况列举: +// 1、装车件数未按照计划数量 +// 2、装车件数齐套,签收数量未签收 +// 3、部分签收 +// 4、完成签收 + //不论什么情况均进行一次重新签收维护数量 +// DistributionParcelNumberEntity distributionParcelNumberEntity = distributionParcelNumberService.getOne(Wrappers.query().lambda().eq(DistributionParcelNumberEntity::getParcelListId, parcelNumberEntity.getId())); + //扣除在库数量 + parcelNumberServiceById.setHandQuantity(parcelNumberServiceById.getHandQuantity() + distributionLoadscanEntity.getLoadedNub() - parcelNumberEntity.getReservationNum()); + //扣除冻结数量 + parcelNumberServiceById.setDeliveryQuantity(parcelNumberServiceById.getDeliveryQuantity() + distributionLoadscanEntity.getLoadedNub() - parcelNumberEntity.getReservationNum()); + //维护出库数量 + parcelNumberServiceById.setOutboundQuantity(parcelNumberServiceById.getOutboundQuantity() - distributionLoadscanEntity.getLoadedNub() + parcelNumberEntity.getReservationNum()); + //维护签收数量 + parcelNumberServiceById.setSigninQuantity(parcelNumberServiceById.getSigninQuantity() - distributionLoadscanEntity.getLoadedNub() + parcelNumberEntity.getReservationNum()); + loadingPackageNum += (parcelNumberEntity.getReservationNum() - distributionLoadscanEntity.getLoadedNub()); + signingPackageNum += (parcelNumberEntity.getReservationNum() - distributionLoadscanEntity.getReceivedQuantity()); + Integer loadedNub = distributionLoadscanEntity.getLoadedNub(); + Integer receivedQuantity = distributionLoadscanEntity.getReceivedQuantity(); + distributionLoadscanEntity.setOneClick(1); + distributionLoadscanEntity.setOneQclick(2); + distributionLoadscanEntity.setLoadedNub(parcelNumberEntity.getReservationNum()); + distributionLoadscanEntity.setReceivedQuantity(parcelNumberEntity.getReservationNum()); + distributionLoadscanEntity.setPackageNub(parcelNumberEntity.getReservationNum()); + distributionLoadscanEntity.setSigningUser(user.getNickName()); + distributionLoadscanEntity.setSigningUserId(user.getUserId()); + distributionLoadscanEntity.setSigningTime(simpleDateFormat.format(new Date())); + distributionLoadscanEntity.setIsZero(1); + distributionLoadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); + distributionLoadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); + distributionLoadscanService.updateById(distributionLoadscanEntity); + distributionLoadscanEntityLists.add(distributionLoadscanEntity); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("code", parcelListEntity.getOrderPackageCode()); + jsonObject.put("warehouseId", myCurrentWarehouse.getId()); + jsonObject.put("taskId", distributionSignforEntity.getReservationId()); + jsonObject.put("type", 3); + jsonObject.put("num", parcelNumberEntity.getReservationNum() - distributionLoadscanEntity.getLoadedNub()); + jsonObject.put("remark", "批量签收下架"); + jsonObjects.add(jsonObject); } else { - DistributionLoadscaninvnEntity newLoadscaninvnEntity = new DistributionLoadscaninvnEntity(); - if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverId())) { - newLoadscaninvnEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); + //不存在装车数据 + DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity(); + loadscanEntity.setPackageId(parcelNumberEntity.getParcelListId()); + loadscanEntity.setOrderId(parcelNumberEntity.getStockArticleId()); + loadscanEntity.setDeliveryId(distributionSignforEntity.getDeliveryId()); + loadscanEntity.setReservationId(distributionSignforEntity.getReservationId()); + loadscanEntity.setScanUser(user.getNickName()); + loadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); + loadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); + loadscanEntity.setScanTime(simpleDateFormat.format(new Date())); + loadscanEntity.setPackageNub(parcelNumberEntity.getReservationNum()); + loadscanEntity.setLoadedNub(parcelNumberEntity.getReservationNum()); + loadscanEntity.setSigningUser(user.getNickName()); + loadscanEntity.setSigningUserId(user.getUserId()); + assert deliverySelfEntity != null; + if (Func.isNotEmpty(deliverySelfEntity.getDriverId())) { + loadscanEntity.setDriverId(deliverySelfEntity.getDriverId()); } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) { - newLoadscaninvnEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); + if (Func.isNotEmpty(deliverySelfEntity.getDriverName())) { + loadscanEntity.setDriverName(deliverySelfEntity.getDriverName()); } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) { - newLoadscaninvnEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); + if (Func.isNotEmpty(deliverySelfEntity.getVehicleId())) { + loadscanEntity.setVehicleId(deliverySelfEntity.getVehicleId()); } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) { - newLoadscaninvnEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); + if (Func.isNotEmpty(deliverySelfEntity.getVehicleNub())) { + loadscanEntity.setVehicleName(deliverySelfEntity.getVehicleNub()); } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) { - newLoadscaninvnEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); + if (Func.isNotEmpty(deliverySelfEntity.getDriverPhone())) { + loadscanEntity.setDriverPhone(deliverySelfEntity.getDriverPhone()); } - newLoadscaninvnEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString()); - newLoadscaninvnEntity.setOrderPackageCode(detailEntity.getStockPackageCode()); - newLoadscaninvnEntity.setInventoryId(detailEntity.getStockListId()); - newLoadscaninvnEntity.setDeliveryId(distributionSignforEntity.getDeliveryId()); - newLoadscaninvnEntity.setReservationId(distributionSignforEntity.getReservationId()); - newLoadscaninvnEntity.setInventoryPackageId(detailEntity.getId()); - newLoadscaninvnEntity.setScanUser(user.getNickName()); - newLoadscaninvnEntity.setScanTime(simpleDateFormat.format(new Date())); - newLoadscaninvnEntity.setPackageNub(detailEntity.getNum()); - newLoadscaninvnEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue()); - newLoadscaninvnEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue()); - newLoadscaninvnEntity.setScanType("1"); - newLoadscaninvnEntity.setType(2); - newLoadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); - newLoadscaninvnEntity.setIsSignfor(1); - newLoadscaninvnEntity.setReceivedQuantity(detailEntity.getNum()); - newLoadscaninvnEntity.setOneClick(2); - newLoadscaninvnEntity.setOneQclick(2); - newLoadscaninvnEntity.setWarehouseId(myCurrentWarehouse.getId()); - newLoadscaninvnEntity.setWarehouseName(myCurrentWarehouse.getName()); - newLoadscaninvnEntity.setSigningUser(user.getNickName()); - newLoadscaninvnEntity.setSigningUserId(user.getUserId()); - newLoadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date())); + loadscanEntity.setLoadingId(deliverySelfEntity.getId().toString()); + loadscanEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue()); + loadscanEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue()); + loadscanEntity.setScanType("1"); + loadscanEntity.setType(2); + loadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); + loadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); + loadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); + loadscanEntity.setIsSignfor(1); + loadscanEntity.setReceivedQuantity(parcelNumberEntity.getReservationNum()); + loadscanEntity.setOneClick(2); + loadscanEntity.setOneQclick(2); + loadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); + loadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); + loadscanEntity.setSigningTime(simpleDateFormat.format(new Date())); if (distributionSignfor.getIsClerk()) { - newLoadscaninvnEntity.setMsg("文员一键签收数据补录"); + loadscanEntity.setMsg("文员一键签收数据补录"); } else { - newLoadscaninvnEntity.setMsg("司机一键签收数据补录"); + loadscanEntity.setMsg("司机一键签收数据补录"); } - distributionLoadscaninvnService.save(newLoadscaninvnEntity); - distributionLoadscaninvnEntityLists.add(newLoadscaninvnEntity); - packageLockIds.add(newLoadscaninvnEntity.getInventoryPackageId()); - Integer j = distributionSignforMapper.updatesignforByinvn(newLoadscaninvnEntity.getDeliveryId(), newLoadscaninvnEntity.getReservationId(), newLoadscaninvnEntity.getPackageNub()); - - //维护预约库存品数据 - //扣减库存 - DistributionStockListEntity stockListEntity = distributionStockListService.getById(detailEntity.getStockListId()); - stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() - newLoadscaninvnEntity.getPackageNub()); - stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - newLoadscaninvnEntity.getPackageNub()); - stockListEntity.setOutboundQuantity(stockListEntity.getOutboundQuantity() + newLoadscaninvnEntity.getPackageNub()); - distributionStockListService.updateById(stockListEntity); + loadscanEntity.setIsZero(1); + distributionLoadscanService.save(loadscanEntity); + distributionLoadscanEntityLists.add(loadscanEntity); + + distributionLoadscanEntityLists.add(loadscanEntity); + num = loadscanEntity.getLoadedNub(); + + packageLockIds.add(loadscanEntity.getPackageId()); + //扣除在库数量 + parcelNumberServiceById.setHandQuantity(parcelNumberServiceById.getHandQuantity() - parcelNumberEntity.getReservationNum()); + //扣除冻结数量 + parcelNumberServiceById.setDeliveryQuantity(parcelNumberServiceById.getDeliveryQuantity() - parcelNumberEntity.getReservationNum()); + //维护出库数量 + parcelNumberServiceById.setOutboundQuantity(parcelNumberServiceById.getOutboundQuantity() + parcelNumberEntity.getReservationNum()); + //维护签收数量 + parcelNumberServiceById.setSigninQuantity(parcelNumberServiceById.getSigninQuantity() + parcelNumberEntity.getReservationNum()); + loadingPackageNum += parcelNumberEntity.getReservationNum(); + signingPackageNum += parcelNumberEntity.getReservationNum(); JSONObject jsonObject = new JSONObject(); - jsonObject.put("code", detailEntity.getStockPackageCode()); + jsonObject.put("code", parcelListEntity.getOrderPackageCode()); jsonObject.put("warehouseId", myCurrentWarehouse.getId()); jsonObject.put("taskId", distributionSignforEntity.getReservationId()); - jsonObject.put("type", 2); - jsonObject.put("num", 1); + jsonObject.put("type", 3); + jsonObject.put("num", num); jsonObject.put("remark", "批量签收下架"); jsonObjects.add(jsonObject); + } - //不存在装车数据 这里需要进行装车数据的补录 - detailEntity.setStockLockingStatus(InventoryLoadingStatusConstant.yizhuangche.getValue()); - detailEntity.setStockSignfoStatus(InventorySigningStatusConstant.yiqianshou.getValue()); - disStockListDetailService.updateById(detailEntity); + log.info(method + "维护零担信息:{}", parcelNumberServiceById); + distributionParcelNumberService.updateById(parcelNumberServiceById); + orderCodes.add(parcelListEntity.getOrderCode()); } - } else { - log.error("################库存品未进行备货操作+{}", detailEntities); - return R.fail("库存品未进行备货操作"); } - } - //查询出该签收任务下的客户对应的所有包件和零担 - List orderCodes = new ArrayList<>(); - List parcelListEntityList = distributionReservationMapper.selectPackageListByReservationId(distributionSignforEntity.getReservationId()); - //包件不需要考虑备货、装车直接可进行签收 过滤已装车的包件 -// List noLoadingPackage = parcelListEntityList.stream().filter(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())).collect(Collectors.toList()); - //查询该客户下的所有零担信息 - List parcelNumberEntityList = distributionReservationMapper.selectZeroPackageListByReservationId(distributionSignforEntity.getReservationId()); - if (Func.isNotEmpty(parcelNumberEntityList)) { -// loadingPackageNum += parcelNumberEntityList.stream().mapToInt(DistributionParcelNumberDTO::getReservationNum).sum(); -// signingPackageNum += parcelNumberEntityList.stream().mapToInt(DistributionParcelNumberDTO::getReservationNum).sum(); - for (DistributionParcelNumberDTO parcelNumberEntity : parcelNumberEntityList) { - DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(parcelNumberEntity.getParcelListId()); - DistributionLoadscanEntity distributionLoadscanEntity = distributionLoadscanService.getOne(Wrappers.query().lambda() - .eq(DistributionLoadscanEntity::getReservationId, distributionSignforEntity.getReservationId()) - .eq(DistributionLoadscanEntity::getPackageId, parcelNumberEntity.getParcelListId()) - .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); - DistributionParcelNumberEntity parcelNumberServiceById = distributionParcelNumberService.getOne(Wrappers.query().lambda() - .eq(DistributionParcelNumberEntity::getParcelListId, parcelNumberEntity.getId()) - ); -// Integer outboundQuantity = 0; -// Integer signinQuantity = 0; -// Integer deliveryQuantity = 0; -// Integer handQuantity = 0; - int num = 0; - if (Func.isNotEmpty(distributionLoadscanEntity)) { - //情况列举: -// 1、装车件数未按照计划数量 -// 2、装车件数齐套,签收数量未签收 -// 3、部分签收 -// 4、完成签收 - //不论什么情况均进行一次重新签收维护数量 -// DistributionParcelNumberEntity distributionParcelNumberEntity = distributionParcelNumberService.getOne(Wrappers.query().lambda().eq(DistributionParcelNumberEntity::getParcelListId, parcelNumberEntity.getId())); - //扣除在库数量 - parcelNumberServiceById.setHandQuantity(parcelNumberServiceById.getHandQuantity() + distributionLoadscanEntity.getLoadedNub() - parcelNumberEntity.getReservationNum()); - //扣除冻结数量 - parcelNumberServiceById.setDeliveryQuantity(parcelNumberServiceById.getDeliveryQuantity() + distributionLoadscanEntity.getLoadedNub() - parcelNumberEntity.getReservationNum()); - //维护出库数量 - parcelNumberServiceById.setOutboundQuantity(parcelNumberServiceById.getOutboundQuantity() - distributionLoadscanEntity.getLoadedNub() + parcelNumberEntity.getReservationNum()); - //维护签收数量 - parcelNumberServiceById.setSigninQuantity(parcelNumberServiceById.getSigninQuantity() - distributionLoadscanEntity.getLoadedNub() + parcelNumberEntity.getReservationNum()); - loadingPackageNum += (parcelNumberEntity.getReservationNum() - distributionLoadscanEntity.getLoadedNub()); - signingPackageNum += (parcelNumberEntity.getReservationNum() - distributionLoadscanEntity.getReceivedQuantity()); - Integer loadedNub = distributionLoadscanEntity.getLoadedNub(); - Integer receivedQuantity = distributionLoadscanEntity.getReceivedQuantity(); - distributionLoadscanEntity.setOneClick(1); - distributionLoadscanEntity.setOneQclick(2); - distributionLoadscanEntity.setLoadedNub(parcelNumberEntity.getReservationNum()); - distributionLoadscanEntity.setReceivedQuantity(parcelNumberEntity.getReservationNum()); - distributionLoadscanEntity.setPackageNub(parcelNumberEntity.getReservationNum()); - distributionLoadscanEntity.setSigningUser(user.getNickName()); - distributionLoadscanEntity.setSigningUserId(user.getUserId()); - distributionLoadscanEntity.setSigningTime(simpleDateFormat.format(new Date())); - distributionLoadscanEntity.setIsZero(1); - distributionLoadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); - distributionLoadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); - distributionLoadscanService.updateById(distributionLoadscanEntity); - distributionLoadscanEntityLists.add(distributionLoadscanEntity); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("code", parcelListEntity.getOrderPackageCode()); - jsonObject.put("warehouseId", myCurrentWarehouse.getId()); - jsonObject.put("taskId", distributionSignforEntity.getReservationId()); - jsonObject.put("type", 3); - jsonObject.put("num", parcelNumberEntity.getReservationNum() - distributionLoadscanEntity.getLoadedNub()); - jsonObject.put("remark", "批量签收下架"); - jsonObjects.add(jsonObject); - } else { - //不存在装车数据 - DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity(); - loadscanEntity.setPackageId(parcelNumberEntity.getParcelListId()); - loadscanEntity.setOrderId(parcelNumberEntity.getStockArticleId()); - loadscanEntity.setDeliveryId(distributionSignforEntity.getDeliveryId()); - loadscanEntity.setReservationId(distributionSignforEntity.getReservationId()); - loadscanEntity.setScanUser(user.getNickName()); - loadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); - loadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); - loadscanEntity.setScanTime(simpleDateFormat.format(new Date())); - loadscanEntity.setPackageNub(parcelNumberEntity.getReservationNum()); - loadscanEntity.setLoadedNub(parcelNumberEntity.getReservationNum()); - loadscanEntity.setSigningUser(user.getNickName()); - loadscanEntity.setSigningUserId(user.getUserId()); - assert distributionDeliverySelfEntity != null; - if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverId())) { - loadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); - } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) { - loadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); - } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) { - loadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); - } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) { - loadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); - } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) { - loadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); - } - loadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString()); - loadscanEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue()); - loadscanEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue()); - loadscanEntity.setScanType("1"); - loadscanEntity.setType(2); - loadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); - loadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); - loadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); - loadscanEntity.setIsSignfor(1); - loadscanEntity.setReceivedQuantity(parcelNumberEntity.getReservationNum()); - loadscanEntity.setOneClick(2); - loadscanEntity.setOneQclick(2); - loadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); - loadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); - loadscanEntity.setSigningTime(simpleDateFormat.format(new Date())); - if (distributionSignfor.getIsClerk()) { - loadscanEntity.setMsg("文员一键签收数据补录"); - } else { - loadscanEntity.setMsg("司机一键签收数据补录"); - } - loadscanEntity.setIsZero(1); - distributionLoadscanService.save(loadscanEntity); - distributionLoadscanEntityLists.add(loadscanEntity); - - distributionLoadscanEntityLists.add(loadscanEntity); - num = loadscanEntity.getLoadedNub(); - - packageLockIds.add(loadscanEntity.getPackageId()); - //扣除在库数量 - parcelNumberServiceById.setHandQuantity(parcelNumberServiceById.getHandQuantity() - parcelNumberEntity.getReservationNum()); - //扣除冻结数量 - parcelNumberServiceById.setDeliveryQuantity(parcelNumberServiceById.getDeliveryQuantity() - parcelNumberEntity.getReservationNum()); - //维护出库数量 - parcelNumberServiceById.setOutboundQuantity(parcelNumberServiceById.getOutboundQuantity() + parcelNumberEntity.getReservationNum()); - //维护签收数量 - parcelNumberServiceById.setSigninQuantity(parcelNumberServiceById.getSigninQuantity() + parcelNumberEntity.getReservationNum()); - loadingPackageNum += parcelNumberEntity.getReservationNum(); - signingPackageNum += parcelNumberEntity.getReservationNum(); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("code", parcelListEntity.getOrderPackageCode()); - jsonObject.put("warehouseId", myCurrentWarehouse.getId()); - jsonObject.put("taskId", distributionSignforEntity.getReservationId()); - jsonObject.put("type", 3); - jsonObject.put("num", num); - jsonObject.put("remark", "批量签收下架"); - jsonObjects.add(jsonObject); - - } - log.info(method + "维护零担信息:{}", parcelNumberServiceById); - distributionParcelNumberService.updateById(parcelNumberServiceById); - orderCodes.add(parcelListEntity.getOrderCode()); - } - } - String signingTime = simpleDateFormat.format(new Date()); - List packageIds = new ArrayList<>(); - List packageCodes = new ArrayList<>(); - List aaa = new ArrayList<>(); - if (Func.isNotEmpty(parcelListEntityList)) { - loadingPackageNum += parcelListEntityList.stream().mapToInt(DistributionParcelListEntity::getQuantity).sum(); - signingPackageNum += parcelListEntityList.stream().mapToInt(DistributionParcelListEntity::getQuantity).sum(); - for (DistributionParcelListEntity parcelListEntity : parcelListEntityList) { - if (OrderPackageStatusConstant.yiqianshou.getValue().equals(parcelListEntity.getOrderPackageStatus())) { - log.info("司机一键签收 >>>>>包件已签收:{}", parcelListEntity.getOrderPackageCode()); - continue; - } - //查询是否进行装车 - DistributionLoadscanEntity loadscanEntities = distributionLoadscanService.getOne(Wrappers.query().lambda() - .eq(DistributionLoadscanEntity::getPackageId, parcelListEntity.getId()) - .eq(DistributionLoadscanEntity::getDeliveryId, distributionSignforEntity.getDeliveryId()) - .eq(DistributionLoadscanEntity::getReservationId, distributionSignforEntity.getReservationId()) - .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); - parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); - parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue()); - String content = ""; - JSONObject trunklinePackageTrackLog = new JSONObject(); - if (Func.isEmpty(loadscanEntities)) { + String signingTime = simpleDateFormat.format(new Date()); + if (Func.isNotEmpty(parcelListEntityList)) { + loadingPackageNum += parcelListEntityList.stream().mapToInt(DistributionParcelListEntity::getQuantity).sum(); + signingPackageNum += parcelListEntityList.stream().mapToInt(DistributionParcelListEntity::getQuantity).sum(); + for (DistributionParcelListEntity parcelListEntity : parcelListEntityList) { + if (OrderPackageStatusConstant.yiqianshou.getValue().equals(parcelListEntity.getOrderPackageStatus())) { + log.info("司机一键签收 >>>>>包件已签收:{}", parcelListEntity.getOrderPackageCode()); + continue; + } + //查询是否进行装车 + DistributionLoadscanEntity loadscanEntities = distributionLoadscanService.getOne(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getPackageId, parcelListEntity.getId()) + .eq(DistributionLoadscanEntity::getDeliveryId, distributionSignforEntity.getDeliveryId()) + .eq(DistributionLoadscanEntity::getReservationId, distributionSignforEntity.getReservationId()) + .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); + parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); + parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue()); + String content = ""; + JSONObject trunklinePackageTrackLog = new JSONObject(); + if (Func.isEmpty(loadscanEntities)) { - //没有进行过装车操作 - DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity(); - loadscanEntity.setPackageId(parcelListEntity.getId()); - loadscanEntity.setOrderPackageCode(parcelListEntity.getOrderPackageCode()); - loadscanEntity.setOrderId(parcelListEntity.getStockArticleId()); - loadscanEntity.setDeliveryId(distributionSignforEntity.getDeliveryId()); - loadscanEntity.setReservationId(distributionSignforEntity.getReservationId()); - loadscanEntity.setScanUser(user.getNickName()); - loadscanEntity.setScanTime(signingTime); - loadscanEntity.setSignforType(LoadScanSigningTypeStatusConstant.sijipiliangqianshou.getValue()); + //没有进行过装车操作 + DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity(); + loadscanEntity.setPackageId(parcelListEntity.getId()); + loadscanEntity.setOrderPackageCode(parcelListEntity.getOrderPackageCode()); + loadscanEntity.setOrderId(parcelListEntity.getStockArticleId()); + loadscanEntity.setDeliveryId(distributionSignforEntity.getDeliveryId()); + loadscanEntity.setReservationId(distributionSignforEntity.getReservationId()); + loadscanEntity.setScanUser(user.getNickName()); + loadscanEntity.setScanTime(signingTime); + loadscanEntity.setSignforType(LoadScanSigningTypeStatusConstant.sijipiliangqianshou.getValue()); - loadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); - loadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); - loadscanEntity.setPackageNub(parcelListEntity.getQuantity()); - loadscanEntity.setSigningUser(user.getNickName()); - loadscanEntity.setSigningUserId(user.getUserId()); - if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverId())) { - loadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); - } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) { - loadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); - } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) { - loadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); - } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) { - loadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); - } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) { - loadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); - } - loadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString()); - loadscanEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue()); - loadscanEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue()); - loadscanEntity.setScanType("1"); - loadscanEntity.setType(2); - loadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); - loadscanEntity.setIsSignfor(1); - loadscanEntity.setReceivedQuantity(parcelListEntity.getQuantity()); - loadscanEntity.setOneClick(2); - loadscanEntity.setOneQclick(2); - loadscanEntity.setSigningTime(signingTime); - if (distributionSignfor.getIsClerk()) { - loadscanEntity.setMsg("文员一键签收数据补录"); + loadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); + loadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); + loadscanEntity.setPackageNub(parcelListEntity.getQuantity()); + loadscanEntity.setSigningUser(user.getNickName()); + loadscanEntity.setSigningUserId(user.getUserId()); + if (Func.isNotEmpty(deliverySelfEntity.getDriverId())) { + loadscanEntity.setDriverId(deliverySelfEntity.getDriverId()); + } + if (Func.isNotEmpty(deliverySelfEntity.getDriverName())) { + loadscanEntity.setDriverName(deliverySelfEntity.getDriverName()); + } + if (Func.isNotEmpty(deliverySelfEntity.getVehicleId())) { + loadscanEntity.setVehicleId(deliverySelfEntity.getVehicleId()); + } + if (Func.isNotEmpty(deliverySelfEntity.getVehicleNub())) { + loadscanEntity.setVehicleName(deliverySelfEntity.getVehicleNub()); + } + if (Func.isNotEmpty(deliverySelfEntity.getDriverPhone())) { + loadscanEntity.setDriverPhone(deliverySelfEntity.getDriverPhone()); + } + loadscanEntity.setLoadingId(deliverySelfEntity.getId().toString()); + loadscanEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue()); + loadscanEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue()); + loadscanEntity.setScanType("1"); + loadscanEntity.setType(2); + loadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); + loadscanEntity.setIsSignfor(1); + loadscanEntity.setReceivedQuantity(parcelListEntity.getQuantity()); + loadscanEntity.setOneClick(2); + loadscanEntity.setOneQclick(2); + loadscanEntity.setSigningTime(signingTime); + if (distributionSignfor.getIsClerk()) { + loadscanEntity.setMsg("文员一键签收数据补录"); + } else { + loadscanEntity.setMsg("司机一键签收数据补录"); + } + distributionLoadscanService.save(loadscanEntity); + packageLockIds.add(loadscanEntity.getPackageId()); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("code", parcelListEntity.getOrderPackageCode()); + jsonObject.put("warehouseId", myCurrentWarehouse.getId()); + jsonObject.put("taskId", distributionSignforEntity.getReservationId()); + jsonObject.put("type", 3); + jsonObject.put("num", 1); + jsonObject.put("remark", "批量签收下架"); + jsonObjects.add(jsonObject); + content = "包件在" + myCurrentWarehouse.getName() + "由" + loadscanEntity.getSigningUser() + "司机批量签收,装车方式:扫描装车,配送车次号:" + distributionDeliveryListEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); + trunklinePackageTrackLog = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_ABNORMAL_SIGN_FOR.getCode(), distributionDeliveryListEntity.getTrainNumber(), parcelListEntity.getWarehouseEntryTimeEnd()); + //distributionAsyncService.sendFactory(parcelListEntity, loadscanEntity.getSigningTime(), reservationEntity.getId(), reservationEntity.getReservationCode(), myCurrentWarehouse.getName(), user.getNickName()); + sendNodeWorkDataBroadcast(parcelListEntity, reservationEntity, loadscanEntity.getSigningTime(), myCurrentWarehouse); } else { - loadscanEntity.setMsg("司机一键签收数据补录"); - } - distributionLoadscanService.save(loadscanEntity); - packageLockIds.add(loadscanEntity.getPackageId()); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("code", parcelListEntity.getOrderPackageCode()); - jsonObject.put("warehouseId", myCurrentWarehouse.getId()); - jsonObject.put("taskId", distributionSignforEntity.getReservationId()); - jsonObject.put("type", 3); - jsonObject.put("num", 1); - jsonObject.put("remark", "批量签收下架"); - jsonObjects.add(jsonObject); - content = "包件在" + myCurrentWarehouse.getName() + "由" + loadscanEntity.getSigningUser() + "司机批量签收,装车方式:扫描装车,配送车次号:" + distributionDeliveryListEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); - trunklinePackageTrackLog = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_ABNORMAL_SIGN_FOR.getCode(), distributionDeliveryListEntity.getTrainNumber(), parcelListEntity.getWarehouseEntryTimeEnd()); - //distributionAsyncService.sendFactory(parcelListEntity, loadscanEntity.getSigningTime(), reservationEntity.getId(), reservationEntity.getReservationCode(), myCurrentWarehouse.getName(), user.getNickName()); - sendNodeWorkDataBroadcast(parcelListEntity, reservationEntity, loadscanEntity.getSigningTime(), myCurrentWarehouse); - } else { - loadscanEntities.setMsg("司机一键签收数据补录"); - if (!loadscanEntities.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) { - //已经进行过装车 这里不需要进行订制品订单在库数量扣减 - loadscanEntities.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); - loadscanEntities.setReceivedQuantity(parcelListEntity.getQuantity()); - loadscanEntities.setOneClick(1); - loadscanEntities.setOneQclick(2); - loadscanEntities.setSignforType(LoadScanSigningTypeStatusConstant.sijipiliangqianshou.getValue()); - loadscanEntities.setSigningUser(user.getNickName()); - loadscanEntities.setSigningUserId(user.getUserId()); - loadscanEntities.setReceivedQuantity(parcelListEntity.getQuantity()); - loadscanEntities.setSigningTime(signingTime); - distributionLoadscanService.updateById(loadscanEntities); - packageLockIds.add(loadscanEntities.getPackageId()); - content = "包件在" + myCurrentWarehouse.getName() + "由" + loadscanEntities.getSigningUser() + "司机批量签收,装车方式:补录装车,配送车次号:" + distributionDeliveryListEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); - trunklinePackageTrackLog = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_ABNORMAL_SIGN_FOR.getCode(), distributionDeliveryListEntity.getId().toString(), parcelListEntity.getWarehouseEntryTimeEnd()); -// distributionAsyncService.sendFactory(parcelListEntity, loadscanEntities.getSigningTime(), reservationEntity.getId(), reservationEntity.getReservationCode(), myCurrentWarehouse.getName(), user.getNickName()); - // 节点作业推送 - sendNodeWorkDataBroadcast(parcelListEntity, reservationEntity, loadscanEntities.getSigningTime(), myCurrentWarehouse); + loadscanEntities.setMsg("司机一键签收数据补录"); + if (!loadscanEntities.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) { + //已经进行过装车 这里不需要进行订制品订单在库数量扣减 + loadscanEntities.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); + loadscanEntities.setReceivedQuantity(parcelListEntity.getQuantity()); + loadscanEntities.setOneClick(1); + loadscanEntities.setOneQclick(2); + loadscanEntities.setSignforType(LoadScanSigningTypeStatusConstant.sijipiliangqianshou.getValue()); + loadscanEntities.setSigningUser(user.getNickName()); + loadscanEntities.setSigningUserId(user.getUserId()); + loadscanEntities.setReceivedQuantity(parcelListEntity.getQuantity()); + loadscanEntities.setSigningTime(signingTime); + distributionLoadscanService.updateById(loadscanEntities); + packageLockIds.add(loadscanEntities.getPackageId()); + content = "包件在" + myCurrentWarehouse.getName() + "由" + loadscanEntities.getSigningUser() + "司机批量签收,装车方式:补录装车,配送车次号:" + distributionDeliveryListEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); + trunklinePackageTrackLog = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_ABNORMAL_SIGN_FOR.getCode(), distributionDeliveryListEntity.getId().toString(), parcelListEntity.getWarehouseEntryTimeEnd()); + // 节点作业推送 + sendNodeWorkDataBroadcast(parcelListEntity, reservationEntity, loadscanEntities.getSigningTime(), myCurrentWarehouse); + } } + trunklinePackageTrackLog.put("workNode", WorkNodeEnums.DISTRIBUTION_SIGN_FOR.getCode()); + trunklinePackageTrackLog.put("content", content); + aaa.add(trunklinePackageTrackLog); + packageIds.add(parcelListEntity.getId()); + orderCodes.add(parcelListEntity.getOrderCode()); + packageCodes.add(parcelListEntity.getOrderPackageCode()); } - trunklinePackageTrackLog.put("workNode", WorkNodeEnums.DISTRIBUTION_SIGN_FOR.getCode()); - trunklinePackageTrackLog.put("content", content); - aaa.add(trunklinePackageTrackLog); - // distributionAsyncService.sendFactory(parcelListEntity, simpleDateFormat.format(new Date()), reservationEntity.getId(), reservationEntity.getReservationCode(), myCurrentWarehouse.getName(), user.getNickName()); - packageIds.add(parcelListEntity.getId()); - orderCodes.add(parcelListEntity.getOrderCode()); - packageCodes.add(parcelListEntity.getOrderPackageCode()); - } - if (Func.isNotEmpty(packageIds)) { - distributionAsyncService.handlPakcage(packageIds, myCurrentWarehouse.getId()); - //批量推送 -// distributionAsyncService.sendReviewFactory(distributionSignforEntity.getId(), myCurrentWarehouse.getName(), myCurrentWarehouse.getId()); - } - //备货库位下架 - //TODO -// warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects); - if (Func.isNotEmpty(packageCodes)) { - //批量下架 - String collected = packageCodes.stream().distinct().collect(Collectors.joining(",")); - log.info(method + "司机批量签收进行包件下架:{}", collected); - Map map = new HashMap<>(); - map.put("orderPackageCode", collected); - map.put("warehouseId", myCurrentWarehouse.getId()); - - warehouseUpdownTypeClient.downDeliveryPackage(map); - trunklinePackageTrackLogClient.addPackageTrackLog(aaa); + if (Func.isNotEmpty(packageIds)) { + distributionAsyncService.handlPakcage(packageIds, myCurrentWarehouse.getId()); + } + if (Func.isNotEmpty(packageCodes)) { + //批量下架 + String collected = packageCodes.stream().distinct().collect(Collectors.joining(",")); + log.info(method + "司机批量签收进行包件下架:{}", collected); + Map map = new HashMap<>(); + map.put("orderPackageCode", collected); + map.put("warehouseId", myCurrentWarehouse.getId()); + warehouseUpdownTypeClient.downDeliveryPackage(map); + trunklinePackageTrackLogClient.addPackageTrackLog(aaa); + } } + //维护客户信息状态 +// reservationEntity.setLoadingStatus(ReservationLoadingStatusConstant.yizhuangche.getValue()); +// reservationEntity.setSigningStatus(ReservationSigningStatusConstant.yiqianshou.getValue()); +// distributionReservationMapper.updateById(reservationEntity); + //更新配送装车时间 + distributionDeliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.peisongzhong.getValue()); + distributionDeliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.yizhuangche.getValue()); + distributionDeliveryListService.updateById(distributionDeliveryListEntity); +//维护签收信息 + distributionSignforEntity.setLoadedNumber(reservationEntity.getReservationNum()); + distributionSignforEntity.setReceivedQuantity(reservationEntity.getReservationNum()); + distributionSignforEntity.setLoadedinNumber(reservationEntity.getReservationStockListNum()); + distributionSignforEntity.setReceivedinQuantity(reservationEntity.getReservationStockListNum()); + } + if (Func.isNotEmpty(distributionSignfor.getDriverRemarks())) { + distributionSignforEntity.setDriverRemarks(distributionSignfor.getDriverRemarks()); + } + //维护预约信息 + distributionReservationService.maintenanceReservationInfo(reservationEntity.getId()); + //更新装车时间 + Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId()); + //更新装车人 + Integer m = distributionSignforMapper.updateSignUser(distributionDeliveryListEntity.getId(), distributionSignfor.getReservationId(), AuthUtil.getUser()); + //维护配送任务状态 + distributionDeliveryListService.maintenanceDeliveryInfo(distributionDeliveryListEntity.getId()); + + this.updateById(distributionSignforEntity); //批量维护订单信息 if (Func.isNotEmpty(orderCodes)) { String orderCode = orderCodes.stream().distinct().collect(Collectors.joining(",")); distributionStockArticleService.maintenanceOrderInfo(orderCode, reservationEntity.getWarehouseId()); } - - //维护客户信息状态 - reservationEntity.setLoadingStatus(ReservationLoadingStatusConstant.yizhuangche.getValue()); - reservationEntity.setSigningStatus(ReservationSigningStatusConstant.yiqianshou.getValue()); - distributionReservationMapper.updateById(reservationEntity); - //更新配送装车时间 - Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId()); - distributionDeliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.peisongzhong.getValue()); - distributionDeliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.yizhuangche.getValue()); - distributionDeliveryListService.updateById(distributionDeliveryListEntity); - //更新装车人 - Integer m = distributionSignforMapper.updateSignUser(distributionDeliveryListEntity.getId(), distributionSignfor.getReservationId(), AuthUtil.getUser()); - log.info(method + "装车包件数>>>>>>>>>>>>>>:{}", loadingPackageNum); - log.info(method + "装车库存品数>>>>>>>>>>>>>>:{}", loadingInventoryNum); - log.info(method + "签收包件数>>>>>>>>>>>>>>:{}", signingPackageNum); - log.info(method + "签收库存品数>>>>>>>>>>>>>>:{}", signingPackageNum); if (!packageLockIds.isEmpty()) { - List a = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + distributionDeliveryListEntity.getTrainNumber() + "orderPackageCode:"); + List a = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + ":trainNumber:" + distributionDeliveryListEntity.getTrainNumber() + ":orderPackageCode:"); if (Func.isNotEmpty(a)) { boolean flag = a.stream().anyMatch(any -> packageLockIds.contains(any)); if (flag) { @@ -5847,27 +5855,95 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl nodeFanoutMsg = buildNodeFanoutMsgByOneClick(distributionDeliveryListEntity, reservationEntity, distributionLoadscaninvnEntityLists, distributionLoadscanEntityLists); + iDistributionNodeWorkService.signFor(nodeFanoutMsg, AuthUtil.getUser()); + return R.status(true); + } - distributionSignforEntity.setLoadedNumber(reservationEntity.getReservationNum()); - distributionSignforEntity.setReceivedQuantity(reservationEntity.getReservationNum()); - distributionSignforEntity.setLoadedinNumber(reservationEntity.getReservationStockListNum()); - distributionSignforEntity.setReceivedinQuantity(reservationEntity.getReservationStockListNum()); - if (Func.isNotEmpty(distributionSignfor.getDriverRemarks())) { - distributionSignforEntity.setDriverRemarks(distributionSignfor.getDriverRemarks()); + private void handleInventoryLoadingData(List inventoryLoadingData, BladeUser user, List distributionLoadscaninvnEntityLists) { + List updateInventoryLoadingData = new ArrayList<>(); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + List inventoryPackageIds = new ArrayList<>(); + for (DistributionLoadscaninvnEntity inventoryLoadingDatum : inventoryLoadingData) { + inventoryLoadingDatum.setReceivedQuantity(inventoryLoadingDatum.getLoadedNub()); + inventoryLoadingDatum.setSignforType(LoadScanSigningTypeStatusConstant.sijipiliangqianshou.getValue()); + inventoryLoadingDatum.setOneClick(1); + inventoryLoadingDatum.setSigningUserId(user.getUserId()); + inventoryLoadingDatum.setSigningUser(user.getNickName()); + inventoryLoadingDatum.setSigningTime(simpleDateFormat.format(new Date())); + inventoryLoadingDatum.setOneQclick(2); + inventoryLoadingDatum.setIsSignfor(1); + updateInventoryLoadingData.add(inventoryLoadingDatum); + distributionLoadscaninvnEntityLists.add(inventoryLoadingDatum); + inventoryPackageIds.add(inventoryLoadingDatum.getInventoryPackageId()); + } + if (!updateInventoryLoadingData.isEmpty()) { + distributionLoadscaninvnService.updateBatchById(updateInventoryLoadingData); + } + if (!inventoryPackageIds.isEmpty()) { + disStockListDetailService.update(Wrappers.update().lambda() + .in(DisStockListDetailEntity::getId, inventoryPackageIds) + .set(DisStockListDetailEntity::getStockSignfoStatus, InventorySigningStatusConstant.yiqianshou.getValue()) + ); } - this.updateById(distributionSignforEntity); - bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "reservationId:", distributionSignfor.getReservationId(), 60L); - NodeFanoutMsg nodeFanoutMsg = buildNodeFanoutMsgByOneClick(distributionDeliveryListEntity, reservationEntity, distributionLoadscaninvnEntityLists, distributionLoadscanEntityLists); - iDistributionNodeWorkService.signFor(nodeFanoutMsg, AuthUtil.getUser()); + } + + private void handlePackageLoadingData(List packageLoadingData, BladeUser user, List distributionLoadscanEntityLists, List orderCodes) { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + List updatePackageLoadingData = new ArrayList<>(); + List packageIds = new ArrayList<>(); + for (DistributionLoadscanEntity packageLoadingDatum : packageLoadingData) { + packageLoadingDatum.setReceivedQuantity(packageLoadingDatum.getLoadedNub()); + packageLoadingDatum.setSignforType(LoadScanSigningTypeStatusConstant.sijipiliangqianshou.getValue()); + packageLoadingDatum.setOneClick(LoadScanSigningTypeStatusConstant.sijipiliangqianshou.getValue()); + packageLoadingDatum.setIsAbnormalLoading(1); + packageLoadingDatum.setIsAbnormalSigning(1); + packageLoadingDatum.setSigningUserId(user.getUserId()); + packageLoadingDatum.setSigningUser(user.getNickName()); + packageLoadingDatum.setSigningTime(simpleDateFormat.format(new Date())); + packageLoadingDatum.setOneQclick(2); + packageLoadingDatum.setIsSignfor(1); + updatePackageLoadingData.add(packageLoadingDatum); + distributionLoadscanEntityLists.add(packageLoadingDatum); + if (Integer.parseInt(IsOrNoConstant.no.getValue()) == packageLoadingDatum.getIsZero()) { + //非零担标注出库 + packageIds.add(packageLoadingDatum.getPackageId()); + } else { + //查询出对应的零担包件 + DistributionParcelNumberEntity distributionParcelNumberEntity = distributionParcelNumberService.getOne(Wrappers.query().lambda() + .eq(DistributionParcelNumberEntity::getParcelListId, packageLoadingDatum.getPackageId()) + ); + distributionParcelNumberEntity.setSigninQuantity(distributionParcelNumberEntity.getSigninQuantity() + packageLoadingDatum.getReceivedQuantity()); + distributionParcelNumberService.updateById(distributionParcelNumberEntity); + } + } + if (!updatePackageLoadingData.isEmpty()) { + distributionLoadscanService.updateBatchById(updatePackageLoadingData); + } + if (!packageIds.isEmpty()) { + distributionParcelListService.update(Wrappers.update().lambda() + .in(DistributionParcelListEntity::getId, packageIds) + .set(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue()) + ); + } + List orderIds = packageLoadingData.stream().map(DistributionLoadscanEntity::getOrderId).distinct().collect(Collectors.toList()); + if (!orderIds.isEmpty()) { + List distributionStockArticleEntities = distributionStockArticleService.listByIds(orderIds); + if (!distributionStockArticleEntities.isEmpty()) { + orderCodes.addAll(distributionStockArticleEntities.stream().map(DistributionStockArticleEntity::getOrderCode).collect(Collectors.toList())); + } + } + //查询所有订单 + - return R.status(true); } private NodeFanoutMsg buildNodeFanoutMsgByOneClick(DistributionDeliveryListEntity distributionDeliveryListEntity, DistributionReservationEntity reservationEntity, List distributionLoadscaninvnEntityLists, List distributionLoadscanEntityLists) { @@ -6265,8 +6341,6 @@ public class DistributionSignforServiceImpl extends BaseServiceImplquery().lambda() .eq(DistributionLoadscanEntity::getReservationId, distributionLoadscanAbnormalEntity.getReservationId()) .eq(DistributionLoadscanEntity::getDeliveryId, distributionLoadscanAbnormalEntity.getDeliveryListId()) @@ -7568,23 +7642,27 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl pushList = new ArrayList<>(); List pushInventoryList = new ArrayList<>(); //配置项 - boolean isConfig = false; - DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfDTO(); - if (deliveryListEntity.getKind().equals(ServiceConstant.DELIVERLIST_KIND_SELF)) { - distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectOne(new QueryWrapper().lambda() - .eq(DistributionDeliverySelfEntity::getIsMaster, ServiceConstant.IS_MASTER_YES) - .eq(DistributionDeliverySelfEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()) - ); - } else { - DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper.selectOne(new QueryWrapper().lambda() - .eq(DistributionDeliveryTripartiteEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId())); - BeanUtils.copyProperties(distributionDeliveryTripartiteEntity, distributionDeliverySelfEntity); - } - switch (type) { - case 1: - if (Func.isEmpty(distrilbutionloadingscanDTO.getBarcode())) { - log.error(method + "Barcode参数缺失"); - return Resp.scanFail("参数缺失,请联系管理员", "参数缺失,请联系管理员"); - } - //校验当前包件是否存在回库任务 - boolean isHaveRetention = warehouseRetentionScanClient.judgeIsHaveRetention(distrilbutionloadingscanDTO.getBarcode(),myCurrentWarehouse.getId()); - if (isHaveRetention){ - return Resp.scanFail("当前包件存在回库任务","当前包件存在回库任务"); + DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfDTO(); + if (deliveryListEntity.getKind().equals(ServiceConstant.DELIVERLIST_KIND_SELF)) { + distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectOne(new QueryWrapper().lambda() + .eq(DistributionDeliverySelfEntity::getIsMaster, ServiceConstant.IS_MASTER_YES) + .eq(DistributionDeliverySelfEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()) + ); + } else { + DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper.selectOne(new QueryWrapper().lambda() + .eq(DistributionDeliveryTripartiteEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId())); + BeanUtils.copyProperties(distributionDeliveryTripartiteEntity, distributionDeliverySelfEntity); + } + switch (type) { + case 1: + if (Func.isEmpty(distrilbutionloadingscanDTO.getBarcode())) { + log.error(method + "Barcode参数缺失"); + return Resp.scanFail("参数缺失,请联系管理员", "参数缺失,请联系管理员"); + } + //校验当前包件是否存在回库任务 + boolean isHaveRetention = warehouseRetentionScanClient.judgeIsHaveRetention(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId()); + if (isHaveRetention) { + return Resp.scanFail("当前包件存在回库任务", "当前包件存在回库任务"); + } + barcode = distrilbutionloadingscanDTO.getBarcode(); + DistributionParcelListEntity parcelListEntity = distributionParcelListService.selectByOrderPackageCode(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId()); + if (Objects.isNull(parcelListEntity)) { + List list = disStockListDetailService.list(Wrappers.query().lambda() + .eq(DisStockListDetailEntity::getStockPackageCode, distrilbutionloadingscanDTO.getBarcode()) + .ne(DisStockListDetailEntity::getStockPackageStatus, ReservationPackageStatusConstant.quxiao.getValue()) + ); + if (!list.isEmpty()) { + return Resp.scanFail("请在库存品扫描此码", "请在库存品扫描此码"); } - barcode = distrilbutionloadingscanDTO.getBarcode(); - DistributionParcelListEntity parcelListEntity = distributionParcelListService.selectByOrderPackageCode(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId()); - if (Objects.isNull(parcelListEntity)) { - List list = disStockListDetailService.list(Wrappers.query().lambda() - .eq(DisStockListDetailEntity::getStockPackageCode, distrilbutionloadingscanDTO.getBarcode()) - .ne(DisStockListDetailEntity::getStockPackageStatus, ReservationPackageStatusConstant.quxiao.getValue()) - ); - if (!list.isEmpty()){ - return Resp.scanFail("请在库存品扫描此码", "请在库存品扫描此码"); + return Resp.scanFail("系统无编码", "系统无编码"); + } + if (parcelListEntity.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) { + return Resp.scanFail("包件已签收", "包件已签收"); + } + List aaa = new ArrayList<>(); + DistributionReservationPackageEntity planPackage = distributionReservationPackageService.getPlanPackageByReservationAndCode(reservationId, barcode); + if (!Objects.isNull(planPackage)) { + List abnormalEntities = distributionLoadscanAbnormalService.list(Wrappers.query().lambda() + .eq(DistributionLoadscanAbnormalEntity::getPackageCode, barcode) + .eq(DistributionLoadscanAbnormalEntity::getGoodsType, 1) + .ne(DistributionLoadscanAbnormalEntity::getAbnormalType, 1) + .eq(DistributionLoadscanAbnormalEntity::getAuditingStatus, LoadingAbnormalAuditingStatusConstant.daishenhe.getValue()) + ); + if (!abnormalEntities.isEmpty()) { + //判断是否是本车次的异常操作 + boolean isFlag = abnormalEntities.stream().allMatch(a -> reservationId.equals(a.getReservationId())); + if (!isFlag) { + return Resp.scanFail("存在异常未处理", "存在异常未处理"); } - return Resp.scanFail("系统无编码", "系统无编码"); - } - if (parcelListEntity.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) { - return Resp.scanFail("包件已签收", "包件已签收"); } - List aaa = new ArrayList<>(); - DistributionReservationPackageEntity planPackage = distributionReservationPackageService.getPlanPackageByReservationAndCode(reservationId,barcode); - if (!Objects.isNull(planPackage)){ - if (parcelListEntity.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())) { - return Resp.scanFail("包件未装车,无法签收", "包件未装车,无法签收"); - } - List abnormalEntities = distributionLoadscanAbnormalService.list(Wrappers.query().lambda() - .eq(DistributionLoadscanAbnormalEntity::getPackageCode, barcode) - .eq(DistributionLoadscanAbnormalEntity::getGoodsType, 1) - .ne(DistributionLoadscanAbnormalEntity::getAbnormalType, 1) - .eq(DistributionLoadscanAbnormalEntity::getAuditingStatus, LoadingAbnormalAuditingStatusConstant.daishenhe.getValue()) - //修改 状态 - ); - if (!abnormalEntities.isEmpty()) { - //判断是否是本车次的异常操作 - boolean isFlag = abnormalEntities.stream().allMatch(a -> reservationId.equals(a.getReservationId())); - if (!isFlag){ - return Resp.scanFail("存在异常未处理","存在异常未处理"); + //查询此包件是否有进行装车 + DistributionLoadscanEntity loadscanEntity = distributionLoadscanService.getOne(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getDeliveryId, deliveryId) + .eq(DistributionLoadscanEntity::getReservationId, reservationId) + .eq(DistributionLoadscanEntity::getOrderPackageCode, barcode) + .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) + ); + DistributionLoadscanEntity distributionLoadscanEntity = new DistributionLoadscanEntity(); + if (!Objects.isNull(loadscanEntity)) { + distributionLoadscanEntity = updateSignDistributionLoadscanEntity(loadscanEntity, user, parcelListEntity); + distributionLoadscanService.updateById(distributionLoadscanEntity); + //缺少一个异步维护包件签收的方法 + distributionSignforMapper.updateSignforNum(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub()); + //更新签收人 + distributionSignforMapper.updateSignUser(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), user); + //维护订单状态 + String content = "包件在" + myCurrentWarehouse.getName() + "由" + loadscanEntity.getSigningUser() + "扫描签收,装车方式:扫描装车,配送车次号:" + deliveryListEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); + JSONObject trunklinePackageTrackLog = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_SIGN_FOR.getCode(), deliveryListEntity.getId().toString(), parcelListEntity.getWarehouseEntryTimeEnd()); + aaa.add(trunklinePackageTrackLog); + } else { + //存在配置要求必须装车才能进行签收 + if (Integer.parseInt(IsOrNoConstant.yes.getValue()) == isStrictLoading) { + if (parcelListEntity.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())) { + return Resp.scanFail("包件未装车,无法签收", "包件未装车,无法签收"); } + return Resp.scanFail("包件未装车,无法签收", "包件未装车,无法签收"); } - //查询此包件是否有进行装车 - DistributionLoadscanEntity loadscanEntity = distributionLoadscanService.getOne(Wrappers.query().lambda() - .eq(DistributionLoadscanEntity::getDeliveryId, deliveryId) - .eq(DistributionLoadscanEntity::getReservationId, reservationId) - .eq(DistributionLoadscanEntity::getOrderPackageCode, barcode) - .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) + distributionLoadscanEntity = createdSignDistributionLoadscanEntity(parcelListEntity, deliveryListEntity, reservationEntity, user, myCurrentWarehouse, distributionDeliverySelfEntity); + //不存在装车需要进行补录 + distributionLoadscanService.save(distributionLoadscanEntity); + //进行签收数量的修改 + distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); + //更新装车包件数和签收包件数 + distributionSignforMapper.updateSignforByReservationId(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub()); + //更新签收人 + distributionSignforMapper.updateSignUser(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), AuthUtil.getUser()); + String content = "包件在" + myCurrentWarehouse.getName() + "由" + distributionLoadscanEntity.getSigningUser() + "扫描签收,装车方式:补录装车,配送车次号:" + deliveryListEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); + JSONObject trunklinePackageTrackLog = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_SIGN_FOR.getCode(), deliveryListEntity.getId().toString(), parcelListEntity.getWarehouseEntryTimeEnd()); + aaa.add(trunklinePackageTrackLog); + } + //下架解托 + if (StringUtils.isNotBlank(distributionLoadscanEntity.getOrderPackageCode())) { + warehouseUpdownTypeClient.downPackageOrDelTray(distributionLoadscanEntity.getOrderPackageCode(), myCurrentWarehouse.getId(), "签收下架解托"); + } + pushList.add(distributionLoadscanEntity); + packageLockIds.add(distributionLoadscanEntity.getPackageId()); + parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); + parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue()); + distributionParcelListService.updateById(parcelListEntity); + //维护签收包件状态 + orderCodes.add(parcelListEntity.getOrderCode()); + } else { + + //判断当前包件是否已进行签收 + //判断客户 + boolean flag = judgmentClient(reservationEntity, parcelListEntity.getStockArticleId()); + if (flag) { + //查询出未审核如果存在多个则不行 + DistributionLoadscanAbnormalEntity abnormalEntity = distributionLoadscanAbnormalService.getOne(Wrappers.query().lambda() + .eq(DistributionLoadscanAbnormalEntity::getDeliveryListId, deliveryId) + .eq(DistributionLoadscanAbnormalEntity::getReservationId, reservationId) + .eq(DistributionLoadscanAbnormalEntity::getPackageCode, distrilbutionloadingscanDTO.getBarcode()) + .eq(DistributionLoadscanAbnormalEntity::getAuditingStatus, LoadingAbnormalAuditingStatusConstant.daishenhe.getValue()) + .eq(DistributionLoadscanAbnormalEntity::getAbnormalType, LoadingAbnormalTypeConstant.jihuayichang.getValue()) ); - DistributionLoadscanEntity distributionLoadscanEntity = new DistributionLoadscanEntity(); - if (!Objects.isNull(loadscanEntity)) { - distributionLoadscanEntity = updateSignDistributionLoadscanEntity(loadscanEntity,user,parcelListEntity); - distributionLoadscanService.updateById(distributionLoadscanEntity); - //缺少一个异步维护包件签收的方法 - distributionSignforMapper.updateSignforNum(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub()); - //更新签收人 - distributionSignforMapper.updateSignUser(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), user); - //维护订单状态 - String content = "包件在" + myCurrentWarehouse.getName() + "由" + loadscanEntity.getSigningUser() + "扫描签收,装车方式:扫描装车,配送车次号:" + deliveryListEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); - JSONObject trunklinePackageTrackLog = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_SIGN_FOR.getCode(), deliveryListEntity.getId().toString(), parcelListEntity.getWarehouseEntryTimeEnd()); - aaa.add(trunklinePackageTrackLog); - } else { - //存在配置要求必须装车才能进行签收 - if (isConfig){ - return Resp.scanFail("当前包件未装车","当前包件未装车"); - } - distributionLoadscanEntity = createdSignDistributionLoadscanEntity(parcelListEntity,deliveryListEntity,reservationEntity,user,myCurrentWarehouse,distributionDeliverySelfEntity); - //不存在装车需要进行补录 - distributionLoadscanService.save(distributionLoadscanEntity); - //进行签收数量的修改 - distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); - //更新装车包件数和签收包件数 - distributionSignforMapper.updateSignforByReservationId(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub()); - //更新签收人 - distributionSignforMapper.updateSignUser(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), AuthUtil.getUser()); - String content = "包件在" + myCurrentWarehouse.getName() + "由" + distributionLoadscanEntity.getSigningUser() + "扫描签收,装车方式:补录装车,配送车次号:" + deliveryListEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); - JSONObject trunklinePackageTrackLog = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_SIGN_FOR.getCode(), deliveryListEntity.getId().toString(), parcelListEntity.getWarehouseEntryTimeEnd()); - aaa.add(trunklinePackageTrackLog); + if (!Objects.isNull(abnormalEntity)) { + return Resp.scanFail("异常装车未处理", "异常装车未处理"); } - //下架解托 - if (StringUtils.isNotBlank(distributionLoadscanEntity.getOrderPackageCode())) { - warehouseUpdownTypeClient.downPackageOrDelTray(distributionLoadscanEntity.getOrderPackageCode(), myCurrentWarehouse.getId(), "签收下架解托"); + if (OrderPackageReservationStatusConstant.yiyueyue.getValue().equals(parcelListEntity.getOrderPackageReservationStatus())) { + return Resp.scanFail("当前包件存在配送计划", "当前包件存在配送计划"); } - pushList.add(distributionLoadscanEntity); - packageLockIds.add(distributionLoadscanEntity.getPackageId()); - parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); - parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue()); - distributionParcelListService.updateById(parcelListEntity); - //维护签收包件状态 - orderCodes.add(parcelListEntity.getOrderCode()); + return R.fail(3006, null); } else { - //判断当前包件是否已进行签收 - //判断客户 - boolean flag = judgmentClient(reservationEntity, parcelListEntity.getStockArticleId()); - if (flag) { - //查询出未审核如果存在多个则不行 - DistributionLoadscanAbnormalEntity abnormalEntity = distributionLoadscanAbnormalService.getOne(Wrappers.query().lambda() - .eq(DistributionLoadscanAbnormalEntity::getDeliveryListId, deliveryId) - .eq(DistributionLoadscanAbnormalEntity::getReservationId, reservationId) - .eq(DistributionLoadscanAbnormalEntity::getPackageCode, distrilbutionloadingscanDTO.getBarcode()) - .eq(DistributionLoadscanAbnormalEntity::getAuditingStatus, LoadingAbnormalAuditingStatusConstant.daishenhe.getValue()) - .eq(DistributionLoadscanAbnormalEntity::getAbnormalType, LoadingAbnormalTypeConstant.jihuayichang.getValue()) - ); - if (!Objects.isNull(abnormalEntity)){ - return Resp.scanFail("异常装车未处理","异常装车未处理"); - } - if (OrderPackageReservationStatusConstant.yiyueyue.getValue().equals(parcelListEntity.getOrderPackageReservationStatus())){ - return Resp.scanFail("当前包件存在配送计划", "当前包件存在配送计划"); - } - return R.fail(3006, null); - } else { - - return Resp.scanFail("不属于当前签收客户", "不属于当前签收客户"); - } + return Resp.scanFail("不属于当前签收客户", "不属于当前签收客户"); } + } - //维护客户 - distributionReservationService.maintenanceReservationInfo(distrilbutionloadingscanDTO.getReservationId()); - //维护配送任务 - distributionDeliveryListService.maintenanceDeliveryInfo(distrilbutionloadingscanDTO.getDeliveryId()); - trunklinePackageTrackLogClient.addPackageTrackLog(aaa); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); - String singleTime = simpleDateFormat.format(new Date()); - // 节点作业推送 - sendNodeWorkDataBroadcast(parcelListEntity, reservationEntity, singleTime, myCurrentWarehouse); - // 构建新作业节点回传 - NodeFanoutMsg nodeFanoutMsg = buildDistributionSignforVO(deliveryListEntity,reservationEntity, pushList,OperatModeConstant.BATCH); - iDistributionNodeWorkService.signFor(nodeFanoutMsg, AuthUtil.getUser()); - break; - case 2: - //零担 - if (Func.isEmpty(distrilbutionloadingscanDTO.getParcelListDTOS())) { - log.error(method + "ParcelListDTOS参数缺失"); - return Resp.scanFail("参数缺失,请联系管理员", "参数缺失,请联系管理员"); + //维护客户 + distributionReservationService.maintenanceReservationInfo(distrilbutionloadingscanDTO.getReservationId()); + //维护配送任务 + distributionDeliveryListService.maintenanceDeliveryInfo(distrilbutionloadingscanDTO.getDeliveryId()); + trunklinePackageTrackLogClient.addPackageTrackLog(aaa); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + String singleTime = simpleDateFormat.format(new Date()); + // 节点作业推送 + sendNodeWorkDataBroadcast(parcelListEntity, reservationEntity, singleTime, myCurrentWarehouse); + // 构建新作业节点回传 + NodeFanoutMsg nodeFanoutMsg = buildDistributionSignforVO(deliveryListEntity, reservationEntity, pushList, OperatModeConstant.BATCH); + iDistributionNodeWorkService.signFor(nodeFanoutMsg, AuthUtil.getUser()); + break; + case 2: + //零担 + if (Func.isEmpty(distrilbutionloadingscanDTO.getParcelListDTOS())) { + log.error(method + "ParcelListDTOS参数缺失"); + return Resp.scanFail("参数缺失,请联系管理员", "参数缺失,请联系管理员"); + } + List parcelNumberDTOS = distrilbutionloadingscanDTO.getParcelListDTOS(); + Integer loadedNumber = signforEntity.getLoadedNumber(); + Integer receivedQuantity = signforEntity.getReceivedQuantity(); + if (!parcelNumberDTOS.isEmpty()) { + List packageIds = parcelNumberDTOS.stream().map(DistributionParcelNumberDTO::getParcelListId).collect(Collectors.toList()); + List loadscanEntityList = distributionLoadscanService.list(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) + .eq(DistributionLoadscanEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()) + .eq(DistributionLoadscanEntity::getOrderId, distrilbutionloadingscanDTO.getOrderId()) + .in(DistributionLoadscanEntity::getPackageId, packageIds) + .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); + Map> loadingMap = null; + Map> reservationMap = null; + if (!loadscanEntityList.isEmpty()) { + int sum1 = loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum(); + int sum2 = loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum(); + loadedNumber = loadedNumber - sum1; + receivedQuantity = receivedQuantity - sum2; + loadingMap = loadscanEntityList.stream().collect(Collectors.groupingBy(DistributionLoadscanEntity::getPackageId)); + } + //查询对应的计划品类 + List reservationZeroPackageEntity = distributionReservationZeroPackageService.list(Wrappers.query().lambda() + .eq(DistributionReservationZeroPackageEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) + .in(DistributionReservationZeroPackageEntity::getParcelListId, packageIds) + .ne(DistributionReservationZeroPackageEntity::getZeroPackageStatus, ReservationPackageStatusConstant.quxiao.getValue())); + if (!reservationZeroPackageEntity.isEmpty()) { + reservationMap = reservationZeroPackageEntity.stream().collect(Collectors.groupingBy(DistributionReservationZeroPackageEntity::getParcelListId)); } - List parcelNumberDTOS = distrilbutionloadingscanDTO.getParcelListDTOS(); - Integer loadedNumber = signforEntity.getLoadedNumber(); - Integer receivedQuantity = signforEntity.getReceivedQuantity(); - if (!parcelNumberDTOS.isEmpty()) { - List packageIds = parcelNumberDTOS.stream().map(DistributionParcelNumberDTO::getParcelListId).collect(Collectors.toList()); - List loadscanEntityList = distributionLoadscanService.list(Wrappers.query().lambda() - .eq(DistributionLoadscanEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) - .eq(DistributionLoadscanEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()) - .eq(DistributionLoadscanEntity::getOrderId, distrilbutionloadingscanDTO.getOrderId()) - .in(DistributionLoadscanEntity::getPackageId, packageIds) - .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); - Map> loadingMap = null; - Map> reservationMap = null; - if (!loadscanEntityList.isEmpty()) { - int sum1 = loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum(); - int sum2 = loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum(); - loadedNumber = loadedNumber - sum1; - receivedQuantity = receivedQuantity - sum2; - loadingMap = loadscanEntityList.stream().collect(Collectors.groupingBy(DistributionLoadscanEntity::getPackageId)); - } - //查询对应的计划品类 - List reservationZeroPackageEntity = distributionReservationZeroPackageService.list(Wrappers.query().lambda() - .eq(DistributionReservationZeroPackageEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) - .in(DistributionReservationZeroPackageEntity::getParcelListId, packageIds) - .ne(DistributionReservationZeroPackageEntity::getZeroPackageStatus, ReservationPackageStatusConstant.quxiao.getValue())); - if (!reservationZeroPackageEntity.isEmpty()) { - reservationMap = reservationZeroPackageEntity.stream().collect(Collectors.groupingBy(DistributionReservationZeroPackageEntity::getParcelListId)); - } - List jsonObjects = new ArrayList<>(); - for (DistributionParcelNumberDTO parcelNumberDTO : parcelNumberDTOS) { - List zeroPackageEntities = reservationMap.get(parcelNumberDTO.getParcelListId()); - DistributionParcelNumberEntity distributionParcelNumberEntity = distributionParcelNumberService.getOne(Wrappers.query().lambda() - .eq(DistributionParcelNumberEntity::getParcelListId, parcelNumberDTO.getParcelListId()) - ); - DistributionParcelListEntity zeroParcelListEntity = distributionParcelListService.getById(parcelNumberDTO.getParcelListId()); - orderCodes.add(zeroParcelListEntity.getOrderCode()); - packageLockIds.add(zeroParcelListEntity.getId()); - if (zeroPackageEntities.size() == 1) { - DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = zeroPackageEntities.get(0); - //查询是否存在装车 - Integer deliveryNumber = 0; - Integer handQuantity = 0; - Integer outboundQuantity = 0; - Integer signinQuantity = 0; - if (Func.isNotEmpty(loadingMap)) { - //存在装车数据,进行是否签收判断 - List entityList = loadingMap.get(parcelNumberDTO.getParcelListId()); - if (entityList.size() == 1) { - DistributionLoadscanEntity distributionLoadscanEntity = entityList.get(0); - if (parcelNumberDTO.getSigningNum() > distributionReservationZeroPackageEntity.getQuantity()) { - log.info("#############零担签收超过计划数量ParcelListId:{},计划:{}录入,:{}", parcelNumberDTO.getParcelListId(), distributionReservationZeroPackageEntity.getQuantity(), parcelNumberDTO.getSigningNum()); - } - int a = 0; - if (distributionLoadscanEntity.getLoadedNub() < parcelNumberDTO.getSigningNum()) { - //将装车和签收进行统一数量 - distributionLoadscanEntity.setLoadedNub(parcelNumberDTO.getSigningNum()); - distributionLoadscanEntity.setPackageNub(parcelNumberDTO.getSigningNum()); - a = parcelNumberDTO.getSigningNum() - distributionLoadscanEntity.getLoadedNub(); + List jsonObjects = new ArrayList<>(); + for (DistributionParcelNumberDTO parcelNumberDTO : parcelNumberDTOS) { + List zeroPackageEntities = reservationMap.get(parcelNumberDTO.getParcelListId()); + DistributionParcelNumberEntity distributionParcelNumberEntity = distributionParcelNumberService.getOne(Wrappers.query().lambda() + .eq(DistributionParcelNumberEntity::getParcelListId, parcelNumberDTO.getParcelListId()) + ); + DistributionParcelListEntity zeroParcelListEntity = distributionParcelListService.getById(parcelNumberDTO.getParcelListId()); + orderCodes.add(zeroParcelListEntity.getOrderCode()); + packageLockIds.add(zeroParcelListEntity.getId()); + if (zeroPackageEntities.size() == 1) { + DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = zeroPackageEntities.get(0); + //查询是否存在装车 + Integer deliveryNumber = 0; + Integer handQuantity = 0; + Integer outboundQuantity = 0; + Integer signinQuantity = 0; + if (Func.isNotEmpty(loadingMap)) { + //存在装车数据,进行是否签收判断 + List entityList = loadingMap.get(parcelNumberDTO.getParcelListId()); + if (entityList.size() == 1) { + DistributionLoadscanEntity distributionLoadscanEntity = entityList.get(0); + if (parcelNumberDTO.getSigningNum() > distributionReservationZeroPackageEntity.getQuantity()) { + //存在配置要求必须装车才能进行签收 + if (Integer.parseInt(IsOrNoConstant.yes.getValue()) == isStrictLoading) { + return Resp.scanFail("装车数少于签收数", "装车数少于签收数"); } - - deliveryNumber = distributionParcelNumberEntity.getDeliveryQuantity() + distributionLoadscanEntity.getReceivedQuantity() - parcelNumberDTO.getSigningNum(); - handQuantity = distributionParcelNumberEntity.getHandQuantity() + distributionLoadscanEntity.getReceivedQuantity() - parcelNumberDTO.getSigningNum(); - outboundQuantity = distributionParcelNumberEntity.getOutboundQuantity() - distributionLoadscanEntity.getReceivedQuantity() + parcelNumberDTO.getSigningNum(); - signinQuantity = distributionParcelNumberEntity.getSigninQuantity() - distributionLoadscanEntity.getReceivedQuantity() + parcelNumberDTO.getSigningNum(); - distributionLoadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); - distributionLoadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); - distributionLoadscanEntity.setReceivedQuantity(parcelNumberDTO.getSigningNum()); - distributionLoadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); - distributionLoadscanEntity.setScanTime(now); - distributionLoadscanEntity.setSigningUser(user.getNickName()); - distributionLoadscanEntity.setSigningUserId(user.getUserId()); - distributionLoadscanEntity.setSignforType(LoadScanSigningTypeStatusConstant.sijiqianshou.getValue()); - distributionLoadscanEntity.setSigningTime(now); - distributionLoadscanEntity.setSigningUser(user.getNickName()); - loadedNumber += parcelNumberDTO.getSigningNum(); - receivedQuantity += parcelNumberDTO.getSigningNum(); - //进行签收数量的统计 - distributionLoadscanService.updateById(distributionLoadscanEntity); - pushList.add(distributionLoadscanEntity); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("code", zeroParcelListEntity.getOrderCode()); - jsonObject.put("warehouseId", myCurrentWarehouse.getId()); - jsonObject.put("taskId", distributionLoadscanEntity.getReservationId()); - jsonObject.put("type", 3); - jsonObject.put("num", a); - jsonObject.put("remark", "签收下架"); - jsonObjects.add(jsonObject); - } else { - log.info("#############零担签收存在多个装车记录ParcelListId:{}", parcelNumberDTO.getParcelListId()); - } - } else { - //签收装车数据一起进行补录 - DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity(); - loadscanEntity.setPackageId(distributionParcelNumberEntity.getParcelListId()); - loadscanEntity.setOrderId(distributionParcelNumberEntity.getStockArticleId()); - loadscanEntity.setDeliveryId(signforEntity.getDeliveryId()); - loadscanEntity.setReservationId(signforEntity.getReservationId()); - loadscanEntity.setScanUser(user.getNickName()); - loadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); - loadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); - loadscanEntity.setScanTime(now); - loadscanEntity.setSigningUser(user.getNickName()); - loadscanEntity.setPackageNub(parcelNumberDTO.getSigningNum()); - loadscanEntity.setLoadedNub(parcelNumberDTO.getSigningNum()); - loadscanEntity.setSigningUserId(user.getUserId()); - assert distributionDeliverySelfEntity != null; - if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverId())) { - loadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); - } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) { - loadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); - } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) { - loadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); - } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) { - loadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); + log.info("#############零担签收超过计划数量ParcelListId:{},计划:{}录入,:{}", parcelNumberDTO.getParcelListId(), distributionReservationZeroPackageEntity.getQuantity(), parcelNumberDTO.getSigningNum()); } - if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) { - loadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); + int a = 0; + if (distributionLoadscanEntity.getLoadedNub() < parcelNumberDTO.getSigningNum()) { + //将装车和签收进行统一数量 + distributionLoadscanEntity.setLoadedNub(parcelNumberDTO.getSigningNum()); + distributionLoadscanEntity.setPackageNub(parcelNumberDTO.getSigningNum()); + a = parcelNumberDTO.getSigningNum() - distributionLoadscanEntity.getLoadedNub(); } - loadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString()); - loadscanEntity.setScanStatus(LoadingStatusConstant.buluzhuangche.getValue()); - loadscanEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue()); - loadscanEntity.setScanType("1"); - loadscanEntity.setType(2); - loadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); - loadscanEntity.setIsSignfor(1); - loadscanEntity.setReceivedQuantity(parcelNumberDTO.getSigningNum()); - loadscanEntity.setOneClick(2); - loadscanEntity.setOneQclick(2); - loadscanEntity.setSigningTime(now); - distributionLoadscanService.save(loadscanEntity); - pushList.add(loadscanEntity); - loadedNumber += loadscanEntity.getLoadedNub(); - receivedQuantity += loadscanEntity.getReceivedQuantity(); - //维护零担品类信息 - deliveryNumber = distributionParcelNumberEntity.getDeliveryQuantity() - parcelNumberDTO.getSigningNum(); - handQuantity = distributionParcelNumberEntity.getHandQuantity() - parcelNumberDTO.getSigningNum(); - outboundQuantity = distributionParcelNumberEntity.getOutboundQuantity() + parcelNumberDTO.getSigningNum(); - signinQuantity = distributionParcelNumberEntity.getSigninQuantity() + parcelNumberDTO.getSigningNum(); + + deliveryNumber = distributionParcelNumberEntity.getDeliveryQuantity() + distributionLoadscanEntity.getReceivedQuantity() - parcelNumberDTO.getSigningNum(); + handQuantity = distributionParcelNumberEntity.getHandQuantity() + distributionLoadscanEntity.getReceivedQuantity() - parcelNumberDTO.getSigningNum(); + outboundQuantity = distributionParcelNumberEntity.getOutboundQuantity() - distributionLoadscanEntity.getReceivedQuantity() + parcelNumberDTO.getSigningNum(); + signinQuantity = distributionParcelNumberEntity.getSigninQuantity() - distributionLoadscanEntity.getReceivedQuantity() + parcelNumberDTO.getSigningNum(); + distributionLoadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); + distributionLoadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); + distributionLoadscanEntity.setReceivedQuantity(parcelNumberDTO.getSigningNum()); + distributionLoadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); + distributionLoadscanEntity.setScanTime(now); + distributionLoadscanEntity.setSigningUser(user.getNickName()); + distributionLoadscanEntity.setSigningUserId(user.getUserId()); + distributionLoadscanEntity.setSignforType(LoadScanSigningTypeStatusConstant.sijiqianshou.getValue()); + distributionLoadscanEntity.setSigningTime(now); + distributionLoadscanEntity.setSigningUser(user.getNickName()); + loadedNumber += parcelNumberDTO.getSigningNum(); + receivedQuantity += parcelNumberDTO.getSigningNum(); + //进行签收数量的统计 + distributionLoadscanService.updateById(distributionLoadscanEntity); + pushList.add(distributionLoadscanEntity); JSONObject jsonObject = new JSONObject(); jsonObject.put("code", zeroParcelListEntity.getOrderCode()); jsonObject.put("warehouseId", myCurrentWarehouse.getId()); - jsonObject.put("taskId", loadscanEntity.getReservationId()); + jsonObject.put("taskId", distributionLoadscanEntity.getReservationId()); jsonObject.put("type", 3); - jsonObject.put("num", loadscanEntity.getLoadedNub()); + jsonObject.put("num", a); jsonObject.put("remark", "签收下架"); jsonObjects.add(jsonObject); - warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects); - } - //维护订单 - if (outboundQuantity.equals(distributionParcelNumberEntity.getQuantity())) { - zeroParcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); - } - if (handQuantity == 0) { - zeroParcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue()); - } - if (receivedQuantity.equals(distributionParcelNumberEntity.getQuantity())) { - zeroParcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue()); + } else { + log.info("#############零担签收存在多个装车记录ParcelListId:{}", parcelNumberDTO.getParcelListId()); } - distributionParcelListService.updateById(zeroParcelListEntity); - - DistributionParcelNumberEntity parcelNumberEntity = new DistributionParcelNumberEntity(); - parcelNumberEntity.setId(distributionParcelNumberEntity.getId()); - parcelNumberEntity.setDeliveryQuantity(deliveryNumber); - parcelNumberEntity.setOutboundQuantity(outboundQuantity); - parcelNumberEntity.setSigninQuantity(signinQuantity); - parcelNumberEntity.setHandQuantity(handQuantity); - distributionParcelNumberService.updateById(parcelNumberEntity); } else { - log.info("#############零担签收查询计划错误ParcelListId:{}", parcelNumberDTO.getParcelListId()); - } - } - } - break; - case 3: - if (Func.isEmpty(distrilbutionloadingscanDTO.getBarcode())) { - log.error(method + "Barcode参数缺失"); - return Resp.scanFail("参数缺失,请联系管理员", "参数缺失,请联系管理员"); - } - //校验当前包件是否存在回库任务 - boolean isHaveInventoryRetention = warehouseRetentionScanClient.judgeIsHaveRetention(distrilbutionloadingscanDTO.getBarcode(),myCurrentWarehouse.getId()); - if (isHaveInventoryRetention){ - return Resp.scanFail("当前包件存在回库任务","当前包件存在回库任务"); - } - //库存品 - List detailEntities = distributionReservationMapper.selectInventoryListByReservation(distrilbutionloadingscanDTO.getReservationId()); - if (detailEntities.isEmpty()) { - DistributionParcelListEntity isFlag = distributionParcelListService.selectByOrderPackageCode(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId()); - if (!Objects.isNull(isFlag)) { - return Resp.scanFail("请在订制品扫描此码","请在订制品扫描此码"); - } - return Resp.scanFail("系统无编码","系统无编码"); - } - boolean isHaveCode = detailEntities.stream().allMatch(inven -> Func.isEmpty(inven.getStockPackageCode())); - if (isHaveCode) { - return Resp.scanFail("库存品未备货","库存品未备货"); - } - String finalBarcode = distrilbutionloadingscanDTO.getBarcode(); - List inventoryPakcgaeList = detailEntities.stream().filter(f -> finalBarcode.equals(f.getStockPackageCode())).collect(Collectors.toList()); - if (!inventoryPakcgaeList.isEmpty()) { - if (inventoryPakcgaeList.size() == 1) { - DisStockListDetailEntity disStockListDetailEntity = inventoryPakcgaeList.get(0); - DistributionLoadscaninvnEntity loadscaninvnEntity = distributionLoadscaninvnService.getOne(Wrappers.query().lambda() - .eq(DistributionLoadscaninvnEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) - .eq(DistributionLoadscaninvnEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()) - .eq(DistributionLoadscaninvnEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()) - .ne(DistributionLoadscaninvnEntity::getScanStatus, 1)); - if (Func.isNotEmpty(loadscaninvnEntity)) { - if (loadscaninvnEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) { - return Resp.scanFail("重复扫描", "重复扫描"); + //存在配置要求必须装车才能进行签收 + if (Integer.parseInt(IsOrNoConstant.yes.getValue()) == isStrictLoading) { + return Resp.scanFail("包件未装车,无法签收", "包件未装车,无法签收"); } -// 库存品进行装车,这里需要对库存品扫描数据进行签收的状态标记 - loadscaninvnEntity.setSigningUserId(user.getUserId()); - loadscaninvnEntity.setSigningUser(user.getNickName()); - loadscaninvnEntity.setReceivedQuantity(disStockListDetailEntity.getNum()); - loadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); - loadscaninvnEntity.setSigningTime(now); - loadscaninvnEntity.setOneQclick(1); - packageLockIds.add(loadscaninvnEntity.getInventoryPackageId()); - distributionLoadscaninvnService.updateById(loadscaninvnEntity); - pushInventoryList.add(loadscaninvnEntity); - //维护签收数量 - distributionSignforMapper.updatesignforByinvn(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub()); - //更新签收人 - distributionSignforMapper.updateSignUser(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), user); - } else { - //库存品未进行装车 - //这里装车的数据需要进行补录 - DistributionLoadscaninvnEntity distributionLoadscaninvnEntity = new DistributionLoadscaninvnEntity(); - + //签收装车数据一起进行补录 + DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity(); + loadscanEntity.setPackageId(distributionParcelNumberEntity.getParcelListId()); + loadscanEntity.setOrderId(distributionParcelNumberEntity.getStockArticleId()); + loadscanEntity.setDeliveryId(signforEntity.getDeliveryId()); + loadscanEntity.setReservationId(signforEntity.getReservationId()); + loadscanEntity.setScanUser(user.getNickName()); + loadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); + loadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); + loadscanEntity.setScanTime(now); + loadscanEntity.setSigningUser(user.getNickName()); + loadscanEntity.setPackageNub(parcelNumberDTO.getSigningNum()); + loadscanEntity.setLoadedNub(parcelNumberDTO.getSigningNum()); + loadscanEntity.setSigningUserId(user.getUserId()); + assert distributionDeliverySelfEntity != null; if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverId())) { - distributionLoadscaninvnEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); + loadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); } if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) { - distributionLoadscaninvnEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); + loadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); } if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) { - distributionLoadscaninvnEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); + loadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); } if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) { - distributionLoadscaninvnEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); + loadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); } if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) { - distributionLoadscaninvnEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); + loadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); } - distributionLoadscaninvnEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString()); - distributionLoadscaninvnEntity.setOrderPackageCode(disStockListDetailEntity.getStockPackageCode()); - distributionLoadscaninvnEntity.setInventoryId(disStockListDetailEntity.getStockListId()); - distributionLoadscaninvnEntity.setInventoryPackageId(disStockListDetailEntity.getId()); - distributionLoadscaninvnEntity.setDeliveryId(distrilbutionloadingscanDTO.getDeliveryId()); - distributionLoadscaninvnEntity.setReservationId(distrilbutionloadingscanDTO.getReservationId()); - distributionLoadscaninvnEntity.setScanUser(user.getNickName()); - distributionLoadscaninvnEntity.setScanTime(now); - distributionLoadscaninvnEntity.setPackageNub(disStockListDetailEntity.getNum()); - distributionLoadscaninvnEntity.setScanStatus(LoadingStatusConstant.saomiao.getValue()); - distributionLoadscaninvnEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue()); - distributionLoadscaninvnEntity.setScanType("1"); - distributionLoadscaninvnEntity.setType(2); - distributionLoadscaninvnEntity.setWarehouseId(myCurrentWarehouse.getId()); - distributionLoadscaninvnEntity.setWarehouseName(myCurrentWarehouse.getName()); - distributionLoadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); - distributionLoadscaninvnEntity.setIsSignfor(1); - distributionLoadscaninvnEntity.setReceivedQuantity(disStockListDetailEntity.getNum()); - distributionLoadscaninvnEntity.setOneClick(1); - distributionLoadscaninvnEntity.setOneQclick(1); - distributionLoadscaninvnEntity.setLoadedNub(1); - distributionLoadscaninvnEntity.setSigningUser(user.getNickName()); - distributionLoadscaninvnEntity.setSigningUserId(user.getUserId()); - distributionLoadscaninvnEntity.setSigningTime(now); - distributionLoadscaninvnService.save(distributionLoadscaninvnEntity); - pushInventoryList.add(distributionLoadscaninvnEntity); - //更新装车数量 - Integer j = distributionSignforMapper.updateLoadAndsignforByinvn(distributionLoadscaninvnEntity.getDeliveryId(), distributionLoadscaninvnEntity.getReservationId(), distributionLoadscaninvnEntity.getPackageNub()); - //更新签收人 - Integer i = distributionSignforMapper.updateSignUser(distributionLoadscaninvnEntity.getDeliveryId(), distributionLoadscaninvnEntity.getReservationId(), AuthUtil.getUser()); - //扣减库存 - distributionStockListMapper.deductionQuantityStock(distributionLoadscaninvnEntity.getInventoryId(), distributionLoadscaninvnEntity.getLoadedNub()); - packageLockIds.add(distributionLoadscaninvnEntity.getInventoryPackageId()); -// //扣减库存 - List jsonObjects = new ArrayList<>(); + loadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString()); + loadscanEntity.setScanStatus(LoadingStatusConstant.buluzhuangche.getValue()); + loadscanEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue()); + loadscanEntity.setScanType("1"); + loadscanEntity.setType(2); + loadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); + loadscanEntity.setIsSignfor(1); + loadscanEntity.setReceivedQuantity(parcelNumberDTO.getSigningNum()); + loadscanEntity.setOneClick(2); + loadscanEntity.setOneQclick(2); + loadscanEntity.setSigningTime(now); + distributionLoadscanService.save(loadscanEntity); + pushList.add(loadscanEntity); + loadedNumber += loadscanEntity.getLoadedNub(); + receivedQuantity += loadscanEntity.getReceivedQuantity(); + //维护零担品类信息 + deliveryNumber = distributionParcelNumberEntity.getDeliveryQuantity() - parcelNumberDTO.getSigningNum(); + handQuantity = distributionParcelNumberEntity.getHandQuantity() - parcelNumberDTO.getSigningNum(); + outboundQuantity = distributionParcelNumberEntity.getOutboundQuantity() + parcelNumberDTO.getSigningNum(); + signinQuantity = distributionParcelNumberEntity.getSigninQuantity() + parcelNumberDTO.getSigningNum(); JSONObject jsonObject = new JSONObject(); - jsonObject.put("code", distributionLoadscaninvnEntity.getOrderPackageCode()); + jsonObject.put("code", zeroParcelListEntity.getOrderCode()); jsonObject.put("warehouseId", myCurrentWarehouse.getId()); - jsonObject.put("taskId", distributionLoadscaninvnEntity.getReservationId()); - jsonObject.put("type", 2); - jsonObject.put("num", 1); + jsonObject.put("taskId", loadscanEntity.getReservationId()); + jsonObject.put("type", 3); + jsonObject.put("num", loadscanEntity.getLoadedNub()); jsonObject.put("remark", "签收下架"); jsonObjects.add(jsonObject); warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects); } - //进行库存品包件状态维护 - disStockListDetailEntity.setStockLockingStatus(InventoryLoadingStatusConstant.yizhuangche.getValue()); - disStockListDetailEntity.setStockSignfoStatus(InventorySigningStatusConstant.yiqianshou.getValue()); - disStockListDetailService.updateById(disStockListDetailEntity); + //维护订单 + if (outboundQuantity.equals(distributionParcelNumberEntity.getQuantity())) { + zeroParcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); + } + if (handQuantity == 0) { + zeroParcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue()); + } + if (receivedQuantity.equals(distributionParcelNumberEntity.getQuantity())) { + zeroParcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue()); + } + distributionParcelListService.updateById(zeroParcelListEntity); + + DistributionParcelNumberEntity parcelNumberEntity = new DistributionParcelNumberEntity(); + parcelNumberEntity.setId(distributionParcelNumberEntity.getId()); + parcelNumberEntity.setDeliveryQuantity(deliveryNumber); + parcelNumberEntity.setOutboundQuantity(outboundQuantity); + parcelNumberEntity.setSigninQuantity(signinQuantity); + parcelNumberEntity.setHandQuantity(handQuantity); + distributionParcelNumberService.updateById(parcelNumberEntity); + } else { + log.info("#############零担签收查询计划错误ParcelListId:{}", parcelNumberDTO.getParcelListId()); } } - break; - } + } + break; + case 3: + if (Func.isEmpty(distrilbutionloadingscanDTO.getBarcode())) { + log.error(method + "Barcode参数缺失"); + return Resp.scanFail("参数缺失,请联系管理员", "参数缺失,请联系管理员"); + } + //校验当前包件是否存在回库任务 + boolean isHaveInventoryRetention = warehouseRetentionScanClient.judgeIsHaveRetention(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId()); + if (isHaveInventoryRetention) { + return Resp.scanFail("当前包件存在回库任务", "当前包件存在回库任务"); + } + //库存品 + List detailEntities = distributionReservationMapper.selectInventoryListByReservation(distrilbutionloadingscanDTO.getReservationId()); + if (detailEntities.isEmpty()) { + DistributionParcelListEntity isFlag = distributionParcelListService.selectByOrderPackageCode(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId()); + if (!Objects.isNull(isFlag)) { + return Resp.scanFail("请在订制品扫描此码", "请在订制品扫描此码"); + } + return Resp.scanFail("系统无编码", "系统无编码"); + } + boolean isHaveCode = detailEntities.stream().allMatch(inven -> Func.isEmpty(inven.getStockPackageCode())); + if (isHaveCode) { + return Resp.scanFail("库存品未备货", "库存品未备货"); + } + String finalBarcode = distrilbutionloadingscanDTO.getBarcode(); + List inventoryPakcgaeList = detailEntities.stream().filter(f -> finalBarcode.equals(f.getStockPackageCode())).collect(Collectors.toList()); + if (!inventoryPakcgaeList.isEmpty()) { + if (inventoryPakcgaeList.size() == 1) { + DisStockListDetailEntity disStockListDetailEntity = inventoryPakcgaeList.get(0); + DistributionLoadscaninvnEntity loadscaninvnEntity = distributionLoadscaninvnService.getOne(Wrappers.query().lambda() + .eq(DistributionLoadscaninvnEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) + .eq(DistributionLoadscaninvnEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()) + .eq(DistributionLoadscaninvnEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()) + .ne(DistributionLoadscaninvnEntity::getScanStatus, 1)); + if (Func.isNotEmpty(loadscaninvnEntity)) { + if (loadscaninvnEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) { + return Resp.scanFail("重复扫描", "重复扫描"); + } +// 库存品进行装车,这里需要对库存品扫描数据进行签收的状态标记 + loadscaninvnEntity.setSigningUserId(user.getUserId()); + loadscaninvnEntity.setSigningUser(user.getNickName()); + loadscaninvnEntity.setReceivedQuantity(disStockListDetailEntity.getNum()); + loadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); + loadscaninvnEntity.setSigningTime(now); + loadscaninvnEntity.setOneQclick(1); + packageLockIds.add(loadscaninvnEntity.getInventoryPackageId()); + distributionLoadscaninvnService.updateById(loadscaninvnEntity); + pushInventoryList.add(loadscaninvnEntity); + //维护签收数量 + distributionSignforMapper.updatesignforByinvn(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub()); + //更新签收人 + distributionSignforMapper.updateSignUser(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), user); + } else { + //存在配置要求必须装车才能进行签收 + if (Integer.parseInt(IsOrNoConstant.yes.getValue()) == isStrictLoading) { + return Resp.scanFail("库存品未装车,无法签收", "库存品未装车,无法签收"); + } + //库存品未进行装车 + //这里装车的数据需要进行补录 + DistributionLoadscaninvnEntity distributionLoadscaninvnEntity = new DistributionLoadscaninvnEntity(); + + if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverId())) { + distributionLoadscaninvnEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); + } + if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) { + distributionLoadscaninvnEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); + } + if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) { + distributionLoadscaninvnEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); + } + if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) { + distributionLoadscaninvnEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); + } + if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) { + distributionLoadscaninvnEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); + } + distributionLoadscaninvnEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString()); + distributionLoadscaninvnEntity.setOrderPackageCode(disStockListDetailEntity.getStockPackageCode()); + distributionLoadscaninvnEntity.setInventoryId(disStockListDetailEntity.getStockListId()); + distributionLoadscaninvnEntity.setInventoryPackageId(disStockListDetailEntity.getId()); + distributionLoadscaninvnEntity.setDeliveryId(distrilbutionloadingscanDTO.getDeliveryId()); + distributionLoadscaninvnEntity.setReservationId(distrilbutionloadingscanDTO.getReservationId()); + distributionLoadscaninvnEntity.setScanUser(user.getNickName()); + distributionLoadscaninvnEntity.setScanTime(now); + distributionLoadscaninvnEntity.setPackageNub(disStockListDetailEntity.getNum()); + distributionLoadscaninvnEntity.setScanStatus(LoadingStatusConstant.saomiao.getValue()); + distributionLoadscaninvnEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue()); + distributionLoadscaninvnEntity.setScanType("1"); + distributionLoadscaninvnEntity.setType(2); + distributionLoadscaninvnEntity.setWarehouseId(myCurrentWarehouse.getId()); + distributionLoadscaninvnEntity.setWarehouseName(myCurrentWarehouse.getName()); + distributionLoadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); + distributionLoadscaninvnEntity.setIsSignfor(1); + distributionLoadscaninvnEntity.setReceivedQuantity(disStockListDetailEntity.getNum()); + distributionLoadscaninvnEntity.setOneClick(1); + distributionLoadscaninvnEntity.setOneQclick(1); + distributionLoadscaninvnEntity.setLoadedNub(1); + distributionLoadscaninvnEntity.setSigningUser(user.getNickName()); + distributionLoadscaninvnEntity.setSigningUserId(user.getUserId()); + distributionLoadscaninvnEntity.setSigningTime(now); + distributionLoadscaninvnService.save(distributionLoadscaninvnEntity); + pushInventoryList.add(distributionLoadscaninvnEntity); + //更新装车数量 + Integer j = distributionSignforMapper.updateLoadAndsignforByinvn(distributionLoadscaninvnEntity.getDeliveryId(), distributionLoadscaninvnEntity.getReservationId(), distributionLoadscaninvnEntity.getPackageNub()); + //更新签收人 + Integer i = distributionSignforMapper.updateSignUser(distributionLoadscaninvnEntity.getDeliveryId(), distributionLoadscaninvnEntity.getReservationId(), AuthUtil.getUser()); + //扣减库存 + distributionStockListMapper.deductionQuantityStock(distributionLoadscaninvnEntity.getInventoryId(), distributionLoadscaninvnEntity.getLoadedNub()); + packageLockIds.add(distributionLoadscaninvnEntity.getInventoryPackageId()); + //扣减库存 + List jsonObjects = new ArrayList<>(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("code", distributionLoadscaninvnEntity.getOrderPackageCode()); + jsonObject.put("warehouseId", myCurrentWarehouse.getId()); + jsonObject.put("taskId", distributionLoadscaninvnEntity.getReservationId()); + jsonObject.put("type", 2); + jsonObject.put("num", 1); + jsonObject.put("remark", "签收下架"); + jsonObjects.add(jsonObject); + warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects); + } + //进行库存品包件状态维护 + disStockListDetailEntity.setStockLockingStatus(InventoryLoadingStatusConstant.yizhuangche.getValue()); + disStockListDetailEntity.setStockSignfoStatus(InventorySigningStatusConstant.yiqianshou.getValue()); + disStockListDetailService.updateById(disStockListDetailEntity); + } + } + break; + } if (!packageLockIds.isEmpty()) { List a = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + deliveryListEntity.getTrainNumber() + "orderPackageCode:" + packageLockIds); if (Func.isNotEmpty(a)) { @@ -8080,7 +8168,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl nodeFanoutMsg = buildDistributionSignforVO(deliveryListEntity,reservationEntity, pushList,OperatModeConstant.SCAN); + NodeFanoutMsg nodeFanoutMsg = buildDistributionSignforVO(deliveryListEntity, reservationEntity, pushList, OperatModeConstant.SCAN); iDistributionNodeWorkService.signFor(nodeFanoutMsg, AuthUtil.getUser()); } if (!orderCodes.isEmpty()) { @@ -8185,7 +8273,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl orderList = new ArrayList<>(); - List zeroOrderList = new ArrayList<>(); + List zeroOrderList = new ArrayList<>(); //查询该客户装车 List distributionLoadscanEntities = distributionLoadscanService.list(Wrappers.query().lambda() .eq(DistributionLoadscanEntity::getReservationId, reservationId) @@ -8359,84 +8447,85 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl loadscanAbnormalVOS = baseMapper.selectNewAbnormalPackageList(signforEntity.getReservationId(), signforEntity.getDeliveryId()); loadscanAbnormalVOS.forEach(p -> { - switch (p.getOrderPackageStatus()) { - case "10": - p.setOrderPackageStatusName(OrderPackageStatusConstant.weiruku.getName()); - break; - case "20": - p.setOrderPackageStatusName(OrderPackageStatusConstant.yiruku.getName()); - break; - case "30": - p.setOrderPackageStatusName(OrderPackageStatusConstant.zhongzhuanruku.getName()); - break; - case "40": - p.setOrderPackageStatusName(OrderPackageStatusConstant.zhiliu.getName()); - break; + if (p.getGoodsTypeName().equals("订制品")||p.getGoodsTypeName().equals("零担")){ + switch (p.getOrderPackageLoadingStatus()) { + case "10": + p.setOrderPackageLoadingStatusName(OrderPackageLoadingStatusConstant.weizhuancghe.getName()); + break; + case "20": + p.setOrderPackageLoadingStatusName(OrderPackageLoadingStatusConstant.yizhuangche.getName()); + break; + default: + log.info("未知的包件装车状态 {}", p.getOrderPackageLoadingStatus()); + } + switch (p.getOrderPackageStockupStatus()) { + case "10": + p.setOrderPackageStockupStatusName(OrderPackageStockupStatusConstant.daibeihuo.getName()); + break; + case "20": + p.setOrderPackageStockupStatusName(OrderPackageStockupStatusConstant.yibeihu.getName()); + break; + default: + log.info("未知的包件备货状态 {}", p.getOrderPackageStockupStatus()); + } + switch (p.getOrderPackageReservationStatus()) { + case "10": + p.setOrderPackageReservationStatusName(OrderPackageReservationStatusConstant.daiyuyue.getName()); + break; + case "20": + p.setOrderPackageReservationStatusName(OrderPackageReservationStatusConstant.yiyueyue.getName()); + break; + default: + log.info("未知的包件预约状态 {}", p.getOrderPackageReservationStatus()); + } + switch (p.getOrderPackageStatus()) { + case "10": + p.setOrderPackageStatusName(OrderPackageStatusConstant.weiruku.getName()); + break; + case "20": + p.setOrderPackageStatusName(OrderPackageStatusConstant.yiruku.getName()); + break; + case "30": + p.setOrderPackageStatusName(OrderPackageStatusConstant.zhongzhuanruku.getName()); + break; + case "40": + p.setOrderPackageStatusName(OrderPackageStatusConstant.zhiliu.getName()); + break; // case "50": // p.setOrderPackageStatusName(OrderPackageStatusConstant.yichuku.getName()); // break; - case "60": - p.setOrderPackageStatusName(OrderPackageStatusConstant.yichuku.getName()); - break; - case "70": - p.setOrderPackageStatusName(OrderPackageStatusConstant.yiqianshou.getName()); - break; - default: - log.info("未知的包件状态 {}", p.getOrderPackageStatus()); - } - switch (p.getOrderPackageFreezeStatus()) { - case "10": - p.setOrderPackageFreezeStatusName(OrderPackageFreezeStatusConstant.weidongjie.getName()); - break; - case "20": - p.setOrderPackageFreezeStatusName(OrderPackageFreezeStatusConstant.yidongjie.getName()); - break; - default: - log.info("未知的包件冻结状态 {}", p.getOrderPackageFreezeStatus()); - } - switch (p.getOrderPackageLoadingStatus()) { - case "10": - p.setOrderPackageLoadingStatusName(OrderPackageLoadingStatusConstant.weizhuancghe.getName()); - break; - case "20": - p.setOrderPackageLoadingStatusName(OrderPackageLoadingStatusConstant.yizhuangche.getName()); - break; - default: - log.info("未知的包件装车状态 {}", p.getOrderPackageLoadingStatus()); - } - switch (p.getOrderPackageStockupStatus()) { - case "10": - p.setOrderPackageStockupStatusName(OrderPackageStockupStatusConstant.daibeihuo.getName()); - break; - case "20": - p.setOrderPackageStockupStatusName(OrderPackageStockupStatusConstant.yibeihu.getName()); - break; - default: - log.info("未知的包件备货状态 {}", p.getOrderPackageStockupStatus()); - } - switch (p.getOrderPackageReservationStatus()) { - case "10": - p.setOrderPackageReservationStatusName(OrderPackageReservationStatusConstant.daiyuyue.getName()); - break; - case "20": - p.setOrderPackageReservationStatusName(OrderPackageReservationStatusConstant.yiyueyue.getName()); - break; - default: - log.info("未知的包件预约状态 {}", p.getOrderPackageReservationStatus()); - } + case "60": + p.setOrderPackageStatusName(OrderPackageStatusConstant.yichuku.getName()); + break; + case "70": + p.setOrderPackageStatusName(OrderPackageStatusConstant.yiqianshou.getName()); + break; + default: + log.info("未知的包件状态 {}", p.getOrderPackageStatus()); + } + }else if (p.getGoodsTypeName().equals("库存品")){ + DisStockListDetailEntity disStockListDetail = disStockListDetailService.getById(p.getPackageId()); + DisStockListDetailVO disStockListDetailVO = DistributionDisStockListWrapper.build().entityVO(disStockListDetail); + p.setOrderPackageStatusName(disStockListDetail.getStockLockingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue()) ?"已出库":(disStockListDetail.getStockSignfoStatus().equals(InventorySigningStatusConstant.yiqianshou.getValue())?"已签收":"已入库")); + p.setOrderPackageLoadingStatusName(disStockListDetailVO.getLoadingStatusName()); + p.setOrderPackageStockupStatusName(disStockListDetailVO.getStockupStatusName()); + p.setOrderPackageReservationStatusName(InventoryPackageStatusConstant.quxiao.getValue().equals(disStockListDetail.getStockPackageStatus())?"已预约":"已取消"); + DistributionStockListEntity stockListEntity = distributionStockListService.getById(disStockListDetail.getStockListId()); + p.setMaterialName(stockListEntity.getDescriptionGoods()); + } }); return R.data(loadscanAbnormalVOS); } @@ -8453,11 +8542,11 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl list = Func.toLongList(ids); List abnormalEntities = distributionLoadscanAbnormalService.listByIds(list); - if (abnormalEntities.isEmpty()){ + if (abnormalEntities.isEmpty()) { log.error(method + "查询异常列表数据错误,ids:{}", ids); return R.fail("查询异常列表数据错误,请联系管理员"); } @@ -8467,7 +8556,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl Objects.isNull(a.getLoadingId())).map(DistributionLoadscanAbnormalEntity::getPackageCode).collect(Collectors.joining(",")); log.error(method + "驳回出现,未进行装车的包件,unLoadingPackageCode:{}", unLoadingPackageCode); - return R.fail(unLoadingPackageCode+"未进行装车"); + return R.fail(unLoadingPackageCode + "未进行装车"); } List packageIds = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getPackageId).collect(Collectors.toList()); List reservationId = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getReservationId).distinct().collect(Collectors.toList()); @@ -8481,12 +8570,12 @@ public class DistributionSignforServiceImpl extends BaseServiceImplupdate().lambda() - .in(DistributionLoadscanAbnormalEntity::getId,ids) - .set(DistributionLoadscanAbnormalEntity::getAuditingStatus,LoadingAbnormalAuditingStatusConstant.yichang.getValue()) - .set(DistributionLoadscanAbnormalEntity::getAuditingUser,AuthUtil.getNickName()) - .set(DistributionLoadscanAbnormalEntity::getAuditingTime,new Date()) + .in(DistributionLoadscanAbnormalEntity::getId, ids) + .set(DistributionLoadscanAbnormalEntity::getAuditingStatus, LoadingAbnormalAuditingStatusConstant.yichang.getValue()) + .set(DistributionLoadscanAbnormalEntity::getAuditingUser, AuthUtil.getNickName()) + .set(DistributionLoadscanAbnormalEntity::getAuditingTime, new Date()) ); - List entityList = createdRetentionScanEntityList(loadscanEntityList,myCurrentWarehouse,AuthUtil.getUser(),reservationEntity,deliveryListEntity,abnormalEntities.stream().collect(Collectors.groupingBy(DistributionLoadscanAbnormalEntity::getLoadingId))); - if (!entityList.isEmpty()){ + List entityList = createdRetentionScanEntityList(loadscanEntityList, myCurrentWarehouse, AuthUtil.getUser(), reservationEntity, deliveryListEntity, abnormalEntities.stream().collect(Collectors.groupingBy(DistributionLoadscanAbnormalEntity::getLoadingId))); + if (!entityList.isEmpty()) { //进行批量回库任务提交 warehouseRetentionScanClient.saveBatchRetentionScan(entityList); } @@ -8519,11 +8608,11 @@ public class DistributionSignforServiceImpl extends BaseServiceImplupdate().lambda() - .eq(DistributionSignforEntity::getReservationId,reservationId) - .set(DistributionSignforEntity::getIsHaveAbnormalPackage,1) + .eq(DistributionSignforEntity::getReservationId, reservationId) + .set(DistributionSignforEntity::getIsHaveAbnormalPackage, 1) ); } @@ -8532,49 +8621,49 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl