From 242bbccea6fd21c130f639cf7b9c6aa95d41fe44 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期二, 16 一月 2024 11:12:42 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   96 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 77 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index e36752f..47ec31e 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -228,6 +228,62 @@
     }
 
     /**
+     * 缁勬墭
+     * 鍏ュ簱绔欙紝鏍规嵁鏉$爜鎵弿閫氱煡妗佹灦鐮佸灈
+     */
+    public synchronized void generateStoreWrkFileFull2LouM() {
+        // 鏍规嵁杈撻�佺嚎plc閬嶅巻
+        for (DevpSlave devp : slaveProperties.getDevp()) {
+            // 閬嶅巻鐮佸灈鍙�
+            for (DevpSlave.Sta driveSta : devp.getDriveSta()) {
+                // 鑾峰彇鏉$爜鎵弿浠俊鎭�
+                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, driveSta.getBarcode());
+                if (barcodeThread == null) {
+                    continue;
+                }
+                String barcode = barcodeThread.getBarcode();
+
+                if (!Cools.isEmpty(barcode) && !barcode.equals("") && !barcode.equals("      ")) {
+                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+                        continue;
+                    }
+                } else {
+                    continue;
+                }
+
+                // 鑾峰彇鐮佸灈鍙d俊鎭�
+                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+                StaProtocol staProtocol = devpThread.getStation().get(driveSta.getStaNo());
+                if (staProtocol == null) {
+                    continue;
+                } else {
+                    staProtocol = staProtocol.clone();
+                }
+                // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
+                if (staProtocol.isAutoing()
+                        && staProtocol.isLoading()
+                        && staProtocol.isInEnable()
+                        && staProtocol.isEmptyMk()
+                        && (staProtocol.getWorkNo() == 0 || (staProtocol.getWorkNo()>9899 && staProtocol.getWorkNo()<10000) )
+                ) {
+                    try {
+                        BasDevp basDevp = basDevpService.selectById(driveSta.getStaNo());
+                        if (basDevp.getReportSign()>0){
+                            continue;
+                        }
+                        basDevp.setBarcode(barcode);
+                        basDevp.setReportSign(1);
+                        basDevpService.updateById(basDevp);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    }
+                }
+            }
+        }
+    }
+
+    /**
      * wms鍏ュ簱
      * 鍏ュ簱绔欙紝鏍规嵁鏉$爜鎵弿鐢熸垚鍏ュ簱宸ヤ綔妗o紝宸ヤ綔鐘舵�� 1 ==>> 2
      */
@@ -235,7 +291,7 @@
         // 鏍规嵁杈撻�佺嚎plc閬嶅巻
         for (DevpSlave devp : slaveProperties.getDevp()) {
             // 閬嶅巻鍏ュ簱鍙�
-            for (DevpSlave.Sta inSta : devp.getInSta()) {
+            for (DevpSlave.Sta inSta : devp.getInWmsSta()) {
                 // 鑾峰彇鍏ュ簱绔欎俊鎭�
                 SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                 StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
@@ -246,9 +302,9 @@
                 }
 
 //                // 鍏ュ嚭搴撴ā寮忓垽鏂�
-                if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) {
-                    continue;
-                }
+//                if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) {
+//                    continue;
+//                }
 
                 // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
                 if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
@@ -3147,6 +3203,7 @@
                 // 鍑哄簱妯″紡
                 switch (wrkMast.getIoType()) {
                     case 1:
+                    case 202:
                         ledCommand.setTitle("鍏ㄦ澘鍏ュ簱");
                         break;
                     case 10:
@@ -3185,27 +3242,28 @@
             Set<Integer> workNos = wrkMasts.stream().map(WrkMast::getWrkNo).collect(Collectors.toSet());
             // 鑾峰彇LED绾跨▼
             LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
-            // 鐩稿悓宸ヤ綔鍙烽泦鍚堝垯杩囨护
-            if (CollectionUtils.equals(ledThread.getWorkNos(), workNos)) {
-                continue;
-            }
+//            // 鐩稿悓宸ヤ綔鍙烽泦鍚堝垯杩囨护
+//            if (CollectionUtils.equals(ledThread.getWorkNos(), workNos)) {
+//                continue;
+//            }
             // 鍛戒护涓嬪彂 -------------------------------------------------------------------------------
             if (!commands.isEmpty()) {
-                if (led.getId() == 7) {
+//                if (led.getId() == 7) {
                     if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) {
                         log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
                         continue;
                     } else {
                         ledThread.setLedMk(false);
                     }
-                } else {
-                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) {
-                        log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
-                        continue;
-                    } else {
-                        ledThread.setLedMk(false);
-                    }
-                }
+//                }
+//                else {
+//                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) {
+//                        log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
+//                        continue;
+//                    } else {
+//                        ledThread.setLedMk(false);
+//                    }
+//                }
 
             }
 
@@ -3954,7 +4012,7 @@
                 if (staProtocol.isAutoing()
                         && staProtocol.isLoading()
                         && staProtocol.isInEnable()
-                        && staProtocol.getWorkNo() == 0
+                        && (staProtocol.getWorkNo() == 0 || (staProtocol.getWorkNo()>9899 && staProtocol.getWorkNo()<10000))
                 ) {//&& staProtocol.isPakMk() && !Cools.isEmpty(barcode)) {
 
                     //浠诲姟瀹屾垚
@@ -4601,7 +4659,7 @@
                         && rgvProtocol.getTaskNo1()==0
                         && rgvProtocol.getTaskNo2()==0
                 ) {
-                    BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+                    BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvSlave.getId());
                     basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
                     rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
                 }

--
Gitblit v1.9.1