From f656de144ce68b49401a3bfc12bd6e1c33cbd281 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 25 七月 2023 13:55:16 +0800
Subject: [PATCH] 捡料

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   51 ++++++++++++++++++++++++---------------------------
 1 files changed, 24 insertions(+), 27 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 cd12c60..08aad9e 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -384,6 +384,7 @@
     /**
      * 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱
      */
+    @Transactional
     public synchronized void stnToCrnStnPick(){
         for (DevpSlave devp : slaveProperties.getDevp()) {
             // 閬嶅巻鎷f枡鍏ュ簱鍙�
@@ -399,24 +400,20 @@
                 }
                 if (staProtocol.isAutoing()
                         && staProtocol.isLoading()
-                        // 0 - 9990 鎴栬�� 9996
-                        && (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9990)
+                        && (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9999)
                         && staProtocol.getStaNo().equals(staProtocol.getSiteId().shortValue())
                         && staProtocol.isPakMk()){
 
                     // 鑾峰彇鏉$爜鎵弿浠俊鎭�
-//                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
-//                    if (barcodeThread == null) {
-//                        continue;
-//                    }
+                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
+                    if (barcodeThread == null) {
+                        continue;
+                    }
+                    String barcode = barcodeThread.getBarcode();
 
                     WrkMast wrkMast = null;
-                    if (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9990) {
-                        wrkMast = wrkMastMapper.selectPickStep(staProtocol.getWorkNo());
-                        if (null == wrkMast) {
-                            continue;
-                        }
-                    } else {
+                    wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode);
+                    if (wrkMast == null) {
                         continue;
                     }
 //                    if (staProtocol.getWorkNo() == 9996) {
@@ -456,6 +453,7 @@
 //                            News.error("{}鏉$爜閿欒锛屾殏鏃犳嫞鏂欎换鍔★紒", barcode);
 //                        }
 //                    }
+
                     if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
                         || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) {
                         continue;
@@ -481,18 +479,18 @@
                         if (code.equals(200)) {
                             StartupDto dto = jsonObject.getObject("data", StartupDto.class);
 
-                            // 鑾峰彇鐩爣绔�
-                            Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
-                                    .eq("type_no", wrkMast.getIoType() - 50)
-                                    .eq("stn_no", pickSta.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯
-                                    .eq("crn_no", dto.getCrnNo()); // 鍫嗗灈鏈哄彿
-                            StaDesc staDesc = staDescService.selectOne(wrapper);
-                            if (Cools.isEmpty(staDesc)) {
-                                News.error("鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
-                                continue;
-                            }
-                            // 鍫嗗灈鏈虹珯鐐�(鐩爣绔�)
-                            Integer staNo = staDesc.getCrnStn();
+//                            // 鑾峰彇鐩爣绔�
+//                            Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
+//                                    .eq("type_no", wrkMast.getIoType() - 50)
+//                                    .eq("stn_no", pickSta.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯
+//                                    .eq("crn_no", dto.getCrnNo()); // 鍫嗗灈鏈哄彿
+//                            StaDesc staDesc = staDescService.selectOne(wrapper);
+//                            if (Cools.isEmpty(staDesc)) {
+//                                News.error("鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
+//                                continue;
+//                            }
+//                            // 鍫嗗灈鏈虹珯鐐�(鐩爣绔�)
+//                            Integer staNo = staDesc.getCrnStn();
 
                             // 淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。
 //                        if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) {
@@ -510,8 +508,7 @@
                             wrkMast.setSourceStaNo(pickSta.getStaNo()); // 婧愮珯
                             wrkMast.setStaNo(dto.getStaNo()); // 鐩爣绔�
                             wrkMast.setCrnNo(dto.getCrnNo());
-                            wrkMast.setLocNo(dto.getLocNo()); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
-                            wrkMast.setSourceLocNo(""); // 婧愬簱浣嶆竻绌�
+                            wrkMast.setLocNo(sourceLocNo); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
                             wrkMast.setShuttleNo(null); // 绌挎杞︽竻绌�
                             wrkMast.setModiTime(new Date());
                             if (wrkMastMapper.updateById(wrkMast) == 0) {
@@ -522,7 +519,7 @@
                             }
 
                             // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
-                            LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
+                            LocMast locMast = locMastService.selectById(sourceLocNo);
                             locMast.setLocSts("Q");
                             locMast.setModiTime(new Date());
                             if (!locMastService.updateById(locMast)) {

--
Gitblit v1.9.1