From ee51a946795e372e5d7ed025a71dabd27048975c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 02 七月 2021 11:14:00 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 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 6c34f3b..30b2c4c 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -58,6 +58,9 @@
 @Transactional
 public class MainServiceImpl {
 
+
+    public static final long COMMAND_TIMEOUT = 5 * 1000;
+
     @Autowired
     private CommonService commonService;
     @Autowired
@@ -97,6 +100,9 @@
             for (DevpSlave.Sta inSta : devp.getInSta()) {
                 // 鑾峰彇鏉$爜鎵弿浠俊鎭�
                 BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode());
+                if (barcodeThread == null) {
+                    continue;
+                }
                 String barcode = barcodeThread.getBarcode();
                 if(!Cools.isEmpty(barcode)) {
                     log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
@@ -221,7 +227,7 @@
                     staProtocol = staProtocol.clone();
                 }
                 // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
-                if (staProtocol.isAutoing() && staProtocol.isLoading()
+                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
                         && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() == 9999)
                         && staProtocol.isPakMk()) {
                     // 鍒ゆ柇閲嶅宸ヤ綔妗�
@@ -530,6 +536,19 @@
             if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
                 log.error("鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
             } else {
+
+//                long startTime = System.currentTimeMillis();
+//                while ((System.currentTimeMillis() - startTime) < COMMAND_TIMEOUT) {
+//
+//                    if (true) {
+//                        break;
+//                    }
+//
+//                    try{
+//                        Thread.sleep(500);
+//                    }catch(Exception ignore){}
+//                }
+
                 // 淇敼宸ヤ綔妗g姸鎬� 2.璁惧涓婅蛋 => 3.鍚婅溅鍏ュ簱涓�
                 Date now = new Date();
                 wrkMast.setWrkSts(3L);

--
Gitblit v1.9.1