From dfb16176c060ace64d01926c42e041d268e90262 Mon Sep 17 00:00:00 2001
From: 1 <1>
Date: 星期一, 24 十一月 2025 08:31:40 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/SiemensDevpThread.java |  368 ++++++++++++++++++++++++++++++++-------------------
 1 files changed, 230 insertions(+), 138 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index affd623..25712d2 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -10,6 +10,8 @@
 import com.core.common.SpringUtils;
 import com.core.exception.CoolException;
 import com.zy.asrs.entity.*;
+import com.zy.asrs.mapper.BasRgvMapMapper;
+import com.zy.asrs.mapper.BasRgvMapper;
 import com.zy.asrs.service.*;
 import com.zy.common.utils.News;
 import com.zy.core.DevpThread;
@@ -24,6 +26,7 @@
 import com.zy.core.model.protocol.StaProtocol;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import java.nio.charset.StandardCharsets;
 import java.text.MessageFormat;
@@ -37,7 +40,8 @@
 @Data
 @Slf4j
 public class SiemensDevpThread implements Runnable, DevpThread {
-
+    private BasRgvMapMapper basRgvMapMapper;
+    private BasRgvMapper basRgvMapper;
     private DevpSlave slave;
     private SiemensS7Net siemensS7Net;
     private Map<Integer, StaProtocol> station = new ConcurrentHashMap<>();
@@ -47,6 +51,7 @@
 //
 //    }};
     public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{
+        add(1);add(2);//灏忚溅绔欑偣
         add(1001);add(1002);add(1004);
         add(1005);add(1007);
         add(1008);add(1010);
@@ -67,6 +72,7 @@
     }};
 
     public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{
+        add(3);add(4);
         add(2001);add(2003);
         add(2004);add(2006);
         add(2007);add(2009);
@@ -161,6 +167,10 @@
         put(1036, 512);put(1103, 476);put(1047, 452);put(2037, 270);put(4001,294);
 
     }};
+    public static final Map<Integer, Integer> siteAgvOffsetMap = new HashMap<Integer, Integer>() {{
+        put(1037, 0);put(1039, 2);put(1041, 4);put(2033, 0);put(2034,2);put(4003,4);put(4006,6);
+
+    }};
 
     // 鐗规畩绔欑偣闆嗗悎
     private static final Set<Integer> specialSites = new HashSet<>(
@@ -173,6 +183,8 @@
     private static final Set<Integer> specialSites3 = new HashSet<>(//鏈烘鑷傜珯鐐�
             Arrays.asList(1098,1093,1087,1082,1074,1071,1061,1058));
 
+    private static final Set<Integer> specialAgvSites = new HashSet<>(//agv鍙栨斁璐х珯鐐�
+            Arrays.asList(1037,1039,1041,2033,2034,4003,4006));
 
     public static final ArrayList<Integer> BarcodeList = new ArrayList<Integer>() {{
         add(0); add(1); add(2);
@@ -277,6 +289,7 @@
                 read();
 
             } catch (Exception e) {
+                e.printStackTrace();
                 log.error("Dev鏁版嵁璇诲彇绾跨▼寮傚父锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
                 initSite();
             }
@@ -322,6 +335,9 @@
                         write((StaProtocol)task.getData());
                         log.error("杈撻�佺嚎涓嬪彂鍛戒护锛�"+((StaProtocol) task.getData()).getWorkNo()+","+((StaProtocol) task.getData()).getStaNo());
                         break;
+//                    case 3:
+//                        writeAgv((StaProtocol)task.getData());
+//                        break;
                     default:
                         break;
                 }
@@ -442,19 +458,25 @@
         OperateResultExOne<byte[]> result4 = null;//1054-1079
         OperateResultExOne<byte[]> result5 = null;//1080-1110
         OperateResultExOne<byte[]> resultErr = null;
-        if(staNoSize == 100){
+        OperateResultExOne<byte[]> resultPlc = null;
+        OperateResultExOne<byte[]> resultAgv = null;
+
+        if(staNoSize == 102){
             result1 = siemensS7Net.Read("DB100.0", (short) (2768));//1001-1028
             result2 = siemensS7Net.Read("DB101.0", (short) (1268));//1029-1037
             result3 = siemensS7Net.Read("DB104.0", (short) (1268));//1042-1053
             result4 = siemensS7Net.Read("DB103.0", (short) (2824));//1054-1079
             result5 = siemensS7Net.Read("DB102.0", (short) (3428));//1080-1110
             resultErr = siemensS7Net.Read("DB3.0", (short) (536));
+//            resultAgv = siemensS7Net.Read("DB901.0", (short) (5)); //agv鍙栨斁璐ц姹�
+//            resultPlc = siemensS7Net.Read("DB902.0", (short) (5)); //杈撻�佺嚎纭
         }else{
             result1 = siemensS7Net.Read("DB200.0", (short) (3000));//2001-2030
             result2 = siemensS7Net.Read("DB201.0", (short) (720));//2031-2037
             result3 = siemensS7Net.Read("DB400.0", (short) (600));//4001-4006
             resultErr = siemensS7Net.Read("DB3.0", (short) (354));
-
+//            resultAgv = siemensS7Net.Read("DB901.0", (short) (7)); //agv鍙栨斁璐ц姹�
+//            resultPlc = siemensS7Net.Read("DB902.0", (short) (7)); //杈撻�佺嚎纭
         }
 
 
@@ -470,7 +492,7 @@
                     station.put(siteId, staProtocol);
                 }
                 staProtocol.setSiteId(siteId);
-                if (staNoSize == 100) {
+                if (staNoSize == 102) {
                     if (siteId < 1029) {
                         result = result1;
                     } else if (siteId < 1042) {
@@ -491,152 +513,211 @@
                         result = result3;
                     }
                 }
-                // 鑾峰彇璇ョ珯鐐瑰搴旂殑鍋忕Щ閲�
-                Integer offset = siteOffsetMap.get(siteId);
-                if (offset == null) {
-                    continue; // 濡傛灉娌″畾涔夊亸绉婚噺锛岃烦杩�
-                }
-                Integer offset2 = getOffsetBySiteId(siteId);//鐗规畩鍋忕Щ閲忚绠�
-                Integer offset3 = getOffsetBySiteId2(siteId);
-                Integer offsetSign = siteOffsetMapSign.get(siteId);
-                if(siteId == 1040){
-                    boolean[] full = siemensS7Net.getByteTransform().TransBool(result.Content, offset, 2);
-                    staProtocol.setFull(full[0]);
-                }
-                staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt32(result.Content, offset + offset2));     // 宸ヤ綔鍙�
-                staProtocol.setStaNo((short)siemensS7Net.getByteTransform().TransInt32(result.Content, offset + offset2 + 12));   // 鐩爣绔�
-                staProtocol.setBarcode(String.valueOf(siemensS7Net.getByteTransform().TransInt32(result.Content, offset + offset2 + 16)));  //鏉$爜
+//                if(siteId < 5){
+//                    int rgvNo = 2;
+//                    if(siteId<3){
+//                        rgvNo = 1;
+//                    }
+////                    BasRgv basRgv = basRgvMapper.selectByRgvNo(rgvNo);
+//                    BasRgvMap basRgvMap = basRgvMapMapper.selectByRgvNo(rgvNo);
+//                    if(siteId%2 != 0){
+////                        staProtocol.setWorkNo(basRgv.getWrkNo1());
+//                    }else{
+////                        staProtocol.setWorkNo(basRgv.getWrkNo2());
+//                    }
+//
+//                }else{
+                    // 鑾峰彇璇ョ珯鐐瑰搴旂殑鍋忕Щ閲�
+                    Integer offset = siteOffsetMap.get(siteId);
+                    if (offset == null) {
+                        continue; // 濡傛灉娌″畾涔夊亸绉婚噺锛岃烦杩�
+                    }
+                    Integer offset2 = getOffsetBySiteId(siteId);//鐗规畩鍋忕Щ閲忚绠�
+                    Integer offset3 = getOffsetBySiteId2(siteId);
+                    Integer offsetSign = siteOffsetMapSign.get(siteId);
+                    if(siteId == 1040){
+                        boolean[] full = siemensS7Net.getByteTransform().TransBool(result.Content, offset, 2);
+                        staProtocol.setFull(full[0]);
+                    }
+                    staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt32(result.Content, offset + offset2));     // 宸ヤ綔鍙�
+                    staProtocol.setStaNo((short)siemensS7Net.getByteTransform().TransInt32(result.Content, offset + offset2 + 12));   // 鐩爣绔�
+                    staProtocol.setBarcode(String.valueOf(siemensS7Net.getByteTransform().TransInt32(result.Content, offset + offset2 + 16)));  //鏉$爜
 
-                if(specialSites2.contains(siteId)){
-                    staProtocol.setStaNo((short)siemensS7Net.getByteTransform().TransInt32(result.Content, offset + offset2 + 48));   // 鐩爣绔�
-                    staProtocol.setBarcode(String.valueOf(siemensS7Net.getByteTransform().TransInt32(result.Content, offset + offset2 + 52)));  //鏉$爜
-                }
-                if(staNosErrList.contains(siteId)){
-                    Integer offsetErr = siteErrOffsetMap.get(siteId);
-                    boolean[] statusErr = siemensS7Net.getByteTransform().TransBool(resultErr.Content, offsetErr, 2);
-                    staProtocol.setFrontErr(statusErr[2]);
-                    staProtocol.setBackErr(statusErr[3]);
-                    staProtocol.setHighErr(statusErr[5]);
-                    staProtocol.setLeftErr(statusErr[11]);
-                    staProtocol.setRightErr(statusErr[12]);
+                    if(specialSites2.contains(siteId)){
+                        staProtocol.setStaNo((short)siemensS7Net.getByteTransform().TransInt32(result.Content, offset + offset2 + 48));   // 鐩爣绔�
+                        staProtocol.setBarcode(String.valueOf(siemensS7Net.getByteTransform().TransInt32(result.Content, offset + offset2 + 52)));  //鏉$爜
+                    }
+                    if(staNosErrList.contains(siteId)){
+                        Integer offsetErr = siteErrOffsetMap.get(siteId);
+                        boolean[] statusErr = siemensS7Net.getByteTransform().TransBool(resultErr.Content, offsetErr, 2);
+                        staProtocol.setFrontErr(statusErr[2]);
+                        staProtocol.setBackErr(statusErr[3]);
+                        staProtocol.setHighErr(statusErr[5]);
+                        staProtocol.setLeftErr(statusErr[11]);
+                        staProtocol.setRightErr(statusErr[12]);
 // 鍙栧嚭454~458浣嶇疆鐨�5涓瓧鑺�
-                    byte[] bytes = Arrays.copyOfRange(resultErr.Content, (offsetErr + 14), (offsetErr + 19));
+                        byte[] bytes = Arrays.copyOfRange(resultErr.Content, (offsetErr + 14), (offsetErr + 19));
 // 杞崲鎴愬瓧绗︿覆锛圫7閲孋HAR鏄崟瀛楄妭缂栫爜锛岀洿鎺SCII鍗冲彲锛�
-                    String plcStr = new String(bytes, StandardCharsets.US_ASCII).trim();
+                        String plcStr = new String(bytes, StandardCharsets.US_ASCII).trim();
 // 鍒ゆ柇鏄惁绛変簬 "error"
-                    staProtocol.setBarcodeErr("error".equalsIgnoreCase(plcStr));
-                }
+                        staProtocol.setBarcodeErr("error".equalsIgnoreCase(plcStr));
+                    }
 
-                boolean[] status = siemensS7Net.getByteTransform().TransBool(result.Content, offset + offset3, 1);
-                staProtocol.setAutoing(!status[0]);  // 鑷姩
-                boolean[] status1 = siemensS7Net.getByteTransform().TransBool(result.Content, offset + offset3 - 4, 3);
-                boolean[] statusErr = siemensS7Net.getByteTransform().TransBool(result.Content, offset + offset3 - 8, 3);
-                boolean[] statusSign = siemensS7Net.getByteTransform().TransBool(resultErr.Content, offsetSign, 3);
-                boolean loading = false;
-                if(!status1[0])
-                {
-                    loading = true;
-                }
-                staProtocol.setLoading(loading);  // 鏈夌墿
+                    boolean[] status = siemensS7Net.getByteTransform().TransBool(result.Content, offset + offset3, 1);
+                    staProtocol.setAutoing(!status[0]);  // 鑷姩
+                    boolean[] status1 = siemensS7Net.getByteTransform().TransBool(result.Content, offset + offset3 - 4, 3);
+                    boolean[] statusErr = siemensS7Net.getByteTransform().TransBool(result.Content, offset + offset3 - 8, 3);
+                    boolean[] statusSign = siemensS7Net.getByteTransform().TransBool(resultErr.Content, offsetSign, 3);
+                    boolean loading = false;
+                    if(!status1[0])
+                    {
+                        loading = true;
+                    }
+                    staProtocol.setLoading(loading);  // 鏈夌墿
 
-                staProtocol.setInEnable(status1[2]); // 鍙叆
-                staProtocol.setOutEnable(status1[2]);// 鍙嚭
-                staProtocol.setErr(status1[6]);
+                    staProtocol.setInEnable(status1[2]); // 鍙叆
+                    staProtocol.setOutEnable(status1[2]);// 鍙嚭
+                    staProtocol.setErr(status1[6]);
 
-                //鎶ヨ
-                staProtocol.setPassTimeOut(statusErr[0]);
-                staProtocol.setObjectNoIdError(statusErr[1]);
-                staProtocol.setIdNoObjectError(statusErr[2]);
-                staProtocol.setLmfrError(statusErr[3]);
-                staProtocol.setLiftError(statusErr[4]);
-                staProtocol.setDlfrError(statusErr[5]);
-                staProtocol.setDmfrError(statusErr[6]);
-                staProtocol.setVfdError(statusErr[7]);
-                staProtocol.setSrvError(statusErr[8]);
-                staProtocol.setRes1(statusErr[9]);
-                staProtocol.setRes2(statusErr[10]);
-                staProtocol.setRes3(statusErr[11]);
-                staProtocol.setCommunicationTimeOut(statusErr[12]);
-                staProtocol.setParameterIncompleteError(statusErr[13]);
-                staProtocol.setDataNotClear(statusErr[14]);
-                staProtocol.setSetParameterError(statusErr[15]);
-                staProtocol.setRes4(statusErr[16]);
-                staProtocol.setRes5(statusErr[17]);
-                staProtocol.setDataError(statusErr[18]);
+//                    boolean[] statusAlarm = siemensS7Net.getByteTransform().TransBool(resultAlarm.Content, 2*i, 1);
+//                    //鎶ヨ
+//                    staProtocol.setPassTimeOut(statusAlarm[0]);
+//                    staProtocol.setObjectNoIdError(statusAlarm[1]);
+//                    staProtocol.setIdNoObjectError(statusAlarm[2]);
+//                    staProtocol.setLmfrError(statusAlarm[3]);
+//                    staProtocol.setLiftError(statusAlarm[4]);
+//                    staProtocol.setDlfrError(statusAlarm[5]);
+//                    staProtocol.setDmfrError(statusAlarm[6]);
+//                    staProtocol.setVfdError(statusAlarm[7]);
+//                    staProtocol.setSrvError(statusAlarm[8]);
+//                    staProtocol.setRes1(statusAlarm[9]);
+//                    staProtocol.setRes2(statusAlarm[10]);
+//                    staProtocol.setRes3(statusAlarm[11]);
+//                    staProtocol.setCommunicationTimeOut(statusAlarm[12]);
+//                    staProtocol.setParameterIncompleteError(statusAlarm[13]);
+//                    staProtocol.setDataNotClear(statusAlarm[14]);
+//                    staProtocol.setSetParameterError(statusAlarm[15]);
 
-                //淇″彿
-                staProtocol.setSensorGArrive(statusSign[0]);
-                staProtocol.setSensorGDec(statusSign[1]);
-                staProtocol.setSensorGArrive2(statusSign[2]);
-                staProtocol.setSensorLimit(statusSign[3]);
-                staProtocol.setEmergency(statusSign[4]);
-                staProtocol.setSensorGLeave(statusSign[5]);
-                staProtocol.setSensorGLeave2(statusSign[6]);
-                staProtocol.setSensorCUp(statusSign[7]);
-                staProtocol.setSensorCDown(statusSign[8]);
-                staProtocol.setLiftMotorFr(statusSign[9]);
-                staProtocol.setLineMotorFr(statusSign[10]);
-                staProtocol.setTranMotorFr(statusSign[11]);
-                staProtocol.setRst1(statusSign[12]);
-                staProtocol.setRst2(statusSign[13]);
-                staProtocol.setRst3(statusSign[14]);
-                staProtocol.setRst4(statusSign[15]);
-                staProtocol.setSensorArriveD(statusSign[16]);
-                staProtocol.setSensorDecD(statusSign[17]);
-                staProtocol.setSensorArriveL(statusSign[18]);
-                staProtocol.setSensorDecL(statusSign[19]);
-                staProtocol.setSensorArriveR(statusSign[20]);
-                staProtocol.setSensorDecR(statusSign[21]);
+                    //鎶ヨ
+                    staProtocol.setPassTimeOut(statusErr[0]);
+                    staProtocol.setObjectNoIdError(statusErr[1]);
+                    staProtocol.setIdNoObjectError(statusErr[2]);
+                    staProtocol.setLmfrError(statusErr[3]);
+                    staProtocol.setLiftError(statusErr[4]);
+                    staProtocol.setDlfrError(statusErr[5]);
+                    staProtocol.setDmfrError(statusErr[6]);
+                    staProtocol.setVfdError(statusErr[7]);
+                    staProtocol.setSrvError(statusErr[8]);
+                    staProtocol.setRes1(statusErr[9]);
+                    staProtocol.setRes2(statusErr[10]);
+                    staProtocol.setRes3(statusErr[11]);
+                    staProtocol.setCommunicationTimeOut(statusErr[12]);
+                    staProtocol.setParameterIncompleteError(statusErr[13]);
+                    staProtocol.setDataNotClear(statusErr[14]);
+                    staProtocol.setSetParameterError(statusErr[15]);
+                    staProtocol.setRes4(statusErr[16]);
+                    staProtocol.setRes5(statusErr[17]);
+                    staProtocol.setDataError(statusErr[18]);
+
+                    //淇″彿
+                    staProtocol.setSensorGArrive(statusSign[0]);
+                    staProtocol.setSensorGDec(statusSign[1]);
+                    staProtocol.setSensorGArrive2(statusSign[2]);
+                    staProtocol.setSensorLimit(statusSign[3]);
+                    staProtocol.setEmergency(statusSign[4]);
+                    staProtocol.setSensorGLeave(statusSign[5]);
+                    staProtocol.setSensorGLeave2(statusSign[6]);
+                    staProtocol.setSensorCUp(statusSign[7]);
+                    staProtocol.setSensorCDown(statusSign[8]);
+                    staProtocol.setLiftMotorFr(statusSign[9]);
+                    staProtocol.setLineMotorFr(statusSign[10]);
+                    staProtocol.setTranMotorFr(statusSign[11]);
+                    staProtocol.setRst1(statusSign[12]);
+                    staProtocol.setRst2(statusSign[13]);
+                    staProtocol.setRst3(statusSign[14]);
+                    staProtocol.setRst4(statusSign[15]);
+                    staProtocol.setSensorArriveD(statusSign[16]);
+                    staProtocol.setSensorDecD(statusSign[17]);
+                    staProtocol.setSensorArriveL(statusSign[18]);
+                    staProtocol.setSensorDecL(statusSign[19]);
+                    staProtocol.setSensorArriveR(statusSign[20]);
+                    staProtocol.setSensorDecR(statusSign[21]);
+
+//                    Integer offsetAgv = siteAgvOffsetMap.get(siteId);
+//
+//                    boolean[] statusPlc = siemensS7Net.getByteTransform().TransBool(resultPlc.Content, offsetAgv, 1);
+//                    boolean[] statusAgv = siemensS7Net.getByteTransform().TransBool(resultAgv.Content, offsetAgv, 1);
+//
+//                    if(specialAgvSites.contains(siteId)){
+//                        // 蹇冭烦
+//                        staProtocol.setHeartbeatDevp(statusPlc[0]);
+//                        staProtocol.setHeartbeatAgv(statusAgv[0]);
+//                        // 杈撻�佺嚎锛圥LC锛�
+//                        staProtocol.setConveyorAllowPick(statusPlc[1]);
+//                        staProtocol.setConveyorAllowPlace(statusPlc[2]);
+//                        staProtocol.setConveyorPickDone(statusPlc[3]);
+//                        staProtocol.setConveyorPlaceDone(statusPlc[4]);
+//                        staProtocol.setSafetyDoorOpen(statusPlc[5]);
+//                        staProtocol.setExternalEmergencyStop(statusPlc[6]);
+//                        // AGV
+//                        staProtocol.setAgvRequestPlace(statusAgv[1]);
+//                        staProtocol.setAgvRequestPick(statusAgv[2]);
+//                        staProtocol.setAgvPickDone(statusAgv[3]);
+//                        staProtocol.setAgvPlaceDone(statusAgv[4]);
+//                        staProtocol.setAgvForbidden(statusAgv[5]);
+//                    }
 
 
-                if( (staProtocol.getPassTimeOut() ||
-                    staProtocol.getObjectNoIdError() ||
-                        staProtocol.getIdNoObjectError() ||
-                        staProtocol.getLmfrError() ||
-                        staProtocol.getLiftError() ||
-                        staProtocol.getDlfrError() ||
-                        staProtocol.getDmfrError() ||
-                        staProtocol.getVfdError() ||
-                        staProtocol.getSrvError() ||
-                        staProtocol.getRes1() ||
-                        staProtocol.getRes2() ||
-                        staProtocol.getRes3() ||
-                        staProtocol.getCommunicationTimeOut() ||
-                        staProtocol.getParameterIncompleteError() ||
-                        staProtocol.getDataNotClear() ||
-                        staProtocol.getSetParameterError() ||
-                        staProtocol.getDataError()) && staProtocol.isWriteMk()
-                ){
-                    staProtocol.setErrorMk(true);//鑻ュ瓨鍦ㄥ紓甯歌Е鍙戝啓鍏�
-                }
+                    if( (staProtocol.getPassTimeOut() ||
+                            staProtocol.getObjectNoIdError() ||
+                            staProtocol.getIdNoObjectError() ||
+                            staProtocol.getLmfrError() ||
+                            staProtocol.getLiftError() ||
+                            staProtocol.getDlfrError() ||
+                            staProtocol.getDmfrError() ||
+                            staProtocol.getVfdError() ||
+                            staProtocol.getSrvError() ||
+                            staProtocol.getRes1() ||
+                            staProtocol.getRes2() ||
+                            staProtocol.getRes3() ||
+                            staProtocol.getCommunicationTimeOut() ||
+                            staProtocol.getParameterIncompleteError() ||
+                            staProtocol.getDataNotClear() ||
+                            staProtocol.getSetParameterError() ||
+                            staProtocol.getDataError()) && staProtocol.isWriteMk()
+                    ){
+                        staProtocol.setErrorMk(true);//鑻ュ瓨鍦ㄥ紓甯歌Е鍙戝啓鍏�
+                    }
 
-                if(     !staProtocol.getPassTimeOut() &&
-                        !staProtocol.getObjectNoIdError() &&
-                        !staProtocol.getIdNoObjectError() &&
-                        !staProtocol.getLmfrError() &&
-                        !staProtocol.getLiftError() &&
-                        !staProtocol.getDlfrError() &&
-                        !staProtocol.getDmfrError() &&
-                        !staProtocol.getVfdError() &&
-                        !staProtocol.getSrvError() &&
-                        !staProtocol.getRes1() &&
-                        !staProtocol.getRes2() &&
-                        !staProtocol.getRes3() &&
-                        !staProtocol.getCommunicationTimeOut() &&
-                        !staProtocol.getParameterIncompleteError() &&
-                        !staProtocol.getDataNotClear() &&
-                        !staProtocol.getSetParameterError() &&
-                        !staProtocol.getDataError()
-                ){
-                    staProtocol.setWriteMk(true);//鏃犲紓甯稿悗鎵嶈兘缁х画鍐欏叆
-                    staProtocol.setErrorMk(false);//鑻ュ瓨鍦ㄥ紓甯歌Е鍙戝啓鍏�
+                    if(     !staProtocol.getPassTimeOut() &&
+                            !staProtocol.getObjectNoIdError() &&
+                            !staProtocol.getIdNoObjectError() &&
+                            !staProtocol.getLmfrError() &&
+                            !staProtocol.getLiftError() &&
+                            !staProtocol.getDlfrError() &&
+                            !staProtocol.getDmfrError() &&
+                            !staProtocol.getVfdError() &&
+                            !staProtocol.getSrvError() &&
+                            !staProtocol.getRes1() &&
+                            !staProtocol.getRes2() &&
+                            !staProtocol.getRes3() &&
+                            !staProtocol.getCommunicationTimeOut() &&
+                            !staProtocol.getParameterIncompleteError() &&
+                            !staProtocol.getDataNotClear() &&
+                            !staProtocol.getSetParameterError() &&
+                            !staProtocol.getDataError()
+                    ){
+                        staProtocol.setWriteMk(true);//鏃犲紓甯稿悗鎵嶈兘缁х画鍐欏叆
+                        staProtocol.setErrorMk(false);//鑻ュ瓨鍦ㄥ紓甯歌Е鍙戝啓鍏�
 
-                }
+                    }
 
 
-                if (!staProtocol.isPakMk() && (!staProtocol.isLoading() || staProtocol.getWorkNo()==0)) {
-                    staProtocol.setPakMk(true);
-                }
+                    if (!staProtocol.isPakMk() && (!staProtocol.isLoading() || staProtocol.getWorkNo()==0)) {
+                        staProtocol.setPakMk(true);
+                    }
+//                }
+
             }
         }
         //鏉$爜鎵弿鍣�
@@ -647,6 +728,7 @@
         OperateResultExOne<byte[]> reasultBarcode3 = siemensS7Net.Read("DB102.2780", (short) 4);//1103
         OperateResultExOne<byte[]> reasultBarcode4 = siemensS7Net.Read("DB201.344", (short) 4);//2037
         OperateResultExOne<byte[]> reasultBarcode5 = siemensS7Net.Read("DB400.112", (short) 4);//4001
+        OperateResultExOne<byte[]> reasultBarcode6 = siemensS7Net.Read("DB201.716", (short) 4);//2033
 
         if(barcodeList.get(0) == 0){
             if(reasultBarcode1.IsSuccess){
@@ -693,7 +775,17 @@
                     barcodeThread.setBarcode(barcode);
                 }
             }
+            if(reasultBarcode6.IsSuccess){
+                Integer barcodeId = barcodeList.get(2);
+                String barcode = String.valueOf(siemensS7Net.getByteTransform().TransInt32(reasultBarcode6.Content, 0));
+                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + +1);
+                if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
+                    barcodeThread.setBarcode(barcode);
+                }
+            }
         }
+
+
 
 
         if (result1.IsSuccess && result2.IsSuccess) {
@@ -842,8 +934,8 @@
                     staProtocol.isHighErr()? 1L:0L,
                     staProtocol.isLeftErr()? 1L:0L,
                     staProtocol.isRightErr()? 1L:0L,
-                    staProtocol.isBarcodeErr()? 1L:0L
-
+                    staProtocol.isBarcodeErr()? 1L:0L,
+                    staProtocol.getErrCode()
             );
             bean.insert(basDevpOpt);
         } catch (Exception ignore) {

--
Gitblit v1.9.1