Browse Source

PDA移库(可以不叫车)

k 1 year ago
parent
commit
6de8bccb19

+ 27 - 4
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java

@@ -192,6 +192,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
      * @param invLotLocIdMoveForm
      * @return
      */
+    @Transactional
     @Override
     public AjaxResult move(InvLotLocIdMoveForm invLotLocIdMoveForm) {
         String locationFrom = invLotLocIdMoveForm.getLocationFrom();
@@ -201,6 +202,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         Long warehouseId = invLotLocIdMoveForm.getWarehouseId();
         BaseLocationInfo baseLocationFrom = null;
         BaseLocationInfo baseLocationTo = null;
+        String palletNo;
 
         // 验证起始库位
         Boolean isIdleFrom = baseLocationInfoService.verifyLocationIsIdle(locationFrom, warehouseId);
@@ -219,6 +221,16 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         // 起始和目标库位
         baseLocationFrom = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationFrom, warehouseId);
         baseLocationTo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationTo, warehouseId);
+        if (baseLocationTo.getZoneId().equals(Constant.ZONE_TYPE.ZONE_VIRTUAL.getValue())) {
+            return AjaxResult.error("目标库位虚拟库位不可叫车!");
+        }
+
+        // 验证起始库位必须有货
+        List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invLotLocIdService.selectInvLocIdLotattByLocationId(baseLocationFrom.getId());
+        if (invLotLocIdLotattVOList.size() == 0) {
+            return AjaxResult.error("起始库位需要有库存!");
+        }
+        palletNo = invLotLocIdLotattVOList.get(0).getLotatt07();
 
         // 根据起始库位判断目标库位是否可以放置
         Boolean canPut = iBusinessService.checkLocCanPut(baseLocationFrom, baseLocationTo);
@@ -251,9 +263,12 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         baseLocationInfoService.lockLocationStockStatus(baseLocationFrom.getId(), baseLocationTo.getId()
                 , warehouseId, updateBy);
 
+        // 更新托盘绑定库位关系
+        iWmsBoxInfoService.updateLocationBind(palletNo,baseLocationFrom.getId(),baseLocationTo.getId(),null);
         return AjaxResult.success("执行成功");
     }
 
+    @Transactional
     @Override
     public AjaxResult moveDirect(InvLotLocIdMoveForm invLotLocIdMoveForm) {
         String locationFrom = invLotLocIdMoveForm.getLocationFrom();
@@ -263,6 +278,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         Long warehouseId = invLotLocIdMoveForm.getWarehouseId();
         BaseLocationInfo baseLocationFrom = null;
         BaseLocationInfo baseLocationTo = null;
+        String palletNo;
 
         // 验证起始库位
         Boolean isIdleFrom = baseLocationInfoService.verifyLocationIsIdle(locationFrom, warehouseId);
@@ -276,14 +292,21 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         }
         Boolean isInStock = baseLocationInfoService.verifyLocationIsInStock(locationTo, warehouseId);
         if (isInStock) {
-            return AjaxResult.error("目标库位有货!");
+//            return AjaxResult.error("目标库位有货!");
         }
         // 起始和目标库位
         baseLocationFrom = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationFrom, warehouseId);
         baseLocationTo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationTo, warehouseId);
 
+        // 验证起始库位必须有货
+        List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invLotLocIdService.selectInvLocIdLotattByLocationId(baseLocationFrom.getId());
+        if (invLotLocIdLotattVOList.size() == 0) {
+            return AjaxResult.error("起始库位需要有库存!");
+        }
+        palletNo = invLotLocIdLotattVOList.get(0).getLotatt07();
+
         // 转移库存
-        int stockTransfer = invLotLocIdService.stockTransfer(baseLocationFrom.getId(), invLotLocIdMoveForm.getPalletNo(), baseLocationTo.getId());
+        int stockTransfer = invLotLocIdService.stockTransfer(baseLocationFrom.getId(), null, baseLocationTo.getId());
         if (stockTransfer <= 0) {
             return AjaxResult.success("库存转移失败!");
         }
@@ -292,8 +315,8 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         // 更新目标库位空闲有货
         baseLocationInfoService.updateLocationIdleAndNoEmpty(baseLocationTo.getId(), warehouseId, updateBy);
 
-        // todo 事务
-
+        // 更新托盘绑定库位关系
+        iWmsBoxInfoService.updateLocationBind(palletNo,baseLocationFrom.getId(),baseLocationTo.getId(),null);
         return AjaxResult.success("操作成功!");
     }
 

+ 5 - 1
warewms-base/src/main/java/com/ruoyi/base/constant/Constant.java

@@ -427,7 +427,11 @@ public class Constant {
         /**
          * 出库区域
          */
-        ZONE_OUT(5L);
+        ZONE_OUT(5L),
+        /**
+         * 虚拟区
+         */
+        ZONE_VIRTUAL(9999L);
 
         private Long value;