zhangxin 1 gadu atpakaļ
vecāks
revīzija
3ed6ac23fc

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

@@ -965,8 +965,8 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
             return invLotLocIdService.releaseLocation(basLocationForm.getLocationNo(), Constant.LOC_SORTATION02_CACHE
                     , Constant.WAREHOUSE_ID, "PDA");
         }
-
-        // 如果库存中所有lotatt15都为空 说明是移库
+        //todo
+       // 如果库存中所有lotatt15都为空 说明是移库
         boolean lotatt15Null = true;
         for (InvLotLocIdLotattVO lotLocIdLotattVO : invLotLocIdLotattVOS) {
             if (StringUtils.isNotEmpty(lotLocIdLotattVO.getLotatt15())) {
@@ -1183,7 +1183,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
                 .set(StringUtils.isNotBlank(lotNumTo), InvLotLocId::getQty, qty)
                 .set(InvLotLocId::getSku, sku)
                 .set(StringUtils.isNotBlank(locationId), InvLotLocId::getLocationId, locationId)
-                .set(InvLotLocId::getQtyallocated, StringUtils.isNotBlank(lotNumTo) ? BigDecimal.ZERO : qtyAllocated)
+                .set(InvLotLocId::getQtyallocated, StringUtils.isNotBlank(lotNumTo) ? qty : qtyAllocated)
         ) > 0;
     }
 

+ 10 - 6
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/WmsDocOrderHeaderServiceImpl.java

@@ -2753,13 +2753,18 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         String sn = pdaGroupDiskDTO.getSn(); // 条码号
         String boxNo = StringUtils.isNotBlank(pdaGroupDiskDTO.getBoxNo()) ? pdaGroupDiskDTO.getBoxNo() : palletNoTo; //箱号
         BigDecimal qty = new BigDecimal(pdaGroupDiskDTO.getQty()); // 数量
-        WmsDocOrderHeader wmsDocOrderHeader = selectWmsDocOrderHeaderByErpNo(pdaGroupDiskDTO.getOrderNo());
-        String orderNo = wmsDocOrderHeader.getOrderNo();
-
         // 根据条码获取物料号
         CodeSkuRelationshipVO codeSkuRelationshipVO = codeSkuRelationshipService.checkIsProduct(sn);
         // 物料编码
         String sku = codeSkuRelationshipVO.getSku();
+        WmsDocOrderHeader wmsDocOrderHeader = selectWmsDocOrderHeaderByErpNo(pdaGroupDiskDTO.getOrderNo());
+        String orderNo = wmsDocOrderHeader.getOrderNo();
+        List<WmsDocOrderDetails> wmsDocOrderDetailsList = wmsDocOrderDetailsService.queryWmsDocOrderDetailsByOrderNo(orderNo);
+        List<WmsDocOrderDetails> wmsDocOrderDetailsMatchSkuList = wmsDocOrderDetailsList.stream().filter(item -> item.getSku().equals(sku)).collect(Collectors.toList());
+        if (CollectionUtil.isEmpty(wmsDocOrderDetailsMatchSkuList)){
+            throw new BaseException("出库明细未绑定此类产品!");
+        }
+
         //创建新批次
         String lotNum = IdWorker.getIdStr();
         invLotAttService.insertInvLotAtt(buildInvLotAtt(lotNum, palletNoTo, orderNo, sn, sku));
@@ -2778,10 +2783,9 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             invLotLocIdService.insertInvLotLocId(buildInvLotLocId(lotNum, qty, locationId, orderNo, sku));
         }
 
-        List<WmsDocOrderDetails> wmsDocOrderDetailsList = wmsDocOrderDetailsService.queryWmsDocOrderDetailsByOrderNo(orderNo);
+
         //筛选出相同sku并且数量未分配或未分配完的明细信息
-        List<WmsDocOrderDetails> wmsDocOrderDetailsFilterList = wmsDocOrderDetailsList.stream().filter(item -> CompareUtil.compare(item.getSku(), sku) == 0 &&
-                CompareUtil.compare(item.getQtyOrdered().subtract(item.getQtyAllocated()), BigDecimal.ZERO) > 0).collect(Collectors.toList());
+        List<WmsDocOrderDetails> wmsDocOrderDetailsFilterList = wmsDocOrderDetailsMatchSkuList.stream().filter(item -> CompareUtil.compare(item.getQtyOrdered().subtract(item.getQtyAllocated()), BigDecimal.ZERO) > 0).collect(Collectors.toList());
         for (WmsDocOrderDetails wmsDocOrderDetails : wmsDocOrderDetailsFilterList) {
             //明细已分配数量
             BigDecimal wmsDocOrderDetailsQtyAllocated = ObjectUtil.isNotNull(wmsDocOrderDetails.getQtyAllocated()) ? wmsDocOrderDetails.getQtyAllocated() : BigDecimal.ZERO;