From ebdfec3e9db0977bccca0527be7d2226fbbd0229 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期三, 12 六月 2024 11:02:16 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SiemensDevpThread.java |   47 +++++++++++++++++++++++++++++++++--------------
 1 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SiemensDevpThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SiemensDevpThread.java
index eac27b4..6e8f537 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SiemensDevpThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SiemensDevpThread.java
@@ -112,20 +112,6 @@
             }
         }
 
-        // 鏉$爜鎵弿鍣�
-        Thread.sleep(200);
-        OperateResultExOne<byte[]> result2 = null;
-        result2 = siemensS7Net.Read("DB101.840.0", (short) (barcodeSize * 8));
-        if (result2.IsSuccess) {
-            for (int i = 0; i < barcodeSize; i++) {
-                String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 8, 8, "UTF-8");
-//                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
-//                if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
-//                    barcodeThread.setBarcode(barcode);
-//                }
-            }
-        }
-
         Thread.sleep(200);
         ArrayList<Station> errorStaNo = getStaNo();
         OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB101.800.0", (short) (errorStaNo.size() * 4));
@@ -244,6 +230,28 @@
     }
 
     @Override
+    public boolean writeWorkSta(int siteId, short staNo, short workNo) {
+        int index = findStaNosIndex(siteId);
+
+        OperateResult write1 = siemensS7Net.Write("DB100." + index*6, workNo);    // 宸ヤ綔鍙�
+        OperateResult write2 = siemensS7Net.Write("DB100." + (index*6+4), staNo);    // 鐩爣绔�
+
+        if (!(write1.IsSuccess && write2.IsSuccess)) {
+            StaProtocol staProtocol = station.get(siteId);
+            if (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() ==0) {
+                staProtocol.setPakMk(true);
+            }
+            OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎绔欑偣鏁版嵁澶辫触銆傝緭閫佺嚎plc缂栧彿={1}锛岀珯鐐规暟鎹�={2}", device.getId(), JSON.toJSON(staProtocol)));
+            log.error("鍐欏叆杈撻�佺嚎绔欑偣鏁版嵁澶辫触銆傝緭閫佺嚎plc缂栧彿={}锛岀珯鐐规暟鎹�={}", device.getId(), JSON.toJSON(staProtocol));
+        } else {
+            OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆� 杈撻�佺嚎鍛戒护涓嬪彂 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), device.getId(), JSON.toJSON(staNo)));
+            log.info("杈撻�佺嚎鍛戒护涓嬪彂 [id:{}] >>>>> 鍛戒护涓嬪彂锛� {}",  device.getId(), JSON.toJSON(staNo));
+            return true;
+        }
+        return false;
+    }
+
+    @Override
     public Map<Integer, StaProtocol> getStation() {
         return this.station;
     }
@@ -261,4 +269,15 @@
         }
         return index;
     }
+
+    /**
+     * 璁剧疆鍏ュ簱鏍囪
+     */
+    @Override
+    public void setPakMk(Integer siteId, boolean pakMk) {
+        StaProtocol staProtocol = station.get(siteId);
+        if (null != staProtocol) {
+            staProtocol.setPakMk(pakMk);
+        }
+    }
 }

--
Gitblit v1.9.1