From 62af9acaccedaea4c4c7efd4e68c8b702cf5a27d Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期六, 22 六月 2024 13:35:02 +0800
Subject: [PATCH] # 捷众二期开发

---
 src/main/java/com/zy/core/model/protocol/StaProtocol.java   |   23 
 src/main/resources/mapper/WrkDetlMapper.xml                 |    2 
 src/main/java/com/zy/core/thread/SiemensCrnThread.java      |  110 ++-
 src/main/webapp/views/crn.html                              |   31 +
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  263 +++++----
 src/main/webapp/static/js/console.map.js                    |  326 ++----------
 src/main/java/com/zy/asrs/entity/BasCrnp.java               |   24 
 src/main/java/com/zy/core/MainProcess.java                  |    6 
 src/main/java/com/zy/core/thread/SiemensDevpThread.java     |  395 +++++++++-----
 src/main/resources/application.yml                          |  325 +++++------
 10 files changed, 754 insertions(+), 751 deletions(-)

diff --git a/src/main/java/com/zy/asrs/entity/BasCrnp.java b/src/main/java/com/zy/asrs/entity/BasCrnp.java
index bdaa3b5..e1045c2 100644
--- a/src/main/java/com/zy/asrs/entity/BasCrnp.java
+++ b/src/main/java/com/zy/asrs/entity/BasCrnp.java
@@ -43,12 +43,12 @@
     @TableField("out_enable")
     private String outEnable;
 
-    /**
-     * 鍥炲師鐐�
-     */
-    @ApiModelProperty(value= "鍥炲師鐐�")
-    @TableField("move_origin")
-    private String moveOrigin;
+//    /**
+//     * 鍥炲師鐐�
+//     */
+//    @ApiModelProperty(value= "鍥炲師鐐�")
+//    @TableField("move_origin")
+//    private String moveOrigin;
 
     /**
      * 鐘舵��
@@ -160,7 +160,7 @@
     public BasCrnp(String inEnable,String outEnable,String moveOrigin,Integer crnSts,Integer wrkNo,Long crnErr,String frmLocno,Integer frmSta,Integer toSta,String toLocno,Long appeUser,Date appeTime,Long modiUser,Date modiTime,String hpMk,String retrieveMk,String ctlHp,String ctlRest,String empIn,Integer tankQty,Integer tankQty1) {
         this.inEnable = inEnable;
         this.outEnable = outEnable;
-        this.moveOrigin = moveOrigin;
+//        this.moveOrigin = moveOrigin;
         this.crnSts = crnSts;
         this.wrkNo = wrkNo;
         this.crnErr = crnErr;
@@ -228,11 +228,11 @@
         this.outEnable = outEnable;
     }
 
-    public String getMoveOrigin() { return moveOrigin; }
-
-    public void setMoveOrigin(String moveOrigin) {
-        this.moveOrigin = moveOrigin;
-    }
+//    public String getMoveOrigin() { return moveOrigin; }
+//
+//    public void setMoveOrigin(String moveOrigin) {
+//        this.moveOrigin = moveOrigin;
+//    }
 
     public Integer getCrnSts() {
         return crnSts;
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 ec5c4dd..b55123d 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1,7 +1,5 @@
 package com.zy.asrs.service.impl;
 
-import HslCommunication.Core.Types.OperateResultExOne;
-import HslCommunication.Profinet.Siemens.SiemensS7Net;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
@@ -93,7 +91,7 @@
     private WrkMastService wrkMastService;
     @Value("${wms.url}")
     private String wmsUrl;
-
+    public short wrkNo = 9999;
     /**
      * 缁勬墭
      * 鍏ュ簱绔欙紝鏍规嵁鏉$爜鎵弿鐢熸垚鍏ュ簱宸ヤ綔妗o紝宸ヤ綔鐘舵�� 2
@@ -112,27 +110,94 @@
                 // 鑾峰彇鍏ュ簱绔欎俊鎭�
                 SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                 StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
+                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                 if (staProtocol == null) {
                     continue;
                 } else {
                     staProtocol = staProtocol.clone();
                 }
 
-                //LED
-                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
-                // 鍏ュ嚭搴撴ā寮忓垽鏂�
-//                if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; }
-//                if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) {
-//                    continue;
-//                }
-
-                // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
-                if (!staProtocol.isLoading()){
+                String barcode = barcodeThread.getBarcode();
+                if (Cools.isEmpty(barcode)) {
                     continue;
                 }
+
+                if(!staProtocol.isInEnable()) {
+                    continue;
+                }
+
+                // 灏哄妫�娴嬪紓甯�
+                boolean back = false;
+                String errMsg = "";
+                if (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 && devp.getId() == 2) {
+                    if(staProtocol.getWorkNo() == 9907 && '5' != barcode.charAt(0)){
+                        errMsg = "鏉$爜5鍙兘鍏�7鎺�";
+                        back = true;
+                    }
+                    if(staProtocol.getWorkNo() == 9906 && '5' == barcode.charAt(0)){
+                        errMsg = "鏉$爜5涓嶈兘鍏�6鎺�";
+                        back = true;
+                    }
+                }
+
+                //鎷f枡銆佺洏鐐逛换鍔★紝涓嶈繘鍏ユ柊鏉垮叆搴撴柟娉曪紝鐩存帴璺冲嚭
+                if(staProtocol.getWorkNo() == 9995){
+                    continue;
+                }
+
+                // 閫�鍥�
+                if (back) {
+//                    News.warn("鎵爜鍏ュ簱澶辫触锛寋}鍏ュ簱绔欏洜{}寮傚父锛屾墭鐩樺凡琚��鍥�", inSta.getStaNo(), errMsg);
+//                    if(!staProtocol.isOutEnable()){
+//                        continue;
+//                    }
+
+                    if (!staProtocol.isLoading()){
+                        continue;
+                    }
+                    if (!staProtocol.isPakMk()) {
+                        continue;
+                    }
+                    staProtocol.setWorkNo(wrkNo);
+                    News.warn("{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", inSta.getStaNo(), errMsg,wrkNo);
+                    staProtocol.setStaNo(inSta.getBackSta().shortValue());
+                    devpThread.setPakMk(staProtocol.getSiteId(), false);
+                    MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg));
+                }
+
 //                String barcode11 = barcodeThread.getBarcode();
-//                if (Cools.isEmpty(barcode11)){
-//                    if (staProtocol.isAutoing()&& !staProtocol.isEmptyMk() && staProtocol.getWorkNo() == 9999 && staProtocol.isPakMk() && staProtocol.getStamp()>=2){
+//                if (Cools.isEmpty(barcode)){
+//                    if (staProtocol.isAutoing()&& !staProtocol.isEmptyMk() && staProtocol.isPakMk() && staProtocol.getStamp()>=2){
 //                        staProtocol.setStamp(0);
 //                        News.info(""+mark+" - 7"+" - 鎵爜澶辫触2 ===>> {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{},绔欑偣:{}", inSta.getBarcode(), barcode11, inSta.getStaNo());
 //                        staProtocol.setWorkNo((short) 9989);
@@ -147,81 +212,41 @@
 //                        continue;
 //                    }
 //                }
-                //瓒呭瓒呴珮娌℃壂鍒版潯鐮佹姤璀�
-//                boolean fig=false;
-//                for(int i=0;i<8;i++){
-//                    switch (i){
-//                        case 0: if(devpThread.startSignal[i]){
-//                            log.error("鍓嶈秴鎶ヨ");
-//                            fig=true;
-//                        };
-//                        case 1: if(devpThread.startSignal[i]){
-//                            log.error("鍚庤秴鎶ヨ");
-//                            fig=true;
-//                        };
-//                        case 2: if(devpThread.startSignal[i]){
-//                            log.error("楂樿秴鎶ヨ");
-//                            fig=true;
-//                        };
-//                        case 3: if(devpThread.startSignal[i]){
-//                            log.error("宸﹁秴鎶ヨ");
-//                            fig=true;
-//                        };
-//                        case 4: if(devpThread.startSignal[i]){
-//                            log.error("鍙宠秴鎶ヨ");
-//                            fig=true;
-//                        };
-//                        case 5: if(devpThread.startSignal[i]){
-//                            log.error("瓒呴噸鎶ヨ");
-//                            fig=true;
-//                        };
-//                        case 6: if(devpThread.startSignal[i]){
-//                            log.error("鏈壂鍒扮爜鎶ヨ");
-//                            fig=true;
-//                        };
-//
-//                    }
-//                }
                 if (staProtocol.isAutoing() && staProtocol.isInEnable()
-                        && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990)
-                        && staProtocol.isPakMk()) { //&& staProtocol.getStamp()>=2) {// && !Cools.isEmpty(barcode)) {
+                        && !staProtocol.isEmptyMk() && staProtocol.getWorkNo() > 9000
+                        && staProtocol.isPakMk() && !back) { //&& staProtocol.getStamp()>=2) {// && !Cools.isEmpty(barcode)) {
                     News.warnNoLog(""+mark+" - 0"+" - 寮�濮嬫墽琛�");
-//                    try {
-//                        Thread.sleep(300);
-//                    }catch (Exception e){}
-
-                    String barcode = barcodeThread.getBarcode();
-                    if(!Cools.isEmpty(barcode)) {
-                        News.info(""+mark+" - 1"+" - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
-
-                        if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
-                            staProtocol.setWorkNo((short) 9999);
-                            staProtocol.setStaNo(inSta.getBackSta().shortValue());
-                            devpThread.setPakMk(staProtocol.getSiteId(), false);
-                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-
-                            News.info(""+mark+" - 2"+" - 鎵爜澶辫触1 ===>> {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{},绔欑偣:{}", inSta.getBarcode(), barcode, inSta.getStaNo());
-                            // led 寮傚父鏄剧ず
-                            if (ledThread != null) {
-                                String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
-                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg));
-                            }
-                            continue;
-                        }
-                    } else {
-                        staProtocol.setWorkNo((short) 9999);
-                        staProtocol.setStaNo(inSta.getBackSta().shortValue());
-                        devpThread.setPakMk(staProtocol.getSiteId(), false);
-                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-
-                        News.info(""+mark+" - 3"+" - 鎵爜澶辫触2 ===>> {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{},绔欑偣:{}", inSta.getBarcode(), barcode, inSta.getStaNo());
-                        // led 寮傚父鏄剧ず
-                        if (ledThread != null) {
-                            String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
-                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg));
-                        }
-                        continue;
-                    }
+//                    if(!Cools.isEmpty(barcode) ) {
+////                        News.info(""+mark+" - 1"+" - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
+//
+//                        if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
+//                            staProtocol.setWorkNo((short) 9999);
+//                            staProtocol.setStaNo(inSta.getBackSta().shortValue());
+//                            devpThread.setPakMk(staProtocol.getSiteId(), false);
+//                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+//
+//                            News.info(""+mark+" - 2"+" - 鎵爜澶辫触1 ===>> {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{},绔欑偣:{}", inSta.getBarcode(), barcode, inSta.getStaNo());
+//                            // led 寮傚父鏄剧ず
+//                            if (ledThread != null) {
+//                                String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
+//                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg));
+//                            }
+//                            continue;
+//                        }
+//                    } else {
+//                        staProtocol.setWorkNo((short) 9999);
+//                        staProtocol.setStaNo(inSta.getBackSta().shortValue());
+//                        devpThread.setPakMk(staProtocol.getSiteId(), false);
+//                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+//
+//                        News.info(""+mark+" - 3"+" - 鎵爜澶辫触2 ===>> {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{},绔欑偣:{}", inSta.getBarcode(), barcode, inSta.getStaNo());
+//                        // led 寮傚父鏄剧ず
+//                        if (ledThread != null) {
+//                            String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
+//                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg));
+//                        }
+//                        continue;
+//                    }
 
                     // 鍒ゆ柇閲嶅宸ヤ綔妗�
                     WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
@@ -233,7 +258,7 @@
                         }
                     }
                     if (wrkMast != null) {
-                        News.error(""+mark+" - 4"+" - 宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
+                        News.warn(""+mark+" - 4"+" - 宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
                         staProtocol.setWorkNo((short)9999);
                         staProtocol.setStaNo(inSta.getBackSta().shortValue());
                         devpThread.setPakMk(staProtocol.getSiteId(), false);
@@ -406,7 +431,7 @@
                 }
                 String barcode = barcodeThread.getBarcode();
                 if(!Cools.isEmpty(barcode)) {
-                    News.info(""+mark+" - 1"+" - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
+//                    News.info(""+mark+" - 1"+" - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
                     if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
                         continue;
                     }
@@ -440,18 +465,32 @@
                     }
 
                     // 鎷c�佺洏銆佸苟 浣滀笟绔欒浆鎹�
-//                    int stnNo = 0;
-//                    if (wrkMast.getStaNo() == 109) {
-//                        stnNo = 127;
-//                    } else if (wrkMast.getStaNo() == 113) {
-//                        stnNo = 128;
-//                    } else {
-//                        log.error("{}鍙蜂换鍔℃暟鎹紓甯革紒", wrkMast.getWrkNo());
-//                    }
+                    int stnNo = 0;
+                    if (wrkMast.getIoType() == 103) { // 鎷f枡鍑哄簱
+                        if(wrkMast.getCrnNo() == 1) {
+                            stnNo = 104;
+                        }else if(wrkMast.getCrnNo() == 2) {
+                            stnNo =204;
+                        }else if(wrkMast.getCrnNo() == 3) {
+                            stnNo = 304;
+                        }
+                    } else if(wrkMast.getIoType() == 107){ //鐩樼偣鍑哄簱
+                        if(wrkMast.getCrnNo() == 1) {
+                            stnNo = 101;
+                        }else if(wrkMast.getCrnNo() == 2) {
+                            stnNo =201;
+                        }else if(wrkMast.getCrnNo() == 3) {
+                            stnNo = 301;
+                        }
+                    }
+                    if (stnNo == 0) {
+                        log.error("{}鍙蜂换鍔℃暟鎹紓甯革紒", wrkMast.getWrkNo());
+                        continue;
+                    }
                     // 鑾峰彇鐩爣绔�
                     Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
                             .eq("type_no", wrkMast.getIoType() - 50)
-                            .eq("stn_no", pickSta.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯
+                            .eq("stn_no", stnNo) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯
                             .eq("crn_no", wrkMast.getCrnNo()); // 鍫嗗灈鏈哄彿
                     StaDesc staDesc = staDescService.selectOne(wrapper);
                     if (Cools.isEmpty(staDesc)) {
@@ -487,7 +526,7 @@
                         wrkMast.setIoTime(now);
                         wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
                         wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
-                        wrkMast.setSourceStaNo(100); // 婧愮珯
+                        wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 婧愮珯
                         wrkMast.setStaNo(staNo); // 鐩爣绔�
                         wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
                         wrkMast.setSourceLocNo(""); // 婧愬簱浣嶆竻绌�
@@ -656,13 +695,13 @@
             //mark - 3 - ....
             this.locToLoc(crn, crnProtocol,mark);
 
-            if (!Cools.isEmpty(basCrnp.getMoveOrigin()) && basCrnp.getMoveOrigin().equals("Y")){
-                if (crnProtocol.getStatusType() == CrnStatusType.IDLE && crnProtocol.getTaskNo() == 0 && crnProtocol.getModeType() == CrnModeType.AUTO
-                        && crnThread.isCmdFlag()) {
-                    this.crnMoveIntXY(crn, crnProtocol, crnThread);
-                    this.crnMoveOutXY(crn, crnProtocol, crnThread);
-                }
-            }
+//            if (!Cools.isEmpty(basCrnp.getMoveOrigin()) && basCrnp.getMoveOrigin().equals("Y")){
+//                if (crnProtocol.getStatusType() == CrnStatusType.IDLE && crnProtocol.getTaskNo() == 0 && crnProtocol.getModeType() == CrnModeType.AUTO
+//                        && crnThread.isCmdFlag()) {
+//                    this.crnMoveIntXY(crn, crnProtocol, crnThread);
+//                    this.crnMoveOutXY(crn, crnProtocol, crnThread);
+//                }
+//            }
 //            this.crnRebackHp(crnProtocol, crnThread);
 
         }
@@ -934,6 +973,7 @@
                 crnCommand.setDestinationPosX(locMast.getRow1().shortValue());     // 鐩爣搴撲綅鎺�
                 crnCommand.setDestinationPosY(locMast.getBay1().shortValue());     // 鐩爣搴撲綅鍒�
                 crnCommand.setDestinationPosZ(locMast.getLev1().shortValue());     // 鐩爣搴撲綅灞�
+                crnCommand.setCommand((short) 1);
                 if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
                     News.error(""+mark+" - 1"+" - 16"+" - 鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
                 } else {
@@ -1101,6 +1141,7 @@
                         crnCommand.setDestinationPosX(crnStn.getRow().shortValue());     // 鐩爣搴撲綅鎺�
                         crnCommand.setDestinationPosY(crnStn.getBay().shortValue());     // 鐩爣搴撲綅鍒�
                         crnCommand.setDestinationPosZ(crnStn.getLev().shortValue());     // 鐩爣搴撲綅灞�
+                        crnCommand.setCommand((short) 1);
                         if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
                             News.error(""+mark+" - 2"+" - 13"+" - 鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
                         } else {
@@ -1332,7 +1373,8 @@
                     crnThread.setResetFlag(true);
                 } else {
                     // 鑾峰彇鍏ュ簱寰呯‘璁ゅ伐浣滄。
-                    WrkMast wrkMast = wrkMastMapper.selectPakInStep3(crnProtocol.getTaskNo().intValue());
+                    System.out.println("浠诲姟鍙�"+crnProtocol.getTaskNo());
+                    WrkMast wrkMast = wrkMastMapper.selectPakInStep3(Integer.valueOf(crnProtocol.getTaskNo()));
                     if (wrkMast == null) {
                         News.error(""+mark+" - 1"+" - 鍫嗗灈鏈哄浜庣瓑寰呯‘璁や笖浠诲姟瀹屾垚鐘舵�侊紝浣嗘湭鎵惧埌宸ヤ綔妗c�傚爢鍨涙満鍙�={}锛屽伐浣滃彿={}", crn.getId(), crnProtocol.getTaskNo());
                         continue;
@@ -1513,8 +1555,9 @@
                 if (staProtocol.isAutoing()
                         && staProtocol.isInEnable()
                         && staProtocol.isEmptyMk()
-                        && (staProtocol.getWorkNo() > 9990 && staProtocol.getWorkNo() <= 9999)
-                        && staProtocol.isPakMk() ) {
+                        && (staProtocol.getWorkNo() >= 9990 && staProtocol.getWorkNo() <= 9999)
+                        && staProtocol.isPakMk()
+                ) {
                     News.warnNoLog(""+mark+" - 0"+" - 寮�濮嬫墽琛岋細绌烘爤鏉垮垵濮嬪寲鍏ュ簱,鍙夎溅鍏ュ簱绔欐斁璐�");
 
                     try {
diff --git a/src/main/java/com/zy/core/MainProcess.java b/src/main/java/com/zy/core/MainProcess.java
index 6315b0b..b5c9937 100644
--- a/src/main/java/com/zy/core/MainProcess.java
+++ b/src/main/java/com/zy/core/MainProcess.java
@@ -5,11 +5,9 @@
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.PreDestroy;
-import java.util.ArrayList;
 
 /**
  * WCS涓绘祦绋�
@@ -44,12 +42,12 @@
                     }
 
                     // 婕旂ず
-                    mainService.crnDemoOfLocMove1();
+//                    mainService.crnDemoOfLocMove1();
                     // 鍏ュ嚭搴撴ā寮忓垏鎹㈠嚱鏁�
 //                    mainService.ioConvert();
                     // 鍏ュ簱  ===>> 鍏ュ簱绔欏埌鍫嗗灈鏈虹珯锛屾牴鎹潯鐮佹壂鎻忕敓鎴愬叆搴撳伐浣滄。
                     mainService.generateStoreWrkFile(1); // 缁勬墭
-                    mainService.generateStoreWrkFile0(2); // WMS鍏ュ簱
+//                    mainService.generateStoreWrkFile0(2); // WMS鍏ュ簱
                     Thread.sleep(500);
                     // 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱
                     mainService.stnToCrnStnPick(3);
diff --git a/src/main/java/com/zy/core/model/protocol/StaProtocol.java b/src/main/java/com/zy/core/model/protocol/StaProtocol.java
index 8bda488..fcdfab9 100644
--- a/src/main/java/com/zy/core/model/protocol/StaProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/StaProtocol.java
@@ -51,6 +51,29 @@
     // 閿佸畾鏍囪
     private boolean pakMk = true;
 
+    // 澶栧舰妫�娴� ------------------------------------------------------------------------
+
+    // 鍓嶈秴闄�
+    private boolean frontErr = false;
+
+    // 鍚庤秴闄�
+    private boolean backErr = false;
+
+    // 楂樿秴闄�
+    private boolean highErr = false;
+
+    // 宸﹁秴闄�
+    private boolean leftErr = false;
+
+    // 鍙宠秴闄�
+    private boolean rightErr = false;
+
+    // 瓒呴噸
+    private boolean weightErr = false;
+
+    // 鎵爜澶辫触
+    private boolean barcodeErr = false;
+
     // 鍏ュ簱鏆傚瓨鏁�
     private Short inQty;
 
diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
index ab70f5b..a410ab6 100644
--- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -5,7 +5,6 @@
 import HslCommunication.Profinet.Siemens.SiemensPLCS;
 import HslCommunication.Profinet.Siemens.SiemensS7Net;
 import com.alibaba.fastjson.JSON;
-import com.core.common.Cools;
 import com.core.common.DateUtils;
 import com.core.common.SpringUtils;
 import com.zy.asrs.entity.BasCrnOpt;
@@ -16,7 +15,9 @@
 import com.zy.core.CrnThread;
 import com.zy.core.cache.MessageQueue;
 import com.zy.core.cache.OutputQueue;
-import com.zy.core.enums.*;
+import com.zy.core.enums.CrnStatusType;
+import com.zy.core.enums.CrnTaskModeType;
+import com.zy.core.enums.SlaveType;
 import com.zy.core.model.CrnSlave;
 import com.zy.core.model.Task;
 import com.zy.core.model.command.CrnCommand;
@@ -158,7 +159,7 @@
      */
     private void readStatus(){
         try {
-            OperateResultExOne<byte[]> result = siemensNet.Read("DB91.0", (short) 52);
+            OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 54);
             if (result.IsSuccess) {
                 if (null == crnProtocol) {
                     crnProtocol = new CrnProtocol();
@@ -175,20 +176,20 @@
                 crnProtocol.setLoaded(siemensNet.getByteTransform().TransInt16(result.Content, 16));
                 crnProtocol.setAlarm(siemensNet.getByteTransform().TransInt16(result.Content, 18));
 
-//                crnProtocol.setxSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 28));
-//                crnProtocol.setySpeed(siemensNet.getByteTransform().TransInt16(result.Content, 32));
-//                crnProtocol.setzSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 36));
-                crnProtocol.setxSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 34));
-                crnProtocol.setySpeed(siemensNet.getByteTransform().TransInt16(result.Content, 36));
-                crnProtocol.setzSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 38));
+                crnProtocol.setxSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 28));
+                crnProtocol.setySpeed(siemensNet.getByteTransform().TransInt16(result.Content, 32));
+                crnProtocol.setzSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 36));
+//                crnProtocol.setxSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 34));
+//                crnProtocol.setySpeed(siemensNet.getByteTransform().TransInt16(result.Content, 36));
+//                crnProtocol.setzSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 38));
 
-//                crnProtocol.setxDistance(siemensNet.getByteTransform().TransInt16(result.Content, 40));
-//                crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 44));
-//                crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 48));
                 crnProtocol.setxDistance(siemensNet.getByteTransform().TransInt16(result.Content, 40));
-                crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 42));
-                crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 44));
-                crnProtocol.setyDuration(siemensNet.getByteTransform().TransInt16(result.Content, 46));
+                crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 44));
+                crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 48));
+//                crnProtocol.setxDistance(siemensNet.getByteTransform().TransInt16(result.Content, 40));
+//                crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 42));
+//                crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 44));
+                crnProtocol.setyDuration(siemensNet.getByteTransform().TransInt16(result.Content, 52));
 
 
 //                crnProtocol.setTemp1(siemensNet.getByteTransform().TransInt16(result.Content, 20));
@@ -201,15 +202,28 @@
                 OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
 
                 // 澶嶄綅淇″彿
-                if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) {
+//                if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) {
+//                    if (resetFlag) {
+//                        if(crnProtocol.getTaskNo()==9999){
+//                            backHpFlag = false;
+//                        }
+//                        CrnCommand crnCommand = new CrnCommand();
+//                        crnCommand.setAckFinish((short)1);
+//                        if (write(crnCommand)) {
+//                            resetFlag = false;
+//                        }
+//                    }
+//                }
+
+                if (crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) {
+//                    News.error("-------------------------------------------绗竴姝ャ�乕鍫嗗灈鏈哄彿锛歿}, 宸ヤ綔鍙凤細{}, 杞借揣鍙颁俊鍙�:{}]==>> 鐘舵�佷负10锛岀瓑寰呯‘璁わ紒锛�",
+//                            slave.getId(),crnProtocol.getTaskNo(), crnProtocol.getLoaded()==1 ? "鏈夌墿" : "鏃犵墿");
                     if (resetFlag) {
-                        if(crnProtocol.getTaskNo()==9999){
-                            backHpFlag = false;
-                        }
                         CrnCommand crnCommand = new CrnCommand();
                         crnCommand.setAckFinish((short)1);
                         if (write(crnCommand)) {
                             resetFlag = false;
+//                            cmdFlag = true;
                         }
                     }
                 }
@@ -255,27 +269,33 @@
             News.error("SiemensCrn"+" - 6"+" - 鍫嗗灈鏈哄啓鍏ュ懡浠や负绌�");
             return false;
         }
+        OperateResult result;
 //        convertRow(command);
-        command.setCrnNo(slave.getId());
-        short[] array = new short[10];
-        array[0] = command.getAckFinish();
-        array[1] = command.getTaskNo();
-        array[2] = command.getTaskMode();
-        array[3] = command.getSourcePosX();
-        array[4] = command.getSourcePosY();
-        array[5] = command.getSourcePosZ();
-        array[6] = command.getDestinationPosX();
-        array[7] = command.getDestinationPosY();
-        array[8] = command.getDestinationPosZ();
+        if (command.getAckFinish() == 1) {
+            result = siemensNet.Write("DB100.0", (short) 1);
+//            result = siemensNet.Write("DB100.18", 0);
+        } else {
+            command.setCrnNo(slave.getId());
+            short[] array = new short[10];
+            array[0] = command.getAckFinish();
+            array[1] = command.getTaskNo();
+            array[2] = command.getTaskMode();
+            array[3] = command.getSourcePosX();
+            array[4] = command.getSourcePosY();
+            array[5] = command.getSourcePosZ();
+            array[6] = command.getDestinationPosX();
+            array[7] = command.getDestinationPosY();
+            array[8] = command.getDestinationPosZ();
 //        array[9] = command.getSourceStaNo();
 //        array[10] = command.getDestinationStaNo();
-        array[9] = command.getCommand();
-        OperateResult result = siemensNet.Write("DB90.0", array);
+            array[9] = command.getCommand();
+            result = siemensNet.Write("DB100.0", array);
 
-        if (command.getAckFinish() == 0) {
-            short commandFinish = 1;
-            Thread.sleep(100L);
-            result = siemensNet.Write("DB90.18", commandFinish);
+//            if (command.getAckFinish() == 0) {
+//                short commandFinish = 1;
+//                Thread.sleep(100L);
+//                result = siemensNet.Write("DB100.18", commandFinish);
+//            }
         }
 
         try {
@@ -326,7 +346,8 @@
     public static void main(String[] args) throws InterruptedException {
         CrnSlave slave = new CrnSlave();
         slave.setId(1);
-        slave.setIp("192.168.6.9");
+        slave.setIp("10.10.10.10");
+        slave.setPort(0);
         slave.setRack(0);
         slave.setSlot(0);
         SiemensCrnThread crnThread = new SiemensCrnThread(slave);
@@ -337,16 +358,17 @@
 
         // 1.鍏ュ簱 婧愬拰鐩爣閮藉彂
 //        CrnCommand command = new CrnCommand();
-//        command.setCrnNo(1); // 鍫嗗灈鏈虹紪鍙�
-//        command.setTaskNo((short) 0); // 宸ヤ綔鍙�
+////        command.setCrnNo(3); // 鍫嗗灈鏈虹紪鍙�
+//        command.setTaskNo((short) 2); // 宸ヤ綔鍙�
 //        command.setAckFinish((short) 0);  // 浠诲姟瀹屾垚纭浣�
 //        command.setTaskMode(CrnTaskModeType.PAKIN); // 浠诲姟妯″紡
-//        command.setSourcePosX((short) 1);     // 婧愬簱浣嶆帓
-//        command.setSourcePosY((short) 0);     // 婧愬簱浣嶅垪
-//        command.setSourcePosZ((short) 1);     // 婧愬簱浣嶅眰
-//        command.setDestinationPosX((short) 2);     // 鐩爣搴撲綅鎺�
-//        command.setDestinationPosY((short) 3);     // 鐩爣搴撲綅鍒�
+//        command.setSourcePosX((short) 6);     // 婧愬簱浣嶆帓
+//        command.setSourcePosY((short) 2);     // 婧愬簱浣嶅垪
+//        command.setSourcePosZ((short) 2);     // 婧愬簱浣嶅眰
+//        command.setDestinationPosX((short) 6);     // 鐩爣搴撲綅鎺�
+//        command.setDestinationPosY((short) 0);     // 鐩爣搴撲綅鍒�
 //        command.setDestinationPosZ((short) 1);     // 鐩爣搴撲綅灞�
+//        command.setCommand((short)1);
 //        crnThread.write(command);
 
         // 2.鍑哄簱 婧愬拰鐩爣閮藉彂
diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index 90cbc08..a2528c8 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -56,15 +56,15 @@
         add(300);add(301);add(302);add(303);add(304);
     }};
 
+    public static final ArrayList<Integer> barcode1 = new ArrayList<Integer>() {{
+        add(1); add(2);
+    }};
 
-
+    public static final ArrayList<Integer> barcode2 = new ArrayList<Integer>() {{
+       add(3);
+    }};
 
     private Integer count=0;
-
-    /**
-     * 鏉$爜鏁伴噺
-     */
-    private int barcodeSize = 2;
 
     /**
      * 鍏ュ嚭搴撴ā寮�
@@ -157,6 +157,17 @@
         }
     }
 
+    private ArrayList<Integer> getBarcodeList() {
+        switch (slave.getId()) {
+            case 1:
+                return barcode1;
+            case 2:
+                return barcode2;
+            default:
+                throw new CoolException("鑾峰彇鏉$爜鎵弿鍣ㄥけ璐ワ紒");
+        }
+    }
+
     @Override
     public boolean connect() {
         boolean result = false;
@@ -183,101 +194,194 @@
     private void read() throws InterruptedException {
 //        // 鏇存柊鍏ュ嚭搴撴ā寮�
 //        updateIoMode();
+        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
         ArrayList<Integer> staNos = getStaNo();
         int staNoSize = staNos.size();
-        OperateResultExOne<byte[]> result = siemensS7Net.Read("DB100.0", (short) (staNoSize*4));
-//        OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB101.0", (short) (staNoSize*2));
-        if (result.IsSuccess) {
-            for (int i = 0; i < staNoSize; i++) {
-                Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
-                StaProtocol staProtocol = station.get(siteId);
-                if (null == staProtocol) {
-                    staProtocol = new StaProtocol();
-                    staProtocol.setSiteId(siteId);
-                    station.put(siteId, staProtocol);
-                }
-                staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4));     // 宸ヤ綔鍙�
+        if (slave.getId() == 1) {
 
-                staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4+2));   // 鐩爣绔�
+        } else if (slave.getId() == 2) {
+            OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize*8));
+            if (result.IsSuccess) {
+                for (int i = 0; i < staNoSize; i++) {
+                    Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
+                    StaProtocol staProtocol = station.get(siteId);
+                    if (null == staProtocol) {
+                        staProtocol = new StaProtocol();
+                        staProtocol.setSiteId(siteId);
+                        station.put(siteId, staProtocol);
+                    }
+                    staProtocol.setWorkNo((short) siemensS7Net.getByteTransform().TransInt32(result.Content, i * 8));     // 宸ヤ綔鍙�
+                    staProtocol.setStaNo( siemensS7Net.getByteTransform().TransInt16(result.Content, i*8 + 4 ));   // 鐩爣绔�
+                    boolean[] status = siemensS7Net.getByteTransform().TransBool(result.Content, i*8+6, 1);
+                    staProtocol.setAutoing(status[0]);  // 鑷姩
+                    staProtocol.setLoading(status[1]);  // 鏈夌墿
+                    staProtocol.setInEnable(status[2]); // 鍙叆
+                    staProtocol.setOutEnable(status[3]);// 鍙嚭
+                    staProtocol.setEmptyMk(status[4]);  // 绌烘澘淇″彿
+                    staProtocol.setFullPlt(status[5]);  // 婊℃墭鐩�
+                    staProtocol.setHigh(status[6]);     // 楂樺簱浣�
+                    staProtocol.setLow(status[7]);      // 浣庡簱浣�
+//                staProtocol.setWeight(status[8]);  //鏄惁涓洪噸璐�
+                    if (!staProtocol.isPakMk() && staProtocol.isLoading()) {
+                        staProtocol.setPakMk(true);
+                    }
+                }
+
+                // 鏍规嵁瀹炴椂淇℃伅鏇存柊鏁版嵁搴�
+                try {
+                    List<BasDevp> basDevps = new ArrayList<>();
+                    for (Integer siteId : staNos) {
+                        StaProtocol staProtocol = station.get(siteId);
+                        basDevps.add(staProtocol.toSqlModel());
+                    }
+
+                    BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
+                    if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) {
+                        throw new Exception("鏇存柊鏁版嵁搴撴暟鎹け璐�");
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戞洿鏂版暟鎹簱鏁版嵁澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
+                    News.error(methodName + ":鏇存柊鏁版嵁搴撴暟鎹け璐� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
+                }
+            } else {
+                OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戣鍙栬緭閫佺嚎plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+                log.error("璇诲彇杈撻�佺嚎plc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}] ", slave.getId(), slave.getIp(), slave.getPort());
             }
-        }
 
-        Thread.sleep(200);
-        OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB100.60", (short) (staNoSize * 2));
-        if (result1.IsSuccess) {
-            for (int i = 0; i < staNoSize; i++) {
-                Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
-                boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i*2, 1);
-                boolean[] status2 = siemensS7Net.getByteTransform().TransBool(result1.Content, i*2+1, 1);
-                StaProtocol staProtocol = station.get(siteId);
-                staProtocol.setAutoing(status[0]);  // 鑷姩
-                staProtocol.setLoading(status[1]);  // 鏈夌墿
-                staProtocol.setInEnable(status[2]); // 鍙叆
-                staProtocol.setOutEnable(status[3]);// 鍙嚭
-                staProtocol.setEmptyMk(status[4]);  // 绌烘澘淇″彿
-                staProtocol.setFullPlt(status[5]);  // 婊℃墭鐩�
-                staProtocol.setLow(status[6]);      // 浣庡簱浣�
-                staProtocol.setMedium(status[7]);   // 涓簱浣�
-                staProtocol.setMedium_high(status2[0]); //涓珮搴撲綅
-                staProtocol.setHigh(status2[1]);     // 楂樺簱浣�
-                if (!staProtocol.isPakMk() && !staProtocol.isLoading()) {
-                    staProtocol.setPakMk(true);
-                }
+            //澶栧舰妫�娴�
+            OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.42", (short) 8);
+            if (resultErr.IsSuccess){
+                    boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, 0, 1);
+                    StaProtocol staProtocol = station.get(303);
+                    staProtocol.setFrontErr(status[0]);
+                    staProtocol.setBackErr(status[1]);
+                    staProtocol.setHighErr(status[2]);
+                    staProtocol.setLeftErr(status[3]);
+                    staProtocol.setRightErr(status[4]);
+                    staProtocol.setWeightErr(status[5]);
+                    staProtocol.setBarcodeErr(status[6]);
+            }
 
-                if (!staProtocol.isLoading()){
-                    staProtocol.setStamp(0);
+            //鏉$爜鎵弿鍣�
+            Thread.sleep(200);
+            ArrayList<Integer> barcodeList = getBarcodeList();
+            OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.60", (short) (barcodeList.size() * 8));
+            if (result2.IsSuccess) {
+                for (int i = 0; i < barcodeList.size(); i++) {
+                    Integer barcodeId = barcodeList.get(i);
+                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,8, "UTF-8");
+                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId);
+                    if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
+                        barcodeThread.setBarcode(barcode);
+                    }
                 }
             }
+
+//            //鏉$爜鎵弿鍣�
+//            Thread.sleep(200);
+//            OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.60",(short)8);
+//            if (result2.IsSuccess) {
+//                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,0,8, "UTF-8");
+//                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 3);
+//                    if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
+//                        barcodeThread.setBarcode(barcode);
+//                    }
+//            }
         }
+
+//
+//        if (result.IsSuccess) {
+//            for (int i = 0; i < staNoSize; i++) {
+//                Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
+//                StaProtocol staProtocol = station.get(siteId);
+//                if (null == staProtocol) {
+//                    staProtocol = new StaProtocol();
+//                    staProtocol.setSiteId(siteId);
+//                    station.put(siteId, staProtocol);
+//                }
+//                staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4));     // 宸ヤ綔鍙�
+//
+//                staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4+2));   // 鐩爣绔�
+//            }
+//        }
+
+//        Thread.sleep(200);
+//        OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB100.60", (short) (staNoSize * 2));
+//        if (result1.IsSuccess) {
+//            for (int i = 0; i < staNoSize; i++) {
+//                Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
+//                boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i*2, 1);
+//                boolean[] status2 = siemensS7Net.getByteTransform().TransBool(result1.Content, i*2+1, 1);
+//                StaProtocol staProtocol = station.get(siteId);
+//                staProtocol.setAutoing(status[0]);  // 鑷姩
+//                staProtocol.setLoading(status[1]);  // 鏈夌墿
+//                staProtocol.setInEnable(status[2]); // 鍙叆
+//                staProtocol.setOutEnable(status[3]);// 鍙嚭
+//                staProtocol.setEmptyMk(status[4]);  // 绌烘澘淇″彿
+//                staProtocol.setFullPlt(status[5]);  // 婊℃墭鐩�
+//                staProtocol.setLow(status[6]);      // 浣庡簱浣�
+//                staProtocol.setMedium(status[7]);   // 涓簱浣�
+//                staProtocol.setMedium_high(status2[0]); //涓珮搴撲綅
+//                staProtocol.setHigh(status2[1]);     // 楂樺簱浣�
+//                if (!staProtocol.isPakMk() && !staProtocol.isLoading()) {
+//                    staProtocol.setPakMk(true);
+//                }
+//
+//                if (!staProtocol.isLoading()){
+//                    staProtocol.setStamp(0);
+//                }
+//            }
+//        }
 
         //鎺ユ敹瓒呭瓒呴珮娌℃壂鍒版潯鐮佹姤璀�
-        Thread.sleep(200);
-        OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB101.34",(short)(1));
-        if (result4.IsSuccess) {
-            startSignal = siemensS7Net.getByteTransform().TransBool(result4.Content, 0, 1);
-        }
+//        Thread.sleep(200);
+//        OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB101.34",(short)(1));
+//        if (result4.IsSuccess) {
+//            startSignal = siemensS7Net.getByteTransform().TransBool(result4.Content, 0, 1);
+//        }
 
 
         //鏉$爜鎵弿鍣�
-        Thread.sleep(200);
-        OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.90",(short)(barcodeSize*8));
-        if (result2.IsSuccess) {
-            for (int i = 0; i < barcodeSize; i++) {
-                String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,8, "UTF-8");
-                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
-                if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
-                    barcodeThread.setBarcode(barcode);
-                }
-            }
-        }
+//        Thread.sleep(200);
+//        OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.60",(short)(barcodeSize*8));
+//        if (result2.IsSuccess) {
+//            for (int i = 0; i < barcodeSize; i++) {
+//                String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,8, "UTF-8");
+//                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
+//                if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
+//                    barcodeThread.setBarcode(barcode);
+//                }
+//            }
+//        }
 
-        if (result.IsSuccess && result1.IsSuccess) {
-
-            OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
-
-            // 鏍规嵁瀹炴椂淇℃伅鏇存柊鏁版嵁搴�
-            try {
-                List<BasDevp> basDevps = new ArrayList<>();
-                for (Integer siteId : staNos) {
-                    StaProtocol staProtocol = station.get(siteId);
-                    basDevps.add(staProtocol.toSqlModel());
-                }
-
-                BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
-                if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) {
-                    throw new Exception("鏇存柊鏁版嵁搴撴暟鎹け璐�");
-                }
-            } catch (Exception e) {
-                initSite();
-                e.printStackTrace();
-                OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戞洿鏂版暟鎹簱鏁版嵁澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
-                News.error("SiemensDevp"+" - 3"+" - 鏇存柊鏁版嵁搴撴暟鎹け璐� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
-            }
-
-        } else {
-            OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戣鍙栬緭閫佺嚎plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
-//            log.error("璇诲彇杈撻�佺嚎plc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
-        }
+//        if (result.IsSuccess && result1.IsSuccess) {
+//
+//            OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
+//
+//            // 鏍规嵁瀹炴椂淇℃伅鏇存柊鏁版嵁搴�
+//            try {
+//                List<BasDevp> basDevps = new ArrayList<>();
+//                for (Integer siteId : staNos) {
+//                    StaProtocol staProtocol = station.get(siteId);
+//                    basDevps.add(staProtocol.toSqlModel());
+//                }
+//
+//                BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
+//                if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) {
+//                    throw new Exception("鏇存柊鏁版嵁搴撴暟鎹け璐�");
+//                }
+//            } catch (Exception e) {
+//                initSite();
+//                e.printStackTrace();
+//                OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戞洿鏂版暟鎹簱鏁版嵁澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
+//                News.error("SiemensDevp"+" - 3"+" - 鏇存柊鏁版嵁搴撴暟鎹け璐� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
+//            }
+//
+//        } else {
+//            OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戣鍙栬緭閫佺嚎plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
+////            log.error("璇诲彇杈撻�佺嚎plc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
+//        }
     }
 
     /**
@@ -296,37 +400,38 @@
 
         OperateResult write = null;
         OperateResult write1 = null;
-        //浠诲姟涓嬪彂娆℃暟
-        int writeCount = 0;
-        do {
-            write = siemensS7Net.Write("DB100." + index*4, staProtocol.getWorkNo());    // 宸ヤ綔鍙�
+//        //浠诲姟涓嬪彂娆℃暟
+//        int writeCount = 0;
+//        do {
+        write1 = siemensS7Net.Write("DB100." + (index*6+4), staProtocol.getStaNo());    // 鐩爣绔�
             Thread.sleep(500);
-            write1 = siemensS7Net.Write("DB100." + (index*4+2), staProtocol.getStaNo());    // 鐩爣绔�
-            if(write.IsSuccess || write1.IsSuccess){
-                Thread.sleep(200);
-                OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB100." + index*4, (short) 2);
-                OperateResultExOne<byte[]> readResult1 = siemensS7Net.Read("DB100." + (index*4+2), (short) 2);
-                if(readResult.IsSuccess && readResult1.IsSuccess){
-                    short workNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 0);
-                    short staNo = siemensS7Net.getByteTransform().TransInt16(readResult1.Content, 0);
-                    if(staProtocol.getWorkNo().equals(workNo) && staProtocol.getStaNo().equals(staNo)){
-                        //浠诲姟鍛戒护鍐欏叆鎴愬姛
-                        log.info("鍐欏叆鍫嗗灈鏈哄懡浠ゅ悗杩斿洖鎴愬姛锛屽苟涓斿洖璇绘垚鍔熴�傚爢鍨涙満plc缂栧彿={}锛寋}锛屽啓鍏ユ鏁�={}", slave.getId(), JSON.toJSON(staProtocol), writeCount);
-                        break;
-                    } else {//杩斿洖缁撴灉鏄垚鍔熶簡锛屼絾鏄湡瀹炲�间笉鐩稿悓
-                        writeCount++;
-                        log.error("鍐欏叆鍫嗗灈鏈哄懡浠ゅ悗杩斿洖鎴愬姛锛屼絾鏄鍙栦换鍔″�间笉涓�鑷淬�傚爢鍨涙満plc缂栧彿={}锛寋}锛屽啓鍏ユ鏁�={}", slave.getId(), JSON.toJSON(staProtocol), writeCount);
-                    }
-                } else {
-                    writeCount++;
-                    log.error("鍐欏叆鍫嗗灈鏈哄懡浠ゅ悗璇诲彇澶辫触銆傚爢鍨涙満plc缂栧彿={}锛岀珯鐐规暟鎹�={},鍐欏叆娆℃暟={}", slave.getId(), JSON.toJSON(staProtocol), writeCount);
-                }
-            }
-            else {
-                writeCount++;
-                log.error("鍐欏叆鍫嗗灈鏈哄懡浠ゅ悗璇诲彇澶辫触銆傚爢鍨涙満plc缂栧彿={}锛岀珯鐐规暟鎹�={},鍐欏叆娆℃暟={}", slave.getId(), JSON.toJSON(staProtocol), writeCount);
-            }
-        }while (writeCount<5);
+        write = siemensS7Net.Write("DB100." + index*6, staProtocol.getWorkNo().intValue());    // 宸ヤ綔鍙�
+
+//            if(write.IsSuccess || write1.IsSuccess){
+//                Thread.sleep(200);
+//                OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB100." + index*4, (short) 2);
+//                OperateResultExOne<byte[]> readResult1 = siemensS7Net.Read("DB100." + (index*4+2), (short) 2);
+//                if(readResult.IsSuccess && readResult1.IsSuccess){
+//                    short workNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 0);
+//                    short staNo = siemensS7Net.getByteTransform().TransInt16(readResult1.Content, 0);
+//                    if(staProtocol.getWorkNo().equals(workNo) && staProtocol.getStaNo().equals(staNo)){
+//                        //浠诲姟鍛戒护鍐欏叆鎴愬姛
+//                        log.info("鍐欏叆鍫嗗灈鏈哄懡浠ゅ悗杩斿洖鎴愬姛锛屽苟涓斿洖璇绘垚鍔熴�傚爢鍨涙満plc缂栧彿={}锛寋}锛屽啓鍏ユ鏁�={}", slave.getId(), JSON.toJSON(staProtocol), writeCount);
+//                        break;
+//                    } else {//杩斿洖缁撴灉鏄垚鍔熶簡锛屼絾鏄湡瀹炲�间笉鐩稿悓
+//                        writeCount++;
+//                        log.error("鍐欏叆鍫嗗灈鏈哄懡浠ゅ悗杩斿洖鎴愬姛锛屼絾鏄鍙栦换鍔″�间笉涓�鑷淬�傚爢鍨涙満plc缂栧彿={}锛寋}锛屽啓鍏ユ鏁�={}", slave.getId(), JSON.toJSON(staProtocol), writeCount);
+//                    }
+//                } else {
+//                    writeCount++;
+//                    log.error("鍐欏叆鍫嗗灈鏈哄懡浠ゅ悗璇诲彇澶辫触銆傚爢鍨涙満plc缂栧彿={}锛岀珯鐐规暟鎹�={},鍐欏叆娆℃暟={}", slave.getId(), JSON.toJSON(staProtocol), writeCount);
+//                }
+//            }
+//            else {
+//                writeCount++;
+//                log.error("鍐欏叆鍫嗗灈鏈哄懡浠ゅ悗璇诲彇澶辫触銆傚爢鍨涙満plc缂栧彿={}锛岀珯鐐规暟鎹�={},鍐欏叆娆℃暟={}", slave.getId(), JSON.toJSON(staProtocol), writeCount);
+//            }
+//        }while (writeCount<5);
 
         if (!write.IsSuccess || !write1.IsSuccess) {
             staProtocol = station.get(staProtocol.getSiteId());
@@ -382,38 +487,44 @@
         siemensS7Net.ConnectClose();
     }
 
-    public static void main(String[] args) {
-        System.out.println(staNos1.indexOf(129));
-        System.out.println(staNos1.size());
-        for (int i = 0; i<staNos1.size(); i++) {
-//            System.out.println(i*2);
-//            System.out.println(i*2 + 200);
-//            System.out.println(i);
-        }
-        int index = staNos1.indexOf(128);
-        System.out.println(index*2);
-        System.out.println(index*2 + 200);
-    }
+//    public static void main(String[] args) {
+//        System.out.println(staNos1.indexOf(129));
+//        System.out.println(staNos1.size());
+//        for (int i = 0; i<staNos1.size(); i++) {
+////            System.out.println(i*2);
+////            System.out.println(i*2 + 200);
+////            System.out.println(i);
+//        }
+//        int index = staNos1.indexOf(128);
+//        System.out.println(index*2);
+//        System.out.println(index*2 + 200);
+//    }
 
-//    public static void main(String[] args) throws Exception {
-//        DevpSlave slave = new DevpSlave();
-//        slave.setIp("192.168.2.125");
-//        SiemensDevpThread devpThread = new SiemensDevpThread(slave);
-//        devpThread.connect();
-//        devpThread.read();
-//        // 鍐�
-//        StaProtocol staProtocol = devpThread.getStation().get(1);
-//        staProtocol.setWorkNo((short) 232);
-//        staProtocol.setStaNo((short) 6);
+    public static void main(String[] args) throws Exception {
+        DevpSlave slave = new DevpSlave();
+        slave.setId(1);
+        slave.setIp("10.10.10.100");
+        slave.setPort(0);
+        slave.setRack(0);
+        slave.setSlot(0);
+//        slave.setIp("10.10.10.130");
+        SiemensDevpThread devpThread = new SiemensDevpThread(slave);
+        devpThread.connect();
+        devpThread.read();
+        // 鍐�
+//        StaProtocol staProtocol = devpThread.getStation().get(300);
+//        staProtocol.setWorkNo((short) 3002);
+//        staProtocol.setStaNo((short) 301);
 //        staProtocol.setAutoing(true);
 //        staProtocol.setEmptyMk(true);
 //        staProtocol.setInEnable(true);
+//        staProtocol.setOutEnable(true);
 //        devpThread.write(staProtocol);
 //        System.out.println("----------------------------------------");
-//        // 璇�
+        // 璇�
 //        devpThread.read();
-//        System.out.println(JSON.toJSONString(devpThread.station));
-//
-//    }
+        System.out.println(JSON.toJSONString(devpThread.station));
+
+    }
 
 }
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 5f86d6d..5f90ed6 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -8,7 +8,7 @@
     name: @pom.build.finalName@
   datasource:
     driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
-    url: jdbc:sqlserver://192.168.4.15:1433;databasename=sxjzasrs
+    url: jdbc:sqlserver://127.0.0.1:1433;databasename=sxjzasrs
     username: sa
     password: sa@123
   mvc:
@@ -34,69 +34,69 @@
   enable: false
 
 wms:
-  url: 127.0.0.1:8080/sxjzwms
+  url: 127.0.0.1:8080/jzwms
 
 # 涓嬩綅鏈洪厤缃�
 wcs-slave:
   # 鍙屾繁
   doubleDeep: true
   # 鍙屾繁搴撲綅鎺掑彿
-  doubleLocs: 1,4,5,8,9,12
+  doubleLocs: 1
   # 涓�涓爢鍨涙満璐熻矗鐨勮揣鏋舵帓鏁�
-  groupCount: 4
-  # 鍫嗗灈鏈�1
-  crn[0]:
-    id: 1
-    ip: 10.10.10.10
-    port: 102
-    rack: 0
-    slot: 0
-    # 鍋忕Щ閲忥紝褰撳爢鍨涙満绔欑偣鍒楀彿=1鏃讹紝鍋忕Щ閲�=2
-    offset: 2
-    demo: false
-    # 鍫嗗灈鏈哄叆搴撶珯鐐�
-    crnInStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
-      staNo: 104
-      row: 1
-      bay: 1
-      lev: 1
-    # 鍫嗗灈鏈哄嚭搴撶珯鐐�
-    crnOutStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
-      staNo: 100
-      row: 2
-      bay: 1
-      lev: 1
-  # 鍫嗗灈鏈�2
-  crn[1]:
-    id: 2
-    ip: 10.10.10.18
-    port: 102
-    rack: 0
-    slot: 0
-    # 鍋忕Щ閲忥紝褰撳爢鍨涙満绔欑偣鍒楀彿=1鏃讹紝鍋忕Щ閲�=2
-    offset: 2
-    demo: false
-    # 鍫嗗灈鏈哄叆搴撶珯鐐�
-    crnInStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
-      staNo: 204
-      row: 4
-      bay: 1
-      lev: 1
-    # 鍫嗗灈鏈哄嚭搴撶珯鐐�
-    crnOutStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
-      staNo: 200
-      row: 5
-      bay: 2
-      lev: 1
+  groupCount: 3
+#  # 鍫嗗灈鏈�1
+#  crn[0]:
+#    id: 1
+#    ip: 10.10.10.10
+#    port: 102
+#    rack: 0
+#    slot: 0
+#    # 鍋忕Щ閲忥紝褰撳爢鍨涙満绔欑偣鍒楀彿=1鏃讹紝鍋忕Щ閲�=2
+#    offset: 2
+#    demo: false
+#    # 鍫嗗灈鏈哄叆搴撶珯鐐�
+#    crnInStn[0]:
+#      devpPlcId: ${wcs-slave.devp[0].id}
+#      staNo: 104
+#      row: 3
+#      bay: 39
+#      lev: 1
+#    # 鍫嗗灈鏈哄嚭搴撶珯鐐�
+#    crnOutStn[0]:
+#      devpPlcId: ${wcs-slave.devp[0].id}
+#      staNo: 100
+#      row: 2
+#      bay: 39
+#      lev: 1
+#  # 鍫嗗灈鏈�2
+#  crn[1]:
+#    id: 2
+#    ip: 10.10.10.18
+#    port: 102
+#    rack: 0
+#    slot: 0
+#    # 鍋忕Щ閲忥紝褰撳爢鍨涙満绔欑偣鍒楀彿=1鏃讹紝鍋忕Щ閲�=2
+#    offset: 2
+#    demo: false
+#    # 鍫嗗灈鏈哄叆搴撶珯鐐�
+#    crnInStn[0]:
+#      devpPlcId: ${wcs-slave.devp[0].id}
+#      staNo: 204
+#      row: 5
+#      bay: 39
+#      lev: 1
+#    # 鍫嗗灈鏈哄嚭搴撶珯鐐�
+#    crnOutStn[0]:
+#      devpPlcId: ${wcs-slave.devp[0].id}
+#      staNo: 200
+#      row: 4
+#      bay: 39
+#      lev: 1
   # 鍫嗗灈鏈�3
-  crn[2]:
+  crn[0]:
     id: 3
-    ip: 10.10.10.110
-    port: 102
+    ip: 10.10.10.30
+    port: 0
     rack: 0
     slot: 0
     # 鍋忕Щ閲忥紝褰撳爢鍨涙満绔欑偣鍒楀彿=1鏃讹紝鍋忕Щ閲�=2
@@ -106,147 +106,128 @@
     crnInStn[0]:
       devpPlcId: ${wcs-slave.devp[0].id}
       staNo: 304
-      row: 4
-      bay: 1
+      row: 7
+      bay: 0
       lev: 1
     # 鍫嗗灈鏈哄嚭搴撶珯鐐�
     crnOutStn[0]:
       devpPlcId: ${wcs-slave.devp[0].id}
       staNo: 300
-      row: 5
-      bay: 2
+      row: 6
+      bay: 0
       lev: 1
-  # 杈撻�佺嚎1
-  devp[0]:
-    id: 1
-    ip: 10.10.10.100
-    port: 102
-    rack: 0
-    slot: 0
-    # 鍏ュ簱鍙�1
-    inSta[0]:
-      staNo: 104
-      barcode: ${wcs-slave.barcode[0].id}
-      backSta: 1
-      led: ${wcs-slave.led[0].id}
-    # 鍏ュ簱鍙�2
-    inSta[1]:
-      staNo: 204
-      barcode: ${wcs-slave.barcode[0].id}
-      backSta: 1
-      led: ${wcs-slave.led[0].id}
-    # 绌烘澘鍏ュ簱鍙�1
-    emptyInSta[0]:
-      staNo: 104
-      barcode: ${wcs-slave.barcode[0].id}
-      backSta: 1
-      led: ${wcs-slave.led[0].id}
-    # 绌烘澘鍏ュ簱鍙�2
-    emptyInSta[1]:
-      staNo: 101
-      barcode: ${wcs-slave.barcode[0].id}
-      backSta: 1
-      led: ${wcs-slave.led[0].id}
-    # 鎷f枡鍏ュ簱鍙�1
-    pickSta[0]:
-      staNo: 204
-      barcode: ${wcs-slave.barcode[0].id}
-      led: ${wcs-slave.led[0].id}
-    # 鎷f枡鍏ュ簱鍙�2
-    pickSta[1]:
-      staNo: 104
-      barcode: ${wcs-slave.barcode[0].id}
-      led: ${wcs-slave.led[0].id}
-    # 鍑哄簱鍙�1
-    outSta[0]:
-      staNo: 101
-      led: ${wcs-slave.led[1].id}
-    # 鍑哄簱鍙�2
-    outSta[1]:
-      staNo: 201
-      led: ${wcs-slave.led[1].id}
+#  # 杈撻�佺嚎1
+#  devp[0]:
+#    id: 1
+#    ip: 10.10.10.100
+#    port: 102
+#    rack: 0
+#    slot: 0
+#    # 鍏ュ簱鍙�1
+#    inSta[0]:
+#      staNo: 104
+#      barcode: ${wcs-slave.barcode[0].id}
+#      backSta: 103
+#      led: ${wcs-slave.led[0].id}
+#    # 鍏ュ簱鍙�2
+#    inSta[1]:
+#      staNo: 204
+#      barcode: ${wcs-slave.barcode[1].id}
+#      backSta: 203
+#      led: ${wcs-slave.led[1].id}
+#    # 绌烘澘鍏ュ簱鍙�1
+#    emptyInSta[0]:
+#      staNo: 104
+#      barcode: ${wcs-slave.barcode[0].id}
+#      led: ${wcs-slave.led[0].id}
+#    # 绌烘澘鍏ュ簱鍙�2
+#    emptyInSta[1]:
+#      staNo: 204
+#      barcode: ${wcs-slave.barcode[1].id}
+#      led: ${wcs-slave.led[1].id}
+#    # 鎷f枡鍏ュ簱鍙�1
+#    pickSta[0]:
+#      staNo: 204
+#      barcode: ${wcs-slave.barcode[1].id}
+#      led: ${wcs-slave.led[1].id}
+#    # 鎷f枡鍏ュ簱鍙�2
+#    pickSta[1]:
+#      staNo: 104
+#      barcode: ${wcs-slave.barcode[0].id}
+#      led: ${wcs-slave.led[0].id}
+#    # 鍑哄簱鍙�1
+#    outSta[0]:
+#      staNo: 101
+#      led: ${wcs-slave.led[0].id}
+#    # 鍑哄簱鍙�2
+#    outSta[1]:
+#      staNo: 201
+#      led: ${wcs-slave.led[1].id}
   # 杈撻�佺嚎2
-  devp[1]:
+  devp[0]:
     id: 2
-    ip: 10.10.10.120
-    port: 102
+    ip: 10.10.10.130
+    port: 0
     rack: 0
     slot: 0
     # 鍏ュ簱鍙�1
     inSta[0]:
-      staNo: 104
-      barcode: ${wcs-slave.barcode[2].id}
-      backSta: 1
-      led: ${wcs-slave.led[2].id}
-    # 鍏ュ簱鍙�2
-    inSta[1]:
-      staNo: 204
-      barcode: ${wcs-slave.barcode[2].id}
-      backSta: 1
-      led: ${wcs-slave.led[2].id}
+      staNo: 304
+      barcode: ${wcs-slave.barcode[0].id}
+      backSta: 303
+      led: ${wcs-slave.led[0].id}
     # 绌烘澘鍏ュ簱鍙�1
     emptyInSta[0]:
-      staNo: 104
-      barcode: ${wcs-slave.barcode[2].id}
-      backSta: 1
-      led: ${wcs-slave.led[2].id}
-    # 绌烘澘鍏ュ簱鍙�2
-    emptyInSta[1]:
-      staNo: 101
-      barcode: ${wcs-slave.barcode[2].id}
-      backSta: 1
-      led: ${wcs-slave.led[2].id}
+      staNo: 304
+      barcode: ${wcs-slave.barcode[0].id}
+      led: ${wcs-slave.led[0].id}
     # 鎷f枡鍏ュ簱鍙�1
     pickSta[0]:
-      staNo: 204
-      barcode: ${wcs-slave.barcode[2].id}
-      led: ${wcs-slave.led[2].id}
-    # 鎷f枡鍏ュ簱鍙�2
-    pickSta[1]:
-      staNo: 104
-      barcode: ${wcs-slave.barcode[2].id}
-      led: ${wcs-slave.led[2].id}
+      staNo: 304
+      barcode: ${wcs-slave.barcode[0].id}
+      led: ${wcs-slave.led[0].id}
     # 鍑哄簱鍙�1
     outSta[0]:
-      staNo: 101
-      led: ${wcs-slave.led[2].id}
-    # 鍑哄簱鍙�2
-    outSta[1]:
-      staNo: 201
-      led: ${wcs-slave.led[2].id}
+      staNo: 301
+      led: ${wcs-slave.led[0].id}
   # 鏉$爜鎵弿浠�1
-  barcode[0]:
-    id: 1
-    ip: 10.10.10.102
-    port: 51236
-  # 鏉$爜鎵弿浠�2
-  barcode[1]:
-    id: 2
-    ip: 10.10.10.104
-    port: 51236
+#  barcode[0]:
+#    id: 1
+#    ip: 10.10.10.102
+#    port: 51236
+#  # 鏉$爜鎵弿浠�2
+#  barcode[1]:
+#    id: 2
+#    ip: 10.10.10.104
+#    port: 51236
   # 鏉$爜鎵弿浠�3
-  barcode[2]:
+  barcode[0]:
     id: 3
-    ip: 10.10.10.121
-    port: 51236
    # LED1
-  led[0]:
-    id: 1
-    ip: 10.10.10.107
-    port: 5005
-    devpPlcId: ${wcs-slave.devp[0].id}
-    staArr: 2
-  # LED2
-  led[1]:
-    id: 2
-    ip: 10.10.10.105
-    port: 5005
-    devpPlcId: ${wcs-slave.devp[0].id}
-    staArr: 11
+#  led[0]:
+#    id: 1
+#    ip: 10.10.10.107
+#    port: 5005
+#    devpPlcId: ${wcs-slave.devp[0].id}
+#    staArr: 101
+#  # LED2
+#  led[1]:
+#    id: 2
+#    ip: 10.10.10.105
+#    port: 5005
+#    devpPlcId: ${wcs-slave.devp[0].id}
+#    staArr: 201
   # LED3
-  led[2]:
+  led[0]:
     id: 3
     ip: 10.10.10.105
     port: 5005
     devpPlcId: ${wcs-slave.devp[0].id}
-    staArr: 11
\ No newline at end of file
+    staArr: 301
+#  # LED4
+#  led[3]:
+#    id: 4
+#    ip: 10.10.10.105
+#    port: 5005
+#    devpPlcId: ${wcs-slave.devp[1].id}
+#    staArr: 304
\ No newline at end of file
diff --git a/src/main/resources/mapper/WrkDetlMapper.xml b/src/main/resources/mapper/WrkDetlMapper.xml
index da1c6d3..a01491b 100644
--- a/src/main/resources/mapper/WrkDetlMapper.xml
+++ b/src/main/resources/mapper/WrkDetlMapper.xml
@@ -27,7 +27,7 @@
     </resultMap>
 
     <select id="findByWorkNo" resultMap="BaseResultMap">
-        select wrk_no, matnr, maktx, anfme ,specs from asr_wrk_detl where 1=1 and wrk_no = #{workNo}
+        select wrk_no, mat_no as matnr, mat_name as maktx, qty as anfme ,specs from asr_wrk_detl where 1=1 and wrk_no = #{workNo}
     </select>
 
     <update id="updateIoTime">
diff --git a/src/main/webapp/static/js/console.map.js b/src/main/webapp/static/js/console.map.js
index a7e1e4c..add3cd5 100644
--- a/src/main/webapp/static/js/console.map.js
+++ b/src/main/webapp/static/js/console.map.js
@@ -3,207 +3,93 @@
     "rackCount": 16,
     "crnCount": 4,
     "stbCount": 16,
-    "hpPosition": 0,
+    "hpPosition": 1,
     "minBayNo": 2,
     "floors": 1,
     "racks": [{
         "type": "rack",
         "id": "rack1",
-        "top": 45,
-        "left": 650,
-        "width": 917,
+        "top": 225,
+        "left": 300,
+        "width": 1171,
         "height": 22,
-        "minBayNo": 2,
-        "maxBayNo": 29
+        "minBayNo": 1,
+        "maxBayNo": 34
     }, {
         "type": "rack",
         "id": "rack2",
-        "top": 67,
-        "left": 650,
-        "width": 917,
+        "top": 278,
+        "left": 300,
+        "width": 1171,
         "height": 22,
-        "minBayNo": 2,
-        "maxBayNo": 29
+        "minBayNo": 1,
+        "maxBayNo": 34
+
     }, {
         "type": "rack",
         "id": "rack3",
-        "top": 115,
-        "left": 650,
-        "width": 917,
+        "top": 308,
+        "left": 300,
+        "width": 1200,
         "height": 22,
-        "minBayNo": 2,
-        "maxBayNo": 29
+        "minBayNo": 1,
+        "maxBayNo": 39
     }, {
         "type": "rack",
         "id": "rack4",
-        "top": 137,
-        "left": 650,
-        "width": 917,
+        "top": 365,
+        "left": 300,
+        "width": 1200,
         "height": 22,
-        "minBayNo": 2,
-        "maxBayNo": 29
+        "minBayNo": 1,
+        "maxBayNo": 39
     }, {
         "type": "rack",
         "id": "rack5",
-        "top": 159,
-        "left": 650,
-        "width": 917,
+        "top": 393,
+        "left": 300,
+        "width": 1200,
         "height": 22,
-        "minBayNo": 2,
-        "maxBayNo": 29
+        "minBayNo": 1,
+        "maxBayNo": 39
     }, {
         "type": "rack",
         "id": "rack6",
-        "top": 181,
-        "left": 650,
-        "width": 917,
+        "top": 448,
+        "left": 300,
+        "width": 1200,
         "height": 22,
-        "minBayNo": 2,
-        "maxBayNo": 29
+        "minBayNo": 1,
+        "maxBayNo": 39
     }, {
         "type": "rack",
         "id": "rack7",
-        "top": 229,
-        "left": 650,
-        "width": 917,
+        "top": 475,
+        "left": 300,
+        "width": 1200,
         "height": 22,
-        "minBayNo": 2,
-        "maxBayNo": 29
-    }, {
-        "type": "rack",
-        "id": "rack8",
-        "top": 251,
-        "left": 650,
-        "width": 917,
-        "height": 22,
-        "minBayNo": 2,
-        "maxBayNo": 29
-    }, {
-        "type": "rack",
-        "id": "rack9",
-        "top": 273,
-        "left": 650,
-        "width": 917,
-        "height": 22,
-        "minBayNo": 2,
-        "maxBayNo": 29
-    }, {
-        "type": "rack",
-        "id": "rack10",
-        "top": 295,
-        "left": 650,
-        "width": 917,
-        "height": 22,
-        "minBayNo": 2,
-        "maxBayNo": 29
-    }, {
-        "type": "rack",
-        "id": "rack11",
-        "top": 343,
-        "left": 650,
-        "width": 917,
-        "height": 22,
-        "minBayNo": 2,
-        "maxBayNo": 29
-    }, {
-        "type": "rack",
-        "id": "rack12",
-        "top": 365,
-        "left": 650,
-        "width": 917,
-        "height": 22,
-        "minBayNo": 2,
-        "maxBayNo": 29
+        "minBayNo": 1,
+        "maxBayNo": 39
     }],
     "rackDescs": [{
-        "type": "rackDescs",
-        "id": "lb_desc16",
-        "text": "#1",
-        "top": 45,
-        "left": 1570,
-        "width": 30,
-        "height": 23
+        "type": "rackDescs", "id": "lb_desc16", "text": "#7", "top": 227, "left": 240, "width": 30, "height": 23
     }, {
-        "type": "rackDescs",
-        "id": "lb_desc1",
-        "text": "#12",
-        "top": 365,
-        "left": 1570,
-        "width": 41,
-        "height": 23
+        "type": "rackDescs", "id": "lb_desc1", "text": "#1", "top": 475, "left": 240, "width": 30, "height": 23
     }, {
-        "type": "rackDescs",
-        "id": "lb_desc100",
-        "text": "<=鍑哄簱<=",
-        "top": 48,
-        "left": 550,
-        "width": 100,
-        "height": 23
-    }, {
-        "type": "rackDescs",
-        "id": "lb_desc103",
-        "text": "=>鍏ュ簱=>",
-        "top": 138,
-        "left": 550,
-        "width": 100,
-        "height": 23
-    }, {
-        "type": "rackDescs",
-        "id": "lb_desc103",
-        "text": "<=鍑哄簱<=",
-        "top": 162,
-        "left": 550,
-        "width": 100,
-        "height": 23
+        "type": "rackDescs", "id": "lb_desc100", "text": "=>鍑哄簱=>=>", "top": 475, "left": 1470, "width": 120, "height": 23
     }],
     "crns": [{
-        "type": "crane",
-        "id": "crn-1",
-        "text": "1",
-        "top": 96,
-        "left": 739,
-        "width": 93,
-        "height": 22
+        "type": "crane", "id": "crn-1", "text": "1", "top": 423, "left": 300, "width": 93, "height": 22
     }, {
-        "type": "track",
-        "id": "lb_track1",
-        "text": "",
-        "top": 106,
-        "left": 573,
-        "width": 1042,
-        "height": 2
+        "type": "track", "id": "lb_track1", "text": "", "top": 430, "left": 300, "width": 1170, "height": 2
     }, {
-        "type": "crane",
-        "id": "crn-2",
-        "text": "2",
-        "top": 210,
-        "left": 739,
-        "width": 93,
-        "height": 22
+        "type": "crane", "id": "crn-2", "text": "2", "top": 340, "left": 300, "width": 93, "height": 22
     }, {
-        "type": "track",
-        "id": "lb_track2",
-        "text": "",
-        "top": 220,
-        "left": 573,
-        "width": 1042,
-        "height": 2
+        "type": "track", "id": "lb_track2", "text": "", "top": 350, "left": 300, "width": 1170, "height": 2
     }, {
-        "type": "crane",
-        "id": "crn-3",
-        "text": "3",
-        "top": 324,
-        "left": 739,
-        "width": 93,
-        "height": 22
+        "type": "crane", "id": "crn-3", "text": "3", "top": 256, "left": 300, "width": 93, "height": 22
     }, {
-        "type": "track",
-        "id": "lb_track3",
-        "text": "",
-        "top": 334,
-        "left": 573,
-        "width": 1042,
-        "height": 2
+        "type": "track", "id": "lb_track3", "text": "", "top": 263, "left": 300, "width": 1170, "height": 2
     }],
     "areas": [{
         "type": "Control_floor",
@@ -222,125 +108,35 @@
             "width": 1374,
             "height": 672,
             "stns": [{
-                "type": "stn",
-                "id": "site-100",
-                "text": "100",
-                "top": 69,
-                "left": 601,
-                "width": 49,
-                "height": 20
+                "type": "stn", "id": "site-100", "text": "100", "top": 450, "left": 1470, "width": 70, "height": 20
             }, {
-                "type": "stn",
-                "id": "site-101",
-                "text": "101",
-                "top": 69,
-                "left": 550,
-                "width": 49,
-                "height": 20
+                "type": "stn", "id": "site-101", "text": "101", "top": 450, "left": 1550, "width": 70, "height": 20
             }, {
-                "type": "stn",
-                "id": "site-102",
-                "text": "102",
-                "top": 90,
-                "left": 550,
-                "width": 49,
-                "height": 24
+                "type": "stn", "id": "site-102", "text": "102", "top": 420, "left": 1550, "width": 70, "height": 24
             }, {
-                "type": "stn",
-                "id": "site-103",
-                "text": "103",
-                "top": 115,
-                "left": 550,
-                "width": 49,
-                "height": 20
+                "type": "stn", "id": "site-103", "text": "103", "top": 395, "left": 1550, "width": 70, "height": 20
             }, {
-                "type": "stn",
-                "id": "site-104",
-                "text": "104",
-                "top": 115,
-                "left": 601,
-                "width": 49,
-                "height": 20
+                "type": "stn", "id": "site-104", "text": "104", "top": 395, "left": 1470, "width": 70, "height": 20
             }, {
-                "type": "stn",
-                "id": "site-200",
-                "text": "200",
-                "top": 183,
-                "left": 601,
-                "width": 49,
-                "height": 20
+                "type": "stn", "id": "site-200", "text": "200", "top": 367, "left": 1470, "width": 70, "height": 20
             }, {
-                "type": "stn",
-                "id": "site-201",
-                "text": "201",
-                "top": 183,
-                "left": 550,
-                "width": 49,
-                "height": 20
+                "type": "stn", "id": "site-201", "text": "201", "top": 367, "left": 1550, "width": 70, "height": 20
             }, {
-                "type": "stn",
-                "id": "site-202",
-                "text": "202",
-                "top": 204,
-                "left": 550,
-                "width": 49,
-                "height": 26
+                "type": "stn", "id": "site-202", "text": "202", "top": 335, "left": 1550, "width": 70, "height": 26
             }, {
-                "type": "stn",
-                "id": "site-203",
-                "text": "203",
-                "top": 231,
-                "left": 550,
-                "width": 49,
-                "height": 20
+                "type": "stn", "id": "site-203", "text": "203", "top": 310, "left": 1550, "width": 70, "height": 20
             }, {
-                "type": "stn",
-                "id": "site-204",
-                "text": "204",
-                "top": 231,
-                "left": 601,
-                "width": 49,
-                "height": 20
+                "type": "stn", "id": "site-204", "text": "204", "top": 310, "left": 1470, "width": 70, "height": 20
             }, {
-                "type": "stn",
-                "id": "site-300",
-                "text": "300",
-                "top": 297,
-                "left": 601,
-                "width": 49,
-                "height": 20
+                "type": "stn", "id": "site-300", "text": "300", "top": 280, "left": 1470, "width": 70, "height": 20
             }, {
-                "type": "stn",
-                "id": "site-301",
-                "text": "301",
-                "top": 297,
-                "left": 550,
-                "width": 49,
-                "height": 20
+                "type": "stn", "id": "site-301", "text": "301", "top": 280, "left": 1550, "width": 70, "height": 20
             }, {
-                "type": "stn",
-                "id": "site-302",
-                "text": "302",
-                "top": 318,
-                "left": 550,
-                "width": 49,
-                "height": 26
+                "type": "stn", "id": "site-302", "text": "302", "top": 252, "left": 1550, "width": 70, "height": 26
             }, {
-                "type": "stn",
-                "id": "site-303",
-                "text": "303",
-                "top": 345,
-                "left": 550,
-                "width": 49,
-                "height": 20
+                "type": "stn", "id": "site-303", "text": "303", "top": 227, "left": 1550, "width": 70, "height": 20
             }, {
-                "type": "stn",
-                "id": "site-304",
-                "text": "304",
-                "top": 345,
-                "left": 601,
-                "width": 49,
-                "height": 20
+                "type": "stn", "id": "site-304", "text": "304", "top": 227, "left": 1470, "width": 70, "height": 20
             }]
         }]
     }]
diff --git a/src/main/webapp/views/crn.html b/src/main/webapp/views/crn.html
index 5bd72a4..2225ccb 100644
--- a/src/main/webapp/views/crn.html
+++ b/src/main/webapp/views/crn.html
@@ -65,6 +65,12 @@
                     <!--            <span>&nbsp;</span>-->
                     <input id="crn2" disabled="disabled">
                 </div>
+                <div class="crn-command-item">
+                    <label>3#</label>
+                    <button id="demoBtn-3" class="demoBtn" onclick="demoSwitch(this.id)"> - </button>
+                    <!--            <span>&nbsp;</span>-->
+                    <input id="crn3" disabled="disabled">
+                </div>
             </div>
             <!-- 鍫嗗灈鏈虹姸鎬佷綅淇℃伅 -->
             <div class="crn-state">
@@ -128,11 +134,12 @@
             <!-- 璁惧浠诲姟閫夋嫨 -->
             <div class="task-select">
                 <!-- 鍫嗗灈鏈洪�夋嫨 -->
-                <div id="crn-select" class="operator-item" style="width: 55%">
+                <div id="crn-select" class="operator-item" style="width: 38%">
                     <span class="select-title">鍫嗗灈鏈哄彿</span>
                     <div class="select-container" style="padding: 20px 0;">
                         <label><input type="radio" name="crnSelect" value="1" checked>&nbsp;1鍙峰爢鍨涙満</label>
                         <label><input type="radio" name="crnSelect" value="2">&nbsp;2鍙峰爢鍨涙満</label>
+                        <label><input type="radio" name="crnSelect" value="3">&nbsp;3鍙峰爢鍨涙満</label>
                     </div>
                 </div>
                 <!-- 婧愮珯/婧愬簱浣� 閫夋嫨 -->
@@ -179,6 +186,28 @@
                         </div>
                     </div>
                 </div>
+                <!-- 鐩爣绔�/鐩爣搴撲綅 閫夋嫨 -->
+                <div id="end-select" class="operator-item">
+                    <span class="select-title">鐩爣绔�/鐩爣搴撲綅</span>
+                    <div class="select-container">
+                        <div class="select-container-item">
+                            <span>绔�</span>
+                            <label><input id="endStaNo" type="number" name="points" min="0" /></label>
+                        </div>
+                        <div class="select-container-item">
+                            <span>鎺�</span>
+                            <label><input id="endRow" type="number" name="points" min="1" style="background-color: #a9eeff" value="1" /></label>
+                        </div>
+                        <div class="select-container-item">
+                            <span>鍒�</span>
+                            <label><input id="endBay" type="number" name="points" min="0" style="background-color: #a9eeff" value="0" /></label>
+                        </div>
+                        <div class="select-container-item">
+                            <span>灞�</span>
+                            <label><input id="endLev" type="number" name="points" min="1" style="background-color: #a9eeff" value="1" /></label>
+                        </div>
+                    </div>
+                </div>
             </div>
 
             <!-- 璁惧浠诲姟鎿嶄綔 -->

--
Gitblit v1.9.1