diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseRetentionScanClient.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseRetentionScanClient.java index 11fc23016..273f2ce38 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseRetentionScanClient.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseRetentionScanClient.java @@ -17,6 +17,7 @@ package com.logpm.warehouse.feign; import com.logpm.warehouse.entity.WarehouseRetentionScanEntity; +import org.springblade.common.constant.ModuleNameConstant; import org.springblade.core.mp.support.BladePage; import com.logpm.warehouse.entity.WarehouseRetentionRecordEntity; import org.springblade.core.tool.api.R; @@ -26,6 +27,8 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; +import java.util.List; + /** * 滞留扫描记录 Feign接口类 * @@ -33,7 +36,7 @@ import org.springframework.web.bind.annotation.RequestParam; * @since 2023-11-03 */ @FeignClient( - value = "warehouseRetentionScan" + value = ModuleNameConstant.APPLICATION_WAREHOUSE_NAME ) public interface IWarehouseRetentionScanClient { @@ -58,4 +61,7 @@ public interface IWarehouseRetentionScanClient { @PostMapping(TOP+"/saveRetentionScan") R saveRetentionScan(@RequestBody WarehouseRetentionScanEntity warehouseRetentionScanEntity); + @PostMapping(TOP+"/saveBatchRetentionScan") + R saveBatchRetentionScan(@RequestBody List warehouseRetentionScanEntities); + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java index de298abb5..628a37bcb 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java @@ -5941,11 +5941,24 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl barcode = Func.toStrList(distrilbutionloadingscanDTO.getBarcode()); + List parcelListEntities = distributionParcelListService.list(Wrappers.query().lambda() + .in(DistributionParcelListEntity::getOrderPackageCode, barcode) + .eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId()) + ); + if (!parcelListEntities.isEmpty()) { + boolean flag = parcelListEntities.stream().allMatch(a -> OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(a.getOrderPackageLoadingStatus()) && !OrderPackageStatusConstant.yiqianshou.getValue().equals(a.getOrderPackageStatus())); + if (!flag){ + String str = parcelListEntities.stream().filter(a -> OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(a.getOrderPackageLoadingStatus()) && !OrderPackageStatusConstant.yiqianshou.getValue().equals(a.getOrderPackageStatus())).map(DistributionParcelListEntity::getOrderCode).distinct().collect(Collectors.joining(",")); + return R.fail(str+"不满足滞留"); + } } Integer retentionType = distrilbutionloadingscanDTO.getRetentionType(); Long deliveryId = null; @@ -5953,14 +5966,14 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl loadscanEntityList = distributionLoadscanService.list(Wrappers.query().lambda() - .eq(DistributionLoadscanEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()) + .in(DistributionLoadscanEntity::getOrderPackageCode, barcode) .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) .ne(DistributionLoadscanEntity::getSignforState, LoadScanSigningStatusConstant.yiqianshou.getValue()) ); if (loadscanEntityList.isEmpty()) { //查询库存品 List loadscaninvnEntityList = distributionLoadscaninvnService.list(Wrappers.query().lambda() - .eq(DistributionLoadscaninvnEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()) + .in(DistributionLoadscaninvnEntity::getOrderPackageCode, barcode) .ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) .ne(DistributionLoadscaninvnEntity::getSignforState, LoadScanSigningStatusConstant.yiqianshou.getValue()) ); @@ -5978,7 +5991,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl retentionScanVos = new ArrayList<>(); - switch (retentionType) { case 1: //包件--库存品 和包件 @@ -6056,7 +6068,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl list = distributionLoadscanAbnormalService.list(Wrappers.query().lambda() .eq(DistributionLoadscanAbnormalEntity::getPackageCode, distrilbutionloadingscanDTO.getBarcode()) ); @@ -6085,16 +6097,22 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl warehouseRetentionScanEntities = new ArrayList<>(); + if (!retentionScanVos.isEmpty()) { + retentionScanVos.forEach(r->{ + WarehouseRetentionScanEntity warehouseRetntionScanEntity = Func.copy(r, WarehouseRetentionScanEntity.class); + warehouseRetentionScanEntities.add(warehouseRetntionScanEntity); + }); + } + if (!warehouseRetentionScanEntities.isEmpty()) { + //进行批量滞留 + R r = warehouseRetentionScanClient.saveBatchRetentionScan(warehouseRetentionScanEntities); + if (!Objects.equals(r.getCode(),200)){ + throw new RuntimeException(r.getMsg()); + } } } - return R.data(retentionScanVos); + return R.success("滞留操作成功"); } @Override diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseRetentionScanClient.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseRetentionScanClient.java index 730cd1f55..47e8b3c48 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseRetentionScanClient.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseRetentionScanClient.java @@ -30,6 +30,8 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; +import java.util.List; + /** * 滞留扫描记录 Feign实现类 * @@ -43,6 +45,8 @@ public class WarehouseRetentionScanClient implements IWarehouseRetentionScanClie private final IWarehouseRetentionScanService warehouseRetentionScanService; + private final IWarehouseRetentionRecordService warehouseRetentionRecordService; + @Override @GetMapping(TOP) public BladePage retentionScanTop(Integer current, Integer size) { @@ -58,4 +62,10 @@ public class WarehouseRetentionScanClient implements IWarehouseRetentionScanClie return R.status(warehouseRetentionScanService.save(warehouseRetentionScanEntity)); } + @Override + public R saveBatchRetentionScan(List warehouseRetentionScanEntities) { + + return warehouseRetentionRecordService.saveBatchRetentionList(warehouseRetentionScanEntities); + } + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseRetentionRecordService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseRetentionRecordService.java index 535a89164..50d64e4de 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseRetentionRecordService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseRetentionRecordService.java @@ -23,6 +23,7 @@ import com.logpm.warehouse.dto.RetentionDTO; import com.logpm.warehouse.dto.WarehouseRetentionRecordDTO; import com.logpm.warehouse.dto.WarehouseRetentionScanDTO; import com.logpm.warehouse.entity.WarehouseRetentionRecordEntity; +import com.logpm.warehouse.entity.WarehouseRetentionScanEntity; import com.logpm.warehouse.excel.WarehouseRetentionRecordExcel; import com.logpm.warehouse.vo.WarehouseRetentionRecordVO; import com.logpm.warehouse.vo.WarehouseRetentionScanVO; @@ -98,4 +99,12 @@ public interface IWarehouseRetentionRecordService extends BaseService getRetentionPackageByType(@Param("retentionId") Long retentionId,@Param("type") Integer type); + + /** + * 后台批量进行滞留 + * @param warehouseRetentionScanEntities + * @return + */ + R saveBatchRetentionList(List warehouseRetentionScanEntities); + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseRetentionRecordServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseRetentionRecordServiceImpl.java index eaa07b8f0..a0ac34c7f 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseRetentionRecordServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseRetentionRecordServiceImpl.java @@ -155,9 +155,9 @@ public class WarehouseRetentionRecordServiceImpl extends BaseServiceImpl retentionScanEntityList = warehouseRetentionScanService.list(Wrappers.query().lambda() .eq(WarehouseRetentionScanEntity::getDeliveryId, deliveryId) @@ -297,7 +297,7 @@ public class WarehouseRetentionRecordServiceImpl extends BaseServiceImplquery().lambda() - .eq(WarehouseRetentionScanEntity::getDeliveryId, warehouseRetentionScanDTOS.getDeliveryId())).stream().mapToInt(WarehouseRetentionScanEntity::getRetentionQuantity) + .eq(WarehouseRetentionScanEntity::getDeliveryId, warehouseRetentionScanDTOS.getDeliveryId())).stream().mapToInt(WarehouseRetentionScanEntity::getRetentionQuantity) .sum(); if (saveFlah.get()) { return Resp.scanSuccess("操作成功", "共计滞留" + retentionTotal + "件"); @@ -381,4 +381,50 @@ public class WarehouseRetentionRecordServiceImpl extends BaseServiceImpl warehouseRetentionScanEntities) { + AtomicBoolean saveFlah = new AtomicBoolean(false); + if (!warehouseRetentionScanEntities.isEmpty()) { + List deliveryIds = warehouseRetentionScanEntities.stream().map(WarehouseRetentionScanEntity::getDeliveryId).distinct().collect(Collectors.toList()); + //查询出该滞留任务是否存在 + List retentionScanEntityList = warehouseRetentionScanService.list(Wrappers.query().lambda() + .in(WarehouseRetentionScanEntity::getDeliveryId, deliveryIds) + ); + if (!retentionScanEntityList.isEmpty()) { + String collect = retentionScanEntityList.stream().filter(f -> + warehouseRetentionScanEntities.stream().map(w -> w.getOrderPackageCode()) + .collect(Collectors.toList()) + .contains(f.getOrderPackageCode())) + .map(WarehouseRetentionScanEntity::getOrderPackageCode).collect(Collectors.joining(",")); + if (Objects.isNull(collect)){ + return R.fail(collect+"重复滞留"); + } + } + for (WarehouseRetentionScanEntity warehouseRetentionScanEntity : warehouseRetentionScanEntities) { + + //进行滞留逻辑处理 + switch (warehouseRetentionScanEntity.getConditions()) { + case 1: + //订制品 + saveFlah.set(distributionDeliveryListClient.retentionDeliveryReservationPackage(warehouseRetentionScanEntity.getDeliveryId(), warehouseRetentionScanEntity.getReservationId(), warehouseRetentionScanEntity.getOrderPackageId(), warehouseRetentionScanEntity.getConditions())); + break; + case 2: + //库存品 + saveFlah.set(distributionDeliveryListClient.retentionDeliveryReservationInventory(warehouseRetentionScanEntity.getDeliveryId(), warehouseRetentionScanEntity.getReservationId(), warehouseRetentionScanEntity.getOrderPackageId())); + break; + case 3: + //零担 + saveFlah.set(distributionDeliveryListClient.retentionDeliveryReservationZeroPackage(warehouseRetentionScanEntity.getDeliveryId(), warehouseRetentionScanEntity.getReservationId(), warehouseRetentionScanEntity.getOrderPackageId(), warehouseRetentionScanEntity.getRetentionQuantity(), warehouseRetentionScanEntity.getOrderId())); + break; + default: + log.error(">>>>> rs.getConditions()={}", warehouseRetentionScanEntity.getConditions()); + } + //进行滞留信息的保存 + warehouseRetentionScanService.save(Func.copy(warehouseRetentionScanEntity, WarehouseRetentionScanEntity.class)); + } + } + return R.success("操作成功"); + } + }