From af6fed7d45038a8696ecaa41e8b9a509df68e63e Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期一, 04 十二月 2023 13:37:11 +0800
Subject: [PATCH] #redis 同步set

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  161 +++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 135 insertions(+), 26 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 946c4de..40645e0 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -405,6 +405,9 @@
         for (DevpSlave devp : slaveProperties.getDevp()) {
             // 閬嶅巻鎷f枡鍏ュ簱鍙�
             for (DevpSlave.Sta pickSta : devp.getPickInSta()) {
+                if (pickSta.getStaNo() == 325 || pickSta.getStaNo() == 331 || pickSta.getStaNo() == 333 || pickSta.getStaNo() == 339) {
+                    continue;
+                }
 
                 // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
                 DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
@@ -420,26 +423,124 @@
 //                        && (staProtocol.getWorkNo() > 0)
                         && staProtocol.isPakMk()){
 
-                    WrkMast wrkMast = null;
-                    if (staProtocol.getWorkNo() > 0) {//瀛樺湪宸ヤ綔鍙凤紝鍒╃敤宸ヤ綔鍙锋悳绱换鍔�
-                        wrkMast = wrkMastMapper.selectByWorkNo(staProtocol.getWorkNo().intValue());
-                    }else {
-                        //涓嶅瓨鍦ㄥ伐浣滃彿锛屼緷闈犳墭鐩樻潯鐮佹悳绱�
-                        // 鑾峰彇鏉$爜鎵弿浠俊鎭�
-                        BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
-                        if (barcodeThread == null) {
-                            continue;
-                        }
-                        String barcode = barcodeThread.getBarcode();
-                        if(Cools.isEmpty(barcode)) {
-                            continue;
-                        }
-                        if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
-                            continue;
-                        }
-                        wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode);
+                    // 鑾峰彇鏉$爜鎵弿浠俊鎭�
+                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
+                    if (barcodeThread == null) {
+                        continue;
+                    }
+                    String barcode = barcodeThread.getBarcode();
+                    if(Cools.isEmpty(barcode)) {
+                        continue;
+                    }
+                    if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
+                        continue;
                     }
 
+                    WrkMast wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode);
+                    if (wrkMast == null) {//鎵句笉鍒板伐浣滄。
+                        continue;
+                    }
+
+                    if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
+                            || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) {
+                        continue;
+                    }
+
+                    //*********************鍚屽簱浣嶇粍鏍¢獙*********************
+                    boolean flag = false;
+                    String th = "";
+                    List<String> innerLoc = Utils.getGroupInnerLoc(wrkMast.getSourceLocNo());
+                    for (String loc : innerLoc) {
+                        LocMast locMast = locMastService.selectById(loc);
+                        if (locMast == null) {
+                            continue;
+                        }
+
+                        if (!locMast.getLocSts().equals("F")) {
+                            flag = true;
+                            th = loc + "搴撲綅瀛樺湪鏈洖搴撲换鍔�";
+                            break;
+                        }
+                    }
+                    if (flag) {
+                        News.info(th);
+                        continue;
+                    }
+                    //*********************鍚屽簱浣嶇粍鏍¢獙*********************
+
+                    // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
+                    if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
+                        News.info(wrkMast.getWrkNo() + "淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
+                        continue;
+                    }
+
+                    String sourceLocNo = wrkMast.getSourceLocNo().trim();
+                    LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(pickSta.getLiftNo(), Utils.getLev(sourceLocNo));//鑾峰彇鍥炲簱鎻愬崌鏈虹洰鏍囩珯
+                    if (liftStaProtocol == null) {
+                        continue;
+                    }
+
+                    // 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
+                    wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
+                    wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
+                    wrkMast.setSourceStaNo(pickSta.getBackSta()); // 婧愮珯
+//                            wrkMast.setStaNo(dto.getStaNo()); // 鐩爣绔�
+//                            wrkMast.setCrnNo(dto.getCrnNo());
+                    wrkMast.setStaNo(liftStaProtocol.getStaNo());//鐩爣绔�
+                    wrkMast.setLocNo(sourceLocNo); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
+                    wrkMast.setShuttleNo(null); // 绌挎杞︽竻绌�
+                    wrkMast.setLiftNo(null);// 鎻愬崌鏈烘竻绌�
+                    wrkMast.setModiTime(new Date());
+                    if (wrkMastMapper.updateById(wrkMast) == 0) {
+                        News.info(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+                        continue;
+                    }
+                    if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) {
+                        News.info(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+                        continue;
+                    }
+
+                    // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
+                    LocMast locMast = locMastService.selectById(sourceLocNo);
+                    locMast.setLocSts("Q");
+                    locMast.setModiTime(new Date());
+                    if (!locMastService.updateById(locMast)) {
+                        News.info("淇敼搴撲綅鐘舵�佸け璐�");
+                        continue;
+                    }
+                }
+            }
+
+        }
+    }
+
+    /**
+     * 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱(325銆�331銆�333銆�339)
+     */
+    @Transactional
+    public synchronized void stnToCrnStnPick2(){
+        for (DevpSlave devp : slaveProperties.getDevp()) {
+            // 閬嶅巻鎷f枡鍏ュ簱鍙�
+            for (DevpSlave.Sta pickSta : devp.getPickInSta()) {
+                if (!(pickSta.getStaNo() == 325 || pickSta.getStaNo() == 331 || pickSta.getStaNo() == 333 || pickSta.getStaNo() == 339)) {
+                    continue;
+                }
+
+                // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
+                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+                StaProtocol staProtocol = devpThread.getStation().get(pickSta.getStaNo());
+                if (staProtocol == null) {
+                    continue;
+                } else {
+                    staProtocol = staProtocol.clone();
+                }
+                if (staProtocol.isAutoing()
+                        && staProtocol.isLoading()
+                        && staProtocol.isInEnable()
+                        && (staProtocol.getWorkNo() > 0)
+                        && staProtocol.isPakMk()){
+
+                    WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol.getWorkNo().intValue());
                     if (wrkMast == null) {//鎵句笉鍒板伐浣滄。
                         continue;
                     }
@@ -512,11 +613,8 @@
                         continue;
                     }
 
-                    if (pickSta.getBackSta() == 325 || pickSta.getBackSta() == 331 || pickSta.getBackSta() == 333 || pickSta.getBackSta() == 339) {
-                        staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());//鍐欏叆宸ヤ綔鍙�
-                        staProtocol.setStaNo(pickSta.getBackSta().shortValue());//鍐欏叆鐩爣绔�
-                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                    }
+                    staProtocol.setStaNo(pickSta.getBackSta().shortValue());//鍐欏叆鐩爣绔�
+                    MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                 }
             }
 
@@ -2391,7 +2489,9 @@
                         RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetls.size(), "303");
                     }
                 }
-            }else if (staProtocol317.isAutoing() && staProtocol317.isLoading() && staProtocol317.getWorkNo() != 0) {
+            }
+
+            if (staProtocol317.isAutoing() && staProtocol317.isLoading() && staProtocol317.getWorkNo() != 0) {
                 //璋冨害鏈烘鑷�
                 //鏌ヨ鏄惁鏈夊伐浣滄。
                 WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol317.getWorkNo().intValue());
@@ -2919,9 +3019,18 @@
                     continue;
                 }
 
-                if (shuttleProtocol.getVoltage() < 5630) {
-                    continue;//鐢靛帇涓嶅缁х画鍏呯數
+                //***************鍒ゆ柇鏄惁婊″厖鏍″噯***************
+                EntityWrapper<Config> wrapper1 = new EntityWrapper<>();
+                wrapper.eq("code", "shuttleMaxPowerVerify");
+                Config config1 = configService.selectOne(wrapper1);
+                if (config1 != null) {
+                    if (config1.getValue().equals("true")) {
+                        if (shuttleProtocol.getVoltage() < 5630) {
+                            continue;//鐢靛帇涓嶅缁х画鍏呯數
+                        }
+                    }
                 }
+                //***************鍒ゆ柇鏄惁婊″厖鏍″噯***************
 
                 //灏忚溅婊$數锛岀粨鏉熷厖鐢典换鍔�
                 NyShuttleHttpCommand chargeCommand = NyHttpUtils.getChargeCommand(shuttle.getId(), wrkCharge.getWrkNo(), false);

--
Gitblit v1.9.1