From 76f9aff5cda7e8471585f41bfd88ce2e819521ba Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期二, 01 十一月 2022 11:13:59 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   48 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 47 insertions(+), 1 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 8435624..19ee97f 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -2458,6 +2458,7 @@
     /**
      * 灏忚溅鐢甸噺妫�娴� ===>> 鍙戣捣鍏呯數
      */
+    @SuppressWarnings("serial")
     public synchronized void loopSteCharge() {
         SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
         for (SteSlave ste : slaveProperties.getSte()) {
@@ -2470,6 +2471,7 @@
                 if (steProtocol.getMode() == 0
                         || !steProtocol.statusType.equals(SteStatusType.IDLE)
                         || basSte.getPakMk().equals("Y")
+                        || basSte.getAutoCharge().equals("N")
 //                        || steProtocol.getChargeStatus() == 1
                 ) {
                     continue;
@@ -2484,7 +2486,33 @@
 
                 if (wrkCharge == null && steProtocol.getChargeStatus() == 0) {
                     // 瀵绘壘绌洪棽鍏呯數妗�
-                    SteChargeType steCharge = devpThread.getIdleChargeLocNo();
+                    SteChargeType steCharge = null;
+                    do {
+                        String locNo;
+                        if (!devpThread.charge0) {
+                            locNo = SteChargeType.FIRST.locNo;
+                            if (basSteService.hasCarOfLocNo(locNo) == null) {
+                                steCharge = SteChargeType.FIRST;
+                                break;
+                            }
+                        }
+                        if (!devpThread.charge1) {
+                            locNo = SteChargeType.SECOND.locNo;
+                            if (basSteService.hasCarOfLocNo(locNo) == null) {
+                                steCharge = SteChargeType.SECOND;
+                                break;
+                            }
+                        }
+                        if (!devpThread.charge2) {
+                            locNo = SteChargeType.THIRD.locNo;
+                            if (basSteService.hasCarOfLocNo(locNo) == null) {
+                                steCharge = SteChargeType.THIRD;
+                                break;
+                            }
+                        }
+                        break;
+                    } while (false);
+
                     if (steCharge == null) {
                         log.warn("{}鍙峰皬杞︺�愮數閲忥細{}銆戝厖鐢靛け璐ワ紝鍘熷洜锛氭病鏈夌┖闂插厖鐢垫々銆�", ste.getId(), steProtocol.getCharge());
                         continue;
@@ -2644,6 +2672,24 @@
         }
     }
 
+    /**
+     * 灏忚溅浠庡厖鐢垫々 鑷� 寰呮満搴撲綅
+     */
+    public synchronized void steFromChargeToIdleLoc() {
+        for (SteChargeType value : SteChargeType.values()) {
+            Integer steNo = basSteService.hasCarOfLocNo(value.locNo);
+            if (steNo != null) {
+                SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
+                SteProtocol steProtocol = steThread.getSteProtocol();
+                BasSte basSte = basSteService.selectById(steNo);
+                if (Cools.isEmpty(steProtocol, basSte)) {
+                    continue;
+                }
+
+            }
+        }
+    }
+
 
     /**
      * 鍥犲弻娣卞簱浣嶉樆濉烇紝瀵规祬搴撲綅杩涜绉昏浆锛堝嚭搴撶増)

--
Gitblit v1.9.1