From ec3fa1a4209062eb95388d19474dd8b5a3ac9c0f Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期一, 16 三月 2026 11:16:18 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/task/WrkMastScheduler.java |  147 +++++++++++++++++++++++++++---------------------
 1 files changed, 82 insertions(+), 65 deletions(-)

diff --git a/src/main/java/com/zy/asrs/task/WrkMastScheduler.java b/src/main/java/com/zy/asrs/task/WrkMastScheduler.java
index 7ef9d9b..cabcd4d 100644
--- a/src/main/java/com/zy/asrs/task/WrkMastScheduler.java
+++ b/src/main/java/com/zy/asrs/task/WrkMastScheduler.java
@@ -1,7 +1,6 @@
 package com.zy.asrs.task;
 
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.zy.asrs.domain.enums.NotifyMsgType;
 import com.zy.asrs.entity.LocMast;
@@ -10,11 +9,9 @@
 import com.zy.asrs.service.WrkMastLogService;
 import com.zy.asrs.service.WrkMastService;
 import com.zy.asrs.utils.NotifyUtils;
-import com.zy.common.utils.HttpHandler;
-import com.zy.core.enums.SlaveType;
+import com.zy.core.enums.LocStsType;
+import com.zy.core.enums.WrkIoType;
 import com.zy.core.enums.WrkStsType;
-import com.zy.system.entity.Config;
-import com.zy.system.service.ConfigService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -60,6 +57,7 @@
             }
 
             locMast.setLocSts("F");
+            locMast.setBarcode(wrkMast.getBarcode());
             locMast.setModiTime(new Date());
             boolean result = locMastService.updateById(locMast);
             if (!result) {
@@ -77,7 +75,7 @@
             }
 
             //涓婃姤
-            notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), NotifyMsgType.TASK_COMPLETE, JSON.toJSONString(wrkMast));
+            notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.TASK_COMPLETE, JSON.toJSONString(wrkMast));
         }
     }
 
@@ -97,17 +95,15 @@
                 continue;
             }
 
-            if (!locMast.getLocSts().equals("R")) {
-                log.info("[workNo={}]搴撲綅鐘舵�佷笉澶勪簬R", wrkMast.getWrkNo());
-                continue;
-            }
-
-            locMast.setLocSts("O");
-            locMast.setModiTime(new Date());
-            boolean result = locMastService.updateById(locMast);
-            if (!result) {
-                log.info("[workNo={}]搴撲綅鐘舵�丱鏇存柊澶辫触", wrkMast.getWrkNo());
-                continue;
+            if (locMast.getLocSts().equals("R")) {
+                locMast.setLocSts("O");
+                locMast.setBarcode("");
+                locMast.setModiTime(new Date());
+                boolean result = locMastService.updateById(locMast);
+                if (!result) {
+                    log.info("[workNo={}]搴撲綅鐘舵�丱鏇存柊澶辫触", wrkMast.getWrkNo());
+                    continue;
+                }
             }
 
             // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
@@ -115,12 +111,12 @@
                 log.info("淇濆瓨宸ヤ綔鍘嗗彶妗workNo={}]澶辫触", wrkMast.getWrkNo());
             }
             // 鍒犻櫎宸ヤ綔涓绘。
-            if (!wrkMastService.deleteById(wrkMast)) {
+            if (!wrkMastService.deleteById(wrkMast.getWrkNo())) {
                 log.info("鍒犻櫎宸ヤ綔涓绘。[workNo={}]澶辫触", wrkMast.getWrkNo());
             }
 
             //涓婃姤
-            notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), NotifyMsgType.TASK_COMPLETE, JSON.toJSONString(wrkMast));
+            notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.TASK_COMPLETE, JSON.toJSONString(wrkMast));
         }
     }
 
@@ -146,7 +142,7 @@
                 continue;
             }
 
-            LocMast sourceLocMast= locMastService.queryByLoc(sourceLocNo);
+            LocMast sourceLocMast = locMastService.queryByLoc(sourceLocNo);
             if (sourceLocMast == null) {
                 log.info("[workNo={}]搴撲綅涓嶅瓨鍦�", wrkMast.getWrkNo());
                 continue;
@@ -158,6 +154,7 @@
             }
 
             locMast.setLocSts("F");
+            locMast.setBarcode(wrkMast.getBarcode());
             locMast.setModiTime(new Date());
             boolean result = locMastService.updateById(locMast);
             if (!result) {
@@ -166,6 +163,7 @@
             }
 
             sourceLocMast.setLocSts("O");
+            sourceLocMast.setBarcode("");
             sourceLocMast.setModiTime(new Date());
             boolean result2 = locMastService.updateById(sourceLocMast);
             if (!result2) {
@@ -183,50 +181,7 @@
             }
 
             //涓婃姤
-            notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), NotifyMsgType.TASK_COMPLETE, JSON.toJSONString(wrkMast));
-        }
-    }
-
-    @Scheduled(cron = "0/1 * * * * ? ")
-    @Transactional
-    public void executeMove(){
-        List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.COMPLETE_MOVE.sts));
-        if (wrkMasts.isEmpty()) {
-            return;
-        }
-
-        for (WrkMast wrkMast : wrkMasts) {
-            // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
-            if (!wrkMastLogService.save(wrkMast.getWrkNo())) {
-                log.info("淇濆瓨宸ヤ綔鍘嗗彶妗workNo={}]澶辫触", wrkMast.getWrkNo());
-            }
-            // 鍒犻櫎宸ヤ綔涓绘。
-            if (!wrkMastService.deleteById(wrkMast)) {
-                log.info("鍒犻櫎宸ヤ綔涓绘。[workNo={}]澶辫触", wrkMast.getWrkNo());
-            }
-        }
-    }
-
-    @Scheduled(cron = "0/1 * * * * ? ")
-    @Transactional
-    public void executeCharge(){
-        List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.COMPLETE_CHARGE.sts));
-        if (wrkMasts.isEmpty()) {
-            return;
-        }
-
-        for (WrkMast wrkMast : wrkMasts) {
-            // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
-            if (!wrkMastLogService.save(wrkMast.getWrkNo())) {
-                log.info("淇濆瓨宸ヤ綔鍘嗗彶妗workNo={}]澶辫触", wrkMast.getWrkNo());
-            }
-            // 鍒犻櫎宸ヤ綔涓绘。
-            if (!wrkMastService.deleteById(wrkMast)) {
-                log.info("鍒犻櫎宸ヤ綔涓绘。[workNo={}]澶辫触", wrkMast.getWrkNo());
-            }
-
-            //涓婃姤
-            notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), NotifyMsgType.TASK_CHARGE_COMPLETE, JSON.toJSONString(wrkMast));
+            notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.TASK_COMPLETE, JSON.toJSONString(wrkMast));
         }
     }
 
@@ -248,8 +203,70 @@
                 log.info("鍒犻櫎宸ヤ綔涓绘。[workNo={}]澶辫触", wrkMast.getWrkNo());
             }
 
+            if (wrkMast.getIoType() == WrkIoType.IN.id) {
+                LocMast locMast = locMastService.queryByLoc(wrkMast.getLocNo());
+                locMast.setLocSts(String.valueOf(LocStsType.O));
+                locMast.setModiTime(new Date());
+                locMastService.updateById(locMast);
+            } else if (wrkMast.getIoType() == WrkIoType.OUT.id) {
+                LocMast locMast = locMastService.queryByLoc(wrkMast.getSourceLocNo());
+                locMast.setLocSts(String.valueOf(LocStsType.F));
+                locMast.setModiTime(new Date());
+                locMastService.updateById(locMast);
+            } else if (wrkMast.getIoType() == WrkIoType.LOC_MOVE.id) {
+                LocMast sourceLocMast = locMastService.queryByLoc(wrkMast.getSourceLocNo());
+                LocMast locMast = locMastService.queryByLoc(wrkMast.getLocNo());
+                if (sourceLocMast.getLocSts().equals(String.valueOf(LocStsType.R))) {
+                    sourceLocMast.setLocSts(String.valueOf(LocStsType.F));
+                    sourceLocMast.setModiTime(new Date());
+                    locMastService.updateById(sourceLocMast);
+                }
+
+                if (locMast.getLocSts().equals(String.valueOf(LocStsType.S))) {
+                    locMast.setLocSts(String.valueOf(LocStsType.O));
+                    locMast.setModiTime(new Date());
+                    locMastService.updateById(locMast);
+                }
+            }
+
             //涓婃姤
-            notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), NotifyMsgType.TASK_CANCEL, JSON.toJSONString(wrkMast));
+            notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.TASK_CANCEL, JSON.toJSONString(wrkMast));
+        }
+    }
+
+    @Scheduled(cron = "0/1 * * * * ? ")
+    @Transactional
+    public void processOutStationRun(){
+        List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.STATION_RUN.sts));
+        if (wrkMasts.isEmpty()) {
+            return;
+        }
+
+        for (WrkMast wrkMast : wrkMasts) {
+            String locNo = wrkMast.getSourceLocNo();
+            LocMast locMast = locMastService.queryByLoc(locNo);
+            if (locMast == null) {
+                log.info("[workNo={}]搴撲綅涓嶅瓨鍦�", wrkMast.getWrkNo());
+                continue;
+            }
+
+            if (locMast.getLocSts().equals("O")) {
+                continue;
+            }
+
+            if (!locMast.getLocSts().equals("R")) {
+                log.info("[workNo={}]搴撲綅鐘舵�佷笉澶勪簬R", wrkMast.getWrkNo());
+                continue;
+            }
+
+            locMast.setLocSts("O");
+            locMast.setBarcode("");
+            locMast.setModiTime(new Date());
+            boolean result = locMastService.updateById(locMast);
+            if (!result) {
+                log.info("[workNo={}]搴撲綅鐘舵�丱鏇存柊澶辫触", wrkMast.getWrkNo());
+                continue;
+            }
         }
     }
 

--
Gitblit v1.9.1