From 2de4173f02cc9525949eb20e60595019b9be9a3f Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期一, 09 六月 2025 19:43:05 +0800
Subject: [PATCH] 部署服务器

---
 src/main/java/com/zy/controller/SiteController.java          |    2 
 src/main/webapp/views/console.html                           |   47 
 src/main/resources/mapper/WrkMastMapper.xml                  |    5 
 src/main/java/com/zy/service/impl/MainServiceImpl.java       |  952 ++++++++++++++++------------
 src/main/webapp/static/js/console.map.js                     |  228 +++---
 src/main/java/com/zy/common/model/SearchLocParam.java        |   18 
 src/main/java/com/zy/core/model/command/CrnCommand.java      |    3 
 src/main/java/com/zy/common/model/LocTypeDto.java            |    4 
 src/main/java/com/zy/core/model/protocol/StaProtocol.java    |   38 +
 src/main/resources/mapper/WrkDetlMapper.xml                  |   36 
 src/main/java/com/zy/core/thread/SiemensCrnThread.java       |    4 
 src/main/java/com/zy/entity/WrkDetl.java                     |    9 
 src/main/webapp/views/index.html                             |    4 
 src/main/java/com/zy/common/model/CanningLineInLocParam.java |   28 
 src/main/webapp/static/js/console.js                         |    2 
 src/main/java/com/zy/core/MainProcess.java                   |   33 
 src/main/webapp/views/control.html                           |    2 
 src/main/java/com/zy/core/thread/SiemensDevpThread.java      |  415 +++++++++---
 src/main/java/com/zy/entity/WrkMast.java                     |    5 
 src/main/resources/application.yml                           |  140 ++-
 src/main/java/com/zy/mapper/WrkMastMapper.java               |    2 
 src/main/webapp/views/indexTV.html                           |    2 
 22 files changed, 1,193 insertions(+), 786 deletions(-)

diff --git a/src/main/java/com/zy/common/model/CanningLineInLocParam.java b/src/main/java/com/zy/common/model/CanningLineInLocParam.java
index 055eb19..d600dc6 100644
--- a/src/main/java/com/zy/common/model/CanningLineInLocParam.java
+++ b/src/main/java/com/zy/common/model/CanningLineInLocParam.java
@@ -10,14 +10,28 @@
 @Data
 public class CanningLineInLocParam {
 
-    /**
-     * 浠诲姟鍙�
-     */
-    private Integer wrkNo;
+    // 浠诲姟鍙�
+    private int wrkNo;
 
-    /**
-     * 婧愮珯鐐�
-     */
+    // 妗跺瀷鏍囪瘑
+    private String matnr;
+
+    //  鎵瑰彿
+    private String batch;
+
+    // 鐢熶骇鏃ユ湡
+    private String manuDate;
+
+    // 鍑�閲�
+    private double weight;
+
+    // 澶嶆閲嶉噺
+    private double grossWeight;
+
+     // 婧愮珯鐐�
     private Integer sourceStaNo;
 
+    // 璐存爣鎴愬姛鍚�
+    private boolean tbFlag;
+
 }
diff --git a/src/main/java/com/zy/common/model/LocTypeDto.java b/src/main/java/com/zy/common/model/LocTypeDto.java
index 84da5f1..a4fd352 100644
--- a/src/main/java/com/zy/common/model/LocTypeDto.java
+++ b/src/main/java/com/zy/common/model/LocTypeDto.java
@@ -33,9 +33,9 @@
 //        if (staProtocol.isHigh() == staProtocol.isLow()) {
 //            throw new CoolException("plc楂樹綆妫�娴嬪紓甯�");
 //        }
-//        if (staProtocol.getSiteId() == 106 || staProtocol.getSiteId() == 159){
+//        if (staProtocol.isHigh()) {
 //            this.locType1 = 2; // 楂樺簱浣�
-//        }else {
+//        } else if (staProtocol.isLow()) {
             this.locType1 = 1; // 浣庡簱浣�
 //        }
     }
diff --git a/src/main/java/com/zy/common/model/SearchLocParam.java b/src/main/java/com/zy/common/model/SearchLocParam.java
index dc7c9d6..7c16632 100644
--- a/src/main/java/com/zy/common/model/SearchLocParam.java
+++ b/src/main/java/com/zy/common/model/SearchLocParam.java
@@ -1,10 +1,10 @@
 package com.zy.common.model;
 
 import com.alibaba.fastjson.JSON;
+import lombok.AllArgsConstructor;
 import lombok.Data;
 
-import java.util.HashMap;
-import java.util.Map;
+import java.util.List;
 
 /**
  * Created by vincent on 2020/10/30
@@ -21,11 +21,6 @@
     // 搴撲綅瑙勬牸锛� 0:鏈煡, 1:浣庡簱浣�, 2:涓簱浣�, 3:楂樺簱浣� 锛�
     private Short locType1;
 
-    /**
-     * 搴撳尯绫诲瀷 1.鎴愬搧搴擄紝2.绌烘《搴�
-     */
-    private int locArea;
-
     // 鍏ュ簱妗剁紪鍙�
     private String bucketType;
 
@@ -36,7 +31,14 @@
     private boolean tailSupportFlag;
 
     // 缃愯绾胯妗� 缃愯绾垮彿-妗剁被鍨�
-    private Map<Integer,String> wantBucketFlag =  new HashMap<>();
+    private List<WantBucket> wantBucketFlag;
+
+    @Data
+    @AllArgsConstructor
+    public static class WantBucket{
+        private int site;
+        private int bucketType;
+    }
 
     public static void main(String[] args) {
         SearchLocParam searchLocParam = new SearchLocParam();
diff --git a/src/main/java/com/zy/controller/SiteController.java b/src/main/java/com/zy/controller/SiteController.java
index 3fe8c23..b3c38f9 100644
--- a/src/main/java/com/zy/controller/SiteController.java
+++ b/src/main/java/com/zy/controller/SiteController.java
@@ -50,8 +50,6 @@
             SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
             Map<String, Object> map2 = new HashMap<>();
             map2.put("floor", 2);
-            map2.put("modeVal", devpThread.ioModeOf101.id);
-            map2.put("modeDesc", devpThread.ioModeOf101.desc);
             res.add(map2);
         }
         return R.ok().add(res);
diff --git a/src/main/java/com/zy/core/MainProcess.java b/src/main/java/com/zy/core/MainProcess.java
index bd4cedf..071347c 100644
--- a/src/main/java/com/zy/core/MainProcess.java
+++ b/src/main/java/com/zy/core/MainProcess.java
@@ -29,34 +29,47 @@
     /**
      * =====>>  寮�濮嬪伐浣�
      */
-    public void start(){
+    public void start() throws InterruptedException {
         thread = new Thread(() -> {
+            // 鍒濆鍖栫綈瑁呯嚎鍑哄簱鍙f槸鍚﹀彲鍑�
             while (!Thread.currentThread().isInterrupted()) {
                 try {
-
                     Thread.sleep(1000);
 
                     // 绯荤粺杩愯鐘舵�佸垽鏂�
                     if (!SystemProperties.WCS_RUNNING_STATUS.get()) {
                         continue;
                     }
+                    if(rgcWrk) {
+                        Thread.sleep(3000);
+                        mainService.intiGzxkc();
+                        rgcWrk = false;
+                    }
 
                     // 鎵樼洏鍒拌揪rgv鎺ラ┏绔欑偣锛屾洿鏀瑰伐浣滄。鐘舵�佷负9.鍛煎彨RGV锛岀幆绌跨▼搴忚皟搴gv
                     mainService.callRgv();
 
+                    // rgv鏀捐揣瀹屾垚锛岀粰杈撻�佺嚎涓嬪彂浠诲姟
+                    mainService.rgvToDev();
+
+                    // 1090寮傚父鍙i噸鏂板叆搴撳垎閰嶅簱浣�
+                    mainService.abnormalMouthWarehousing();
+                    Thread.sleep(1000);
+
                     // 鍏ュ簱  ===>> 鍏ュ簱绔欏埌鍫嗗灈鏈虹珯锛屾牴鎹潯鐮佹壂鎻忕敓鎴愬叆搴撳伐浣滄。
                     mainService.generateStoreWrkFile(1); // 缁勬墭
 
-                    Thread.sleep(500);
+                    Thread.sleep(1000);
 
                     // 鐢熸垚 绌哄瓙/姣嶆墭鐩樺嚭搴撲换鍔�
                     mainService.generateEmptyPalletStoreWrk();
 
-                    // 鍏ュ簱 ===>> 绌哄瓙鎵樼洏鍏ュ簱
-                    mainService.storeEmptyPlt();
-
-                    // 鍏ュ簱 ===>> 姣嶇┖鎵樼洏鍙犳弧鍏ュ簱
+                    // 鍏ュ簱 ===>> 姣嶆墭鐩樺彔婊″叆搴�
                     mainService.autoEmptyIn();
+                    Thread.sleep(1000);
+
+                    // 瀛愭墭鐩樺簳涓嬫瘝鎵樼洏鍥炲彔鐩樻満
+//                    mainService.motherTrayReflow();
 
                     // 鍑哄簱  ===>>  鍫嗗灈鏈哄嚭搴撶珯鍒板嚭搴撶珯
                     mainService.crnStnToOutStn(4);
@@ -67,8 +80,12 @@
                     // 鍏ュ簱  ===>> 鎵ц瀵瑰伐浣滄。鐨勫畬鎴愭搷浣�
                     mainService.storeFinished(6);
 
-                    // 绌烘《缃愯瀹屾垚鍒拌揪缃愯绾縭gv鍙� 瀹屾垚鐩翠緵缃愯绾夸换鍔″拰绌烘《鍑哄簱浠诲姟锛屽垱寤烘垚鍝佹《鍏ュ簱浠诲姟
+                    // 绌烘《鍒拌揪缃愯绾垮叆鍙� 鍛婅瘔缃愯绾垮叆搴撴《淇℃伅
+                    mainService.inGzxBefore();
+
+                    // 绌烘《缃愯瀹屾垚鍒拌揪缃愯绾垮嚭鍙� 瀹屾垚鐩翠緵缃愯绾夸换鍔″拰绌烘《鍑哄簱浠诲姟锛屽垱寤烘垚鍝佹《鍏ュ簱浠诲姟
                     mainService.canningLineTaskFinish();
+                    Thread.sleep(1000);
 
                     // 鍫嗗灈鏈哄紓甯镐俊鎭褰�
                     mainService.recCrnErr(7);
diff --git a/src/main/java/com/zy/core/model/command/CrnCommand.java b/src/main/java/com/zy/core/model/command/CrnCommand.java
index 6b09a73..ea94f78 100644
--- a/src/main/java/com/zy/core/model/command/CrnCommand.java
+++ b/src/main/java/com/zy/core/model/command/CrnCommand.java
@@ -74,6 +74,9 @@
     // 浠诲姟纭 0锛氭湭纭 1锛氬凡纭
     private Short command = 0;
 
+    // 绌烘《搴撳嚭搴擄紝鍛婅瘔鍫嗗灈鏈鸿繖娆″嚭搴撴湁鍑犱釜璐�
+    private Short taskCount = 0;
+
     private boolean traySize = false;
 
     public void setTaskMode(Short taskMode){
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 8abdeee..af48cf5 100644
--- a/src/main/java/com/zy/core/model/protocol/StaProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/StaProtocol.java
@@ -58,6 +58,7 @@
     //lfd鍏ュ簱鍗拌  褰搒tamp>=2鏃舵墠鍏ュ簱
     private Integer stamp = 0;
 
+    // 鍏ュ簱杈撻�佺嚎鍙嶉鍏ュ簱妗剁殑淇℃伅----------------------------------------------------------
     /**
      * 鍏ュ簱妗剁紪鍙�/鐗╂枡鍙�
      */
@@ -73,10 +74,39 @@
      */
     private boolean tailSupportFlag;
 
-    /**
-     * 娓呴櫎瑕佹《淇″彿 0.涓嶇敤娓呴櫎锛�123娓呴櫎鐩稿簲瑕佹《淇″彿
-     */
-    private int clearBucketSignal;
+//    /**
+//     * 娓呴櫎瑕佹《淇″彿 0.涓嶇敤娓呴櫎锛�123娓呴櫎鐩稿簲瑕佹《淇″彿
+//     */
+//    private int clearBucketSignal;
+    // 璇昏緭閫佺嚎鍙嶉鐨勮緟鍔╀换鍔″彿----------------------------------------------------------
+    // RGV鏀捐揣瀹屾垚杈呭姪浠诲姟鍙�
+    private Integer hideWorkNo = 0;
+
+    // 瑕佹《鍨�-------------------------------------------------------------------------
+    private int wantBucketFlag = 0;
+
+    // 鍑虹綈瑁呯嚎 缃愯绾垮弽棣堢粰wcs----------------------------------------------------------
+
+    // 浠诲姟鍙�
+    private int wrkNo;
+
+    // 鎴愬搧鏍囪瘑
+    private String matnr;
+
+    //  鎵瑰彿
+    private String batch;
+
+    // 鐢熶骇鏃ユ湡
+    private String manuDate;
+
+    // 鍑�閲�
+    private double weight;
+
+    // 澶嶆閲嶉噺
+    private double grossWeight;
+
+    // 鍑虹綈瑁呯嚎浠诲姟瀹屾垚锛岀粰缃愯绾垮啓鍙斁淇″彿 1鍙斁锛�2涓嶅彲鏀�-------------------------------------
+    private int placeableFlag;
 
     // 澶栧舰妫�娴� ------------------------------------------------------------------------
 
diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
index 9f6e7cb..1b5e722 100644
--- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -89,6 +89,7 @@
                         command.setDestinationPosX((short)0);     // 鐩爣搴撲綅鎺�
                         command.setDestinationPosY((short)0);     // 鐩爣搴撲綅鍒�
                         command.setDestinationPosZ((short)0);     // 鐩爣搴撲綅灞�
+                        command.setTaskCount((short) 0);
                         write(command);
                         break;
                     default:
@@ -267,7 +268,7 @@
 //        convertRow(command);
         command.setCrnNo(slave.getId());
 //        short[] array = new short[10];
-        short[] array = new short[10];
+        short[] array = new short[12];
         array[0] = command.getAckFinish(); // 浠诲姟瀹屾垚纭浣�
         array[1] = command.getTaskNo();  // 浠诲姟鍙�
         array[2] = command.getTaskMode();  // 妯″紡
@@ -278,6 +279,7 @@
         array[7] = command.getDestinationPosY(); // 鐩爣浣嶇疆鍒楀彿
         array[8] = command.getDestinationPosZ(); // 鐩爣浣嶇疆灞傚彿
         array[9] = command.getCommand();
+        array[11] = command.getTaskCount(); // 绌烘《鍑哄簱锛屽憡璇夊爢鍨涙満鍙栦竴涓揣杩樻槸涓や釜璐�
         OperateResult result = siemensNet.Write("DB100.0", array);
         News.info("鍫嗗灈鏈哄懡浠や笅鍙慬id:{}] >>>>> {}", slave.getId(), array);
 
diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index 25784fa..6707f1f 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -8,16 +8,13 @@
 import com.core.common.Cools;
 import com.core.common.DateUtils;
 import com.core.common.SpringUtils;
-import com.core.exception.CoolException;
 import com.zy.core.DevpThread;
 import com.zy.core.cache.MessageQueue;
 import com.zy.core.cache.OutputQueue;
 import com.zy.core.cache.SlaveConnection;
-import com.zy.core.enums.IoModeType;
 import com.zy.core.enums.SlaveType;
 import com.zy.core.model.DevpSlave;
 import com.zy.core.model.Task;
-import com.zy.core.model.protocol.StaError1;
 import com.zy.core.model.protocol.StaProtocol;
 import com.zy.entity.BasDevp;
 import com.zy.service.BasDevpService;
@@ -41,55 +38,88 @@
     private SiemensS7Net siemensS7Net;
     private Map<Integer, StaProtocol> station = new ConcurrentHashMap<>();
     private short heartBeatVal = 1;
-    private StaError1 staError1;
-    public static final ArrayList<Integer> staNos = new ArrayList<Integer>() {{
+
+    public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{
         add(1001);add(1002);add(1004);add(1005);add(1006);add(1007);add(1008);add(1009);add(1010);add(1011);add(1012);
-        add(1041);add(1042);add(1043);add(1013);add(1014);add(1015);add(1016);add(1017);add(1018);add(1019);add(1020);
-        add(1034);add(1035);add(1036);add(1038);add(1039);add(1040);
+        add(1018);add(1017);add(1016);add(1015);add(1014);add(1020);add(1019);add(1013);add(1043);add(1042);add(1041);
         add(1022);add(1023);add(1024);add(1025);add(1026);add(1027);add(1028);add(1030);add(1031);add(1032);add(1033);
-        add(1044);add(1045);add(1046);add(1047);add(1049);add(1050);add(1051);add(1052);add(1053);add(1054);add(1056);add(1057);
-        add(1061);add(1063);add(1064);add(1065);add(1066);add(1067);add(1068);add(1073);add(1074);add(1075);add(1077);add(1078);add(1079);
+        add(1034);add(1035);add(1036);add(1038);add(1039);add(1040);
+    }};
+
+    public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{
+        add(1044);add(1045);add(1046);add(1047);add(1048);add(1049);add(1050);add(1051);add(1052);add(1053);add(1054);add(1055);add(1056);add(1057);add(1058);
+        add(1061);add(1062);add(1066);add(1067);add(1068);add(1069);add(1070);add(1071);add(1072);add(1063);add(1064);add(1065);
+        add(1073);add(1074);add(1075);add(1076);add(1077);add(1078);add(1079);
         add(1081);add(1082);add(1083);add(1084);add(1085);add(1086);add(1087);add(1088);add(1089);add(1090);
-        add(1091);add(1092);add(1093);add(1094);add(1095);add(1096);add(1097);add(1098);add(1099);add(1100);add(1101);add(1102);add(1103);add(1104);
-        add(1105);add(1106);add(1107);
     }};
 
-    public static final ArrayList<Integer> BarcodeList = new ArrayList<Integer>() {{
-        add(1); add(2);
-    }};
-    public static final ArrayList<Integer> staNosErrList = new ArrayList<Integer>() {{
-        add(101); add(103);
+    public static final ArrayList<Integer> staNos3 = new ArrayList<Integer>() {{
+        add(1091);add(1092);add(1093);add(1094);add(1095);add(1096);add(1097);add(1098);add(1099);add(1100);add(1101);add(1102);
+        add(1103);add(1104);add(1105);add(1106);add(1107);
     }};
 
-    // 缃愯绾胯妗舵爣璇�
-    private volatile Map<Integer,String> wantBucketFlag =  new HashMap<>();
+    public static final ArrayList<Integer> rgvSiteBackWrkNo1= new ArrayList<Integer>() {{
+        add(1001);add(1006);add(1012);add(1018);add(1019);add(1041);add(1022);add(1026);add(1033);add(1034);
+    }};
 
-    /**
-     * 鏉$爜鏁伴噺
-     */
-    private int barcodeSize = 2;
+    public static final ArrayList<Integer> rgvSiteBackWrkNo2= new ArrayList<Integer>() {{
+        add(1044);
+    }};
 
-    /**
-     * 鍏ュ嚭搴撴ā寮�
-     * 0锛氭湭鐭�
-     * 1锛氬叆搴撳惎鍔ㄤ腑
-     * 2.鍏ュ簱妯″紡
-     * 3.鍑哄簱鍚姩涓� 锛堜笉鑳界敓鎴愬叆搴撳伐浣滄。锛�
-     * 4.鍑哄簱妯″紡
-     */
-    public IoModeType ioModeOf101 = IoModeType.NONE;
-    public IoModeType ioModeOf103 = IoModeType.NONE;
-    public IoModeType ioModeOf305 = IoModeType.NONE;
-//    public IoModeType ioMode = IoModeType.NONE;
-//    public IoModeType ioModeOf4F = IoModeType.NONE;
-//    public IoModeType ioMode = IoModeType.NONE;
+    public static final ArrayList<Integer> rgvSiteBackWrkNo3= new ArrayList<Integer>() {{
+        add(1105);add(1100);add(1091);add(1094);add(1097);
+    }};
+
+    public static final ArrayList<Integer> barcodeList = new ArrayList<Integer>() {{
+        add(1); add(2); add(3); add(4);
+    }};
+
+    // 澶栧舰妫�娴�1鍙穚lc
+    public static final ArrayList<Integer> staNosErrList1 = new ArrayList<Integer>() {{
+        add(1006); add(1012);add(1018);add(1041);
+    }};
+
+    // 澶栧舰妫�娴�2鍙穚lc
+    public static final ArrayList<Integer> staNosErrList2 = new ArrayList<Integer>() {{
+        add(1083); add(1086);add(1089);
+    }};
+
+    // 鍑虹綈瑁呯嚎鍙嶉缁檞cs淇℃伅绔欑偣
+    public static final ArrayList<Integer> gzxResultSite = new ArrayList<Integer>() {{
+        add(1081); add(1084);add(1087);
+    }};
 
     public SiemensDevpThread(DevpSlave slave) {
         this.slave = slave;
     }
 
+    private ArrayList<Integer> getRgvSiteBackWrkNo() {
+        switch (this.slave.getId()) {
+            case 1: return rgvSiteBackWrkNo1;
+            case 2: return rgvSiteBackWrkNo2;
+            case 3: return rgvSiteBackWrkNo3;
+            default:
+        }
+        return new ArrayList<>();
+    }
+
     private ArrayList<Integer> getStaNo() {
-        return staNos;
+        switch (this.slave.getId()) {
+            case 1: return staNos1;
+            case 2: return staNos2;
+            case 3: return staNos3;
+            default:
+        }
+        return new ArrayList<>();
+    }
+
+    private ArrayList<Integer> getStaNosErrList() {
+        switch (this.slave.getId()) {
+            case 1: return staNosErrList1;
+            case 2: return staNosErrList2;
+            default:
+        }
+        return new ArrayList<>();
     }
 
     @Override
@@ -111,7 +141,18 @@
                     // 鍐欐暟鎹� ID+鐩爣绔�
                     case 2:
                         write((StaProtocol)task.getData());
-//                        log.error("杈撻�佺嚎涓嬪彂鍛戒护锛�"+((StaProtocol) task.getData()).getWorkNo()+","+((StaProtocol) task.getData()).getStaNo());
+                        break;
+                    // 鍐欏熬妗朵俊鍙�
+                    case 3:
+                        writeTail((StaProtocol)task.getData());
+                        break;
+                    // 鍐欏叆缃愯绾挎《鍨嬩俊鎭�
+                    case 4:
+                        writeGzx((StaProtocol)task.getData());
+                        break;
+                    // 缁欑綈瑁呯嚎鍐欏彲鍑�
+                    case 5:
+                        writeGzxkc((StaProtocol)task.getData());
                         break;
                     default:
                         break;
@@ -176,15 +217,45 @@
     /**
      * 璇诲彇鐘舵�� ====> 鏁村潡plc
      */
-    private void read() throws InterruptedException {
-        wantBucketFlag.clear();
-        //todo 璇诲彇缃愯绾縋LC瑕佹《鏍囪瘑
-        wantBucketFlag.put(1,"IBC");
+    private void read() {
 
-        // 璇讳竴妤艰繛缁�8涓珯鐐�
-        OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (8*8));
-        if (result.IsSuccess) {
-            for (int i = 0; i < 8; i++) {
+        // 璇荤綈瑁呯嚎鍙嶉淇℃伅
+        if (slave.getId() > 3) {
+//            log.info("璇诲彇{}鍙风綈瑁呯嚎plc淇℃伅鎴愬姛",slave.getId());
+            OperateResultExOne<byte[]> read = siemensS7Net.Read("DB101.0", (short) 58);
+            if (read.IsSuccess) {
+                // 鎴愬搧淇℃伅鍙嶉鍒扮綈瑁呯嚎鍑哄彛绔欑偣
+                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2);
+                StaProtocol staProtocol = devpThread.getStation().get(gzxResultSite.get(slave.getId()-4));
+                if (staProtocol != null) {
+                    staProtocol.setWantBucketFlag(siemensS7Net.getByteTransform().TransInt16(read.Content, 0));// 缃愯绾胯妗跺瀷淇″彿
+                    staProtocol.setWrkNo(siemensS7Net.getByteTransform().TransInt16(read.Content, 2));
+                    double weight208l1 = siemensS7Net.getByteTransform().TransInt32(read.Content, 4); // 200L妗�1鍑�閲�
+                    double weight208l2 = siemensS7Net.getByteTransform().TransInt32(read.Content, 8); // 200L妗�2鍑�閲�
+                    double weight208l3 = siemensS7Net.getByteTransform().TransInt32(read.Content, 12); // 200L妗�3鍑�閲�
+                    double weight208l4 = siemensS7Net.getByteTransform().TransInt32(read.Content, 16); // 200L妗�4鍑�閲�
+                    double weight1T = siemensS7Net.getByteTransform().TransInt32(read.Content, 20); // 1T妗跺噣閲�
+//                    log.info("璇诲彇宸ョ綈瑁呯嚎鍑�閲� 200l妗�1:{},200l妗�2:{},200l妗�3:{},200l妗�4:{},1t妗�:{}",weight208l1,weight208l2,weight208l3,weight208l4,weight1T);
+                    staProtocol.setWeight(weight208l1 + weight208l2 + weight208l3 + weight208l4 + weight1T);
+                    staProtocol.setGrossWeight(siemensS7Net.getByteTransform().TransInt32(read.Content, 24));
+                    staProtocol.setMatnr(siemensS7Net.getByteTransform().TransString(read.Content, 28,12,"UTF-8"));
+                    staProtocol.setBatch(siemensS7Net.getByteTransform().TransString(read.Content, 40,10,"UTF-8"));
+                    staProtocol.setManuDate(siemensS7Net.getByteTransform().TransString(read.Content, 50,8,"UTF-8"));
+                }
+                return;
+            }
+        }
+
+        ArrayList<Integer> staNos = getStaNo();
+        if(staNos == null) {
+            log.error("璇诲彇plc鍦板潃鍧楋紝鑾峰彇绔欑偣鍒楄〃澶辫触");
+            return;
+        }
+
+        // 璇荤珯鐐逛俊鎭弽棣�
+        OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNos.size() * 8));
+        if (result.IsSuccess)   {
+            for (int i = 0; i < staNos.size(); i++) {
                 Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
                 StaProtocol staProtocol = station.get(siteId);
                 if (null == staProtocol) {
@@ -212,38 +283,11 @@
             }
         }
 
-        // 鏉$爜鎵弿鍣�
-        OperateResultExOne<byte[]> barcodeResult = siemensS7Net.Read("DB101.1672", (short) ((BarcodeList.size()+1) * 8)); // 涓嶈繛缁�
-        if (barcodeResult.IsSuccess) {
-            for (int i = 0; i < BarcodeList.size(); i++) {
-                String barcode = siemensS7Net.getByteTransform().TransString(barcodeResult.Content,i*16,8, "UTF-8");
-                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, BarcodeList.get(i));
-                if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
-                    barcodeThread.setBarcode(barcode);
-                }
-            }
-        }
-
-        // 澶栧舰妫�娴�
-        OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.1652", (short) ((staNosErrList.size()+1)*4)); // 涓嶈繛缁紝澶氳涓棿涓�涓�
-        if (resultErr.IsSuccess){
-            for (int i = 0;i<staNosErrList.size();i++){
-                boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i*8+2, 1);
-                StaProtocol staProtocol = station.get(staNosErrList.get(i));
-                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]);
-            }
-        }
-        // 璇讳竴妤艰繛缁�8涓珯鐐癸紝鏁呴殰淇℃伅鍙嶉
-        OperateResultExOne<byte[]> resultErr2 = siemensS7Net.Read("DB101.3312", (short) (8*2));
+        // 璇绘晠闅滀俊鎭弽棣�
+        OperateResultExOne<byte[]> resultErr2 = siemensS7Net.Read("DB101.920", (short) (staNos.size()*4));
         if (resultErr2.IsSuccess) {
-            for (int i = 0; i < 8; i++) {
-                boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr2.Content, i*2 + 1, 1);
+            for (int i = 0; i < staNos.size(); i++) {
+                boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr2.Content, i * 4 + 2, 1);
                 StaProtocol staProtocol = station.get(staNos.get(i)); // 绔欑偣缂栧彿
                 staProtocol.setBreakerErr(status[0]);
                 staProtocol.setInfraredErr(status[1]);
@@ -254,6 +298,74 @@
                 staProtocol.setContactErr(status[6]);
                 staProtocol.setUpcontactErr(status[7]);
 
+            }
+        }
+
+        // 璇籸gv鏀捐揣绔欑偣浠诲姟鍙峰弽棣�
+        ArrayList<Integer> rgvSiteBackWrkNo = getRgvSiteBackWrkNo();
+        OperateResultExOne<byte[]> rgvSiteBackWrkNoResult = siemensS7Net.Read("DB101.1440", (short) (rgvSiteBackWrkNo.size() * 2));
+        if (rgvSiteBackWrkNoResult.IsSuccess) {
+            for (int i = 0; i < rgvSiteBackWrkNo.size(); i ++ ){
+                short hideWrkNo = siemensS7Net.getByteTransform().TransInt16(rgvSiteBackWrkNoResult.Content, i * 2);
+                StaProtocol staProtocol = station.get(getRgvSiteBackWrkNo().get(i));
+                staProtocol.setHideWorkNo((int) hideWrkNo);
+            }
+        }
+
+        // 璇绘潯鐮佹壂鎻忓櫒
+        if(slave.getId() == 1) {
+            OperateResultExOne<byte[]> barcodeResult = siemensS7Net.Read("DB101.840", (short) (barcodeList.size() * 8));
+            if (barcodeResult.IsSuccess) {
+                for (int i = 0; i < barcodeList.size(); i++) {
+                    String barcode = siemensS7Net.getByteTransform().TransString(barcodeResult.Content,i*8,8, "UTF-8");
+                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeList.get(i));
+                    if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
+                        barcodeThread.setBarcode(barcode);
+                    }
+                }
+            }
+        }
+
+        // 璇荤┖妗朵俊鎭弽棣�
+        if (slave.getId() == 1) {
+            OperateResultExOne<byte[]> emptyBucketsResult = siemensS7Net.Read("DB101.1320", (short) (staNosErrList1.size() * 6));
+            if (emptyBucketsResult.IsSuccess) {
+                for (int i = 0; i < staNosErrList1.size(); i++) {
+                    // 妗剁被鍨嬫爣璇�
+                    int bucketType = siemensS7Net.getByteTransform().TransInt16(emptyBucketsResult.Content, i * 6);
+                    // 妗舵暟閲�
+                    int bucketCount = siemensS7Net.getByteTransform().TransInt16(emptyBucketsResult.Content, i * 6 + 2);
+                    // 灏炬《鏍囪瘑
+                    boolean[] tailSupportArray= siemensS7Net.getByteTransform().TransBool(emptyBucketsResult.Content, i * 6 + 4,1);
+                    boolean tailSupportFlag = tailSupportArray[0];
+//                    log.info("绌烘《淇℃伅鍙嶉锛岀珯鐐癸細{}锛屾《绫诲瀷鏍囪瘑锛歿}锛屾暟閲忥細{}锛屽熬妗舵爣璇嗭細{}",staNosErrList1.get(i),bucketType,bucketCount,tailSupportFlag);
+                    StaProtocol staProtocol = station.get(staNosErrList1.get(i));
+                    if (null == staProtocol) {
+                        staProtocol = new StaProtocol();
+                        staProtocol.setSiteId(staNosErrList1.get(i));
+                        station.put(staNosErrList1.get(i), staProtocol);
+                    }
+                    staProtocol.setBucketType(String.valueOf(bucketType));
+                    staProtocol.setBucketCount(bucketCount);
+                    staProtocol.setTailSupportFlag(tailSupportFlag);
+                }
+            }
+        }
+
+        // 璇诲褰㈡娴�
+        ArrayList<Integer> staNosErrList = getStaNosErrList();
+        OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.800", (short) (staNosErrList.size()*4));
+        if (resultErr.IsSuccess){
+            for (int i = 0;i<staNosErrList.size();i++){
+                boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i*4+2, 1);
+                StaProtocol staProtocol = station.get(staNosErrList.get(i));
+                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]);
             }
         }
 
@@ -270,9 +382,12 @@
                 }
 
                 BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
-                if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) {
-                    throw new Exception("鏇存柊鏁版嵁搴撴暟鎹け璐�");
+                if(basDevps.size() > 0) {
+                    if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) {
+                        throw new Exception("鏇存柊鏁版嵁搴撴暟鎹け璐�");
+                    }
                 }
+
             } catch (Exception e) {
                 initSite();
                 e.printStackTrace();
@@ -294,41 +409,19 @@
             return;
         }
 
-        int address = -1;
-        switch (staProtocol.getSiteId()) {
-            case 100: address = 0; break;
-            case 101: address = 4; break;
-            case 102: address = 8; break;
-            case 103: address = 12; break;
-            case 104: address = 16; break;
-            case 105: address = 20; break;
-            case 106: address = 24; break;
-            case 107: address = 28; break;
-            case 200: address = 400; break;
-            case 201: address = 404; break;
-            case 202: address = 408; break;
-            case 203: address = 412; break;
-            case 210: address = 440; break;
-            case 300: address = 800; break;
-            case 301: address = 804; break;
-            case 302: address = 808; break;
-            case 303: address = 812; break;
-            case 304: address = 816; break;
-            case 305: address = 820; break;
-            default:
-        }
-        if(address == -1) {
-            throw new CoolException("鍐欏叆绔欑偣寮傚父锛�" + staProtocol.getSiteId());
-        }
+        // 鍙栫珯鐐逛笅鏍囷紝璁$畻plc鍋忕Щ閲�
+        int i = getStaNo().indexOf(staProtocol.getSiteId());
+
         OperateResult write;
         OperateResult write1;
         //浠诲姟涓嬪彂娆℃暟
         int writeCount = 0;
         do {
-            write1 = siemensS7Net.Write("DB100." + (address+2), staProtocol.getStaNo());    // 鐩爣绔�
-            write = siemensS7Net.Write("DB100." + address, staProtocol.getWorkNo().shortValue());    // 宸ヤ綔鍙�
+            write1 = siemensS7Net.Write("DB100." + (i*6 +4), staProtocol.getStaNo());    // 鐩爣绔�
+            write = siemensS7Net.Write("DB100." + (i*6), staProtocol.getWorkNo());    // 宸ヤ綔鍙�
             Thread.sleep(200);
             if(write.IsSuccess && write1.IsSuccess){
+                log.info("杈撻�佺嚎鍛戒护涓嬪彂鎴愬姛,绔欑偣锛歿},浠诲姟鍙�:{},鐩爣绔欙細{}",staProtocol.getSiteId(),staProtocol.getWorkNo(),staProtocol.getStaNo());
                 break;
             }
             else {
@@ -351,6 +444,114 @@
     }
 
     /**
+     * 鍐欏熬妗朵俊鍙�
+     */
+    private void writeTail(StaProtocol staProtocol) throws InterruptedException {
+        if (null == staProtocol) {
+            return;
+        }
+
+        OperateResult write;
+        //浠诲姟涓嬪彂娆℃暟
+        int writeCount = 0;
+        do {
+            write = siemensS7Net.Write("DB100.600", staProtocol.isTailSupportFlag() ? 1 : 0);    // 0 涓嶆槸灏炬《锛�1 鏄熬妗�
+            Thread.sleep(200);
+            if(write.IsSuccess){
+                break;
+            }
+            else {
+                writeCount++;
+                log.error("鍐欏叆灏炬《鍛戒护澶辫触銆傝緭閫佺嚎plc缂栧彿={}锛屾槸鍚﹀熬妗�={},鍐欏叆娆℃暟={}", slave.getId(), staProtocol.isTailSupportFlag(), writeCount);
+            }
+        }while (writeCount<5);
+
+        if (!write.IsSuccess) {
+            OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ュ熬妗跺懡浠ゆ暟鎹け璐ャ�傝緭閫佺嚎plc缂栧彿={1}锛岀珯鐐规暟鎹�={2}", slave.getId(), staProtocol.isTailSupportFlag()));
+            News.error("SiemensDevp"+" - 4"+" - 鍐欏叆灏炬《鍛戒护鏁版嵁澶辫触銆傝緭閫佺嚎plc缂栧彿={}锛岀珯鐐规暟鎹�={}", slave.getId(), staProtocol.isTailSupportFlag());
+        } else {
+            OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆� 鍐欏叆灏炬《鍛戒护涓嬪彂 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), staProtocol.isTailSupportFlag()));
+            News.info("SiemensDevp"+" - 5"+" - 鍐欏叆灏炬《鍛戒护涓嬪彂 [id:{}] >>>>> 鍛戒护涓嬪彂锛� {}",  slave.getId(), staProtocol.isTailSupportFlag());
+        }
+    }
+
+    /**
+     * 鍏ョ綈瑁呯嚎鍓峸cs鍐欐《鍨嬩俊鎭�
+     */
+    private void writeGzx(StaProtocol staProtocol) throws InterruptedException {
+        if (null == staProtocol) {
+            return;
+        }
+        short[] common = new short[3];
+        common[0] = Short.parseShort(staProtocol.getBucketType());
+        common[1] = (short) staProtocol.getBucketCount();
+        common[2] = staProtocol.getWorkNo().shortValue();
+        OperateResult write;
+        //浠诲姟涓嬪彂娆℃暟
+        int writeCount = 0;
+        do {
+            write = siemensS7Net.Write("DB100.0", common);
+            Thread.sleep(200);
+            if(write.IsSuccess){
+                break;
+            }
+            else {
+                writeCount++;
+                log.error("缁欑綈瑁呯嚎鍐欏叆妗跺瀷淇℃伅澶辫触銆傝緭閫佺嚎plc缂栧彿={}锛屾槸鍚﹀熬妗�={},鍐欏叆娆℃暟={}", slave.getId(), staProtocol.isTailSupportFlag(), writeCount);
+            }
+        }while (writeCount<5);
+
+        if (!write.IsSuccess) {
+            OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ュ熬妗跺懡浠ゆ暟鎹け璐ャ�傝緭閫佺嚎plc缂栧彿={1}锛岀珯鐐规暟鎹�={2}", slave.getId(), staProtocol.isTailSupportFlag()));
+            News.error("SiemensDevp"+" - 4"+" - 缁欑綈瑁呯嚎鍐欏叆妗跺瀷淇℃伅澶辫触銆傝緭閫佺嚎plc缂栧彿={}锛岀珯鐐规暟鎹�={}", slave.getId(), staProtocol.isTailSupportFlag());
+        } else {
+            OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆� 缁欑綈瑁呯嚎鍐欏叆妗跺瀷淇℃伅鍛戒护涓嬪彂鎴愬姛 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), staProtocol.isTailSupportFlag()));
+            News.info("SiemensDevp"+" - 5"+" - 缁欑綈瑁呯嚎鍐欏叆妗跺瀷淇℃伅鍛戒护涓嬪彂鎴愬姛 [id:{}] >>>>> 鍛戒护涓嬪彂锛� {}",  slave.getId(), staProtocol.getBucketType());
+        }
+    }
+
+    /**
+     * 缁欑綈瑁呯嚎鍐欏叆鍙嚭淇″彿
+     */
+    private void writeGzxkc(StaProtocol staProtocol) throws InterruptedException {
+        if (null == staProtocol) {
+            return;
+        }
+        short[] common = new short[1];
+        common[0] = (short) staProtocol.getPlaceableFlag();
+
+        OperateResult write;
+        //浠诲姟涓嬪彂娆℃暟
+        int writeCount = 0;
+        do {
+            write = siemensS7Net.Write("DB100.6", common);
+            Thread.sleep(200);
+            OperateResultExOne<byte[]> read = siemensS7Net.Read("DB100.6", (short) 2);
+            if(write.IsSuccess && read.IsSuccess){
+                short i = siemensS7Net.getByteTransform().TransInt16(read.Content, 0);
+                if ( i != 1) {
+                    writeCount++;
+                    log.error("缁欑綈瑁呯嚎鍐欏叆鍙嚭淇″彿鎴愬姛锛屼絾鍥炶澶辫触锛氳鍙栧�硷細{},杈撻�佺嚎plc缂栧彿={}锛屽啓鍏ユ鏁�={}", i, slave.getId(), writeCount);
+                    continue;
+                }
+                break;
+            }
+            else {
+                writeCount++;
+                log.error("缁欑綈瑁呯嚎鍐欏叆鍙嚭淇″彿锛歿}澶辫触銆傝緭閫佺嚎plc缂栧彿={}锛屽啓鍏ユ鏁�={}", common[0], slave.getId(), writeCount);
+            }
+        }while (writeCount<5);
+
+        if (!write.IsSuccess) {
+            OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戠粰缃愯绾垮啓鍏ュ彲鍑轰俊鍙峰け璐ャ�傝緭閫佺嚎plc缂栧彿={1}锛岀珯鐐规暟鎹�={2}", slave.getId(), staProtocol.getPlaceableFlag()));
+            News.error("SiemensDevp"+" - 4"+" - 缁欑綈瑁呯嚎鍐欏叆鍙嚭淇″彿澶辫触銆傝緭閫佺嚎plc缂栧彿={}锛岀珯鐐规暟鎹�={}", slave.getId(), staProtocol.getPlaceableFlag());
+        } else {
+            OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆� 缁欑綈瑁呯嚎鍐欏叆鍙嚭淇″彿鍛戒护涓嬪彂鎴愬姛 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), staProtocol.getPlaceableFlag()));
+            News.info("SiemensDevp"+" - 5"+" - 缁欑綈瑁呯嚎鍐欏叆鍙嚭淇″彿鍛戒护涓嬪彂鎴愬姛 [id:{}] >>>>> 鍛戒护涓嬪彂锛� {}",  slave.getId(), staProtocol.getPlaceableFlag());
+        }
+    }
+
+    /**
      * 蹇冭烦
      */
     private void heartbeat(){
diff --git a/src/main/java/com/zy/entity/WrkDetl.java b/src/main/java/com/zy/entity/WrkDetl.java
index fb871de..05afeed 100644
--- a/src/main/java/com/zy/entity/WrkDetl.java
+++ b/src/main/java/com/zy/entity/WrkDetl.java
@@ -166,8 +166,9 @@
     /**
      * 闀垮害
      */
-    @ApiModelProperty(value= "闀垮害")
-    private Double length;
+    @ApiModelProperty(value= "姣涢噸")
+    @TableField("man_length")
+    private Double manLength;
 
     /**
      * 浣撶Н
@@ -223,9 +224,9 @@
     private Integer source;
 
     /**
-     * 瑕佹眰妫�楠� 1: 鏄�  0: 鍚�
+     * 璐存爣缁撴灉(1.鎴愬姛锛�0.澶辫触)
      */
-    @ApiModelProperty(value= "瑕佹眰妫�楠� 1: 鏄�  0: 鍚�  ")
+    @ApiModelProperty(value= "璐存爣缁撴灉(1.鎴愬姛锛�0.澶辫触)")
     private Integer inspect;
 
     /**
diff --git a/src/main/java/com/zy/entity/WrkMast.java b/src/main/java/com/zy/entity/WrkMast.java
index 27358e9..47285a4 100644
--- a/src/main/java/com/zy/entity/WrkMast.java
+++ b/src/main/java/com/zy/entity/WrkMast.java
@@ -295,7 +295,7 @@
 
     @ApiModelProperty(value= "")
     @TableField("Pdc_type")
-    private String PdcType;
+    private String pdcType;
 
     @ApiModelProperty(value= "")
     @TableField("ctn_no")
@@ -310,6 +310,9 @@
     @TableField("rgv_dsta_no")
     private Integer rgvDstaNo;
 
+    @TableField("work_no_other")
+    private Integer workNoOther;
+
     /**
      * 婊℃澘
      */
diff --git a/src/main/java/com/zy/mapper/WrkMastMapper.java b/src/main/java/com/zy/mapper/WrkMastMapper.java
index 3454d25..4892ba1 100644
--- a/src/main/java/com/zy/mapper/WrkMastMapper.java
+++ b/src/main/java/com/zy/mapper/WrkMastMapper.java
@@ -31,7 +31,7 @@
 
     // 鍏ュ簱绗簩姝ワ紝褰撴墭鐩樼墿鏂欏湪鍫嗗灈鏈哄叆搴撶珯鏃舵椂鏌ヨ
 //    @Select("select top 1 * from dbo.asr_wrk_mast where wrk_sts=2 and crn_no=#{crnNo} and wrk_no=#{workNo} and (io_type=1 or io_type=10 or io_type=53 or io_type=54 or io_type=57) order by io_pri desc,io_time,wrk_no ASC")
-    WrkMast selectPakInStep2(@Param("crnNo")Integer crnNo, @Param("workNo")Integer workNo, @Param("staNo")Integer staNo);
+    WrkMast selectPakInStep2(@Param("crnNo")Integer crnNo, @Param("workNo")Integer workNo);
 
     // 鍏ュ簱绗笁姝ワ紝褰撳爢鍨涙満鎶婅揣鏀惧叆搴撲綅鏃�
 //    @Select("select top 1 from dbo.asr_wrk_mast where wrk_no=#{workNo}")
diff --git a/src/main/java/com/zy/service/impl/MainServiceImpl.java b/src/main/java/com/zy/service/impl/MainServiceImpl.java
index 594455a..bbe9cec 100644
--- a/src/main/java/com/zy/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/service/impl/MainServiceImpl.java
@@ -65,11 +65,21 @@
     // 缃愯瀹屾垚rgv鎺ラ┏绔欑偣
     public static final List<Integer>  canningLineRgvConnectionSiteList = new ArrayList<>();
 
-    static {
-        emptyPalletSiteMap.put(1002,"M");
-        emptyPalletSiteMap.put(1020,"M");emptyPalletSiteMap.put(1035,"Z");
+    // 鍏ョ綈瑁呯嚎涔嬪墠鍛婅瘔缃愯绾挎《淇℃伅鐨勭珯鐐�
+    public static final List<Integer>  inGzxSiteList = new ArrayList<>();
 
-        stackingSite.add(1027);stackingSite.add(1020);
+    // 鍑虹綈瑁呯嚎鍚庤鍙栫綈瑁呯嚎鍙嶉淇℃伅
+    public static final List<Integer>  outGzxSiteList = new ArrayList<>();
+
+    // 鎴愬搧搴撳爢鍨涙満鍑哄簱绔欑偣鍒皉gv鎺ラ┏鐐�
+    public static final Map<Integer,Short>  crnOutSiteToRgvSite = new HashMap<>();
+
+    static {
+        emptyPalletSiteMap.put(1001,"M"); // emptyPalletSiteMap.put(1002,"M");
+        emptyPalletSiteMap.put(1019,"M"); // emptyPalletSiteMap.put(1020,"M");
+        emptyPalletSiteMap.put(1034,"Z"); // emptyPalletSiteMap.put(1035,"Z");
+
+        stackingSite.add(1019);stackingSite.add(1026);
 
         rgvConnectionSiteList.add(1012);rgvConnectionSiteList.add(1006);rgvConnectionSiteList.add(1001);rgvConnectionSiteList.add(1018);
         rgvConnectionSiteList.add(1019);rgvConnectionSiteList.add(1041);rgvConnectionSiteList.add(1034);rgvConnectionSiteList.add(1033);
@@ -78,13 +88,18 @@
         rgvConnectionSiteList.add(1105);rgvConnectionSiteList.add(1100);rgvConnectionSiteList.add(1097);rgvConnectionSiteList.add(1094);
         rgvConnectionSiteList.add(1091);
 
-        taskStaNoToRgvStaNoMap.put(1050,1044);taskStaNoToRgvStaNoMap.put(1079,1044);taskStaNoToRgvStaNoMap.put(1065,1044);taskStaNoToRgvStaNoMap.put(1072,1044);taskStaNoToRgvStaNoMap.put(1093,1094);
+        taskStaNoToRgvStaNoMap.put(1050,1044);taskStaNoToRgvStaNoMap.put(1078,1044);taskStaNoToRgvStaNoMap.put(1064,1044);taskStaNoToRgvStaNoMap.put(1071,1044);taskStaNoToRgvStaNoMap.put(1096,1094);
         taskStaNoToRgvStaNoMap.put(1104,1100);taskStaNoToRgvStaNoMap.put(1102,1100);taskStaNoToRgvStaNoMap.put(1090,1090);taskStaNoToRgvStaNoMap.put(1002,1001);taskStaNoToRgvStaNoMap.put(1016,1018);
         taskStaNoToRgvStaNoMap.put(1020,1019);taskStaNoToRgvStaNoMap.put(1024,1022);taskStaNoToRgvStaNoMap.put(1035,1034);taskStaNoToRgvStaNoMap.put(1040,1033);taskStaNoToRgvStaNoMap.put(1043,1041);
 
         canningLineRgvConnectionSiteList.add(1083);canningLineRgvConnectionSiteList.add(1086);
         canningLineRgvConnectionSiteList.add(1089);
 
+        inGzxSiteList.add(1071);inGzxSiteList.add(1064);inGzxSiteList.add(1078);
+
+        outGzxSiteList.add(1081);outGzxSiteList.add(1084);outGzxSiteList.add(1087);
+
+        crnOutSiteToRgvSite.put(1093, (short) 1091);crnOutSiteToRgvSite.put(1099, (short) 1097);crnOutSiteToRgvSite.put(1107, (short) 1105);
     }
 
     @Autowired
@@ -155,36 +170,36 @@
                 // 灏哄妫�娴嬪紓甯�
                 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 (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) {
+                if (back && staProtocol.isInEnable()) {
                     MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
 
                     if (!staProtocol.isLoading()){
@@ -193,12 +208,8 @@
                     if (!staProtocol.isPakMk()) {
                         continue;
                     }
-                    staProtocol.setWorkNo(wrkNo);
                     News.info("{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", inSta.getStaNo(), errMsg,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("{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", inSta.getStaNo(), errMsg,wrkNo);
                     return;
                 }
 
@@ -206,48 +217,31 @@
                 if (staProtocol.isAutoing()
                         && staProtocol.isLoading()
                         && staProtocol.isInEnable()
-                        && !staProtocol.isEmptyMk()
-                        && staProtocol.isPakMk()) {
-                    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);
-//                        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());
+                        && staProtocol.getWorkNo() == 0
+                        && staProtocol.isPakMk()
+                ) {
+                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode) || barcode.startsWith("ERROR")) {
+                        log.error("{}鍙锋潯鐮佹娴嬪け璐ワ紝鏉$爜淇℃伅锛歿}", inSta.getBarcode(), barcode);
                         continue;
                     }
                     // 鍒ゆ柇閲嶅宸ヤ綔妗�
                     WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
                     if (wrkMast != null) {
-//                        News.error(methodName + ":宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
-//                        if (ledThread != null) {
-//                            News.error(methodName + ":鎵爜澶辫触锛岃閲嶈瘯");
-//                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, "宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={" + wrkMast.getWrkNo() + "}, 璇锋墜鍔ㄥ彇娑堝凡瀛樺湪宸ヤ綔妗�"));
-//                        }
                         continue;
                     }
-                    WrkMast checkPick = wrkMastService.selectOne(new EntityWrapper<WrkMast>()
-                            .eq("barcode", barcode)
-                            .in("io_type", 107,103,57));
-                    if (!Cools.isEmpty(checkPick)) {
-                        continue;
-                    }
+
                     try {
                         LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
 
                         SearchLocParam param = new SearchLocParam();
                         param.setBarcode(barcode);
-                        param.setIoType(1);
+                        param.setIoType(staProtocol.getBucketType().equals("21")  || staProtocol.getBucketType().equals("20") ? 10 : 1);
                         param.setSourceStaNo(inSta.getStaNo());
                         param.setLocType1(locTypeDto.getLocType1());
-                        param.setLocArea(2);// 鍏ョ┖妗跺簱鏍囪瘑
                         param.setBucketType(staProtocol.getBucketType());
                         param.setBucketCount(staProtocol.getBucketCount());
                         param.setTailSupportFlag(staProtocol.isTailSupportFlag());
-                        param.setWantBucketFlag(devpThread.getWantBucketFlag());
+                        param.setWantBucketFlag(getWantBucketFlag());
 
                         String response = new HttpHandler.Builder()
                                 .setUri(wmsUrl)
@@ -260,28 +254,18 @@
                         if (jsonObject.getInteger("code").equals(200)) {
                             StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                             barcodeThread.setBarcode("");
-                            // 鐩爣绔欑偣鏄洿渚涚綈瑁呯嚎
-                            if (dto.getStaNo() == 1079 || dto.getStaNo() == 1065 || dto.getStaNo() == 1072) {
-                                devpThread.getWantBucketFlag().remove(dto.getCrnNo()); // 绉婚櫎杈撻�佺嚎瑕佹《淇″彿
-                                staProtocol.setClearBucketSignal(dto.getCrnNo()); // 娓呴櫎瑕佹《淇″彿鏍囪瘑
-                            }
                             staProtocol.setWorkNo(dto.getWorkNo());
-                            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());
                             if (!result) {
                                 News.error(methodName + ":鏇存柊plc绔欑偣淇℃伅澶辫触");
-
                                 throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
                             }else {
                                 ledThread.errorReset();
                             }
                         } else {
-                            staProtocol.setWorkNo(wrkNo);
-                            staProtocol.setStaNo(inSta.getBackSta().shortValue());
-                            devpThread.setPakMk(staProtocol.getSiteId(), false);
-                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                             if (ledThread != null) {
                                 String errorMsg = jsonObject.getString("msg");
                                 if (!Cools.isEmpty(errorMsg)) {
@@ -301,70 +285,18 @@
     }
 
     /**
-     * wms鍏ュ簱
-     * 鍏ュ簱绔欙紝鏍规嵁鏉$爜鎵弿鐢熸垚鍏ュ簱宸ヤ綔妗o紝宸ヤ綔鐘舵�� 1 ==>> 2
+     * 鑾峰彇缃愯绾胯妗朵俊鎭�
      */
-    public synchronized void generateStoreWrkFile0(Integer mark) {
-        // 鏍规嵁杈撻�佺嚎plc閬嶅巻
-        for (DevpSlave devp : slaveProperties.getDevp()) {
-            // 閬嶅巻鍏ュ簱鍙�
-            for (DevpSlave.Sta inSta : devp.getInSta()) {
-                // 鑾峰彇鍏ュ簱绔欎俊鎭�
-                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
-                StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
-                if (staProtocol == null) {
-                    continue;
-                } else {
-                    staProtocol = staProtocol.clone();
-                }
-
-//                // 鍏ュ嚭搴撴ā寮忓垽鏂�
-                if (inSta.getStaNo() == 203 && devpThread.ioModeOf101 != IoModeType.PAKIN_MODE) {
-                    continue;
-                }
-
-                // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
-                if (!staProtocol.isLoading()){
-                    continue;
-                }
-                if (staProtocol.isAutoing() && staProtocol.isInEnable()
-                        && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() == 9999)
-                        && staProtocol.isPakMk()) {
-                    News.warnNoLog(""+mark+" - 0"+" - 寮�濮嬫墽琛�");
-                    // 鍒ゆ柇閲嶅宸ヤ綔妗�
-                    WrkMast wrkMast = wrkMastMapper.selectPakInStep11(inSta.getStaNo());
-                    if (wrkMast == null) {
-                        continue;
-                    }
-
-                    // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
-
-                    // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
-                    staProtocol.setWorkNo(wrkMast.getWrkNo());
-                    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());
-                    if (result) {
-                        // 鏇存柊宸ヤ綔涓绘。
-                        wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵�侊細2.璁惧涓婅蛋
-                        wrkMast.setModiTime(new Date());
-                        if (wrkMastMapper.updateById(wrkMast) == 0) {
-                            News.error(""+mark+" - 1"+" - 鏇存柊宸ヤ綔妗eけ璐ワ紒锛侊紒 [宸ヤ綔鍙凤細{}]", wrkMast.getWrkNo());
-                        }
-                    } else {
-                        News.error(""+mark+" - 2"+" - 鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
-                    }
-
-                }else {
-                    News.errorNoLog(""+mark+" - 6"+" - 绔欑偣淇℃伅涓嶇鍚堝叆搴撴潯浠讹紒锛侊紒"+" 鑷姩淇″彿锛�"+staProtocol.isLoading()+"銆佸彲鍏ヤ俊鍙凤細" + staProtocol.isInEnable()
-                            +"銆佺┖鏉夸俊鍙凤細"+ staProtocol.isEmptyMk()+"銆佸伐浣滃彿锛�" + staProtocol.getWorkNo()
-                            +"銆侀攣瀹氭爣璁�"+ staProtocol.isPakMk()+"銆佸叆搴撳嵃璁帮細" + staProtocol.getStamp());
-                }
-            }
-        }
-//        News.infoNoLog(""+mark+" - 0"+" - wms鍏ュ簱  ===銆嬫墽琛屽畬鎴�");
-
+    private List<SearchLocParam.WantBucket> getWantBucketFlag() {
+        SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 2);
+        StaProtocol staProtocol1081 = devpThread.getStation().get(1081);
+        StaProtocol staProtocol1084 = devpThread.getStation().get(1084);
+        StaProtocol staProtocol1087 = devpThread.getStation().get(1087);
+        List<SearchLocParam.WantBucket> wantBucketList = new ArrayList<>();
+        wantBucketList.add(new SearchLocParam.WantBucket(1071,staProtocol1081.getWantBucketFlag()));
+        wantBucketList.add(new SearchLocParam.WantBucket(1064,staProtocol1084.getWantBucketFlag()));
+        wantBucketList.add(new SearchLocParam.WantBucket(1078,staProtocol1087.getWantBucketFlag()));
+        return wantBucketList;
     }
 
     /**
@@ -545,33 +477,34 @@
                             && crnProtocol.statusType == CrnStatusType.WAITING
                             && crnProtocol.forkPosType == CrnForkPosType.HOME) {
 
-                        staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
+                        staProtocol.setStaNo(crnSlave.getId() == 4 ? wrkMast.getStaNo().shortValue() : crnOutSiteToRgvSite.get(wrkMast.getSourceStaNo()));
                         staProtocol.setWorkNo(wrkMast.getWrkNo());
                         if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol))) {
                             continue;
                         }
-                        wrkMast.setWrkSts(14L);
-                        wrkMast.setCrnEndTime(new Date());
-                        if (wrkMastMapper.updateById(wrkMast) != 0) {
-                            // 绌烘《鍑哄簱瀹屾垚搴撲綅缁勪换鍔�
-                            if (wrkMast.getSourceStaNo() == 1056) {
-                                WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_sta_no", 1056).eq("wrk_sts", 12));
-                                if (wrkMast1 != null) {
-                                    StaProtocol staProtocol1 = devpThread.getStation().get(1057);
-                                    if (staProtocol1 != null) {
-                                        staProtocol1 = staProtocol1.clone();
-                                        staProtocol1.setStaNo(wrkMast1.getStaNo().shortValue());
-                                        staProtocol1.setWorkNo(wrkMast1.getWrkNo());
-                                        if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol1))) {
-                                            log.error("绌烘《鍑哄簱瀹屾垚搴撲綅缁勪换鍔℃帹閫佽緭閫佺嚎鍛戒护闃熷垪澶辫触");
-                                        }
-                                        wrkMast1.setWrkSts(14L);
-                                        wrkMast1.setCrnEndTime(new Date());
-                                        if (wrkMastMapper.updateById(wrkMast1) != 0) {
-                                        }
+                        // 绌烘《鍑哄簱瀹屾垚搴撲綅缁勪换鍔�
+                        if (wrkMast.getWorkNoOther() != 0) {
+                            WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", wrkMast.getWorkNoOther()));
+                            if (wrkMast1 != null) {
+                                StaProtocol staProtocol1 = devpThread.getStation().get(1057);
+                                if (staProtocol1 != null) {
+                                    staProtocol1 = staProtocol1.clone();
+                                    staProtocol1.setWorkNo(wrkMast1.getWrkNo());
+                                    staProtocol1.setStaNo(wrkMast1.getStaNo().shortValue());
+                                    if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol1))) {
+                                        log.error("绌烘《鍑哄簱瀹屾垚搴撲綅缁勪换鍔℃帹閫佽緭閫佺嚎鍛戒护闃熷垪澶辫触");
                                     }
+                                    wrkMast1.setWrkSts(14L);
+                                    wrkMast1.setCrnEndTime(new Date());
+                                    wrkMast1.setWorkNoOther(0);
+                                    wrkMastMapper.updateById(wrkMast1);
                                 }
                             }
+                        }
+                        wrkMast.setWrkSts(14L);
+                        wrkMast.setCrnEndTime(new Date());
+                        wrkMast.setWorkNoOther(0); // 娓呴櫎鍙︿竴涓换鍔″彿
+                        if (wrkMastMapper.updateById(wrkMast) != 0) {
                             // 澶嶄綅鍫嗗灈鏈�
                             log.info("鍑哄簱浠诲姟瀹屾垚涓嬪彂鍫嗗灈鏈哄浣�,浠诲姟鍙凤細{}",wrkMast.getWrkNo());
                             crnThread.setResetFlag(true);
@@ -591,142 +524,6 @@
             }
         }
 //        News.infoNoLog(""+mark+" - 0"+" - 鍫嗗灈鏈虹珯鍑哄簱鍒板嚭搴撶珯  ===銆嬫墽琛屽畬鎴�");
-    }
-
-    /**
-     * 绌哄瓙鎵樼洏鍏ュ簱
-     */
-    public synchronized void storeEmptyPlt() {
-        // 鏍规嵁杈撻�佺嚎plc閬嶅巻
-        for (DevpSlave devp : slaveProperties.getDevp()) {
-            // 閬嶅巻鍏ュ簱鍙�
-            for (DevpSlave.Sta inSta : devp.getEmptyInSta()) {
-                // 鑾峰彇鏉$爜鎵弿浠俊鎭�
-                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode());
-                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
-                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
-                StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
-                if (staProtocol == null) {
-                    continue;
-                } else {
-                    staProtocol = staProtocol.clone();
-                }
-
-                if (barcodeThread == null) {
-                    continue;
-                }
-                String barcode = barcodeThread.getBarcode();
-                // 灏哄妫�娴嬪紓甯�
-                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) {
-                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
-                    if (!staProtocol.isLoading()) {
-                        continue;
-                    }
-                    if (!staProtocol.isPakMk()) {
-                        continue;
-                    }
-                    staProtocol.setWorkNo(wrkNo);
-                    News.info("{}绌烘墭鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", inSta.getStaNo(), errMsg, 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());
-                    return;
-                }
-
-                // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
-                if (staProtocol.isAutoing()
-                        && staProtocol.isLoading()
-                        && staProtocol.isInEnable()
-                        && staProtocol.isEmptyMk()
-                        && staProtocol.isPakMk()) {
-                    if (Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) {
-                        News.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
-                        continue;
-                    }
-                    // 鍒ゆ柇閲嶅宸ヤ綔妗�
-                    WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
-                    if (wrkMast != null) {
-                        continue;
-                    }
-                    try {
-                        LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
-
-                        SearchLocParam param = new SearchLocParam();
-                        param.setBarcode(barcode);
-                        param.setIoType(10);
-                        param.setSourceStaNo(inSta.getStaNo());
-                        param.setLocType1(locTypeDto.getLocType1());
-                        String response = new HttpHandler.Builder()
-                                .setUri(wmsUrl)
-                                .setPath("/rpc/pakin/loc/v1")
-                                .setJson(JSON.toJSONString(param))
-                                .build()
-                                .doPost();
-                        log.info("绌哄瓙鎵樼洏鍏ュ簱璇锋眰wms鍘熷杩斿洖锛�" + response);
-                        JSONObject jsonObject = JSON.parseObject(response);
-                        if (jsonObject.getInteger("code").equals(200)) {
-                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
-                            barcodeThread.setBarcode("");
-                            staProtocol.setWorkNo(dto.getWorkNo());
-                            staProtocol.setStaNo(RouteUtils.SouStaEnd(dto.getStaNo(), dto.getSourceStaNo()));
-                            devpThread.setPakMk(staProtocol.getSiteId(), false);
-                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                            log.error("杈撻�佺嚎涓嬪彂2锛�" + dto.getWorkNo() + "," + dto.getStaNo());
-                            if (!result) {
-                                News.error(":鏇存柊plc绔欑偣淇℃伅澶辫触");
-                                throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
-                            } else {
-                                ledThread.errorReset();
-                            }
-                        } else {
-                            staProtocol.setWorkNo(wrkNo);
-                            staProtocol.setStaNo(inSta.getBackSta().shortValue());
-                            devpThread.setPakMk(staProtocol.getSiteId(), false);
-                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                            String errorMsg = jsonObject.getString("msg");
-                            if (!Cools.isEmpty(errorMsg)) {
-                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
-                            }
-                        }
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                    }
-                }
-            }
-        }
     }
 
     /**
@@ -801,7 +598,7 @@
                 News.error(""+mark+" - 1"+" - 2"+" - 鍏ュ簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
                 continue;
             }
-            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable()
+            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 // && staProtocol.isInEnable()
                     && staDetl.getCanining() != null && staDetl.getCanining().equals("Y")) {
                 flag = true;
             }
@@ -813,11 +610,30 @@
                 continue;
             }
             // 鑾峰彇宸ヤ綔鐘舵�佷负2锛堣澶囦笂璧帮級鐨勫叆搴撳伐浣滄。
-            WrkMast wrkMast = wrkMastMapper.selectPakInStep2(slave.getId(), staProtocol.getWorkNo(), crnStn.getStaNo());
+            WrkMast wrkMast = wrkMastMapper.selectPakInStep2(slave.getId(), staProtocol.getWorkNo());
+
             if (null == wrkMast) {
                 News.infoNoLog(""+mark+" - 1"+" - 4"+" - 鏌ヨ鏃犲緟鍏ュ簱鏁版嵁--wrk_sts=2, 宸ヤ綔鍙�={}", staProtocol.getWorkNo());
-//                log.error("鏌ヨ鏃犲緟鍏ュ簱鏁版嵁--wrk_sts=2, 宸ヤ綔鍙�={}", staProtocol.getWorkNo());
+                log.error("鏌ヨ鏃犲緟鍏ュ簱鏁版嵁--wrk_sts=2, 宸ヤ綔鍙�={}", staProtocol.getWorkNo());
                 continue;
+            }
+            if (crnStn.getStaNo() == 1050 && wrkMast.getCtnType() != 1) {
+                continue;
+            } else if(crnStn.getStaNo() == 1049) {
+                // 鍒ゆ柇1050鏄惁鏈夎揣
+                StaProtocol staProtocol1 = devpThread.getStation().get(1050);
+                if(staProtocol1.isAutoing() && staProtocol1.isLoading() && staProtocol1.isInEnable() && staProtocol1.getWorkNo() != 0) {
+
+                } else {
+                    continue;
+                }
+            }
+            if (crnStn.getStaNo() == 1096) { // 鍒ゆ柇鍏ュ簱鍒�1096锛屽垽鏂�1093鏄惁鏈夌墿
+                StaProtocol staProtocol2 = devpThread.getStation().get(1093);
+                if(!staProtocol2.isAutoing() || staProtocol2.isLoading() || staProtocol2.getWorkNo() != 0) {
+                    log.warn("1鍙峰爢鍨涙満鍏ュ簱鍙栬揣鍓嶏紝鍒ゆ柇1096绔欑偣淇℃伅鑷姩锛歿}锛屾湁鐗╋細{}锛屽伐浣滃彿锛歿}锛屼笉鍙叆",staProtocol2.isAutoing(),staProtocol2.isLoading(),staProtocol2.getWorkNo());
+                    continue;
+                }
             }
             // 鑾峰彇搴撲綅淇℃伅
             LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
@@ -897,22 +713,22 @@
             crnCommand.setSourcePosY(crnStn.getBay().shortValue());     // 婧愬簱浣嶅垪
             crnCommand.setSourcePosZ(crnStn.getLev().shortValue());     // 婧愬簱浣嶅眰
             crnCommand.setDestinationPosX(locMast.getRow1().shortValue());     // 鐩爣搴撲綅鎺�
+            if(crnStn.getStaNo() == 1050 && locMast.getRow1() == 10) {
+                crnCommand.setDestinationPosX((short) 9);
+            }
+            if(crnStn.getStaNo() == 1049 && locMast.getRow1() == 11) {
+                crnCommand.setDestinationPosX((short) 12);
+            }
             crnCommand.setDestinationPosY(locMast.getBay1().shortValue());     // 鐩爣搴撲綅鍒�
             crnCommand.setDestinationPosZ(locMast.getLev1().shortValue());     // 鐩爣搴撲綅灞�
             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));
             } else {
-
-                // 淇敼宸ヤ綔妗g姸鎬� 2.璁惧涓婅蛋 => 3.鍚婅溅鍏ュ簱涓�
                 Date now = new Date();
-                wrkMast.setWrkSts(3L);
-                wrkMast.setCrnStrTime(now);
-                wrkMast.setModiTime(now);
-                if (wrkMastMapper.updateById(wrkMast) == 0) {
-                    News.error(""+mark+" - 1"+" - 17"+" - 淇敼宸ヤ綔妗g姸鎬� 2.璁惧涓婅蛋 => 3.鍚婅溅鍏ュ簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
-                }
+                // 淇敼宸ヤ綔妗g姸鎬� 2.璁惧涓婅蛋 => 3.鍚婅溅鍏ュ簱涓�
                 // 濡傛灉鏄�1049鍒欐湁涓や釜浠诲姟锛岄渶瑕佹妸1050鏀规垚鍚婅溅鍏ュ簱涓�
+                int workNoOther = 0;
                 if (crnStn.getStaNo() == 1049) {
                     BasDevp basDevp = basDevpService.selectById(1050);
                     if (basDevp.getWrkNo() == 0) {
@@ -922,11 +738,22 @@
                         wrkMast1.setWrkSts(3L);
                         wrkMast1.setCrnStrTime(now);
                         wrkMast1.setModiTime(now);
+                        wrkMast1.setWorkNoOther(0);
+                        workNoOther = wrkMast1.getWrkNo();
                         if (wrkMastMapper.updateById(wrkMast1) == 0) {
                             News.error(""+mark+" - 1"+" - 17"+" - 淇敼宸ヤ綔妗g姸鎬� 2.璁惧涓婅蛋 => 3.鍚婅溅鍏ュ簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
                         }
                     }
                 }
+
+                wrkMast.setWrkSts(3L);
+                wrkMast.setCrnStrTime(now);
+                wrkMast.setModiTime(now);
+                wrkMast.setWorkNoOther(workNoOther);
+                if (wrkMastMapper.updateById(wrkMast) == 0) {
+                    News.error(""+mark+" - 1"+" - 17"+" - 淇敼宸ヤ綔妗g姸鎬� 2.璁惧涓婅蛋 => 3.鍚婅溅鍏ュ簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+                }
+
             }
         }
         News.infoNoLog(""+mark+" - 1"+" - 0"+" - 鍫嗗灈鏈哄叆鍑哄簱浣滀笟涓嬪彂 锛� 鍏ュ簱鎵ц瀹屾瘯");
@@ -974,7 +801,7 @@
                 }
 
                 // 鍒ゆ柇鍫嗗灈鏈哄嚭搴撶珯鐘舵��
-                if (staProtocol.isAutoing() && staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y")
+                if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y")
                         && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) {
                     // 鍫嗗灈鏈烘帶鍒惰繃婊�
                     if (!crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() != 0) {
@@ -1035,35 +862,47 @@
                         break;
                     }
 
-                    WrkMast wrkMast1 = null; // 搴撲綅浠诲姟瀵瑰簲鍙︿竴涓簱浣嶄换鍔�
-                    LocMast locMast = null; // 搴撲綅瀵瑰簲鍙︿竴涓簱浣�
-                    // 绌烘《搴撳嚭搴撻渶瑕佷袱涓簱浣嶄竴璧峰嚭
-                    if(slave.getId() == 4) {
-                        Integer row = sourceSta.getRow1();
-                        // 鑾峰彇瀵瑰簲搴撲綅
-                        String  newLocNo = (row == 9 || row == 11 ? String.valueOf(row + 1) : row == 10 ? "09" : "11") + sourceSta.getLocNo().substring(2);
-                        locMast = locMastService.selectById(newLocNo);
-                        if (locMast == null) {
-                            log.error("绌烘《鍑哄簱瀵绘壘{}瀵瑰簲搴撲綅缁勫簱浣嶅彿{}閿欒",sourceSta.getLocNo(),newLocNo);
-                            break;
+                    if(slave.getId() == 4 && crnStn.getStaNo() == 1057) {
+                        String locNo = wrkMast.getSourceLocNo();
+                        // 鍙栧搴斿彟涓�涓簱浣�
+                        String newLocNo="";
+                        switch (locNo.substring(0,2)){
+                            case "09":newLocNo="10";break;
+                            case "10":newLocNo="09";break;
+                            case "11":newLocNo="12";break;
+                            case "12":newLocNo="11";break;
                         }
-                        if (locMast.getLocSts().equals("R")) {
-                            wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_loc_no", newLocNo));
-                        } else if(locMast.getLocSts().equals("F")) {
-                            log.error("绌烘《鍑哄簱瀵绘壘{}瀵瑰簲搴撲綅缁勫簱浣嶅彿{}搴撲綅鐘舵�侀敊璇疐",sourceSta.getLocNo(),newLocNo);
+                        newLocNo = newLocNo + locNo.substring(2);
+                        // 瀵瑰簲搴撲綅鏈夋棤浠诲姟
+                        WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_loc_no", newLocNo));
+                        if(wrkMast1 == null) {
+                             if(locNo.startsWith("10") || locNo.startsWith("11")){ // 娴呭簱浣�
+
+                             } else  { // 娣卞簱浣嶅垽鏂祬搴撲綅鐘舵��
+                                LocMast locMast = locMastService.selectById(newLocNo);
+                                if(!locMast.getLocSts().equals("O")) {
+                                     log.info("{}绌烘《鍗曞嚭搴擄紝娴呭簱浣峽}琚牭濉�",locNo,newLocNo);
+                                     break;
+                                }
+                            }
+                            // 鍑轰竴涓椂锛屽彇璐ф帓11锛�12锛岀洰鏍囦綅缃�1057锛屾斁璐т几鍙変細浼稿埌1056涓婏紝鎵�浠ュ緱鍒ゆ柇1056娌′笢瑗挎墠鑳芥斁
+                            if(sourceSta.getRow1() == 11 || sourceSta.getRow1() == 12) {
+                                StaProtocol staProtocol2 = devpThread.getStation().get(1056);
+                                if(!staProtocol2.isAutoing() || staProtocol2.isLoading() || staProtocol2.getWorkNo() != 0) {
+                                    log.warn("1057绌烘《鍑轰竴涓揣鏃讹紝1056涓嶆弧瓒虫斁璐ф潯浠讹紝鑷姩锛歿}锛屾湁鐗╋細{}锛屼换鍔″彿锛歿}",staProtocol2.isAutoing(),staProtocol2.isLoading(),staProtocol2.getWorkNo());
+                                    continue;
+                                }
+                            }
+                        } else { // 鏈変换鍔�
+                            // 姣忎釜搴撲綅榛樿鍑哄簱绔欑偣鏄�1057锛屽鏋滄繁娴呭簱浣嶄竴璧峰嚭锛屽垯淇敼婧愮珯鐐逛负1056锛屽爢鍨涙満鍑哄簱绔欑偣涓�1056鏃舵洿鏂板搴斿簱浣嶅嚭鍒�1057
+                            if(locNo.startsWith("09") || locNo.startsWith("11")) { //
+                                wrkMast.setSourceStaNo(1056);
+                                wrkMastService.updateById(wrkMast);
+                            } else  {
+                                wrkMast1.setSourceStaNo(1056);
+                                wrkMastService.updateById(wrkMast1);
+                            }
                             break;
-                        }
-                    }
-                    if (wrkMast1 != null) {
-                        // 鍒ゆ柇缁欏爢鍨涙満鍙戠敓鍛戒护鐨勬簮搴撲綅
-                        if (sourceSta.getRow1() == 10 || sourceSta.getRow1() == 11) {
-                            // 浜ゆ崲搴撲綅鍜屼换鍔�
-                            LocMast t1 = sourceSta;
-                            sourceSta = locMast;
-                            locMast = t1;
-                            WrkMast t2 = wrkMast1;
-                            wrkMast1 = wrkMast;
-                            wrkMast = t2;
                         }
                     }
 
@@ -1078,31 +917,51 @@
 //                    crnCommand.setAckFinish((short) 0);  // 浠诲姟瀹屾垚纭浣�
                     crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 浠诲姟妯″紡:  搴撲綅绉昏浆
                     crnCommand.setSourcePosX(sourceSta.getRow1().shortValue());     // 婧愬簱浣嶆帓
+                    if(slave.getId() == 4 && crnStn.getStaNo() == 1056 && sourceSta.getRow1() == 11) { // 11鎺掑嚭鍒�1056涓�娆″嚭涓や釜鏃讹紝鍙栬揣浣嶇疆鍋忕Щ鍒�12鎺�
+                        crnCommand.setSourcePosX((short) 12);
+                        crnCommand.setTaskCount((short) 2);  // 鍑轰袱涓《鏃跺憡璇夊爢鍨涙満杩欐槸涓や釜
+                    } else {
+                        crnCommand.setTaskCount((short) 1); // 鍏朵粬榛樿鍑虹殑鏄竴涓�
+                    }
                     crnCommand.setSourcePosY(sourceSta.getBay1().shortValue());     // 婧愬簱浣嶅垪
                     crnCommand.setSourcePosZ(sourceSta.getLev1().shortValue());     // 婧愬簱浣嶅眰
                     crnCommand.setDestinationPosX(crnStn.getRow().shortValue());     // 鐩爣搴撲綅鎺�
+
+                    // 婧愮珯1057
+                    if(slave.getId() == 4 && crnStn.getStaNo() == 1057 && sourceSta.getRow1() == 12) {
+                        crnCommand.setDestinationPosX((short) 9);
+                    }
                     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));
                     } else {
-                        // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓�
+
                         Date now = new Date();
+                        int workNoOther = 0;
+                        // 淇敼绌烘《搴撳搴斿簱浣嶄换鍔$姸鎬�
+                        if(slave.getId() == 4 && crnStn.getStaNo() == 1056) {
+                            String locNo2 = (wrkMast.getSourceLocNo().startsWith("09") ? "10" : "12") + wrkMast.getSourceLocNo().substring(2);
+                            WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_loc_no", locNo2));
+                            if (wrkMast1 != null) {
+                                wrkMast1.setWrkSts(12L);
+                                wrkMast1.setCrnStrTime(now);
+                                wrkMast1.setModiTime(now);
+                                if (wrkMastMapper.updateById(wrkMast1) == 0) {
+                                    News.error(""+mark+" - 2"+" - 14"+" - 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast1.getWrkNo());
+                                }
+                                workNoOther = wrkMast1.getWrkNo(); // 璁板綍浠诲姟鍙凤紝鍑哄簱瀹屾垚鐨勬椂鍊欎竴璧峰畬鎴�
+                            }
+                        }
+
+                        // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓�
                         wrkMast.setWrkSts(12L);
                         wrkMast.setCrnStrTime(now);
                         wrkMast.setModiTime(now);
+                        wrkMast.setWorkNoOther(workNoOther);
                         if (wrkMastMapper.updateById(wrkMast) == 0) {
                             News.error(""+mark+" - 2"+" - 14"+" - 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
-                        }
-                        // 淇敼绌烘《搴撳搴斿簱浣嶄换鍔$姸鎬�
-                        if (wrkMast1 != null) {
-                            wrkMast1.setWrkSts(12L);
-                            wrkMast1.setCrnStrTime(now);
-                            wrkMast1.setModiTime(now);
-                            if (wrkMastMapper.updateById(wrkMast1) == 0) {
-                                News.error(""+mark+" - 2"+" - 14"+" - 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
-                            }
                         }
                         break;
                     }
@@ -1223,8 +1082,22 @@
                         continue;
                     }
                     Date now = new Date();
+                    // 绌烘《鍏ュ簱瀹屾垚锛屽厛瀹屾垚瀵瑰簲搴撲綅缁勪换鍔�
+                    if(wrkMast.getWorkNoOther() != 0 ){
+                        WrkMast wrkMast1 = wrkMastService.selectByWrkNo(wrkMast.getWorkNoOther());
+                        // 浜ゆ崲搴撲綅鍙�
+                        String locNo = wrkMast.getLocNo();
+                        wrkMast.setLocNo(wrkMast1.getLocNo());
+                        wrkMast1.setLocNo(locNo);
+                        wrkMast1.setCrnEndTime(now);
+                        wrkMast1.setModiTime(now);
+                        wrkMast1.setWrkSts(4L);
+                        wrkMast1.setWorkNoOther(0);
+                        wrkMastMapper.updateById(wrkMast1);
+                    }
                     wrkMast.setCrnEndTime(now);
                     wrkMast.setModiTime(now);
+                    wrkMast.setWorkNoOther(0); // 娓呯┖鍙︿竴涓换鍔″彿
                     // 淇敼鎴愬姛鍚庡浣嶅爢鍨涙満
                     if (wrkMastMapper.updateById(wrkMast) > 0) {
                         // 鍫嗗灈鏈哄浣�
@@ -1392,6 +1265,9 @@
                     case 1:
                         ledCommand.setTitle("鍏ㄦ澘鍏ュ簱");
                         break;
+                    case 3:
+                        ledCommand.setTitle("绔欏埌绔�");
+                        break;
                     case 10:
                         ledCommand.setTitle("绌烘澘鍏ュ簱");
                         break;
@@ -1421,7 +1297,7 @@
                 if (wrkMast.getIoType() != 110 && wrkMast.getIoType() != 10) {
                     List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
 //                    List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
-                    wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getSpecs(),wrkDetl.getManuDate(),wrkDetl.getModel(),wrkDetl.getWeight(),wrkDetl.getLength(),wrkDetl.getVolume())));
+                    wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getSpecs(),wrkDetl.getManuDate(),wrkDetl.getModel(),wrkDetl.getWeight(),wrkDetl.getManLength(),wrkDetl.getVolume())));
 //                    wrkDetls.forEach(wrkDetl -> {
 //                        Double total = 0.0;
 //                        EntityWrapper<LocDetl> wrapper = new EntityWrapper<>();
@@ -1665,9 +1541,8 @@
      * 鐢熸垚 绌哄瓙/姣嶆墭鐩樺嚭搴撲换鍔�
      */
     public synchronized void generateEmptyPalletStoreWrk() {
-        Integer devpId = 1;
+        SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
         for (Map.Entry<Integer, String> entry : emptyPalletSiteMap.entrySet()) {
-            SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devpId);
             StaProtocol staProtocol = devpThread.getStation().get(entry.getKey());
             if (staProtocol == null) {
                 continue;
@@ -1676,14 +1551,20 @@
             }
 
             // 鑷姩&鏃犵墿&鍙嚭
-            if (staProtocol.isAutoing() && !staProtocol.isLoading() && staProtocol.isOutEnable()) {
+            if (staProtocol.isAutoing() && !staProtocol.isLoading() && staProtocol.isOutEnable() && staProtocol.getWrkNo() == 0) {
                 // 鍒ゆ柇鏄惁宸茬粡鐢熸垚浠诲姟
-                if (wrkMastService.selectList(new EntityWrapper<WrkMast>().in("io_type", 111,112).eq("sta_no", entry.getKey())).size() > 0) {
-                    log.warn("{}绔欑偣宸茬粡瀛樺湪绌烘澘鍑哄簱浠诲姟", entry.getKey());
+                int dismantlingMachine = entry.getKey();
+                switch (entry.getKey()) {
+                    case 1001:dismantlingMachine = 1002;break;
+                    case 1019:dismantlingMachine = 1020;break;
+                    case 1034:dismantlingMachine = 1035;break;
+                }
+                if (wrkMastService.selectList(new EntityWrapper<WrkMast>().in("io_type", 110).eq("sta_no", dismantlingMachine)).size() > 0) {
+//                    log.warn("{}绔欑偣宸茬粡瀛樺湪涓や釜绌烘澘鍑哄簱浠诲姟", entry.getKey());
                     continue;
                 }
                 Map<String, String> map = new HashMap<>();
-                map.put("site", String.valueOf(entry.getKey()));
+                map.put("site", String.valueOf(dismantlingMachine));
                 map.put("flag", entry.getValue());
                 String response = "";
                 try {
@@ -1711,23 +1592,31 @@
      * 鎵樼洏鍒拌揪rgv鎺ラ┏绔欑偣锛屾洿鏀瑰伐浣滄。鐘舵�佷负9.鍛煎彨RGV锛岀幆绌跨▼搴忚皟搴gv
      */
     public synchronized void callRgv() {
-        // 杈撻�佺嚎plc缂栧彿
-        Integer devpPlcId = 1;
-        DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devpPlcId);
         for (Integer site : rgvConnectionSiteList) {
+            // 杈撻�佺嚎plc缂栧彿
+            Integer devpPlcId = site < 1044 ? 1 : site <= 1090 ? 2 : 3;
+            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devpPlcId);
             StaProtocol staProtocol = devpThread.getStation().get(site);
             if (staProtocol == null) {
                 continue;
             } else {
                 staProtocol = staProtocol.clone();
             }
-            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() != 0) {
+            if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.isInEnable() || staProtocol.isOutEnable() && site == 1090) && staProtocol.getWorkNo() != 0 && staProtocol.getWorkNo() < 9000) {
                 // 鏌ヨ宸ヤ綔妗�
                 WrkMast wrkMast = wrkMastMapper.selectByWrkNo(staProtocol.getWorkNo());
+                if (wrkMast == null) {
+                    log.error("鍛煎彨rgv,浠诲姟鍙蜂笉瀛樺湪:{}",staProtocol.getWorkNo());
+                    continue;
+                }
+                if (staProtocol.getSiteId() == 1090 && wrkMast.getLocNo() == null) {
+                    continue;
+                }
                 if ((wrkMast.getWrkSts() == 2 || wrkMast.getWrkSts() == 15) && wrkMast.getRgvNo() == null) {
                     wrkMast.setRgvNo(0);
                     wrkMast.setRgvSstaNo(site);
                     wrkMast.setRgvDstaNo(taskStaNoToRgvStaNoMap.get(wrkMast.getStaNo()));
+                    wrkMast.setWrkSts(9L);
                     wrkMast.setModiTime(new Date());
                     wrkMastMapper.updateById(wrkMast);
                     log.info("浠诲姟鍙凤細{}宸插埌杈緍gv鎺ラ┏浣嶏紝鍑嗗鍛煎彨rgv...", wrkMast.getWrkNo());
@@ -1737,15 +1626,124 @@
     }
 
     /**
+     * rgv鏀捐揣瀹屾垚锛岀粰杈撻�佺嚎涓嬪彂浠诲姟
+     */
+    public synchronized void rgvToDev() {
+        for (Integer site : rgvConnectionSiteList) {
+            // 杈撻�佺嚎plc缂栧彿
+            Integer devpPlcId = site < 1044 ? 1 : site <= 1090 ? 2 : 3;
+            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devpPlcId);
+            StaProtocol staProtocol = devpThread.getStation().get(site);
+            if (staProtocol == null) {
+                continue;
+            } else {
+                staProtocol = staProtocol.clone();
+            }
+            if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.isOutEnable() ||  (staProtocol.getSiteId() == 1001 || staProtocol.getSiteId() == 1019 || staProtocol.getSiteId() == 1034))&& staProtocol.getWorkNo() == 0 && staProtocol.getHideWorkNo() != 0) {
+                // 鏌ヨ宸ヤ綔妗�
+                WrkMast wrkMast = wrkMastMapper.selectByWrkNo(staProtocol.getHideWorkNo());
+                if (wrkMast == null) {
+                    log.error("rgv鏀捐揣瀹屾垚锛寋}绔欑偣,闅愯棌浠诲姟鍙锋壘涓嶅埌宸ヤ綔妗�:{}", site, staProtocol.getHideWorkNo());
+                    continue;
+                }
+
+                if(wrkMast.getIoType() == 3 && (wrkMast.getStaNo() == 1024 || wrkMast.getStaNo() == 1016 || wrkMast.getStaNo() == 1043)) { // 鍒�1024鍑哄簱鍙o紝鏀惧埌杈撻�佺嚎鍚庝换鍔″畬鎴�
+                    wrkMast.setWrkSts(2L);
+                    wrkMast.setModiTime(new Date());
+                    wrkMastService.updateById(wrkMast);
+                } else if(wrkMast.getIoType() == 101 && (wrkMast.getStaNo() == 1024 || wrkMast.getStaNo() == 1016 || wrkMast.getStaNo() == 1043)) {
+                    wrkMast.setWrkSts(15L);
+                    wrkMast.setModiTime(new Date());
+                    wrkMastService.updateById(wrkMast);
+                } else if(wrkMast.getIoType() == 110 && (wrkMast.getStaNo() == 1002 || wrkMast.getStaNo() == 1020 ||wrkMast.getStaNo() == 1035)) {
+                    wrkMast.setWrkSts(15L);
+                    wrkMast.setModiTime(new Date());
+                    wrkMastService.updateById(wrkMast);
+                }
+
+                // 缁欒緭閫佺嚎涓嬪彂鍛戒护
+                staProtocol.setWorkNo(staProtocol.getHideWorkNo());
+                staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
+                if (!MessageQueue.offer(SlaveType.Devp, devpPlcId, new Task(2, staProtocol))) {
+                    log.info("rgv鎼繍瀹屾垚缁欒緭閫佺嚎涓嬪彂鍛戒护澶辫触!,plc id:{},绔欑偣{}锛屼换鍔″彿锛歿}锛岀洰鏍囩珯锛歿}", devpPlcId,staProtocol.getStaNo(), staProtocol.getWorkNo(), staProtocol.getStaNo());
+                } else {
+                    log.info("rgv鎼繍瀹屾垚缁欒緭閫佺嚎涓嬪彂鍛戒护鎴愬姛plc id:{}!,绔欑偣{}锛屼换鍔″彿锛歿}锛岀洰鏍囩珯锛歿}", devpPlcId,staProtocol.getStaNo(), staProtocol.getWorkNo(), staProtocol.getStaNo());
+                }
+            }
+        }
+    }
+
+    /**
+     * 璇诲紓甯稿彛鍙叆淇″彿锛屽垎閰嶅簱浣�
+     */
+    public synchronized void abnormalMouthWarehousing() {
+        DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2);
+        StaProtocol staProtocol = devpThread.getStation().get(1090);
+        if (staProtocol == null) {
+            return;
+        } else {
+            staProtocol = staProtocol.clone();
+        }
+        if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.isInEnable() || staProtocol.isOutEnable()) && staProtocol.getWorkNo() != 0 && staProtocol.getWorkNo() < 9000) {
+            // 鏌ヨ宸ヤ綔妗�
+            WrkMast wrkMast = wrkMastService.selectById(staProtocol.getWorkNo());
+            if (wrkMast == null) {
+                log.error("寮傚父鍙e叆搴撲换鍔″彿鏃犱换鍔�:{}", staProtocol.getWorkNo());
+                return;
+            } else if (wrkMast.getLocNo() != null) {
+                log.info("寮傚父鍙e叆搴撳簱浣嶅凡鍒嗛厤:{}", wrkMast.getLocNo());
+                return;
+            } else if(wrkMast.getStaNo() != 1090) {
+                log.info("寮傚父鍙e叆搴撳叆搴撶洰鏍囩珯鐐瑰凡鍒嗛厤:{}", wrkMast.getStaNo());
+                return;
+            }
+
+            try {
+                CanningLineInLocParam param = new CanningLineInLocParam();
+                param.setWrkNo(staProtocol.getWrkNo());
+                param.setSourceStaNo(1090);
+                param.setTbFlag(staProtocol.isInEnable()); // true鍏ユ垚鍝佸簱锛宖alse鍏ョ┖妗跺簱
+
+                String response = new HttpHandler.Builder()
+                        .setUri(wmsUrl)
+                        .setPath("/rpc/pakin/abnormalMouthWarehousing/loc/v1")
+                        .setJson(JSON.toJSONString(param))
+                        .build()
+                        .doPost();
+                log.info("寮傚父鍙e叆搴撹姹倃ms鍘熷杩斿洖锛�" + response);
+                JSONObject jsonObject = JSON.parseObject(response);
+                if (jsonObject.getInteger("code").equals(200)) {
+//                    StartupDto dto = jsonObject.getObject("data", StartupDto.class);
+//                    staProtocol.setWorkNo(dto.getWorkNo());
+//                    staProtocol.setStaNo(dto.getStaNo().shortValue());
+//                    devpThread.setPakMk(staProtocol.getSiteId(), false);
+//                    boolean result = MessageQueue.offer(SlaveType.Devp, 2, new Task(2, staProtocol));
+//                    if (result) {
+//                        log.info("寮傚父鍙e叆搴撴帹閫佽緭閫佺嚎鍛戒护鎴愬姛锛�" + dto.getWorkNo() + "," + 1090 + "," + dto.getStaNo());
+//                        News.info("寮傚父鍙e叆搴撴帹閫佽緭閫佺嚎鍛戒护鎴愬姛锛�" + dto.getWorkNo() + "," + 1090 + "," + dto.getStaNo());
+//                    } else {
+//                        log.error("寮傚父鍙e叆搴撴帹閫佽緭閫佺嚎鍛戒护澶辫触锛�" + dto.getWorkNo() + "," + 1090 + "," + dto.getStaNo());
+//                        News.error("寮傚父鍙e叆搴撴帹閫佽緭閫佺嚎鍛戒护澶辫触锛�" + dto.getWorkNo() + "," + 1090 + "," + dto.getStaNo());
+//                        throw new CoolException("寮傚父鍙e叆搴撴帹閫佽緭閫佺嚎鍛戒护澶辫触:" + 1090);
+//                    }
+                } else {
+                    log.error("寮傚父鍙e叆搴撹姹傛帴鍙e紓甯革紝url:{}锛宺equest:{},response:{}", wmsUrl + "/rpc/pakin/CanningLine/loc/v1", JSON.toJSONString(param), response);
+                    News.error("寮傚父鍙e叆搴撹姹傛帴鍙e紓甯革紒锛侊紒url锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/CanningLine/loc/v1", JSON.toJSONString(param), response);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            }
+        }
+    }
+
+    /**
      * 姣嶆墭鐩樺彔婊¤嚜鍔ㄥ叆搴�
      */
     public synchronized void autoEmptyIn() {
 
-        for (DevpSlave devp : slaveProperties.getDevp()) {
-            // 閬嶅巻绌烘澘鍏ュ簱鍙�
+        SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
             for (Integer site :  stackingSite) {
-                // 鑾峰彇绌烘澘鍏ュ簱绔欎俊鎭�
-                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                 StaProtocol staProtocol = devpThread.getStation().get(site);
                 if (staProtocol == null) {
                     continue;
@@ -1753,26 +1751,14 @@
                     staProtocol = staProtocol.clone();
                 }
 
-                if (!staProtocol.isLoading()){
-                    continue;
-                }
-
                 // 绔欑偣鏉′欢鍒ゆ柇
-                if (staProtocol.isAutoing()
-                        && staProtocol.isLoading()
-                        && staProtocol.isInEnable()
-                        && staProtocol.isEmptyMk()
-                        && staProtocol.isPakMk()
-                        && staProtocol.getWorkNo() == 0
-                ) {
-
+                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.getWorkNo() == 0) {
                     try {
-                        LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
-
                         SearchLocParam param = new SearchLocParam();
                         param.setIoType(10);
                         param.setSourceStaNo(site);
-                        param.setLocType1(locTypeDto.getLocType1());
+                        param.setLocType1((short) 1);
+
                         String response = new HttpHandler.Builder()
                                 .setUri(wmsUrl)
                                 .setPath("/rpc/pakin/loc/v1")
@@ -1784,10 +1770,9 @@
                             StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                             // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
                             staProtocol.setWorkNo(dto.getWorkNo());
-                            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());
+                            staProtocol.setStaNo(dto.getStaNo().shortValue());
+                            boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol));
+                            log.error("姣嶆墭鍙犵洏鍏ュ簱杈撻�佺嚎涓嬪彂锛�"+dto.getWorkNo()+","+staProtocol.getSiteId());
                             if (!result) {
                                 News.errorNoLog(""+" - 1"+" - 鏇存柊plc绔欑偣淇℃伅澶辫触");
                                 throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
@@ -1799,24 +1784,149 @@
                         e.printStackTrace();
                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                     }
-                } else {
-                    News.errorNoLog(" - 姣嶆墭鍙犵洏鍏ュ簱绔欑偣淇℃伅涓嶇鍚堝叆搴撴潯浠讹紒锛侊紒"+" 鑷姩淇″彿锛�"+staProtocol.isAutoing()+"銆佸彲鍏ヤ俊鍙凤細" + staProtocol.isInEnable()
-                            +"銆佺┖鏉夸俊鍙凤細"+ staProtocol.isEmptyMk()+"銆佸伐浣滃彿锛�" + staProtocol.getWorkNo()
-                            +"銆侀攣瀹氭爣璁�"+ staProtocol.isPakMk());
                 }
             }
-        }
-
     }
 
     /**
-     * 绌烘《缃愯瀹屾垚鍒拌揪缃愯绾縭gv鍙� 瀹屾垚鐩翠緵缃愯绾夸换鍔″拰绌烘《鍑哄簱浠诲姟锛屽垱寤烘垚鍝佹《鍏ュ簱浠诲姟
+     * 瀛愭墭鐩樺簳涓嬫瘝鎵樼洏鍥炴祦
+     */
+    public synchronized void motherTrayReflow() {
+
+        SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
+        StaProtocol staProtocol = devpThread.getStation().get(1034);
+        if (staProtocol == null) {
+            return;
+        } else {
+            staProtocol = staProtocol.clone();
+        }
+
+        // 绔欑偣鏉′欢鍒ゆ柇
+        if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.getWrkNo() == 0) {
+
+            Date now = new Date();
+            // 淇濆瓨宸ヤ綔妗�
+            WrkMast wrkMast = new WrkMast();
+            wrkMast.setWrkNo(commonService.getWorkNo(1));
+            wrkMast.setIoTime(now);
+            wrkMast.setWrkSts(2L);
+            wrkMast.setIoType(3);
+            wrkMast.setSourceStaNo(1034); // 婧愮珯
+            wrkMast.setStaNo(1024); // 鐩爣绔�
+            wrkMast.setAppeTime(now);
+            wrkMast.setMemo("瀛愭墭鐩樺簳搴ф瘝鎵樼洏鍥炴祦");
+            wrkMastService.insert(wrkMast);
+
+            staProtocol.setWorkNo(wrkMast.getWrkNo());
+            staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
+            boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol));
+            if (result) {
+                log.info("瀛愭墭鐩樺簳搴ф瘝鎵樼洏鍥炴祦鍛戒护鎺ㄩ�侀槦鍒楁垚鍔燂細" + wrkMast.getWrkNo() + "," + staProtocol.getSiteId());
+            } else {
+                log.error("瀛愭墭鐩樺簳搴ф瘝鎵樼洏鍥炴祦鍛戒护鎺ㄩ�侀槦鍒楀け璐ワ細" + wrkMast.getWrkNo() + "," + staProtocol.getSiteId());
+            }
+        }
+    }
+
+    /**
+     * 绌烘《缃愯瀹屾垚鍒拌揪缃愯绾垮嚭鍙� 瀹屾垚鐩翠緵缃愯绾夸换鍔″拰绌烘《鍑哄簱浠诲姟锛屽垱寤烘垚鍝佹《鍏ュ簱浠诲姟
      */
     public synchronized void canningLineTaskFinish() {
         // 杈撻�佺嚎plc缂栧彿
-        Integer devpPlcId = 1;
+        Integer devpPlcId = 2;
         DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devpPlcId);
-        for (Integer site : canningLineRgvConnectionSiteList) {
+        for (Integer site : outGzxSiteList) {
+            StaProtocol staProtocol = devpThread.getStation().get(site);
+            if (staProtocol == null) {
+                continue;
+            } else {
+                staProtocol = staProtocol.clone();
+            }
+            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.getWorkNo() == 0) {
+                if(staProtocol.getWrkNo() == 0) {
+                    log.error("{}鍑虹綈瑁呯嚎璐х墿鍒颁綅锛屾病鏈夎鍙栧埌浠诲姟鍙�:{}",staProtocol.getSiteId(),staProtocol.getWrkNo());
+                    continue;
+                }
+
+                // 璐存爣缁撴灉鍙嶉鍒板褰㈡娴嬬殑鎵弿鏉$爜澶辫触
+                StaProtocol staProtocol2 = devpThread.getStation().get(site + 2);
+                // 鏍规嵁缃愯绾垮弽棣堜换鍔″彿鏌ヨ宸ヤ綔妗�
+                WrkMast wrkMast = wrkMastService.selectById(staProtocol.getWrkNo());
+                if(wrkMast == null) {
+                    log.error("鍑虹綈瑁呯嚎璐х墿浠诲姟鍙峰伐浣滄。涓嶅瓨鍦�:{}",staProtocol.getWrkNo());
+                    continue;
+                } else if(wrkMast.getWrkSts() != 2) {
+                    log.error("鍑虹綈瑁呯嚎璐х墿浠诲姟鍙峰伐浣滄。鐘舵�佸紓甯革紝涓嶄负2:{}",staProtocol.getWrkNo());
+                    continue;
+                }
+
+                try {
+                    CanningLineInLocParam param = new CanningLineInLocParam();
+                    param.setWrkNo(staProtocol.getWrkNo());
+                    param.setMatnr(staProtocol.getMatnr().trim());
+                    param.setBatch(staProtocol.getBatch());
+                    param.setManuDate(staProtocol.getManuDate());
+                    param.setWeight(staProtocol.getWeight());
+                    param.setGrossWeight(staProtocol.getGrossWeight());
+                    param.setSourceStaNo(site + 2);
+                    param.setTbFlag(staProtocol2.isBarcodeErr());
+
+//                    param.setWrkNo(57);
+//                    param.setMatnr("101");
+//                    param.setBatch("tt1");
+//                    param.setManuDate("2025-06-05");
+//                    param.setWeight(100.0);
+//                    param.setGrossWeight(100.0);
+//                    param.setSourceStaNo(site);
+//                    param.setTbFlag(true);
+
+                    String response = new HttpHandler.Builder()
+                            .setUri(wmsUrl)
+                            .setPath("/rpc/pakin/CanningLine/loc/v1")
+                            .setJson(JSON.toJSONString(param))
+                            .build()
+                            .doPost();
+                    log.info("缃愯绾垮叆搴撹姹倃ms鍘熷杩斿洖锛�" + response);
+                    JSONObject jsonObject = JSON.parseObject(response);
+                    if (jsonObject.getInteger("code").equals(200)) {
+                        StartupDto dto = jsonObject.getObject("data", StartupDto.class);
+                        staProtocol.setWorkNo(dto.getWorkNo());
+                        staProtocol.setStaNo(dto.getSourceStaNo().shortValue());
+                        devpThread.setPakMk(staProtocol.getSiteId(), false);
+                        boolean result = MessageQueue.offer(SlaveType.Devp, devpPlcId, new Task(2, staProtocol));
+                        staProtocol.setPlaceableFlag(1);
+                        boolean offer = MessageQueue.offer(SlaveType.Devp, outGzxSiteList.indexOf(site) + 4, new Task(5, staProtocol));
+                        if (offer) {
+                            log.info("缁欑綈瑁呯嚎鍐欏叆鍙嚭淇″彿鎺ㄩ�亄}鍙疯緭閫佺嚎鍛戒护鎴愬姛锛歿}" ,site,1);
+                        }
+                        if (result) {
+                            log.info("缃愯绾垮叆搴撴帹閫佽緭閫佺嚎鍛戒护鎴愬姛锛�" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
+                            News.info("缃愯绾垮叆搴撴帹閫佽緭閫佺嚎鍛戒护鎴愬姛锛�" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
+                        } else {
+                            log.error("缃愯绾垮叆搴撴帹閫佽緭閫佺嚎鍛戒护澶辫触锛�" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
+                            News.error("缃愯绾垮叆搴撴帹閫佽緭閫佺嚎鍛戒护澶辫触锛�" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
+                            throw new CoolException("缃愯绾垮叆搴撴帹閫佽緭閫佺嚎鍛戒护澶辫触:" + site);
+                        }
+                    } else {
+                        log.error("缃愯绾垮叆搴撹姹傛帴鍙e紓甯革紝url:{}锛宺equest:{},response:{}", wmsUrl + "/rpc/pakin/CanningLine/loc/v1", JSON.toJSONString(param), response);
+                        News.error("缃愯绾垮叆搴撹姹傛帴鍙e紓甯革紒锛侊紒url锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/CanningLine/loc/v1", JSON.toJSONString(param), response);
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                }
+            }
+        }
+    }
+
+    /**
+     * 鍒拌揪缃愯绾垮叆搴撳彛锛屽憡璇夌綈瑁呯嚎瑕佸叆搴撴《淇℃伅
+     */
+    public synchronized void inGzxBefore() {
+        // 杈撻�佺嚎plc缂栧彿
+        Integer devpPlcId = 2;
+        DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devpPlcId);
+        for (Integer site : inGzxSiteList) {
             StaProtocol staProtocol = devpThread.getStation().get(site);
             if (staProtocol == null) {
                 continue;
@@ -1826,45 +1936,43 @@
             if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.getWorkNo() != 0) {
                 // 鏌ヨ宸ヤ綔妗�
                 WrkMast wrkMast = wrkMastMapper.selectByWrkNo(staProtocol.getWorkNo());
-                if (wrkMast.getIoType() != 1) {
-                    try {
-                        CanningLineInLocParam param = new CanningLineInLocParam();
-                        param.setWrkNo(wrkMast.getWrkNo());
-                        param.setSourceStaNo(site);
-
-                        String response = new HttpHandler.Builder()
-                                .setUri(wmsUrl)
-                                .setPath("/rpc/pakin/CanningLine/loc/v1")
-                                .setJson(JSON.toJSONString(param))
-                                .build()
-                                .doPost();
-                        log.info("缃愯绾垮叆搴撹姹倃ms鍘熷杩斿洖锛�" + response);
-                        JSONObject jsonObject = JSON.parseObject(response);
-                        if (jsonObject.getInteger("code").equals(200)) {
-                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
-                            staProtocol.setWorkNo(dto.getWorkNo());
-                            staProtocol.setStaNo(RouteUtils.SouStaEnd(dto.getStaNo(), dto.getSourceStaNo()));
-                            devpThread.setPakMk(staProtocol.getSiteId(), false);
-                            // 杩欓噷涓嬪彂鍛戒护鍚庯紝杈撻�佺嚎瑕佹妸璇ョ珯鐐瑰彲鍏ヤ俊鍙峰幓闄�
-                            boolean result = MessageQueue.offer(SlaveType.Devp, devpPlcId, new Task(2, staProtocol));
-                            if (result) {
-                                log.info("缃愯绾垮叆搴撴帹閫佽緭閫佺嚎鍛戒护鎴愬姛锛�" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
-                                News.info("缃愯绾垮叆搴撴帹閫佽緭閫佺嚎鍛戒护鎴愬姛锛�" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
-                            } else {
-                                log.error("缃愯绾垮叆搴撴帹閫佽緭閫佺嚎鍛戒护澶辫触锛�" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
-                                News.error("缃愯绾垮叆搴撴帹閫佽緭閫佺嚎鍛戒护澶辫触锛�" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
-                                throw new CoolException("缃愯绾垮叆搴撴帹閫佽緭閫佺嚎鍛戒护澶辫触:" + site);
-                            }
-                        } else {
-                            log.error("缃愯绾垮叆搴撹姹傛帴鍙e紓甯革紝url:{}锛宺equest:{},response:{}", wmsUrl + "/rpc/pakin/CanningLine/loc/v1", JSON.toJSONString(param), response);
-                            News.error("缃愯绾垮叆搴撹姹傛帴鍙e紓甯革紒锛侊紒url锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/CanningLine/loc/v1", JSON.toJSONString(param), response);
-                        }
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                if (wrkMast != null && wrkMast.getWhsType() == null) {
+                    WrkDetl wrkDetl = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
+                    staProtocol.setBucketType(wrkDetl.getMatnr());
+                    staProtocol.setBucketCount(wrkDetl.getAnfme().intValue());
+                    boolean result = MessageQueue.offer(SlaveType.Devp, inGzxSiteList.indexOf(site) + 4, new Task(4, staProtocol));
+                    if (result) {
+                        log.info("鍛婅瘔缃愯绾垮叆搴撴《淇℃伅鍛戒护闃熷垪鎺ㄩ�佹垚鍔燂細" + staProtocol.getWorkNo() + "," + site + "," + staProtocol.getBucketType() +"," + staProtocol.getBucketCount());
+                        News.info("鍛婅瘔缃愯绾垮叆搴撴《淇℃伅鍛戒护闃熷垪鎺ㄩ�佹垚鍔燂細" + staProtocol.getWorkNo() + "," + site + "," + staProtocol.getBucketType() +"," + staProtocol.getBucketCount());
+                        wrkMast.setWhsType(1); // 鏇存柊鎺ㄩ�佹爣璇嗭紝閬垮厤閲嶅鎺ㄩ��
+                        wrkMastService.updateById(wrkMast);
+                    } else {
+                        log.error("鍛婅瘔缃愯绾垮叆搴撴《淇℃伅鍛戒护闃熷垪鎺ㄩ�佸け璐ワ細" + staProtocol.getWorkNo() + "," + site + "," + staProtocol.getBucketType() +"," + staProtocol.getBucketCount());
+                        News.error("鍛婅瘔缃愯绾垮叆搴撴《淇℃伅鍛戒护闃熷垪鎺ㄩ�佸け璐ワ細" + staProtocol.getWorkNo() + "," + site + "," + staProtocol.getBucketType() +"," + staProtocol.getBucketCount());
+                        throw new CoolException("鍛婅瘔缃愯绾垮叆搴撴《淇℃伅鍛戒护闃熷垪鎺ㄩ�佸け璐�:" + site);
                     }
                 }
             }
         }
     }
+
+    public synchronized void intiGzxkc() throws InterruptedException {
+        DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2);
+        for (Integer site : outGzxSiteList) {
+            StaProtocol staProtocol = devpThread.getStation().get(site);
+            if (staProtocol == null) {
+                continue;
+            } else {
+                staProtocol = staProtocol.clone();
+            }
+            if (staProtocol.isAutoing() && !staProtocol.isLoading() && staProtocol.getWorkNo() == 0) {
+                staProtocol.setPlaceableFlag(1);
+                boolean offer = MessageQueue.offer(SlaveType.Devp, outGzxSiteList.indexOf(site) + 4, new Task(5, staProtocol));
+                if(offer) {
+                    log.info("鍒濆鍖栫綈瑁呯嚎鍙嚭淇″彿鎴愬姛锛岀珯鐐箋}锛屼俊鍙凤細{}",site,1);
+                    Thread.sleep(500);
+                }
+            }
+        }
+    }
 }
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index f19488f..366baa0 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -8,7 +8,8 @@
     name: @pom.build.finalName@
   datasource:
     driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
-    url: jdbc:sqlserver://127.0.0.1:1433;databasename=mdqzasrs
+    url: jdbc:sqlserver://192.168.2.201:1433;databasename=mdqzasrs
+#    url: jdbc:sqlserver://127.0.0.1:1433;databasename=mdqzasrs
     username: sa
     password: sa@123
   mvc:
@@ -48,7 +49,7 @@
   # 鍫嗗灈鏈�1
   crn[0]:
     id: 1
-    ip: 10.10.10.1
+    ip: 192.168.2.1
     port: 102
     rack: 0
     slot: 0
@@ -57,22 +58,22 @@
     demo: false
     # 鍫嗗灈鏈哄叆搴撶珯鐐�
     crnInStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
-      staNo: 1093
-      row: 3
-      bay: 1
+      devpPlcId: ${wcs-slave.devp[2].id}
+      staNo: 1096
+      row: 4
+      bay: 0
       lev: 1
     # 鍫嗗灈鏈哄嚭搴撶珯鐐�
     crnOutStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
+      devpPlcId: ${wcs-slave.devp[2].id}
       staNo: 1093
       row: 3
-      bay: 1
+      bay: 0
       lev: 1
   # 鍫嗗灈鏈�2
   crn[1]:
     id: 2
-    ip: 10.10.10.10
+    ip: 192.168.2.11
     port: 102
     rack: 0
     slot: 0
@@ -81,22 +82,22 @@
     demo: false
     # 鍫嗗灈鏈哄叆搴撶珯鐐�
     crnInStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
+      devpPlcId: ${wcs-slave.devp[2].id}
       staNo: 1104
       row: 6
-      bay: 1
+      bay: 0
       lev: 1
     # 鍫嗗灈鏈哄嚭搴撶珯鐐�
     crnOutStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
+      devpPlcId: ${wcs-slave.devp[2].id}
       staNo: 1099
       row: 5
-      bay: 1
+      bay: 0
       lev: 1
   # 鍫嗗灈鏈�3
   crn[2]:
     id: 3
-    ip: 10.10.10.20
+    ip: 192.168.2.21
     port: 102
     rack: 0
     slot: 0
@@ -105,22 +106,22 @@
     demo: false
     # 鍫嗗灈鏈哄叆搴撶珯鐐�
     crnInStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
+      devpPlcId: ${wcs-slave.devp[2].id}
       staNo: 1102
       row: 7
-      bay: 1
+      bay: 0
       lev: 1
     # 鍫嗗灈鏈哄嚭搴撶珯鐐�
     crnOutStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
+      devpPlcId: ${wcs-slave.devp[2].id}
       staNo: 1107
       row: 8
-      bay: 1
+      bay: 0
       lev: 1
   # 鍫嗗灈鏈�4
   crn[3]:
     id: 4
-    ip: 10.10.10.30
+    ip: 192.168.2.31
     port: 102
     rack: 0
     slot: 0
@@ -129,75 +130,60 @@
     demo: false
     # 鍫嗗灈鏈哄叆搴撶珯鐐�1
     crnInStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
+      devpPlcId: ${wcs-slave.devp[1].id}
       staNo: 1050
       row: 11
-      bay: 1
+      bay: 0
       lev: 1
     # 鍫嗗灈鏈哄叆搴撶珯鐐�2
     crnInStn[1]:
-      devpPlcId: ${wcs-slave.devp[0].id}
+      devpPlcId: ${wcs-slave.devp[1].id}
       staNo: 1049
       row: 12
-      bay: 1
+      bay: 0
       lev: 1
     # 鍫嗗灈鏈哄嚭搴撶珯鐐�
     crnOutStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
+      devpPlcId: ${wcs-slave.devp[1].id}
       staNo: 1056
       row: 9
-      bay: 1
+      bay: 0
+      lev: 1
+    # 鍫嗗灈鏈哄嚭搴撶珯鐐�
+    crnOutStn[1]:
+      devpPlcId: ${wcs-slave.devp[1].id}
+      staNo: 1057
+      row: 10
+      bay: 0
       lev: 1
 
   # 杈撻�佺嚎1
   devp[0]:
     id: 1
-    ip: 10.10.10.18
+    ip: 192.168.2.60
     port: 102
     rack: 0
     slot: 0
     # 鍏ュ簱鍙�1
     inSta[0]:
-      staNo: 1011
+      staNo: 1006
       barcode: ${wcs-slave.barcode[0].id}
-      backSta: 1010
       led: ${wcs-slave.led[0].id}
     # 鍏ュ簱鍙�2
     inSta[1]:
-      staNo: 1007
+      staNo: 1012
       barcode: ${wcs-slave.barcode[1].id}
-      backSta: 1008
       led: ${wcs-slave.led[1].id}
     # 鍏ュ簱鍙�3
     inSta[2]:
-      staNo: 1017
-      barcode: ${wcs-slave.barcode[1].id}
-      backSta: 1016
-      led: ${wcs-slave.led[1].id}
+      staNo: 1018
+      barcode: ${wcs-slave.barcode[2].id}
+      led: ${wcs-slave.led[2].id}
     # 鍏ュ簱鍙�4
     inSta[3]:
-      staNo: 1042
-      barcode: ${wcs-slave.barcode[1].id}
-      backSta: 1043
-      led: ${wcs-slave.led[1].id}
-    # 绌烘澘鍏ュ簱鍙�1
-    emptyInSta[0]:
-      staNo: 1042
-      barcode: ${wcs-slave.barcode[0].id}
-      backSta: 1043
-      led: ${wcs-slave.led[2].id}
-    # 绌烘澘鍏ュ簱鍙�2
-    emptyInSta[1]:
-      staNo: 1017
-      barcode: ${wcs-slave.barcode[1].id}
-      backSta: 1016
+      staNo: 1041
+      barcode: ${wcs-slave.barcode[3].id}
       led: ${wcs-slave.led[3].id}
-    # 绌烘澘鍏ュ簱鍙�3
-    emptyInSta[2]:
-      staNo: 1007
-      barcode: ${wcs-slave.barcode[2].id}
-      backSta: 1008
-      led: ${wcs-slave.led[4].id}
     # 鍑哄簱鍙�1
     outSta[0]:
       staNo: 1024
@@ -214,26 +200,60 @@
     outSta[3]:
       staNo: 1016
       led: ${wcs-slave.led[1].id}
-
+  # 杈撻�佺嚎2
+  devp[1]:
+    id: 2
+    ip: 192.168.2.80
+    port: 102
+    rack: 0
+    slot: 0
+  # 杈撻�佺嚎3
+  devp[2]:
+    id: 3
+    ip: 192.168.2.100
+    port: 102
+    rack: 0
+    slot: 0
+  # 缃愯绾�1
+  devp[3]:
+    id: 4
+    ip: 192.168.1.10
+    port: 102
+    rack: 0
+    slot: 0
+  # 缃愯绾�2
+  devp[4]:
+    id: 5
+    ip: 192.168.1.30
+    port: 102
+    rack: 0
+    slot: 0
+  # 缃愯绾�3
+  devp[5]:
+    id: 6
+    ip: 192.168.1.50
+    port: 102
+    rack: 0
+    slot: 0
   # 鏉$爜鎵弿浠�1
   barcode[0]:
     id: 1
-    ip: 10.10.10.121
+    ip: 192.168.2.63
     port: 51236
   # 鏉$爜鎵弿浠�2
   barcode[1]:
     id: 2
-    ip: 10.10.10.122
+    ip: 192.168.2.64
     port: 51236
   # 鏉$爜鎵弿浠�3
   barcode[2]:
     id: 3
-    ip: 10.10.10.122
+    ip: 192.168.2.67
     port: 51236
   # 鏉$爜鎵弿浠�4
   barcode[3]:
     id: 4
-    ip: 10.10.10.122
+    ip: 192.168.2.68
     port: 51236
 
   # LED1
diff --git a/src/main/resources/mapper/WrkDetlMapper.xml b/src/main/resources/mapper/WrkDetlMapper.xml
index 6e87030..56c37d8 100644
--- a/src/main/resources/mapper/WrkDetlMapper.xml
+++ b/src/main/resources/mapper/WrkDetlMapper.xml
@@ -6,24 +6,44 @@
     <resultMap id="BaseResultMap" type="com.zy.entity.WrkDetl">
         <result column="wrk_no" property="wrkNo" />
         <result column="io_time" property="ioTime" />
+        <result column="anfme" property="anfme" />
+        <result column="zpallet" property="zpallet" />
         <result column="matnr" property="matnr" />
         <result column="maktx" property="maktx" />
+        <result column="batch" property="batch" />
+        <result column="order_no" property="orderNo" />
         <result column="specs" property="specs" />
-<!--        <result column="size" property="size" />-->
+        <result column="model" property="model" />
         <result column="color" property="color" />
-        <result column="weight" property="weight" />
-<!--        <result column="bill_no" property="billNo" />-->
-<!--        <result column="seq_no" property="seqNo" />-->
         <result column="brand" property="brand" />
-        <result column="anfme" property="anfme" />
         <result column="unit" property="unit" />
-        <result column="zpallet" property="zpallet" />
-<!--        <result column="bname" property="bname" />-->
-        <result column="memo" property="memo" />
+        <result column="price" property="price" />
+        <result column="sku" property="sku" />
+        <result column="units" property="units" />
+        <result column="barcode" property="barcode" />
+        <result column="origin" property="origin" />
+        <result column="manu" property="manu" />
+        <result column="manu_date" property="manuDate" />
+        <result column="item_num" property="itemNum" />
+        <result column="safe_qty" property="safeQty" />
+        <result column="weight" property="weight" />
+        <result column="man_length" property="manLength" />
+        <result column="volume" property="volume" />
+        <result column="three_code" property="threeCode" />
+        <result column="supp" property="supp" />
+        <result column="supp_code" property="suppCode" />
+        <result column="be_batch" property="beBatch" />
+        <result column="dead_time" property="deadTime" />
+        <result column="dead_warn" property="deadWarn" />
+        <result column="source" property="source" />
+        <result column="inspect" property="inspect" />
+        <result column="danger" property="danger" />
+
         <result column="modi_user" property="modiUser" />
         <result column="modi_time" property="modiTime" />
         <result column="appe_user" property="appeUser" />
         <result column="appe_time" property="appeTime" />
+        <result column="memo" property="memo" />
     </resultMap>
 
     <select id="findByWorkNo" resultMap="BaseResultMap">
diff --git a/src/main/resources/mapper/WrkMastMapper.xml b/src/main/resources/mapper/WrkMastMapper.xml
index b86468f..e1113c7 100644
--- a/src/main/resources/mapper/WrkMastMapper.xml
+++ b/src/main/resources/mapper/WrkMastMapper.xml
@@ -55,6 +55,7 @@
         <result column="log_mk" property="logMk" />
         <result column="log_err_time" property="logErrTime" />
         <result column="log_err_memo" property="logErrMemo" />
+        <result column="Pdc_type" property="pdcType" />
         <result column="barcode" property="barcode" />
 <!--        <result column="Pdc_type" property="PdcType" />-->
         <result column="ctn_no" property="ctnNo" />
@@ -62,7 +63,7 @@
         <result column="rgv_no" property="rgvNo" />
         <result column="rgv_ssta_no" property="rgvSstaNo" />
         <result column="rgv_dsta_no" property="rgvDstaNo" />
-
+        <result column="work_no_other" property="workNoOther" />
     </resultMap>
 
     <select id="selectByLocNo"  resultMap="BaseResultMap">
@@ -98,7 +99,7 @@
     </select>
 
     <select id="selectPakInStep2" resultMap="BaseResultMap">
-        select top 1 * from dbo.asr_wrk_mast where wrk_sts=2 and crn_no=#{crnNo} and wrk_no=#{workNo} and sta_no=#{staNo} and (io_type=1 or io_type=10 or io_type=53 or io_type=54 or io_type=57) order by io_pri desc,io_time,wrk_no ASC
+        select top 1 * from dbo.asr_wrk_mast where wrk_sts=2 and crn_no=#{crnNo} and wrk_no=#{workNo} and (io_type=1 or io_type=10 or io_type=53 or io_type=54 or io_type=57) order by io_pri desc,io_time,wrk_no ASC
     </select>
 
     <select id="selectPakInStep3" resultMap="BaseResultMap">
diff --git a/src/main/webapp/static/js/console.js b/src/main/webapp/static/js/console.js
index de14203..b086f36 100644
--- a/src/main/webapp/static/js/console.js
+++ b/src/main/webapp/static/js/console.js
@@ -30,7 +30,7 @@
         let bLen
         let interval // 闂撮殧鏁�
 
-        if (i < 8) {
+        if (i <= 12) {
             interval = 1
             bLen = maxBayNo / interval // 搴撲綅涓暟
         } else {
diff --git a/src/main/webapp/static/js/console.map.js b/src/main/webapp/static/js/console.map.js
index cebaab1..0a1e95e 100644
--- a/src/main/webapp/static/js/console.map.js
+++ b/src/main/webapp/static/js/console.map.js
@@ -11,73 +11,73 @@
         "id": "rack1",
         "top": 100,
         "left": 450,
-        "width": 1300,
+        "width": 1120,
         "height": 20,
         "minBayNo": 1,
-        "maxBayNo": 40
+        "maxBayNo": 56
     },{
         "type": "rack",
         "id": "rack2",
         "top": 120,
         "left": 450,
-        "width": 1300,
+        "width": 1120,
         "height": 20,
         "minBayNo": 1,
-        "maxBayNo": 40
+        "maxBayNo": 56
     },{
             "type": "rack",
             "id": "rack3",
             "top": 170,
             "left": 450,
-            "width": 1300,
+            "width": 1120,
             "height": 20,
             "minBayNo": 1,
-            "maxBayNo": 40
+            "maxBayNo": 56
         },{
         "type": "rack",
         "id": "rack4",
         "top": 190,
         "left": 450,
-        "width": 1300,
+        "width": 1120,
         "height": 20,
         "minBayNo": 1,
-        "maxBayNo": 40
+        "maxBayNo": 56
     },{
         "type": "rack",
         "id": "rack5",
         "top": 210,
         "left": 450,
-        "width": 1300,
+        "width": 1120,
         "height": 20,
         "minBayNo": 1,
-        "maxBayNo": 40
+        "maxBayNo": 56
     },{
         "type": "rack",
         "id": "rack6",
         "top": 260,
         "left": 450,
-        "width": 1300,
+        "width": 1120,
         "height": 20,
         "minBayNo": 1,
-        "maxBayNo": 40
+        "maxBayNo": 56
     },{
         "type": "rack",
         "id": "rack7",
         "top": 280,
         "left": 450,
-        "width": 1300,
+        "width": 1120,
         "height": 20,
         "minBayNo": 1,
-        "maxBayNo": 40
+        "maxBayNo": 56
     },{
         "type": "rack",
         "id": "rack8",
         "top": 330,
         "left": 450,
-        "width": 1300,
+        "width": 1120,
         "height": 20,
         "minBayNo": 1,
-        "maxBayNo": 40
+        "maxBayNo": 56
     },{
         "type": "rack",
         "id": "rack9",
@@ -116,27 +116,27 @@
         "maxBayNo": 40
     }],
     "rackDescs": [
-        {"type": "rackDescs", "id": "lb_desc1", "text": "#1", "top": 102, "left": 1750, "width": 30, "height": 20},
-        {"type": "rackDescs", "id": "lb_desc2", "text": "#2", "top": 120, "left": 1750, "width": 30, "height": 20},
-        {"type": "rackDescs", "id": "lb_desc3", "text": "#3", "top": 172, "left": 1750, "width": 30, "height": 20},
-        {"type": "rackDescs", "id": "lb_desc4", "text": "#4", "top": 192, "left": 1750, "width": 30, "height": 20},
-        {"type": "rackDescs", "id": "lb_desc5", "text": "#5", "top": 212, "left": 1750, "width": 30, "height": 20},
-        {"type": "rackDescs", "id": "lb_desc6", "text": "#6", "top": 262, "left": 1750, "width": 30, "height": 20},
-        {"type": "rackDescs", "id": "lb_desc7", "text": "#7", "top": 282, "left": 1750, "width": 30, "height": 20},
-        {"type": "rackDescs", "id": "lb_desc8", "text": "#8", "top": 332, "left": 1750, "width": 30, "height": 20},
+        {"type": "rackDescs", "id": "lb_desc1", "text": "#1", "top": 102, "left": 1570, "width": 30, "height": 20},
+        {"type": "rackDescs", "id": "lb_desc2", "text": "#2", "top": 120, "left": 1570, "width": 30, "height": 20},
+        {"type": "rackDescs", "id": "lb_desc3", "text": "#3", "top": 172, "left": 1570, "width": 30, "height": 20},
+        {"type": "rackDescs", "id": "lb_desc4", "text": "#4", "top": 192, "left": 1570, "width": 30, "height": 20},
+        {"type": "rackDescs", "id": "lb_desc5", "text": "#5", "top": 212, "left": 1570, "width": 30, "height": 20},
+        {"type": "rackDescs", "id": "lb_desc6", "text": "#6", "top": 262, "left": 1570, "width": 30, "height": 20},
+        {"type": "rackDescs", "id": "lb_desc7", "text": "#7", "top": 282, "left": 1570, "width": 30, "height": 20},
+        {"type": "rackDescs", "id": "lb_desc8", "text": "#8", "top": 332, "left": 1570, "width": 30, "height": 20},
         {"type": "rackDescs", "id": "lb_desc9", "text": "#9", "top": 457, "left": 1760, "width": 30, "height": 20},
         {"type": "rackDescs", "id": "lb_desc10", "text": "10", "top": 476, "left": 1760, "width": 30, "height": 20},
         {"type": "rackDescs", "id": "lb_desc11", "text": "11", "top": 527, "left": 1760, "width": 30, "height": 20},
         {"type": "rackDescs", "id": "lb_desc12", "text": "12", "top": 546, "left": 1760, "width": 30, "height": 20}
     ],
     "crns": [
-        {"type": "crane", "id": "crn-1", "text": "1", "top": 142, "left": 376, "width": 100, "height": 30},
-        {"type": "track", "id": "lb_track1","text": "", "top": 159, "left": 450, "width": 1300, "height": 1},
-        {"type": "crane", "id": "crn-2", "text": "2", "top": 232, "left": 376, "width": 100, "height": 30},
-        {"type": "track", "id": "lb_track2","text": "", "top": 250, "left": 450, "width": 1300, "height": 1},
-        {"type": "crane", "id": "crn-3", "text": "3", "top": 302, "left": 460, "width": 100, "height": 30},
-        {"type": "track", "id": "lb_track3","text": "", "top": 320, "left": 450, "width": 1300, "height": 1},
-        {"type": "crane", "id": "crn-4", "text": "4", "top": 497, "left": 1200, "width": 100, "height": 30},
+        {"type": "crane", "id": "crn-1", "text": "1", "top": 142, "left": 376, "width": 60, "height": 30},
+        {"type": "track", "id": "lb_track1","text": "", "top": 159, "left": 450, "width": 1120, "height": 1},
+        {"type": "crane", "id": "crn-2", "text": "2", "top": 232, "left": 376, "width": 60, "height": 30},
+        {"type": "track", "id": "lb_track2","text": "", "top": 250, "left": 450, "width": 1120, "height": 1},
+        {"type": "crane", "id": "crn-3", "text": "3", "top": 302, "left": 460, "width": 60, "height": 30},
+        {"type": "track", "id": "lb_track3","text": "", "top": 320, "left": 450, "width": 1120, "height": 1},
+        {"type": "crane", "id": "crn-4", "text": "4", "top": 497, "left": 1200, "width": 60, "height": 30},
         {"type": "track", "id": "lb_track4","text": "", "top": 515, "left": 960, "width": 800, "height": 1},
         {"type": "track", "id": "lb_track5","text": "", "top": 612, "left": 303, "width": 1430, "height": 1},
         {"type": "track", "id": "lb_track6","text": "", "top": 638, "left": 270 , "width": 1464, "height": 1},
@@ -179,93 +179,95 @@
                 {"type": "stn", "id": "site-1105", "text": "1105", "top": 332, "left": 307, "width": 47, "height": 20},
                 {"type": "stn", "id": "site-1106", "text": "1106", "top": 332, "left": 355, "width": 47, "height": 20},
                 {"type": "stn", "id": "site-1107", "text": "1107", "top": 332, "left": 403, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1090", "top": 367, "left": 307, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1089", "top": 393, "left": 307, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1088", "top": 393, "left": 355, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1087", "top": 393, "left": 403, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1086", "top": 456, "left": 307, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1085", "top": 456, "left": 355, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1084", "top": 456, "left": 403, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1083", "top": 519, "left": 307, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1082", "top": 519, "left": 355, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1081", "top": 519, "left": 403, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1079", "top": 393, "left": 625, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1078", "top": 393, "left": 673, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1077", "top": 393, "left": 721, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1075", "top": 393, "left": 769, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1074", "top": 414, "left": 769, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1073", "top": 435, "left": 769, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1061", "top": 456, "left": 769, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1063", "top": 456, "left": 721, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1064", "top": 456, "left": 673, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1065", "top": 456, "left": 625, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1066", "top": 477, "left": 769, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1067", "top": 498, "left": 769, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1068", "top": 519, "left": 769, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1070", "top": 519, "left": 721, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1071", "top": 519, "left": 673, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1072", "top": 519, "left": 625, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1050", "top": 527, "left": 913, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1051", "top": 512, "left": 817, "width": 47, "height": 35},
-                {"type": "stn", "id": "site-1107", "text": "1052", "top": 477, "left": 817, "width": 47, "height": 35},
-                {"type": "stn", "id": "site-1107", "text": "1049", "top": 548, "left": 913, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1047", "top": 548, "left": 865, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1046", "top": 548, "left": 817, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1045", "top": 569, "left": 817, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1044", "top": 590, "left": 817, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1053", "top": 456, "left": 817, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1054", "top": 456, "left": 865, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1056", "top": 456, "left": 913, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1057", "top": 477, "left": 913, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1090", "text": "1090", "top": 367, "left": 307, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1089", "text": "1089", "top": 393, "left": 307, "width": 47, "height": 20},
+                // {"type": "stn", "id": "site-1088", "text": "1088", "top": 393, "left": 355, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1087", "text": "1087", "top": 393, "left": 355, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1086", "text": "1086", "top": 456, "left": 307, "width": 47, "height": 20},
+                // {"type": "stn", "id": "site-1085", "text": "1085", "top": 456, "left": 355, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1084", "text": "1084", "top": 456, "left": 355, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1083", "text": "1083", "top": 519, "left": 307, "width": 47, "height": 20},
+                // {"type": "stn", "id": "site-1082", "text": "1082", "top": 519, "left": 355, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1081", "text": "1081", "top": 519, "left": 355, "width": 47, "height": 20},
+                // {"type": "stn", "id": "site-1079", "text": "1079", "top": 393, "left": 578, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1078", "text": "1078", "top": 393, "left": 626, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1077", "text": "1077", "top": 393, "left": 674, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1075", "text": "1075", "top": 393, "left": 722, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1074", "text": "1074", "top": 414, "left": 722, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1073", "text": "1073", "top": 435, "left": 722, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1061", "text": "1061", "top": 456, "left": 722, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1063", "text": "1063", "top": 456, "left": 674, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1064", "text": "1064", "top": 456, "left": 626, "width": 47, "height": 20},
+                // {"type": "stn", "id": "site-1065", "text": "1065", "top": 456, "left": 578, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1066", "text": "1066", "top": 477, "left": 722, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1067", "text": "1067", "top": 498, "left": 722, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1068", "text": "1068", "top": 519, "left": 722, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1070", "text": "1070", "top": 519, "left": 674, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1071", "text": "1071", "top": 519, "left": 626, "width": 47, "height": 20},
+                // {"type": "stn", "id": "site-1072", "text": "1072", "top": 519, "left": 578, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1050", "text": "1050", "top": 527, "left": 913, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1051", "text": "1051", "top": 512, "left": 770, "width": 47, "height": 35},
+                {"type": "stn", "id": "site-1052", "text": "1052", "top": 477, "left": 770, "width": 47, "height": 35},
+                {"type": "stn", "id": "site-1049", "text": "1049", "top": 548, "left": 913, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1048", "text": "1048", "top": 548, "left": 865, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1047", "text": "1047", "top": 548, "left": 818, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1046", "text": "1046", "top": 548, "left": 770, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1045", "text": "1045", "top": 569, "left": 770, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1044", "text": "1044", "top": 590, "left": 770, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1053", "text": "1053", "top": 456, "left": 770, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1054", "text": "1054", "top": 456, "left": 818, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1055", "text": "1055", "top": 456, "left": 865, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1056", "text": "1056", "top": 456, "left": 913, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1057", "text": "1057", "top": 477, "left": 913, "width": 47, "height": 20},
 
-                {"type": "stn", "id": "site-1107", "text": "1001", "top": 640, "left": 1340, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1002", "top": 661, "left": 1340, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1004", "top": 682, "left": 1340, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1005", "top": 682, "left": 1388, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1006", "top": 640, "left": 1436, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1007", "top": 661, "left": 1436, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1008", "top": 682, "left": 1436, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1009", "top": 682, "left": 1484, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1010", "top": 682, "left": 1532, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1011", "top": 661, "left": 1532, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1012", "top": 640, "left": 1532, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1001", "text": "1001", "top": 640, "left": 1340, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1002", "text": "1002", "top": 661, "left": 1340, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1004", "text": "1004", "top": 682, "left": 1340, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1005", "text": "1005", "top": 682, "left": 1388, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1006", "text": "1006", "top": 640, "left": 1436, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1007", "text": "1007", "top": 661, "left": 1436, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1008", "text": "1008", "top": 682, "left": 1436, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1009", "text": "1009", "top": 682, "left": 1484, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1010", "text": "1010", "top": 682, "left": 1532, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1011", "text": "1011", "top": 661, "left": 1532, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1012", "text": "1012", "top": 640, "left": 1532, "width": 47, "height": 20},
 
-                {"type": "stn", "id": "site-1107", "text": "1041", "top": 640, "left": 1050, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1042", "top": 661, "left": 1050, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1043", "top": 682, "left": 1050, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1013", "top": 682, "left": 1098, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1014", "top": 682, "left": 1146, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1015", "top": 682, "left": 1194, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1016", "top": 682, "left": 1242, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1017", "top": 661, "left": 1242, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1018", "top": 640, "left": 1242, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1019", "top": 640, "left": 1146, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1020", "top": 661, "left": 1146, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1041", "text": "1041", "top": 640, "left": 1050, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1042", "text": "1042", "top": 661, "left": 1050, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1043", "text": "1043", "top": 682, "left": 1050, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1013", "text": "1013", "top": 682, "left": 1098, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1014", "text": "1014", "top": 682, "left": 1146, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1015", "text": "1015", "top": 682, "left": 1194, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1016", "text": "1016", "top": 682, "left": 1242, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1017", "text": "1017", "top": 661, "left": 1242, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1018", "text": "1018", "top": 640, "left": 1242, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1019", "text": "1019", "top": 640, "left": 1146, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1020", "text": "1020", "top": 661, "left": 1146, "width": 47, "height": 20},
 
-                {"type": "stn", "id": "site-1107", "text": "1022", "top": 640, "left": 400, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1023", "top": 661, "left": 400, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1024", "top": 682, "left": 400, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1025", "top": 682, "left": 448, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1026", "top": 640, "left": 496, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1027", "top": 661, "left": 496, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1028", "top": 682, "left": 496, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1030", "top": 682, "left": 544, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1031", "top": 682, "left": 592, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1032", "top": 661, "left": 592, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1033", "top": 640, "left": 592, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1022", "text": "1022", "top": 640, "left": 400, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1023", "text": "1023", "top": 661, "left": 400, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1024", "text": "1024", "top": 682, "left": 400, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1025", "text": "1025", "top": 682, "left": 448, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1026", "text": "1026", "top": 640, "left": 496, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1027", "text": "1027", "top": 661, "left": 496, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1028", "text": "1028", "top": 682, "left": 496, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1030", "text": "1030", "top": 682, "left": 544, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1031", "text": "1031", "top": 682, "left": 592, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1032", "text": "1032", "top": 661, "left": 592, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1033", "text": "1033", "top": 640, "left": 592, "width": 47, "height": 20},
 
-                {"type": "stn", "id": "site-1107", "text": "1034", "top": 640, "left": 650, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1035", "top": 661, "left": 650, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1036", "top": 682, "left": 650, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1038", "top": 682, "left": 698, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1039", "top": 682, "left": 746, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "1040", "top": 682, "left": 794, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1034", "text": "1034", "top": 640, "left": 650, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1035", "text": "1035", "top": 661, "left": 650, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1036", "text": "1036", "top": 682, "left": 650, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1038", "text": "1038", "top": 682, "left": 698, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1039", "text": "1039", "top": 682, "left": 746, "width": 47, "height": 20},
+                {"type": "stn", "id": "site-1040", "text": "1040", "top": 682, "left": 794, "width": 47, "height": 20},
 
-                {"type": "stn", "id": "site-1107", "text": "1", "top": 627, "left": 737, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "2", "top": 627, "left": 800, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "3", "top": 627, "left": 850, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "4", "top": 627, "left": 900, "width": 47, "height": 20},
-                {"type": "stn", "id": "site-1107", "text": "5", "top": 627, "left": 950, "width": 47, "height": 20},
+                // {"type": "stn", "id": "site-1107", "text": "1", "top": 627, "left": 737, "width": 47, "height": 20},
+                // {"type": "stn", "id": "site-1107", "text": "2", "top": 627, "left": 800, "width": 47, "height": 20},
+                // {"type": "stn", "id": "site-1107", "text": "3", "top": 627, "left": 850, "width": 47, "height": 20},
+                // {"type": "stn", "id": "site-1107", "text": "4", "top": 627, "left": 900, "width": 47, "height": 20},
+                // {"type": "stn", "id": "site-1107", "text": "5", "top": 627, "left": 950, "width": 47, "height": 20},
             ]
         }]
     }]
diff --git a/src/main/webapp/views/console.html b/src/main/webapp/views/console.html
index f223198..0493976 100644
--- a/src/main/webapp/views/console.html
+++ b/src/main/webapp/views/console.html
@@ -595,40 +595,25 @@
                     for (var i = 0; i < crns.length; i++) {
                         var crnEl = $("#crn-" + crns[i].crnId);
                         crnEl.attr("class", "machine " + crns[i].crnStatus);
-                        var unit = 31;//($('.item').eq(0).width() + 13) / 2;
-
-                        if (crns[i].bay < 0 || crns[i].bay === -2) {
-                            crns[i].bay = 1
+                        if (crns[i].bay < 0) {
+                            crns[i].bay = 1;
                         }
-                        // crnEl.animate({left: (crns[i].bay * unit) + 'px'}, 1000);
-                        // crns[i].bay = 15;
-                        var offSet = 1450;
-                        // switch (i) 5
-                        //     case 0:
-                        //     case 1:
-                        //     case 2:
-                        //     case 3:
-                        //         unit = 35;
-                        //         offSet = 500;
-                        //         break;
-                        //     case 5:
-                        //         unit = 124;
-                        //         offSet = 550;
-                        //         break;
-                        //     case 4:
-                        //     case 6:
-                        //         unit = 62;
-                        //         offSet = 550;
-                        //         break;
-                        // }
-                        console.log(offSet)
-                        if(crns[i].bay === 1){
-                            crnEl.animate({left: offSet + 'px'}, 1000);
+                        let unit = 20
+                        if (crns[i].crnId === 4) {
+                            let offSet = 960;
+                            if(crns[i].bay === 1){
+                                crnEl.animate({left: offSet + 'px'}, 1000);
+                            } else {
+                                crnEl.animate({left: (offSet + unit*(crns[i].bay-1)) + 'px'}, 1000);
+                            }
                         } else {
-                            let lf = (offSet - crns[i].bay * 42);
-                            crnEl.animate({left: lf + 'px'}, 1000);
+                            let offSet = 450;
+                            if(crns[i].bay === 1){
+                                crnEl.animate({left: offSet + 'px'}, 1000);
+                            } else {
+                                crnEl.animate({left: (offSet + unit*(crns[i].bay -1)) + 'px'}, 1000);
+                            }
                         }
-
                     }
                 } else if (res.code === 403) {
                     parent.location.href = baseUrl + "/login";
diff --git a/src/main/webapp/views/control.html b/src/main/webapp/views/control.html
index 0468aed..defbc8f 100644
--- a/src/main/webapp/views/control.html
+++ b/src/main/webapp/views/control.html
@@ -84,7 +84,7 @@
     </main>
 
     <footer class="footer">
-        Copyright 漏 2023 All Rights Reserved. <a href="http://www.zoneyung.com" target="_blank">娴欐睙涓壃绔嬪簱鎶�鏈湁闄愬叕鍙�</a>  淇濈暀鎵�鏈夋潈鍒�
+<!--        Copyright 漏 2023 All Rights Reserved. <a href="http://www.zoneyung.com" target="_blank">娴欐睙涓壃绔嬪簱鎶�鏈湁闄愬叕鍙�</a>  淇濈暀鎵�鏈夋潈鍒�-->
     </footer>
 
 </body>
diff --git a/src/main/webapp/views/index.html b/src/main/webapp/views/index.html
index 3171813..ecf9fd5 100644
--- a/src/main/webapp/views/index.html
+++ b/src/main/webapp/views/index.html
@@ -34,7 +34,7 @@
 <!-- 涓讳綋鍐呭 -->
 <iframe id="content" src="console.html"></iframe>
 <footer class="footer">
-    Copyright 漏 2024 All Rights Reserved. <a href="http://www.zoneyung.com" target="_blank">娴欐睙涓壃绔嬪簱鎶�鏈湁闄愬叕鍙�</a>  淇濈暀鎵�鏈夋潈鍒�
+<!--    Copyright 漏 2024 All Rights Reserved. <a href="http://www.zoneyung.com" target="_blank">娴欐睙涓壃绔嬪簱鎶�鏈湁闄愬叕鍙�</a>  淇濈暀鎵�鏈夋潈鍒�-->
 </footer>
 </body>
 <script>
@@ -70,7 +70,7 @@
                 // , control:false
                 , opacity:0.9
                 , border:false
-                , icon:'<img src="../static/images/favicon.ico" style="height:22px;display:block;"  alt=""/>'
+                // , icon:'<img src="../static/images/favicon.ico" style="height:22px;display:block;"  alt=""/>'
                 , stickMenu:true
                 , maxMenu:false
                 , closeMenu:false
diff --git a/src/main/webapp/views/indexTV.html b/src/main/webapp/views/indexTV.html
index 711a467..d510c4b 100644
--- a/src/main/webapp/views/indexTV.html
+++ b/src/main/webapp/views/indexTV.html
@@ -41,7 +41,7 @@
 <!-- 涓讳綋鍐呭 -->
 <iframe id="content" src="console.html"></iframe>
 <footer class="footer">
-    Copyright 漏 2023 All Rights Reserved. <a href="http://www.zoneyung.com" target="_blank">娴欐睙涓壃绔嬪簱鎶�鏈湁闄愬叕鍙�</a>  淇濈暀鎵�鏈夋潈鍒�
+<!--    Copyright 漏 2023 All Rights Reserved. <a href="http://www.zoneyung.com" target="_blank">娴欐睙涓壃绔嬪簱鎶�鏈湁闄愬叕鍙�</a>  淇濈暀鎵�鏈夋潈鍒�-->
 </footer>
 </body>
 <script>

--
Gitblit v1.9.1