Prechádzať zdrojové kódy

2024/02/04 检查节点给收费系统推送排队改为int型

wk 1 rok pred
rodič
commit
83963fe882

+ 24 - 2
出口引导节点/main_window_XmSgj.py

@@ -1,6 +1,7 @@
 import sys
 import threading
 import time
+from datetime import datetime
 
 from PyQt5 import QtWidgets
 
@@ -113,7 +114,28 @@ class MainWindow(QMainWindow, Ui_MainWindow):
                 #     self.last_command_dict[i] = self.db.query_command_top_number(self.top_number)
 
             time.sleep(0.2)
-
+    def get_time_weight(self):
+        current_time_gour = datetime.now().hour
+        if 0 <= current_time_gour < 7:
+            return 0.6
+        elif 7 <= current_time_gour < 8:
+            return 0.9
+        elif 8 <= current_time_gour < 9:
+            return 1
+        elif 9 <= current_time_gour < 11:
+            return 0.9
+        elif 11 <= current_time_gour < 12:
+            return 0.8
+        elif 12 <= current_time_gour < 14:
+            return 0.7
+        elif 11 <= current_time_gour < 15:
+            return 0.9
+        elif 15 <= current_time_gour < 16:
+            return 0.8
+        elif 16 <= current_time_gour < 21:
+            return 0.7
+        elif 21 <= current_time_gour < 24:
+            return 0.6
     def get_listWidget_item(self, dict, index):
         item = QListWidgetItem()
         item.setFont(QFont('微软雅黑', self.font_size, QFont.Bold))
@@ -139,7 +161,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
                 show_str = "%s %s排队中" % (dict['car_number'], self.get_unit(dict['unit']))
                 if index != 40:
                     show_str = "%s 预计剩%d分钟" % (dict['car_number'],
-                                                int((dict['row_number() over(order by queue_time)']) * 5 *
+                                                round((dict['row_number() over(order by queue_time)']) * 5 * self.get_time_weight() *
                                                     self.pick_wait_weight[index][0]['wait_weight']))
             elif (dict['statu'] == 1):  # 工作
                 item.setForeground(QColor('blue'))

+ 23 - 2
指令检查节点/check_command_XmSgj.py

@@ -565,7 +565,7 @@ class CommandChecker:
             "inRecordId": primary_key,
             "garageNo": self.get_unit_str(unit_id),
             "waitNum": command_count,
-            "remainingTime": command_count * 5 * weight
+            "remainingTime": round(command_count * 5 * weight * self.get_time_weight())
         }
 
         phone_out_dict = {
@@ -588,7 +588,28 @@ class CommandChecker:
                         self.db.update_command_queue_upload_statu_in_car_number(dict['car_number'])
                         print("\n")
             time.sleep(1)
-
+    def get_time_weight(self):
+        current_time_gour = datetime.datetime.now().hour
+        if 0 <= current_time_gour < 7:
+            return 0.6
+        elif 7 <= current_time_gour < 8:
+            return 0.9
+        elif 8 <= current_time_gour < 9:
+            return 1
+        elif 9 <= current_time_gour < 11:
+            return 0.9
+        elif 11 <= current_time_gour < 12:
+            return 0.8
+        elif 12 <= current_time_gour < 14:
+            return 0.7
+        elif 11 <= current_time_gour < 15:
+            return 0.9
+        elif 15 <= current_time_gour < 16:
+            return 0.8
+        elif 16 <= current_time_gour < 21:
+            return 0.7
+        elif 21 <= current_time_gour < 24:
+            return 0.6
     def get_unit_str(self, unit):
         if unit == 11:
             return 'A1'