From 7400211f1ceecea0048ff3f5adfeeb8fe975bc7a Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期三, 19 三月 2025 11:01:53 +0800
Subject: [PATCH] #初始化地图

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 1069 +++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 599 insertions(+), 470 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 af23280..51ac5cc 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -156,24 +156,26 @@
                     errMsg = "鎵爜澶辫触";
                     back = true;
                 }
+
                 // 閫�鍥�
                 if (back) {
+                    log.info("errmsg: " + errMsg);
 //                        News.warn("鎵爜鍏ュ簱澶辫触锛寋}鍏ュ簱绔欏洜{}寮傚父锛屾墭鐩樺凡琚��鍥�", inSta.getStaNo(), errMsg);
                     MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
 
-                    if (!staProtocol.isLoading()){
+                    if (!staProtocol.isLoading()) {
                         continue;
                     }
                     if (!staProtocol.isPakMk()) {
                         continue;
                     }
                     staProtocol.setWorkNo(wrkNo);
-                    News.info("{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", inSta.getStaNo(), errMsg,wrkNo);
+                    News.info("{}PLC鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", inSta.getStaNo(), errMsg, wrkNo);
                     wrkNo++;
                     staProtocol.setStaNo(inSta.getBackSta().shortValue());
                     devpThread.setPakMk(staProtocol.getSiteId(), false);
                     MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                    log.error("杈撻�佺嚎涓嬪彂1锛�"+wrkNo+","+inSta.getBackSta());
+                    log.error("杈撻�佺嚎涓嬪彂1锛�" + wrkNo + "," + inSta.getBackSta());
                 }
 
                 // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
@@ -182,52 +184,53 @@
                         && staProtocol.isInEnable()
                         && !staProtocol.isEmptyMk()
                         && staProtocol.isPakMk()) {
-                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) {
+                    if (Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) {
                         News.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
 
                         staProtocol.setWorkNo(wrkNo);
-                        News.info("{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", inSta.getStaNo(), errMsg,wrkNo);
+                        News.info("{}barcode鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", inSta.getStaNo(), errMsg, wrkNo);
                         wrkNo++;
                         staProtocol.setStaNo(inSta.getBackSta().shortValue());
                         devpThread.setPakMk(staProtocol.getSiteId(), false);
                         MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                        log.error("杈撻�佺嚎涓嬪彂1锛�"+wrkNo+","+inSta.getBackSta());
+                        log.error("杈撻�佺嚎涓嬪彂1锛�" + wrkNo + "," + inSta.getBackSta());
                         continue;
                     }
                     // 鍒ゆ柇閲嶅宸ヤ綔妗�
                     WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
                     if (wrkMast != null) {
-                        int wrkNo1 = basDevpService.selectCount(new EntityWrapper<BasDevp>().eq("wrk_no", wrkMast.getWrkNo()));
-                        if (wrkNo1 != 0){
-                            News.error(barcode + "鏉$爜宸插瓨鍦ㄧ姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,璇锋煡鐪媁CS杈撻�佺嚎鐣岄潰,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
-                            if (ledThread != null) {
-                                News.error(methodName + ":鎵爜澶辫触锛岃閲嶈瘯");
-                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, barcode + "鏉$爜宸插瓨鍦ㄧ姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑浠诲姟,宸ヤ綔鍙�="+ wrkMast.getWrkNo()));
-                            }
-                            continue;
-                        }
-                        barcodeThread.setBarcode("");
-                        staProtocol.setWorkNo(wrkMast.getWrkNo());
-                        staProtocol.setStaNo(RouteUtils.SouStaEnd(null,wrkMast.getSourceStaNo()));
-                        devpThread.setPakMk(staProtocol.getSiteId(), false);
-                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                        log.info("杈撻�佺嚎涓嬪彂(瀛樺湪璁惧涓婅蛋鐨勫伐浣滄。锛岀洿鎺ヤ笅鍙戯紒))锛�"+wrkMast.getWrkNo()+","+wrkMast.getStaNo());
-
-                        ledThread.errorReset();
-                        log.info("缁勬墭璇锋眰鍚嶭ED閿欒娓呴櫎");
-
-                        if (!result) {
-                            News.error(methodName + ":鏇存柊plc绔欑偣淇℃伅澶辫触");
-                            log.error("杈撻�佺嚎涓嬪彂(瀛樺湪璁惧涓婅蛋鐨勫伐浣滄。锛岀洿鎺ヤ笅鍙戯紒)==>鏇存柊plc绔欑偣淇℃伅澶辫触");
-
-//                            throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
-                            continue;
-                        }
+//                        int wrkNo1 = basDevpService.selectCount(new EntityWrapper<BasDevp>().eq("wrk_no", wrkMast.getWrkNo()));
+//                        if (wrkNo1 != 0){
+//                            if (ledThread != null) {
+//                                News.error(methodName + ":鎵爜澶辫触锛岃閲嶈瘯");
+//                            }
+//
+//                        }
+                        News.error(barcode + "鏉$爜宸插瓨鍦ㄧ姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,璇锋煡鐪媁CS杈撻�佺嚎鐣岄潰,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
+                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, barcode + "鏉$爜宸插瓨鍦ㄧ姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑浠诲姟,宸ヤ綔鍙�=" + wrkMast.getWrkNo()));
+                        continue;
+//                        barcodeThread.setBarcode("");
+//                        staProtocol.setWorkNo(wrkMast.getWrkNo());
+//                        staProtocol.setStaNo(RouteUtils.SouStaEnd(null,wrkMast.getSourceStaNo()));
+//                        devpThread.setPakMk(staProtocol.getSiteId(), false);
+//                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+//                        log.info("杈撻�佺嚎涓嬪彂(瀛樺湪璁惧涓婅蛋鐨勫伐浣滄。锛岀洿鎺ヤ笅鍙戯紒))锛�"+wrkMast.getWrkNo()+","+wrkMast.getStaNo());
+//
+//                        ledThread.errorReset();
+//                        log.info("缁勬墭璇锋眰鍚嶭ED閿欒娓呴櫎");
+//
+//                        if (!result) {
+//                            News.error(methodName + ":鏇存柊plc绔欑偣淇℃伅澶辫触");
+//                            log.error("杈撻�佺嚎涓嬪彂(瀛樺湪璁惧涓婅蛋鐨勫伐浣滄。锛岀洿鎺ヤ笅鍙戯紒)==>鏇存柊plc绔欑偣淇℃伅澶辫触");
+//
+////                            throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+//                            continue;
+//                        }
 
                     }
                     WrkMast checkPick = wrkMastService.selectOne(new EntityWrapper<WrkMast>()
                             .eq("barcode", barcode)
-                            .in("io_type", 107,103,57));
+                            .in("io_type", 107, 103, 57));
                     if (!Cools.isEmpty(checkPick)) {
                         continue;
                     }
@@ -240,6 +243,7 @@
                         param.setSourceStaNo(inSta.getStaNo());
                         param.setLocType1(locTypeDto.getLocType1());
                         String response = new HttpHandler.Builder()
+                                .setTimeout(30,TimeUnit.SECONDS)
                                 .setUri(wmsUrl)
                                 .setPath("/rpc/pakin/loc/v1")
                                 .setJson(JSON.toJSONString(param))
@@ -250,10 +254,11 @@
                             StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                             barcodeThread.setBarcode("");
                             staProtocol.setWorkNo(dto.getWorkNo());
-                            staProtocol.setStaNo(RouteUtils.SouStaEnd(dto.getStaNo(),dto.getSourceStaNo()));
+                            //staProtocol.setStaNo(RouteUtils.SouStaEnd(dto.getStaNo(),dto.getSourceStaNo()));
+                            staProtocol.setStaNo(dto.getStaNo().shortValue());
                             devpThread.setPakMk(staProtocol.getSiteId(), false);
                             boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                            log.error("杈撻�佺嚎涓嬪彂2锛�"+dto.getWorkNo()+","+dto.getStaNo());
+                            log.error("杈撻�佺嚎涓嬪彂2锛�" + dto.getWorkNo() + "," + dto.getStaNo());
 
                             ledThread.errorReset();
                             log.error("缁勬墭璇锋眰鍚嶭ED閿欒娓呴櫎");
@@ -264,6 +269,30 @@
                                 throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
                             }
                         } else {
+                            if (jsonObject.getString("msg").equals("宸ヤ綔妗e凡瀛樺湪")) {
+
+                                //宸ヤ綔妗e凡瀛樺湪    鍐嶆杩涘幓
+//                                wrkMast = wrkMastMapper.selectPakInStepBarcode(barcode);
+//                                if (wrkMast != null) {
+//                                    barcodeThread.setBarcode("");
+//                                    staProtocol.setWorkNo(9999);
+//                                    //staProtocol.setWorkNo(wrkMast.getWrkNo());
+//                                    //staProtocol.setStaNo(RouteUtils.SouStaEnd(dto.getStaNo(),dto.getSourceStaNo()));
+//                                    staProtocol.setStaNo(inSta.getBackSta().shortValue());
+//                                    devpThread.setPakMk(staProtocol.getSiteId(), false);
+//                                    boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+//                                    log.error("杈撻�佺嚎涓嬪彂2锛�" + wrkMast.getWrkNo() + "," + wrkMast.getStaNo());
+//                                    ledThread.errorReset();
+//                                    log.error("缁勬墭璇锋眰鍚嶭ED閿欒娓呴櫎");
+//                                    if (!result) {
+//                                        News.error(methodName + ":鏇存柊plc绔欑偣淇℃伅澶辫触");
+//
+//                                        throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+//                                    }
+//                                }
+
+                                continue;
+                            }
                             staProtocol.setWorkNo(wrkNo);
                             wrkNo++;
                             staProtocol.setStaNo(inSta.getBackSta().shortValue());
@@ -271,10 +300,10 @@
                             MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
 //
 //                            if (ledThread != null) {
-                                String errorMsg = jsonObject.getString("msg");
-                                if (!Cools.isEmpty(errorMsg)) {
-                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
-                                }
+                            String errorMsg = jsonObject.getString("msg");
+                            if (!Cools.isEmpty(errorMsg)) {
+                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
+                            }
 //                            }
 //                            News.error(methodName + ":璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
                         }
@@ -318,13 +347,13 @@
                 }
 
                 // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
-                if (!staProtocol.isLoading()){
+                if (!staProtocol.isLoading()) {
                     continue;
                 }
                 if (staProtocol.isAutoing() && staProtocol.isInEnable()
                         && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() == 9999)
                         && staProtocol.isPakMk()) {
-                    News.warnNoLog(""+mark+" - 0"+" - 寮�濮嬫墽琛�");
+                    News.warnNoLog("" + mark + " - 0" + " - 寮�濮嬫墽琛�");
                     // 鍒ゆ柇閲嶅宸ヤ綔妗�
                     WrkMast wrkMast = wrkMastMapper.selectPakInStep11(inSta.getStaNo());
                     if (wrkMast == null) {
@@ -338,22 +367,22 @@
                     staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
                     devpThread.setPakMk(staProtocol.getSiteId(), false);
                     boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                    log.error("杈撻�佺嚎涓嬪彂3锛�"+wrkMast.getWrkNo()+","+wrkMast.getStaNo());
+                    log.error("杈撻�佺嚎涓嬪彂3锛�" + wrkMast.getWrkNo() + "," + wrkMast.getStaNo());
                     if (result) {
                         // 鏇存柊宸ヤ綔涓绘。
                         wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵�侊細2.璁惧涓婅蛋
                         wrkMast.setModiTime(new Date());
                         if (wrkMastMapper.updateById(wrkMast) == 0) {
-                            News.error(""+mark+" - 1"+" - 鏇存柊宸ヤ綔妗eけ璐ワ紒锛侊紒 [宸ヤ綔鍙凤細{}]", wrkMast.getWrkNo());
+                            News.error("" + mark + " - 1" + " - 鏇存柊宸ヤ綔妗eけ璐ワ紒锛侊紒 [宸ヤ綔鍙凤細{}]", wrkMast.getWrkNo());
                         }
                     } else {
-                        News.error(""+mark+" - 2"+" - 鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
+                        News.error("" + mark + " - 2" + " - 鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
                     }
 
-                }else {
-                    News.errorNoLog(""+mark+" - 6"+" - 绔欑偣淇℃伅涓嶇鍚堝叆搴撴潯浠讹紒锛侊紒"+" 鑷姩淇″彿锛�"+staProtocol.isLoading()+"銆佸彲鍏ヤ俊鍙凤細" + staProtocol.isInEnable()
-                            +"銆佺┖鏉夸俊鍙凤細"+ staProtocol.isEmptyMk()+"銆佸伐浣滃彿锛�" + staProtocol.getWorkNo()
-                            +"銆侀攣瀹氭爣璁�"+ staProtocol.isPakMk()+"銆佸叆搴撳嵃璁帮細" + staProtocol.getStamp());
+                } else {
+                    News.errorNoLog("" + mark + " - 6" + " - 绔欑偣淇℃伅涓嶇鍚堝叆搴撴潯浠讹紒锛侊紒" + " 鑷姩淇″彿锛�" + staProtocol.isLoading() + "銆佸彲鍏ヤ俊鍙凤細" + staProtocol.isInEnable()
+                            + "銆佺┖鏉夸俊鍙凤細" + staProtocol.isEmptyMk() + "銆佸伐浣滃彿锛�" + staProtocol.getWorkNo()
+                            + "銆侀攣瀹氭爣璁�" + staProtocol.isPakMk() + "銆佸叆搴撳嵃璁帮細" + staProtocol.getStamp());
                 }
             }
         }
@@ -374,18 +403,93 @@
                     continue;
                 }
                 String barcode = barcodeThread.getBarcode();
-                if(!Cools.isEmpty(barcode)) {
-//                    News.info(""+mark+" - 1"+" - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
-                    if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+                // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
+                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+
+                StaProtocol staProtocol = devpThread.getStation().get(pickSta.getStaNo());
+
+                if(staProtocol == null) {
+                    News.error("绔欑偣淇℃伅鏈幏寰�");
+                    continue;
+                }
+                // 灏哄妫�娴嬪紓甯�
+                boolean back = false;
+                String errMsg = "";
+                if (!back && staProtocol.isFrontErr()) {
+                    errMsg = "鍓嶈秴闄�";
+                    back = true;
+                }
+                if (!back && staProtocol.isBackErr()) {
+                    errMsg = "鍚庤秴闄�";
+                    back = true;
+                }
+                if (!back && staProtocol.isHighErr()) {
+                    errMsg = "楂樿秴闄�";
+                    back = true;
+                }
+                if (!back && staProtocol.isLeftErr()) {
+                    errMsg = "宸﹁秴闄�";
+                    back = true;
+                }
+                if (!back && staProtocol.isRightErr()) {
+                    errMsg = "鍙宠秴闄�";
+                    back = true;
+                }
+                if (!back && staProtocol.isWeightErr()) {
+                    errMsg = "瓒呴噸";
+                    back = true;
+                }
+                if (!back && staProtocol.isBarcodeErr()) {
+                    errMsg = "鎵爜澶辫触";
+                    back = true;
+                }
+
+                // 閫�鍥�
+                if (back) {
+                    log.info("errmsg: " + errMsg);
+//                        News.warn("鎵爜鍏ュ簱澶辫触锛寋}鍏ュ簱绔欏洜{}寮傚父锛屾墭鐩樺凡琚��鍥�", inSta.getStaNo(), errMsg);
+                    MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(5, errMsg));
+                    if (!staProtocol.isLoading()) {
+                        continue;
+                    }
+                    if (!staProtocol.isPakMk()) {
+                        continue;
+                    }
+                    staProtocol.setWorkNo(wrkNo);
+                    News.info("{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", pickSta.getStaNo(), errMsg, wrkNo);
+                    wrkNo++;
+                    staProtocol.setStaNo(pickSta.getBackSta().shortValue());
+                    devpThread.setPakMk(staProtocol.getSiteId(), false);
+                    MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+                    log.error("杈撻�佺嚎涓嬪彂1锛�" + 9999 + "," + pickSta.getBackSta());
+                    LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
+
+                    // led 寮傚父鏄剧ず
+                    if (ledThread != null) {
+                        MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(5, errMsg));
+                    }
+                    continue;
+                }
+                if (!Cools.isEmpty(barcode)) {
+                    News.infoNoLog("" + mark + " - 1" + " - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
+                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
                         continue;
                     }
                 } else {
                     continue;
                 }
 
-                // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
-                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
-                StaProtocol staProtocol = devpThread.getStation().get(pickSta.getStaNo());
+
+                if (!Cools.isEmpty(barcode)) {
+//                    News.info(""+mark+" - 1"+" - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
+                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+                        continue;
+                    }
+                } else {
+                    continue;
+                }
+
+
                 if (staProtocol == null) {
                     continue;
                 } else {
@@ -396,7 +500,7 @@
 //                if (devpThread.ioMode != IoModeType.PAKIN_MODE) { continue; }
 
                 if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()) {
-                    News.warnNoLog(""+mark+" - 0"+" - 寮�濮嬫墽琛�");
+                    News.warnNoLog("" + mark + " - 0" + " - 寮�濮嬫墽琛�");
                     WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
 //                    WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
                     if (wrkMast == null) {
@@ -424,17 +528,17 @@
                             .eq("crn_no", wrkMast.getCrnNo()); // 鍫嗗灈鏈哄彿
                     StaDesc staDesc = staDescService.selectOne(wrapper);
                     if (Cools.isEmpty(staDesc)) {
-                        News.error(""+mark+" - 2"+" - 鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
+                        News.error("" + mark + " - 2" + " - 鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
                         staProtocol.setWorkNo(wrkNo++);
-                        staProtocol.setStaNo((short) (pickSta.getStaNo().shortValue()-(short)1));
+                        staProtocol.setStaNo((short) (pickSta.getStaNo().shortValue() - (short) 1));
                         devpThread.setPakMk(staProtocol.getSiteId(), false);
                         MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                        log.error("杈撻�佺嚎涓嬪彂4锛�"+9989+","+(pickSta.getStaNo().shortValue()-(short)1));
+                        log.error("杈撻�佺嚎涓嬪彂4锛�" + 9989 + "," + (pickSta.getStaNo().shortValue() - (short) 1));
                         //LED
                         LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
                         // led 寮傚父鏄剧ず
                         if (ledThread != null) {
-                            String errorMsg = "姝や负鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱.璇锋斁鍦�"+pickSta.getBackSta().shortValue()+"绔欑偣";
+                            String errorMsg = "姝や负鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱.璇锋斁鍦�" + pickSta.getBackSta().shortValue() + "绔欑偣";
                             MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
                         }
                         continue;
@@ -482,17 +586,17 @@
 
                     // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
                     staProtocol.setWorkNo(wrkMast.getWrkNo());
-                    staProtocol.setStaNo((short) 161);
+                    staProtocol.setStaNo(Short.valueOf(wrkMast.getStaNo().toString()));
                     devpThread.setPakMk(staProtocol.getSiteId(), false);
                     boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                    log.error("杈撻�佺嚎涓嬪彂5锛�"+wrkMast.getWrkNo()+","+wrkMast.getStaNo());
+                    log.error("杈撻�佺嚎涓嬪彂5锛�" + wrkMast.getWrkNo() + "," + wrkMast.getStaNo());
                     if (!result) {
-                        News.error(""+mark+" - 3"+" - 鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
+                        News.error("" + mark + " - 3" + " - 鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
                     }
 
-                }else {
-                    News.errorNoLog(""+mark+" - 6"+" - 绔欑偣淇℃伅涓嶇鍚堝叆搴撴潯浠讹紒锛侊紒"+" 鑷姩淇″彿锛�"+staProtocol.isLoading()+"銆佸彲鍏ヤ俊鍙凤細" + staProtocol.isInEnable()
-                            +"銆佺┖鏉夸俊鍙凤細"+ staProtocol.isEmptyMk());
+                } else {
+                    News.errorNoLog("" + mark + " - 6" + " - 绔欑偣淇℃伅涓嶇鍚堝叆搴撴潯浠讹紒锛侊紒" + " 鑷姩淇″彿锛�" + staProtocol.isLoading() + "銆佸彲鍏ヤ俊鍙凤細" + staProtocol.isInEnable()
+                            + "銆佺┖鏉夸俊鍙凤細" + staProtocol.isEmptyMk());
                 }
 
             }
@@ -503,7 +607,7 @@
 
 
     //鐩樼偣鍐嶅叆搴�
-    public synchronized void stnToCrnStnPick2(){
+    public synchronized void stnToCrnStnPick2() {
         for (DevpSlave devp : slaveProperties.getDevp()) {
             // 閬嶅巻鎷f枡鍏ュ簱鍙�
             for (DevpSlave.Sta pickSta : devp.getPickSta()) {
@@ -520,7 +624,7 @@
                         && staProtocol.isInEnable()
                         && !staProtocol.isEmptyMk()
 //                        && staProtocol.getWorkNo() > 0
-                        && staProtocol.isPakMk()){
+                        && staProtocol.isPakMk()) {
 
                     // 鑾峰彇鏉$爜鎵弿浠俊鎭�
                     BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
@@ -528,9 +632,9 @@
                         continue;
                     }
                     String barcode = barcodeThread.getBarcode();
-                    if(!Cools.isEmpty(barcode)) {
+                    if (!Cools.isEmpty(barcode)) {
 //                        log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
-                        if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
+                        if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
                             staProtocol.setWorkNo(wrkNo++);
                             staProtocol.setStaNo(pickSta.getBackSta().shortValue());
                             devpThread.setPakMk(staProtocol.getSiteId(), false);
@@ -582,14 +686,14 @@
                         param.setBarcode(barcode);
                         param.setIoType(107);
                         param.setSourceStaNo(pickSta.getStaNo()); //浣滀笟绔欑偣
-                        if (!Cools.isEmpty(locMast)){
+                        if (!Cools.isEmpty(locMast)) {
                             param.setLocType1(locMast.getLocType1());
-                        }else {
+                        } else {
                             param.setLocType1(locTypeDto.getLocType1());
                         }
 
                         String response = "";
-                        log.info("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
+                        log.info("鍏ュ簱浣滀笟绔�" + pickSta.getStaNo() + "鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
                         try {
                             response = new HttpHandler.Builder()
                                     .setUri(wmsUrl)
@@ -598,15 +702,15 @@
 //                                    .setTimeout(15, TimeUnit.SECONDS)
                                     .build()
                                     .doPost();
-                        } catch(Exception e){
-                            log.error("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
+                        } catch (Exception e) {
+                            log.error("鍏ュ簱浣滀笟绔�" + pickSta.getStaNo() + "鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
                             log.error("stnToCrnStnPick2===>>鐩樼偣鏌ュ簱浣嶅叆搴撴帴鍙eけ璐�", e);
                             e.printStackTrace();
                             continue;
                         }
-                        log.info("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
-                        log.info("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"涓嬪彂鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS杩斿洖缁撴灉===>>" + response);
-                        if(response.equals("")) {
+                        log.info("鍏ュ簱浣滀笟绔�" + pickSta.getStaNo() + "鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
+                        log.info("鍏ュ簱浣滀笟绔�" + pickSta.getStaNo() + "涓嬪彂鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS杩斿洖缁撴灉===>>" + response);
+                        if (response.equals("")) {
                             continue;
                         }
                         JSONObject jsonObject = JSON.parseObject(response);
@@ -615,20 +719,20 @@
                         if (code == 200) {
                             StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                             if (Cools.isEmpty(dto) || Cools.isEmpty(dto.getStaNo())) {
-                                log.error("浠诲姟鍙�"+wrkMast.getWrkNo()+"鐩樼偣鍐嶅叆搴撴煡璇㈠簱浣嶅け璐�===>>" + jsonObject.toJSONString());
+                                log.error("浠诲姟鍙�" + wrkMast.getWrkNo() + "鐩樼偣鍐嶅叆搴撴煡璇㈠簱浣嶅け璐�===>>" + jsonObject.toJSONString());
                             } else {
-                                log.info("浠诲姟鍙�"+wrkMast.getWrkNo()+"鐩樼偣鍐嶅叆搴撴煡璇㈠簱浣嶆垚鍔�===>>" + jsonObject.toJSONString());
+                                log.info("浠诲姟鍙�" + wrkMast.getWrkNo() + "鐩樼偣鍐嶅叆搴撴煡璇㈠簱浣嶆垚鍔�===>>" + jsonObject.toJSONString());
                                 try {
                                     // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
                                     staProtocol.setWorkNo(wrkMast.getWrkNo());
-                                    staProtocol.setStaNo((short)161);
+                                    staProtocol.setStaNo(Short.valueOf(dto.getStaNo().toString()));
                                     devpThread.setPakMk(staProtocol.getSiteId(), false);
 
                                     boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                                     if (!result) {
                                         log.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
                                     }
-                                    log.info("浠诲姟鍙�"+wrkMast.getWrkNo()+"鐩樼偣鍐嶅叆搴撲换鍔′笅鍙戞垚鍔�===>>" + staProtocol);
+                                    log.info("浠诲姟鍙�" + wrkMast.getWrkNo() + "鐩樼偣鍐嶅叆搴撲换鍔′笅鍙戞垚鍔�===>>" + staProtocol);
 
                                     ledThread.errorReset();
                                     log.error("鐩樼偣鍚巐ed閿欒鍒犻櫎");
@@ -708,12 +812,12 @@
 
                         // 涓嬪彂绔欑偣淇℃伅
                         staProtocol.setWorkNo(wrkMast.getWrkNo());
-                        staProtocol.setStaNo(RouteUtils.CrnStaEnd(wrkMast.getStaNo(),wrkMast.getSourceStaNo()));
+                        staProtocol.setStaNo(RouteUtils.CrnStaEnd(wrkMast.getStaNo(), wrkMast.getSourceStaNo()));
                         if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol))) {
-                            log.info(staProtocol.getWorkNo()+","+staProtocol.getStaNo()+"杈撻�佺嚎鍑哄簱鍛戒护涓嬪彂澶辫触");
+                            log.info(staProtocol.getWorkNo() + "," + staProtocol.getStaNo() + "杈撻�佺嚎鍑哄簱鍛戒护涓嬪彂澶辫触");
                             continue;
-                        }else {
-                            log.info(staProtocol.getWorkNo()+","+staProtocol.getStaNo()+"杈撻�佺嚎鍑哄簱鍛戒护涓嬪彂鎴愬姛");
+                        } else {
+                            log.info(staProtocol.getWorkNo() + "," + staProtocol.getStaNo() + "杈撻�佺嚎鍑哄簱鍛戒护涓嬪彂鎴愬姛");
                         }
 
                         // 鏇存柊宸ヤ綔妗g姸鎬佷负14澶辫触
@@ -724,15 +828,15 @@
                             log.error("鍑哄簱浠诲姟瀹屾垚涓嬪彂鍫嗗灈鏈哄浣�,{}", wrkMast.getWrkNo());
                             crnThread.setResetFlag(true);
                         } else {
-                            News.error(""+mark+" - 1"+" - 鏇存柊宸ヤ綔妗g殑宸ヤ綔鐘舵�佷负14澶辫触锛侊紒锛� [宸ヤ綔鍙�:{}]", wrkMast.getWrkNo());
+                            News.error("" + mark + " - 1" + " - 鏇存柊宸ヤ綔妗g殑宸ヤ綔鐘舵�佷负14澶辫触锛侊紒锛� [宸ヤ綔鍙�:{}]", wrkMast.getWrkNo());
                         }
 
-                    }else {
-                        News.errorNoLog(""+mark+" - 6"+" - 鍫嗗灈鏈轰俊鎭笉绗﹀悎鍏ュ簱鏉′欢锛侊紒锛�"
-                                +" 鍫嗗灈鏈虹姸鎬侊細"+crnProtocol.modeType+"==鑷姩AUTO锛�" + CrnModeType.AUTO
-                                +"銆佸爢鍨涙満浠诲姟鍙凤細"+crnProtocol.getTaskNo()+"==宸ヤ綔妗d换鍔″彿锛�" + wrkMast.getWrkNo().shortValue()
-                                +"銆佺姸鎬佹灇涓撅細"+crnProtocol.statusType+"==WAITING锛�90 //浠诲姟瀹屾垚绛夊緟WCS纭)锛�" + CrnStatusType.WAITING
-                                +"銆佽揣鍙変綅缃細"+crnProtocol.forkPosType+"==HOME锛�0  // 璐у弶鍘熶綅锛�" + CrnForkPosType.HOME);
+                    } else {
+                        News.errorNoLog("" + mark + " - 6" + " - 鍫嗗灈鏈轰俊鎭笉绗﹀悎鍏ュ簱鏉′欢锛侊紒锛�"
+                                + " 鍫嗗灈鏈虹姸鎬侊細" + crnProtocol.modeType + "==鑷姩AUTO锛�" + CrnModeType.AUTO
+                                + "銆佸爢鍨涙満浠诲姟鍙凤細" + crnProtocol.getTaskNo() + "==宸ヤ綔妗d换鍔″彿锛�" + wrkMast.getWrkNo().shortValue()
+                                + "銆佺姸鎬佹灇涓撅細" + crnProtocol.statusType + "==WAITING锛�90 //浠诲姟瀹屾垚绛夊緟WCS纭)锛�" + CrnStatusType.WAITING
+                                + "銆佽揣鍙変綅缃細" + crnProtocol.forkPosType + "==HOME锛�0  // 璐у弶鍘熶綅锛�" + CrnForkPosType.HOME);
                     }
 
                 }
@@ -755,7 +859,7 @@
             }
             BasCrnp basCrnp = basCrnpService.selectById(crn.getId());
             if (basCrnp == null) {
-                News.error(""+mark+" - 1"+" - {}鍙峰爢鍨涙満灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�", crn.getId());
+                News.error("" + mark + " - 1" + " - {}鍙峰爢鍨涙満灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�", crn.getId());
                 continue;
             }
 
@@ -767,33 +871,33 @@
             // 鍙湁褰撳爢鍨涙満绌洪棽 骞朵笖 鏃犱换鍔℃椂鎵嶇户缁墽琛�
             if (crnProtocol.getStatusType() == CrnStatusType.IDLE && crnProtocol.getTaskNo() == 0 && crnProtocol.getModeType() == CrnModeType.AUTO
                     && crnProtocol.getLoaded() == 0 && crnProtocol.getForkPos() == 0) {
-                News.warnNoLog(""+mark+" - 0"+" - 寮�濮嬫墽琛屽爢鍨涙満鍏ュ嚭搴撲綔涓氫笅鍙�");
+                News.warnNoLog("" + mark + " - 0" + " - 寮�濮嬫墽琛屽爢鍨涙満鍏ュ嚭搴撲綔涓氫笅鍙�");
                 // 濡傛灉鏈�杩戜竴娆℃槸鍏ュ簱妯″紡
                 if (crnProtocol.getLastIo().equals("I")) {
                     if (basCrnp.getInEnable().equals("Y")) {
                         //mark - 1 - ....
-                        this.crnStnToLoc(crn, crnProtocol,mark); //  鍏ュ簱
+                        this.crnStnToLoc(crn, crnProtocol, mark); //  鍏ュ簱
                         crnProtocol.setLastIo("O");
                     } else if (basCrnp.getOutEnable().equals("Y")) {
                         //mark - 2 - ....
-                        this.locToCrnStn(crn, crnProtocol,mark); //  鍑哄簱
+                        this.locToCrnStn(crn, crnProtocol, mark); //  鍑哄簱
                         crnProtocol.setLastIo("I");
                     }
                 }
                 // 濡傛灉鏈�杩戜竴娆℃槸鍑哄簱妯″紡
                 else if (crnProtocol.getLastIo().equals("O")) {
                     if (basCrnp.getOutEnable().equals("Y")) {
-                        this.locToCrnStn(crn, crnProtocol,mark); //  鍑哄簱
+                        this.locToCrnStn(crn, crnProtocol, mark); //  鍑哄簱
                         crnProtocol.setLastIo("I");
                     } else if (basCrnp.getInEnable().equals("Y")) {
-                        this.crnStnToLoc(crn, crnProtocol,mark); //  鍏ュ簱
+                        this.crnStnToLoc(crn, crnProtocol, mark); //  鍏ュ簱
                         crnProtocol.setLastIo("O");
                     }
                 }
             }
             // 搴撲綅绉昏浆
             //mark - 3 - ....
-            this.locToLoc(crn, crnProtocol,mark);
+            this.locToLoc(crn, crnProtocol, mark);
 //            this.crnRebackHp(crnProtocol, crnThread);
 
         }
@@ -859,15 +963,15 @@
     /**
      * 鍏ュ簱  ===>>  鍫嗗灈鏈虹珯鍒板簱浣�
      */
-    public synchronized void crnStnToLoc(CrnSlave slave, CrnProtocol crnProtocol,Integer mark) {
-        News.warnNoLog(""+mark+" - 1"+" - 0"+" - 鍫嗗灈鏈哄叆鍑哄簱浣滀笟涓嬪彂锛氭墽琛屽叆搴�");
+    public synchronized void crnStnToLoc(CrnSlave slave, CrnProtocol crnProtocol, Integer mark) {
+        News.warnNoLog("" + mark + " - 1" + " - 0" + " - 鍫嗗灈鏈哄叆鍑哄簱浣滀笟涓嬪彂锛氭墽琛屽叆搴�");
         for (CrnSlave.CrnStn crnStn : slave.getCrnInStn()) {
             boolean flag = false;
             // 鑾峰彇鍫嗗灈鏈哄叆搴撶珯淇℃伅
             DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId());
             StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo());
             if (staProtocol == null) {
-                News.infoNoLog(""+mark+" - 1"+" - 1"+" - 鍫嗗灈鏈哄叆搴撶珯淇℃伅(staProtocol!=null缁х画鎵ц)锛歴taProtocol="+staProtocol);
+                News.infoNoLog("" + mark + " - 1" + " - 1" + " - 鍫嗗灈鏈哄叆搴撶珯淇℃伅(staProtocol!=null缁х画鎵ц)锛歴taProtocol=" + staProtocol);
                 continue;
             } else {
                 staProtocol = staProtocol.clone();
@@ -875,7 +979,7 @@
             // 鏌ヨ绔欑偣璇︾粏淇℃伅
             BasDevp staDetl = basDevpService.selectById(crnStn.getStaNo());
             if (staDetl == null) {
-                News.error(""+mark+" - 1"+" - 2"+" - 鍏ュ簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
+                News.error("" + mark + " - 1" + " - 2" + " - 鍏ュ簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
                 continue;
             }
             if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable()
@@ -883,27 +987,27 @@
                 flag = true;
             }
             if (!flag) {
-                News.errorNoLog(""+mark+" - 1"+" - 3"+" - 鍫嗗灈鏈哄叆搴撶珯淇℃伅(浠ヤ笅闇�瑕佸叏true):"
-                        +"鑷姩淇″彿"+staProtocol.isAutoing()+"鏈夌墿淇″彿"+staProtocol.isLoading()
-                        +"宸ヤ綔鍙�>0"+staProtocol.getWorkNo()+"鍙叆淇″彿"+staProtocol.isInEnable()
-                        +"鑳藉叆淇″彿锛坵ms璁剧疆锛�.equals(\"Y\")"+staDetl.getCanining());
+                News.errorNoLog("" + mark + " - 1" + " - 3" + " - 鍫嗗灈鏈哄叆搴撶珯淇℃伅(浠ヤ笅闇�瑕佸叏true):"
+                        + "鑷姩淇″彿" + staProtocol.isAutoing() + "鏈夌墿淇″彿" + staProtocol.isLoading()
+                        + "宸ヤ綔鍙�>0" + staProtocol.getWorkNo() + "鍙叆淇″彿" + staProtocol.isInEnable()
+                        + "鑳藉叆淇″彿锛坵ms璁剧疆锛�.equals(\"Y\")" + staDetl.getCanining());
                 continue;
             }
             // 鑾峰彇宸ヤ綔鐘舵�佷负2锛堣澶囦笂璧帮級鐨勫叆搴撳伐浣滄。
             WrkMast wrkMast = wrkMastMapper.selectPakInStep2(slave.getId(), staProtocol.getWorkNo().intValue(), crnStn.getStaNo());
             if (null == wrkMast) {
-                News.infoNoLog(""+mark+" - 1"+" - 4"+" - 鏌ヨ鏃犲緟鍏ュ簱鏁版嵁--wrk_sts=2, 宸ヤ綔鍙�={}", staProtocol.getWorkNo());
+                News.infoNoLog("" + mark + " - 1" + " - 4" + " - 鏌ヨ鏃犲緟鍏ュ簱鏁版嵁--wrk_sts=2, 宸ヤ綔鍙�={}", staProtocol.getWorkNo());
 //                log.error("鏌ヨ鏃犲緟鍏ュ簱鏁版嵁--wrk_sts=2, 宸ヤ綔鍙�={}", staProtocol.getWorkNo());
                 continue;
             }
             // 鑾峰彇搴撲綅淇℃伅
             LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
             if (locMast == null) {
-                News.error(""+mark+" - 1"+" - 5"+" - 鏌ヨ搴撳瓨鏃犳暟鎹�--搴撲綅鍙穥}", wrkMast.getLocNo());
+                News.error("" + mark + " - 1" + " - 5" + " - 鏌ヨ搴撳瓨鏃犳暟鎹�--搴撲綅鍙穥}", wrkMast.getLocNo());
                 continue;
             }
             if (!locMast.getLocSts().equals("S") && !locMast.getLocSts().equals("Q")) {
-                News.error(""+mark+" - 1"+" - 6"+" - 鍏ュ簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMast.getLocNo(), locMast.getLocSts());
+                News.error("" + mark + " - 1" + " - 6" + " - 鍏ュ簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMast.getLocNo(), locMast.getLocSts());
                 continue;
             }
 
@@ -918,51 +1022,51 @@
                 continue;
             }
 
-            // 鍙屾繁搴撲綅涓旀祬搴撲綅鏈夎揣锛屽垯闇�鍏堝娴呭簱浣嶈繘琛屽簱浣嶇Щ杞�
-            if (Utils.isDeepLoc(slaveProperties, wrkMast.getLocNo())) {
-                News.warnNoLog(""+mark+" - 1"+" - 8"+" - 鍙屾繁搴撲綅涓旀祬搴撲綅鏈夎揣锛屽垯闇�鍏堝娴呭簱浣嶈繘琛屽簱浣嶇Щ杞� : 寮�濮嬫墽琛� 浠诲姟鍙�={}",wrkMast.getWrkNo());
-                String shallowLocNo = Utils.getShallowLoc(slaveProperties, wrkMast.getLocNo());
-                LocMast shallowLoc = locMastService.selectById(shallowLocNo);
-                // O.绌哄簱浣嶃�丵.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴撱�丼.鍏ュ簱棰勭害銆乆.绂佺敤 鐩存帴鎼紒
-                if (shallowLoc.getLocSts().equals("P") || shallowLoc.getLocSts().equals("R")) {
-                    News.warnNoLog(""+mark+" - 1"+" - 9"+" - // O.绌哄簱浣嶃�丵.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴撱�丼.鍏ュ簱棰勭害銆乆.绂佺敤 鐩存帴鎼紒搴撲綅鐘舵��={}",shallowLoc.getLocSts());
-                    WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
-                    if (null == waitWrkMast) {
-                        News.error(""+mark+" - 1"+" - 10"+" - {}搴撲綅寮傚父锛屾湭妫�绱㈠埌鐩稿簲宸ヤ綔妗o紒", shallowLocNo);
-                    } else {
-                        waitWrkMast.setIoPri(15D);
-                        waitWrkMast.setModiTime(new Date());
-                        if (wrkMastMapper.updateById(waitWrkMast) == 0) {
-                            News.error(""+mark+" - 1"+" - 11"+" - 璋冩暣宸ヤ綔妗d紭鍏堢骇澶辫触锛佸伐浣滃彿={}", waitWrkMast.getWrkNo());
-                        }
-                        continue;
-                    }
-
-                } else if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) {
-                    News.warnNoLog(""+mark+" - 1"+" - 12"+" - // F銆丏  搴撲綅鐘舵��={}",shallowLoc.getLocSts());
-                    // 姝ゆ爣璁伴伩鍏嶅娆℃墽琛岀Щ搴撲换鍔�
-                    if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())) {
-                        wrkMast.setUpdMk("Y");
-                        wrkMast.setIoPri(14D);
-                        wrkMastMapper.updateById(wrkMast);
-                        // 鐢熸垚宸ヤ綔妗�,灏嗘祬搴撲綅绉昏浆鍒版柊鐨勫簱浣嶄腑
-                        moveLocForDeepLoc(slave, shallowLoc,mark);
-                        // 鐢熸垚宸ヤ綔妗c�佹敼鍙樻祬搴撲綅鐨勬簮搴�/鐩爣搴� 搴撲綅鐘舵�併�佷笅鍙戝爢鍨涙満鍛戒护锛堢珛椹墽琛�)
-//                        moveLocForDeepLocPakin(slave, shallowLoc, wrkMast);
-                    }
-                    continue;
-                } else if (shallowLoc.getLocSts().equals("Q")) {
-                    News.warnNoLog(""+mark+" - 1"+" - 13"+" - // Q  搴撲綅鐘舵��={}",shallowLoc.getLocSts());
-                    WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
-                    if (null != waitWrkMast && waitWrkMast.getWrkSts() == 4) {
-                        News.infoNoLog(""+mark+" - 1"+" - 14"+" - // F銆丏  宸ヤ綔鐘舵��(鍒ゆ柇鏉′欢涓�==4)={}",waitWrkMast.getWrkSts());
-                        continue;
-                    }
-                }
-            }
-            News.warnNoLog(""+mark+" - 1"+" - 15"+" - 鍛戒护涓嬪彂 : 宸ヤ綔鍙�={},婧愭帓={},婧愬垪={},婧愬眰={},鐩爣鎺�={},鐩爣鍒�={},鐩爣灞�={}",wrkMast.getWrkNo().shortValue()
-                    ,crnStn.getRow().shortValue(),crnStn.getBay().shortValue(),crnStn.getLev().shortValue()
-                    ,locMast.getRow1().shortValue(),locMast.getBay1().shortValue(),locMast.getLev1().shortValue());
+//            // 鍙屾繁搴撲綅涓旀祬搴撲綅鏈夎揣锛屽垯闇�鍏堝娴呭簱浣嶈繘琛屽簱浣嶇Щ杞�
+//            if (Utils.isDeepLoc(slaveProperties, wrkMast.getLocNo())) {
+//                News.warnNoLog("" + mark + " - 1" + " - 8" + " - 鍙屾繁搴撲綅涓旀祬搴撲綅鏈夎揣锛屽垯闇�鍏堝娴呭簱浣嶈繘琛屽簱浣嶇Щ杞� : 寮�濮嬫墽琛� 浠诲姟鍙�={}", wrkMast.getWrkNo());
+//                String shallowLocNo = Utils.getShallowLoc(slaveProperties, wrkMast.getLocNo());
+//                LocMast shallowLoc = locMastService.selectById(shallowLocNo);
+//                // O.绌哄簱浣嶃�丵.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴撱�丼.鍏ュ簱棰勭害銆乆.绂佺敤 鐩存帴鎼紒
+//                if (shallowLoc.getLocSts().equals("P") || shallowLoc.getLocSts().equals("R")) {
+//                    News.warnNoLog("" + mark + " - 1" + " - 9" + " - // O.绌哄簱浣嶃�丵.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴撱�丼.鍏ュ簱棰勭害銆乆.绂佺敤 鐩存帴鎼紒搴撲綅鐘舵��={}", shallowLoc.getLocSts());
+//                    WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
+//                    if (null == waitWrkMast) {
+//                        News.error("" + mark + " - 1" + " - 10" + " - {}搴撲綅寮傚父锛屾湭妫�绱㈠埌鐩稿簲宸ヤ綔妗o紒", shallowLocNo);
+//                    } else {
+//                        waitWrkMast.setIoPri(15D);
+//                        waitWrkMast.setModiTime(new Date());
+//                        if (wrkMastMapper.updateById(waitWrkMast) == 0) {
+//                            News.error("" + mark + " - 1" + " - 11" + " - 璋冩暣宸ヤ綔妗d紭鍏堢骇澶辫触锛佸伐浣滃彿={}", waitWrkMast.getWrkNo());
+//                        }
+//                        continue;
+//                    }
+//
+//                } else if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) {
+//                    News.warnNoLog("" + mark + " - 1" + " - 12" + " - // F銆丏  搴撲綅鐘舵��={}", shallowLoc.getLocSts());
+//                    // 姝ゆ爣璁伴伩鍏嶅娆℃墽琛岀Щ搴撲换鍔�
+//                    if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())) {
+//                        wrkMast.setUpdMk("Y");
+//                        wrkMast.setIoPri(14D);
+//                        wrkMastMapper.updateById(wrkMast);
+//                        // 鐢熸垚宸ヤ綔妗�,灏嗘祬搴撲綅绉昏浆鍒版柊鐨勫簱浣嶄腑
+//                        moveLocForDeepLoc(slave, shallowLoc, mark);
+//                        // 鐢熸垚宸ヤ綔妗c�佹敼鍙樻祬搴撲綅鐨勬簮搴�/鐩爣搴� 搴撲綅鐘舵�併�佷笅鍙戝爢鍨涙満鍛戒护锛堢珛椹墽琛�)
+////                        moveLocForDeepLocPakin(slave, shallowLoc, wrkMast);
+//                    }
+//                    continue;
+//                } else if (shallowLoc.getLocSts().equals("Q")) {
+//                    News.warnNoLog("" + mark + " - 1" + " - 13" + " - // Q  搴撲綅鐘舵��={}", shallowLoc.getLocSts());
+//                    WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
+//                    if (null != waitWrkMast && waitWrkMast.getWrkSts() == 4) {
+//                        News.infoNoLog("" + mark + " - 1" + " - 14" + " - // F銆丏  宸ヤ綔鐘舵��(鍒ゆ柇鏉′欢涓�==4)={}", waitWrkMast.getWrkSts());
+//                        continue;
+//                    }
+//                }
+//            }
+            News.warnNoLog("" + mark + " - 1" + " - 15" + " - 鍛戒护涓嬪彂 : 宸ヤ綔鍙�={},婧愭帓={},婧愬垪={},婧愬眰={},鐩爣鎺�={},鐩爣鍒�={},鐩爣灞�={}", wrkMast.getWrkNo().shortValue()
+                    , crnStn.getRow().shortValue(), crnStn.getBay().shortValue(), crnStn.getLev().shortValue()
+                    , locMast.getRow1().shortValue(), locMast.getBay1().shortValue(), locMast.getLev1().shortValue());
 
             // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
             CrnCommand crnCommand = new CrnCommand();
@@ -973,12 +1077,12 @@
             crnCommand.setSourcePosX(crnStn.getRow().shortValue());     // 婧愬簱浣嶆帓
             crnCommand.setSourcePosY(crnStn.getBay().shortValue());     // 婧愬簱浣嶅垪
             crnCommand.setSourcePosZ(crnStn.getLev().shortValue());     // 婧愬簱浣嶅眰
-            crnCommand.setDestinationPosX(locMast.getRow1().shortValue());     // 鐩爣搴撲綅鎺�
-            crnCommand.setDestinationPosY(locMast.getBay1().shortValue());     // 鐩爣搴撲綅鍒�
-            crnCommand.setDestinationPosZ(locMast.getLev1().shortValue());     // 鐩爣搴撲綅灞�
+            crnCommand.setDestinationPosX((short) (locMast.getRow1() + slave.getOffset()));     // 鐩爣搴撲綅鎺�
+            crnCommand.setDestinationPosY((short) (locMast.getBay1() + slave.getOffset()));     // 鐩爣搴撲綅鍒�
+            crnCommand.setDestinationPosZ((short) (locMast.getLev1() + slave.getOffset()));     // 鐩爣搴撲綅灞�
             crnCommand.setTraySize(locMast.getLocType1() == 2);
             if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
-                News.error(""+mark+" - 1"+" - 16"+" - 鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
+                News.error("" + mark + " - 1" + " - 16" + " - 鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
             } else {
 
 //                long startTime = System.currentTimeMillis();
@@ -999,19 +1103,19 @@
                 wrkMast.setCrnStrTime(now);
                 wrkMast.setModiTime(now);
                 if (wrkMastMapper.updateById(wrkMast) == 0) {
-                    News.error(""+mark+" - 1"+" - 17"+" - 淇敼宸ヤ綔妗g姸鎬� 2.璁惧涓婅蛋 => 3.鍚婅溅鍏ュ簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+                    News.error("" + mark + " - 1" + " - 17" + " - 淇敼宸ヤ綔妗g姸鎬� 2.璁惧涓婅蛋 => 3.鍚婅溅鍏ュ簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
                 }
             }
         }
-        News.infoNoLog(""+mark+" - 1"+" - 0"+" - 鍫嗗灈鏈哄叆鍑哄簱浣滀笟涓嬪彂 锛� 鍏ュ簱鎵ц瀹屾瘯");
+        News.infoNoLog("" + mark + " - 1" + " - 0" + " - 鍫嗗灈鏈哄叆鍑哄簱浣滀笟涓嬪彂 锛� 鍏ュ簱鎵ц瀹屾瘯");
     }
 
     /**
      * 鍑哄簱  ===>>  搴撲綅鍒板爢鍨涙満绔�
      * 2022-06-09 TQS淇敼锛屾煡璇㈠伐浣滄。LIST锛岄亶鍘嗕笅鍙戯紝闃叉绗竴涓换鍔″牭濉炲嚭搴�
      */
-    public synchronized void locToCrnStn(CrnSlave slave, CrnProtocol crnProtocol,Integer mark) {
-        News.warnNoLog(""+mark+" - 2"+" - 0"+" - 鍫嗗灈鏈哄叆鍑哄簱浣滀笟涓嬪彂锛氭墽琛屽嚭搴�");
+    public synchronized void locToCrnStn(CrnSlave slave, CrnProtocol crnProtocol, Integer mark) {
+        News.warnNoLog("" + mark + " - 2" + " - 0" + " - 鍫嗗灈鏈哄叆鍑哄簱浣滀笟涓嬪彂锛氭墽琛屽嚭搴�");
         for (CrnSlave.CrnStn crnStn : slave.getCrnOutStn()) {
             // 鑾峰彇宸ヤ綔鐘舵�佷负11锛堢敓鎴愬嚭搴揑D锛夌殑鍑哄簱宸ヤ綔妗�
 //            WrkMast wrkMast = wrkMastMapper.selectPakOutStep1(slave.getId(), crnStn.getStaNo());
@@ -1022,20 +1126,20 @@
                 }
                 // 宸ヤ綔妗g姸鎬佸垽鏂�
                 if (wrkMast.getIoType() < 100 || wrkMast.getSourceStaNo() == null) {
-                    News.error(""+mark+" - 2"+" - 1"+" - 鏌ヨ宸ヤ綔妗f暟鎹笉绗﹀悎鏉′欢--鍏ュ嚭绫诲瀷/绔欑偣, 宸ヤ綔鍙�={}锛屾簮搴撲綅={}锛屽叆鍑虹被鍨�={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getIoType());
+                    News.error("" + mark + " - 2" + " - 1" + " - 鏌ヨ宸ヤ綔妗f暟鎹笉绗﹀悎鏉′欢--鍏ュ嚭绫诲瀷/绔欑偣, 宸ヤ綔鍙�={}锛屾簮搴撲綅={}锛屽叆鍑虹被鍨�={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getIoType());
                     continue;
                 }
                 // 鑾峰彇婧愬簱浣嶄俊鎭�
                 LocMast sourceSta = locMastService.selectById(wrkMast.getSourceLocNo());
                 if (!sourceSta.getLocSts().equals("R") && !sourceSta.getLocSts().equals("P")) {
-                    News.error(""+mark+" - 2"+" - 2"+" - 鍑哄簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMast.getLocNo(), sourceSta.getLocSts());
+                    News.error("" + mark + " - 2" + " - 2" + " - 鍑哄簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMast.getLocNo(), sourceSta.getLocSts());
                     continue;
                 }
                 // 鑾峰彇鍫嗗灈鏈哄嚭搴撶珯淇℃伅
                 SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId());
                 StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo());
                 if (staProtocol == null) {
-                    News.infoNoLog(""+mark+" - 2"+" - 3"+" - 鍫嗗灈鏈哄嚭搴撶珯淇℃伅(staProtocol!=null缁х画鎵ц,鍚﹀垯寰幆缁堟)锛歴taProtocol="+staProtocol);
+                    News.infoNoLog("" + mark + " - 2" + " - 3" + " - 鍫嗗灈鏈哄嚭搴撶珯淇℃伅(staProtocol!=null缁х画鎵ц,鍚﹀垯寰幆缁堟)锛歴taProtocol=" + staProtocol);
                     break;
 //                    continue;
                 } else {
@@ -1052,7 +1156,7 @@
                 // 鏌ヨ绔欑偣璇︾粏淇℃伅
                 BasDevp staDetl = basDevpService.selectById(crnStn.getStaNo());
                 if (staDetl == null) {
-                    News.error(""+mark+" - 2"+" - 5"+" - 鍑哄簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
+                    News.error("" + mark + " - 2" + " - 5" + " - 鍑哄簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
                     break;
 //                    continue;
                 }
@@ -1067,54 +1171,54 @@
                         break;
                     }
 
-                    // 鍙屾繁搴撲綅涓旀祬搴撲綅鏈夎揣锛屽垯闇�鍏堝娴呭簱浣嶈繘琛屽簱浣嶇Щ杞�
-                    if (Utils.isDeepLoc(slaveProperties, wrkMast.getSourceLocNo())) {
-                        News.warnNoLog(""+mark+" - 2"+" - 6"+" - 鍙屾繁搴撲綅涓旀祬搴撲綅鏈夎揣锛屽垯闇�鍏堝娴呭簱浣嶈繘琛屽簱浣嶇Щ杞� : 寮�濮嬫墽琛� 浠诲姟鍙�={}",wrkMast.getWrkNo());
-                        String shallowLocNo = Utils.getShallowLoc(slaveProperties, wrkMast.getSourceLocNo());
-                        LocMast shallowLoc = locMastService.selectById(shallowLocNo);
-                        // O.绌哄簱浣嶃�丵.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴撱�丼.鍏ュ簱棰勭害銆乆.绂佺敤 鐩存帴鎼紒
-                        if (shallowLoc.getLocSts().equals("P") || shallowLoc.getLocSts().equals("R")) {
-                            News.warnNoLog(""+mark+" - 2"+" - 7"+" - // O.绌哄簱浣嶃�丵.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴撱�丼.鍏ュ簱棰勭害銆乆.绂佺敤 鐩存帴鎼紒搴撲綅鐘舵��={}",shallowLoc.getLocSts());
-                            WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
-                            if (null == waitWrkMast) {
-                                News.error("{}搴撲綅寮傚父锛屾湭妫�绱㈠埌鐩稿簲宸ヤ綔妗o紒", shallowLocNo);
-                            } else {
-                                if (waitWrkMast.getWrkSts() == 11) {
-                                    waitWrkMast.setIoPri(15D);
-                                    waitWrkMast.setModiTime(new Date());
-                                    if (wrkMastMapper.updateById(waitWrkMast) == 0) {
-                                        News.error(""+mark+" - 2"+" - 8"+" - 璋冩暣宸ヤ綔妗d紭鍏堢骇澶辫触锛佸伐浣滃彿={}", waitWrkMast.getWrkNo());
-                                    }
-                                    continue;
-                                } else {
-
-                                }
-                            }
-                        } else if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) {
-                            News.warnNoLog(""+mark+" - 2"+" - 9"+" - // F銆丏  搴撲綅鐘舵��={}",shallowLoc.getLocSts());
+//                    // 鍙屾繁搴撲綅涓旀祬搴撲綅鏈夎揣锛屽垯闇�鍏堝娴呭簱浣嶈繘琛屽簱浣嶇Щ杞�
+//                    if (Utils.isDeepLoc(slaveProperties, wrkMast.getSourceLocNo())) {
+//                        News.warnNoLog("" + mark + " - 2" + " - 6" + " - 鍙屾繁搴撲綅涓旀祬搴撲綅鏈夎揣锛屽垯闇�鍏堝娴呭簱浣嶈繘琛屽簱浣嶇Щ杞� : 寮�濮嬫墽琛� 浠诲姟鍙�={}", wrkMast.getWrkNo());
+//                        String shallowLocNo = Utils.getShallowLoc(slaveProperties, wrkMast.getSourceLocNo());
+//                        LocMast shallowLoc = locMastService.selectById(shallowLocNo);
+//                        // O.绌哄簱浣嶃�丵.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴撱�丼.鍏ュ簱棰勭害銆乆.绂佺敤 鐩存帴鎼紒
+//                        if (shallowLoc.getLocSts().equals("P") || shallowLoc.getLocSts().equals("R")) {
+//                            News.warnNoLog("" + mark + " - 2" + " - 7" + " - // O.绌哄簱浣嶃�丵.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴撱�丼.鍏ュ簱棰勭害銆乆.绂佺敤 鐩存帴鎼紒搴撲綅鐘舵��={}", shallowLoc.getLocSts());
 //                            WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
-                            //2022-08-16 modify,涓嶆牴鎹畊pdmk鏍囪绉诲簱浠诲姟(瀹规槗琚彇娑堝鑷村牭濉�)锛屾煡璇㈠伐浣滄。鏄惁瀛樺湪浠诲姟
-                            WrkMast waitWrkMast = wrkMastMapper.selectByLocNo1(shallowLocNo);
-                            // 姝ゆ爣璁伴伩鍏嶅娆℃墽琛岀Щ搴撲换鍔�
-//                            if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())
-//                                || Cools.isEmpty(waitWrkMast)) {
-                            if (Cools.isEmpty(waitWrkMast)) {
-                                wrkMast.setUpdMk("Y");
-                                wrkMastMapper.updateById(wrkMast);
-                                // 鐢熸垚宸ヤ綔妗�,灏嗘祬搴撲綅绉昏浆鍒版柊鐨勫簱浣嶄腑
-                                moveLocForDeepLoc(slave, shallowLoc,mark);
-                            }
-                            News.error("{}浠诲姟鍑哄簱澶辫触锛屾祬搴撲綅鍫靛锛佹祬搴撲綅鍙�:{}", wrkMast.getWrkNo(), shallowLocNo);
-                            continue;
-                        } else if (shallowLoc.getLocSts().equals("Q") || shallowLoc.getLocSts().equals("S")) {
-                            News.warnNoLog(""+mark+" - 2"+" - 10"+" - // Q銆丼  搴撲綅鐘舵��={}",shallowLoc.getLocSts());
-                            WrkMast waitWrkMast = wrkMastMapper.selectByLocNo1(shallowLocNo);
-                            if (null != waitWrkMast && waitWrkMast.getWrkSts() == 4) {
-                                News.infoNoLog(""+mark+" - 2"+" - 11"+" - // F銆丏  宸ヤ綔鐘舵��(鍒ゆ柇鏉′欢涓�==4)={}",waitWrkMast.getWrkSts());
-                                continue;
-                            }
-                        }
-                    }
+//                            if (null == waitWrkMast) {
+//                                News.error("{}搴撲綅寮傚父锛屾湭妫�绱㈠埌鐩稿簲宸ヤ綔妗o紒", shallowLocNo);
+//                            } else {
+//                                if (waitWrkMast.getWrkSts() == 11) {
+//                                    waitWrkMast.setIoPri(15D);
+//                                    waitWrkMast.setModiTime(new Date());
+//                                    if (wrkMastMapper.updateById(waitWrkMast) == 0) {
+//                                        News.error("" + mark + " - 2" + " - 8" + " - 璋冩暣宸ヤ綔妗d紭鍏堢骇澶辫触锛佸伐浣滃彿={}", waitWrkMast.getWrkNo());
+//                                    }
+//                                    continue;
+//                                } else {
+//
+//                                }
+//                            }
+//                        } else if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) {
+//                            News.warnNoLog("" + mark + " - 2" + " - 9" + " - // F銆丏  搴撲綅鐘舵��={}", shallowLoc.getLocSts());
+////                            WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
+//                            //2022-08-16 modify,涓嶆牴鎹畊pdmk鏍囪绉诲簱浠诲姟(瀹规槗琚彇娑堝鑷村牭濉�)锛屾煡璇㈠伐浣滄。鏄惁瀛樺湪浠诲姟
+//                            WrkMast waitWrkMast = wrkMastMapper.selectByLocNo1(shallowLocNo);
+//                            // 姝ゆ爣璁伴伩鍏嶅娆℃墽琛岀Щ搴撲换鍔�
+////                            if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())
+////                                || Cools.isEmpty(waitWrkMast)) {
+//                            if (Cools.isEmpty(waitWrkMast)) {
+//                                wrkMast.setUpdMk("Y");
+//                                wrkMastMapper.updateById(wrkMast);
+//                                // 鐢熸垚宸ヤ綔妗�,灏嗘祬搴撲綅绉昏浆鍒版柊鐨勫簱浣嶄腑
+//                                moveLocForDeepLoc(slave, shallowLoc, mark);
+//                            }
+//                            News.error("{}浠诲姟鍑哄簱澶辫触锛屾祬搴撲綅鍫靛锛佹祬搴撲綅鍙�:{}", wrkMast.getWrkNo(), shallowLocNo);
+//                            continue;
+//                        } else if (shallowLoc.getLocSts().equals("Q") || shallowLoc.getLocSts().equals("S")) {
+//                            News.warnNoLog("" + mark + " - 2" + " - 10" + " - // Q銆丼  搴撲綅鐘舵��={}", shallowLoc.getLocSts());
+//                            WrkMast waitWrkMast = wrkMastMapper.selectByLocNo1(shallowLocNo);
+//                            if (null != waitWrkMast && waitWrkMast.getWrkSts() == 4) {
+//                                News.infoNoLog("" + mark + " - 2" + " - 11" + " - // F銆丏  宸ヤ綔鐘舵��(鍒ゆ柇鏉′欢涓�==4)={}", waitWrkMast.getWrkSts());
+//                                continue;
+//                            }
+//                        }
+//                    }
 
                     // 宸茬粡瀛樺湪鍚婅溅鎵ц浠诲姟鏃讹紝鍒欒繃婊�
                     if (wrkMastMapper.selectWorking(slave.getId()) != null) {
@@ -1122,9 +1226,9 @@
 //                        return;
                     }
 
-                    News.warnNoLog(""+mark+" - 2"+" - 12"+" - 鍛戒护涓嬪彂 : 宸ヤ綔鍙�={},婧愭帓={},婧愬垪={},婧愬眰={},鐩爣鎺�={},鐩爣鍒�={},鐩爣灞�={}",wrkMast.getWrkNo().shortValue()
-                            ,sourceSta.getRow1().shortValue(),sourceSta.getBay1().shortValue(),sourceSta.getLev1().shortValue()
-                            ,crnStn.getRow().shortValue(),crnStn.getBay().shortValue(),crnStn.getLev().shortValue());
+                    News.warnNoLog("" + mark + " - 2" + " - 12" + " - 鍛戒护涓嬪彂 : 宸ヤ綔鍙�={},婧愭帓={},婧愬垪={},婧愬眰={},鐩爣鎺�={},鐩爣鍒�={},鐩爣灞�={}", wrkMast.getWrkNo().shortValue()
+                            , sourceSta.getRow1().shortValue(), sourceSta.getBay1().shortValue(), sourceSta.getLev1().shortValue()
+                            , crnStn.getRow().shortValue(), crnStn.getBay().shortValue(), crnStn.getLev().shortValue());
 
                     // 1.鍫嗗灈鏈哄紑濮嬬Щ鍔�
                     CrnCommand crnCommand = new CrnCommand();
@@ -1132,15 +1236,15 @@
                     crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 宸ヤ綔鍙�
 //                    crnCommand.setAckFinish((short) 0);  // 浠诲姟瀹屾垚纭浣�
                     crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 浠诲姟妯″紡:  搴撲綅绉昏浆
-                    crnCommand.setSourcePosX(sourceSta.getRow1().shortValue());     // 婧愬簱浣嶆帓
-                    crnCommand.setSourcePosY(sourceSta.getBay1().shortValue());     // 婧愬簱浣嶅垪
-                    crnCommand.setSourcePosZ(sourceSta.getLev1().shortValue());     // 婧愬簱浣嶅眰
+                    crnCommand.setSourcePosX((short) (sourceSta.getRow1() + slave.getOffset()));     // 婧愬簱浣嶆帓
+                    crnCommand.setSourcePosY((short) (sourceSta.getBay1() + slave.getOffset()));     // 婧愬簱浣嶅垪
+                    crnCommand.setSourcePosZ((short) (sourceSta.getLev1() + slave.getOffset()));     // 婧愬簱浣嶅眰
                     crnCommand.setDestinationPosX(crnStn.getRow().shortValue());     // 鐩爣搴撲綅鎺�
                     crnCommand.setDestinationPosY(crnStn.getBay().shortValue());     // 鐩爣搴撲綅鍒�
                     crnCommand.setDestinationPosZ(crnStn.getLev().shortValue());     // 鐩爣搴撲綅灞�
                     crnCommand.setTraySize(sourceSta.getLocType1() == 2);     //搴撲綅绫诲瀷
                     if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
-                        News.error(""+mark+" - 2"+" - 13"+" - 鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
+                        News.error("" + mark + " - 2" + " - 13" + " - 鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
                     } else {
                         // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓�
                         Date now = new Date();
@@ -1148,14 +1252,14 @@
                         wrkMast.setCrnStrTime(now);
                         wrkMast.setModiTime(now);
                         if (wrkMastMapper.updateById(wrkMast) == 0) {
-                            News.error(""+mark+" - 2"+" - 14"+" - 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+                            News.error("" + mark + " - 2" + " - 14" + " - 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
                         }
                         break;
                     }
                 }
             }
         }
-        News.infoNoLog(""+mark+" - 2"+" - 0"+" - 鍫嗗灈鏈哄叆鍑哄簱浣滀笟涓嬪彂 锛� 鍑哄簱鎵ц瀹屾瘯");
+        News.infoNoLog("" + mark + " - 2" + " - 0" + " - 鍫嗗灈鏈哄叆鍑哄簱浣滀笟涓嬪彂 锛� 鍑哄簱鎵ц瀹屾瘯");
     }
 
 //    /**
@@ -1278,17 +1382,17 @@
     /**
      * 搴撲綅绉昏浆
      */
-    public synchronized void locToLoc(CrnSlave slave, CrnProtocol crnProtocol,Integer mark) {
+    public synchronized void locToLoc(CrnSlave slave, CrnProtocol crnProtocol, Integer mark) {
         // 鑾峰彇宸ヤ綔妗d俊鎭�
         WrkMast wrkMast = wrkMastMapper.selectLocMove(slave.getId());
         if (null == wrkMast) {
             return;
         }
-        News.warnNoLog(""+mark+" - 3"+" - 0"+" - 鍫嗗灈鏈哄叆鍑哄簱浣滀笟涓嬪彂锛氭墽琛屽簱浣嶇Щ杞�");
+        News.warnNoLog("" + mark + " - 3" + " - 0" + " - 鍫嗗灈鏈哄叆鍑哄簱浣滀笟涓嬪彂锛氭墽琛屽簱浣嶇Щ杞�");
         // 鑾峰彇婧愬簱浣嶄俊鎭�
         LocMast sourceSta = locMastService.selectById(wrkMast.getSourceLocNo());
         if (null == sourceSta) {
-            News.error(""+mark+" - 3"+" - 1"+" - 宸ヤ綔妗e簱浣嶇Щ杞け璐ワ紝鍘熷洜锛氭绱㈡簮搴撲綅澶辫触锛佸伐浣滃彿={}锛屾簮搴撲綅={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo());
+            News.error("" + mark + " - 3" + " - 1" + " - 宸ヤ綔妗e簱浣嶇Щ杞け璐ワ紝鍘熷洜锛氭绱㈡簮搴撲綅澶辫触锛佸伐浣滃彿={}锛屾簮搴撲綅={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo());
             return;
         }
         // 婧愬簱浣�  搴撲綅鐘舵�佸垽鏂�
@@ -1298,10 +1402,10 @@
         // 鑾峰彇鐩爣搴撲綅淇℃伅
         LocMast sta = locMastService.selectById(wrkMast.getLocNo());
         if (null == sta) {
-            News.error(""+mark+" - 3"+" - 2"+" - 宸ヤ綔妗e簱浣嶇Щ杞け璐ワ紝鍘熷洜锛氭绱㈢洰鏍囧簱浣嶅け璐ワ紒宸ヤ綔鍙�={}锛屾簮搴撲綅={}", wrkMast.getWrkNo(), wrkMast.getLocNo());
+            News.error("" + mark + " - 3" + " - 2" + " - 宸ヤ綔妗e簱浣嶇Щ杞け璐ワ紝鍘熷洜锛氭绱㈢洰鏍囧簱浣嶅け璐ワ紒宸ヤ綔鍙�={}锛屾簮搴撲綅={}", wrkMast.getWrkNo(), wrkMast.getLocNo());
             return;
         }
-        if(sta.getLocType1() != sourceSta.getLocType1()){
+        if (sta.getLocType1() != sourceSta.getLocType1()) {
             News.error("绉诲簱鐩爣搴撲綅绫诲瀷涓庢簮搴撲綅绫诲瀷涓嶇");
             return;
         }
@@ -1321,9 +1425,9 @@
             return;
         }
 
-        News.warnNoLog(""+mark+" - 3"+" - 3"+" - 鍛戒护涓嬪彂 : 宸ヤ綔鍙�={},婧愭帓={},婧愬垪={},婧愬眰={},鐩爣鎺�={},鐩爣鍒�={},鐩爣灞�={}",wrkMast.getWrkNo().shortValue()
-                ,sourceSta.getRow1().shortValue(),sourceSta.getBay1().shortValue(),sourceSta.getLev1().shortValue()
-                ,sta.getRow1().shortValue(),sta.getBay1().shortValue(),sta.getLev1().shortValue());
+        News.warnNoLog("" + mark + " - 3" + " - 3" + " - 鍛戒护涓嬪彂 : 宸ヤ綔鍙�={},婧愭帓={},婧愬垪={},婧愬眰={},鐩爣鎺�={},鐩爣鍒�={},鐩爣灞�={}", wrkMast.getWrkNo().shortValue()
+                , sourceSta.getRow1().shortValue(), sourceSta.getBay1().shortValue(), sourceSta.getLev1().shortValue()
+                , sta.getRow1().shortValue(), sta.getBay1().shortValue(), sta.getLev1().shortValue());
 
         // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
         CrnCommand crnCommand = new CrnCommand();
@@ -1339,7 +1443,7 @@
         crnCommand.setDestinationPosZ(sta.getLev1().shortValue());     // 鐩爣搴撲綅灞�
         crnCommand.setTraySize(sourceSta.getLocType1() == 2);     //搴撲綅绫诲瀷
         if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
-            News.error(""+mark+" - 3"+" - 4"+" - 鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
+            News.error("" + mark + " - 3" + " - 4" + " - 鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
         } else {
             // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓�
             Date now = new Date();
@@ -1347,10 +1451,10 @@
             wrkMast.setCrnStrTime(now);
             wrkMast.setModiTime(now);
             if (wrkMastMapper.updateById(wrkMast) == 0) {
-                News.error(""+mark+" - 3"+" - 5"+" - 銆愬簱浣嶇Щ杞�� 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+                News.error("" + mark + " - 3" + " - 5" + " - 銆愬簱浣嶇Щ杞�� 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
             }
         }
-        News.infoNoLog(""+mark+" - 3"+" - 0"+" - 鍫嗗灈鏈哄叆鍑哄簱浣滀笟涓嬪彂锛氬簱浣嶇Щ杞畬鎴�");
+        News.infoNoLog("" + mark + " - 3" + " - 0" + " - 鍫嗗灈鏈哄叆鍑哄簱浣滀笟涓嬪彂锛氬簱浣嶇Щ杞畬鎴�");
 
     }
 
@@ -1368,31 +1472,31 @@
             }
             //  鐘舵�侊細绛夊緟纭 骞朵笖  浠诲姟瀹屾垚浣� = 1
             if (crnProtocol.statusType == CrnStatusType.WAITING && crnProtocol.getTaskNo() != 0) {
-                News.warnNoLog(""+mark+" - 0"+" - 寮�濮嬫墽琛屽宸ヤ綔妗g殑瀹屾垚鎿嶄綔");
+                News.warnNoLog("" + mark + " - 0" + " - 寮�濮嬫墽琛屽宸ヤ綔妗g殑瀹屾垚鎿嶄綔锛屼换鍔″彿:" + crnProtocol.getTaskNo());
 
-                    // 鑾峰彇鍏ュ簱寰呯‘璁ゅ伐浣滄。
-                    WrkMast wrkMast = wrkMastMapper.selectPakInStep3(crnProtocol.getTaskNo().intValue());
-                    if (wrkMast == null) {
-                        News.error(""+mark+" - 1"+" - 鍫嗗灈鏈哄浜庣瓑寰呯‘璁や笖浠诲姟瀹屾垚鐘舵�侊紝浣嗘湭鎵惧埌宸ヤ綔妗c�傚爢鍨涙満鍙�={}锛屽伐浣滃彿={}", crn.getId(), crnProtocol.getTaskNo());
-                        continue;
-                    }
-                    // 鍏ュ簱 + 搴撲綅杞Щ  ==> 4.鍏ュ簱瀹屾垚
-                    if (wrkMast.getWrkSts() == 3 || (wrkMast.getWrkSts() == 12 && wrkMast.getIoType() == 11)) {
-                        wrkMast.setWrkSts(4L);
-                    } else {
-                        continue;
-                    }
-                    Date now = new Date();
-                    wrkMast.setCrnEndTime(now);
-                    wrkMast.setModiTime(now);
-                    // 淇敼鎴愬姛鍚庡浣嶅爢鍨涙満
-                    if (wrkMastMapper.updateById(wrkMast) > 0) {
-                        // 鍫嗗灈鏈哄浣�
-                        log.error(wrkMast.getWrkNo()+"浠诲姟淇敼鐘舵��4鎴愬姛锛屽浣嶅爢鍨涙満={}",crnThread.getCrnProtocol().getCrnNo());
-                        News.warnNoLog(""+mark+" - 2"+" - 淇敼鎴愬姛鍚庡浣嶅爢鍨涙満 : 鍫嗗灈鏈哄彿={}",crnThread.getCrnProtocol().getCrnNo());
-                        crnThread.setResetFlag(true);
-                    }
+                // 鑾峰彇鍏ュ簱寰呯‘璁ゅ伐浣滄。
+                WrkMast wrkMast = wrkMastMapper.selectPakInStep3(crnProtocol.getTaskNo().intValue());
+                if (wrkMast == null) {
+                    News.error("" + mark + " - 1" + " - 鍫嗗灈鏈哄浜庣瓑寰呯‘璁や笖浠诲姟瀹屾垚鐘舵�侊紝浣嗘湭鎵惧埌宸ヤ綔妗c�傚爢鍨涙満鍙�={}锛屽伐浣滃彿={}", crn.getId(), crnProtocol.getTaskNo());
+                    continue;
                 }
+                // 鍏ュ簱 + 搴撲綅杞Щ  ==> 4.鍏ュ簱瀹屾垚
+                if (wrkMast.getWrkSts() == 3 || (wrkMast.getWrkSts() == 12 && wrkMast.getIoType() == 11)) {
+                    wrkMast.setWrkSts(4L);
+                } else {
+                    continue;
+                }
+                Date now = new Date();
+                wrkMast.setCrnEndTime(now);
+                wrkMast.setModiTime(now);
+                // 淇敼鎴愬姛鍚庡浣嶅爢鍨涙満
+                if (wrkMastMapper.updateById(wrkMast) > 0) {
+                    // 鍫嗗灈鏈哄浣�
+                    log.error(wrkMast.getWrkNo() + "浠诲姟淇敼鐘舵��4鎴愬姛锛屽浣嶅爢鍨涙満={}", crnThread.getCrnProtocol().getCrnNo());
+                    News.warnNoLog("" + mark + " - 2" + " - 淇敼鎴愬姛鍚庡浣嶅爢鍨涙満 : 鍫嗗灈鏈哄彿={}", crnThread.getCrnProtocol().getCrnNo());
+                    crnThread.setResetFlag(true);
+                }
+            }
 
 
         }
@@ -1419,7 +1523,7 @@
                     BasErrLog latest = basErrLogService.findLatestByTaskNo(crn.getId(), crnProtocol.getTaskNo().intValue());
                     // 鏈夊紓甯�
                     if (latest == null) {
-                        News.warnNoLog(""+mark+" - 1"+" - 寮�濮嬫墽琛岋細鍫嗗灈鏈哄紓甯镐俊鎭褰� 锛� 鏈変换鍔★紝鏈夊紓甯�");
+                        News.warnNoLog("" + mark + " - 1" + " - 寮�濮嬫墽琛岋細鍫嗗灈鏈哄紓甯镐俊鎭褰� 锛� 鏈変换鍔★紝鏈夊紓甯�");
                         if (crnProtocol.getAlarm() != null && crnProtocol.getAlarm() > 0) {
                             WrkMast wrkMast = wrkMastMapper.selectById(crnProtocol.getTaskNo());
                             if (wrkMast == null) {
@@ -1451,7 +1555,7 @@
                                     "浠诲姟涓紓甯�"    // 澶囨敞
                             );
                             if (!basErrLogService.insert(basErrLog)) {
-                                News.error(""+mark+" - 2"+" - 鍫嗗灈鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", crn.getId(), errName);
+                                News.error("" + mark + " - 2" + " - 鍫嗗灈鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", crn.getId(), errName);
                             }
                         }
                     } else {
@@ -1461,7 +1565,7 @@
                             latest.setUpdateTime(now);
                             latest.setStatus(2);
                             if (!basErrLogService.updateById(latest)) {
-                                News.error(""+mark+" - 3"+" - 鍫嗗灈鏈簆lc寮傚父璁板綍淇澶辫触 ===>> [id:{}] [errLogId:{}]", crn.getId(), latest.getId());
+                                News.error("" + mark + " - 3" + " - 鍫嗗灈鏈簆lc寮傚父璁板綍淇澶辫触 ===>> [id:{}] [errLogId:{}]", crn.getId(), latest.getId());
                             }
                         }
                     }
@@ -1470,7 +1574,7 @@
                     BasErrLog latest = basErrLogService.findLatest(crn.getId());
                     // 鏈夊紓甯�
                     if (crnProtocol.getAlarm() != null && crnProtocol.getAlarm() > 0) {
-                        News.warnNoLog(""+mark+" - 4"+" - 寮�濮嬫墽琛岋細鍫嗗灈鏈哄紓甯镐俊鎭褰� 锛� 鏃犱换鍔★紝鏈夊紓甯�");
+                        News.warnNoLog("" + mark + " - 4" + " - 寮�濮嬫墽琛岋細鍫嗗灈鏈哄紓甯镐俊鎭褰� 锛� 鏃犱换鍔★紝鏈夊紓甯�");
                         // 璁板綍鏂板紓甯�
                         if (latest == null || (latest.getErrCode() != crnProtocol.getAlarm().intValue())) {
                             BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm());
@@ -1499,7 +1603,7 @@
                                     "鏃犱换鍔″紓甯�"    // 澶囨敞
                             );
                             if (!basErrLogService.insert(basErrLog)) {
-                                News.error(""+mark+" - 5"+" - 鍫嗗灈鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", crn.getId(), errName);
+                                News.error("" + mark + " - 5" + " - 鍫嗗灈鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", crn.getId(), errName);
                             }
                         }
                         // 鏃犲紓甯�
@@ -1510,7 +1614,7 @@
                             latest.setUpdateTime(now);
                             latest.setStatus(2);
                             if (!basErrLogService.updateById(latest)) {
-                                News.error(""+mark+" - 6"+" - 鍫嗗灈鏈簆lc寮傚父璁板綍淇澶辫触 ===>> [id:{}] [errLogId:{}]", crn.getId(), latest.getId());
+                                News.error("" + mark + " - 6" + " - 鍫嗗灈鏈簆lc寮傚父璁板綍淇澶辫触 ===>> [id:{}] [errLogId:{}]", crn.getId(), latest.getId());
                             }
                         }
                     }
@@ -1542,11 +1646,11 @@
                 }
 
                 LedThread ledThread = null;
-                if (!Cools.isEmpty(emptyInSta.getLed()))  {
+                if (!Cools.isEmpty(emptyInSta.getLed())) {
                     ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, emptyInSta.getLed());
                 }
 
-                if (!staProtocol.isLoading()){
+                if (!staProtocol.isLoading()) {
                     continue;
                 }
 
@@ -1556,9 +1660,9 @@
                         && staProtocol.isInEnable()
                         && staProtocol.isEmptyMk()
                         && staProtocol.isPakMk()
-                        && (staProtocol.getWorkNo() !=0 && staProtocol.getWorkNo() > 9700)
-                        ) {
-                    News.warnNoLog(""+mark+" - 0"+" - 寮�濮嬫墽琛岋細绌烘爤鏉垮垵濮嬪寲鍏ュ簱,鍙夎溅鍏ュ簱绔欐斁璐�");
+                        && (staProtocol.getWorkNo() != 0 && staProtocol.getWorkNo() > 9700)
+                ) {
+                    News.warnNoLog("" + mark + " - 0" + " - 寮�濮嬫墽琛岋細绌烘爤鏉垮垵濮嬪寲鍏ュ簱,鍙夎溅鍏ュ簱绔欐斁璐�");
 
                     try {
                         LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
@@ -1579,12 +1683,13 @@
 
                             // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
                             staProtocol.setWorkNo(dto.getWorkNo());
-                            staProtocol.setStaNo(staProtocol.getSiteId().shortValue());
+                            staProtocol.setStaNo(dto.getStaNo().shortValue());
+                            //staProtocol.setStaNo(staProtocol.getSiteId().shortValue());
                             devpThread.setPakMk(staProtocol.getSiteId(), false);
                             boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                            log.error("杈撻�佺嚎涓嬪彂6锛�"+dto.getWorkNo()+","+staProtocol.getSiteId());
+                            log.error("杈撻�佺嚎涓嬪彂6锛�" + dto.getWorkNo() + "," + staProtocol.getSiteId());
                             if (!result) {
-                                News.errorNoLog(""+mark+" - 1"+" - 鏇存柊plc绔欑偣淇℃伅澶辫触");
+                                News.errorNoLog("" + mark + " - 1" + " - 鏇存柊plc绔欑偣淇℃伅澶辫触");
                                 throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
                             }
 
@@ -1626,9 +1731,9 @@
                     }
 
                 } else {
-                    News.errorNoLog(""+mark+" - 4"+" - 绔欑偣淇℃伅涓嶇鍚堝叆搴撴潯浠讹紒锛侊紒"+" 鑷姩淇″彿锛�"+staProtocol.isAutoing()+"銆佸彲鍏ヤ俊鍙凤細" + staProtocol.isInEnable()
-                            +"銆佺┖鏉夸俊鍙凤細"+ staProtocol.isEmptyMk()+"銆佸伐浣滃彿锛�" + staProtocol.getWorkNo()
-                            +"銆侀攣瀹氭爣璁�"+ staProtocol.isPakMk());
+                    News.errorNoLog("" + mark + " - 4" + " - 绔欑偣淇℃伅涓嶇鍚堝叆搴撴潯浠讹紒锛侊紒" + " 鑷姩淇″彿锛�" + staProtocol.isAutoing() + "銆佸彲鍏ヤ俊鍙凤細" + staProtocol.isInEnable()
+                            + "銆佺┖鏉夸俊鍙凤細" + staProtocol.isEmptyMk() + "銆佸伐浣滃彿锛�" + staProtocol.getWorkNo()
+                            + "銆侀攣瀹氭爣璁�" + staProtocol.isPakMk());
                 }
             }
         }
@@ -1656,7 +1761,9 @@
                 }
                 // 鑾峰彇宸ヤ綔妗f暟鎹�
                 WrkMast wrkMast = wrkMastMapper.selectById(staProtocol.getWorkNo());
-                if (null == wrkMast) { continue; }
+                if (null == wrkMast) {
+                    continue;
+                }
                 wrkMasts.add(wrkMast);
                 // 缁勮鍛戒护
                 LedCommand ledCommand = new LedCommand();
@@ -1706,13 +1813,13 @@
                             total = locDetl.getAnfme();
                         }
                         if (wrkMast.getIoType() == 101 || wrkMast.getIoType() == 1) {
-                            ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total));
+                            ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(), total));
                         }
                         if (wrkMast.getIoType() == 103 && (null == wrkDetl.getInspect() || 0 == wrkDetl.getInspect())) {
-                            ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total));
+                            ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(), total));
                         }
                         if (wrkMast.getIoType() == 107) {
-                            ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total));
+                            ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(), total));
                         }
                     });
                 }
@@ -1766,14 +1873,16 @@
             for (Integer staNo : led.getStaArr()) {
                 // 鑾峰彇鍙夎溅绔欑偣
                 StaProtocol staProtocol = devpThread.getStation().get(staNo);
-                if (staProtocol == null) { continue; }
+                if (staProtocol == null) {
+                    continue;
+                }
                 if (staProtocol.getWorkNo() != 0 || staProtocol.isErr()) {
                     reset = false;
                     break;
                 }
             }
             // 鑾峰彇led绾跨▼
-            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getDevpPlcId());
+            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
             // led鏄剧ず榛樿鍐呭
             if (reset) {
                 if (ledThread == null) {
@@ -1866,10 +1975,10 @@
      * 鍥犲弻娣卞簱浣嶉樆濉烇紝瀵规祬搴撲綅杩涜绉昏浆锛堢珛鍗虫墽琛岀増)
      * tip锛氬悓姝�
      */
-    private synchronized void moveLocForDeepLoc(CrnSlave crn, LocMast shallowLoc,Integer mark) {
+    private synchronized void moveLocForDeepLoc(CrnSlave crn, LocMast shallowLoc, Integer mark) {
 
         try {
-            News.warnNoLog(""+mark+"moveLocForDeepLoc"+" - 0"+" - 寮�濮嬫墽琛�:鍥犲弻娣卞簱浣嶉樆濉烇紝瀵规祬搴撲綅杩涜绉昏浆锛堢珛鍗虫墽琛岀増)");
+            News.warnNoLog("" + mark + "moveLocForDeepLoc" + " - 0" + " - 寮�濮嬫墽琛�:鍥犲弻娣卞簱浣嶉樆濉烇紝瀵规祬搴撲綅杩涜绉昏浆锛堢珛鍗虫墽琛岀増)");
             List<Integer> rows = locMastService.queryDistinctRow(crn.getId());
             LocMast loc = null;
             for (Integer row : rows) {
@@ -1911,7 +2020,7 @@
             }
 
             if (null == loc) {
-                News.error(""+mark+"moveLocForDeepLoc"+" - 1"+" - 鍙屾繁搴撲綅 --- 娴呭簱浣嶉樆濉炲紓甯革紒 寰呯Щ杞祬搴撲綅锛�" + shallowLoc.getLocNo());
+                News.error("" + mark + "moveLocForDeepLoc" + " - 1" + " - 鍙屾繁搴撲綅 --- 娴呭簱浣嶉樆濉炲紓甯革紒 寰呯Щ杞祬搴撲綅锛�" + shallowLoc.getLocNo());
                 throw new CoolException("鍙屾繁搴撲綅 --- 娴呭簱浣嶉樆濉炲紓甯革紒 寰呯Щ杞祬搴撲綅锛�" + shallowLoc.getLocNo());
             }
 
@@ -1937,7 +2046,7 @@
             wrkMast.setModiTime(new Date());
             int res = wrkMastMapper.insert(wrkMast);
             if (res == 0) {
-                News.errorNoLog(""+mark+"moveLocForDeepLoc"+" - 2"+" - 淇濆瓨宸ヤ綔妗eけ璐�");
+                News.errorNoLog("" + mark + "moveLocForDeepLoc" + " - 2" + " - 淇濆瓨宸ヤ綔妗eけ璐�");
                 throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
             }
             // 宸ヤ綔妗f槑缁嗕繚瀛�
@@ -1952,7 +2061,7 @@
                     wrkDetl.setAppeTime(new Date());
                     wrkDetl.setModiTime(new Date());
                     if (!wrkDetlService.insert(wrkDetl)) {
-                        News.errorNoLog(""+mark+"moveLocForDeepLoc"+" - 3"+" - 淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
+                        News.errorNoLog("" + mark + "moveLocForDeepLoc" + " - 3" + " - 淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
                         throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
                     }
                 }
@@ -1962,11 +2071,11 @@
                 shallowLoc.setLocSts("R"); // R.鍑哄簱棰勭害
                 shallowLoc.setModiTime(new Date());
                 if (!locMastService.updateById(shallowLoc)) {
-                    News.errorNoLog(""+mark+"moveLocForDeepLoc"+" - 4"+" - 鏇存柊婧愬簱浣嶇姸鎬佸け璐�");
+                    News.errorNoLog("" + mark + "moveLocForDeepLoc" + " - 4" + " - 鏇存柊婧愬簱浣嶇姸鎬佸け璐�");
                     throw new CoolException("鏇存柊婧愬簱浣嶇姸鎬佸け璐�");
                 }
             } else {
-                News.errorNoLog(""+mark+"moveLocForDeepLoc"+" - 5"+" - 婧愬簱浣嶅嚭搴撳け璐�");
+                News.errorNoLog("" + mark + "moveLocForDeepLoc" + " - 5" + " - 婧愬簱浣嶅嚭搴撳け璐�");
                 throw new CoolException("婧愬簱浣嶅嚭搴撳け璐�");
             }
             // 淇敼鐩爣搴撲綅鐘舵��
@@ -1974,15 +2083,15 @@
                 loc.setLocSts("S"); // S.鍏ュ簱棰勭害
                 loc.setModiTime(new Date());
                 if (!locMastService.updateById(loc)) {
-                    News.errorNoLog(""+mark+"moveLocForDeepLoc"+" - 6"+" - 鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
+                    News.errorNoLog("" + mark + "moveLocForDeepLoc" + " - 6" + " - 鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
                     throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
                 }
             } else {
-                News.errorNoLog(""+mark+"moveLocForDeepLoc"+" - 7"+" - 绉昏浆澶辫触");
+                News.errorNoLog("" + mark + "moveLocForDeepLoc" + " - 7" + " - 绉昏浆澶辫触");
                 throw new CoolException("绉昏浆澶辫触");
             }
         } catch (Exception e) {
-            News.error(""+mark+"moveLocForDeepLoc"+" - 8"+" - 鍙屾繁搴撲綅闃诲锛屽娴呭簱浣嶈繘琛岀Щ杞け璐�", e);
+            News.error("" + mark + "moveLocForDeepLoc" + " - 8" + " - 鍙屾繁搴撲綅闃诲锛屽娴呭簱浣嶈繘琛岀Щ杞け璐�", e);
             e.printStackTrace();
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
         }
@@ -2205,14 +2314,14 @@
     public synchronized void outOfDevp(Integer mark) {
 
         List<WrkMast> wrkMasts = wrkMastMapper.selectPick();
-        if (wrkMasts.size()!=0){
-            News.warnNoLog(""+mark+" - 0"+" - 寮�濮嬫墽琛宱utOfDevp");
+        if (wrkMasts.size() != 0) {
+            News.warnNoLog("" + mark + " - 0" + " - 寮�濮嬫墽琛宱utOfDevp");
         }
         for (WrkMast wrkMast : wrkMasts) {
             if (basDevpService.selectCount(new EntityWrapper<BasDevp>().eq("wrk_no", wrkMast.getWrkNo())) == 0) {
                 wrkMast.setCtnNo("Y");
                 if (wrkMastMapper.updateById(wrkMast) == 0) {
-                    News.error(""+mark+" - 1"+" - 淇敼{}宸ヤ綔妗eけ璐ワ紝ctn_no", wrkMast.getWrkNo());
+                    News.error("" + mark + " - 1" + " - 淇敼{}宸ヤ綔妗eけ璐ワ紝ctn_no", wrkMast.getWrkNo());
                 }
             }
         }
@@ -2223,12 +2332,14 @@
     public synchronized void autoEmptyOut() {
         SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
         List<Integer> list = new ArrayList<>();
-        list.add(101);list.add(112);
-        Map<Integer,Integer> map = new HashMap<>();
-        map.put(101,102);map.put(112,111);
-        for (Integer site:list){
+        list.add(101);
+        list.add(112);
+        Map<Integer, Integer> map = new HashMap<>();
+        map.put(101, 102);
+        map.put(112, 111);
+        for (Integer site : list) {
             WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("sta_no", map.get(site)));
-            if (!Cools.isEmpty(wrkMast)){
+            if (!Cools.isEmpty(wrkMast)) {
                 continue;
             }
             //濡傛灉绔欑偣鍙嚭绂佺敤锛屽垯涓嶇敓鎴愮┖鐩樺嚭搴撲换鍔�
@@ -2248,7 +2359,7 @@
                     return;
                 }
                 Short loctype1 = 1;
-                if (site == 101){
+                if (site == 101) {
                     loctype1 = 2;
                 }
                 LocTypeDto locTypeDto = new LocTypeDto(loctype1, (short) 1, (short) 1);
@@ -2263,9 +2374,9 @@
                     JSONObject jsonObject = JSON.parseObject(response);
                     if (jsonObject.getInteger("code").equals(200)) {
                         String data = jsonObject.get("data").toString();
-                        News.info((String) jsonObject.get("msg")+","+data);
+                        News.info((String) jsonObject.get("msg") + "," + data);
                     } else {
-                        News.warnNoLog("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/auto/emptyOut/v1","", response);
+                        News.warnNoLog("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/auto/emptyOut/v1", "", response);
                     }
                 } catch (Exception e) {
                     e.printStackTrace();
@@ -2279,8 +2390,9 @@
     public synchronized void autoEmptyIn() {
         SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
         List<Integer> list = new ArrayList<>();
-        list.add(153);list.add(157);
-        for (Integer site:list){
+        list.add(153);
+        list.add(157);
+        for (Integer site : list) {
             StaProtocol staProtocol = devpThread.getStation().get(site);
             if (staProtocol == null) {
                 return;
@@ -2296,7 +2408,7 @@
 
                 try {
                     Short loctype1 = 1;
-                    if (site == 153){
+                    if (site == 153) {
                         loctype1 = 2;
                     }
                     LocTypeDto locTypeDto = new LocTypeDto(loctype1, (short) 1, (short) 1);
@@ -2313,7 +2425,7 @@
                         News.info((String) jsonObject.get("msg"));
                         staProtocol.setWorkNo(jsonObject.get("data").hashCode());
                         staProtocol.setStaNo(site.shortValue());
-                        devpThread.setPakMk(site,false);
+                        devpThread.setPakMk(site, false);
                         MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol));
                     } else {
                         News.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/auto/emptyIn/v1", JSON.toJSONString(locTypeDto), response);
@@ -2331,13 +2443,16 @@
     /*
      * 灏忚溅鍦板浘鏇存柊  鏇存柊閿�
      * */
-    public synchronized boolean rgvMapUpdate(BasRgvMap basRgvMapCurrent,Integer staStart,Integer staEnd,String sign){
+    public synchronized boolean rgvMapUpdate(BasRgvMap basRgvMapCurrent, Integer staStart, Integer staEnd, String sign) {
+        log.info("灏忚溅鍦板浘鏇存柊锛乕鏍囪锛歿}];[BasRgvMap锛歿}];[staStart锛歿}];[staEnd锛歿}];", sign, JSON.toJSONString(basRgvMapCurrent), staStart, staEnd);
 
 //        List<Integer> integers = RouteUtils.RouteMapCurrentFar(basRgvMapCurrent.getNowRoute(),staStart,staEnd, basRgvMapCurrent.getLockStartRoute());
         //鏇存柊褰撳墠灏忚溅閿�
-        try{
+        try {
             Integer farCurrentStaNo = RouteUtils.RouteIndexFarMas(basRgvMapCurrent.getNowRoute(), staStart, staEnd, basRgvMapCurrent.getLockStartRoute());//鑾峰彇鏈�杩滅珯鐐�
+            log.info("灏忚溅鍦板浘鏇存柊锛佽幏鍙栨渶杩滅珯鐐�;[farCurrentStaNo锛歿}]", farCurrentStaNo);
             Integer fallMerge = RouteUtils.RouteIndexFarMas(basRgvMapCurrent.getRgvNo(), farCurrentStaNo); //鑾峰彇鍚堝苟骞叉秹椤�
+            log.info("灏忚溅鍦板浘鏇存柊锛佽幏鍙栧悎骞跺共娑夐」;[fallMerge锛歿}]", fallMerge);
             basRgvMapCurrent.setLockEndRoute(fallMerge);
             Integer i = basRgvMapMapper.updateById(basRgvMapCurrent);
 //            if (i>0){
@@ -2346,17 +2461,22 @@
 
             //鏇存柊鍙︿竴鍙板皬杞﹀湴鍥�
             Integer rgvNoOther = basRgvMapCurrent.getRgvNoOther(basRgvMapCurrent.getRgvNo());
+            log.info("灏忚溅鍦板浘鏇存柊锛佸彟涓�鍙板皬杞﹀彿;[rgvNoOther锛歿}]", rgvNoOther);
+
             BasRgvMap basRgvMapOther = basRgvMapMapper.selectById(rgvNoOther);
+            log.info("灏忚溅鍦板浘鏇存柊锛佸彟涓�鍙板皬杞�;[basRgvMapOther锛歿}]", JSON.toJSONString(basRgvMapOther));
+
             List<Integer> integers = RouteUtils.RouteMapCurrentFar(fallMerge, basRgvMapCurrent.getLockStartRoute());
             Integer lockEndRoute = RouteUtils.RouteMapOtherFarStnNo(integers, basRgvMapCurrent.getLockStartRoute());//鍙︿竴鍙板皬杞﹀彲娲诲姩鏈�杩滀綅缃�
+            log.info("灏忚溅鍦板浘鏇存柊锛佸彟涓�鍙板皬杞﹀彲娲诲姩鏈�杩滀綅缃�;[lockEndRoute锛歿}]", lockEndRoute);
             basRgvMapOther.setEndRoute(lockEndRoute);
             Integer i1 = basRgvMapMapper.updateById(basRgvMapOther);
 //            if (i1>0){
 //                log.error("{}:==>{}:{}鍙疯溅鏇存柊缁撴潫浣嶇疆,{}",sign,new Date(),basRgvMapOther.getRgvNo(),JSON.toJSONString(basRgvMapOther));
 //            }
             return true;
-        }catch (Exception e){
-            log.error("灏忚溅鍦板浘鏇存柊鍑洪敊锛�");
+        } catch (Exception e) {
+            log.error("灏忚溅鍦板浘鏇存柊鍑洪敊锛佸紓甯稿師鍥狅細" + e);
             return false;
         }
     }
@@ -2365,14 +2485,14 @@
      * 鍒锋柊鍦板浘鏁版嵁
      * */
     public synchronized void refreshRgvMap() {
-        try{
+        try {
             List<BasRgvMap> basRgvMaps = basRgvMapService.selectList(new EntityWrapper<>());
-            for (BasRgvMap rgvSlave:basRgvMaps) {
+            for (BasRgvMap rgvSlave : basRgvMaps) {
                 RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getRgvNo());
                 RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
                 if (rgvProtocol == null) {
                     continue;
-                }else {
+                } else {
                     rgvProtocol = rgvProtocol.clone();
                 }
                 BasRgv basRgv = basRgvService.selectById(rgvSlave.getRgvNo());
@@ -2383,10 +2503,10 @@
 
                 // 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅涓�鏃犵墿//rgv鍙敤
                 if (rgvProtocol.getStatusType() == RgvStatusType.IDLE &&
-                    rgvProtocol.getModeType() == RgvModeType.AUTO
-                    && rgvProtocol.getLoaded1()==0  //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
-                    && (rgvProtocol.getTaskNo1()==0)
-                        &&rgvThread.isPakMk()
+                        rgvProtocol.getModeType() == RgvModeType.AUTO
+                        && rgvProtocol.getLoaded1() == 0  //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
+                        && (rgvProtocol.getTaskNo1() == 0)
+                        && rgvThread.isPakMk()
                 ) {
                     BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
 
@@ -2395,161 +2515,160 @@
                     RgvProtocol rgvProtocolOther = rgvThreadOther.getRgvProtocol();
                     if (rgvProtocolOther == null) {
                         continue;
-                    }else {
+                    } else {
                         rgvProtocolOther = rgvProtocolOther.clone();
                     }
                     if (rgvProtocolOther.getStatusType() == RgvStatusType.IDLE
-                        && rgvProtocolOther.getModeType() == RgvModeType.AUTO
-                        && rgvProtocolOther.getLoaded1()==0
-                        && (rgvProtocolOther.getTaskNo1()==0)
-                        &&rgvThreadOther.isPakMk()
-                    ){
+                            && rgvProtocolOther.getModeType() == RgvModeType.AUTO
+                            && rgvProtocolOther.getLoaded1() == 0
+                            && (rgvProtocolOther.getTaskNo1() == 0)
+                            && rgvThreadOther.isPakMk()
+                    ) {
                         //瀵瑰伐浣滄。杩涜鍒ゆ柇
                         basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
-                        if (rgvProtocol.getTaskNo1() >0 && rgvProtocol.getTaskNo1()<=9000){
+                        if (rgvProtocol.getTaskNo1() > 0 && rgvProtocol.getTaskNo1() <= 9000) {
                             WrkMastSta wrkMastSta = wrkMastStaMapper.selectByWrkNo(rgvProtocol.getTaskNo1().intValue());
-                            rgvMapUpdate(basRgvMap, wrkMastSta.getStaStart(), wrkMastSta.getStaEnd(),"2366");
-                        }else if (rgvProtocol.getTaskNo1() == 0){
-                            rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute(),"2366");
+                            rgvMapUpdate(basRgvMap, wrkMastSta.getStaStart(), wrkMastSta.getStaEnd(), "2366");
+                        } else if (rgvProtocol.getTaskNo1() == 0) {
+                            rgvMapUpdate(basRgvMap, basRgvMap.getStartRoute(), basRgvMap.getStartRoute(), "2366");
                         }
 
                     }
 
 
-
                 }
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             log.error("4109琛屾墽琛屽皬杞﹀垵濮嬪寲浠诲姟涓嬪彂澶辫触");
-            log.error("4109琛�"+e);
+            log.error("4109琛�" + e);
         }
     }
 
 
     /**
-     *  瀹屾垚灏忚溅浠诲姟
+     * 瀹屾垚灏忚溅浠诲姟
      */
     public synchronized void rgvCompleteWrkMastSta() {
-        try{
+        try {
             for (DevpSlave devp : slaveProperties.getDevp()) {
                 List<BasRgvMap> basRgvMaps = basRgvMapService.selectList(new EntityWrapper<>());
-            for (BasRgvMap rgvSlave:basRgvMaps) {
-                RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getRgvNo());
-                RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
-                if (rgvProtocol == null) {
-                    continue;
-                }else {
-                    rgvProtocol = rgvProtocol.clone();
-                }
-                BasRgv basRgv = basRgvService.selectById(rgvSlave.getRgvNo());
-                if (basRgv == null) {
-                    log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�3", rgvSlave.getRgvNo());
-                    continue;
-                }
+                for (BasRgvMap rgvSlave : basRgvMaps) {
+                    RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getRgvNo());
+                    RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
+                    if (rgvProtocol == null) {
+                        continue;
+                    } else {
+                        rgvProtocol = rgvProtocol.clone();
+                    }
+                    BasRgv basRgv = basRgvService.selectById(rgvSlave.getRgvNo());
+                    if (basRgv == null) {
+                        log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�3", rgvSlave.getRgvNo());
+                        continue;
+                    }
 
-                // 鍙湁褰揜GV绛夊緟WCS纭銆佽嚜鍔�
-                if ((rgvProtocol.getStatusType1() == RgvStatusType.WAITING || rgvProtocol.getStatusType1()==RgvStatusType.FETCHWAITING)
-                        && rgvProtocol.getModeType() == RgvModeType.AUTO
-                        && (rgvProtocol.getStatusType() == RgvStatusType.WORKING1)
-                ){
-                    log.info("{}鍙峰皬杞︾瓑寰厀cs纭锛岀姸鎬亄}锛屽弬鏁皗}",rgvProtocol.getRgvNo(),rgvProtocol.getStatusType(),rgvProtocol);
-                    if (rgvProtocol.getTaskNo1()!=0){
-                        if (rgvProtocol.getTaskNo1()==32222){
-                            boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo());
-                            if (!rgvComplete){
-                                log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�",rgvProtocol.getRgvNo());
+                    // 鍙湁褰揜GV绛夊緟WCS纭銆佽嚜鍔�
+                    if ((rgvProtocol.getStatusType1() == RgvStatusType.WAITING || rgvProtocol.getStatusType1() == RgvStatusType.FETCHWAITING)
+                            && rgvProtocol.getModeType() == RgvModeType.AUTO
+                            && (rgvProtocol.getStatusType() == RgvStatusType.WORKING1)
+                    ) {
+                        log.info("{}鍙峰皬杞︾瓑寰厀cs纭锛岀姸鎬亄}锛屽弬鏁皗}", rgvProtocol.getRgvNo(), rgvProtocol.getStatusType(), rgvProtocol);
+                        if (rgvProtocol.getTaskNo1() != 0) {
+                            if (rgvProtocol.getTaskNo1() == 32222) {
+                                boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo());
+                                if (!rgvComplete) {
+                                    log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�", rgvProtocol.getRgvNo());
+                                }
+                                BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+                                basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
+                                rgvMapUpdate(basRgvMap, basRgvMap.getStartRoute(), basRgvMap.getStartRoute(), "2415");
+                                rgvThread.setPakMk(true);
+                                break;
                             }
+                            WrkMastSta wrkMastSta = wrkMastStaMapper.selectByWrkNo(rgvProtocol.getTaskNo1().intValue());
+                            if (Cools.isEmpty(wrkMastSta) || wrkMastSta.getWrkSts() != 1) {
+                                log.error("鏈煡鍒板皬杞︽墽琛屼换鍔℃垨鑰呮墽琛屼换鍔$姸鎬佷笉绗﹀悎锛�" + wrkMastSta);
+                                continue;
+                            }
+
+                            SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+                            StaProtocol staProtocol = devpThread.getStation().get(wrkMastSta.getStaEnd());
+                            if (staProtocol == null) {
+                                continue;
+                            } else {
+                                staProtocol = staProtocol.clone();
+                            }
+                            if (!staProtocol.isAutoing() || !staProtocol.isLoading()) {
+                                continue;
+                            }
+                            WrkMast wrkMast = wrkMastMapper.selectPakInStep3(wrkMastSta.getWrkNo().intValue());
+                            if (!Cools.isEmpty(wrkMast)) {
+                                if (!staProtocol.isPakMk()) {
+                                    continue;
+                                }
+                                // 涓嬪彂绔欑偣淇℃伅
+                                staProtocol.setWorkNo(wrkMast.getWrkNo());
+                                staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
+                                devpThread.setPakMk(staProtocol.getSiteId(), false);
+                                log.error("rgv浠诲姟瀹屾垚缁欒緭閫佺嚎涓嬪彂鍛戒护锛�" + wrkMast.getWrkNo() + "," + wrkMast.getStaNo());
+                                if (!MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol))) {
+                                    continue;
+                                }
+                            } else {
+                                log.error("rgv浠诲姟瀹屾垚缁欒緭閫佺嚎涓嬪彂鍛戒护,浣嗘湭鏌ヨ鍒板伐浣滄。");
+                                // 涓嬪彂绔欑偣淇℃伅
+                                Map<Integer, Integer> map = new HashMap<>();
+                                map.put(101, 102);
+                                map.put(112, 111);
+                                map.put(100, 100);
+                                staProtocol.setWorkNo(rgvProtocol.getTaskNo1().intValue());
+                                staProtocol.setStaNo(map.get(rgvProtocol.getRgvPosI()).shortValue());
+                                devpThread.setPakMk(staProtocol.getSiteId(), false);
+//                            log.error("rgv浠诲姟瀹屾垚缁欒緭閫佺嚎涓嬪彂鍛戒护锛�"+wrkMast.getWrkNo()+","+wrkMast.getStaNo());
+                                if (!MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol))) {
+                                    continue;
+                                }
+                            }
+                            boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo());
+//                        boolean rgvComplete = true;
+                            if (!rgvComplete) {
+                                log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�", rgvProtocol.getRgvNo());
+                                break;
+                            }
+                            WrkMast wrkMast1 = wrkMastService.selectByWrkNo(rgvProtocol.getTaskNo1().intValue());
+                            wrkMast1.setPdcType("Y");
+
+                            wrkMastService.updateById(wrkMast1);
+
+                            wrkMastSta.setWrkSts(3);
+                            wrkMastStaMapper.updateById(wrkMastSta);
                             BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
                             basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
-                            rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute(),"2415");
+                            rgvMapUpdate(basRgvMap, basRgvMap.getStartRoute(), basRgvMap.getStartRoute(), "2471");
                             rgvThread.setPakMk(true);
-                            break;
-                        }
-                        WrkMastSta wrkMastSta = wrkMastStaMapper.selectByWrkNo(rgvProtocol.getTaskNo1().intValue());
-                        if (Cools.isEmpty(wrkMastSta) || wrkMastSta.getWrkSts()!=1){
-                            log.error("鏈煡鍒板皬杞︽墽琛屼换鍔℃垨鑰呮墽琛屼换鍔$姸鎬佷笉绗﹀悎锛�"+wrkMastSta);
-                            continue;
-                        }
-
-                        SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
-                        StaProtocol staProtocol = devpThread.getStation().get(wrkMastSta.getStaEnd());
-                        if (staProtocol == null) {
-                            continue;
                         } else {
-                            staProtocol = staProtocol.clone();
+                            log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{},绛夊緟wcs纭浣嗘槸娌℃湁宸ヤ綔鍙凤紒", rgvProtocol.getRgvNo());
                         }
-                        if (!staProtocol.isAutoing() || !staProtocol.isLoading()){
-                            continue;
-                        }
-                        WrkMast wrkMast = wrkMastMapper.selectPakInStep3(wrkMastSta.getWrkNo().intValue());
-                        if (!Cools.isEmpty(wrkMast)){
-                            if (!staProtocol.isPakMk()){
-                                continue;
-                            }
-                            // 涓嬪彂绔欑偣淇℃伅
-                            staProtocol.setWorkNo(wrkMast.getWrkNo());
-                            staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
-                            devpThread.setPakMk(staProtocol.getSiteId(), false);
-                            log.error("rgv浠诲姟瀹屾垚缁欒緭閫佺嚎涓嬪彂鍛戒护锛�"+wrkMast.getWrkNo()+","+wrkMast.getStaNo());
-                            if (!MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol))) {
-                                continue;
-                            }
-                        }else {
-                            log.error("rgv浠诲姟瀹屾垚缁欒緭閫佺嚎涓嬪彂鍛戒护,浣嗘湭鏌ヨ鍒板伐浣滄。");
-                            // 涓嬪彂绔欑偣淇℃伅
-                            Map<Integer,Integer> map = new HashMap<>();
-                            map.put(101,102);map.put(112,111);
-                            map.put(100,100);
-                            staProtocol.setWorkNo(rgvProtocol.getTaskNo1().intValue());
-                            staProtocol.setStaNo(map.get(rgvProtocol.getRgvPosI()).shortValue());
-                            devpThread.setPakMk(staProtocol.getSiteId(), false);
-//                            log.error("rgv浠诲姟瀹屾垚缁欒緭閫佺嚎涓嬪彂鍛戒护锛�"+wrkMast.getWrkNo()+","+wrkMast.getStaNo());
-                            if (!MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol))) {
-                                continue;
-                            }
-                        }
-                        boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo());
-//                        boolean rgvComplete = true;
-                        if (!rgvComplete){
-                            log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�",rgvProtocol.getRgvNo());
-                            break;
-                        }
-                        WrkMast wrkMast1 = wrkMastService.selectByWrkNo(rgvProtocol.getTaskNo1().intValue());
-                        wrkMast1.setPdcType("Y");
-
-                        wrkMastService.updateById(wrkMast1);
-
-                        wrkMastSta.setWrkSts(3);
-                        wrkMastStaMapper.updateById(wrkMastSta);
-                        BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
-                        basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
-                        rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute(),"2471");
-                        rgvThread.setPakMk(true);
-                    }
-
-                    else {
-                        log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{},绛夊緟wcs纭浣嗘槸娌℃湁宸ヤ綔鍙凤紒",rgvProtocol.getRgvNo());
                     }
                 }
             }
-            }
-        }catch (Exception e){
-            log.error("灏忚溅澶嶄綅绾跨▼鎶ラ敊锛�"+e);
+        } catch (Exception e) {
+            log.error("灏忚溅澶嶄綅绾跨▼鎶ラ敊锛�" + e);
         }
     }
+
     /**
      * 鎵ц灏忚溅鎼繍浠诲姟
      */
     public synchronized void rgvRunWrkMastFullSta() {
         boolean wrkEnable = false;
-        try{
+        try {
             List<BasRgvMap> basRgvMaps = basRgvMapService.selectList(new EntityWrapper<>());
-            for (BasRgvMap rgvSlave:basRgvMaps) {
+            for (BasRgvMap rgvSlave : basRgvMaps) {
                 RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getRgvNo());
                 RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
                 if (rgvProtocol == null) {
                     continue;
-                }else {
+                } else {
                     rgvProtocol = rgvProtocol.clone();
                 }
                 BasRgv basRgv = basRgvService.selectById(rgvSlave.getRgvNo());
@@ -2561,7 +2680,7 @@
                 // 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅涓�鏃犵墿//rgv鍙敤
                 if (rgvProtocol.getStatusType() == RgvStatusType.IDLE
                         && rgvProtocol.getModeType() == RgvModeType.AUTO
-                        && rgvProtocol.getLoaded1()==0
+                        && rgvProtocol.getLoaded1() == 0
                         && rgvProtocol.getTaskNo1() == 0
                         && rgvThread.isPakMk()
                 ) {
@@ -2573,44 +2692,54 @@
                     List<Integer> route = RouteUtils.getRoute(basRgvMap.getStartRoute(), basRgvMap.getEndRoute());
                     basRgvMap.setNowRoute(rgvProtocol.getRgvPosI()); //鏇存柊灏忚溅褰撳墠浣嶇疆绔欑偣鍙�
                     List<WrkMastSta> wrkMastStaList = wrkMastStaMapper.selectNoInterfereList(route, route);
-                    for (WrkMastSta wrkMastSta : wrkMastStaList){
-                        if (wrkMastSta.getType()!=0 || wrkMastSta.getWrkType()!=3){//1:婊$増   3锛氬彇鏀�
+                    for (WrkMastSta wrkMastSta : wrkMastStaList) {
+                        if (wrkMastSta.getType() != 0 || wrkMastSta.getWrkType() != 3 || wrkMastSta.getWrkSts() != 0) {//1:婊$増   3锛氬彇鏀�
                             continue;
+                        }
+                        //鍒ゆ柇宸ヤ綔缁撴潫浣嶇疆鐘舵��
+                        BasDevp devNo = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", wrkMastSta.getStaEnd()));
+                        if (!Cools.isEmpty(devNo)) {
+                            if (devNo.getAutoing().equals("Y") && !devNo.getWrkNo().equals(0) && !devNo.getLoading().equals("N")) {
+                                continue;
+                            }
                         }
                         boolean sign = rgvTakeFullAll(basRgvMap.getRgvNo(), wrkMastSta); //鍛戒护涓嬪彂
                         wrkEnable = true;
-                        if (sign){
+                        if (sign) {
                             rgvThread.setPakMk(false);
-                            boolean signMap = rgvMapUpdate(basRgvMap, wrkMastSta.getStaStart(), wrkMastSta.getStaEnd(),"2526");
-                            if (signMap){
+                            boolean signMap = rgvMapUpdate(basRgvMap, wrkMastSta.getStaStart(), wrkMastSta.getStaEnd(), "2526");
+                            if (signMap) {
                                 Thread.sleep(300);
                                 wrkMastSta.setWrkSts(1);
-                                try{
+                                try {
                                     wrkMastStaMapper.updateById(wrkMastSta);
                                     return;
-                                }catch (Exception e){
+                                } catch (Exception e) {
                                     log.error("鏇存柊灏忚溅浠诲姟澶辫触");
                                 }
                                 break;
-                            }else {
-                                log.error("3864琛岋紝璐х墿鎼繍浠诲姟锛氬伐浣滃彿{}鎵�灞炰换鍔′笅鍙戝悗鍦板浘鍚屾澶辫触",wrkMastSta.getWrkNo());
+                            } else {
+                                log.error("3864琛岋紝璐х墿鎼繍浠诲姟锛氬伐浣滃彿{}鎵�灞炰换鍔′笅鍙戝悗鍦板浘鍚屾澶辫触", wrkMastSta.getWrkNo());
+                                Thread.sleep(500);
                             }
                         } else {
-                            log.error("宸ヤ綔鍙穥}鎵�灞炰换鍔′笅鍙戝け璐�",wrkMastSta.getWrkNo());
+                            log.error("宸ヤ綔鍙穥}鎵�灞炰换鍔′笅鍙戝け璐�", wrkMastSta.getWrkNo());
+                            Thread.sleep(500);
                         }
                         break;
                     }
                 }
 
             }
-            if (!wrkEnable){
+            if (!wrkEnable) {
                 rgvRunWrkMastEmptyStaAvoidance();
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             log.error("3875琛屾墽琛屽皬杞︽惉杩愪换鍔′笅鍙戝け璐�");
-            log.error("3875琛�"+e);
+            log.error("3875琛�" + e);
         }
     }
+
     /**
      * 鎵ц灏忚溅鎼繍浠诲姟
      */
@@ -2744,18 +2873,18 @@
      * 鏈変换鍔′絾鏈墽琛�  姝ゆ椂闇�瑕佽皟鏁村皬杞︿綅缃�
      * */
     public synchronized void rgvRunWrkMastEmptyStaAvoidance() {
-        try{
-            Integer integer = wrkMastStaMapper.selectAllWrkStsCount(null,0);//鏌ヨ鐘舵�佷负0鐨勪换鍔�
-            if (integer==0){
+        try {
+            Integer integer = wrkMastStaMapper.selectAllWrkStsCount(null, 0);//鏌ヨ鐘舵�佷负0鐨勪换鍔�
+            if (integer == 0) {
                 return;
             }
             List<BasRgvMap> basRgvMaps = basRgvMapService.selectList(new EntityWrapper<>());
-            for (BasRgvMap rgvSlave:basRgvMaps) {
+            for (BasRgvMap rgvSlave : basRgvMaps) {
                 RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getRgvNo());
                 RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
                 if (rgvProtocol == null) {
                     continue;
-                }else {
+                } else {
                     rgvProtocol = rgvProtocol.clone();
                 }
                 BasRgv basRgv = basRgvService.selectById(rgvSlave.getRgvNo());
@@ -2767,14 +2896,14 @@
                 // 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅涓�鏃犵墿//rgv鍙敤
                 if (rgvProtocol.getStatusType() == RgvStatusType.IDLE
                         && rgvProtocol.getModeType() == RgvModeType.AUTO
-                        && rgvProtocol.getLoaded1()==0  //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
-                        && rgvProtocol.getTaskNo1()==0
+                        && rgvProtocol.getLoaded1() == 0  //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
+                        && rgvProtocol.getTaskNo1() == 0
                         && rgvProtocol.getStatusType1() == RgvStatusType.IDLE
                         && rgvThread.isPakMk()
 //                        && rgvProtocol.getTaskNo2()==0
-                ){
+                ) {
                     BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
-                    if (rgvProtocol.getRgvPosI().equals(basRgvMap.getStartRoute())){
+                    if (rgvProtocol.getRgvPosI().equals(basRgvMap.getStartRoute())) {
                         continue;
                     }
 //                    if (rgvProtocol.getRgvNo()==1 && rgvProtocol.getRgvPosI().equals(100)){
@@ -2783,28 +2912,28 @@
 //                        continue;
 //                    }
                     rgvAvoidanceXY(rgvProtocol.getRgvNo());
-                    rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute(),"2727");
+                    rgvMapUpdate(basRgvMap, basRgvMap.getStartRoute(), basRgvMap.getStartRoute(), "2727");
                 }
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             log.error("4109琛屾墽琛屽皬杞﹀垵濮嬪寲浠诲姟涓嬪彂澶辫触");
-            log.error("4109琛�"+e);
+            log.error("4109琛�" + e);
         }
     }
 
     /*
      * 灏忚溅XY绉诲姩  閬胯
      * */
-    public synchronized boolean rgvAvoidanceXY(Integer rgvId){
+    public synchronized boolean rgvAvoidanceXY(Integer rgvId) {
         BasRgvMap basRgvMap = basRgvMapService.selectByRgvNo(rgvId);
-        if (basRgvMap.getStartRoute() == 100 || basRgvMap.getStartRoute() == 101){
-            try{
+        if (basRgvMap.getStartRoute() == 100 || basRgvMap.getStartRoute() == 101) {
+            try {
 
                 //  鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
                 RgvCommand rgvCommand = new RgvCommand();
                 rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
                 rgvCommand.setAckFinish1((short) 0);  // 宸ヤ綅1浠诲姟瀹屾垚纭浣�
-                rgvCommand.setTaskNo1((short)32222); // 宸ヤ綅1宸ヤ綔鍙�
+                rgvCommand.setTaskNo1((short) 32222); // 宸ヤ綅1宸ヤ綔鍙�
                 rgvCommand.setTaskMode1(RgvTaskModeType.X_MOVE); // 宸ヤ綅1浠诲姟妯″紡:  鍥炲師鐐�
                 //basRgvMap.getLockStartRoute().shortValue()
                 rgvCommand.setSourceStaNo1(basRgvMap.getStartRoute().shortValue());
@@ -2816,17 +2945,17 @@
                 } else {
                     return true;
                 }
-            }catch (Exception e){
+            } catch (Exception e) {
                 return false;
 
             }
-        }else {
-            try{
+        } else {
+            try {
                 //  鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
                 RgvCommand rgvCommand = new RgvCommand();
                 rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
                 rgvCommand.setAckFinish1((short) 0);  // 宸ヤ綅1浠诲姟瀹屾垚纭浣�
-                rgvCommand.setTaskNo1((short)32222); // 宸ヤ綅1宸ヤ綔鍙�
+                rgvCommand.setTaskNo1((short) 32222); // 宸ヤ綅1宸ヤ綔鍙�
                 rgvCommand.setTaskMode1(RgvTaskModeType.X_MOVE); // 宸ヤ綅1浠诲姟妯″紡:  鍥炲師鐐�
                 //basRgvMap.getLockStartRoute().shortValue()
                 rgvCommand.setSourceStaNo1(basRgvMap.getStartRoute().shortValue());
@@ -2838,7 +2967,7 @@
                 } else {
                     return true;
                 }
-            }catch (Exception e){
+            } catch (Exception e) {
                 return false;
 
             }
@@ -2849,8 +2978,8 @@
     /*
      * 灏忚溅鍙栬揣鑷冲伐浣嶄换鍔�
      * */
-    public synchronized boolean rgvTakeFullAll(Integer rgvId,WrkMastSta wrkMastSta){
-        try{
+    public synchronized boolean rgvTakeFullAll(Integer rgvId, WrkMastSta wrkMastSta) {
+        try {
             //  鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
             RgvCommand rgvCommand = new RgvCommand();
             rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
@@ -2867,7 +2996,7 @@
             } else {
                 return true;
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             return false;
         }
     }
@@ -2975,19 +3104,19 @@
     /*
      * 灏忚溅澶嶄綅
      * */
-    public synchronized boolean rgvComplete(Integer rgvId){
-        try{
+    public synchronized boolean rgvComplete(Integer rgvId) {
+        try {
             //  鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
             if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(3, new RgvCommand()))) {
                 //step=2,宸ヤ綅1銆�2鍐欎换鍔★紱   step=4锛屽伐浣�1鍐欎换鍔★紱     step=5锛屽伐浣�2鍐欎换鍔�
-                log.error("RGV鍛戒护涓嬪彂澶辫触锛孯GV鍙�={}",rgvId);
+                log.error("RGV鍛戒护涓嬪彂澶辫触锛孯GV鍙�={}", rgvId);
                 return false;
             } else {
-                log.info("RGV鍛戒护涓嬪彂鎴愬姛锛孯GV鍙�={}",rgvId);
+                log.info("RGV鍛戒护涓嬪彂鎴愬姛锛孯GV鍙�={}", rgvId);
                 return true;
             }
-        }catch (Exception e){
-            log.error("RGV鍛戒护涓嬪彂澶辫触锛孯GV鍙�={}銆傚紓甯革細"+e,rgvId);
+        } catch (Exception e) {
+            log.error("RGV鍛戒护涓嬪彂澶辫触锛孯GV鍙�={}銆傚紓甯革細" + e, rgvId);
             return false;
         }
     }

--
Gitblit v1.9.1