ソースを参照

出库整体流程代码完善

LZH 1 年間 前
コミット
a7707ac874

+ 212 - 0
warewms-ams/src/main/java/com/ruoyi/ams/xuankuang/service/ConvertUtils.java

@@ -0,0 +1,212 @@
+package com.ruoyi.ams.xuankuang.service;
+
+/**
+ * @author Jwk
+ * @version 1.0
+ * @date 2023/4/25 15:12
+ */
+
+/**
+ * 剂量转换工具
+ */
+public class ConvertUtils {
+    /**
+     * 碳酸钠
+     *
+     * @param i
+     * @return 物料的kg
+     */
+    public static int convertToInt(int i) {
+        int i1 = i * 10;
+        return i1;
+    }
+
+    /**
+     * 碳酸钠
+     *
+     * @param i
+     * @return 物料所需的袋数
+     */
+    public static int convertToQty(int i) {
+        int qty = i / 50;
+        return qty;
+    }
+
+    /**
+     * 碳酸钠
+     *
+     * @param i
+     * @return 物料剩余的kg
+     */
+    public static int convertToRemainder(int i) {
+        int remainder = i % 50;
+        return remainder;
+    }
+
+    /**
+     * 丁黄药
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToInt1(int i) {
+        int i1 = i * 10;
+        return i1;
+    }
+
+    /**
+     * 丁黄药
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToQty1(int i) {
+        int qty = i / 40;
+        return qty;
+    }
+
+    /**
+     * 丁黄药
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToRemainder1(int i) {
+        int remainder = i % 40;
+        return remainder;
+    }
+
+    /**
+     * 丁铵黑药
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToInt2(int i) {
+        int i1 = i * 10;
+        return i1;
+    }
+
+    /**
+     * 丁铵黑药
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToQty2(int i) {
+        int qty = i / 200;
+        return qty;
+    }
+
+    /**
+     * 丁铵黑药
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToRemainder2(int i) {
+        int remainder = i % 200;
+        return remainder;
+    }
+
+    /**
+     * 六偏磷酸钠
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToInt3(int i) {
+        int i1 = i * 10;
+        return i1;
+    }
+
+    /**
+     * 六偏磷酸钠
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToQty3(int i) {
+        int qty = i / 70;
+        return qty;
+    }
+
+    /**
+     * 六偏磷酸钠
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToRemainder3(int i) {
+        int remainder = i % 70;
+        return remainder;
+    }
+
+    /**
+     * 硫酸铵
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToInt4(int i) {
+        int i1 = i * 10;
+        return i1;
+    }
+
+    /**
+     * 硫酸铵
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToQty4(int i) {
+        int qty = i / 50;
+        return qty;
+    }
+
+    /**
+     * 硫酸铵
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToRemainder4(int i) {
+        int remainder = i % 50;
+        return remainder;
+    }
+
+
+    /**
+     * 乙黄药
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToInt5(int i) {
+        int i1 = i * 10;
+        return i1;
+    }
+
+    /**
+     * 乙黄药
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToQty5(int i) {
+        int qty = i / 40;
+        return qty;
+    }
+
+    /**
+     * 乙黄药
+     *
+     * @param i
+     * @return
+     */
+    public static int convertToRemainder5(int i) {
+        int remainder = i % 40;
+        return remainder;
+    }
+
+}

+ 155 - 21
warewms-ams/src/main/java/com/ruoyi/ams/xuankuang/service/WcsToWmsApiService.java

@@ -140,7 +140,6 @@ public class WcsToWmsApiService {
             locationCoordinateVo.setCol(Integer.valueOf(baseLocationLotattVO.getRowNo()));
             locationCoordinateVo.setRow(Integer.valueOf(baseLocationLotattVO.getRowIndex()));
             return AjaxResult.success("仓位获取成功!", locationCoordinateVo);
-
         }
 
         // 判重
@@ -364,6 +363,7 @@ public class WcsToWmsApiService {
 
     /**
      * 拆包机开启接口
+     *
      * @param lineOpenNotificationForm
      * @return
      */
@@ -439,10 +439,17 @@ public class WcsToWmsApiService {
      * @return
      */
     public AjaxResult turnOffTheUnpacker() {
-        //写仓库注入碳酸钠完成
-        stirringTankClient.writeTank05();
-        //写关闭拆包机信号
-        unpackingMachineSubClient.writeV141_2();
+        new Thread(() -> {
+            try {
+                Thread.sleep(300000);
+                //写关闭拆包机信号
+                unpackingMachineSubClient.writeV141_2();
+                //写仓库注入碳酸钠完成
+                stirringTankClient.writeTank05();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }).start();
         return AjaxResult.success();
     }
 
@@ -452,10 +459,17 @@ public class WcsToWmsApiService {
      * @return
      */
     public AjaxResult turnOffTheUnpacker1() {
-        //写仓库注入丁黄药完成
-        stirringTankClient.writeTank05_1();
-        //写关闭拆包机信号
-        unpackingMachineSubClient.writeV141_3();
+        new Thread(() -> {
+            try {
+                Thread.sleep(300000);
+                //写关闭拆包机信号
+                unpackingMachineSubClient.writeV141_3();
+                //写仓库注入丁黄药完成
+                stirringTankClient.writeTank05_1();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }).start();
         return AjaxResult.success();
     }
 
@@ -465,10 +479,17 @@ public class WcsToWmsApiService {
      * @return
      */
     public AjaxResult turnOffTheUnpacker2() {
-        //写仓库注入六偏磷酸钠完成
-        stirringTankClient.writeTank05_3();
-        //写关闭拆包机信号
-        unpackingMachineSubClient.writeV141_4();
+        new Thread(() -> {
+            try {
+                Thread.sleep(300000);
+                //写关闭拆包机信号
+                unpackingMachineSubClient.writeV141_4();
+                //写仓库注入六偏磷酸钠完成
+                stirringTankClient.writeTank05_3();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }).start();
         return AjaxResult.success();
     }
 
@@ -478,10 +499,17 @@ public class WcsToWmsApiService {
      * @return
      */
     public AjaxResult turnOffTheUnpacker3() {
-        //写仓库注入硫酸铵完成
-        stirringTankClient.writeTank05_4();
-        //写关闭拆包机信号
-        unpackingMachineSubClient.writeV141_5();
+        new Thread(() -> {
+            try {
+                Thread.sleep(300000);
+                //写关闭拆包机信号
+                unpackingMachineSubClient.writeV141_5();
+                //写仓库注入硫酸铵完成
+                stirringTankClient.writeTank05_4();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }).start();
         return AjaxResult.success();
     }
 
@@ -491,12 +519,20 @@ public class WcsToWmsApiService {
      * @return
      */
     public AjaxResult turnOffTheUnpacker4() {
-        //写仓库注入乙黄药完成
-        stirringTankClient.writeTank05_5();
-        //写关闭拆包机信号
-        unpackingMachineSubClient.writeV141_6();
+        new Thread(() -> {
+            try {
+                Thread.sleep(300000);
+                //写关闭拆包机信号
+                unpackingMachineSubClient.writeV141_6();
+                //写仓库注入乙黄药完成
+                stirringTankClient.writeTank05_5();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }).start();
         return AjaxResult.success();
     }
+
     /**
      * 异常关闭1号拆包机
      *
@@ -562,4 +598,102 @@ public class WcsToWmsApiService {
         unpackingMachineSubClient.writeV141_6();
         return AjaxResult.success();
     }
+
+    /**
+     * 更新数据接口
+     *
+     * @param updateForm
+     * @return
+     */
+    public AjaxResult updateAsnData(UpdateForm updateForm) {
+        String asnNo = updateForm.getDocNo();
+        String asnLineNo = updateForm.getLineNo();
+        Integer num = updateForm.getNum();
+        WmsDocAsnDetails wmsDocAsnDetails = wmsDocAsnDetailsMapper.selectWmsDocAsnDetailsByAsnLineNo(asnNo, asnLineNo);
+        wmsDocAsnDetails.setExpectedQty(new BigDecimal(num));
+        wmsDocAsnDetails.setExpectedQtyEach(new BigDecimal(num));
+        wmsDocAsnDetailsMapper.updateWmsDocAsnDetails(wmsDocAsnDetails);
+        return AjaxResult.success();
+    }
+
+    /**
+     * 桶装入库
+     *
+     * @param stackingCompletion
+     * @return
+     */
+    @Transactional
+    public synchronized AjaxResult theBucketIsLoadedIntoTheLibrary(String sku, String asnNo, String palletNo, BigDecimal num) {
+
+
+        // 数量
+        Double qty = num.doubleValue();
+
+        // 任务号
+        String wcsNo = "";
+
+        // 判重
+        WcsTask wcsTaskQuery = new WcsTask();
+        wcsTaskQuery.setExt1(asnNo);
+        wcsTaskQuery.setExt2(palletNo);
+        wcsTaskQuery.setExt3(wcsNo);
+        WcsTask wcsTask = iWcsTaskService.selectWcsTaskByModel(wcsTaskQuery);
+        if (wcsTask != null) {
+            String locationTo = wcsTask.getLocationTo();
+            BaseLocationInfo baseLocationInfo = iBaseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationTo, Constant.WAREHOUSE_ID);
+            LocationCoordinateVo locationCoordinateVo = new LocationCoordinateVo();
+            locationCoordinateVo.setTaskNo(wcsTask.getTaskNo());
+            locationCoordinateVo.setLocationId(baseLocationInfo.getLocationNo());
+            locationCoordinateVo.setFloor(Integer.valueOf(baseLocationInfo.getShiftNo()));
+            locationCoordinateVo.setCol(Integer.valueOf(baseLocationInfo.getRowNo()));
+            locationCoordinateVo.setRow(Integer.valueOf(baseLocationInfo.getRowIndex()));
+            return AjaxResult.success("仓位获取成功!", locationCoordinateVo);
+        }
+
+        // 推荐目标库位
+        BaseLocationLotattVO baseLocationLotattVO = baseLocationInfoSubService.recommendAReceiptLocation(sku);
+        if (baseLocationLotattVO == null) {
+            AjaxResult.error("没有可以推荐的目标库位!");
+        }
+
+        // 生成任务
+        String taskNo = "";
+        AjaxResult ajaxResult = wcsTaskSubService.addWcsTask(Constant.LOC_STAGE_CACHE.toString()
+                , baseLocationLotattVO.getId().toString()
+                , asnNo
+                , palletNo
+                , wcsNo);
+        if (!ajaxResult.isSuccess()) {
+            return ajaxResult;
+        }
+        taskNo = ajaxResult.get("data").toString();
+        // 入库缓存位生成库存
+        InvLotLocIdSubService.initInv(Constant.LOC_STAGE_CACHE.toString(), sku, palletNo, asnNo, taskNo, qty);
+        // 反馈
+        LocationCoordinateVo locationCoordinateVo = new LocationCoordinateVo();
+        locationCoordinateVo.setTaskNo(taskNo);
+        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);
+    }
+
+    /**
+     * 安全交握
+     * @param callbackTaskFrom
+     * @return
+     */
+    public AjaxResult secureHandover(CallbackTaskFrom callbackTaskFrom) {
+        return AjaxResult.success();
+    }
+
+    /**
+     * 出库任务下发
+     * @param callbackTaskFrom
+     * @return
+     */
+    public AjaxResult outboundRequest(OutboundForm outboundForm) {
+        return AjaxResult.success();
+    }
 }

+ 20 - 3
warewms-ams/src/main/java/com/ruoyi/ams/xuankuang/service/WmsDocOrderSubService.java

@@ -134,11 +134,11 @@ public class WmsDocOrderSubService {
             OutTaskForm.Dest dest = new OutTaskForm.Dest();
             dest.setDest(Integer.parseInt(wmsDocOrderHeader.getSoReference3()));
             if (orderNum <= qty.intValue()) {
-                allocateQuantities = list.get(0).getQtyOrdered().intValue();
+                allocateQuantities = orderNum;
                 dest.setNum(allocateQuantities);
             } else if (orderNum > qty.intValue()) {
                 allocateQuantities = qty.intValue();
-                orderNum = list.get(0).getQtyOrdered().intValue()-qty.intValue();
+                orderNum = orderNum-qty.intValue();
                 dest.setNum(allocateQuantities);
             }
             dests.add(dest);
@@ -263,6 +263,7 @@ public class WmsDocOrderSubService {
      * @return
      */
     public AjaxResult addCrossingOutboundOrder(String asnNo) {
+        List<WmsDocAsnDetails> wmsDocAsnDetails = iWmsDocAsnHeaderService.queryWmsDocAsnDetails(asnNo);
         // 生成单头
         WmsDocOrderHeader wmsDocOrderHeader = new WmsDocOrderHeader();
         String orderNo = idSequenceUtils.generateId("ORDERNO");
@@ -270,9 +271,24 @@ public class WmsDocOrderSubService {
         wmsDocOrderHeader.setEdiSendFlag("N");
         wmsDocOrderHeader.setSoReference2(asnNo);
         wmsDocOrderHeader.setOrderStatus(Constant.ORDER_STS.STS00.getValue());
+        wmsDocOrderHeader.setOrderType(Constant.ORDER_TYP.YK.getValue());
+        if (wmsDocAsnDetails.get(0).getSku().equals("Na2CO3")){
+            wmsDocOrderHeader.setSoReference3("1");
+        }
+        if (wmsDocAsnDetails.get(0).getSku().equals("C5H10OS2")){
+            wmsDocOrderHeader.setSoReference3("2");
+        }
+        if (wmsDocAsnDetails.get(0).getSku().equals("(NaPO3)6")){
+            wmsDocOrderHeader.setSoReference3("3");
+        }
+        if (wmsDocAsnDetails.get(0).getSku().equals("(NH4)2SO4")){
+            wmsDocOrderHeader.setSoReference3("4");
+        }
+        if (wmsDocAsnDetails.get(0).getSku().equals("CH3CH2OCS2Na")){
+            wmsDocOrderHeader.setSoReference3("5");
+        }
         wmsDocOrderHeader.setCreateTime(new Date());
         wmsDocOrderHeaderMapper.insertWmsDocOrderHeader(wmsDocOrderHeader);
-        List<WmsDocAsnDetails> wmsDocAsnDetails = iWmsDocAsnHeaderService.queryWmsDocAsnDetails(asnNo);
         for (WmsDocAsnDetails wmsDocAsnDetails1 : wmsDocAsnDetails) {
             // 生成明细
             WmsDocOrderDetails wmsDocOrderDetails = new WmsDocOrderDetails();
@@ -282,6 +298,7 @@ public class WmsDocOrderSubService {
             wmsDocOrderDetails.setLineStatus(Constant.ORDER_STS.STS00.getValue());
             wmsDocOrderDetails.setQtyOrderedEach(wmsDocAsnDetails1.getExpectedQty());
             wmsDocOrderDetails.setCreateTime(new Date());
+            wmsDocOrderDetails.setQtyOrdered(wmsDocAsnDetails1.getExpectedQty());
             iWmsDocOrderHeaderService.insertWmsDocOrderDetails(wmsDocOrderDetails);
         }
         return AjaxResult.success();

+ 12 - 1
warewms-ams/src/main/resources/mapper/docOrder/WmsDocOrderHeaderMapper.xml

@@ -168,7 +168,7 @@
             <if test="carrierName != null  and carrierName != ''"> and carrier_name like concat('%', #{carrierName}, '%')</if>
             <if test="orderNo != null  and orderNo != ''"> and order_no like concat('%', #{orderNo}, '%')</if>
             <if test="soReference3 != null  and soReference3 != ''"> and so_reference3 = #{soReference3}</if>
-             and order_status in (00,10,30,40)
+             and order_status in (00,10)
         </where>
         order by create_time desc
     </select>
@@ -393,4 +393,15 @@
         and de.line_status = '20'
         group by de.order_no,w.box_no,b.location_no
     </select>
+
+    <select id="selectWmsDocOrderHeaderList2" parameterType="WmsDocOrderHeader" resultMap="WmsDocOrderHeaderResult">
+        <include refid="selectWmsDocOrderHeaderVo"/>
+        <where>
+            <if test="consigneeName != null  and consigneeName != ''"> and consignee_name like concat('%', #{consigneeName}, '%')</if>
+            <if test="carrierName != null  and carrierName != ''"> and carrier_name like concat('%', #{carrierName}, '%')</if>
+            <if test="orderNo != null  and orderNo != ''"> and order_no like concat('%', #{orderNo}, '%')</if>
+            <if test="soReference2 != null  and soReference2 != ''"> and so_reference2 = #{soReference2}</if>
+        </where>
+        order by create_time desc
+    </select>
 </mapper>