From 6c8bbda65905a9dd299062d725682a8bc896cd72 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期五, 21 六月 2024 19:14:33 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  138 ++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 127 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index a1284f4..cc21f70 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -34,13 +34,11 @@
 import com.zy.core.model.command.RgvCommand;
 import com.zy.core.model.cpmmandParam.CrnCommandParam;
 import com.zy.core.model.protocol.CrnProtocol;
+import com.zy.core.model.protocol.JarProtocol;
 import com.zy.core.model.protocol.RgvProtocol;
 import com.zy.core.model.protocol.StaProtocol;
 import com.zy.core.properties.SlaveProperties;
-import com.zy.core.thread.BarcodeThread;
-import com.zy.core.thread.LedThread;
-import com.zy.core.thread.RgvThread;
-import com.zy.core.thread.SiemensDevpThread;
+import com.zy.core.thread.*;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -107,11 +105,14 @@
     private WrkMastCrnMapper wrkMastCrnMapper;
     @Autowired
     private WrkMastSplitTwinMapper wrkMastSplitTwinMapper;
+    @Autowired
+    private WrkMastSplitTwinService wrkMastSplitTwinService;
+    @Autowired
+    private BasJarMastService basJarMastService;
 
     @Value("${wms.url}")
     private String wmsUrl;
-    @Autowired
-    private WrkMastSplitTwinService wrkMastSplitTwinService;
+
 
     /**
      * 缁勬墭
@@ -4409,11 +4410,126 @@
      *  Jar浠诲姟鍒涘缓
      */
     public synchronized void jarGenerateWrkMastSta() {
-        try{
-
-        }catch (Exception e){
-            log.error("灏忚溅澶嶄綅绾跨▼鎶ラ敊锛�"+e);
+        for (JarSlave jarSlave : slaveProperties.getJar()) {
+            try{
+                Integer count = basJarMastService.getJarMastByJarIdCount(jarSlave.getId().longValue());
+                if (count>=7){
+                    continue;
+                }
+                BasJarMast jarMastByJarIdMax = basJarMastService.getJarMastByJarIdMax(jarSlave.getId().longValue());
+                if (!Cools.isEmpty(jarMastByJarIdMax) && jarMastByJarIdMax.getJarLocDigit()==7){
+                    continue;
+                }
+                jarGenerateWrkMastStaExecute(jarSlave);
+            }catch (Exception e){
+                log.error(jarSlave.getId()+"鍙峰皬杞﹀浣嶇嚎绋嬫姤閿欙紒"+e);
+            }
         }
+    }
+
+    /**
+     *  Jar浠诲姟鍒涘缓  鎵ц
+     */
+    public synchronized boolean jarGenerateWrkMastStaExecute(JarSlave jarSlave) {
+        try{
+            // 鑾峰彇鍫嗗灈鏈轰俊鎭�
+            JarThread jarThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getId());
+            JarProtocol jarProtocol = jarThread.getJarProtocol();
+            if (jarProtocol == null) {
+                return false;
+            }
+            if (jarProtocol.modeType != JarModeType.AUTO){
+                return false;
+            }
+
+            JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId());
+            JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol();
+            if (jarOtherProtocol == null) {
+                return false;
+            }
+            if (jarOtherProtocol.modeType != JarModeType.AUTO){
+                return false;
+            }
+
+            //鑷姩銆佺┖闂层�佸彸闂ㄥ叧闂��
+            if (jarProtocol.isAutoing() && !jarProtocol.isRightDoor() && jarProtocol.jarErr==0 && !jarOtherProtocol.isLeftDoor() && jarOtherProtocol.jarErr==0){
+
+            }
+
+        } catch (Exception e){
+//            log.error("鍫嗗灈鏈哄伐浣嶄簩瀹屾垚绛夊緟纭寮傚父,鍫嗗灈鏈哄彿={},寮傚父淇℃伅={},宸ヤ綅鍙�={}",crn.getId(),e.getMessage(),2);
+        }
+        return false;
+    }
+
+    /**
+     *  Jar浠诲姟鍒涘缓  鎵ц
+     */
+    public synchronized boolean jarGenerateWrkMastStaExecuteOne(JarSlave jarSlave) {
+        try{
+            // 鑾峰彇鍫嗗灈鏈轰俊鎭�
+            JarThread jarThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getId());
+            JarProtocol jarProtocol = jarThread.getJarProtocol();
+            if (jarProtocol == null) {
+                return false;
+            }
+            if (jarProtocol.modeType != JarModeType.AUTO){
+                return false;
+            }
+
+            JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId());
+            JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol();
+            if (jarOtherProtocol == null) {
+                return false;
+            }
+            if (jarOtherProtocol.modeType != JarModeType.AUTO){
+                return false;
+            }
+
+            //鑷姩銆佺┖闂层�佸彸闂ㄥ叧闂��
+            if (jarProtocol.isAutoing() && !jarProtocol.isRightDoor() && jarProtocol.jarErr==0 && !jarOtherProtocol.isLeftDoor() && jarOtherProtocol.jarErr==0){
+
+            }
+
+        } catch (Exception e){
+//            log.error("鍫嗗灈鏈哄伐浣嶄簩瀹屾垚绛夊緟纭寮傚父,鍫嗗灈鏈哄彿={},寮傚父淇℃伅={},宸ヤ綅鍙�={}",crn.getId(),e.getMessage(),2);
+        }
+        return false;
+    }
+
+    /**
+     *  Jar浠诲姟鍒涘缓  鎵ц
+     */
+    public synchronized boolean jarGenerateWrkMastStaExecuteTwo(JarSlave jarSlave) {
+        try{
+            // 鑾峰彇鍫嗗灈鏈轰俊鎭�
+            JarThread jarThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getId());
+            JarProtocol jarProtocol = jarThread.getJarProtocol();
+            if (jarProtocol == null) {
+                return false;
+            }
+            if (jarProtocol.modeType != JarModeType.AUTO){
+                return false;
+            }
+
+            JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId());
+            JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol();
+            if (jarOtherProtocol == null) {
+                return false;
+            }
+            if (jarOtherProtocol.modeType != JarModeType.AUTO){
+                return false;
+            }
+
+            //鑷姩銆佺┖闂层�佸彸闂ㄥ叧闂��
+            if (jarProtocol.isAutoing() && !jarProtocol.isRightDoor() && jarProtocol.jarErr==0 && !jarOtherProtocol.isLeftDoor() && jarOtherProtocol.jarErr==0){
+
+            }
+
+        } catch (Exception e){
+//            log.error("鍫嗗灈鏈哄伐浣嶄簩瀹屾垚绛夊緟纭寮傚父,鍫嗗灈鏈哄彿={},寮傚父淇℃伅={},宸ヤ綅鍙�={}",crn.getId(),e.getMessage(),2);
+        }
+        return false;
     }
 
     /**
@@ -4499,7 +4615,7 @@
         return false;
     }
     /*
-     * 灏忚溅鍙栫┖鏉胯嚦宸ヤ綅浠诲姟  婊″彇
+     * 绌挎鏉跨Щ鍔�
      * */
     public synchronized boolean jarRgvTake8(Integer rgvId,BasJarMast basJarMast){
         return false;

--
Gitblit v1.9.1