From daeab66cfaa84fb6cad6d2365e7f5d8ee409a20d Mon Sep 17 00:00:00 2001
From: youjie <272855983@qq.com>
Date: Fri, 10 Nov 2023 09:04:44 +0800
Subject: [PATCH] 自动出库只能适配立库

---
 huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java
index f846870..d525ec3 100644
--- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java
+++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java
@@ -19,6 +19,8 @@ import org.jeecg.modules.wms.config.port.entity.Port;
 import org.jeecg.modules.wms.config.port.service.IPortService;
 import org.jeecg.modules.wms.config.shipmentType.entity.ShipmentType;
 import org.jeecg.modules.wms.config.shipmentType.service.IShipmentTypeService;
+import org.jeecg.modules.wms.config.zone.entity.Zone;
+import org.jeecg.modules.wms.config.zone.service.IZoneService;
 import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService;
 import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService;
 import org.jeecg.modules.wms.shipment.shipmentCombination.service.IShipmentCombinationService;
@@ -102,6 +104,8 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper,
     private IHuahengMultiHandlerService huahengMultiHandlerService;
     @Resource
     private IPortService portService;
+    @Resource
+    private IZoneService zoneService;
 
     @Override
     @Transactional
@@ -366,14 +370,29 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper,
 //        if (type == QuantityConstant.PORT_TYPE_IN) {
 //            return Result.error("自动出库, 不能选择入库口来出库");
 //        }
-        Result result = shipmentCombinationService.autoCombination(shipmentCode, warehouseCode);
-        if (!result.isSuccess()) {
-            throw new JeecgBootException("自动出库," + result.getMessage());
-        }
         ShipmentHeader shipmentHeader = shipmentHeaderService.getShipmentHeaderByCode(shipmentCode, warehouseCode);
         if (shipmentHeader == null) {
             throw new JeecgBootException("自动出库, 没有找到出库单");
         }
+        String zoneCode = shipmentHeader.getZoneCode();
+        if (StringUtils.isEmpty(zoneCode)) {
+            throw new JeecgBootException("自动出库, 库区编码为空");
+        }
+        Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode);
+        if (zone == null) {
+            throw new JeecgBootException("自动出库, 库区为空");
+        }
+        String zoneType = zone.getType();
+        if (StringUtils.isEmpty(zoneType)) {
+            throw new JeecgBootException("自动出库, 库区类型编码为空");
+        }
+        if (!zoneType.equals(QuantityConstant.ZONE_TYPE_STEREOSCOPIC)) {
+            throw new JeecgBootException("自动出库, 库区类型必须为立库区类型");
+        }
+        Result result = shipmentCombinationService.autoCombination(shipmentCode, warehouseCode);
+        if (!result.isSuccess()) {
+            throw new JeecgBootException("自动出库," + result.getMessage());
+        }
         List<ShipmentContainerDetail> shipmentContainerDetailList = shipmentContainerDetailService.getShipmentContainerDetailListByShipmentCode(shipmentCode);
         if (shipmentContainerDetailList == null) {
             throw new JeecgBootException("自动出库, 没有找到出库配盘详情");
@@ -389,7 +408,6 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper,
             if (shipmentContainerHeader == null) {
                 throw new JeecgBootException("自动出库, 没有找到出库表头:" + shipmentContainerId);
             }
-            String zoneCode = shipmentHeader.getZoneCode();
             int taskType = shipmentContainerHeader.getTaskType();
             int type = QuantityConstant.PORT_TYPE_PICK;
             if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) {
--
libgit2 0.22.2