From db479403cb04f33586584844d9cbdde513201712 Mon Sep 17 00:00:00 2001
From: lsh <1>
Date: 星期四, 18 七月 2024 15:42:19 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  100 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 100 insertions(+), 0 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 1174b53..b38bf97 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -8016,5 +8016,105 @@
         }
         return false;
     }
+    /**
+     * 鍏朵粬  ===>> 607鍒嗛厤纭寲缃�
+     */
+    public synchronized void stackingCompletionDriveTray() {
+        Integer staNo1 = jarGetStartStaNo(607);
+        if (staNo1!=0){
+            SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 2);
+            StaProtocol staProtocol607 = devpThread.getStation().get(607);
+            staProtocol607.setStaNo(staNo1);
+            boolean result2 = MessageQueue.offer(SlaveType.Devp, 2, new Task(5, staProtocol607));
+        }
+    }
+    public synchronized Integer jarGetStartStaNo(Integer staNo) {
+        try {
+            int[] jarNos=new int[]{1,2,3,4};//(607鍒嗛厤纭寲缃�)
+            ArrayList<Integer> staNos = new ArrayList<Integer>() {{
+                add(607);add(608);add(609);add(610);add(611);add(612);
+                add(613);add(614);add(615);add(616);add(617);add(618);
+                add(619);add(620);add(621);add(622);
+            }};
+            ArrayList<Integer> jarNoList = new ArrayList<>();
+            ArrayList<Integer> jarNoListNow = new ArrayList<>();
+            for (int jarNo : jarNos) {
+                List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarNo, new ArrayList<Integer>() {{
+                    add(0);
+                    add(1);
+                    add(2);
+                    add(3);
+                    add(4);
+                }});
+                if (basJarMastList.isEmpty()){
+                    continue;
+                }
+                if (basJarMastList.size()>0 && basJarMastList.size()<7){
+                    jarNoList.add(jarNo);
+                }
+            }
+            jarNoList.add(4);
+            jarNoList.add(2);
+            jarNoList.add(3);
+            jarNoList.add(1);
+            for (int jarNo : jarNoList) {
+                if (jarNoListNow.contains(jarNo)){
+                    continue;
+                }
+                // 鑾峰彇纭寲缃愪俊鎭�
+                JarThread jarThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarNo);
+                JarProtocol jarProtocol = jarThread.getJarProtocol();
+                if (jarProtocol == null) {
+                    continue;
+                }
+                if (jarProtocol.modeType != JarModeType.AUTO){
+                    continue;
+                }
+                if (jarProtocol.statusType .equals(JarStatusType.SOS)){
+                    continue;
+                }
+                if (jarProtocol.getJarTemperature()>50){
+                    log.error("{}鍙风~鍖栫綈鏌ヨ璁惧娓╁害杩囬珮锛岀瓑寰呴檷娓�....锛侊紒锛�",jarProtocol.getJarNo());
+                    continue;
+                }
+
+                BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
+                if (Cools.isEmpty(basJar)){
+                    log.error("{}鍙风~鍖栫綈鏌ヨ璁惧妗f鏃犱俊鎭紒锛侊紒",jarProtocol.getJarNo());
+                    continue;
+                }
+                List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarNo, new ArrayList<Integer>() {{
+                    add(0);
+                    add(1);
+                    add(2);
+                    add(3);
+                    add(4);
+                }});
+                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2);
+                Integer count = basJarMastList.size();
+                Integer staNoEnd = 0;
+                ArrayList<Integer> wrkNoList = new ArrayList<>();
+
+                for (Integer staNoEnt : staNos){
+                    StaProtocol staProtocolEnt = devpThread.getStation().get(staNoEnt);
+                    if (staProtocolEnt != null && staProtocolEnt.getWorkNo()!=0 && !wrkNoList.contains(staProtocolEnt.getWorkNo())){
+                        if (staProtocolEnt.getStaNo().equals(basJar.getEntStaNo$())){
+                            count++;
+                            staNoEnd = staProtocolEnt.getWorkNo();
+                            wrkNoList.add(staProtocolEnt.getWorkNo());
+                        }
+                    }
+                }
+                if (count<7){
+                    return staNoEnd;
+                }
+            }
+        }catch (Exception e){
+//            e.printStackTrace();
+//            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            log.error("鍏朵粬  ===>> 鍒嗛厤纭寲缃愯繘鍏ヤ笅涓�姝�"+e);
+        }
+        return 0;
+    }
 
 }

--
Gitblit v1.9.1