Ver Fonte

Merge remote-tracking branch 'origin/yonghu' into yonghu

LZH há 2 anos atrás
pai
commit
bac78c8696

+ 27 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/pda/PdaController.java

@@ -22,6 +22,8 @@ import com.ruoyi.ams.config.domain.vo.FlowConfigHeaderVO;
 import com.ruoyi.ams.config.domain.vo.LotattConfigVO;
 import com.ruoyi.ams.config.service.IFlowConfigHeaderService;
 import com.ruoyi.ams.config.service.ILotattConfigService;
+import com.ruoyi.ams.inv.domain.form.InvLocIdSearchFrom;
+import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
 import com.ruoyi.ams.inv.form.InvTransferPickForm;
 import com.ruoyi.ams.inv.service.IInvLotLocIdService;
 import com.ruoyi.ams.lineCall.domain.form.LineCallDetailsForm;
@@ -37,6 +39,7 @@ import com.ruoyi.ams.order.service.IWmsDocOrderHeaderService;
 import com.ruoyi.ams.order.vo.CheckOutVO;
 import com.ruoyi.ams.order.vo.PickingListVO;
 import com.ruoyi.base.constant.Constant;
+import com.ruoyi.base.domain.BaseLocationInfo;
 import com.ruoyi.base.domain.form.BasLocationForm;
 import com.ruoyi.base.domain.vo.CodeSkuRelationshipSoVO;
 import com.ruoyi.base.domain.vo.CodeSkuRelationshipVO;
@@ -538,6 +541,30 @@ public class PdaController {
      */
     @PostMapping("/base/locationRelease")
     public AjaxResult locationRelease(@RequestBody BasLocationForm basLocationForm) {
+        BaseLocationInfo baseLocationInfo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(basLocationForm.getLocationNo(), Constant.WAREHOUSE_ID);
+        if (baseLocationInfo == null) {
+            return AjaxResult.error("不存在此库位!");
+        }
+        List<InvLotLocIdLotattVO> invLotLocIdLotattVOS = invLotLocIdService.selectInvLocIdLotattByLocationId(baseLocationInfo.getId());
+        if (invLotLocIdLotattVOS.size() == 0) {
+            return AjaxResult.error("不存在对应释放库存!");
+        }
+        // 查出对应出库单
+        InvLotLocIdLotattVO invLotLocIdLotattVO = invLotLocIdLotattVOS.get(0);
+        if (StringUtils.isEmpty(invLotLocIdLotattVO.getLotatt15())) {
+            // 说明是移库,直接删除库存
+            return invLotLocIdService.clear(baseLocationInfo.getId().toString(), Constant.WAREHOUSE_ID, "PDA");
+        }
+        String lotatt15 = invLotLocIdLotattVO.getLotatt15();
+        WmsDocOrderHeader wmsDocOrderHeader = wmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(lotatt15);
+        // 如果是备货单,并且出库的库存lotatt14不为空,说明是备货完成出库,就需要删除库存
+        if (wmsDocOrderHeader.getOrderType().equals(Constant.ORDER_TYP.BH.getValue())
+                && StringUtils.isNotEmpty(invLotLocIdLotattVO.getLotatt14())) {
+            // todo 删除备货虚拟库位的库存,根据出库单号查询仓储外备货区,如果有的话清除
+            return invLotLocIdService.clear(baseLocationInfo.getId().toString(), Constant.WAREHOUSE_ID, "PDA");
+
+        }
+        // 转移库存到出库虚拟区
         return invLotLocIdService.releaseLocation(basLocationForm.getLocationNo(), Constant.WAREHOUSE_ID, "PDA");
     }
     //endregion

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

@@ -557,6 +557,7 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
     @Transactional
     @Override
     public AjaxResult unloadStock(UnlockForm unlockForm) {
+        int sum = 0;
         WmsBoxInfo wmsBoxInfo = wmsBoxInfoService.selectWmsBoxInfoByBoxNo(unlockForm.getPalletNo());
         if (wmsBoxInfo == null) {
             return AjaxResult.error("查询不到托盘:" + unlockForm.getPalletNo());
@@ -605,8 +606,9 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
             }
             //删除库存 todo 物料增加库存的时候如果改成根据相同库存和批次可以累加数量,这边就需要减库存,而不是直接删除
             invLotLocIdMapper.deleteInvLotLocIdBy(inv.getLotnum(), inv.getSku(), inv.getLocationId(), inv.getCustomerId());
+            sum = sum + inv.getQty().intValue();
         }
-        return AjaxResult.success("解绑成功");
+        return AjaxResult.success("解绑成功!" + unlockForm.getSku() + ",数量:" + sum);
     }
 
     @Override

+ 27 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/domain/vo/InvLotLocIdLotattVO.java

@@ -13,6 +13,9 @@ public class InvLotLocIdLotattVO {
     private String skuName;
     private String skuTypeName;
     private String locationNo;
+    private String zoneId;
+    private String stockStatus;
+    private String isEmpty;
     private String zoneName;
     private Double qty;
     private Double qtyallocated;
@@ -276,4 +279,28 @@ public class InvLotLocIdLotattVO {
     public void setZoneName(String zoneName) {
         this.zoneName = zoneName;
     }
+
+    public String getStockStatus() {
+        return stockStatus;
+    }
+
+    public void setStockStatus(String stockStatus) {
+        this.stockStatus = stockStatus;
+    }
+
+    public String getIsEmpty() {
+        return isEmpty;
+    }
+
+    public void setIsEmpty(String isEmpty) {
+        this.isEmpty = isEmpty;
+    }
+
+    public String getZoneId() {
+        return zoneId;
+    }
+
+    public void setZoneId(String zoneId) {
+        this.zoneId = zoneId;
+    }
 }

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

@@ -353,6 +353,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         WmsBoxInfo wmsBoxInfo = iWmsBoxInfoService.selectByLocationId(baseLocationInfo.getId().toString());
         if(wmsBoxInfo != null) {
             wmsBoxInfo.setIsFull("N");
+            wmsBoxInfo.setLocationId(Constant.LOC_SORTATION_CACHE);
             wmsBoxInfo.setIsEmpty("Y");
             wmsBoxInfo.setUpdateBy(updateBy);
             iWmsBoxInfoService.updateWmsBoxInfoIsNull(wmsBoxInfo);
@@ -808,25 +809,19 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         List<InvLotLocId> invLotLocIdList = selectInvLotLocIdList(invLotLocIdQuery);
 
         if (BaseLocationZone.ZONE_OUTBOUND == baseLocationInfo.getZoneId().intValue()) {
-
             for (InvLotLocId invLotLocId : invLotLocIdList) {
-
                 invLotLocIdMapper.updateLocation(Long.parseLong(invLotLocId.getLocationId()), Constant.LOC_SORTATION_CACHE);
             }
         } else {
-
             deleteInvLotLocIdById(baseLocationInfo.getId());
         }
-
         adjLocationIsEmpty(locationFrom, Constant.WAREHOUSE_ID, updateBy);
-
         //修改托盘库位绑定关系
         WmsBoxInfo wmsBoxInfo = iWmsBoxInfoService.selectByLocationId(String.valueOf(baseLocationInfo.getId()));
         if(wmsBoxInfo!=null) {
             iWmsBoxInfoService.updateLocationBind(baseLocationInfo.getId(), Constant.LOC_SORTATION_CACHE
                     , wmsBoxInfo.getIsFull() == null?"":wmsBoxInfo.getIsFull());
         }
-
         //释放库位状态
         return AjaxResult.success("操作成功");
     }

+ 34 - 1
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/WmsDocOrderHeaderServiceImpl.java

@@ -738,7 +738,40 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
 
     @Override
     public List<CheckOutVO> checkOutList(List<String> orderNoList) {
-        return wmsDocOrderHeaderMapper.selectCheckOutList(orderNoList);
+        List<CheckOutVO> endCheckOutVOList = new ArrayList<>();
+        Set<String> locationSet = new HashSet<>();
+        for (String orderNo : orderNoList) {
+            WmsDocOrderHeader wmsDocOrderHeader = wmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(orderNo);
+            // 是备货单并且是备货完成状态
+            boolean isBh = wmsDocOrderHeader.getOrderType().equals(Constant.ORDER_TYP.BH.getValue())
+                    &&
+                    (wmsDocOrderHeader.getOrderStatus().equals(Constant.ORDER_STS.STS23.getValue())
+                            || (wmsDocOrderHeader.getOrderStatus().equals(Constant.ORDER_STS.STS98.getValue())
+                            || (wmsDocOrderHeader.getOrderStatus().equals(Constant.ORDER_STS.STS99.getValue()))));
+            InvLocIdSearchFrom invLocIdSearchFrom = new InvLocIdSearchFrom();
+            if (isBh) {
+                invLocIdSearchFrom.setLotatt14(orderNo);
+            }else {
+                invLocIdSearchFrom.setLotatt15(orderNo);
+            }
+            List<InvLotLocIdLotattVO> invLotLocIdLotattVOS = invLotLocIdService.selectInvLocIdLotattList(invLocIdSearchFrom);
+            invLotLocIdLotattVOS.forEach(v->{
+                if (v.getStockStatus().equals(Constant.STOCK_STATUS.STOCK00.getValue())
+                        && v.getIsEmpty().equals(Constant.IS_YES.N.name())
+                        &&v.getZoneId().equals(Constant.ZONE_TYPE.ZONE_INV.getValue())) {
+                    if (!locationSet.contains(v.getLocationNo())) {
+                        CheckOutVO checkOutVO = new CheckOutVO();
+                        checkOutVO.setOrderNo(orderNo);
+                        checkOutVO.setLocationNo(v.getLocationNo());
+                        checkOutVO.setPalletNo(v.getLotatt07());
+                        endCheckOutVOList.add(checkOutVO);
+                        locationSet.add(v.getLocationNo());
+                    }
+                }
+            });
+        }
+        return endCheckOutVOList;
+//        return wmsDocOrderHeaderMapper.selectCheckOutList(orderNoList);
     }
 
     @Transactional(propagation = Propagation.REQUIRES_NEW)

+ 8 - 2
warewms-ams/src/main/resources/mapper/ams/InvLotLocIdMapper.xml

@@ -31,6 +31,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="lotnum"    column="lotnum"    />
         <result property="locationNo"    column="location_no"    />
         <result property="locationId"    column="location_id"    />
+        <result property="zoneId"    column="zone_id"    />
+        <result property="isEmpty"    column="isEmpty"    />
+        <result property="stockStatus"    column="stockStatus"    />
         <result property="zoneName"    column="zone_name"    />
         <result property="customerId"    column="customer_id"    />
         <result property="sku"    column="sku"    />
@@ -329,7 +332,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectInvLocIdLotattList" resultMap="InvLotLocIdLotattResult">
         select
         inv.location_id,sk.sku,sk.desc1 sku_name,skt.item_name sku_type_name,b.location_no,inv.qty,inv.qtyallocated
-        ,att.lotnum, att.customer_id,w.box_no,w.is_full,z.zone_name
+        ,att.lotnum, att.customer_id,w.box_no,w.is_full
+        b.zone_id,b.stock_status stockStatus,b.is_empty isEmpty,z.zone_name
         ,lotatt01, lotatt02, lotatt03, lotatt04,lot05_dict.dict_label lotatt05, supp.supplier_name lotatt06
         ,lotatt07, lotatt08, lotatt09, lotatt10, lotatt11, lotatt12, lotatt13, lotatt14, lotatt15, lotatt16, lotatt17
         ,lotatt18
@@ -374,7 +378,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectInvLocIdLotattByLocationId" resultMap="InvLotLocIdLotattResult">
         select
             inv.location_id,sk.sku,sk.desc1 sku_name,b.location_no,inv.qty,inv.qtyallocated
-            ,att.lotnum, att.customer_id, lotatt01, lotatt02, lotatt03, lotatt04,qua.dict_label lotatt05, lotatt06, lotatt07, lotatt08, lotatt09, lotatt10, lotatt11, lotatt12, lotatt13, lotatt14, lotatt15, lotatt16, lotatt17, lotatt18
+            ,att.lotnum, att.customer_id
+             , lotatt01, lotatt02, lotatt03, lotatt04,qua.dict_label lotatt05, lotatt06, lotatt07, lotatt08
+             , lotatt09, lotatt10, lotatt11, lotatt12, lotatt13, lotatt14, lotatt15, lotatt16, lotatt17, lotatt18
         from inv_lot_loc_id inv
         left join inv_lot_att att on inv.lotnum = att.lotnum
         left join base_location_info b on inv.location_id = b.id

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

@@ -34,6 +34,11 @@ public class Constant {
      */
     public static final Long LOC_SORTATION_CACHE = 99998l;
 
+    /**
+     * 备货虚拟区(仓储外)
+     */
+    public static final Long LOC_SORTATION02_CACHE = 99996l;
+
     /**
      * 中间缓存位
      * AGV作业搬运任务时候库存的虚拟库位