Browse Source

1.多张出库可分配同一个托盘
2.限制物料不可入库码盘
3.扫描条码查询条码库存bug修改

k 1 year ago
parent
commit
f3bd2db5b3

+ 3 - 0
warewms-ams/src/main/java/com/ruoyi/ams/asn/service/impl/WmsDocAsnHeaderServiceImpl.java

@@ -324,6 +324,9 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
 
         //判断成品条码
         CodeSkuRelationshipVO codeSkuRelationshipVO = codeSkuRelationshipService.checkIsProduct(stockForm.getSkuSn());
+        if (!codeSkuRelationshipVO.isProduct()) {
+            return AjaxResult.error("物料不可以入库!");
+        }
         //当前订单总数
         BigDecimal totalQty = new BigDecimal(stockForm.getQty());
 

+ 9 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/IInvLotLocIdService.java

@@ -394,4 +394,13 @@ public interface IInvLotLocIdService {
      * @return
      */
     AjaxResult updateLotatt15ByLocationId(String locationId,String orderNo);
+
+    /**
+     * 根据lotnum将对应库存批次lotatt15改为出库单号
+     *
+     * @param lotnum
+     * @param orderNo
+     * @return
+     */
+    AjaxResult updateLotatt15ByLotnum(String lotnum,String orderNo);
 }

+ 20 - 2
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java

@@ -957,7 +957,15 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
             return invLotLocIdService.releaseLocation(basLocationForm.getLocationNo(), Constant.LOC_SORTATION02_CACHE
                     , Constant.WAREHOUSE_ID, "PDA");
         }
-        if (StringUtils.isEmpty(invLotLocIdLotattVOS.get(0).getLotatt15())) {
+
+        // 如果库存中所有lotatt15都为空 说明是移库
+        boolean lotatt15Null = true;
+        for (InvLotLocIdLotattVO lotLocIdLotattVO : invLotLocIdLotattVOS) {
+            if (StringUtils.isNotEmpty(lotLocIdLotattVO.getLotatt15())) {
+                lotatt15Null = false;
+            }
+        }
+        if (lotatt15Null) {
             // 说明是移库,直接删除库存
             return AjaxResult.error("移库暂时不支持释放!");
 //            return invLotLocIdService.clear(baseLocationInfo.getId().toString(), Constant.WAREHOUSE_ID, "PDA");
@@ -1008,7 +1016,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         // 判断是否有更新备货造成的未分配数量
         for (InvLotLocIdLotattVO locIdLotattVO : invLotLocIdLotattVOList) {
             if (locIdLotattVO.getQty().compareTo(locIdLotattVO.getQtyallocated()) != 0) {
-                return AjaxResult.error("托盘有库存不属于当前备货单,不可操作出库!");
+                return AjaxResult.error("托盘有库存不属于当前备货单,不可操作出库!" + locIdLotattVO.getLotatt02());
             }
         }
         // 清除库存
@@ -1069,4 +1077,14 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         return AjaxResult.success();
     }
 
+    @Override
+    public AjaxResult updateLotatt15ByLotnum(String lotnum, String orderNo) {
+        InvLotAtt invLotAtt = invLotAttMapper.selectInvLotAttByLotnum(lotnum);
+        if (invLotAtt != null) {
+            invLotAtt.setLotatt15(orderNo);
+            invLotAttMapper.updateInvLotAtt(invLotAtt);
+        }
+        return AjaxResult.success();
+    }
+
 }

+ 20 - 7
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/WmsDocOrderHeaderServiceImpl.java

@@ -381,6 +381,8 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             } else if (header.getOrderType().equals(Constant.ORDER_TYP.LH.getValue())) {
                 // 库内理货不需要分配
                 ajaxResult = AjaxResult.success();
+            } else {
+                ajaxResult = AjaxResult.error("出库单类型不存在!");
             }
             if (!ajaxResult.isSuccess()) {
                 builder.append(s).append(":").append(ajaxResult.getMsg()).append(";");
@@ -561,7 +563,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                 return false;
             }
             // 库存是否已经分配或者备货
-            if (StringUtils.isEmpty(v.getLotatt15()) || orderNo.equals(v.getLotatt15())) {
+            if (StringUtils.isEmpty(v.getLotatt15())) {
                 if (StringUtils.isEmpty(v.getLotatt14())) {
                     return true;
                 }
@@ -605,8 +607,10 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                             //生成分配明细
                             actAllocationDetailsService.addActAllocationDetails(inv.getLotnum(), inv.getLocationId(), allocatedQty, details
                                     , Constant.ORDER_STS.STS20.getValue());
+                            //修改分配的库存批次lotatt15记录分配出库单号
+                            invLotLocIdService.updateLotatt15ByLotnum(inv.getLotnum(), orderNo);
                             //库位对应所有库存lotatt15记录分配出库单号
-                            invLotLocIdService.updateLotatt15ByLocationId(inv.getLocationId(), orderNo);
+//                            invLotLocIdService.updateLotatt15ByLocationId(inv.getLocationId(), orderNo);
                         } else {
                             throw new ServiceException("占用库存分配数失败");
                         }
@@ -626,8 +630,10 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                             //生成分配明细
                             actAllocationDetailsService.addActAllocationDetails(inv.getLotnum(), inv.getLocationId(), allocatedQty, details
                                     , Constant.ORDER_STS.STS20.getValue());
+                            //修改分配的库存批次lotatt15记录分配出库单号
+                            invLotLocIdService.updateLotatt15ByLotnum(inv.getLotnum(), orderNo);
                             //库位对应所有库存lotatt15记录分配出库单号
-                            invLotLocIdService.updateLotatt15ByLocationId(inv.getLocationId(), orderNo);
+//                            invLotLocIdService.updateLotatt15ByLocationId(inv.getLocationId(), orderNo);
                             return AjaxResult.success("分配完成", originalOrderQty);
                         } else {
                             throw new ServiceException("占用库存分配数失败");
@@ -646,8 +652,10 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                             //生成分配明细
                             actAllocationDetailsService.addActAllocationDetails(inv.getLotnum(), inv.getLocationId(), currentQty, details
                                     , Constant.ORDER_STS.STS20.getValue());
+                            //修改分配的库存批次lotatt15记录分配出库单号
+                            invLotLocIdService.updateLotatt15ByLotnum(inv.getLotnum(), orderNo);
                             //库位对应所有库存lotatt15记录分配出库单号
-                            invLotLocIdService.updateLotatt15ByLocationId(inv.getLocationId(), orderNo);
+//                            invLotLocIdService.updateLotatt15ByLocationId(inv.getLocationId(), orderNo);
                             return AjaxResult.success("分配完成", originalOrderQty);
 
                         } else {
@@ -683,7 +691,10 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                 String lotatt15 = locIdLotattVO.getLotatt15();
                 WmsDocOrderHeader wmsDocOrderHeader = wmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(lotatt15);
                 PickingListVO pickingListVO = new PickingListVO();
-                pickingListVO.setOrderNo(wmsDocOrderHeader.getSoReference1()); // ERP单号
+                if (wmsDocOrderHeader != null) {
+                    pickingListVO.setOrderNo(wmsDocOrderHeader.getSoReference1() == null ? ""
+                            : wmsDocOrderHeader.getSoReference1()); // ERP单号
+                }
                 pickingListVO.setSku(locIdLotattVO.getSku());
                 pickingListVO.setPickQty(locIdLotattVO.getQtyallocated());
                 pickingListVO.setToBePickQty(locIdLotattVO.getQty());
@@ -1217,7 +1228,6 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
      * @return
      */
     private int judgmentOfGroupPlateType(InvLotLocIdLotattVO locIdLotattVO) {
-        // 为空说明是备货出库,但是被更新备货流程改变了分配数
         if (StringUtils.isEmpty(locIdLotattVO.getLotatt15())
                 && StringUtils.isNotEmpty(locIdLotattVO.getLotatt14())) {
             return 3;
@@ -1734,7 +1744,10 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         for (InvLotLocIdLotattVO locIdLotattVO : invLotLocIdLotattVOList) {
             String lotatt15 = locIdLotattVO.getLotatt15();
             WmsDocOrderHeader wmsDocOrderHeader = wmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(lotatt15);
-            codeSkuRelationshipSoVO.setOrderNo(wmsDocOrderHeader.getSoReference1());
+            if (wmsDocOrderHeader != null) {
+                codeSkuRelationshipSoVO.setOrderNo(wmsDocOrderHeader.getSoReference1() == null ? ""
+                        : wmsDocOrderHeader.getSoReference1()); // ERP单号
+            }
             codeSkuRelationshipSoVO.setSku(locIdLotattVO.getSku());
             codeSkuRelationshipSoVO.setSkuName(locIdLotattVO.getSkuName());
             codeSkuRelationshipSoVO.setSkuType(locIdLotattVO.getSkuTypeName());