From 42180f49192aaddb9aa5db3469e4ce2c52d540a1 Mon Sep 17 00:00:00 2001
From: ytfl <ytfl@qq.com>
Date: 星期三, 11 六月 2025 15:53:44 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   78 +++++++++++++++++++++------------------
 1 files changed, 42 insertions(+), 36 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 3598430..683625a 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -364,26 +364,30 @@
                     staProtocol = staProtocol.clone();
                 }
 
-                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()) {
+                if (staProtocol.isAutoing()
+                        && staProtocol.isLoading()
+                        && staProtocol.isInEnable()
+                        && staProtocol.getWorkNo() > 0
+                        && staProtocol.isPakMk()) {
                     News.warnNoLog(""+mark+" - 0"+" - 寮�濮嬫墽琛�");
 
-                    // 鑾峰彇鏉$爜鎵弿浠俊鎭�
-                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
-                    if (barcodeThread == null) {
-                        continue;
-                    }
-                    String barcode = barcodeThread.getBarcode();
-                    if(!Cools.isEmpty(barcode)) {
-                        News.info(""+mark+" - 1"+" - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", 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)) {
+//                        News.info(""+mark+" - 1"+" - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
+//                        if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+//                            continue;
+//                        }
+//                    } else {
+//                        continue;
+//                    }
 
-                    WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
-//                    WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
+//                    WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
+                    WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
                     if (wrkMast == null) {
                         // 鏃犳嫞鏂欐暟鎹�
                         continue;
@@ -409,11 +413,11 @@
                             .eq("crn_no", wrkMast.getCrnNo()); // 鍫嗗灈鏈哄彿
                     StaDesc staDesc = staDescService.selectOne(wrapper);
                     if (Cools.isEmpty(staDesc)) {
-                        News.error(""+mark+" - 2"+" - 鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
-                        staProtocol.setWorkNo((short) 9989);
-                        staProtocol.setStaNo((short) (pickSta.getStaNo().shortValue()-(short)1));
-                        devpThread.setPakMk(staProtocol.getSiteId(), false);
-                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+//                        News.error(""+mark+" - 2"+" - 鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
+//                        staProtocol.setWorkNo((short) 9989);
+//                        staProtocol.setStaNo((short) (pickSta.getStaNo().shortValue()-(short)1));
+//                        devpThread.setPakMk(staProtocol.getSiteId(), false);
+//                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                         //LED
                         LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
                         // led 寮傚父鏄剧ず
@@ -464,9 +468,11 @@
                         continue;
                     }
 
+                    LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
                     // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
                     staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
                     staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
+                    staProtocol.setPalletSize(locMast.getLocType2());
                     devpThread.setPakMk(staProtocol.getSiteId(), false);
                     boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                     if (!result) {
@@ -1648,20 +1654,20 @@
 //                ledCommand.setSourceStaNo(wrkMast.getSourceStaNo());
                 if (wrkMast.getIoType() != 110 && wrkMast.getIoType() != 10) {
                     List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
-                    try{
-                        if (wrkMast.getIoType()>100){
-                            for (WrkDetl wrkDetl : wrkDetls){
-                                LocDetl locDetl = locDetlService.selectMatnrSpecs(wrkDetl.getMatnr(), wrkDetl.getSpecs(), wrkMast.getSourceLocNo());
-                                wrkDetl.setWeight(locDetl.getAnfme());
-                            }
-                        }else {
-                            for (WrkDetl wrkDetl : wrkDetls){
-                                wrkDetl.setWeight(wrkDetl.getAnfme());
-                            }
-                        }
-                    }catch (Exception e){
-                        log.error("宸ヤ綔妗f鏄庣粏杈撳叆鐢佃鏈哄け璐�1锛氬紓甯镐俊鎭�==銆�"+e);
-                    }
+//                    try{
+//                        if (wrkMast.getIoType()>100){
+//                            for (WrkDetl wrkDetl : wrkDetls){
+//                                LocDetl locDetl = locDetlService.selectMatnrSpecs(wrkDetl.getMatnr(), wrkDetl.getSpecs(), wrkMast.getSourceLocNo());
+//                                wrkDetl.setWeight(locDetl.getAnfme());
+//                            }
+//                        }else {
+//                            for (WrkDetl wrkDetl : wrkDetls){
+//                                wrkDetl.setWeight(wrkDetl.getAnfme());
+//                            }
+//                        }
+//                    }catch (Exception e){
+//                        log.error("宸ヤ綔妗f鏄庣粏杈撳叆鐢佃鏈哄け璐�1锛氬紓甯镐俊鎭�==銆�"+e);
+//                    }
                     wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(),wrkDetl.getWeight(),wrkDetl.getSpecs(),wrkDetl.getSku())));
                 }
                 commands.add(ledCommand);

--
Gitblit v1.9.1