Browse Source

PDA线边出库

k 1 year ago
parent
commit
8d6a6e2528

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

@@ -646,6 +646,14 @@ public class PdaController {
     public AjaxResult locationRelease(@RequestBody BasLocationForm basLocationForm) {
         return invLotLocIdService.locationRelease(basLocationForm);
     }
+
+    /**
+     * PDA线边库位出库
+     */
+    @PostMapping("/base/locationReleaseLine")
+    public AjaxResult locationReleaseLine(@RequestBody LineReleaseFrom lineReleaseFrom) {
+        return invLotLocIdService.locationReleaseLine(lineReleaseFrom);
+    }
     //endregion
 
 

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

@@ -13,6 +13,7 @@ import com.ruoyi.ams.inv.domain.form.InvLotLocIdAdjForm;
 import com.ruoyi.ams.inv.domain.form.InvLotLocIdForm;
 import com.ruoyi.ams.inv.domain.form.InvLotLocIdMoveForm;
 import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
+import com.ruoyi.ams.order.form.LineReleaseFrom;
 import com.ruoyi.base.domain.BaseLocationInfo;
 import com.ruoyi.base.domain.form.BasLocationForm;
 import com.ruoyi.base.domain.vo.BaseLocationLotattVO;
@@ -121,6 +122,17 @@ public interface IInvLotLocIdService {
      */
     AjaxResult clear(String locationId, Long warehouseId, String updateBy);
 
+    /**
+     * 库存清理
+     *
+     * @param locationId
+     * @param palletNo
+     * @param warehouseId
+     * @param updateBy
+     * @return
+     */
+    AjaxResult clear(Long locationId,String palletNo,Long warehouseId, String updateBy);
+
     /**
      * 清除0库存
      *
@@ -348,6 +360,14 @@ public interface IInvLotLocIdService {
      */
     AjaxResult locationRelease(BasLocationForm basLocationForm);
 
+    /**
+     * PDA线边库位置释放
+     *
+     * @param lineReleaseFrom
+     * @return
+     */
+    AjaxResult locationReleaseLine(LineReleaseFrom lineReleaseFrom);
+
     /**
      * 备货组盘的时候,一个托盘只能备货一个出库单
      *

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

@@ -17,6 +17,7 @@ import com.ruoyi.ams.inv.mapper.InvLotAttMapper;
 import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
 import com.ruoyi.ams.inv.service.IInvLotLocIdService;
 import com.ruoyi.ams.order.domain.WmsDocOrderHeader;
+import com.ruoyi.ams.order.form.LineReleaseFrom;
 import com.ruoyi.ams.order.service.IWmsDocOrderHeaderService;
 import com.ruoyi.ams.task.domain.WcsTask;
 import com.ruoyi.base.constant.Constant;
@@ -264,7 +265,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
                 , warehouseId, updateBy);
 
         // 更新托盘绑定库位关系
-        iWmsBoxInfoService.updateLocationBind(palletNo,baseLocationFrom.getId(),baseLocationTo.getId(),null);
+        iWmsBoxInfoService.updateLocationBind(palletNo, baseLocationFrom.getId(), baseLocationTo.getId(), null);
         return AjaxResult.success("执行成功");
     }
 
@@ -316,7 +317,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         baseLocationInfoService.updateLocationIdleAndNoEmpty(baseLocationTo.getId(), warehouseId, updateBy);
 
         // 更新托盘绑定库位关系
-        iWmsBoxInfoService.updateLocationBind(palletNo,baseLocationFrom.getId(),baseLocationTo.getId(),null);
+        iWmsBoxInfoService.updateLocationBind(palletNo, baseLocationFrom.getId(), baseLocationTo.getId(), null);
         return AjaxResult.success("操作成功!");
     }
 
@@ -379,7 +380,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         baseLocationInfoService.updateLocationIdleAndEmpty(id, warehouseId, updateBy);
         //修改托盘绑定
         WmsBoxInfo wmsBoxInfo = iWmsBoxInfoService.selectByLocationId(baseLocationInfo.getId().toString());
-        if(wmsBoxInfo != null) {
+        if (wmsBoxInfo != null) {
             wmsBoxInfo.setIsFull("N");
             wmsBoxInfo.setIsEmpty("Y");
             wmsBoxInfo.setUpdateBy(updateBy);
@@ -390,6 +391,33 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         return AjaxResult.success("操作成功!");
     }
 
+
+    @Transactional
+    @Override
+    public AjaxResult clear(Long locationId,String palletNo, Long warehouseId, String updateBy) {
+        InvLocIdSearchFrom invLocIdSearchFrom = new InvLocIdSearchFrom();
+        invLocIdSearchFrom.setLocationId(locationId.toString());
+        invLocIdSearchFrom.setLotatt07(palletNo);
+        List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invLotLocIdService.selectInvLocIdLotattList(invLocIdSearchFrom);
+        if (invLotLocIdLotattVOList.size() == 0) {
+            return AjaxResult.error("没有可以清除的库存!");
+        }
+        for (InvLotLocIdLotattVO locIdLotattVO : invLotLocIdLotattVOList) {
+            // 清除库存
+            invLotLocIdMapper.deleteInvLotLocIdByPrimaryKey(locIdLotattVO.getLocationId().toString(), locIdLotattVO.getCustomerId()
+                    , locIdLotattVO.getSku(), locIdLotattVO.getLotnum());
+        }
+        //修改托盘绑定
+        WmsBoxInfo wmsBoxInfo = iWmsBoxInfoService.selectWmsBoxInfoByBoxNo(palletNo);
+        if (wmsBoxInfo != null) {
+            wmsBoxInfo.setIsFull("N");
+            wmsBoxInfo.setIsEmpty("Y");
+            wmsBoxInfo.setUpdateBy(updateBy);
+            iWmsBoxInfoService.updateWmsBoxInfoIsNull(wmsBoxInfo);
+        }
+        return AjaxResult.success("操作成功!");
+    }
+
     @Override
     public AjaxResult clearZeroInventory(String locationId, String customerId, String sku, String lotnum) {
         InvLotLocId invLotLocId = invLotLocIdService.selectInvLotLocIdById(locationId, customerId, sku, lotnum);
@@ -564,22 +592,22 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
 //            query.setQtyEach(query.getQty());
 //            invLotLocIdService.updateInvLotLocId(query);
 //        } else {
-            InvLotLocId invLotLocId = new InvLotLocId();
-            invLotLocId.setLotnum(lotnum);
-            invLotLocId.setLocationId(locationFrom);
-            invLotLocId.setSku(sku);
-            invLotLocId.setCustomerId(customerId);
-            invLotLocId.setQty(new BigDecimal(qty));
-            invLotLocId.setQtyEach(new BigDecimal(qty));
-            invLotLocId.setQtyallocated(qtyallocated);
-            invLotLocId.setQtyallocatedEach(qtyallocated);
+        InvLotLocId invLotLocId = new InvLotLocId();
+        invLotLocId.setLotnum(lotnum);
+        invLotLocId.setLocationId(locationFrom);
+        invLotLocId.setSku(sku);
+        invLotLocId.setCustomerId(customerId);
+        invLotLocId.setQty(new BigDecimal(qty));
+        invLotLocId.setQtyEach(new BigDecimal(qty));
+        invLotLocId.setQtyallocated(qtyallocated);
+        invLotLocId.setQtyallocatedEach(qtyallocated);
 //            invLotLocId.setQtyEach(new BigDecimal(0));
 //            invLotLocId.setQtyallocated(new BigDecimal(0));
 //            invLotLocId.setQtyallocatedEach(new BigDecimal(0));
-            invLotLocId.setQtypa(BigDecimal.ZERO);
-            invLotLocId.setQtyrpin(BigDecimal.ZERO);
-            invLotLocId.setCreateTime(new Date());
-            invLotLocIdMapper.insertInvLotLocId(invLotLocId);
+        invLotLocId.setQtypa(BigDecimal.ZERO);
+        invLotLocId.setQtyrpin(BigDecimal.ZERO);
+        invLotLocId.setCreateTime(new Date());
+        invLotLocIdMapper.insertInvLotLocId(invLotLocId);
 //        }
 
         BaseLocationInfo baseLocationInfo = new BaseLocationInfo();
@@ -619,19 +647,19 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
 //            query.setQtyEach(query.getQty());
 //            invLotLocIdService.updateInvLotLocId(query);
 //        } else {
-            InvLotLocId invLotLocId = new InvLotLocId();
-            invLotLocId.setLotnum(lotnum);
-            invLotLocId.setLocationId(locationFrom);
-            invLotLocId.setSku(sku);
-            invLotLocId.setCustomerId(customerId);
-            invLotLocId.setQty(new BigDecimal(qty));
-            invLotLocId.setQtyEach(invLotLocId.getQty());
-            invLotLocId.setQtyallocated(invLotLocId.getQty());
-            invLotLocId.setQtyallocatedEach(invLotLocId.getQty());
-            invLotLocId.setQtypa(BigDecimal.ZERO);
-            invLotLocId.setQtyrpin(BigDecimal.ZERO);
-            invLotLocId.setCreateTime(new Date());
-            invLotLocIdMapper.insertInvLotLocId(invLotLocId);
+        InvLotLocId invLotLocId = new InvLotLocId();
+        invLotLocId.setLotnum(lotnum);
+        invLotLocId.setLocationId(locationFrom);
+        invLotLocId.setSku(sku);
+        invLotLocId.setCustomerId(customerId);
+        invLotLocId.setQty(new BigDecimal(qty));
+        invLotLocId.setQtyEach(invLotLocId.getQty());
+        invLotLocId.setQtyallocated(invLotLocId.getQty());
+        invLotLocId.setQtyallocatedEach(invLotLocId.getQty());
+        invLotLocId.setQtypa(BigDecimal.ZERO);
+        invLotLocId.setQtyrpin(BigDecimal.ZERO);
+        invLotLocId.setCreateTime(new Date());
+        invLotLocIdMapper.insertInvLotLocId(invLotLocId);
 //        }
 
         BaseLocationInfo baseLocationInfo = new BaseLocationInfo();
@@ -845,9 +873,9 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         adjLocationIsEmpty(locationFrom, Constant.WAREHOUSE_ID, updateBy);
         //修改托盘库位绑定关系
         WmsBoxInfo wmsBoxInfo = iWmsBoxInfoService.selectByLocationId(String.valueOf(baseLocationInfo.getId()));
-        if(wmsBoxInfo!=null) {
+        if (wmsBoxInfo != null) {
             iWmsBoxInfoService.updateLocationBind(baseLocationInfo.getId(), Constant.LOC_SORTATION_CACHE
-                    , wmsBoxInfo.getIsFull() == null?"":wmsBoxInfo.getIsFull());
+                    , wmsBoxInfo.getIsFull() == null ? "" : wmsBoxInfo.getIsFull());
         }
         //释放库位状态
         return AjaxResult.success("操作成功");
@@ -891,24 +919,54 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         return invLotLocIdService.releaseLocation(basLocationForm.getLocationNo(), Constant.WAREHOUSE_ID, "PDA");
     }
 
+    @Transactional
+    @Override
+    public AjaxResult locationReleaseLine(LineReleaseFrom lineReleaseFrom) {
+        String palletNo = lineReleaseFrom.getPalletNo();
+        String orderNo = "";
+        Long locationId = 0l;
+        InvLocIdSearchFrom invLocIdSearchFrom = new InvLocIdSearchFrom();
+        invLocIdSearchFrom.setLotatt07(palletNo);
+        List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invLotLocIdService.selectInvLocIdLotattList(invLocIdSearchFrom);
+        if (invLotLocIdLotattVOList.size() == 0) {
+            return AjaxResult.error("托盘没有可以出库的库存!" + palletNo);
+        }
+        for (InvLotLocIdLotattVO locIdLotattVO : invLotLocIdLotattVOList) {
+            if (StringUtils.isEmpty(locIdLotattVO.getLotatt14())) {
+                return AjaxResult.error("线边仓不是备货库存不可出库!");
+            }
+            orderNo = locIdLotattVO.getLotatt14();
+            locationId = locIdLotattVO.getLocationId();
+        }
+        WmsDocOrderHeader wmsDocOrderHeader = wmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(orderNo);
+        if (!wmsDocOrderHeader.getOrderType().equals(Constant.ORDER_TYP.BH.getValue())) {
+            return AjaxResult.success("线边仓库单据类型位备货单才可出库!");
+        }
+        // 修改出库单状态
+        wmsDocOrderHeaderService.modifyAssignmentStockTaskStatusComplete(orderNo, locationId, palletNo, true);
+        // 清除库存
+        invLotLocIdService.clear(locationId.toString(), Constant.WAREHOUSE_ID, "PDA");
+        return AjaxResult.success("托盘出库成功!" + palletNo);
+    }
+
     @Override
     public AjaxResult checkPalletIsOnlyOrderNo(String palletNoTo, String orderNo) {
         InvLocIdSearchFrom invLocIdSearchFrom = new InvLocIdSearchFrom();
         invLocIdSearchFrom.setLotatt07(palletNoTo);
         List<InvLotLocIdLotattVO> invLotLocIdLotattVOS = invLotLocIdService.selectInvLocIdLotattList(invLocIdSearchFrom);
-        if(invLotLocIdLotattVOS.size() == 0){
+        if (invLotLocIdLotattVOS.size() == 0) {
             return AjaxResult.success();
         }
         for (InvLotLocIdLotattVO invLotLocIdLotattVO : invLotLocIdLotattVOS) {
-                String lotatt14 = StringUtils.isEmpty(invLotLocIdLotattVO.getLotatt14())?"":invLotLocIdLotattVO.getLotatt14();
-                if (!lotatt14.equals(orderNo)) {
-                    if(StringUtils.isNotEmpty(orderNo)) {
-                        return AjaxResult.error("托盘已经存在不是此出库单备货的库存!");
-                    }else {
-                        return AjaxResult.error("托盘已经存在备货的库存!");
-                    }
+            String lotatt14 = StringUtils.isEmpty(invLotLocIdLotattVO.getLotatt14()) ? "" : invLotLocIdLotattVO.getLotatt14();
+            if (!lotatt14.equals(orderNo)) {
+                if (StringUtils.isNotEmpty(orderNo)) {
+                    return AjaxResult.error("托盘已经存在不是此出库单备货的库存!");
+                } else {
+                    return AjaxResult.error("托盘已经存在备货的库存!");
                 }
             }
+        }
         return AjaxResult.success();
     }
 
@@ -917,7 +975,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         InvLocIdSearchFrom invLocIdSearchFrom = new InvLocIdSearchFrom();
         invLocIdSearchFrom.setLotatt07(palletNo);
         List<InvLotLocIdLotattVO> invLotLocIdLotattVOS = invLotLocIdService.selectInvLocIdLotattList(invLocIdSearchFrom);
-        if(invLotLocIdLotattVOS.size() == 0){
+        if (invLotLocIdLotattVOS.size() == 0) {
             return AjaxResult.success();
         }
         for (InvLotLocIdLotattVO invLotLocIdLotattVO : invLotLocIdLotattVOS) {
@@ -931,7 +989,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         List<InvLotLocId> invLotLocIds = invLotLocIdService.selectInvLotLocIdList(Long.valueOf(locationId));
         for (InvLotLocId invLotLocId : invLotLocIds) {
             InvLotAtt invLotAtt = invLotAttMapper.selectInvLotAttByLotnum(invLotLocId.getLotnum());
-            if (invLotAtt != null ) {
+            if (invLotAtt != null) {
                 if (StringUtils.isNotEmpty(invLotAtt.getLotatt15()) && invLotAtt.getLotatt15().equals(orderNo)) {
                     break;
                 }

+ 17 - 0
warewms-ams/src/main/java/com/ruoyi/ams/order/form/LineReleaseFrom.java

@@ -0,0 +1,17 @@
+package com.ruoyi.ams.order.form;
+
+import lombok.Data;
+
+/**
+ * @author JWK
+ * @version 1.0
+ * @date 2023/4/24 13:36
+ */
+@Data
+public class LineReleaseFrom {
+
+    /**
+     * 托盘号
+     */
+    private String palletNo;
+}