From 8a286894c2f6c5a3ff027b1c0fcb45b72b96cba1 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期一, 13 四月 2026 10:05:21 +0800
Subject: [PATCH] 1

---
 zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/properties/DevpSlave.java     |   11 +-
 zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/controller/vo/SiteTableVo.java     |    2 
 zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/model/StaProtocol.java        |    3 
 zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/constant/DeviceField.java     |   24 ++++-
 zy-asc-conveyor/src/main/webapp/views/pipeline.html                                  |   22 ++--
 zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/controller/SiteController.java     |   12 +-
 zy-asc-conveyor/src/main/resources/application.yml                                   |    9 -
 zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/thread/SiemensDevpThread.java |  102 ++++++++++++++-----------
 8 files changed, 107 insertions(+), 78 deletions(-)

diff --git a/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/controller/SiteController.java b/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/controller/SiteController.java
index e6a9c8b..350ad11 100644
--- a/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/controller/SiteController.java
+++ b/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/controller/SiteController.java
@@ -69,10 +69,11 @@
             vo.setLoading(staProtocol.isLoading() ? "Y" : "N");     // 鏈夌墿
             vo.setInEnable(staProtocol.isInEnable() ? "Y" : "N");   // 鍙叆
             vo.setOutEnable(staProtocol.isOutEnable() ? "Y" : "N"); // 鍙嚭
-            vo.setEmptyMk(staProtocol.isEmptyMk() ? "Y" : "N");     // 绌烘澘淇″彿
+            vo.setEmptyMk(staProtocol.isEmptyMk() !=staProtocol.isFullPlt() ? (staProtocol.isEmptyMk()?"绌�" : "婊�"): "-");     // 绌烘澘淇″彿
             vo.setStaNo(staProtocol.getStaNo());                // 鐩爣绔�
-//            vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "浣�" : "楂�");     //楂樹綆搴撲綅
-            vo.setLocType1(devp.getDevNo() == 102 ? "楂�" : "浣�");
+            vo.setWeight(staProtocol.getWeight() == null ? 0D : staProtocol.getWeight());
+            vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow()? ( staProtocol.isLow() ? "浣�" : "楂�"): "-");     //楂樹綆搴撲綅
+
         }
 
         return R.ok().add(list);
@@ -110,9 +111,10 @@
                     vo.setLoading(staProtocol.isLoading() ? "Y" : "N");     // 鏈夌墿
                     vo.setInEnable(staProtocol.isInEnable() ? "Y" : "N");   // 鍙叆
                     vo.setOutEnable(staProtocol.isOutEnable() ? "Y" : "N"); // 鍙嚭
-                    vo.setEmptyMk(staProtocol.isEmptyMk() ? "Y" : "N");     // 绌烘澘淇″彿
+                    vo.setEmptyMk(staProtocol.isEmptyMk() !=staProtocol.isFullPlt() ? (staProtocol.isEmptyMk()?"绌�" : "婊�"): "-");     // 绌烘澘淇″彿
                     vo.setStaNo(staProtocol.getStaNo());                // 鐩爣绔�
-                    vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "浣�" : "楂�");     //楂樹綆搴撲綅
+                    vo.setWeight(staProtocol.getWeight() ==null ? 0D : staProtocol.getWeight());
+                    vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow()? ( staProtocol.isLow() ? "浣�" : "楂�"): "-");     //楂樹綆搴撲綅
                     return R.ok().add(vo);
                 }
             }
diff --git a/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/controller/vo/SiteTableVo.java b/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/controller/vo/SiteTableVo.java
index 5f40dd3..1bfedd3 100644
--- a/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/controller/vo/SiteTableVo.java
+++ b/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/controller/vo/SiteTableVo.java
@@ -37,4 +37,6 @@
 
     //楂樹綆搴撲綅
     private String locType1 = "-";
+
+    private Double weight = 0D;
 }
diff --git a/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/constant/DeviceField.java b/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/constant/DeviceField.java
index 6dbefe2..ed3daf0 100644
--- a/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/constant/DeviceField.java
+++ b/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/constant/DeviceField.java
@@ -6,22 +6,26 @@
  */
 public enum DeviceField {
     // 鎵爜鍣細姣忕珯鐐�16瀛楄妭锛孲tring[14]
-    BARCODE("DB103", 254, 16),
+    BARCODE("DB103", 254, 18,new int[]{0,2},21),
+    // 鍑哄叆搴撴ā寮�
+    IO_MODE("DB103", 170, 4,new int[]{0,2},21),
     // 绉伴噸锛氭瘡绔欑偣4瀛楄妭锛孎loat
-    //WEIGHT("DB102", 0, 4),
-
-    WEIGHT("DB103", 634, 4),
+    WEIGHT("DB103", 634, 6,new int[]{0,2},21),
     // 灏哄寮傚父锛氭瘡绔欑偣2瀛楄妭锛孊it鏁扮粍
-    DIMENSION_WORD("DB103", 2, 8);
+    DIMENSION_WORD("DB103", 2, 8,new int[]{0,2,4,6},21);
 
     private final String addressPattern;
     private final int offset;
     private final int byteLength;
+    private final int[] seg;
+    private final int arrLength;
 
-    DeviceField(String addressPattern, int offset, int byteLength) {
+    DeviceField(String addressPattern, int offset, int byteLength,int[] seg, int arrLength) {
         this.addressPattern = addressPattern;
         this.offset = offset;
         this.byteLength = byteLength;
+        this.seg = seg;
+        this.arrLength = arrLength;
     }
 
     public String getAddressPattern() {
@@ -36,6 +40,14 @@
         return byteLength;
     }
 
+    public int getArrLength() {
+        return arrLength;
+    }
+
+    public int[] getSeg() {
+        return seg;
+    }
+
     /**
      * 鏍规嵁 DB 鍧楃紪鍙峰拰绔欑偣鍋忕Щ鐢熸垚鍏蜂綋鍦板潃
      *
diff --git a/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/model/StaProtocol.java b/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/model/StaProtocol.java
index 4b85714..8a0ead1 100644
--- a/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/model/StaProtocol.java
+++ b/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/model/StaProtocol.java
@@ -80,6 +80,9 @@
     // 鎵爜澶辫触
     private boolean barcodeErr = false;
 
+    // 鏈夎揣鎶ヨ锛岀┖鎵樺叆搴撴椂妫�娴嬫墭鐩樹笂鏈夋棤璐х墿
+    private boolean loadErr = false;
+
     //鏁呴殰-----------------------------------------------------------------------
     private Boolean breakerErr = false; //鏂矾鍣ㄦ晠闅�
 
diff --git a/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/properties/DevpSlave.java b/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/properties/DevpSlave.java
index 9b1e241..af7eb6f 100644
--- a/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/properties/DevpSlave.java
+++ b/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/properties/DevpSlave.java
@@ -18,6 +18,11 @@
 
     private Integer slot;
 
+    private Boolean weight;
+
+    private Boolean barcode ;
+
+    private Boolean staNosError ;
 
     private List<Sta> releaseSta = new ArrayList<>();
 
@@ -25,13 +30,9 @@
 
     private List<Sta> inSta = new ArrayList<>();
 
-    private List<Integer> barcodeArr = new ArrayList<>();
-
-    private List<Integer> weightArr = new ArrayList<>();
-
     private List<Integer> staNos = new ArrayList<>();
 
-    private List<Integer> staNosError = new ArrayList<>();
+
 
     @Data
     public static class Sta {
diff --git a/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/thread/SiemensDevpThread.java b/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/thread/SiemensDevpThread.java
index 301ae9e..344a861 100644
--- a/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/thread/SiemensDevpThread.java
+++ b/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/thread/SiemensDevpThread.java
@@ -158,14 +158,13 @@
      * 璇诲彇鏉$爜淇℃伅
      */
     private void readBarcodes() {
-        List<Integer> barcodeArr = slave.getBarcodeArr();
-        if (barcodeArr == null || barcodeArr.isEmpty()) {
+        if (slave.getBarcode() == null || !slave.getBarcode()) {
             return;
         }
 
         OperateResultExOne<byte[]> result = siemensS7Net.Read(
                 DeviceField.BARCODE.buildAddress(),
-                (short) (barcodeArr.size() * DeviceField.BARCODE.getByteLength()));
+                (short) ( DeviceField.BARCODE.getByteLength() * DeviceField.BARCODE.getArrLength()));
 
         if (!result.IsSuccess) {
             log.warn("璇诲彇鏉$爜澶辫触 [id:{}]", slave.getId());
@@ -173,15 +172,18 @@
         }
 
         byte[] content = result.Content;
-        for (int i = 0; i < barcodeArr.size(); i++) {
+        for (int i = 0; i < DeviceField.BARCODE.getArrLength(); i++) {
+            int[] seg = DeviceField.BARCODE.getSeg();
+            Short staNo = siemensS7Net.getByteTransform().TransInt16(
+                    content, seg[0]+i * DeviceField.BARCODE.getByteLength());
             String barcode = siemensS7Net.getByteTransform().TransString(
-                    content, i * DeviceField.BARCODE.getByteLength(),
-                    DeviceField.BARCODE.getByteLength(), "UTF-8");
+                    content, seg[1]+i * DeviceField.BARCODE.getByteLength(),
+                    DeviceField.BARCODE.getByteLength()-seg[1], "UTF-8");
 
-            if (!Cools.isEmpty(barcode)) {
-                StaProtocol staProtocol = station.get(barcodeArr.get(i));
+            if (!Cools.isEmpty(barcode)&& staNo !=null) {
+                StaProtocol staProtocol = station.get(staNo);
                 if (staProtocol == null) {
-                    log.warn("绔欑偣涓嶅瓨鍦� [id:{}] [staNo:{}]", slave.getId(), barcodeArr.get(i));
+                    log.warn("鎵爜绔欑偣涓嶅瓨鍦� [id:{}] [staNo:{}]", slave.getId(), staNo);
                     continue;
                 }
                 staProtocol.setBarcode(barcode);
@@ -191,45 +193,50 @@
     }
 
     /**
-     * 璇诲彇鏉$爜淇℃伅
+     * 璇诲彇閲嶉噺淇℃伅
      */
     private void readWeight() {
-        List<Integer> weightArr = slave.getWeightArr();
-        if (weightArr == null || weightArr.isEmpty()) {
+        if ( slave.getWeight() == null || ! slave.getWeight()) {
             return;
         }
 
         OperateResultExOne<byte[]> result = siemensS7Net.Read(
                 DeviceField.WEIGHT.buildAddress(),
-                (short) (weightArr.size() * DeviceField.WEIGHT.getByteLength()));
+                (short) (DeviceField.WEIGHT.getArrLength() * DeviceField.WEIGHT.getByteLength()));
 
         if (!result.IsSuccess) {
             log.warn("璇诲彇閲嶉噺澶辫触 [id:{}]", slave.getId());
             return;
         }
-        for (int i = 0; i < weightArr.size(); i++) {
-            StaProtocol staProtocol = station.get(weightArr.get(i));
-            if (staProtocol == null) {
-                log.warn("绔欑偣涓嶅瓨鍦� [id:{}] [staNo:{}]", slave.getId(), weightArr.get(i));
-                continue;
+        byte[] content = result.Content;
+        for (int i = 0; i < DeviceField.WEIGHT.getArrLength() ; i++) {
+            int[] seg = DeviceField.WEIGHT.getSeg();
+            Short staNo = siemensS7Net.getByteTransform().TransInt16(
+                    content, seg[0]+i * DeviceField.WEIGHT.getByteLength());
+            Double weight = (double) siemensS7Net.getByteTransform().TransSingle(
+                    content, seg[1] + i * DeviceField.WEIGHT.getByteLength());
+            if (!Cools.isEmpty(weight)&& staNo !=null) {
+                StaProtocol staProtocol = station.get(staNo);
+                if (staProtocol == null) {
+                    log.warn("绉伴噸绔欑偣涓嶅瓨鍦� [id:{}] [staNo:{}]", slave.getId(), staNo);
+                    continue;
+                }
+                staProtocol.setWeight(BigDecimal.valueOf(weight).setScale(4, RoundingMode.HALF_UP).doubleValue());
             }
-            double weight = siemensS7Net.getByteTransform().TransSingle(result.Content, i * DeviceField.WEIGHT.getByteLength());
-            staProtocol.setWeight(BigDecimal.valueOf(weight).setScale(4, RoundingMode.HALF_UP).doubleValue());
-        }
+           }
     }
 
     /**
      * 璇诲彇澶栧舰妫�娴嬮敊璇�
      */
     private void readDimensionErrors() {
-        List<Integer> staNosError = slave.getStaNosError();
-        if (staNosError == null || staNosError.isEmpty()) {
+        if ( slave.getStaNosError() == null ||  !slave.getStaNosError()) {
             return;
         }
 
         OperateResultExOne<byte[]> result = siemensS7Net.Read(
                 DeviceField.DIMENSION_WORD.buildAddress(),
-                (short) (staNosError.size() * DeviceField.DIMENSION_WORD.getByteLength()));
+                (short) (DeviceField.DIMENSION_WORD.getArrLength() * DeviceField.DIMENSION_WORD.getByteLength()));
 
         if (!result.IsSuccess) {
             log.warn("璇诲彇澶栧舰妫�娴嬮敊璇け璐� [id:{}]", slave.getId());
@@ -237,30 +244,35 @@
         }
 
         byte[] content = result.Content;
-        for (int i = 0; i < staNosError.size(); i++) {
-            Integer siteId = staNosError.get(i);
-            StaProtocol staProtocol = station.get(siteId);
-            if (staProtocol == null){
-                log.warn("绔欑偣涓嶅瓨鍦� [id:{}] [staNo:{}]", slave.getId(), staNosError.get(i));
-                continue;
+        for (int i = 0; i < DeviceField.DIMENSION_WORD.getArrLength(); i++) {
+            int[] seg = DeviceField.DIMENSION_WORD.getSeg();
+            Short staNo = siemensS7Net.getByteTransform().TransInt16(
+                    content, seg[0]);
+            if ( staNo !=null) {
+                StaProtocol staProtocol = station.get(staNo);
+                if (staProtocol == null){
+                    log.warn("寮傚父绔欑偣涓嶅瓨鍦� [id:{}] [staNo:{}]", slave.getId(), staNo);
+                    continue;
+                }
+                boolean[] status = siemensS7Net.getByteTransform().TransBool(
+                        content, seg[1]+i * DeviceField.DIMENSION_WORD.getByteLength(),
+                        1);
+//鏈娇鐢紝棰勭暀
+//                boolean[] status1 = siemensS7Net.getByteTransform().TransBool(
+//                        content, seg[1]+i * DeviceField.DIMENSION_WORD.getByteLength()+1,
+//                        1);
+
+                staProtocol.setLeftErr(status[0]);
+                staProtocol.setRightErr(status[1]);
+                staProtocol.setFrontErr(status[2]);
+                staProtocol.setBackErr(status[3]);
+                staProtocol.setHighErr(status[4]);
+                staProtocol.setLoadErr(status[5]);
+                staProtocol.setWeightErr(status[6]);
+                staProtocol.setBarcodeErr(status[7]);
             }
-            short i1 = siemensS7Net.getByteTransform().TransInt16(
-                    content, 0);
-            boolean[] status = siemensS7Net.getByteTransform().TransBool(
-                    content, 2+i * DeviceField.DIMENSION_WORD.getByteLength(),
-                    1);
 
-            boolean[] status1 = siemensS7Net.getByteTransform().TransBool(
-                    content, 2+i * DeviceField.DIMENSION_WORD.getByteLength()+1,
-                    1);
 
-            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]);
         }
     }
 
diff --git a/zy-asc-conveyor/src/main/resources/application.yml b/zy-asc-conveyor/src/main/resources/application.yml
index 21eb956..adcbd4c 100644
--- a/zy-asc-conveyor/src/main/resources/application.yml
+++ b/zy-asc-conveyor/src/main/resources/application.yml
@@ -102,12 +102,9 @@
       - 1011
       - 1012
       - 1013
-    staNosError:
-      - 1010
-    barcodeArr:
-      - 1010
-    weightArr:
-      - 1009
+    staNosError: true
+    barcode: true
+    weight: true
     # ctu鏀捐揣绔欑偣
     releaseSta[0]:
       # 鏈珯鐐�
diff --git a/zy-asc-conveyor/src/main/webapp/views/pipeline.html b/zy-asc-conveyor/src/main/webapp/views/pipeline.html
index 65846fd..40d2f98 100644
--- a/zy-asc-conveyor/src/main/webapp/views/pipeline.html
+++ b/zy-asc-conveyor/src/main/webapp/views/pipeline.html
@@ -783,10 +783,10 @@
                             <th>鏈夌墿</th>
                             <th>鍙叆</th>
                             <th>鍙嚭</th>
-                            <th>鍏ュ簱鏍囪</th>
-                            <th>绌烘澘淇″彿</th>
+                            <th>閲嶉噺淇″彿</th>
+                            <th>绌烘弧淇″彿</th>
                             <th>鐩爣绔�</th>
-                            <th>楂樹綆搴撲綅</th>
+                            <th>楂樹綆淇″彿</th>
                         </tr>
                         </thead>
                         <tbody>
@@ -824,19 +824,19 @@
                         </div>
                         <div class="form-group">
                             <label class="form-label" for="workNo">宸ヤ綔鍙�:</label>
-                            <input id="workNo" name="workNo" type="number" class="form-input"
+                            <input id="workNo" name="workNo" type="number" min="0" class="form-input"
                                    autocomplete="off">
                         </div>
                         <div class="form-group">
                             <label class="form-label" for="staNo">鐩爣绔�:</label>
-                            <input id="staNo" name="staNo" type="number" class="form-input"
+                            <input id="staNo" name="staNo" type="number" min="0" class="form-input"
                                    autocomplete="off">
                         </div>
-                        <div class="form-group">
-                            <label class="form-label" for="pakMk">鍏ュ簱鏍囪:</label>
-                            <input id="pakMk" name="pakMk" type="text" class="form-input"
-                                   autocomplete="off">
-                        </div>
+<!--                        <div class="form-group">-->
+<!--                            <label class="form-label" for="pakMk">鍏ュ簱鏍囪:</label>-->
+<!--                            <input id="pakMk" name="pakMk" type="text" class="form-input"-->
+<!--                                   autocomplete="off">-->
+<!--                        </div>-->
                     </form>
                 </div>
                 <div class="modal-footer">
@@ -987,7 +987,7 @@
                             ${site.outEnable === 'Y' ? 'Y' : 'N'}
                         </span>
                     </td>
-                    <td>${site.pakMk || '--'}</td>
+                    <td>${site.weight || '--'}</td>
                     <td>${site.emptyMk || '--'}</td>
                     <td>${site.staNo || '--'}</td>
                     <td>${site.locType1 || '--'}</td>

--
Gitblit v1.9.1