Browse Source

理货备货-校验当前出库货对应产品是否已经完全备货

k 1 year ago
parent
commit
45cb762695

+ 21 - 2
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/WmsDocOrderHeaderServiceImpl.java

@@ -1049,7 +1049,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
 
     @Transactional
     @Override
-    public AjaxResult groupDisk(GroupDiskFrom groupDiskFrom) {
+    public synchronized AjaxResult groupDisk(GroupDiskFrom groupDiskFrom) {
         String palletNoFrom = groupDiskFrom.getPalletNoFrom(); // 起始托盘
         String palletNoTo = groupDiskFrom.getPalletNoTo(); // 目标托盘
         String sn = groupDiskFrom.getSn(); // 条码号
@@ -1294,7 +1294,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
 
     @Transactional
     @Override
-    public AjaxResult groupDiskBH(GroupDiskFrom groupDiskFrom) {
+    public synchronized AjaxResult groupDiskBH(GroupDiskFrom groupDiskFrom) {
         String palletNoFrom = groupDiskFrom.getPalletNoFrom(); // 起始托盘
         String palletNoTo = groupDiskFrom.getPalletNoTo(); // 目标托盘
         String sn = groupDiskFrom.getSn(); // 条码号
@@ -1321,6 +1321,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                 return AjaxResult.error("出库单状态不可备货组盘!");
             }
         }
+
         // 根据条码获取物料号
         CodeSkuRelationshipVO codeSkuRelationshipVO = codeSkuRelationshipService.checkIsProduct(sn);
         sku = codeSkuRelationshipVO.getSku();
@@ -1328,6 +1329,21 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             qty = 1.0; //产品默认为1
         }
         toQty = qty;
+        // 验证此备货单对应sku是否已经完全备货
+        boolean con = false; // 是否有可以备货的数量
+        List<WmsDocOrderDetails> wmsDocOrderDetails = wmsDocOrderDetailsMapper.selectWmsDocOrderDetailsByOrderNo(orderNo);
+        for (WmsDocOrderDetails wmsDocOrderDetail : wmsDocOrderDetails) {
+            if (wmsDocOrderDetail.getSku().equals(sku)) {
+                if (wmsDocOrderDetail.getQtyAllocated().compareTo(wmsDocOrderDetail.getQtySoftAllocated()) == 1) {
+                    con =true;
+                    break;
+                }
+            }
+        }
+        if (!con) {
+            return AjaxResult.error("备货单对应产品已经备货完成!" + sku);
+        }
+
         // 根据起始托盘,条码号查出库存
         InvLocIdSearchFrom locIdSearchFrom = new InvLocIdSearchFrom();
         locIdSearchFrom.setSku(sku);
@@ -1574,6 +1590,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                                     invLotLocIdUpdate.setSku(locIdLotattVO.getSku());
                                     invLotLocIdUpdate.setQtyallocated(BigDecimal.ZERO);
                                     invLotLocIdService.updateInvLotLocId(invLotLocIdUpdate);
+                                    break;
                                 }
                             }
 
@@ -2223,6 +2240,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
     }
 
 
+    @Transactional
     public AjaxResult modifystockCompletionStatus(String orderNo, String sku, BigDecimal qty) {
         WmsDocOrderHeader docOrderHeader = wmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(orderNo);
         // 明细
@@ -2283,6 +2301,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         return AjaxResult.success();
     }
 
+    @Transactional
     public AjaxResult modifystockCompletionStatusAsn(String orderNo, String sku, BigDecimal qty) {
         WmsDocOrderHeader docOrderHeader = wmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(orderNo);
         // 明细