From 136717ef591afb69723440be32b99cbdc6a48407 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期二, 25 七月 2023 18:03:01 +0800
Subject: [PATCH] #码垛位自动补充空板:码垛完成下一步执行实装

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   36 ++++++++++++++++++++++++++++++++++++
 src/main/java/com/zy/asrs/mapper/WrkMastMapper.java         |   10 ++++++++++
 src/main/resources/mapper/WrkMastMapper.xml                 |    5 +++++
 3 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java b/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
index 69829aa..e5bbc0b 100644
--- a/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
@@ -231,6 +231,16 @@
      */
     List<WrkMast> selectDischargingMachineOutputTray();
 
+    /**
+     * 鐮佸灈瀹屾垚椹卞姩鎵樼洏涓嬩竴姝ユ壂鐮佸叆搴�
+     */
+    List<WrkMast> selectStackingCompletionDriveTray();
+    /**
+     * 鐮佸灈瀹屾垚椹卞姩鎵樼洏涓嬩竴姝ユ壂鐮佸叆搴�
+     * @param wrkNo
+     */
+    @Update("update asr_wrk_mast set wrk_sts=44 where 1=1 and wrk_no=#{wrkNo}")
+    int updateStackingCompletionDriveTray(@Param("wrkNo")Integer wrkNo);
 
     int selectConfigCount10468N();
     // update Config  -- Y
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 f27ee8b..0fd8d37 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -3279,7 +3279,43 @@
      */
     public synchronized void stackingCompletionDriveTray() {
         try {
+            List<WrkMast> wrkMasts = wrkMastMapper.selectStackingCompletionDriveTray();
+            if (Cools.isEmpty(wrkMasts) || wrkMasts.size()==0){
+                return;
+            }
 
+            for (WrkMast wrkMast : wrkMasts){
+                wrkMast.setWrkSts(44L);
+                // 鑾峰彇鍏ュ簱绔欎俊鎭�
+                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
+                StaProtocol staProtocol = devpThread.getStation().get(wrkMast.getStaNo());
+                if (staProtocol == null) {
+                    log.error("鐮佸灈浣嶈嚜鍔ㄨˉ鍏呯┖鏉匡細椹卞姩鎷嗙洏鏈鸿緭鍑烘墭鐩橈紝浠诲姟涓嬪彂澶辫触锛岀珯鐐规煡璇㈠け璐�");
+                    return;
+                } else {
+                    staProtocol = staProtocol.clone();
+                }
+
+                if (!staProtocol.isLoading()){
+                    log.info("鐮佸灈浣嶈嚜鍔ㄨˉ鍏呯┖鏉匡細椹卞姩鎷嗙洏鏈鸿緭鍑烘墭鐩橈紝浠诲姟涓嬪彂澶辫触锛岀珯鐐规棤鐗╋紝姝e湪鑷姩璋冨嚭绌烘澘锛�");
+                    return;
+                }
+                // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
+                if (staProtocol.isAutoing() && staProtocol.getWorkNo().equals(wrkMast.getWrkNo().shortValue()) && staProtocol.isPakMk()) {
+                    staProtocol.setWorkNo((short)9999);
+                    int staNo = wrkMast.getStaNo() + 1;
+                    staProtocol.setStaNo((short)staNo);
+                    devpThread.setPakMk(staProtocol.getSiteId(), false);
+                    boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocol));
+                    if (!result) {
+                        throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触==>鐮佸灈浣嶈嚜鍔ㄨˉ鍏呯┖鏉匡細椹卞姩鎷嗙洏鏈鸿緭鍑烘墭鐩橈紒");
+                    }
+                    log.info("鐮佸灈浣嶈嚜鍔ㄨˉ鍏呯┖鏉匡細椹卞姩鎷嗙洏鏈鸿緭鍑烘墭鐩橈紝浠诲姟涓嬪彂鎴愬姛锛氬伐浣滃彿9999銆佺洰鏍囩珯214锛�");
+                    wrkMastMapper.updateStackingCompletionDriveTray(wrkMast.getWrkNo());
+                }else {
+                    log.error("鐮佸灈浣嶈嚜鍔ㄨˉ鍏呯┖鏉匡細椹卞姩鎷嗙洏鏈鸿緭鍑烘墭鐩橈紝浠诲姟涓嬪彂澶辫触锛岀珯鐐圭姸鎬佷笉绗﹀悎锛�");
+                }
+            }
         }catch (Exception e){
             e.printStackTrace();
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
diff --git a/src/main/resources/mapper/WrkMastMapper.xml b/src/main/resources/mapper/WrkMastMapper.xml
index d516de5..90dae0a 100644
--- a/src/main/resources/mapper/WrkMastMapper.xml
+++ b/src/main/resources/mapper/WrkMastMapper.xml
@@ -289,6 +289,11 @@
         select * from dbo.asr_wrk_mast where 1=1 and io_type = 201
     </select>
 
+
+    <select id="selectStackingCompletionDriveTray" resultMap="BaseResultMap">
+        select * from dbo.asr_wrk_mast where 1=1 and io_type = 201 and wrk_sts = 43
+    </select>
+
     <select id="selectConfigCount10468N" resultType="java.lang.Integer">
         SELECT COUNT(1) FROM dbo.sys_config Where 1=1 and id=10468 and value = 'N'
     </select>

--
Gitblit v1.9.1