Browse Source

组盘上报 --ing

k 2 years ago
parent
commit
d03f22b080

+ 19 - 0
warewms-ams/src/main/java/com/ruoyi/ams/xuankuang/domain/vo/LocationCoordinateVo.java

@@ -0,0 +1,19 @@
+package com.ruoyi.ams.xuankuang.domain.vo;
+
+import lombok.Data;
+
+/**
+ * @author JWK
+ * @version 1.0
+ * @date 2023/4/3 18:29
+ */
+@Data
+public class LocationCoordinateVo {
+
+
+    private String taskNo;
+    private String locationId;
+    private Integer row;
+    private Integer col;
+    private Integer floor;
+}

+ 38 - 0
warewms-ams/src/main/java/com/ruoyi/ams/xuankuang/service/BaseLocationInfoSubService.java

@@ -2,11 +2,13 @@ package com.ruoyi.ams.xuankuang.service;
 
 import com.alibaba.fastjson.JSON;
 import com.ruoyi.ams.config.domain.dto.LotattDTO;
+import com.ruoyi.base.constant.Constant;
 import com.ruoyi.base.domain.vo.BaseLocationLotattVO;
 import com.ruoyi.base.service.IBaseLocationInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -23,6 +25,42 @@ public class BaseLocationInfoSubService {
     private IBaseLocationInfoService baseLocationInfoService;
 
 
+    /**
+     * 入库库区
+     */
+    public static final String[] IN_ZONES = {
+            Constant.LOCATION_ZONE.INV_1.getValue()
+            , Constant.LOCATION_ZONE.INV_2.getValue()
+            , Constant.LOCATION_ZONE.INV_3.getValue()
+    };
+
+    /**
+     * 出库库区
+     */
+    public static final String[] OUT_ZONES = {
+            Constant.LOCATION_ZONE.INV_1.getValue()
+            , Constant.LOCATION_ZONE.INV_2.getValue()
+            , Constant.LOCATION_ZONE.INV_3.getValue()
+    };
+
+
+    /**
+     * 推荐一个入库库位
+     *
+     * @param bindSku
+     * @return
+     */
+    public BaseLocationLotattVO recommendAReceiptLocation(String bindSku) {
+        List<BaseLocationLotattVO> baseLocationLotattVOS = this.selectAllocatingInventoryAccordingConditionsOrderBy(
+                Arrays.asList(IN_ZONES)
+                , bindSku
+                , null);
+        if (baseLocationLotattVOS.size() > 0) {
+            return baseLocationLotattVOS.get(0);
+        }
+        return null;
+    }
+
     /**
      * 根据条件查询可分配库位
      *

+ 36 - 1
warewms-ams/src/main/java/com/ruoyi/ams/xuankuang/service/WcsToWmsApiService.java

@@ -1,8 +1,12 @@
 package com.ruoyi.ams.xuankuang.service;
 
 import com.ruoyi.ams.xuankuang.domain.form.StackingCompletionForm;
+import com.ruoyi.ams.xuankuang.domain.vo.LocationCoordinateVo;
+import com.ruoyi.base.domain.vo.BaseLocationLotattVO;
+import com.ruoyi.base.service.IBaseSkuService;
 import com.ruoyi.common.core.domain.AjaxResult;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -14,6 +18,10 @@ import org.springframework.stereotype.Service;
 @Service
 public class WcsToWmsApiService {
 
+    @Autowired
+    private IBaseSkuService iBaseSkuService;
+    @Autowired
+    private BaseLocationInfoSubService baseLocationInfoSubService;
 
     /**
      * 组盘上报
@@ -22,9 +30,36 @@ public class WcsToWmsApiService {
      * @return
      */
     public AjaxResult stackingCompletion(StackingCompletionForm stackingCompletion) {
+        // 上报类型
+        int reportType = stackingCompletion.getReportType();
+        // 托盘号
+        String palletNo = stackingCompletion.getPalletNo();
+        // Wcs物料类型
+        String materialType = stackingCompletion.getMaterialType();
+        // wms物料编码
+        String sku = iBaseSkuService.selectBaseSkuByMaterialType(materialType).getSku();
+        // 数量
+        int qty = stackingCompletion.getQty();
+        // 入库单号
+        String asnNo = stackingCompletion.getRelatedWmsNo();
 
+        // 推荐目标库位
+        BaseLocationLotattVO baseLocationLotattVO = baseLocationInfoSubService.recommendAReceiptLocation(sku);
+        if (baseLocationLotattVO == null) {
+            AjaxResult.error("没有可以推荐的目标库位!");
+        }
 
-        return AjaxResult.success();
+        // todo 生成任务
+        // todo 入库缓存位生成库存
+        // todo 修改入库单收货数量
+
+        // 反馈
+        LocationCoordinateVo locationCoordinateVo = new LocationCoordinateVo();
+        locationCoordinateVo.setLocationId(baseLocationLotattVO.getLocationNo());
+        locationCoordinateVo.setFloor(Integer.valueOf(baseLocationLotattVO.getShiftNo()));
+        locationCoordinateVo.setCol(Integer.valueOf(baseLocationLotattVO.getRowNo()));
+        locationCoordinateVo.setRow(Integer.valueOf(baseLocationLotattVO.getRowIndex()));
+        return AjaxResult.success("仓位获取成功!", locationCoordinateVo);
     }