From 94860d0ab6d9fedf9413b2083eb9af17d8bd7d54 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 28 九月 2022 13:44:11 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   95 +++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 78 insertions(+), 17 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 201904d..258fe03 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -114,11 +114,33 @@
                     }
                     String barcode = barcodeThread.getBarcode();
                     if(!Cools.isEmpty(barcode)) {
-                        log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
-                        if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+//                        log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
+                        if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
+                            staProtocol.setWorkNo((short) 9995);
+                            staProtocol.setStaNo(inSta.getBackSta().shortValue());
+                            devpThread.setPakMk(staProtocol.getSiteId(), false);
+                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+
+                            // led 寮傚父鏄剧ず
+                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+                            if (ledThread != null) {
+                                String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
+                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
+                            }
                             continue;
                         }
                     } else {
+                        staProtocol.setWorkNo((short) 9995);
+                        staProtocol.setStaNo(inSta.getBackSta().shortValue());
+                        devpThread.setPakMk(staProtocol.getSiteId(), false);
+                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+
+                        // led 寮傚父鏄剧ず
+                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+                        if (ledThread != null) {
+                            String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
+                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
+                        }
                         continue;
                     }
 
@@ -235,21 +257,21 @@
                 if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()){
 
                     // 鑾峰彇鏉$爜鎵弿浠俊鎭�
-                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
-                    if (barcodeThread == null) {
-                        continue;
-                    }
-                    String barcode = barcodeThread.getBarcode();
-                    if(!Cools.isEmpty(barcode)) {
-                        log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
-                        if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
-                            continue;
-                        }
-                    } else {
-                        continue;
-                    }
+//                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
+//                    if (barcodeThread == null) {
+//                        continue;
+//                    }
+//                    String barcode = barcodeThread.getBarcode();
+//                    if(!Cools.isEmpty(barcode)) {
+//                        log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
+//                        if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+//                            continue;
+//                        }
+//                    } else {
+//                        continue;
+//                    }
 
-                    WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
+                    WrkMast wrkMast = wrkMastMapper.selectPickStep(staProtocol.getWorkNo());
                     if (wrkMast == null) {
                         // 鏃犳嫞鏂欐暟鎹�
                         continue;
@@ -292,6 +314,9 @@
                         wrkMast.setModiTime(new Date());
                         if (wrkMastMapper.updateById(wrkMast) == 0) {
                             throw new CoolException("鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+                        }
+                        if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) {
+//                            throw new CoolException("鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
                         }
                         // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
                         LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
@@ -2290,7 +2315,43 @@
                     }
                 }
 
-                log.info("{}鍙峰爢鍨涙満瀵箋}搴撲綅杩涜婕旂ず", crn.getId(), locNo);
+//                log.info("{}鍙峰爢鍨涙満瀵箋}搴撲綅杩涜婕旂ず", crn.getId(), locNo);
+
+            // 鑾峰彇绉诲簱宸ヤ綔妗d俊鎭�
+//                WrkMast wrkMast = wrkMastMapper.selectLocMove(crn.getId());
+//                if (null != wrkMast) { continue; }
+//
+//                LocMast sourceLoc = locMastService.queryDemoSourceLoc(crn.getId());
+//                LocMast loc = locMastService.queryDemoLoc(crn.getId());
+//                if (null == sourceLoc || null == loc) { continue; }
+//
+//                String sourceLocNo = sourceLoc.getLocNo();
+//                String locNo = loc.getLocNo();
+//
+//                // 鑾峰彇宸ヤ綔鍙�
+//                int workNo = commonService.getWorkNo(WorkNoType.PICK.type);
+//                // 淇濆瓨宸ヤ綔妗�
+//                wrkMast = new WrkMast();
+//                wrkMast.setWrkNo(workNo);
+//                wrkMast.setIoTime(new Date());
+//                wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
+//                wrkMast.setIoType(11); // 鍏ュ嚭搴撶姸鎬侊細 11.搴撴牸绉昏浇
+//                wrkMast.setIoPri(13D);
+//                wrkMast.setCrnNo(crn.getId());
+//                wrkMast.setSourceLocNo(sourceLocNo); // 婧愬簱浣�
+//                wrkMast.setLocNo(locNo); // 鐩爣搴撲綅
+//                wrkMast.setFullPlt("N"); // 婊℃澘锛歒
+//                wrkMast.setPicking("N"); // 鎷f枡
+//                wrkMast.setExitMk("N"); // 閫�鍑�
+//                wrkMast.setEmptyMk(sourceLoc.getLocSts().equals("D")?"Y":"N"); // 绌烘澘
+//                wrkMast.setBarcode(sourceLoc.getBarcode()); // 鎵樼洏鐮�
+//                wrkMast.setLinkMis("N");
+//                wrkMast.setAppeTime(new Date());
+//                wrkMast.setModiTime(new Date());
+//                int res = wrkMastMapper.insert(wrkMast);
+//                if (res == 0) {
+//                    throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
+//                }
 
             }
 

--
Gitblit v1.9.1