From 21842952d812db640235becb88de527c17335f58 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 31 三月 2026 18:04:30 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/plugin/FakeProcess.java |   34 ++++++++++++++++++++--------------
 1 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/zy/core/plugin/FakeProcess.java b/src/main/java/com/zy/core/plugin/FakeProcess.java
index c93863d..9fcc809 100644
--- a/src/main/java/com/zy/core/plugin/FakeProcess.java
+++ b/src/main/java/com/zy/core/plugin/FakeProcess.java
@@ -16,6 +16,7 @@
 import com.zy.core.News;
 import com.zy.core.cache.MessageQueue;
 import com.zy.core.cache.SlaveConnection;
+import com.zy.core.dispatch.StationCommandDispatcher;
 import com.zy.core.enums.*;
 import com.zy.core.model.StationObjModel;
 import com.zy.core.model.Task;
@@ -88,9 +89,13 @@
     @Autowired
     private WmsOperateUtils wmsOperateUtils;
     @Autowired
+    private WrkAnalysisService wrkAnalysisService;
+    @Autowired
     private DualCrnOperateProcessUtils dualCrnOperateProcessUtils;
     @Autowired
     private StoreInTaskGenerationService storeInTaskGenerationService;
+    @Autowired
+    private StationCommandDispatcher stationCommandDispatcher;
 
     /**
      * 甯﹁秴鏃朵繚鎶ゆ墽琛屾柟娉�
@@ -128,10 +133,6 @@
         stationOperateProcessUtils.stationInExecute();
         // 鎵ц杈撻�佺珯鐐瑰嚭搴撲换鍔�
         stationOperateProcessUtils.crnStationOutExecute();
-        // 妫�娴嬭緭閫佺珯鐐瑰嚭搴撲换鍔℃墽琛屽畬鎴�
-        stationOperateProcessUtils.stationOutExecuteFinish();
-        // 妫�娴嬩换鍔¤浆瀹屾垚
-        stationOperateProcessUtils.checkTaskToComplete();
         // 妫�娴嬪嚭搴撴帓搴�
         stationOperateProcessUtils.checkStationOutOrder();
         // 鐩戞帶缁曞湀绔欑偣
@@ -256,7 +257,7 @@
                     StationCommand command = stationThread.getCommand(StationCommandType.MOVE,
                             commonService.getWorkNo(WrkIoType.FAKE_TASK_NO.id), stationId,
                             entity.getBarcodeStation().getStationId(), 0);
-                    MessageQueue.offer(SlaveType.Devp, basDevp.getDevpNo(), new Task(2, command));
+                    stationCommandDispatcher.dispatch(basDevp.getDevpNo(), command, "fake-process", "fake-enable-in");
                     redisUtil.set(RedisKeyType.GENERATE_FAKE_IN_STATION_DATA_LIMIT.key + stationId, "lock", 5);
                 }
             }
@@ -351,7 +352,7 @@
                         News.taskInfo(wrkMast.getWrkNo(), "鑾峰彇杈撻�佺嚎鍛戒护澶辫触");
                         continue;
                     }
-                    MessageQueue.offer(SlaveType.Devp, basDevp.getDevpNo(), new Task(2, command));
+                    stationCommandDispatcher.dispatch(basDevp.getDevpNo(), command, "fake-process", "fake-in-task");
                     redisUtil.set(RedisKeyType.GENERATE_FAKE_IN_TASK_LIMIT.key + stationId, "lock", 5);
                 }
             }
@@ -461,7 +462,7 @@
             News.taskInfo(wrkMast.getWrkNo(), "鑾峰彇杈撻�佺嚎鍛戒护澶辫触");
             return;
         }
-        MessageQueue.offer(SlaveType.Devp, context.getBasDevp().getDevpNo(), new Task(2, command));
+        stationCommandDispatcher.dispatch(context.getBasDevp().getDevpNo(), command, "fake-process", "write-info");
     }
 
     // 璁$畻鎵�鏈夌珯鐐瑰仠鐣欐椂闂�
@@ -523,7 +524,7 @@
                         continue;
                     }
 
-                    MessageQueue.offer(SlaveType.Devp, stationObjModel.getDeviceNo(), new Task(2, command));
+                    stationCommandDispatcher.dispatch(stationObjModel.getDeviceNo(), command, "fake-process", "out-station-reset");
                     redisUtil.set(
                             RedisKeyType.CHECK_OUT_STATION_STAY_TIME_OUT_LIMIT.key + stationObjModel.getStationId(),
                             "lock", 10);
@@ -586,7 +587,7 @@
 
                 WrkMast wrkMast = wrkMastService.selectByWorkNo(stationProtocol.getTaskNo());
                 if (wrkMast == null) {
-                    MessageQueue.offer(SlaveType.Devp, stationObjModel.getDeviceNo(), new Task(2, command));
+                    stationCommandDispatcher.dispatch(stationObjModel.getDeviceNo(), command, "fake-process", "in-station-reset-task-over");
                     redisUtil.set(
                             RedisKeyType.CHECK_IN_STATION_STAY_TIME_OUT_LIMIT.key + stationObjModel.getStationId(),
                             "lock", 10);
@@ -594,7 +595,7 @@
                             JSON.toJSONString(command));
                 } else {
                     if (wrkMast.getWrkSts() != WrkStsType.NEW_INBOUND.sts
-                            && wrkMast.getWrkSts() != WrkStsType.INBOUND_DEVICE_RUN.sts) {
+                            && wrkMast.getWrkSts() != WrkStsType.INBOUND_STATION_RUN.sts) {
                         Integer crnNo = wrkMast.getCrnNo();
                         if (crnNo != null) {
                             CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crnNo);
@@ -607,7 +608,7 @@
                                 continue;
                             }
 
-                            MessageQueue.offer(SlaveType.Devp, stationObjModel.getDeviceNo(), new Task(2, command));
+                            stationCommandDispatcher.dispatch(stationObjModel.getDeviceNo(), command, "fake-process", "in-station-reset-crn-fetch");
                             redisUtil.set(RedisKeyType.CHECK_IN_STATION_STAY_TIME_OUT_LIMIT.key
                                     + stationObjModel.getStationId(), "lock", 10);
                             News.info("杈撻�佺珯鐐归噸缃懡浠や笅鍙戞垚鍔�(crn_fetch)锛岀珯鐐瑰彿={}锛屽懡浠ゆ暟鎹�={}", stationObjModel.getStationId(),
@@ -634,7 +635,7 @@
                                 continue;
                             }
 
-                            MessageQueue.offer(SlaveType.Devp, stationObjModel.getDeviceNo(), new Task(2, command));
+                            stationCommandDispatcher.dispatch(stationObjModel.getDeviceNo(), command, "fake-process", "in-station-reset-dual-crn-fetch");
                             redisUtil.set(RedisKeyType.CHECK_IN_STATION_STAY_TIME_OUT_LIMIT.key
                                     + stationObjModel.getStationId(), "lock", 10);
                             News.info("杈撻�佺珯鐐归噸缃懡浠や笅鍙戞垚鍔�(crn_fetch)锛岀珯鐐瑰彿={}锛屽懡浠ゆ暟鎹�={}", stationObjModel.getStationId(),
@@ -701,20 +702,25 @@
                         // 鐢熸垚浠跨湡绔欑偣鏁版嵁
                         StationCommand command = stationThread.getCommand(StationCommandType.WRITE_INFO, 9998,
                                 wrkMast.getSourceStaNo(), 0, 0);
-                        MessageQueue.offer(SlaveType.Devp, stationObjModel.getDeviceNo(), new Task(2, command));
+                        stationCommandDispatcher.dispatch(stationObjModel.getDeviceNo(), command, "fake-process", "crn-out-complete-write-info");
                         redisUtil.set(RedisKeyType.CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo(), JSON.toJSONString(stationObjModel, SerializerFeature.DisableCircularReferenceDetect), 60 * 60 * 24);
                     }
                 } else if (wrkMast.getWrkSts() == WrkStsType.LOC_MOVE_RUN.sts) {
                     updateWrkSts = WrkStsType.COMPLETE_LOC_MOVE.sts;
+                } else if (wrkMast.getWrkSts() == WrkStsType.CRN_MOVE_RUN.sts) {
+                    updateWrkSts = WrkStsType.COMPLETE_CRN_MOVE.sts;
                 } else {
                     News.error("鍫嗗灈鏈哄浜庣瓑寰呯‘璁や笖浠诲姟瀹屾垚鐘舵�侊紝浣嗗伐浣滅姸鎬佸紓甯搞�傚爢鍨涙満鍙�={}锛屽伐浣滃彿={}", basCrnp.getCrnNo(), crnProtocol.getTaskNo());
                     continue;
                 }
 
+                Date now = new Date();
                 wrkMast.setWrkSts(updateWrkSts);
                 wrkMast.setSystemMsg("");
-                wrkMast.setIoTime(new Date());
+                wrkMast.setIoTime(now);
+                wrkMast.setModiTime(now);
                 if (wrkMastService.updateById(wrkMast)) {
+                    wrkAnalysisService.markCraneComplete(wrkMast, now, updateWrkSts);
                     CrnCommand resetCommand = crnThread.getResetCommand(crnProtocol.getTaskNo(), crnProtocol.getCrnNo());
                     MessageQueue.offer(SlaveType.Crn, crnProtocol.getCrnNo(), new Task(2, resetCommand));
                     News.info("鍫嗗灈鏈轰换鍔$姸鎬佹洿鏂版垚鍔燂紝鍫嗗灈鏈哄彿={}锛屽伐浣滃彿={}", basCrnp.getCrnNo(), crnProtocol.getTaskNo());

--
Gitblit v1.9.1