From d09aac232174908a8492d53e3b4c5556d6bc6514 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期五, 13 九月 2024 13:58:39 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  618 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 553 insertions(+), 65 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 b07a549..cef8ccb 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -59,7 +59,8 @@
 //    private static final int[][] execute = new int[][]{{1,4},{2,4},{3,4},{4,4},{5,6},{6,6},{7,4},{8,4},{9,3},{10,4},{11,4}};
     private static final int[][] execute = new int[][]{{1,4},{2,4},{3,4},{4,4},{5,6},{6,6},{7,4},{8,4},{9,3},{10,4},{11,4}};
 
-    private static final Integer jarMaxLoc = 6;
+    private static final Integer jarMaxLoc = 7;
+    private static final Float jarTemperature = 50F;
     @Autowired
     private CommonService commonService;
     @Autowired
@@ -191,7 +192,10 @@
                     // led 寮傚父鏄剧ず
                     LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                     if (ledThread != null) {
-                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg));
+                        ErrMsg errMsg1 = new ErrMsg();
+                        errMsg1.setErrMsg(errMsg);
+                        errMsg1.setArea("1");
+                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                     }
                     continue;
                 }
@@ -226,7 +230,7 @@
                     // 鍒ゆ柇閲嶅宸ヤ綔妗�
                     WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
                     if (wrkMast != null) {
-                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+//                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                         barcodeThread.setBarcode("");
                         staProtocol.setWorkNo(wrkMast.getWrkNo());
                         staProtocol.setStaNo(wrkMast.getStaNo());
@@ -264,7 +268,7 @@
                         if (jsonObject.getInteger("code").equals(200)) {
                             StartupDto dto = jsonObject.getObject("data", StartupDto.class);
 
-                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+//                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
 
 
                             barcodeThread.setBarcode("");
@@ -282,6 +286,224 @@
                                 throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
                             }
                         } else {
+                            // led 寮傚父鏄剧ず
+                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+                            if (ledThread != null) {
+                                ErrMsg errMsg1 = new ErrMsg();
+                                errMsg1.setErrMsg("鍏ュ簱璇锋眰澶辫触"+jsonObject.getInteger("code"));
+                                errMsg1.setArea("1");
+                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
+                            }
+                            log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
+                        }
+
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    }
+
+                }
+
+
+            }
+        }
+
+    }
+    public synchronized void generateStoreWrkFile464() {
+        // 鏍规嵁杈撻�佺嚎plc閬嶅巻
+        for (DevpSlave devp : slaveProperties.getDevp()) {
+            // 閬嶅巻鍏ュ簱鍙�
+            for (DevpSlave.Sta inSta : devp.getInSta464()) {
+                // 鑾峰彇鏉$爜鎵弿浠俊鎭�
+                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);
+                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
+                        continue;
+                    }
+                } else {
+                    continue;
+                }
+
+                // 鑾峰彇鍏ュ簱绔欎俊鎭�
+//                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+                StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
+                if (staProtocol == null) {
+                    continue;
+                } else {
+                    staProtocol = staProtocol.clone();
+                }
+
+                // 灏哄妫�娴嬪紓甯�
+                boolean back = false;
+                String errMsg = "寮傚父锛�";
+                if (staProtocol.isFrontErr()) {
+                    errMsg = errMsg+"鍓嶈秴闄愶紱";
+                    back = true;
+                }
+                if (staProtocol.isBackErr()) {
+                    errMsg = errMsg+"鍚庤秴闄�";
+                    back = true;
+                }
+                if (staProtocol.isHighErr()) {
+                    errMsg = errMsg+"楂樿秴闄�";
+                    back = true;
+                }
+                if (staProtocol.isLeftErr()) {
+                    errMsg = errMsg+"宸﹁秴闄�";
+                    back = true;
+                }
+                if (staProtocol.isRightErr()) {
+                    errMsg = errMsg+"鍙宠秴闄�";
+                    back = true;
+                }
+                if (staProtocol.isWeightErr()) {
+                    errMsg = errMsg+"瓒呴噸";
+                    back = true;
+                }
+                if (staProtocol.isBarcodeErr()) {
+                    errMsg = errMsg+"鎵爜澶辫触";
+                    back = true;
+                }
+                // 閫�鍥�
+                if (back) {
+                    // led 寮傚父鏄剧ず
+                    LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+                    if (ledThread != null) {
+                        ErrMsg errMsg1 = new ErrMsg();
+                        errMsg1.setErrMsg(errMsg);
+                        errMsg1.setArea("1");
+                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
+                    }
+                    continue;
+                }
+
+                // 鍏ュ嚭搴撴ā寮忓垽鏂�
+//                if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; }
+//                if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) {
+//                    continue;
+//                }
+
+                // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
+                if (staProtocol.isAutoing()
+                        && staProtocol.isLoading()
+                        && staProtocol.isInEnable()
+                        && !staProtocol.isEmptyMk()
+                        && staProtocol.getWorkNo() == 0
+                        && staProtocol.isPakMk()) {// && !Cools.isEmpty(barcode)) {
+
+//                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+//                        log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
+//                        //鏉$爜涓虹┖鎴栬�呬笉绗﹀悎锛岄��搴撳埌172绔欑偣
+//                        staProtocol.setWorkNo((short)32222);
+//                        staProtocol.setStaNo((short)172);
+//                        devpThread.setPakMk(staProtocol.getSiteId(), false);
+//                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+//                        if (!result) {
+//                            throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+//                        }
+//                        continue;
+//                    }
+
+                    // 鍒ゆ柇閲嶅宸ヤ綔妗�
+                    WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
+                    if (wrkMast != null) {
+//                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+                        barcodeThread.setBarcode("");
+                        staProtocol.setWorkNo(wrkMast.getWrkNo());
+                        staProtocol.setStaNo(wrkMast.getStaNo());
+
+                        devpThread.setPakMk(staProtocol.getSiteId(), false);
+                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+                        if (!result) {
+                            throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+                        }
+                        return;
+                    }
+//                    // 鑾峰彇鍏ュ簱閫氱煡妗�
+//                    List<WaitPakin> waitPakins = waitPakinMapper.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode).eq("io_status", "N"));
+//                    if (waitPakins.isEmpty()) {
+//                        log.error("鏃犳鍏ュ簱鏉$爜鏁版嵁銆傛潯鐮佸彿={}", barcode);
+//                        continue;
+//                    }
+
+                    try {
+
+                        LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
+
+                        SearchLocParam param = new SearchLocParam();
+                        param.setBarcode(barcode);
+                        param.setIoType(1);
+                        param.setSourceStaNo(inSta.getStaNo());
+                        param.setLocType1(locTypeDto.getLocType1());
+                        String response = new HttpHandler.Builder()
+                                .setUri(wmsUrl)
+                                .setPath("/rpc/pakin/loc/v1")
+                                .setJson(JSON.toJSONString(param))
+                                .build()
+                                .doPost();
+                        JSONObject jsonObject = JSON.parseObject(response);
+                        if (jsonObject.getInteger("code").equals(200)) {
+                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
+
+//                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+
+
+                            barcodeThread.setBarcode("");
+                            staProtocol.setWorkNo(dto.getWorkNo());
+
+                            if(Cools.isEmpty(dto.getRgvNo()) || dto.getRgvNo() <= 0) {
+                                staProtocol.setStaNo(607);//607
+                            } else {//濡傛灉瀛樺湪RGV缂栧彿锛岃鏄庨渶瑕丷GV鎺ラ┏锛屽厛涓嬪彂浠诲姟鍒癛GV婧愮珯
+                                staProtocol.setStaNo(dto.getRgvSstaNo());
+                            }
+
+                            devpThread.setPakMk(staProtocol.getSiteId(), false);
+                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+                            if (!result) {
+                                throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+                            }
+                        } else  if (jsonObject.getInteger("code").equals(700)){
+                            SearchLocParam param2 = new SearchLocParam();
+                            param2.setBarcode(barcode);
+                            param2.setSourceStaNo(inSta.getStaNo());
+                            param2.setLocType1(locTypeDto.getLocType1());
+                            String response2 = new HttpHandler.Builder()
+                                    .setUri(wmsUrl)
+                                    .setPath("/rpc/pakin/yx/loc/v464")
+                                    .setJson(JSON.toJSONString(param2))
+                                    .build()
+                                    .doPost();
+                            JSONObject jsonObject2 = JSON.parseObject(response2);
+                            if (jsonObject2.getInteger("code").equals(200)) {
+                                log.info("464绱ф�ョ珯鐐硅嚜鍔ㄧ粍鎵樻垚鍔燂紒锛�");
+                            } else {
+                                log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/yx/loc/v464", JSON.toJSONString(param), response);
+
+                                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+
+                                if (ledThread != null) {
+                                    ErrMsg errMsg1 = new ErrMsg();
+                                    errMsg1.setErrMsg("鍏ュ簱澶辫触!绔欑偣鍙凤細"+inSta.getStaNo());
+                                    errMsg1.setArea("1");
+                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
+                                }
+                            }
+                        } else {
+                            // led 寮傚父鏄剧ず
+                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+                            if (ledThread != null) {
+                                ErrMsg errMsg1 = new ErrMsg();
+                                errMsg1.setErrMsg("鍏ュ簱璇锋眰澶辫触"+jsonObject.getInteger("code"));
+                                errMsg1.setArea("1");
+                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
+                            }
                             log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
                         }
 
@@ -369,7 +591,10 @@
                     // led 寮傚父鏄剧ず
                     LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                     if (ledThread != null) {
-                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg));
+                        ErrMsg errMsg1 = new ErrMsg();
+                        errMsg1.setErrMsg(errMsg);
+                        errMsg1.setArea("1");
+                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                     }
                     continue;
                 }
@@ -412,6 +637,12 @@
                         devpThread.setPakMk(staProtocol.getSiteId(), false);
                         boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                         if (!result) {
+                            if (ledThread != null) {
+                                ErrMsg errMsg1 = new ErrMsg();
+                                errMsg1.setErrMsg("鏇存柊plc绔欑偣淇℃伅澶辫触!绔欑偣濂斤細"+inSta.getStaNo());
+                                errMsg1.setArea("1");
+                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
+                            }
                             throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
                         }
                         return;
@@ -464,6 +695,12 @@
                             devpThread.setPakMk(staProtocol.getSiteId(), false);
                             boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                             if (!result) {
+                                if (ledThread != null) {
+                                    ErrMsg errMsg1 = new ErrMsg();
+                                    errMsg1.setErrMsg("鏇存柊plc绔欑偣淇℃伅澶辫触!绔欑偣濂斤細"+inSta.getStaNo());
+                                    errMsg1.setArea("1");
+                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
+                                }
                                 throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
                             }
                         } else {
@@ -502,6 +739,18 @@
                 if (!Cools.isEmpty(barcode)) {
 //                    log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
                     if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
+                        continue;
+                    }
+                    if ("00000000".equals(barcode)){
+                        log.error(inSta+"绔欑偣锛屾壂鐮佸け璐ワ紝barcode锛�"+barcode);
+                        // led 寮傚父鏄剧ず
+                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+                        if (ledThread != null) {
+                            ErrMsg errMsg1 = new ErrMsg();
+                            errMsg1.setErrMsg(inSta+"绔欑偣锛屾壂鐮佸け璐ワ紝barcode锛�"+barcode);
+                            errMsg1.setArea("1");
+                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
+                        }
                         continue;
                     }
                 } else {
@@ -554,7 +803,10 @@
                     // led 寮傚父鏄剧ず
                     LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                     if (ledThread != null) {
-                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg));
+                        ErrMsg errMsg1 = new ErrMsg();
+                        errMsg1.setErrMsg(errMsg);
+                        errMsg1.setArea("1");
+                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                     }
                     continue;
                 }
@@ -603,6 +855,12 @@
                         devpThread.setPakMk(staProtocol.getSiteId(), false);
                         boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                         if (!result) {
+                            if (ledThread != null) {
+                                ErrMsg errMsg1 = new ErrMsg();
+                                errMsg1.setErrMsg("鏇存柊plc绔欑偣淇℃伅澶辫触!绔欑偣濂斤細"+inSta.getStaNo());
+                                errMsg1.setArea("1");
+                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
+                            }
                             throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
                         }
                         return;
@@ -647,7 +905,7 @@
                             if (!result) {
                                 throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
                             }
-                        } else {
+                        } else  if (jsonObject.getInteger("code").equals(700)){
                             SearchLocParam param2 = new SearchLocParam();
                             param2.setBarcode(barcode);
                             param2.setSourceStaNo(inSta.getStaNo());
@@ -667,8 +925,22 @@
                                 LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
 
                                 if (ledThread != null) {
-                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, "鍏ュ簱澶辫触锛�"));
+                                    ErrMsg errMsg1 = new ErrMsg();
+                                    errMsg1.setErrMsg("鍏ュ簱澶辫触!绔欑偣鍙凤細"+inSta.getStaNo());
+                                    errMsg1.setArea("1");
+                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                                 }
+                            }
+                        } else {
+                            log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
+
+                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+
+                            if (ledThread != null) {
+                                ErrMsg errMsg1 = new ErrMsg();
+                                errMsg1.setErrMsg("鍏ュ簱澶辫触!绔欑偣鍙凤細"+inSta.getStaNo());
+                                errMsg1.setArea("1");
+                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                             }
                         }
 
@@ -2546,7 +2818,7 @@
             }
             //閫�搴撴ā寮忚烦杩�118銆�119鍑哄簱浠诲姟
             if (wrkMast.getStaNo()==118 || wrkMast.getStaNo()==119){
-                RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign();
+                RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign("oneSign");
                 if (Cools.isEmpty(rgvOneSign) || rgvOneSign.getRgvOneSign()==1){
                     continue;
                 }
@@ -2851,7 +3123,7 @@
             }
             //閫�搴撴ā寮忚烦杩�118銆�119鍑哄簱浠诲姟
             if (wrkMast.getStaNo()==118 || wrkMast.getStaNo()==119){
-                RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign();
+                RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign("oneSign");
                 if (Cools.isEmpty(rgvOneSign) || rgvOneSign.getRgvOneSign()==1){
                     continue;
                 }
@@ -3738,16 +4010,31 @@
                 } else {
                     staProtocol = staProtocol.clone();
                 }
-                if (emptyInSta.getStaNo()==607 && staProtocol.getStaNo()==607 && staProtocol.getWorkNo()>20000 && staProtocol.isLoading() && staProtocol.isAutoing()){
+                String barcode = staProtocol.getBarcode();
+                if (!Cools.isEmpty(barcode)) {
+//                    log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
+                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
+                        continue;
+                    }
+                } else {
+                    continue;
+                }
+                if (emptyInSta.getStaNo()==607 && staProtocol.getStaNo()==607 && staProtocol.getWorkNo()==0
+                        && staProtocol.isLoading() && staProtocol.isAutoing() && staProtocol.isInEnable()){
                     try {
                         BasDevp basDevp = basDevpService.selectById(staProtocol.getStaNo());
                         if (basDevp.getReportSign()==0){
+                            WrkMast wrkMast = wrkMastMapper.selectByBarcodeTwo(barcode);
+                            if (!Cools.isEmpty(wrkMast)){
+                                continue;
+                            }
                             LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
 
                             SearchLocParam param = new SearchLocParam();
                             param.setIoType(10);
                             param.setSourceStaNo(emptyInSta.getStaNo());
                             param.setLocType1(locTypeDto.getLocType1());
+                            param.setBarcode(barcode);
                             String response = new HttpHandler.Builder()
                                     .setUri(wmsUrl)
                                     .setPath("/rpc/pakin/loc/v1")
@@ -3839,7 +4126,13 @@
                 // 绔欑偣鏉′欢鍒ゆ柇
                 if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
                         && staProtocol.isEmptyMk() && ((staProtocol.getWorkNo() > 32222 && staProtocol.getWorkNo() <= 63333) || staProtocol.getWorkNo()==0)  && staProtocol.isPakMk()) {
-
+                    //鍥炲簱鏍囪
+                    if (emptyInSta.getStaNo()==126 || emptyInSta.getStaNo()==131){
+                        RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign("sign"+emptyInSta.getStaNo());
+                        if (Cools.isEmpty(rgvOneSign) || rgvOneSign.getRgvOneSign()!=1){
+                            continue;
+                        }
+                    }
                     try {
                         LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
 
@@ -3896,7 +4189,13 @@
                 // 绔欑偣鏉′欢鍒ゆ柇
                 if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
                         && staProtocol.isEmptyMk() && ((staProtocol.getWorkNo() > 32222 && staProtocol.getWorkNo() <= 63333) || staProtocol.getWorkNo()==0)  && staProtocol.isPakMk()) {
-
+                    //鍥炲簱鏍囪
+                    if (emptyInSta.getStaNo()==310 || emptyInSta.getStaNo()==312){
+                        RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign("sign"+emptyInSta.getStaNo());
+                        if (Cools.isEmpty(rgvOneSign) || rgvOneSign.getRgvOneSign()!=1){
+                            continue;
+                        }
+                    }
                     try {
                         LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
 
@@ -3976,7 +4275,7 @@
      */
     public synchronized void storeEmptyPlt3() {
         try{
-            RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign();
+            RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign("oneSign");
             if (Cools.isEmpty(rgvOneSign) || rgvOneSign.getRgvOneSign()==1){
                 return;
             }
@@ -4813,8 +5112,28 @@
                             if (basJarMastService.selectJarMastOperation(jarSlave.getId(),2)!=0){
                                 break;
                             }
-                            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),3)!=0){
+                            BasJar basJar = basJarMapper.selectById(jarSlave.getId());
+                            int count = basJarMastService.selectCount(new EntityWrapper<BasJarMast>().eq("jar_regin", basJar.getRegion()).lt("status", 17).gt("status", 11));
+                            if (count>0){
                                 break;
+                            }
+                            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),3)!=0){
+                                if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),3)==7){
+                                    JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId());
+                                    JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol();
+                                    if (jarOtherProtocol == null) {
+                                        break;
+                                    }
+                                    if (jarOtherProtocol.getJarTemperature()>jarTemperature){
+                                        log.info("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....鍏堟墽琛屽叆缃愪换鍔★紒锛侊紒",jarOtherProtocol.getJarNo());
+                                    } else {
+                                        if (basJarMastService.getJarMastByJarIdCount(jarSlave.getId())>0){
+                                            log.info("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛屽厛鎵ц浜嗗叆缃愪换鍔★紝鎵ц瀹屾瘯鍐嶈繘琛屽喎鍗达紒锛侊紒",jarOtherProtocol.getJarNo());
+                                        } else {
+                                            break;
+                                        }
+                                    }
+                                }
                             }
                             if (basJarMastService.getJarMastByJarIdCount(jarSlave.getId())>=jarMaxLoc*2){
                                 break;
@@ -4889,7 +5208,7 @@
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧姝e湪纭寲涓紝浠诲姟寮傚父锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
-            if (jarProtocol.getJarTemperature()>50){
+            if (jarProtocol.getJarTemperature()>jarTemperature){
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
@@ -5034,10 +5353,7 @@
                 if (jarProtocol.modeType != JarModeType.AUTO){
                     continue;
                 }
-                if (jarProtocol.getJarTemperature()>50){
-                    log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
-                    continue;
-                }
+
 
                 JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId());
                 JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol();
@@ -5065,6 +5381,10 @@
                                 break;//寮�闂ㄤ换鍔�   鐢熸垚鍏ョ~鍖栫綈浠诲姟
                             }
                         case 2:
+                            if (jarProtocol.getJarTemperature()>jarTemperature){
+                                log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
+                                continue;
+                            }
                             if (jarWrkMastExecuteGenerate2(jarSlave,sign)){
                                 signExecute[i] = true;
                                 break;//鍏宠繘鏂欓棬
@@ -5075,6 +5395,10 @@
                                 break;//寮�鍑烘枡闂�
                             }
                         case 4:
+                            if (jarProtocol.getJarTemperature()>jarTemperature){
+                                log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
+                                continue;
+                            }
                             if (jarWrkMastExecuteGenerate4(jarSlave,sign)){
                                 signExecute[i] = true;
                                 break;//鍑虹~鍖栫綈 ===銆� 鍏ュ喎鍗存Ы
@@ -5113,7 +5437,7 @@
                     signExecute[jarSlave.getId()-5] = true;
                     continue;
                 }
-                if (jarProtocol.getJarTemperature()>50){
+                if (jarProtocol.getJarTemperature()>jarTemperature){
                     log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
                     continue;
                 }
@@ -5128,9 +5452,10 @@
                 if (jarProtocol.isAutoing() && jarProtocol.jarErr==0){
                     if (jarWrkMastExecuteGenerate5(jarSlave,sign)){
                         signExecute[jarSlave.getId()-5] = true;
-                        //鍑虹~鍖栫綈 ===銆� 鍏ュ喎鍗存Ы
+                        return signExecute;
+                        //鍐峰嵈瀹屾垚涓婅緭閫佺嚎
                     }
-                    return signExecute;
+                    continue;
                 }
             } catch (Exception e){
                 log.error("{}鍙风~鍖栫綈JarWrkMastExecute浠诲姟鍒涘缓寮傚父,寮傚父鍘熷洜={}",jarSlave.getId(),e.getMessage());
@@ -5161,7 +5486,7 @@
                 if (jarProtocol.modeType != JarModeType.AUTO){
                     continue;
                 }
-                if (jarProtocol.getJarTemperature()>50){
+                if (jarProtocol.getJarTemperature()>jarTemperature){
                     log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
                     continue;
                 }
@@ -5259,7 +5584,7 @@
                         if (jarProtocol.statusType .equals(JarStatusType.WAITING2) || jarProtocol.statusType .equals(JarStatusType.SOS)){
                             return false;
                         }
-                        if (jarProtocol.getJarTemperature()>50){
+                        if (jarProtocol.getJarTemperature()>jarTemperature){
                             log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
                             continue;
                         }
@@ -5275,6 +5600,15 @@
                         BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
                         if (Cools.isEmpty(basJar)){
                             log.error("{}鍙风~鍖栫綈鏌ヨ璁惧妗f鏃犱俊鎭紒锛侊紒",jarProtocol.getJarNo());
+                            return false;
+                        }
+
+                        if (wrkMastExecuteService.getWrkMastExecuteByjarReginCount(basJar.getRegion())!=0){
+                            return false;
+                        }
+
+                        int count = basJarMastService.selectCount(new EntityWrapper<BasJarMast>().eq("jar_regin", basJar.getRegion()).lt("status", 17).gt("status", 11));
+                        if (count>0){
                             return false;
                         }
 
@@ -5333,6 +5667,10 @@
             if (Cools.isEmpty(basJarMastSign)){
                 return false;
             }
+
+            if (wrkMastExecuteService.getWrkMastExecuteByjarReginCount(basJarMastSign.getJarRegin())!=0){
+                return false;
+            }
 //            //鍒ゆ柇灏忚溅鐘舵��
 //            if (!jarWrkMastExecuteGenerateSteStatus(jarSlave.getJarInSte().get(0).getSteNo(),1,SteStatusType.IDLE)){
 //                return false;
@@ -5355,7 +5693,7 @@
                     log.error("{}鍙风~鍖栫綈鏌ヨ璁惧姝e湪纭寲涓紝浠诲姟寮傚父锛侊紒锛�",jarProtocol.getJarNo());
                     return false;
                 }
-                if (jarProtocol.getJarTemperature()>50){
+                if (jarProtocol.getJarTemperature()>jarTemperature){
                     log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
                     return false;
                 }
@@ -5405,12 +5743,18 @@
             if (basJarMastList.size() != jarMaxLoc){
                 return false;
             }
-            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=0){
-                return false;
-            }
+//            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=0
+//                    && basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=7
+//                    && basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=14){
+//                return false;
+//            }
 
             BasJarMast basJarMastSign = basJarMastList.get(0);
             if (Cools.isEmpty(basJarMastSign)){
+                return false;
+            }
+
+            if (wrkMastExecuteService.getWrkMastExecuteByjarReginCount(basJarMastSign.getJarRegin())!=0){
                 return false;
             }
 //            //鍒ゆ柇灏忚溅鐘舵��
@@ -5436,10 +5780,10 @@
                     log.error("{}鍙风~鍖栫綈鏌ヨ璁惧姝e湪纭寲涓紝浠诲姟寮傚父锛侊紒锛�",jarProtocol.getJarNo());
                     return false;
                 }
-                if (jarProtocol.getJarTemperature()>50){
-                    log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
-                    return false;
-                }
+//                if (jarProtocol.getJarTemperature()>jarTemperature){
+//                    log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
+//                    return false;
+//                }
                 BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
                 if (Cools.isEmpty(basJar)){
                     log.error("{}鍙风~鍖栫綈鏌ヨ璁惧妗f鏃犱俊鎭紒锛侊紒",jarProtocol.getJarNo());
@@ -5482,13 +5826,21 @@
             if (basJarMastList.isEmpty()){
                 return false;
             }
-
-            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),4)!=0){
+            List<BasJarMast> basJarMastList10 = basJarMastService.getJarMastByJarIdAndStatusList(jarSlave.getId(), new ArrayList<Integer>() {{
+                add(10);
+            }});
+            if (basJarMastList10.size()==jarMaxLoc){
+                return false;
+            }
+            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),4)!=0 && basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),4)!=7){
                 return false;
             }
 
             BasJarMast jarMastByJarIdMin = basJarMastService.getJarMastByJarIdMin(jarSlave.getId(),8,8);
             if (Cools.isEmpty(jarMastByJarIdMin)){
+                return false;
+            }
+            if (wrkMastExecuteService.getWrkMastExecuteByjarReginCount(jarMastByJarIdMin.getJarRegin())!=0){
                 return false;
             }
 
@@ -5525,6 +5877,22 @@
                     log.error("{}鍙风~鍖栫綈鏌ヨ璁惧妗f鏃犱俊鎭紒锛侊紒",jarProtocol.getJarNo());
                     return false;
                 }
+
+//                //涓存椂
+//                if (basJar.getJarCode()==1){
+//                    JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId());
+//                    JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol();
+//                    if (jarOtherProtocol == null) {
+//                        return false;
+//                    }
+//
+//                    if (!jarOtherProtocol.isAutoing() || jarOtherProtocol.jarErr!=0
+//                            || !jarOtherProtocol.isLeftDoor() || !jarOtherProtocol.isRightDoor()
+//                            || jarOtherProtocol.leftDoorOpen==1  || jarOtherProtocol.leftDoorClose==1 || jarOtherProtocol.rightDoorOpen==1  || jarOtherProtocol.rightDoorClose==1){
+//                        log.error("{}鍙风~鍖栫綈鏌ヨ璁惧涓嶆弧瓒冲墠寰�鍐峰嵈姹犳潯浠讹紝浠e彿2纭寲缃愰棬娌″紑锛侊紒锛�",jarOtherProtocol.getJarNo());
+//                        return false;
+//                    }
+//                }
 
                 //闂ㄤ綔涓�  鏃�
 //                if (jarProtocol.isAutoing() && jarProtocol.statusType == JarStatusType.WAITING4 && jarProtocol.jarErr==0
@@ -5577,6 +5945,10 @@
             if (Cools.isEmpty(jarMastByJarIdMin)){
                 return false;
             }
+
+            if (wrkMastExecuteService.getWrkMastExecuteByjarReginCount(jarMastByJarIdMin.getJarRegin())!=0){
+                return false;
+            }
 //
 //            //鍒ゆ柇灏忚溅鐘舵��
 //            if (!jarWrkMastExecuteGenerateSteStatus(jarSlave.getJarOutSte().get(0).getSteNo(),3,SteStatusType.IDLE)){
@@ -5596,13 +5968,33 @@
                 if (jarProtocol.modeType != JarModeType.AUTO){
                     return false;
                 }
-                if (jarProtocol.getJarTemperature()>50){
+                if (jarProtocol.getJarTemperature()>jarTemperature){
                     log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
                     return false;
                 }
                 BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
                 if (Cools.isEmpty(basJar)){
                     log.error("{}鍙风~鍖栫綈鏌ヨ璁惧妗f鏃犱俊鎭紒锛侊紒",jarProtocol.getJarNo());
+                    return false;
+                }
+
+                // 鑾峰彇纭寲缃愪俊鎭�
+                JarThread jarThreadOther = (JarThread) SlaveConnection.get(SlaveType.Jar, SteAndJarUtil.getRgvJarNo(jarProtocol.getJarNo()));
+                JarProtocol jarProtocolOther = jarThreadOther.getJarProtocol();
+                if (jarProtocolOther == null) {
+                    return false;
+                }
+                if (jarProtocolOther.modeType != JarModeType.AUTO){
+                    return false;
+                }
+
+                BasJar basJarOther = basJarMapper.selectById(jarProtocolOther.getJarNo());
+                if (Cools.isEmpty(basJarOther)){
+                    log.error("{}鍙风~鍖栫綈鏌ヨ璁惧妗f鏃犱俊鎭紒锛侊紒",jarProtocolOther.getJarNo());
+                    return false;
+                }
+
+                if (!jarProtocolOther.isRightDoor()){
                     return false;
                 }
 
@@ -6019,10 +6411,10 @@
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧姝e湪纭寲涓紝浠诲姟寮傚父锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
-            if (jarProtocol.getJarTemperature()>50){
-                log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
-                return false;
-            }
+//            if (jarProtocol.getJarTemperature()>jarTemperature){
+//                log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
+//                return false;
+//            }
             BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
             if (Cools.isEmpty(basJar)){
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧妗f鏃犱俊鎭紒锛侊紒",jarProtocol.getJarNo());
@@ -6147,7 +6539,7 @@
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧姝e湪纭寲涓紝浠诲姟寮傚父锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
-            if (jarProtocol.getJarTemperature()>50){
+            if (jarProtocol.getJarTemperature()>jarTemperature){
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
@@ -6275,7 +6667,7 @@
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧姝e湪纭寲涓紝浠诲姟寮傚父锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
-            if (jarProtocol.getJarTemperature()>50){
+            if (jarProtocol.getJarTemperature()>jarTemperature){
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
@@ -6391,7 +6783,7 @@
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧姝e湪纭寲涓紝浠诲姟寮傚父锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
-            if (jarProtocol.getJarTemperature()>50){
+            if (jarProtocol.getJarTemperature()>jarTemperature){
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
@@ -6507,7 +6899,7 @@
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧姝e湪纭寲涓紝浠诲姟寮傚父锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
-            if (jarProtocol.getJarTemperature()>50){
+            if (jarProtocol.getJarTemperature()>jarTemperature){
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
@@ -6643,7 +7035,7 @@
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧姝e湪纭寲涓紝浠诲姟寮傚父锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
-            if (jarProtocol.getJarTemperature()>50){
+            if (jarProtocol.getJarTemperature()>jarTemperature){
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
@@ -6775,7 +7167,7 @@
             if (jarProtocol.modeType != JarModeType.AUTO){
                 return false;
             }
-            if (jarProtocol.getJarTemperature()>50){
+            if (jarProtocol.getJarTemperature()>jarTemperature){
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
@@ -6939,7 +7331,7 @@
 //            if (jarProtocol.modeType != JarModeType.AUTO){
 //                return false;
 //            }
-//            if (jarProtocol.getJarTemperature()>50){
+//            if (jarProtocol.getJarTemperature()>jarTemperature){
 //                log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
 //                return false;
 //            }
@@ -7115,7 +7507,7 @@
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧姝e湪纭寲涓紝浠诲姟寮傚父锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
-            if (jarProtocol.getJarTemperature()>50){
+            if (jarProtocol.getJarTemperature()>jarTemperature){
                 log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
                 return false;
             }
@@ -7573,10 +7965,6 @@
                 if (jarProtocol.modeType != JarModeType.AUTO){
                     continue;
                 }
-                if (jarProtocol.getJarTemperature()>50){
-                    log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
-                    return false;
-                }
                 BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
                 if (Cools.isEmpty(basJar)){
                     log.error("{}鍙风~鍖栫綈鏌ヨ璁惧妗f鏃犱俊鎭紒锛侊紒",jarProtocol.getJarNo());
@@ -7602,6 +7990,10 @@
                         && jarProtocol.leftDoorOpen!=1 && jarProtocol.leftDoorOpen!=3
                         && jarProtocol.rightDoorOpen!=1 && jarProtocol.rightDoorOpen!=3
                         && (jarProtocol.leftDoorOpen==2  || jarProtocol.rightDoorOpen==2)){
+//                    if (jarProtocol.getJarTemperature()>jarTemperature){
+//                        log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
+//                        return false;
+//                    }
                     WrkMastExecute wrkMastExecuteSou = new WrkMastExecute();
                     wrkMastExecuteSou.setWrkSts(3);
                     List<WrkMastExecute> wrkMastExecuteList = wrkMastExecuteService.selectWrkMastExecuteByWrk(wrkMastExecuteSou);
@@ -7636,6 +8028,10 @@
                         && jarProtocol.leftDoorClose!=1 && jarProtocol.leftDoorClose!=3
                         && jarProtocol.rightDoorClose!=1 && jarProtocol.rightDoorClose!=3
                         && (jarProtocol.leftDoorClose==2  || jarProtocol.rightDoorClose==2)){
+                    if (jarProtocol.getJarTemperature()>jarTemperature){
+                        log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
+                        return false;
+                    }
                     WrkMastExecute wrkMastExecuteSou = new WrkMastExecute();
                     wrkMastExecuteSou.setWrkSts(3);
                     List<WrkMastExecute> wrkMastExecuteList = wrkMastExecuteService.selectWrkMastExecuteByWrk(wrkMastExecuteSou);
@@ -7761,6 +8157,8 @@
                         return true;
                     }
                     return true;
+                } else {
+                    log.error("{}鍙峰钩琛¤溅褰撳墠鐘舵�佷笉婊¤冻鍏ョ~鍖栫綈鏉′欢锛屽綋鍓嶄换鍔★紝骞宠 杞︿粠鍙栬揣");
                 }
             }
             return true;
@@ -8008,7 +8406,7 @@
                             if (jarProtocol.statusType .equals(JarStatusType.SOS)){
                                 continue;
                             }
-                            if (jarProtocol.getJarTemperature()>50){
+                            if (jarProtocol.getJarTemperature()>jarTemperature){
                                 continue;
                             }
                             if (jarProtocol.leftDoorOpen != 0 || jarProtocol.rightDoorOpen != 0){
@@ -8035,7 +8433,7 @@
                 }
             }
         } catch (Exception e){
-            log.error("纭寲鍖哄煙鍒嗘浠诲姟瀹屾垚寮傚父,寮傚父淇℃伅={}",e.getMessage());
+            log.error("纭寲鍖哄煙鍒嗘鍏呯數浠诲姟鍒涘缓寮傚父,寮傚父淇℃伅={}",e.getMessage());
         }
         return false;
     }
@@ -8066,7 +8464,38 @@
                     if(basJarMastList.isEmpty()){
                         if (wrkMastExecuteService.selectNoStartCharge(steSlave.getId())==0){
                             if (wrkMastExecuteService.selectMoveStart(steSlave.getId())==0){
-                                continue;
+                                boolean sign = true;
+                                for (SteSlave.InStn inStn : steSlave.getSteInStn()){
+                                    //妫�娴嬬珯鐐圭姸鎬�
+                                    DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, inStn.getDevpPlcId());
+                                    StaProtocol staProtocol = devpThread.getStation().get(inStn.getStaNo());
+                                    if (staProtocol == null) {
+                                        continue;
+                                    } else {
+                                        staProtocol = staProtocol.clone();
+                                    }
+                                    if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0) {
+                                        // 鑾峰彇纭寲缃愪俊鎭�
+                                        JarThread jarThread = (JarThread) SlaveConnection.get(SlaveType.Jar, inStn.getJarNo());
+                                        JarProtocol jarProtocol = jarThread.getJarProtocol();
+                                        if (jarProtocol == null) {
+                                            continue;
+                                        }
+                                        if (jarProtocol.modeType != JarModeType.AUTO){
+                                            continue;
+                                        }
+                                        if (jarProtocol.statusType .equals(JarStatusType.SOS)){
+                                            continue;
+                                        }
+                                        if (jarProtocol.getJarTemperature()>jarTemperature){
+                                            continue;
+                                        }
+                                        sign = false;
+                                    }
+                                }
+                                if(sign){
+                                    continue;
+                                }
                             }
                         }
                     }
@@ -8112,7 +8541,7 @@
                 }
             }
         } catch (Exception e){
-            log.error("纭寲鍖哄煙鍒嗘浠诲姟瀹屾垚寮傚父,寮傚父淇℃伅={}",e.getMessage());
+            log.error("纭寲鍖哄煙鍒嗘浠诲姟鍏呯數浠诲姟瀹屾垚寮傚父,寮傚父淇℃伅={}",e.getMessage());
         }
         return false;
     }
@@ -8124,21 +8553,52 @@
         if (staNo1!=0){
             SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 2);
             StaProtocol staProtocol607 = devpThread.getStation().get(607);
-            if (staProtocol607.getWorkNo()<9001 && staProtocol607.getWorkNo()!=0 && staProtocol607.isLoading() && staProtocol607.isAutoing() && staProtocol607.getStaNo() == 607){
-                staProtocol607.setStaNo(staNo1);
-                boolean result2 = MessageQueue.offer(SlaveType.Devp, 2, new Task(5, staProtocol607));
+            String barcode = staProtocol607.getBarcode();
+            if (!Cools.isEmpty(barcode)) {
+//                    log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
+                if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
+                    return;
+                }
+            } else {
+                return;
+            }
+            if (staProtocol607.getWorkNo()==0 && staProtocol607.isLoading() && staProtocol607.isAutoing()
+                    && staProtocol607.getStaNo() == 607 && staProtocol607.isInEnable()){
+                WrkMast wrkMast = wrkMastMapper.selectByBarcodeTwo(barcode);
+                if (!Cools.isEmpty(wrkMast)){
+                    staProtocol607.setWorkNo(wrkMast.getWrkNo());
+                    staProtocol607.setStaNo(staNo1);
+                    boolean result2 = MessageQueue.offer(SlaveType.Devp, 2, new Task(5, staProtocol607));
+                }
+            }
+        } else {
+
+            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, 1);
+
+            if (ledThread != null) {
+                ErrMsg errMsg1 = new ErrMsg();
+                errMsg1.setErrMsg("鍒嗛厤纭寲缃�===>鐩爣绔欑偣鍙凤細"+staNo1);
+                errMsg1.setArea("1");
+                MessageQueue.offer(SlaveType.Led, 1, new Task(5, errMsg1));
+            } try {
+                Thread.sleep(500);
+            } catch (Exception e){
+
             }
         }
+
+
     }
     public synchronized Integer jarGetStartStaNo(Integer staNo) {
         try {
-            int[] jarNos=new int[]{4,2,3,1};//(607鍒嗛厤纭寲缃�)
+            int[] jarNos=new int[]{3,1,4,2};//(607鍒嗛厤纭寲缃�)
             ArrayList<Integer> staNos = new ArrayList<Integer>() {{
                 add(607);add(608);add(609);add(610);add(611);add(612);
                 add(613);add(614);add(615);add(616);add(617);add(618);
                 add(619);add(620);add(621);add(622);
             }};
             ArrayList<Integer> jarNoList = new ArrayList<>();
+            ArrayList<Integer> jarNoList1 = new ArrayList<>();
             ArrayList<Integer> jarNoListNow = new ArrayList<>();
             for (int jarNo : jarNos) {
                 List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarNo, new ArrayList<Integer>() {{
@@ -8155,10 +8615,38 @@
                     jarNoList.add(jarNo);
                 }
             }
-            jarNoList.add(4);
-            jarNoList.add(2);
-            jarNoList.add(3);
-            jarNoList.add(1);
+            for (int jarNo : jarNos) {
+                if (!jarNoList.contains(jarNo)){
+                    jarNoList1.add(jarNo);
+                }
+            }
+            for (int jarNo : jarNoList1) {
+                List<BasJarMast> jarMastByJarIdAndStatusList = basJarMastService.getJarMastByJarIdAndStatusList(8, jarNo);
+                if (jarMastByJarIdAndStatusList.isEmpty()){
+                    jarNoList.add(jarNo);
+                }
+            }
+            jarNoList1 = new ArrayList<Integer>();
+            for (int jarNo : jarNos) {
+                if (!jarNoList.contains(jarNo)){
+                    jarNoList1.add(jarNo);
+                }
+            }
+            for (int jarNo : jarNoList1) {
+                List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarNo, new ArrayList<Integer>() {{
+                    add(5);
+                    add(6);
+                    add(7);
+                    add(8);
+                    add(9);
+                    add(13);
+                    add(14);
+                    add(15);
+                }});
+                if (basJarMastList.isEmpty()){
+                    jarNoList.add(jarNo);
+                }
+            }
             for (int jarNo : jarNoList) {
                 if (jarNoListNow.contains(jarNo)){
                     continue;
@@ -8175,7 +8663,7 @@
                 if (jarProtocol.statusType .equals(JarStatusType.SOS)){
                     continue;
                 }
-                if (jarProtocol.getJarTemperature()>50){
+                if (jarProtocol.getJarTemperature()>jarTemperature){
                     log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
                     continue;
                 }

--
Gitblit v1.9.1