Browse Source

2022/01/10 入口L液晶屏程序完成调试 管理节点完成第一版(暂未显示存车流程)

wk 2 years ago
parent
commit
16ec3ffb3c

+ 6 - 5
入口引导提示节点/window_screen_pyqt.py

@@ -214,11 +214,7 @@ class Frame(QMainWindow):
         is_moving = ((border_statu >> 11) & 0x01) == 1
         lidar_statu=measure_info.ground_status  # 测量状态(正常,无数据、噪声、超界)
 
-        if self.last_moving_statu is None and lidar_statu==MeasureStatu["噪声"] and self.flag is True:
-            self.panel_txt.ShowImg(self.images["检查杂物"])
-            self.panel_arrow.ShowImg(self.images["检查杂物"])
-            self.last_show = "检查杂物"
-            return
+
 
         if is_moving:
             self.last_moving_statu=None
@@ -261,6 +257,11 @@ class Frame(QMainWindow):
             self.last_show="空闲"
             return
         elif lidar_statu==MeasureStatu["噪声"]:
+            if self.last_moving_statu is None and self.flag is True:
+                self.panel_txt.ShowImg(self.images["检查杂物"])
+                self.panel_arrow.ShowImg(self.images["检查杂物"])
+                self.last_show = "检查杂物"
+                return
             if self.last_show=="超时":
                 self.panel_txt.ShowImg(self.images["空闲"])
                 self.panel_arrow.ShowImg(self.images["空闲"])

+ 44 - 0
入口液晶显示屏/db_config.py

@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# -*- coding:utf-8 -*-
+# author:SunXiuWen
+# make_time:2019/1/13
+# -*- coding: UTF-8 -*-
+import pymysql
+
+# 数据库信息
+# DB_TEST_HOST = "192.168.1.233"
+DB_TEST_HOST = "127.0.0.1"
+
+DB_TEST_PORT = 3306
+DB_TEST_DBNAME = "ct_project"
+# DB_TEST_USER = "zx"
+# DB_TEST_PASSWORD = "zx123456"
+DB_TEST_USER = "root"
+DB_TEST_PASSWORD = "123456"
+
+# 数据库连接编码
+DB_CHARSET = "utf8"
+
+# mincached : 启动时开启的闲置连接数量(缺省值 0 开始时不创建连接)
+DB_MIN_CACHED = 10
+
+# maxcached : 连接池中允许的闲置的最多连接数量(缺省值 0 代表不闲置连接池大小)
+DB_MAX_CACHED = 10
+
+# maxshared : 共享连接数允许的最大数量(缺省值 0 代表所有连接都是专用的)如果达到了最大数量,被请求为共享的连接将会被共享使用
+DB_MAX_SHARED = 20
+
+# maxconnecyions : 创建连接池的最大数量(缺省值 0 代表不限制)
+DB_MAX_CONNECYIONS = 100
+
+# blocking : 设置在连接池达到最大数量时的行为(缺省值 0 或 False 代表返回一个错误<toMany......> 其他代表阻塞直到连接数减少,连接被分配)
+DB_BLOCKING = True
+
+# maxusage : 单个连接的最大允许复用次数(缺省值 0 或 False 代表不限制的复用).当达到最大数时,连接会自动重新连接(关闭和重新打开)
+DB_MAX_USAGE = 0
+
+# setsession : 一个可选的SQL命令列表用于准备每个会话,如["set datestyle to german", ...]
+DB_SET_SESSION = None
+
+# creator : 使用连接数据库的模块
+DB_CREATOR = pymysql

+ 60 - 0
入口液晶显示屏/db_operation.py

@@ -0,0 +1,60 @@
+import threading
+import time
+import mysqlhelper
+class DBOperation(threading.Thread):
+    def __init__(self):
+        threading.Thread.__init__(self)
+        self._space_dict = {1:{},2:{},3:{}}
+        self._command_dict = {1:{},2:{},3:{}}
+
+        self._db = mysqlhelper.MySqLHelper()
+        self._isClose = False
+    def close(self):
+        self._isClose = True
+
+    def query_command_in_unit(self, unit):
+        sql = "select * from command_queue WHERE unit=%s"
+        return self._db.selectall(sql, unit)
+    def query_command_in_unit_and_type(self, unit,type):
+        sql = "select * from command_queue WHERE unit=%s and type=%s ORDER BY statu DESC"
+        return self._db.selectall(sql, (unit,type))
+    def query_command_all(self):
+        sql = "select * from command_queue"
+        return self._db.selectall(sql)
+    def query_space_in_unit(self,unit):
+        sql = "select * from space WHERE unit=%s"
+        return self._db.selectall(sql,unit)
+    def query_space_all(self):
+        sql = "select * from space"
+        return self._db.selectall(sql)
+    def update_space_status(self,space_id,statu):
+        sql = "update space set statu=%s where id=%s"
+        return self._db.update(sql,(statu,space_id))
+    def clear_space_data(self,space_id):
+        sql = "update space set car_number=NULL where id=%s"
+        return self._db.update(sql,space_id)
+    def query_vehicle_primary_key(self,car_number):
+        sql = "select primary_key from vehicle where car_number=%s"
+        return self._db.selectall(sql,car_number)
+    def delete_command(self,car_number):
+        sql = "delete from command_queue where car_number=%s"
+        return self._db.delete(sql,car_number)
+    def get_space_dict(self):
+        return self._space_dict
+    def get_command_dict(self):
+        return self._command_dict
+    def get_pick_command_dict(self):
+        return self._command_dict
+    def run(self):
+        while not self._isClose:
+            for unit in range(1,4):
+                res = self.query_space_in_unit(unit)
+                if len(res) > 0 and self._space_dict[unit] != res:
+                    self._space_dict[unit] = res
+
+            for unit in range(1,4):
+                res = self.query_command_in_unit(unit)
+                if len(res) > 0 and self._command_dict[unit] != res:
+                    self._command_dict[unit] = res
+
+            time.sleep(0.001)

+ 0 - 88
入口液晶显示屏/db_query.py

@@ -1,88 +0,0 @@
-import time
-import threading
-import pymysql as psql
-
-class DBQuery(threading.Thread):
-    def __init__(self,ip,port,database,user,password):
-        threading.Thread.__init__(self)
-        self.ip=ip
-        self.port=port
-        self.database=database
-        self.user=user
-        self.password=password
-        self.conn=psql.connect(host=self.ip,port=self.port,database=self.database,charset="utf8",user=self.user,passwd=self.password)
-        self.unit_cmd_1=None
-        self.unit_cmd_2=None
-        self.unit_cmd_3=None
-        self.isClose = False
-        self.callback = None
-    def Close(self):
-        self.isClose = True
-    def setCallback(self,callback):
-        self.callback = callback
-    def connect(self):
-        try:
-            self.conn = psql.connect(host=self.ip, port=self.port, database=self.database, charset="utf8",
-                                        user=self.user, passwd=self.password)
-            return True
-        except:
-            return False
-    def run(self):
-        while self.isClose is False:
-            try:
-                self.conn.ping()  # 采用连接对象的ping()函数检测连接状态
-            except:
-                self.connect()
-                time.sleep(0.5)
-                continue
-            #获取一个光标
-            cursor = self.conn.cursor()
-            #查询指令队列所有信息
-            SQL1="select * from command_queue where unit = 1 and type = 2 order by queue_id ASC;"
-            SQL2="select * from command_queue where unit = 2 and type = 2 order by queue_id ASC;"
-            SQL3="select * from command_queue where unit = 3 and type = 2 order by queue_id ASC;"
-            cmd_dict1 = {}
-            cmd_dict2 = {}
-            cmd_dict3 = {}
-
-            #执行语句 返回结果数量
-            command_count=cursor.execute(SQL1)
-            self.conn.commit()
-            #结果数量大于0
-            if(command_count > 0):
-                queue_cmd=cursor.fetchall()
-                column=[index[0] for index in cursor.description  ]# 列名
-                cmd_dict1 = [dict(zip(column, row)) for row in queue_cmd]  # row是数据库返回的一条一条记录,其中的每一天和column写成字典,最后就是字典数组
-
-            command_count=cursor.execute(SQL2)
-            self.conn.commit()
-            #结果数量大于0
-            if(command_count > 0):
-                queue_cmd=cursor.fetchall()
-                column=[index[0] for index in cursor.description  ]# 列名
-                cmd_dict2 = [dict(zip(column, row)) for row in queue_cmd]  # row是数据库返回的一条一条记录,其中的每一天和column写成字典,最后就是字典数组
-
-            command_count=cursor.execute(SQL3)
-            self.conn.commit()
-            #结果数量大于0
-            if(command_count > 0):
-                queue_cmd=cursor.fetchall()
-                column=[index[0] for index in cursor.description  ]# 列名
-                cmd_dict3 = [dict(zip(column, row)) for row in queue_cmd]  # row是数据库返回的一条一条记录,其中的每一天和column写成字典,最后就是字典数组
-
-            if(cmd_dict1 != self.unit_cmd_1):
-                self.unit_cmd_1 = cmd_dict1.copy()
-                if self.callback is not None and len(self.unit_cmd_1) != 0:
-                    self.callback(self.unit_cmd_1,1)
-
-            if(cmd_dict2 != self.unit_cmd_2):
-                self.unit_cmd_2 = cmd_dict2.copy()
-                if self.callback is not None and len(self.unit_cmd_2) != 0:
-                    self.callback(self.unit_cmd_2,2)
-            if(cmd_dict3 != self.unit_cmd_3):
-                self.unit_cmd_3 = cmd_dict3.copy()
-                if self.callback is not None and len(self.unit_cmd_3) != 0:
-                    self.callback(self.unit_cmd_3,3)
-            # 关闭光标
-            cursor.close()
-            time.sleep(1)

BIN
入口液晶显示屏/log.jpg


+ 191 - 0
入口液晶显示屏/mysqlhelper.py

@@ -0,0 +1,191 @@
+#!/usr/bin/env python
+# -*- coding:utf-8 -*-
+# author:SunXiuWen
+# make_time:2019/1/13
+import pymysql
+from DBUtils.PooledDB import PooledDB
+import db_config as config
+
+"""
+@功能:创建数据库连接池
+"""
+
+class MyConnectionPool(object):
+    __pool = None
+
+    # 创建数据库连接conn和游标cursor
+    def __enter__(self):
+        self.conn = self.__getconn()
+        self.cursor = self.conn.cursor()
+
+    # 创建数据库连接池
+    def __getconn(self):
+        if self.__pool is None:
+            self.__pool = PooledDB(
+                creator=config.DB_CREATOR,
+                mincached=config.DB_MIN_CACHED,
+                maxcached=config.DB_MAX_CACHED,
+                maxshared=config.DB_MAX_SHARED,
+                maxconnections=config.DB_MAX_CONNECYIONS,
+                blocking=config.DB_BLOCKING,
+                maxusage=config.DB_MAX_USAGE,
+                setsession=config.DB_SET_SESSION,
+                host=config.DB_TEST_HOST,
+                port=config.DB_TEST_PORT,
+                user=config.DB_TEST_USER,
+                passwd=config.DB_TEST_PASSWORD,
+                db=config.DB_TEST_DBNAME,
+                use_unicode=True,
+                charset=config.DB_CHARSET
+            )
+        return self.__pool.connection()
+
+    # 释放连接池资源
+    def __exit__(self, exc_type, exc_val, exc_tb):
+        self.cursor.close()
+        self.conn.close()
+
+    # 从连接池中取出一个连接
+    def getconn(self):
+        conn = self.__getconn()
+        cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)
+        return cursor, conn
+
+
+"""执行语句查询有结果返回结果没有返回0;增/删/改返回变更数据条数,没有返回0"""
+
+
+
+class MySqLHelper(object):
+    def __init__(self):
+        self.db = MyConnectionPool()  # 从数据池中获取连接
+
+    def __new__(cls, *args, **kwargs):
+        if not hasattr(cls, 'inst'):  # 单例
+            cls.inst = super(MySqLHelper, cls).__new__(cls, *args, **kwargs)
+        return cls.inst
+
+    # 封装执行命令
+    def execute(self, sql, param=None, autoclose=False):
+        """
+        【主要判断是否有参数和是否执行完就释放连接】
+        :param sql: 字符串类型,sql语句
+        :param param: sql语句中要替换的参数"select %s from tab where id=%s" 其中的%s就是参数
+        :param autoclose: 是否关闭连接
+        :return: 返回连接conn和游标cursor
+        """
+        cursor, conn = self.db.getconn()  # 从连接池获取连接
+        count = 0
+        try:
+            # count : 为改变的数据条数
+            if param:
+                count = cursor.execute(sql, param)
+            else:
+                count = cursor.execute(sql)
+            conn.commit()
+            if autoclose:
+                self.close(cursor, conn)
+        except Exception as e:
+            print("db error_msg:", e.args)
+        return cursor, conn, count
+
+    # 释放连接
+    def close(self, cursor, conn):
+        """释放连接归还给连接池"""
+        cursor.close()
+        conn.close()
+
+    # 查询所有
+    def selectall(self, sql, param=None):
+        try:
+            cursor, conn, count = self.execute(sql, param)
+            res = cursor.fetchall()
+            return res
+        except Exception as e:
+            print("db error_msg:", e.args)
+            self.close(cursor, conn)
+            return count
+
+    # 查询单条
+    def selectone(self, sql, param=None):
+        try:
+            cursor, conn, count = self.execute(sql, param)
+            res = cursor.fetchone()
+            self.close(cursor, conn)
+            return res
+        except Exception as e:
+            print("db error_msg:", e.args)
+            self.close(cursor, conn)
+            return count
+
+    # 增加
+    def insertone(self, sql, param):
+        try:
+            cursor, conn, count = self.execute(sql, param)
+            conn.commit()
+            self.close(cursor, conn)
+            return count
+        except Exception as e:
+            print("db error_msg:", e.args)
+            conn.rollback()
+            self.close(cursor, conn)
+            return count
+
+    # 删除
+    def delete(self, sql, param=None):
+        try:
+            cursor, conn, count = self.execute(sql, param)
+            conn.commit()
+            self.close(cursor, conn)
+            return count
+        except Exception as e:
+            print("db error_msg:", e.args)
+            conn.rollback()
+            self.close(cursor, conn)
+            return count
+
+    # 修改
+    def update(self, sql, param=None):
+        try:
+            cursor, conn, count = self.execute(sql, param)
+            conn.commit()
+            self.close(cursor, conn)
+            return count
+        except Exception as e:
+            print("db error_msg:", e.args)
+            conn.rollback()
+            self.close(cursor, conn)
+            return count
+
+
+if __name__ == '__main__':
+    db = MySqLHelper()
+    while True:
+        sql1 = 'select * from space where unit=%s'
+        args = '2'
+        ret = db.selectone(sql=sql1, param=args)
+        print(ret)  # (79, 2, 1, 2.2, None, 2, 1)
+    # 查询单条
+    sql1 = 'select * from space where unit=%s'
+    args = '2'
+    ret = db.selectone(sql=sql1, param=args)
+    print(ret)  # (79, 2, 1, 2.2, None, 2, 1)
+    #查询所有
+    sql2 = "select * from space"
+    ret = db.selectall(sql=sql2)
+    print(ret)
+    # 增加
+    sql3 = 'insert into vehicle (car_number,primary_key) VALUES (%s,%s)'
+    ret = db.insertone(sql3, ('鄂A6X3B0','DASDASDEFDFSDASDADASDAS'))
+    print(ret)
+    # 删除
+    sql4 = 'delete from vehicle WHERE car_number=%s'
+    args = '鄂A6X3B0'
+    ret = db.delete(sql4, args)
+    print(ret)
+    # 修改
+    sql5 = 'update command_queue set export_id=%s WHERE car_number LIKE %s'
+    args = ('100', 'WK0001')
+    ret = db.update(sql5, args)
+    print(ret)
+

+ 42 - 33
入口液晶显示屏/node.py

@@ -1,21 +1,13 @@
 import sys
 
-from PyQt5.QtCore import QSize
-from PyQt5.QtGui import QFont, QBrush, QColor
+from PyQt5.QtCore import QSize, QTimer
+from PyQt5.QtGui import QFont, QBrush, QColor, QPixmap
 from PyQt5.QtWidgets import QApplication, QMainWindow, QListWidgetItem
 from ui.ui import Ui_MainWindow
-import db_query
-# db参数
-# db_ip = "192.168.1.233"
-db_ip = "127.0.0.1"
-db_port = 3306
-db_name = "ct_project"
-# db_user = "zx"
-# db_password = "zx123456"
-db_user = "root"
-db_password = "123456"
+import db_operation
 
-class MainWindow(QMainWindow,Ui_MainWindow):
+
+class MainWindow(QMainWindow, Ui_MainWindow):
     def __init__(self, parent=None):
         super(MainWindow, self).__init__(parent)
         self.setupUi(self)
@@ -25,46 +17,63 @@ class MainWindow(QMainWindow,Ui_MainWindow):
         self.B_listWidget.setStyleSheet("border:5px solid #014F84;")
         self.C_listWidget.setGridSize(QSize(335, 60))
         self.C_listWidget.setStyleSheet("border:5px solid #014F84;")
+        self.image_label.setPixmap(QPixmap('log.jpg'))
+        self.image_label.setScaledContents(True)
+        self.image_label.setMaximumHeight(140)
+        self.image_label.setMaximumWidth(600)
+
+        self.timer = QTimer()
+        self.timer.timeout.connect(self.Switch)
+        self.timer.start(200)
+
+        self.pick_command_dict = {1: [], 2: [], 3: []}
 
     def closeEvent(self, event):
-        db_query.Close()
+        db_query.close()
         event.accept()  # 接受关闭事件
-    def getListWidgetItem(self,dict):
+
+    def getListWidgetItem(self, dict):
         item = QListWidgetItem()
         item.setFont(QFont('微软雅黑', 20, QFont.Bold))
         show_str = ""
         if (dict["statu"] == 0):  # 排队
-            item.setForeground(QColor('red'))
+            item.setForeground(QColor(80, 80, 80))
             show_str = dict["car_number"] + "   排队中,请稍等片刻"
         elif (dict["statu"] == 1):  # 工作
-            item.setForeground(QColor(255,215,0))
+            item.setForeground(QColor('blue'))
             show_str = dict["car_number"] + "   取车中,等待取车结束"
         elif (dict["statu"] == 2):  # 已完成
             item.setForeground(QColor('green'))
             show_str = dict["car_number"] + "   已完成,请到 %d 号出口取车" % (dict["export_id"])
         item.setText(show_str)
         return item
-    def callback(self,command_queue,unit):
-        command_queue.sort(reverse=True,key=lambda s: s["statu"])
-        if unit == 1:
-            self.A_listWidget.clear()
-            for dict in command_queue:
-                self.A_listWidget.addItem(self.getListWidgetItem(dict))
-        elif unit == 2:
-            self.B_listWidget.clear()
-            for dict in command_queue:
-                self.B_listWidget.addItem(self.getListWidgetItem(dict))
-        elif unit == 3:
-            self.C_listWidget.clear()
-            for dict in command_queue:
-                self.C_listWidget.addItem(self.getListWidgetItem(dict))
 
+    def Switch(self):
+
+        pick_command_dict = {1:[],2:[],3:[]}
+        for key in pick_command_dict:
+            pick_command_dict[key] = db_query.query_command_in_unit_and_type(key,2)
+
+        for key in self.pick_command_dict.keys():
+            if self.pick_command_dict[key] != pick_command_dict[key]:
+                self.pick_command_dict[key] = pick_command_dict[key]
+                if key == 1:
+                    self.A_listWidget.clear()
+                    for dict in self.pick_command_dict[key]:
+                        self.A_listWidget.addItem(self.getListWidgetItem(dict))
+                elif key == 2:
+                    self.B_listWidget.clear()
+                    for dict in self.pick_command_dict[key]:
+                        self.B_listWidget.addItem(self.getListWidgetItem(dict))
+                elif key == 3:
+                    self.C_listWidget.clear()
+                    for dict in self.pick_command_dict[key]:
+                        self.C_listWidget.addItem(self.getListWidgetItem(dict))
 
 if __name__ == '__main__':
     app = QApplication(sys.argv)
     window = MainWindow()
-    db_query = db_query.DBQuery(db_ip, db_port, db_name, db_user, db_password)
-    db_query.setCallback(window.callback)
+    db_query = db_operation.DBOperation()
     db_query.start()
     window.showMaximized()
     sys.exit(app.exec_())

+ 155 - 0
入口液晶显示屏/ui/ui.py

@@ -0,0 +1,155 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui.ui'
+#
+# Created by: PyQt5 UI code generator 5.15.4
+#
+# WARNING: Any manual changes made to this file will be lost when pyuic5 is
+# run again.  Do not edit this file unless you know what you are doing.
+
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+
+class Ui_MainWindow(object):
+    def setupUi(self, MainWindow):
+        MainWindow.setObjectName("MainWindow")
+        MainWindow.resize(1121, 890)
+        MainWindow.setAutoFillBackground(False)
+        MainWindow.setStyleSheet("")
+        self.centralwidget = QtWidgets.QWidget(MainWindow)
+        self.centralwidget.setObjectName("centralwidget")
+        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
+        self.verticalLayout.setObjectName("verticalLayout")
+        self.horizontalLayout = QtWidgets.QHBoxLayout()
+        self.horizontalLayout.setObjectName("horizontalLayout")
+        self.image_label = QtWidgets.QLabel(self.centralwidget)
+        self.image_label.setObjectName("image_label")
+        self.horizontalLayout.addWidget(self.image_label)
+        self.label = QtWidgets.QLabel(self.centralwidget)
+        self.label.setMaximumSize(QtCore.QSize(16777215, 16777215))
+        font = QtGui.QFont()
+        font.setFamily("华文楷体")
+        font.setPointSize(60)
+        font.setBold(True)
+        font.setWeight(75)
+        self.label.setFont(font)
+        self.label.setStyleSheet("color: blue")
+        self.label.setAlignment(QtCore.Qt.AlignCenter)
+        self.label.setObjectName("label")
+        self.horizontalLayout.addWidget(self.label)
+        self.horizontalLayout.setStretch(0, 1)
+        self.horizontalLayout.setStretch(1, 2)
+        self.verticalLayout.addLayout(self.horizontalLayout)
+        self.process_horizontalLayout = QtWidgets.QHBoxLayout()
+        self.process_horizontalLayout.setObjectName("process_horizontalLayout")
+        self.A_listWidget = QtWidgets.QListWidget(self.centralwidget)
+        self.A_listWidget.setStyleSheet("")
+        self.A_listWidget.setObjectName("A_listWidget")
+        self.process_horizontalLayout.addWidget(self.A_listWidget)
+        self.B_listWidget = QtWidgets.QListWidget(self.centralwidget)
+        self.B_listWidget.setObjectName("B_listWidget")
+        self.process_horizontalLayout.addWidget(self.B_listWidget)
+        self.C_listWidget = QtWidgets.QListWidget(self.centralwidget)
+        self.C_listWidget.setObjectName("C_listWidget")
+        self.process_horizontalLayout.addWidget(self.C_listWidget)
+        self.verticalLayout.addLayout(self.process_horizontalLayout)
+        self.unit_horizontalLayout = QtWidgets.QHBoxLayout()
+        self.unit_horizontalLayout.setObjectName("unit_horizontalLayout")
+        self.A_label = QtWidgets.QLabel(self.centralwidget)
+        font = QtGui.QFont()
+        font.setFamily("华文楷体")
+        font.setPointSize(40)
+        font.setBold(False)
+        font.setWeight(50)
+        self.A_label.setFont(font)
+        self.A_label.setStyleSheet("color: blue")
+        self.A_label.setAlignment(QtCore.Qt.AlignCenter)
+        self.A_label.setObjectName("A_label")
+        self.unit_horizontalLayout.addWidget(self.A_label)
+        self.B_label = QtWidgets.QLabel(self.centralwidget)
+        font = QtGui.QFont()
+        font.setFamily("华文楷体")
+        font.setPointSize(40)
+        font.setBold(False)
+        font.setWeight(50)
+        self.B_label.setFont(font)
+        self.B_label.setStyleSheet("color: blue")
+        self.B_label.setAlignment(QtCore.Qt.AlignCenter)
+        self.B_label.setObjectName("B_label")
+        self.unit_horizontalLayout.addWidget(self.B_label)
+        self.C_label = QtWidgets.QLabel(self.centralwidget)
+        font = QtGui.QFont()
+        font.setFamily("华文楷体")
+        font.setPointSize(40)
+        font.setBold(False)
+        font.setWeight(50)
+        self.C_label.setFont(font)
+        self.C_label.setStyleSheet("color: blue")
+        self.C_label.setAlignment(QtCore.Qt.AlignCenter)
+        self.C_label.setObjectName("C_label")
+        self.unit_horizontalLayout.addWidget(self.C_label)
+        self.verticalLayout.addLayout(self.unit_horizontalLayout)
+        self.export_horizontalLayout = QtWidgets.QHBoxLayout()
+        self.export_horizontalLayout.setObjectName("export_horizontalLayout")
+        self.export_1_label = QtWidgets.QLabel(self.centralwidget)
+        font = QtGui.QFont()
+        font.setFamily("华文楷体")
+        font.setPointSize(30)
+        font.setBold(True)
+        font.setWeight(75)
+        self.export_1_label.setFont(font)
+        self.export_1_label.setStyleSheet("color: blue")
+        self.export_1_label.setAlignment(QtCore.Qt.AlignCenter)
+        self.export_1_label.setObjectName("export_1_label")
+        self.export_horizontalLayout.addWidget(self.export_1_label)
+        self.export_2_label = QtWidgets.QLabel(self.centralwidget)
+        font = QtGui.QFont()
+        font.setFamily("华文楷体")
+        font.setPointSize(30)
+        font.setBold(True)
+        font.setWeight(75)
+        self.export_2_label.setFont(font)
+        self.export_2_label.setStyleSheet("color: blue")
+        self.export_2_label.setAlignment(QtCore.Qt.AlignCenter)
+        self.export_2_label.setObjectName("export_2_label")
+        self.export_horizontalLayout.addWidget(self.export_2_label)
+        self.export_3_label = QtWidgets.QLabel(self.centralwidget)
+        font = QtGui.QFont()
+        font.setFamily("华文楷体")
+        font.setPointSize(30)
+        font.setBold(True)
+        font.setWeight(75)
+        self.export_3_label.setFont(font)
+        self.export_3_label.setStyleSheet("color: blue")
+        self.export_3_label.setAlignment(QtCore.Qt.AlignCenter)
+        self.export_3_label.setObjectName("export_3_label")
+        self.export_horizontalLayout.addWidget(self.export_3_label)
+        self.verticalLayout.addLayout(self.export_horizontalLayout)
+        self.verticalLayout.setStretch(0, 3)
+        self.verticalLayout.setStretch(1, 12)
+        self.verticalLayout.setStretch(2, 1)
+        self.verticalLayout.setStretch(3, 1)
+        MainWindow.setCentralWidget(self.centralwidget)
+        self.menubar = QtWidgets.QMenuBar(MainWindow)
+        self.menubar.setGeometry(QtCore.QRect(0, 0, 1121, 23))
+        self.menubar.setObjectName("menubar")
+        MainWindow.setMenuBar(self.menubar)
+        self.statusbar = QtWidgets.QStatusBar(MainWindow)
+        self.statusbar.setObjectName("statusbar")
+        MainWindow.setStatusBar(self.statusbar)
+
+        self.retranslateUi(MainWindow)
+        QtCore.QMetaObject.connectSlotsByName(MainWindow)
+
+    def retranslateUi(self, MainWindow):
+        _translate = QtCore.QCoreApplication.translate
+        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
+        self.image_label.setText(_translate("MainWindow", "啊实打实的"))
+        self.label.setText(_translate("MainWindow", "楚天智能立体停车库取车排队信息"))
+        self.A_label.setText(_translate("MainWindow", "A单元"))
+        self.B_label.setText(_translate("MainWindow", "B单元"))
+        self.C_label.setText(_translate("MainWindow", "C单元"))
+        self.export_1_label.setText(_translate("MainWindow", "(1,2)号口"))
+        self.export_2_label.setText(_translate("MainWindow", "(3,4)号口"))
+        self.export_3_label.setText(_translate("MainWindow", "(5,6)号口"))

+ 229 - 0
入口液晶显示屏/ui/ui.ui

@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1121</width>
+    <height>890</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <property name="autoFillBackground">
+   <bool>false</bool>
+  </property>
+  <property name="styleSheet">
+   <string notr="true"/>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <layout class="QVBoxLayout" name="verticalLayout" stretch="3,12,1,1">
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,2">
+      <item>
+       <widget class="QLabel" name="image_label">
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="label">
+        <property name="maximumSize">
+         <size>
+          <width>16777215</width>
+          <height>16777215</height>
+         </size>
+        </property>
+        <property name="font">
+         <font>
+          <family>华文楷体</family>
+          <pointsize>60</pointsize>
+          <weight>75</weight>
+          <bold>true</bold>
+         </font>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">color: blue</string>
+        </property>
+        <property name="text">
+         <string>楚天智能立体停车库取车排队信息</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignCenter</set>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="process_horizontalLayout">
+      <item>
+       <widget class="QListWidget" name="A_listWidget">
+        <property name="styleSheet">
+         <string notr="true"/>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QListWidget" name="B_listWidget"/>
+      </item>
+      <item>
+       <widget class="QListWidget" name="C_listWidget"/>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="unit_horizontalLayout">
+      <item>
+       <widget class="QLabel" name="A_label">
+        <property name="font">
+         <font>
+          <family>华文楷体</family>
+          <pointsize>40</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">color: blue</string>
+        </property>
+        <property name="text">
+         <string>A单元</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="B_label">
+        <property name="font">
+         <font>
+          <family>华文楷体</family>
+          <pointsize>40</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">color: blue</string>
+        </property>
+        <property name="text">
+         <string>B单元</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="C_label">
+        <property name="font">
+         <font>
+          <family>华文楷体</family>
+          <pointsize>40</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">color: blue</string>
+        </property>
+        <property name="text">
+         <string>C单元</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignCenter</set>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="export_horizontalLayout">
+      <item>
+       <widget class="QLabel" name="export_1_label">
+        <property name="font">
+         <font>
+          <family>华文楷体</family>
+          <pointsize>30</pointsize>
+          <weight>75</weight>
+          <bold>true</bold>
+         </font>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">color: blue</string>
+        </property>
+        <property name="text">
+         <string>(1,2)号口</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="export_2_label">
+        <property name="font">
+         <font>
+          <family>华文楷体</family>
+          <pointsize>30</pointsize>
+          <weight>75</weight>
+          <bold>true</bold>
+         </font>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">color: blue</string>
+        </property>
+        <property name="text">
+         <string>(3,4)号口</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="export_3_label">
+        <property name="font">
+         <font>
+          <family>华文楷体</family>
+          <pointsize>30</pointsize>
+          <weight>75</weight>
+          <bold>true</bold>
+         </font>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">color: blue</string>
+        </property>
+        <property name="text">
+         <string>(5,6)号口</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignCenter</set>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>1121</width>
+     <height>23</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 0 - 1
出口提示节点/LedControl.py

@@ -36,7 +36,6 @@ class LedControl:
         time.sleep(0.5)
 
     def getInput(self,cmd_queue):
-        led_show_string = ""
         queue_string = ""
         work_string = ""
         complete_string = ""

+ 2 - 6
指令检查节点/CheckEntrance.py

@@ -1,3 +1,4 @@
+import datetime
 import threading
 import time
 
@@ -39,12 +40,7 @@ class EntranceChecker(threading.Thread):
         park = message.park_table()
         park.CopyFrom(park_table)
         measure_info = message.measure_info()
-        if self.measure_statu.statu is not None:
-            tf.Parse(self.measure_statu.statu, measure_info)
-        else:
-            park.statu.execute_statu = message.eError
-            park.statu.statu_description = "设备故障,请联系管理员(雷达)"
-            return tf.MessageToString(park, as_utf8=True)     
+        tf.Parse(self.measure_statu.statu, measure_info)
         tm = time.time()
         if self.error_str == 'OK':
             while time.time() - tm < 0.5:

+ 44 - 0
管理节点/db_config.py

@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# -*- coding:utf-8 -*-
+# author:SunXiuWen
+# make_time:2019/1/13
+# -*- coding: UTF-8 -*-
+import pymysql
+
+# 数据库信息
+# DB_TEST_HOST = "192.168.1.233"
+DB_TEST_HOST = "127.0.0.1"
+
+DB_TEST_PORT = 3306
+DB_TEST_DBNAME = "ct_project"
+# DB_TEST_USER = "zx"
+# DB_TEST_PASSWORD = "zx123456"
+DB_TEST_USER = "root"
+DB_TEST_PASSWORD = "123456"
+
+# 数据库连接编码
+DB_CHARSET = "utf8"
+
+# mincached : 启动时开启的闲置连接数量(缺省值 0 开始时不创建连接)
+DB_MIN_CACHED = 10
+
+# maxcached : 连接池中允许的闲置的最多连接数量(缺省值 0 代表不闲置连接池大小)
+DB_MAX_CACHED = 10
+
+# maxshared : 共享连接数允许的最大数量(缺省值 0 代表所有连接都是专用的)如果达到了最大数量,被请求为共享的连接将会被共享使用
+DB_MAX_SHARED = 20
+
+# maxconnecyions : 创建连接池的最大数量(缺省值 0 代表不限制)
+DB_MAX_CONNECYIONS = 100
+
+# blocking : 设置在连接池达到最大数量时的行为(缺省值 0 或 False 代表返回一个错误<toMany......> 其他代表阻塞直到连接数减少,连接被分配)
+DB_BLOCKING = True
+
+# maxusage : 单个连接的最大允许复用次数(缺省值 0 或 False 代表不限制的复用).当达到最大数时,连接会自动重新连接(关闭和重新打开)
+DB_MAX_USAGE = 0
+
+# setsession : 一个可选的SQL命令列表用于准备每个会话,如["set datestyle to german", ...]
+DB_SET_SESSION = None
+
+# creator : 使用连接数据库的模块
+DB_CREATOR = pymysql

+ 247 - 0
管理节点/db_operation.py

@@ -0,0 +1,247 @@
+import threading
+import time
+import mysqlhelper
+class DBOperation(threading.Thread):
+    def __init__(self):
+        threading.Thread.__init__(self)
+        self._space_dict = {1:{},2:{},3:{}}
+        self._command_dict = {1:{},2:{},3:{}}
+
+        self._db = mysqlhelper.MySqLHelper()
+        self._isClose = False
+    def close(self):
+        self._isClose = True
+
+    def query_command_in_unit(self, unit):
+        sql = "select * from command_queue WHERE unit=%s"
+        return self._db.selectall(sql, unit)
+
+    def query_command_all(self):
+        sql = "select * from command_queue"
+        return self._db.selectall(sql)
+    def query_space_in_unit(self,unit):
+        sql = "select * from space WHERE unit=%s"
+        return self._db.selectall(sql,unit)
+    def query_space_all(self):
+        sql = "select * from space"
+        return self._db.selectall(sql)
+    def update_space_status(self,space_id,statu):
+        sql = "update space set statu=%s where id=%s"
+        return self._db.update(sql,(statu,space_id))
+    def clear_space_data(self,space_id):
+        sql = "update space set car_number=NULL where id=%s"
+        return self._db.update(sql,space_id)
+    def query_vehicle_primary_key(self,car_number):
+        sql = "select primary_key from vehicle where car_number=%s"
+        return self._db.selectall(sql,car_number)
+    def delete_command(self,car_number):
+        sql = "delete from command_queue where car_number=%s"
+        return self._db.delete(sql,car_number)
+    def get_space_dict(self):
+        return self._space_dict
+    def get_command_dict(self):
+        return self._command_dict
+    def run(self):
+        while not self._isClose:
+            for unit in range(1,4):
+                res = self.query_space_in_unit(unit)
+                if len(res) > 0 and self._space_dict[unit] != res:
+                    self._space_dict[unit] = res
+
+            for unit in range(1,4):
+                res = self.query_command_in_unit(unit)
+                if len(res) > 0 and self._command_dict[unit] != res:
+                    self._command_dict[unit] = res
+
+            time.sleep(0.001)
+
+
+
+# class ParkManage(threading.Thread):
+#     def __init__(self, ip, port, database, user, password, sender):
+#         threading.Thread.__init__(self)
+#         self.conn = None
+#         self.ip = ip
+#         self.port = port
+#         self.database = database
+#         self.user = user
+#         self.password = password
+#
+#
+#         self.lock = threading.Lock()
+#
+#         self.a_unit_park_list = {}
+#         self.b_unit_park_list = {}
+#         self.c_unit_park_list = {}
+#
+#         self.command_queue_dict = {}
+#         self.a_command_queue_list = {}
+#         self.b_command_queue_list = {}
+#         self.c_command_queue_list = {}
+#
+#
+#         self.my_sql_str = queue.Queue()
+#
+#
+#
+#         self.isClose = False
+#         self.g_sender = sender
+#
+#         self.db_statu_callback = None
+#         self.command_update_callback = None
+#         self.space_update_callback = None
+#
+#     def setDbStatuCallback(self, callback):
+#         self.db_statu_callback = callback
+#     def setCommandUpdateCallback(self,callback):
+#         self.command_update_callback = callback
+#
+#     def setSpaceUpdateCallback(self, callback):
+#         self.space_update_callback = callback
+#     def connect(self):
+#         try:
+#             self.conn = pymysql.connect(host=self.ip, port=self.port, database=self.database, charset="utf8",
+#                                         user=self.user, passwd=self.password)
+#             return True
+#         except:
+#             return False
+#     def putSql(self,SQL):
+#         self.my_sql_str.put(SQL)
+#
+#     def updatePark(self, dict, statu):
+#         self.lock.acquire()
+#
+#         cursor = self.conn.cursor()
+#         SQL = "update space set statu=%d where id=%d" % (statu, dict["id"])
+#         cursor.execute(SQL)
+#         print(SQL)
+#         self.conn.commit()
+#         cursor.close()
+#         self.lock.release()
+#
+#     def clearPark(self, dict):
+#         self.lock.acquire()
+#
+#         cursor = self.conn.cursor()
+#         SQL = "update space set car_number=NULL where id=%d" % (dict["id"])
+#         cursor.execute(SQL)
+#         print(SQL)
+#         self.conn.commit()
+#         cursor.close()
+#         self.lock.release()
+#
+#     def processDelete(self, dict):
+#         self.lock.acquire()
+#         cursor = self.conn.cursor()
+#         SQL = "delete from command_queue where car_number='%s';" % (dict["car_number"])
+#         cursor.execute(SQL)
+#         print(SQL)
+#         self.conn.commit()
+#         cursor.close()
+#         self.lock.release()
+#
+#     def pickUpPark(self, dict):
+#         self.lock.acquire()
+#
+#         cursor = self.conn.cursor()
+#         SQL = "select primary_key from vehicle where car_number='%s'" % (dict["car_number"])
+#         cursor.execute(SQL)
+#         self.conn.commit()
+#         results = cursor.fetchall()
+#         cursor.close()
+#
+#         self.lock.release()
+#
+#         if len(results) == 1:
+#             key = ''.join(results[0])
+#             table = msg.pick_table()
+#             table.primary_key = key
+#             self.g_sender.publish("command_ex", "user_command_port", tf.MessageToString(table, as_utf8=True))
+#             QMessageBox.question(None, '提示', '取车消息发送成功!',
+#                                  QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
+#
+#         else:
+#             QMessageBox.warning(None, '警告', '查询结果有误,请检查数据库!',
+#                                 QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
+#     def close(self):
+#         self.isClose = True
+#     def run(self):
+#         while self.isClose is not True:
+#             try:
+#                 self.conn.ping()  # 采用连接对象的ping()函数检测连接状态
+#                 self.db_statu_callback(True)
+#             except:
+#                 self.db_statu_callback(False)
+#                 self.connect()
+#                 time.sleep(0.5)
+#                 continue
+#             # 获取一个光标
+#             cursor = self.conn.cursor(cursor=pymysql.cursors.DictCursor)
+#             SQL = "select * from space"
+#             t_a_unit_park_list = []
+#             t_b_unit_park_list = []
+#             t_c_unit_park_list = []
+#             results = cursor.execute(SQL)
+#
+#
+#             # 结果数量大于0
+#             if results > 0:
+#                 parkspace = cursor.fetchall()
+#                 for space in parkspace:
+#                     if space["unit"] == 1:
+#                         t_a_unit_park_list.append(space)
+#                     if space["unit"] == 2:
+#                         t_b_unit_park_list.append(space)
+#                     if space["unit"] == 3:
+#                         t_c_unit_park_list.append(space)
+#
+#             if self.a_unit_park_list != t_a_unit_park_list:
+#                 self.a_unit_park_list = t_a_unit_park_list
+#                 self.space_update_callback(self.a_unit_park_list, 'A')
+#
+#             if self.b_unit_park_list != t_b_unit_park_list:
+#                 self.b_unit_park_list = t_b_unit_park_list
+#                 self.space_update_callback(self.b_unit_park_list, 'B')
+#
+#             if self.c_unit_park_list != t_c_unit_park_list:
+#                 self.c_unit_park_list = t_c_unit_park_list
+#                 self.space_update_callback(self.c_unit_park_list, 'C')
+#
+#             SQL = "select * from command_queue"
+#             t_a_command_list = []
+#             t_b_command_list = []
+#             t_c_command_list = []
+#             results = cursor.execute(SQL)
+#             if results > 0:
+#                 command_queue = cursor.fetchall()
+#                 self.command_queue_dict = command_queue
+#                 for command in command_queue:
+#                     if command["unit"] == 1:
+#                         t_a_command_list.append(command)
+#                     if command["unit"] == 2:
+#                         t_a_command_list.append(command)
+#                     if command["unit"] == 3:
+#                         t_a_command_list.append(command)
+#
+#             if self.a_command_queue_list != t_a_command_list:
+#                 self.a_command_queue_list = t_a_command_list
+#                 self.command_update_callback(self.a_command_queue_list, 'A')
+#
+#             elif self.b_command_queue_list != t_b_command_list:
+#                 self.b_command_queue_list = t_b_command_list
+#                 self.command_update_callback(self.b_command_queue_list, 'B')
+#
+#             elif self.c_command_queue_list != t_c_command_list:
+#                 self.c_command_queue_list = t_c_command_list
+#                 self.command_update_callback(self.c_command_queue_list, 'C')
+#
+#             if self.my_sql_str.qsize() > 0:
+#                 SQL = self.my_sql_str.get(False)
+#                 cursor.execute(SQL)
+#                 self.conn.commit()
+#
+#             # 关闭光标
+#             cursor.close()
+#
+#             # print("------------------------------")
+#             time.sleep(0.001)

BIN
管理节点/log.jpg


+ 191 - 0
管理节点/mysqlhelper.py

@@ -0,0 +1,191 @@
+#!/usr/bin/env python
+# -*- coding:utf-8 -*-
+# author:SunXiuWen
+# make_time:2019/1/13
+import pymysql
+from DBUtils.PooledDB import PooledDB
+import db_config as config
+
+"""
+@功能:创建数据库连接池
+"""
+
+class MyConnectionPool(object):
+    __pool = None
+
+    # 创建数据库连接conn和游标cursor
+    def __enter__(self):
+        self.conn = self.__getconn()
+        self.cursor = self.conn.cursor()
+
+    # 创建数据库连接池
+    def __getconn(self):
+        if self.__pool is None:
+            self.__pool = PooledDB(
+                creator=config.DB_CREATOR,
+                mincached=config.DB_MIN_CACHED,
+                maxcached=config.DB_MAX_CACHED,
+                maxshared=config.DB_MAX_SHARED,
+                maxconnections=config.DB_MAX_CONNECYIONS,
+                blocking=config.DB_BLOCKING,
+                maxusage=config.DB_MAX_USAGE,
+                setsession=config.DB_SET_SESSION,
+                host=config.DB_TEST_HOST,
+                port=config.DB_TEST_PORT,
+                user=config.DB_TEST_USER,
+                passwd=config.DB_TEST_PASSWORD,
+                db=config.DB_TEST_DBNAME,
+                use_unicode=True,
+                charset=config.DB_CHARSET
+            )
+        return self.__pool.connection()
+
+    # 释放连接池资源
+    def __exit__(self, exc_type, exc_val, exc_tb):
+        self.cursor.close()
+        self.conn.close()
+
+    # 从连接池中取出一个连接
+    def getconn(self):
+        conn = self.__getconn()
+        cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)
+        return cursor, conn
+
+
+"""执行语句查询有结果返回结果没有返回0;增/删/改返回变更数据条数,没有返回0"""
+
+
+
+class MySqLHelper(object):
+    def __init__(self):
+        self.db = MyConnectionPool()  # 从数据池中获取连接
+
+    def __new__(cls, *args, **kwargs):
+        if not hasattr(cls, 'inst'):  # 单例
+            cls.inst = super(MySqLHelper, cls).__new__(cls, *args, **kwargs)
+        return cls.inst
+
+    # 封装执行命令
+    def execute(self, sql, param=None, autoclose=False):
+        """
+        【主要判断是否有参数和是否执行完就释放连接】
+        :param sql: 字符串类型,sql语句
+        :param param: sql语句中要替换的参数"select %s from tab where id=%s" 其中的%s就是参数
+        :param autoclose: 是否关闭连接
+        :return: 返回连接conn和游标cursor
+        """
+        cursor, conn = self.db.getconn()  # 从连接池获取连接
+        count = 0
+        try:
+            # count : 为改变的数据条数
+            if param:
+                count = cursor.execute(sql, param)
+            else:
+                count = cursor.execute(sql)
+            conn.commit()
+            if autoclose:
+                self.close(cursor, conn)
+        except Exception as e:
+            print("db error_msg:", e.args)
+        return cursor, conn, count
+
+    # 释放连接
+    def close(self, cursor, conn):
+        """释放连接归还给连接池"""
+        cursor.close()
+        conn.close()
+
+    # 查询所有
+    def selectall(self, sql, param=None):
+        try:
+            cursor, conn, count = self.execute(sql, param)
+            res = cursor.fetchall()
+            return res
+        except Exception as e:
+            print("db error_msg:", e.args)
+            self.close(cursor, conn)
+            return count
+
+    # 查询单条
+    def selectone(self, sql, param=None):
+        try:
+            cursor, conn, count = self.execute(sql, param)
+            res = cursor.fetchone()
+            self.close(cursor, conn)
+            return res
+        except Exception as e:
+            print("db error_msg:", e.args)
+            self.close(cursor, conn)
+            return count
+
+    # 增加
+    def insertone(self, sql, param):
+        try:
+            cursor, conn, count = self.execute(sql, param)
+            conn.commit()
+            self.close(cursor, conn)
+            return count
+        except Exception as e:
+            print("db error_msg:", e.args)
+            conn.rollback()
+            self.close(cursor, conn)
+            return count
+
+    # 删除
+    def delete(self, sql, param=None):
+        try:
+            cursor, conn, count = self.execute(sql, param)
+            conn.commit()
+            self.close(cursor, conn)
+            return count
+        except Exception as e:
+            print("db error_msg:", e.args)
+            conn.rollback()
+            self.close(cursor, conn)
+            return count
+
+    # 修改
+    def update(self, sql, param=None):
+        try:
+            cursor, conn, count = self.execute(sql, param)
+            conn.commit()
+            self.close(cursor, conn)
+            return count
+        except Exception as e:
+            print("db error_msg:", e.args)
+            conn.rollback()
+            self.close(cursor, conn)
+            return count
+
+
+if __name__ == '__main__':
+    db = MySqLHelper()
+    while True:
+        sql1 = 'select * from space where unit=%s'
+        args = '2'
+        ret = db.selectone(sql=sql1, param=args)
+        print(ret)  # (79, 2, 1, 2.2, None, 2, 1)
+    # 查询单条
+    sql1 = 'select * from space where unit=%s'
+    args = '2'
+    ret = db.selectone(sql=sql1, param=args)
+    print(ret)  # (79, 2, 1, 2.2, None, 2, 1)
+    #查询所有
+    sql2 = "select * from space"
+    ret = db.selectall(sql=sql2)
+    print(ret)
+    # 增加
+    sql3 = 'insert into vehicle (car_number,primary_key) VALUES (%s,%s)'
+    ret = db.insertone(sql3, ('鄂A6X3B0','DASDASDEFDFSDASDADASDAS'))
+    print(ret)
+    # 删除
+    sql4 = 'delete from vehicle WHERE car_number=%s'
+    args = '鄂A6X3B0'
+    ret = db.delete(sql4, args)
+    print(ret)
+    # 修改
+    sql5 = 'update command_queue set export_id=%s WHERE car_number LIKE %s'
+    args = ('100', 'WK0001')
+    ret = db.update(sql5, args)
+    print(ret)
+

+ 344 - 436
管理节点/node.py

@@ -1,35 +1,27 @@
 import sys
 from itertools import product
-
+import message.message_pb2 as message
 from PyQt5 import sip
-from PyQt5.QtWidgets import QApplication, QSizePolicy, QLabel, QWidget
+from PyQt5.QtWidgets import QApplication, QSizePolicy, QLabel, QWidget, QListWidgetItem
 
 import json
 import threading
 import time
 from functools import partial
-from PyQt5.QtCore import pyqtSignal, Qt
-from PyQt5.QtGui import QCursor, QFont
+from PyQt5.QtCore import pyqtSignal, Qt, QTimer, QThread, QSize
+from PyQt5.QtGui import QCursor, QFont, QColor, QPixmap
 from PyQt5.QtWidgets import QPushButton, QMainWindow, QMenu, QMessageBox
 
 import message.message_pb2 as message
 import google.protobuf.text_format as tf
 import re
 import ui.spaceUi as sui
-import spaceManage as spmng
+import db_operation as spmng
 import async_communication as cmt
 import mcpu_communication as mcn
 from led import Led
 
-# db参数
-db_ip = "192.168.1.233"
-# db_ip = "127.0.0.1"
-db_port = 3306
-db_name = "ct_project"
-db_user = "zx"
-db_password = "zx123456"
-# db_user = "root"
-# db_password = "123456"
+
 # mq参数
 mq_ip = "192.168.1.233"
 # mq_ip = "127.0.0.1"
@@ -54,20 +46,6 @@ statu_ex_keys = [
     ["statu_ex", "out_mcpu_6_statu_port"]
 ]
 
-mcpu_keys = [
-    ["in", 1, "192.168.1.120", 40005],
-    ["in", 2, "192.168.1.121", 40005],
-    ["in", 3, "192.168.1.122", 40005],
-    ["in", 4, "192.168.1.123", 40005],
-    ["in", 5, "192.168.1.124", 40005],
-    ["in", 6, "192.168.1.125", 40005],
-    ["out", 1, "192.168.1.130", 40005],
-    ["out", 2, "192.168.1.131", 40005],
-    ["out", 3, "192.168.1.132", 40005],
-    ["out", 4, "192.168.1.133", 40005],
-    ["out", 5, "192.168.1.134", 40005],
-    ["out", 6, "192.168.1.135", 40005]
-]
 
 
 class QPBtn(QPushButton):
@@ -83,45 +61,37 @@ class QPBtn(QPushButton):
             self.clickedSignal.emit(False)
 
 
-class MainWindow(QMainWindow, threading.Thread):
-    drawSpaceBtnSignal = pyqtSignal(dict, int)
-    drawMcpuBtnSignal = pyqtSignal(str)
-    drawRmqBtnSignal = pyqtSignal(list)
-    drawLedSignal = pyqtSignal()
-    drawUnitProcessSignal = pyqtSignal()
+class MainWindow(QMainWindow, sui.Ui_MainWindow):
 
-    def __init__(self):
-        threading.Thread.__init__(self)
-        QMainWindow.__init__(self)
-        self.rmq_statu = {}
-        self.rmq_timeout = {}
-        self.command_queue_dict = {}
+    def __init__(self, parent=None):
+        super(MainWindow, self).__init__(parent)
 
-        self.ui = sui.Ui_MainWindow()
-        self.ui.setupUi(self)
+        self.setupUi(self)
         self.isClose = False
-        self.drawSpaceBtnSignal.connect(self.drawSpaceBtn)
-        self.drawRmqBtnSignal.connect(self.drawRmqBtn)
-        self.drawLedSignal.connect(self.drawLed)
-        self.drawUnitProcessSignal.connect(self.drawUnitProcess)
-        self.drawMcpuBtnSignal.connect(self.drawMcpuBtn)
+        self.A_listWidget.setGridSize(QSize(335, 60))
+        self.A_listWidget.setStyleSheet("border:5px solid #014F84;")
+        self.B_listWidget.setGridSize(QSize(335, 60))
+        self.B_listWidget.setStyleSheet("border:5px solid #014F84;")
+        self.C_listWidget.setGridSize(QSize(335, 60))
+        self.C_listWidget.setStyleSheet("border:5px solid #014F84;")
+        self.image_label.setPixmap(QPixmap('log.jpg'))
+        self.image_label.setScaledContents(True)
+        self.image_label.setMaximumHeight(140)
+        self.image_label.setMaximumWidth(600)
 
         self.btn_positions = [(i, j) for i in range(13, -1, -1) for j in range(6)]
+        self.space_dict = {1: [], 2: [], 3: []}
+        self.space_is_init = {1: False, 2: False, 3: False}
+        self.rmq_statu_dict = {}
+        self.command_dict = {1: [], 2: [], 3: []}
+
+        for ex_name,key in statu_ex_keys:
+            self.rmq_statu_dict[key]={}
 
-        # self.ui.in_mcpu_1_statu_btn = QPBtn(self.ui.in_mcpu_1_statu_btn)
-        self.ui.in_mcpu_1_statu_btn.clicked.connect(self.mcpu_btn_click)
-        self.ui.in_mcpu_2_statu_btn.clicked.connect(self.mcpu_btn_click)
-        self.ui.in_mcpu_3_statu_btn.clicked.connect(self.mcpu_btn_click)
-        self.ui.in_mcpu_4_statu_btn.clicked.connect(self.mcpu_btn_click)
-        self.ui.in_mcpu_5_statu_btn.clicked.connect(self.mcpu_btn_click)
-        self.ui.in_mcpu_6_statu_btn.clicked.connect(self.mcpu_btn_click)
-
-        self.ui.out_mcpu_1_statu_btn.clicked.connect(self.mcpu_btn_click)
-        self.ui.out_mcpu_2_statu_btn.clicked.connect(self.mcpu_btn_click)
-        self.ui.out_mcpu_3_statu_btn.clicked.connect(self.mcpu_btn_click)
-        self.ui.out_mcpu_4_statu_btn.clicked.connect(self.mcpu_btn_click)
-        self.ui.out_mcpu_5_statu_btn.clicked.connect(self.mcpu_btn_click)
-        self.ui.out_mcpu_6_statu_btn.clicked.connect(self.mcpu_btn_click)
+        self.isInit = False
+        self.timer = QTimer()
+        self.timer.timeout.connect(self.Switch)
+        self.timer.start(200)
 
     def getBackGroundColor(self, color):
         if color == "red":
@@ -135,335 +105,126 @@ class MainWindow(QMainWindow, threading.Thread):
         elif color == "pastel":
             return "background-color:rgb(241,158,194)"
 
-    def drawMcpuBtn(self, key):
-        mouth = key.split(':')[0]
-        id = key.split(':')[1]
-        btn_name = mouth + '_' + id + '_statu_btn'
-        btn = self.findChild(QPushButton, btn_name)
-        iomsg = g_mcpu.GetMcpuIoMsg(key)
-        if g_mcpu.GetMcpuConnectStatus(key) is True or iomsg.timeout() is False:
-            btn.setText(btn.text()[:10] + "正常")
-            btn.setStyleSheet(self.getBackGroundColor("green"))
-
-            btn.setToolTip(str(iomsg.statu))
-        else:
-            btn.setText(btn.text()[:10] + "断连")
-            btn.setToolTip("None")
-            btn.setStyleSheet(self.getBackGroundColor("gray"))
-
-    def drawMcpuBtn(self, key):
-        mouth = key.split(':')[0]
-        id = key.split(':')[1]
-        btn_name = mouth + '_' + id + '_statu_btn'
-        btn = self.findChild(QPushButton, btn_name)
-        iomsg = g_mcpu.GetMcpuIoMsg(key)
-        if g_mcpu.GetMcpuConnectStatus(key) is True or iomsg.timeout() is False:
-            btn.setText(btn.text()[:10] + "正常")
-            btn.setStyleSheet(self.getBackGroundColor("green"))
-
-            btn.setToolTip(str(iomsg.statu))
-        else:
-            btn.setText(btn.text()[:10] + "断连")
-            btn.setToolTip("None")
-            btn.setStyleSheet(self.getBackGroundColor("gray"))
+    def getListWidgetItem(self, dict):
+        item = QListWidgetItem()
+        item.setFont(QFont('微软雅黑', 20, QFont.Bold))
+        show_str = ""
+        if(dict["type"] == 2):
+            if (dict["statu"] == 0):  # 排队
+                item.setForeground(QColor(80, 80, 80))
+                show_str = dict["car_number"] + "   排队中,请稍等片刻"
+            elif (dict["statu"] == 1):  # 工作
+                item.setForeground(QColor('blue'))
+                show_str = dict["car_number"] + "   取车中,等待取车结束"
+            elif (dict["statu"] == 2):  # 已完成
+                item.setForeground(QColor('green'))
+                show_str = dict["car_number"] + "   已完成,请到 %d 号出口取车" % (dict["export_id"])
+            item.setText(show_str)
+        return item
+
+
+    def drawLed(self,command_dict):
+        export = {}
+        for i in range(1,7):
+            export[i] = True
+        for key in self.rmq_statu_dict.keys():
+            if key.find("out") >= 0:
+                out_mcpu_statu = message.out_mcpu_statu()
+                tf.Parse(self.rmq_statu_dict[key], out_mcpu_statu)
+                if out_mcpu_statu.outside_safety == 2:
+                    export[int(key[9])] = False
+        t_command_dict = g_space.get_command_dict()
+        for dict in t_command_dict:
+            if dict["export_id"] == 1:
+                export[1] = False
+            if dict["export_id"] == 2:
+                export[2] = False
+            if dict["export_id"] == 3:
+                export[3] = False
+            if dict["export_id"] == 4:
+                export[4] = False
+            if dict["export_id"] == 5:
+                export[5] = False
+            if dict["export_id"] == 6:
+                export[6] = False
 
-    def drawUnitProcess(self):
-        return
-        if g_space.command_queue_dict is not False and g_space.command_queue_dict is not None:
-            # if self.command_queue_dict != g_space.command_queue_dict
-
-            for Aindex in range(self.ui.A_verticalLayout.count()):
-                item = self.ui.A_verticalLayout.itemAt(Aindex)
-                if item is not None:
-                    self.ui.A_verticalLayout.removeItem(item)
-                    sip.delete(item.widget())
-
-            for Bindex in range(self.ui.B_verticalLayout.count()):
-                wid = self.ui.B_verticalLayout.itemAt(Bindex).widget()
-                if item is not None:
-                    self.ui.B_verticalLayout.removeWidget(wid)
-                    sip.delete(wid)
-
-            for Cindex in range(self.ui.C_verticalLayout.count()):
-                wid = self.ui.C_verticalLayout.itemAt(Cindex).widget()
-                if item is not None:
-                    self.ui.C_verticalLayout.removeWidget(wid)
-                    sip.delete(wid)
-
-            for dict in g_space.command_queue_dict:
-                btn = QPBtn()
-                measure = message.measure_info()
-                # tf.Parse(dict["measure_info"],measure)
-                a = 1.50
-                str = "%s任务-------车牌号:%s 车高:%f" % (
-                    "存车" if dict["type"] == 1 else "取车", dict["car_number"], a)
-                color = ""
-                if dict["statu"] == 1:
-                    color = self.getBackGroundColor("yellow")
-                elif dict["statu"] == 2:
-                    color = self.getBackGroundColor("green")
-                elif dict["statu"] == 0:
-                    color = self.getBackGroundColor("pastel")
-                elif dict["statu"] == 3:
-                    color = self.getBackGroundColor("red")
-                btn.setStyleSheet('border:3px groove orange;border-radius:10px;padding:2px 4px;' + color)
-                tool_tip = '{"car_number":"%s",\n"primary_key":"%s",\n "unit":%d, \n"queue_id":%d, \n"type":%d ,' \
-                           '\n "space_info":"%s", \n"measure_info":"%s", \n"export_id":%d}' % (
-                               dict["car_number"], dict["primary_key"], dict["unit"], dict["queue_id"], dict["type"],
-                               "None" if dict["space_info"] is None else dict["space_info"],
-                               "None" if dict["measure_info"] is None else dict["measure_info"],
-                               -1 if dict["export_id"] is None else dict["export_id"])
-                # if self.findChild(QPBtn, dict["car_number"]) is not None:
-                #     self.findChild(QPBtn, dict["car_number"]).setText(str)
-                #     self.findChild(QPBtn, dict["car_number"]).setToolTip(tool_tip)
-                #     self.findChild(QPBtn, dict["car_number"]).setStyleSheet('border:3px groove %s;border-radius:10px;padding:2px 4px;' % (
-                #     "orange" if dict["type"] is 1 else "blue") + color)
-                #     continue
-                btn.setStyleSheet('border:3px groove %s;border-radius:10px;padding:2px 4px;' % (
-                    "orange" if dict["type"] == 1 else "blue") + color)
-                btn.setObjectName(dict["car_number"])
-                btn.setMinimumHeight(80)
-                font = QFont()
-                font.setFamily('微软雅黑')
-                font.setBold(True)
-                font.setPointSize(15)
-                font.setWeight(50)
-                btn.setFont(font)  # 载入字体设置
-                # btn.setGeometry(0, 0, 250, 500)  # (x坐标,y坐标,宽,高)
-                btn.setText(str)
-                btn.setToolTip(tool_tip)
-                btn.clickedSignal.connect(self.process_btn_click)
-                if dict["unit"] == 1:
-                    self.ui.A_verticalLayout.addWidget(btn)
-                elif dict["unit"] == 2:
-                    self.ui.B_verticalLayout.addWidget(btn)
-                elif dict["unit"] == 3:
-                    self.ui.C_verticalLayout.addWidget(btn)
-
-    def drawLed(self):
-        export_1 = True
-        export_2 = True
-
-        export_3 = True
-        export_4 = True
-
-        export_5 = True
-        export_6 = True
-        out_mcpu_1_statu = message.out_mcpu_statu()
-        out_mcpu_2_statu = message.out_mcpu_statu()
-        out_mcpu_3_statu = message.out_mcpu_statu()
-        out_mcpu_4_statu = message.out_mcpu_statu()
-        out_mcpu_5_statu = message.out_mcpu_statu()
-        out_mcpu_6_statu = message.out_mcpu_statu()
-        if self.ui.out_rmq_1_statu_btn.toolTip() != "None":
-            tf.Parse(self.ui.out_rmq_1_statu_btn.toolTip(), out_mcpu_1_statu)
-            if out_mcpu_1_statu.outside_safety == 2:
-                export_1 = False
-        if self.ui.out_rmq_2_statu_btn.toolTip() != "None":
-            tf.Parse(self.ui.out_rmq_2_statu_btn.toolTip(), out_mcpu_2_statu)
-            if out_mcpu_2_statu.outside_safety == 2:
-                export_2 = False
-        if self.ui.out_rmq_3_statu_btn.toolTip() != "None":
-            tf.Parse(self.ui.out_rmq_3_statu_btn.toolTip(), out_mcpu_3_statu)
-            if out_mcpu_3_statu.outside_safety == 2:
-                export_3 = False
-        if self.ui.out_rmq_4_statu_btn.toolTip() != "None":
-            tf.Parse(self.ui.out_rmq_4_statu_btn.toolTip(), out_mcpu_4_statu)
-            if out_mcpu_4_statu.outside_safety == 2:
-                export_4 = False
-        if self.ui.out_rmq_5_statu_btn.toolTip() != "None":
-            tf.Parse(self.ui.out_rmq_5_statu_btn.toolTip(), out_mcpu_5_statu)
-            if out_mcpu_5_statu.outside_safety == 2:
-                export_5 = False
-        if self.ui.out_rmq_6_statu_btn.toolTip() != "None":
-            tf.Parse(self.ui.out_rmq_6_statu_btn.toolTip(), out_mcpu_6_statu)
-            if out_mcpu_6_statu.outside_safety == 2:
-                export_6 = False
-        if g_space.command_queue_dict is not False and g_space.command_queue_dict is not None:
-            for dict in g_space.command_queue_dict:
-                if dict["export_id"] == 1:
-                    export_1 = False
-                if dict["export_id"] == 2:
-                    export_2 = False
-                if dict["export_id"] == 3:
-                    export_3 = False
-                if dict["export_id"] == 4:
-                    export_4 = False
-                if dict["export_id"] == 5:
-                    export_5 = False
-                if dict["export_id"] == 6:
-                    export_6 = False
 
         led = Led()
         led.setEnabled(False)  # 设置为不使能状态,如果需要切换可以设置为True。则可以实现点击切换指示灯颜色的效果
         led.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
-        if export_1 == export_2 == False:
+        if export[1] == export[2] == False:
             led.setChecked(False)  # 设置为选中状态
         else:
             led.setChecked(True)  # 设置为选中状态
-        self.ui.led_process_Layout.addWidget(led, 0, 1)
+        self.led_process_Layout.addWidget(led, 0, 1)
 
         led = Led()
         led.setEnabled(False)  # 设置为不使能状态,如果需要切换可以设置为True。则可以实现点击切换指示灯颜色的效果
         led.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
-        if export_3 == export_4 == False:
+        if export[3] == export[4] == False:
             led.setChecked(False)  # 设置为选中状态
         else:
             led.setChecked(True)  # 设置为选中状态
-        self.ui.led_process_Layout.addWidget(led, 0, 2)
+        self.led_process_Layout.addWidget(led, 0, 2)
 
         led = Led()
         led.setEnabled(False)  # 设置为不使能状态,如果需要切换可以设置为True。则可以实现点击切换指示灯颜色的效果
         led.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
-        if export_5 == export_6 == False:
+        if export[5] == export[6] == False:
             led.setChecked(False)  # 设置为选中状态
         else:
             led.setChecked(True)  # 设置为选中状态
-        self.ui.led_process_Layout.addWidget(led, 0, 3)
+        self.led_process_Layout.addWidget(led, 0, 3)
 
-    def drawRmqBtn(self, list):
-        ex_name = list[0]
-        key = list[1]
-        id = ex_name + ":" + key
-        btn = self.findChild(QPushButton, (key.replace("port", "btn")).replace("mcpu", "rmq"))
-        if g_rabbitmq[id].statu is not None and g_rabbitmq[id].timeout() is False:
-            btn.setToolTip(g_rabbitmq[id].statu)
-            if key.find("in") >= 0:
-                in_mcpu_statu = message.in_mcpu_statu()
-                tf.Parse(g_rabbitmq[id].statu, in_mcpu_statu)
-                if in_mcpu_statu.is_occupy == 1:
-                    btn.setStyleSheet(self.getBackGroundColor("green"))
-                    btn.setText(btn.text()[:9] + "空闲----" + btn.text()[15:])
-                else:
-                    btn.setStyleSheet(self.getBackGroundColor("yellow"))
-                    btn.setText(btn.text()[:9] + "占用----" + btn.text()[15:])
-                # print(btn.text())
-                if in_mcpu_statu.door_statu == 2:
-                    btn.setText(btn.text()[:-3] + "开到位")
-                elif in_mcpu_statu.door_statu == 3:
-                    btn.setText(btn.text()[:-3] + "关到位")
-                elif in_mcpu_statu.door_statu == 4:
-                    btn.setText(btn.text()[:-3] + "开关中")
-                elif in_mcpu_statu.door_statu == 5:
-                    btn.setText(btn.text()[:-3] + "门故障")
-
-            elif btn.text().find("出口") >= 0:
-                out_mcpu_statu = message.out_mcpu_statu()
-                tf.Parse(g_rabbitmq[id].statu, out_mcpu_statu)
-                if out_mcpu_statu.outside_safety == 1:
-                    btn.setStyleSheet(self.getBackGroundColor("green"))
-                    btn.setText(btn.text()[:9] + "空闲----" + btn.text()[15:])
-                else:
-                    btn.setStyleSheet(self.getBackGroundColor("yellow"))
-                    btn.setText(btn.text()[:9] + "占用----" + btn.text()[15:])
-                export_id = re.search('\d+', btn.objectName()).group()
-                if g_space.command_queue_dict is not None:
-                    for dict in g_space.command_queue_dict:
-                        if dict["export_id"] == int(export_id):
-                            btn.setStyleSheet(self.getBackGroundColor("yellow"))
-                            btn.setText(btn.text()[:9] + "占用----" + btn.text()[15:])
-                if out_mcpu_statu.door_statu == 2:
-                    btn.setText(btn.text()[:-3] + "开到位")
-                elif out_mcpu_statu.door_statu == 3:
-                    btn.setText(btn.text()[:-3] + "关到位")
-                elif out_mcpu_statu.door_statu == 4:
-                    btn.setText(btn.text()[:-3] + "开关中")
-                elif out_mcpu_statu.door_statu == 5:
-                    btn.setText(btn.text()[:-3] + "门故障")
+    def drawRmqBtn(self, msg, key):
 
 
-        else:
+        btn = self.findChild(QPushButton, (key.replace("port", "btn")).replace("mcpu", "rmq"))
+        if msg is None:
             btn.setToolTip("None")
             btn.setStyleSheet(self.getBackGroundColor("gray"))
             btn.setText(btn.text()[:9] + "断连")
-    def mcpu_btn_click(self):
-        sender = self.sender()
-        mcpu_key_list = sender.objectName().split('_')
-        menu = QMenu(self)
-        action = menu.addAction('手动开门')
-        action.triggered.connect(partial(self.manual_open_door, mcpu_key_list))
-        action = menu.addAction('手动关门')
-        action.triggered.connect(partial(self.manual_close_door, mcpu_key_list))
-        action = menu.addAction('恢复半自动')
-        action.triggered.connect(partial(self.automatic_door, mcpu_key_list))
-        action = menu.addAction('恢复全自动')
-        action.triggered.connect(partial(self.fully_automatic_door, mcpu_key_list))
-        menu.exec_(QCursor.pos())
-
-    def manual_open_door(self,mcpu_key_list):
-        dispatch_direction = 0
-        if mcpu_key_list[0] == 'in':
-            dispatch_direction = 1
-        elif mcpu_key_list[0] == 'out':
-            dispatch_direction = 2
-        msg = b'{ "TerminalID": %d, "DispatchDirection": %d, "ProcessControl": 2, "OutPutDo": { "Do0": 1, "Do1": 0, "Do2": 0, "Do3": 0, "Do4": 0, "Do5": 0, "Do6": 0, "Do7": 0 }}' % (
-        int(mcpu_key_list[2]) - 1,dispatch_direction)
-        key = mcpu_key_list[0]+":mcpu_"+mcpu_key_list[2]
-        g_mcpu.publish(key,msg)
-        QMessageBox.question(None, '提示', '指令发送成功!',
-                             QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
-    def manual_close_door(self,mcpu_key_list):
-        dispatch_direction = 0
-        if mcpu_key_list[0] == 'in':
-            dispatch_direction = 1
-        elif mcpu_key_list[0] == 'out':
-            dispatch_direction = 2
-        msg = b'{ "TerminalID": %d, "DispatchDirection": %d, "ProcessControl": 2, "OutPutDo": { "Do0": 0, "Do1": 1, "Do2": 0, "Do3": 0, "Do4": 0, "Do5": 0, "Do6": 0, "Do7": 0 }}' % (
-            int(mcpu_key_list[2]) - 1, dispatch_direction)
-        key = mcpu_key_list[0] + ":mcpu_" + mcpu_key_list[2]
-        g_mcpu.publish(key, msg)
-        QMessageBox.question(None, '提示', '指令发送成功!',
-                             QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
-    def automatic_door(self,mcpu_key_list):
-        dispatch_direction = 0
-        ProcessControl = 0
-        if mcpu_key_list[0] == 'in':
-            ProcessControl = 3
-            dispatch_direction = 1
-        elif mcpu_key_list[0] == 'out':
-            ProcessControl = 4
-            dispatch_direction = 2
-        msg = b'{ "TerminalID": %d, "DispatchDirection": %d, "ProcessControl": %d, "OutPutDo": { "Do0": 0, "Do1": 0, "Do2": 0, "Do3": 0, "Do4": 0, "Do5": 0, "Do6": 0, "Do7": 0 }}' % (
-            int(mcpu_key_list[2]) - 1, dispatch_direction,ProcessControl)
-        key = mcpu_key_list[0] + ":mcpu_" + mcpu_key_list[2]
-        g_mcpu.publish(key, msg)
-        QMessageBox.question(None, '提示', '指令发送成功!',
-                             QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
-    def fully_automatic_door(self,mcpu_key_list):
-        dispatch_direction = 0
-        if mcpu_key_list[0] == 'in':
-            dispatch_direction = 1
-        elif mcpu_key_list[0] == 'out':
-            dispatch_direction = 2
-        msg = b'{ "TerminalID": %d, "DispatchDirection": %d, "ProcessControl": 1, "OutPutDo": { "Do0": 0, "Do1": 0, "Do2": 0, "Do3": 0, "Do4": 0, "Do5": 0, "Do6": 0, "Do7": 0 }}' % (
-            int(mcpu_key_list[2]) - 1, dispatch_direction)
-        key = mcpu_key_list[0] + ":mcpu_" + mcpu_key_list[2]
-        g_mcpu.publish(key, msg)
-        QMessageBox.question(None, '提示', '指令发送成功!',
-                             QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
-    def drawSpaceBtn(self, parkspace_dict, unit):
-
-        for park, position in zip(parkspace_dict.values(), self.btn_positions):
-            btn = QPBtn()
-            str = "车位:%d\n楼层:%d" % ((park["id"] - 1) % 78 + 1, park["floor"])
-            if park["statu"] == 1:
-                btn.setStyleSheet("background-color:rgb(255,130,130)")
-            elif park["statu"] == 0 and park["car_number"] is not None:
-                btn.setStyleSheet("background-color:rgb(248,239,71)")
-            btn.setGeometry(0, 0, 50, 50)
-            btn.setText(str)
-            tool_tip = '{"id":%d,\n"floor":%d,\n "subID":%d, \n"height":%f, \n"car_number":"%s" ,\n "unit":%d, \n"statu":%d}' % (
-                park["id"], park["floor"], park["subID"], park["height"], park["car_number"], park["unit"],
-                park["statu"])
-
-            btn.setToolTip(tool_tip)
-            btn.clickedSignal.connect(self.park_btn_click)
-            if unit == 1:
-                self.ui.A_gridLayout.addWidget(btn, *position)
-            if unit == 2:
-                self.ui.B_gridLayout.addWidget(btn, *position)
-            if unit == 3:
-                self.ui.C_gridLayout.addWidget(btn, *position)
+            return
+        btn.setToolTip(msg)
+        if btn.text().find("入口") >= 0:
+            in_mcpu_statu = message.in_mcpu_statu()
+            tf.Parse(msg, in_mcpu_statu)
+            if in_mcpu_statu.is_occupy == 1:
+                btn.setStyleSheet(self.getBackGroundColor("green"))
+                btn.setText(btn.text()[:9] + "空闲----" + btn.text()[15:])
+            else:
+                btn.setStyleSheet(self.getBackGroundColor("yellow"))
+                btn.setText(btn.text()[:9] + "占用----" + btn.text()[15:])
+            # print(btn.text())
+            if in_mcpu_statu.door_statu == 2:
+                btn.setText(btn.text()[:-3] + "开到位")
+            elif in_mcpu_statu.door_statu == 3:
+                btn.setText(btn.text()[:-3] + "关到位")
+            elif in_mcpu_statu.door_statu == 4:
+                btn.setText(btn.text()[:-3] + "开关中")
+            elif in_mcpu_statu.door_statu == 5:
+                btn.setText(btn.text()[:-3] + "门故障")
+
+        elif btn.text().find("出口") >= 0:
+            out_mcpu_statu = message.out_mcpu_statu()
+            tf.Parse(msg, out_mcpu_statu)
+            if out_mcpu_statu.outside_safety == 1:
+                btn.setStyleSheet(self.getBackGroundColor("green"))
+                btn.setText(btn.text()[:9] + "空闲----" + btn.text()[15:])
+            else:
+                btn.setStyleSheet(self.getBackGroundColor("yellow"))
+                btn.setText(btn.text()[:9] + "占用----" + btn.text()[15:])
+
+            if out_mcpu_statu.door_statu == 2:
+                btn.setText(btn.text()[:-3] + "开到位")
+            elif out_mcpu_statu.door_statu == 3:
+                btn.setText(btn.text()[:-3] + "关到位")
+            elif out_mcpu_statu.door_statu == 4:
+                btn.setText(btn.text()[:-3] + "开关中")
+            elif out_mcpu_statu.door_statu == 5:
+                btn.setText(btn.text()[:-3] + "门故障")
+
+
 
     def process_btn_click(self, flag):
         if flag is False:
@@ -493,85 +254,135 @@ class MainWindow(QMainWindow, threading.Thread):
             menu.exec_(QCursor.pos())
 
     def btn_disableSpace(self, dict, statu):
-        if g_space.statu is False:
-            QMessageBox.warning(self, '警告', '数据库连接错误,请检查网络状态!',
-                                QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
-        else:
-            g_space.updatePark(dict, statu)
+        res = g_space.update_space_status(dict["id"],statu)
+        if res == 0:
+            QMessageBox.question(None, '提示', '更新车位失败!请检查是否点击错误!',
+                                 QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
+
+
 
     def btn_opeSpace(self, dict, statu):
-        if g_space.statu is False:
-            QMessageBox.warning(self, '错误', '数据库连接错误,请检查网络状态!',
-                                QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
-        else:
-            g_space.updatePark(dict, statu)
+        res = g_space.update_space_status(dict["id"],statu)
+        if res == 0:
+            QMessageBox.question(None, '提示', '更新车位失败!请检查是否点击错误!',
+                                 QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
 
     def btn_clearSpace(self, dict):
-        if g_space.statu is False:
-            QMessageBox.warning(self, '错误', '数据库连接错误,请检查网络状态!',
-                                QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
-        else:
-            g_space.clearPark(dict)
+        res = g_space.clear_space_data(dict["id"])
+        if res == 0:
+            QMessageBox.question(None, '提示', '更新车位失败!请检查是否点击错误!',
+                                 QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
 
     def btn_pickUp(self, dict):
-        if g_space.statu is False:
-            QMessageBox.warning(self, '错误', '数据库连接错误,请检查网络状态!',
-                                QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
-        else:
-            g_space.pickUpPark(dict)
+        res = g_space.query_vehicle_primary_key(dict["car_number"])
+        print(res)
+        if len(res) < 1:
+            QMessageBox.question(None, '提示', dict["car_number"]+'   未查询到车辆!',
+                                 QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
+        elif len(res) > 1:
+            QMessageBox.question(None, '提示', dict["car_number"]+'   查询到多条结果!请检查数据库!',
+                                 QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
+        elif len(res) == 1:
+            table = message.pick_table()
+            table.primary_key = res[0]["primary_key"]
+            g_rabbitmq.publish("command_ex", "user_command_port", tf.MessageToString(table, as_utf8=True))
+            QMessageBox.question(None, '提示', '取车消息发送成功!',
+                                 QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
 
-    def process_delete(self, dict):
-        if g_space.statu is False:
-            QMessageBox.warning(self, '错误', '数据库连接错误,请检查网络状态!',
-                                QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
-        else:
-            g_space.processDelete(dict)
 
-    def run(self):
-        while self.isClose is not True:
-            if g_space.statu is False:
-                self.setWindowTitle("MainWindow---连接错误!")
-                self.setEnabled(False)
-            else:
-                self.setWindowTitle("MainWindow---连接正常!")
-                self.setEnabled(True)
-            if g_space.isUpdate_A is True:
-                self.drawSpaceBtnSignal.emit(g_space.a_unit_park_dict, 1)
-                g_space.isUpdate_A = False
-            if g_space.isUpdate_B is True:
-                self.drawSpaceBtnSignal.emit(g_space.b_unit_park_dict, 2)
-                g_space.isUpdate_B = False
-            if g_space.isUpdate_C is True:
-                self.drawSpaceBtnSignal.emit(g_space.c_unit_park_dict, 3)
-                g_space.isUpdate_C = False
-
-            for list in statu_ex_keys:
-                ex_name = list[0]
-                key = list[1]
-                id = ex_name + ":" + key
-                if (id in self.rmq_statu.keys()) is False or self.rmq_statu[id].statu != g_rabbitmq[id].statu or \
-                        self.rmq_timeout[id] != g_rabbitmq[id].timeout():
-                    self.rmq_timeout[id] = g_rabbitmq[id].timeout()
-                    self.rmq_statu[id] = g_rabbitmq[id]
-                    g_space.commandIsUpdate = True
-                    self.drawRmqBtnSignal.emit(list)
-                time.sleep(0.01)
-
-            if g_space.commandIsUpdate is True:
-                self.drawLedSignal.emit()
-                self.drawUnitProcessSignal.emit()
-                g_space.commandIsUpdate = False
-            for key, statu in g_mcpu.GetAllMcpuConnectStatus().items():
-                self.drawMcpuBtnSignal.emit(key)
-                time.sleep(0.01)
-            time.sleep(0.5)
+    def process_delete(self, dict):
+        g_space.processDelete(dict)
+
+
+    # def db_callback(self, flag):
+    #     if flag and self.isEnabled() is False:
+    #         self.setWindowTitle("MainWindow---连接正常!")
+    #         self.setEnabled(True)
+    #     elif flag is False and self.isEnabled() is True:
+    #         self.setWindowTitle("MainWindow---连接错误!")
+    #         self.setEnabled(False)
+
+    def getParkData(self,park):
+        text_str = "车位:%d\n楼层:%d" % ((park["id"] - 1) % 78 + 1, park["floor"])
+        stylesheet = ""
+        if park["statu"] == 1:
+            stylesheet = "background-color:rgb(255,130,130)"
+        elif park["statu"] == 0 and park["car_number"] is not None:
+            stylesheet = "background-color:rgb(248,239,71)"
+
+        tool_tip = '{"id":%d,\n"floor":%d,\n "subID":%d, \n"height":%f, \n"car_number":"%s" ,\n "unit":%d, \n"statu":%d}' % (
+            park["id"], park["floor"], park["subID"], park["height"], park["car_number"], park["unit"],
+            park["statu"])
+        return text_str,stylesheet,tool_tip
+    def Switch(self):
+        #绘制车位按钮
+        space_dict = g_space.get_space_dict()
+        for unit in self.space_dict.keys():
+            if self.space_dict[unit] != space_dict[unit]:
+                if self.space_is_init[unit] == False:
+                    self.space_dict[unit] = space_dict[unit]
+                    self.space_is_init[unit] = True
+                    for unit in self.space_dict.keys():
+                        for park, position in zip(self.space_dict[unit], self.btn_positions):
+                            btn = QPBtn()
+                            text_str, stylesheet, tool_tip = self.getParkData(park)
+                            btn.setText(text_str)
+                            btn.setStyleSheet(stylesheet)
+                            btn.setToolTip(tool_tip)
+                            btn.setObjectName(text_str + str(unit))
+                            btn.clickedSignal.connect(self.park_btn_click)
+                            if unit == 1:
+                                self.A_gridLayout.addWidget(btn, *position)
+                            if unit == 2:
+                                self.B_gridLayout.addWidget(btn, *position)
+                            if unit == 3:
+                                self.C_gridLayout.addWidget(btn, *position)
+                else:
+                    for park1,park2 in zip(self.space_dict[unit],space_dict[unit]):
+                        if park1 != park2:
+                            text_str, stylesheet, tool_tip = self.getParkData(park2)
+                            results = self.findChild(QPushButton,text_str + str(unit))
+                            results.setText(text_str)
+                            results.setStyleSheet(stylesheet)
+                            results.setToolTip(tool_tip)
+                    self.space_dict[unit] = space_dict[unit]
+
+        #绘制出入口状态按钮
+        for key in self.rmq_statu_dict.keys():
+            if g_rabbitmq["statu_ex:"+key].timeout() is True:
+                self.rmq_statu_dict[key] = {}
+                self.drawRmqBtn(None,key)
+
+            elif self.rmq_statu_dict[key] != g_rabbitmq["statu_ex:"+key].statu :
+                self.rmq_statu_dict[key] = g_rabbitmq["statu_ex:"+key].statu
+                self.drawRmqBtn(self.rmq_statu_dict[key],key)
+
+        # #绘制信号灯
+        # command_dict = g_space.get_command_dict()
+        # self.drawLed(command_dict)
+        #绘制流程界面
+        command_dict = g_space.get_command_dict()
+        for key in self.command_dict.keys():
+            if self.command_dict[key] != command_dict[key]:
+                self.command_dict[key] = command_dict[key]
+                if key == 1:
+                    self.A_listWidget.clear()
+                    for dict in self.command_dict[key]:
+                        self.A_listWidget.addItem(self.getListWidgetItem(dict))
+                elif key == 2:
+                    self.B_listWidget.clear()
+                    for dict in self.command_dict[key]:
+                        self.B_listWidget.addItem(self.getListWidgetItem(dict))
+                elif key == 3:
+                    self.C_listWidget.clear()
+                    for dict in self.command_dict[key]:
+                        self.C_listWidget.addItem(self.getListWidgetItem(dict))
 
     def closeEvent(self, event):
         results = QMessageBox.question(self, '退出', '你确定要退出吗?', QMessageBox.Yes | QMessageBox.No,
                                        QMessageBox.No)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
         if results == QMessageBox.Yes:
             g_rabbitmq.close()
-            g_mcpu.McpuCommunicatorUnInit()
             g_space.close()
             self.isClose = True
 
@@ -581,22 +392,119 @@ class MainWindow(QMainWindow, threading.Thread):
             event.ignore()  # 忽略关闭事件
 
 
-g_rabbitmq = cmt.RabbitAsyncCommunicator(mq_ip, mq_port, mq_user, mq_password)
-g_space = spmng.ParkManage(db_ip, db_port, db_name, db_user, db_password, g_rabbitmq)
-g_mcpu = mcn.McpuCommunicator(mcpu_keys)
 
 if __name__ == '__main__':
-    app = QApplication(sys.argv)
-    g_space.start()
+    g_rabbitmq = cmt.RabbitAsyncCommunicator(mq_ip, mq_port, mq_user, mq_password)
     g_rabbitmq.Init(None, statu_ex_keys)
     g_rabbitmq.start()
-    g_mcpu.McpuCommunicatorInit()
+    g_space = spmng.DBOperation()
+    g_space.start()
+
+    app = QApplication(sys.argv)
     mainWindow = MainWindow()
-    mainWindow.start()
     mainWindow.showMaximized()
-    time.sleep(0.5)
-    mainWindow.show()
 
     sys.exit(app.exec_())
 
+
+
+
+
+        # self.drawLedSignal.emit()
+        # self.drawUnitProcessSignal.emit()
+        # return
+
+    # def run(self):
+    #     while self.isClose is not True:
+    #         if g_space.statu is False:
+    #             self.setWindowTitle("MainWindow---连接错误!")
+    #             self.setEnabled(False)
+    #         else:
+    #             self.setWindowTitle("MainWindow---连接正常!")
+    #             self.setEnabled(True)
+    #
+    #         for list in statu_ex_keys:
+    #             ex_name = list[0]
+    #             key = list[1]
+    #             id = ex_name + ":" + key
+    #             if (id in self.rmq_statu.keys()) is False or self.rmq_statu[id].statu != g_rabbitmq[id].statu or \
+    #                     self.rmq_timeout[id] != g_rabbitmq[id].timeout():
+    #                 self.rmq_timeout[id] = g_rabbitmq[id].timeout()
+    #                 self.rmq_statu[id] = g_rabbitmq[id]
+    #                 self.drawLedSignal.emit()
+    #                 self.drawUnitProcessSignal.emit()
+    #                 self.drawRmqBtnSignal.emit(list)
+    #             time.sleep(0.01)
+    #         for key, statu in g_mcpu.GetAllMcpuConnectStatus().items():
+    #             self.drawMcpuBtnSignal.emit(key)
+    #             time.sleep(0.01)
+    #         time.sleep(0.5)
     # 进入程序的主循环,并通过exit函数确保主循环安全结束(该释放资源的一定要释放)
+    # def mcpu_btn_click(self):
+    #     sender = self.sender()
+    #     mcpu_key_list = sender.objectName().split('_')
+    #     menu = QMenu(self)
+    #     action = menu.addAction('手动开门')
+    #     action.triggered.connect(partial(self.manual_open_door, mcpu_key_list))
+    #     action = menu.addAction('手动关门')
+    #     action.triggered.connect(partial(self.manual_close_door, mcpu_key_list))
+    #     action = menu.addAction('恢复半自动')
+    #     action.triggered.connect(partial(self.automatic_door, mcpu_key_list))
+    #     action = menu.addAction('恢复全自动')
+    #     action.triggered.connect(partial(self.fully_automatic_door, mcpu_key_list))
+    #     menu.exec_(QCursor.pos())
+    #
+    # def manual_open_door(self, mcpu_key_list):
+    #     dispatch_direction = 0
+    #     if mcpu_key_list[0] == 'in':
+    #         dispatch_direction = 1
+    #     elif mcpu_key_list[0] == 'out':
+    #         dispatch_direction = 2
+    #     msg = b'{ "TerminalID": %d, "DispatchDirection": %d, "ProcessControl": 2, "OutPutDo": { "Do0": 1, "Do1": 0, "Do2": 0, "Do3": 0, "Do4": 0, "Do5": 0, "Do6": 0, "Do7": 0 }}' % (
+    #         int(mcpu_key_list[2]) - 1, dispatch_direction)
+    #     key = mcpu_key_list[0] + ":mcpu_" + mcpu_key_list[2]
+    #     g_mcpu.publish(key, msg)
+    #     QMessageBox.question(None, '提示', '指令发送成功!',
+    #                          QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
+    #
+    # def manual_close_door(self, mcpu_key_list):
+    #     dispatch_direction = 0
+    #     if mcpu_key_list[0] == 'in':
+    #         dispatch_direction = 1
+    #     elif mcpu_key_list[0] == 'out':
+    #         dispatch_direction = 2
+    #     msg = b'{ "TerminalID": %d, "DispatchDirection": %d, "ProcessControl": 2, "OutPutDo": { "Do0": 0, "Do1": 1, "Do2": 0, "Do3": 0, "Do4": 0, "Do5": 0, "Do6": 0, "Do7": 0 }}' % (
+    #         int(mcpu_key_list[2]) - 1, dispatch_direction)
+    #     key = mcpu_key_list[0] + ":mcpu_" + mcpu_key_list[2]
+    #     g_mcpu.publish(key, msg)
+    #     QMessageBox.question(None, '提示', '指令发送成功!',
+    #                          QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
+    #
+    # def automatic_door(self, mcpu_key_list):
+    #     dispatch_direction = 0
+    #     ProcessControl = 0
+    #     if mcpu_key_list[0] == 'in':
+    #         ProcessControl = 3
+    #         dispatch_direction = 1
+    #     elif mcpu_key_list[0] == 'out':
+    #         ProcessControl = 4
+    #         dispatch_direction = 2
+    #     msg = b'{ "TerminalID": %d, "DispatchDirection": %d, "ProcessControl": %d, "OutPutDo": { "Do0": 0, "Do1": 0, "Do2": 0, "Do3": 0, "Do4": 0, "Do5": 0, "Do6": 0, "Do7": 0 }}' % (
+    #         int(mcpu_key_list[2]) - 1, dispatch_direction, ProcessControl)
+    #     key = mcpu_key_list[0] + ":mcpu_" + mcpu_key_list[2]
+    #     g_mcpu.publish(key, msg)
+    #     QMessageBox.question(None, '提示', '指令发送成功!',
+    #                          QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
+    #
+    # def fully_automatic_door(self, mcpu_key_list):
+    #     dispatch_direction = 0
+    #     if mcpu_key_list[0] == 'in':
+    #         dispatch_direction = 1
+    #     elif mcpu_key_list[0] == 'out':
+    #         dispatch_direction = 2
+    #     msg = b'{ "TerminalID": %d, "DispatchDirection": %d, "ProcessControl": 1, "OutPutDo": { "Do0": 0, "Do1": 0, "Do2": 0, "Do3": 0, "Do4": 0, "Do5": 0, "Do6": 0, "Do7": 0 }}' % (
+    #         int(mcpu_key_list[2]) - 1, dispatch_direction)
+    #     key = mcpu_key_list[0] + ":mcpu_" + mcpu_key_list[2]
+    #     g_mcpu.publish(key, msg)
+    #     QMessageBox.question(None, '提示', '指令发送成功!',
+    #                          QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容

+ 1 - 0
管理节点/proto.sh

@@ -0,0 +1 @@
+protoc -I=../ --python_out=./ ../message.proto

+ 0 - 149
管理节点/spaceManage.py

@@ -1,149 +0,0 @@
-import threading
-import time
-
-from PyQt5.QtWidgets import QMessageBox
-import pymysql
-import google.protobuf.text_format as tf
-import message.message_pb2 as msg
-
-
-class ParkManage(threading.Thread):
-    def __init__(self, ip, port, database, user, password, sender):
-        threading.Thread.__init__(self)
-        self.conn = None
-        self.ip = ip
-        self.port = port
-        self.database = database
-        self.user = user
-        self.password = password
-        self.lock = threading.Lock()
-        self.command_queue_dict = None
-        self.commandIsUpdate = False
-
-        self.a_unit_park_dict = {}
-        self.b_unit_park_dict = {}
-        self.c_unit_park_dict = {}
-        self.isClose = False
-        self.statu = False
-        self.isUpdate_A = False
-        self.isUpdate_B = False
-        self.isUpdate_C = False
-        self.g_sender = sender
-
-    def connect(self):
-        try:
-            self.conn = pymysql.connect(host=self.ip, port=self.port, database=self.database, charset="utf8",
-                                        user=self.user, passwd=self.password)
-            return True
-        except:
-            return False
-
-    def updatePark(self, dict, statu):
-        self.lock.acquire()
-        cursor = self.conn.cursor()
-        SQL = "update space set statu=%d where id=%d" % (statu, dict["id"])
-        cursor.execute(SQL)
-        print(SQL)
-        self.conn.commit()
-        cursor.close()
-        self.lock.release()
-
-    def clearPark(self, dict):
-        self.lock.acquire()
-        cursor = self.conn.cursor()
-        SQL = "update space set car_number=NULL where id=%d" % (dict["id"])
-        cursor.execute(SQL)
-        print(SQL)
-        self.conn.commit()
-        cursor.close()
-        self.lock.release()
-    def processDelete(self, dict):
-        self.lock.acquire()
-        cursor = self.conn.cursor()
-        SQL = "delete from command_queue where car_number='%s';" % (dict["car_number"])
-        cursor.execute(SQL)
-        print(SQL)
-        self.conn.commit()
-        cursor.close()
-        self.lock.release()
-
-    def pickUpPark(self, dict):
-        with self.lock:
-            cursor = self.conn.cursor()
-            SQL = "select primary_key from vehicle where car_number='%s'" % (dict["car_number"])
-            cursor.execute(SQL)
-            self.conn.commit()
-            results = cursor.fetchall()
-            if len(results) == 1:
-                key = ''.join(results[0])
-                table = msg.pick_table()
-                table.primary_key = key
-                self.g_sender.publish("command_ex", "user_command_port", tf.MessageToString(table, as_utf8=True))
-                QMessageBox.question(None, '提示', '取车消息发送成功!',
-                                     QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
-
-            else:
-                QMessageBox.warning(None, '警告', '查询结果有误,请检查数据库!',
-                                    QMessageBox.Ok)  # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
-            cursor.close()
-    def close(self):
-        self.isClose = True
-    def run(self):
-        while self.isClose is not True:
-            try:
-                self.conn.ping()  # 采用连接对象的ping()函数检测连接状态
-                # print('connect MySql-OK   statu=' + str(self.statu))
-                self.statu = True
-            except:
-                self.statu = False
-                # print('connect MySql-ERROR  statu=' + str(self.statu))
-                self.connect()
-                time.sleep(0.5)
-                continue
-            with self.lock:
-                # 获取一个光标
-                cursor = self.conn.cursor()
-                SQL = "select * from space"
-                t_a_unit_park_dict = {}
-                t_b_unit_park_dict = {}
-                t_c_unit_park_dict = {}
-                results = cursor.execute(SQL)
-                self.conn.commit()
-                # 结果数量大于0
-                if results > 0:
-                    parkspace = cursor.fetchall()
-                    column = [index[0] for index in cursor.description]  # 列名
-                    for row, i in zip(parkspace, range(results)):
-                        if row[5] == 1:
-                            t_a_unit_park_dict[i % 78] = dict(zip(column, row))
-                        if row[5] == 2:
-                            t_b_unit_park_dict[i % 78] = dict(zip(column, row))
-                        if row[5] == 3:
-                            t_c_unit_park_dict[i % 78] = dict(zip(column, row))
-
-                if self.a_unit_park_dict != t_a_unit_park_dict:
-                    self.a_unit_park_dict = t_a_unit_park_dict
-                    self.isUpdate_A = True
-                elif self.b_unit_park_dict != t_b_unit_park_dict:
-                    self.b_unit_park_dict = t_b_unit_park_dict
-                    self.isUpdate_B = True
-                elif self.c_unit_park_dict != t_c_unit_park_dict:
-                    self.c_unit_park_dict = t_c_unit_park_dict
-                    self.isUpdate_C = True
-                # SQL = "select * from command_queue where type =2 and (statu=1 or statu=2)"
-                SQL = "select * from command_queue"
-                t_command_dict = {}
-                results = cursor.execute(SQL)
-                self.conn.commit()
-                if results > 0:
-                    command_queue = cursor.fetchall()
-                    column = [index[0] for index in cursor.description]  # 列名
-                    t_command_dict = [dict(zip(column, row)) for row in command_queue]  # row是数据库返回的一条一条记录,其中的每一天和column写成字典,最后就是字典数组
-                if self.command_queue_dict != t_command_dict:
-                    self.command_queue_dict = t_command_dict
-                    self.commandIsUpdate = True
-
-                # 关闭光标
-                cursor.close()
-                # print("------------------------------")
-            time.sleep(0.5)

+ 99 - 260
管理节点/ui/spaceUi.py

@@ -207,259 +207,112 @@ class Ui_MainWindow(object):
         self.process.setObjectName("process")
         self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.process)
         self.verticalLayout_4.setObjectName("verticalLayout_4")
-        self.process_verticalLayout = QtWidgets.QVBoxLayout()
-        self.process_verticalLayout.setObjectName("process_verticalLayout")
-        self.out_wiget = QtWidgets.QWidget(self.process)
-        self.out_wiget.setObjectName("out_wiget")
-        self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.out_wiget)
-        self.verticalLayout_6.setObjectName("verticalLayout_6")
-        self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
-        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
-        spacerItem14 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_6.addItem(spacerItem14)
-        self.pushButton = QtWidgets.QPushButton(self.out_wiget)
-        self.pushButton.setMinimumSize(QtCore.QSize(0, 35))
+        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
+        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
+        self.image_label = QtWidgets.QLabel(self.process)
+        self.image_label.setText("")
+        self.image_label.setObjectName("image_label")
+        self.horizontalLayout_3.addWidget(self.image_label)
+        self.label = QtWidgets.QLabel(self.process)
+        self.label.setMaximumSize(QtCore.QSize(16777215, 16777215))
         font = QtGui.QFont()
-        font.setPointSize(11)
+        font.setFamily("华文楷体")
+        font.setPointSize(60)
         font.setBold(True)
         font.setWeight(75)
-        self.pushButton.setFont(font)
-        self.pushButton.setStyleSheet("border:3px groove orange;border-radius:10px;padding:2px 4px")
-        self.pushButton.setObjectName("pushButton")
-        self.horizontalLayout_6.addWidget(self.pushButton)
-        spacerItem15 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_6.addItem(spacerItem15)
-        self.pushButton_2 = QtWidgets.QPushButton(self.out_wiget)
-        self.pushButton_2.setMinimumSize(QtCore.QSize(0, 35))
+        self.label.setFont(font)
+        self.label.setStyleSheet("color: blue")
+        self.label.setAlignment(QtCore.Qt.AlignCenter)
+        self.label.setObjectName("label")
+        self.horizontalLayout_3.addWidget(self.label)
+        self.horizontalLayout_3.setStretch(0, 1)
+        self.horizontalLayout_3.setStretch(1, 2)
+        self.verticalLayout_4.addLayout(self.horizontalLayout_3)
+        self.process_horizontalLayout = QtWidgets.QHBoxLayout()
+        self.process_horizontalLayout.setObjectName("process_horizontalLayout")
+        self.A_listWidget = QtWidgets.QListWidget(self.process)
+        self.A_listWidget.setStyleSheet("")
+        self.A_listWidget.setObjectName("A_listWidget")
+        self.process_horizontalLayout.addWidget(self.A_listWidget)
+        self.B_listWidget = QtWidgets.QListWidget(self.process)
+        self.B_listWidget.setObjectName("B_listWidget")
+        self.process_horizontalLayout.addWidget(self.B_listWidget)
+        self.C_listWidget = QtWidgets.QListWidget(self.process)
+        self.C_listWidget.setObjectName("C_listWidget")
+        self.process_horizontalLayout.addWidget(self.C_listWidget)
+        self.verticalLayout_4.addLayout(self.process_horizontalLayout)
+        self.unit_horizontalLayout = QtWidgets.QHBoxLayout()
+        self.unit_horizontalLayout.setObjectName("unit_horizontalLayout")
+        self.A_label_2 = QtWidgets.QLabel(self.process)
         font = QtGui.QFont()
-        font.setPointSize(11)
-        font.setBold(True)
-        font.setWeight(75)
-        self.pushButton_2.setFont(font)
-        self.pushButton_2.setStyleSheet("border:3px groove blue;border-radius:10px;padding:2px 4px")
-        self.pushButton_2.setObjectName("pushButton_2")
-        self.horizontalLayout_6.addWidget(self.pushButton_2)
-        spacerItem16 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_6.addItem(spacerItem16)
-        self.pushButton_6 = QtWidgets.QPushButton(self.out_wiget)
-        self.pushButton_6.setMinimumSize(QtCore.QSize(0, 35))
+        font.setFamily("华文楷体")
+        font.setPointSize(40)
+        font.setBold(False)
+        font.setWeight(50)
+        self.A_label_2.setFont(font)
+        self.A_label_2.setStyleSheet("color: blue")
+        self.A_label_2.setAlignment(QtCore.Qt.AlignCenter)
+        self.A_label_2.setObjectName("A_label_2")
+        self.unit_horizontalLayout.addWidget(self.A_label_2)
+        self.B_label_2 = QtWidgets.QLabel(self.process)
         font = QtGui.QFont()
-        font.setPointSize(11)
-        font.setBold(True)
-        font.setWeight(75)
-        self.pushButton_6.setFont(font)
-        self.pushButton_6.setStyleSheet("border:3px groove green;border-radius:10px;padding:2px 4px;background-color:rgb(241,158,194)")
-        self.pushButton_6.setObjectName("pushButton_6")
-        self.horizontalLayout_6.addWidget(self.pushButton_6)
-        spacerItem17 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_6.addItem(spacerItem17)
-        self.pushButton_4 = QtWidgets.QPushButton(self.out_wiget)
-        self.pushButton_4.setMinimumSize(QtCore.QSize(0, 35))
+        font.setFamily("华文楷体")
+        font.setPointSize(40)
+        font.setBold(False)
+        font.setWeight(50)
+        self.B_label_2.setFont(font)
+        self.B_label_2.setStyleSheet("color: blue")
+        self.B_label_2.setAlignment(QtCore.Qt.AlignCenter)
+        self.B_label_2.setObjectName("B_label_2")
+        self.unit_horizontalLayout.addWidget(self.B_label_2)
+        self.C_label_2 = QtWidgets.QLabel(self.process)
         font = QtGui.QFont()
-        font.setPointSize(11)
-        font.setBold(True)
-        font.setWeight(75)
-        self.pushButton_4.setFont(font)
-        self.pushButton_4.setStyleSheet("border:3px groove green;border-radius:10px;padding:2px 4px;background-color:rgb(0,180,0)")
-        self.pushButton_4.setObjectName("pushButton_4")
-        self.horizontalLayout_6.addWidget(self.pushButton_4)
-        spacerItem18 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_6.addItem(spacerItem18)
-        self.pushButton_5 = QtWidgets.QPushButton(self.out_wiget)
-        self.pushButton_5.setMinimumSize(QtCore.QSize(0, 35))
+        font.setFamily("华文楷体")
+        font.setPointSize(40)
+        font.setBold(False)
+        font.setWeight(50)
+        self.C_label_2.setFont(font)
+        self.C_label_2.setStyleSheet("color: blue;")
+        self.C_label_2.setAlignment(QtCore.Qt.AlignCenter)
+        self.C_label_2.setObjectName("C_label_2")
+        self.unit_horizontalLayout.addWidget(self.C_label_2)
+        self.verticalLayout_4.addLayout(self.unit_horizontalLayout)
+        self.export_horizontalLayout = QtWidgets.QHBoxLayout()
+        self.export_horizontalLayout.setObjectName("export_horizontalLayout")
+        self.export_1_label = QtWidgets.QLabel(self.process)
         font = QtGui.QFont()
-        font.setPointSize(11)
+        font.setFamily("华文楷体")
+        font.setPointSize(30)
         font.setBold(True)
         font.setWeight(75)
-        self.pushButton_5.setFont(font)
-        self.pushButton_5.setStyleSheet("border:3px groove yellow;border-radius:10px;padding:2px 4px;background-color:rgb(248,239,71)")
-        self.pushButton_5.setObjectName("pushButton_5")
-        self.horizontalLayout_6.addWidget(self.pushButton_5)
-        spacerItem19 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_6.addItem(spacerItem19)
-        self.pushButton_3 = QtWidgets.QPushButton(self.out_wiget)
-        self.pushButton_3.setMinimumSize(QtCore.QSize(0, 35))
+        self.export_1_label.setFont(font)
+        self.export_1_label.setStyleSheet("color: blue")
+        self.export_1_label.setAlignment(QtCore.Qt.AlignCenter)
+        self.export_1_label.setObjectName("export_1_label")
+        self.export_horizontalLayout.addWidget(self.export_1_label)
+        self.export_2_label = QtWidgets.QLabel(self.process)
         font = QtGui.QFont()
-        font.setPointSize(11)
+        font.setFamily("华文楷体")
+        font.setPointSize(30)
         font.setBold(True)
         font.setWeight(75)
-        self.pushButton_3.setFont(font)
-        self.pushButton_3.setStyleSheet("border:3px groove red;border-radius:10px;padding:2px 4px;background-color:rgb(255,70,70)")
-        self.pushButton_3.setObjectName("pushButton_3")
-        self.horizontalLayout_6.addWidget(self.pushButton_3)
-        spacerItem20 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_6.addItem(spacerItem20)
-        self.horizontalLayout_6.setStretch(1, 1)
-        self.horizontalLayout_6.setStretch(3, 1)
-        self.horizontalLayout_6.setStretch(5, 1)
-        self.horizontalLayout_6.setStretch(7, 1)
-        self.horizontalLayout_6.setStretch(9, 1)
-        self.horizontalLayout_6.setStretch(11, 1)
-        self.verticalLayout_6.addLayout(self.horizontalLayout_6)
-        self.outmcpu_widget = QtWidgets.QWidget(self.out_wiget)
-        self.outmcpu_widget.setObjectName("outmcpu_widget")
-        self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.outmcpu_widget)
-        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
-        spacerItem21 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_5.addItem(spacerItem21)
-        self.out_mcpu_1_statu_btn = QtWidgets.QPushButton(self.outmcpu_widget)
-        self.out_mcpu_1_statu_btn.setObjectName("out_mcpu_1_statu_btn")
-        self.horizontalLayout_5.addWidget(self.out_mcpu_1_statu_btn)
-        spacerItem22 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_5.addItem(spacerItem22)
-        self.out_mcpu_2_statu_btn = QtWidgets.QPushButton(self.outmcpu_widget)
-        self.out_mcpu_2_statu_btn.setObjectName("out_mcpu_2_statu_btn")
-        self.horizontalLayout_5.addWidget(self.out_mcpu_2_statu_btn)
-        spacerItem23 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_5.addItem(spacerItem23)
-        self.out_mcpu_3_statu_btn = QtWidgets.QPushButton(self.outmcpu_widget)
-        self.out_mcpu_3_statu_btn.setObjectName("out_mcpu_3_statu_btn")
-        self.horizontalLayout_5.addWidget(self.out_mcpu_3_statu_btn)
-        spacerItem24 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_5.addItem(spacerItem24)
-        self.out_mcpu_4_statu_btn = QtWidgets.QPushButton(self.outmcpu_widget)
-        self.out_mcpu_4_statu_btn.setObjectName("out_mcpu_4_statu_btn")
-        self.horizontalLayout_5.addWidget(self.out_mcpu_4_statu_btn)
-        spacerItem25 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_5.addItem(spacerItem25)
-        self.out_mcpu_5_statu_btn = QtWidgets.QPushButton(self.outmcpu_widget)
-        self.out_mcpu_5_statu_btn.setObjectName("out_mcpu_5_statu_btn")
-        self.horizontalLayout_5.addWidget(self.out_mcpu_5_statu_btn)
-        spacerItem26 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_5.addItem(spacerItem26)
-        self.out_mcpu_6_statu_btn = QtWidgets.QPushButton(self.outmcpu_widget)
-        self.out_mcpu_6_statu_btn.setObjectName("out_mcpu_6_statu_btn")
-        self.horizontalLayout_5.addWidget(self.out_mcpu_6_statu_btn)
-        spacerItem27 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_5.addItem(spacerItem27)
-        self.horizontalLayout_5.setStretch(1, 4)
-        self.horizontalLayout_5.setStretch(3, 4)
-        self.horizontalLayout_5.setStretch(5, 4)
-        self.horizontalLayout_5.setStretch(7, 4)
-        self.horizontalLayout_5.setStretch(9, 4)
-        self.horizontalLayout_5.setStretch(11, 4)
-        self.verticalLayout_6.addWidget(self.outmcpu_widget)
-        self.process_verticalLayout.addWidget(self.out_wiget)
-        self.process_widget = QtWidgets.QWidget(self.process)
-        self.process_widget.setStyleSheet("")
-        self.process_widget.setObjectName("process_widget")
-        self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.process_widget)
-        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
-        self.fill_22 = QtWidgets.QWidget(self.process_widget)
-        self.fill_22.setObjectName("fill_22")
-        self.horizontalLayout_3.addWidget(self.fill_22)
-        self.A_verticalLayout = QtWidgets.QVBoxLayout()
-        self.A_verticalLayout.setObjectName("A_verticalLayout")
-        self.horizontalLayout_3.addLayout(self.A_verticalLayout)
-        self.fill_20 = QtWidgets.QWidget(self.process_widget)
-        self.fill_20.setObjectName("fill_20")
-        self.horizontalLayout_3.addWidget(self.fill_20)
-        self.B_verticalLayout = QtWidgets.QVBoxLayout()
-        self.B_verticalLayout.setObjectName("B_verticalLayout")
-        self.horizontalLayout_3.addLayout(self.B_verticalLayout)
-        self.fill_21 = QtWidgets.QWidget(self.process_widget)
-        self.fill_21.setObjectName("fill_21")
-        self.horizontalLayout_3.addWidget(self.fill_21)
-        self.C_verticalLayout = QtWidgets.QVBoxLayout()
-        self.C_verticalLayout.setObjectName("C_verticalLayout")
-        self.horizontalLayout_3.addLayout(self.C_verticalLayout)
-        self.fill_19 = QtWidgets.QWidget(self.process_widget)
-        self.fill_19.setObjectName("fill_19")
-        self.horizontalLayout_3.addWidget(self.fill_19)
-        self.horizontalLayout_3.setStretch(0, 2)
-        self.horizontalLayout_3.setStretch(1, 19)
-        self.horizontalLayout_3.setStretch(2, 2)
-        self.horizontalLayout_3.setStretch(3, 19)
-        self.horizontalLayout_3.setStretch(4, 2)
-        self.horizontalLayout_3.setStretch(5, 19)
-        self.horizontalLayout_3.setStretch(6, 2)
-        self.fill_20.raise_()
-        self.fill_22.raise_()
-        self.fill_21.raise_()
-        self.fill_19.raise_()
-        self.process_verticalLayout.addWidget(self.process_widget)
-        self.in_widget = QtWidgets.QWidget(self.process)
-        self.in_widget.setObjectName("in_widget")
-        self.verticalLayout_7 = QtWidgets.QVBoxLayout(self.in_widget)
-        self.verticalLayout_7.setObjectName("verticalLayout_7")
-        self.inmcpu_widget = QtWidgets.QWidget(self.in_widget)
-        self.inmcpu_widget.setObjectName("inmcpu_widget")
-        self.horizontalLayout_11 = QtWidgets.QHBoxLayout(self.inmcpu_widget)
-        self.horizontalLayout_11.setObjectName("horizontalLayout_11")
-        spacerItem28 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_11.addItem(spacerItem28)
-        self.in_mcpu_1_statu_btn = QtWidgets.QPushButton(self.inmcpu_widget)
-        self.in_mcpu_1_statu_btn.setObjectName("in_mcpu_1_statu_btn")
-        self.horizontalLayout_11.addWidget(self.in_mcpu_1_statu_btn)
-        spacerItem29 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_11.addItem(spacerItem29)
-        self.in_mcpu_2_statu_btn = QtWidgets.QPushButton(self.inmcpu_widget)
-        self.in_mcpu_2_statu_btn.setObjectName("in_mcpu_2_statu_btn")
-        self.horizontalLayout_11.addWidget(self.in_mcpu_2_statu_btn)
-        spacerItem30 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_11.addItem(spacerItem30)
-        self.in_mcpu_3_statu_btn = QtWidgets.QPushButton(self.inmcpu_widget)
-        self.in_mcpu_3_statu_btn.setObjectName("in_mcpu_3_statu_btn")
-        self.horizontalLayout_11.addWidget(self.in_mcpu_3_statu_btn)
-        spacerItem31 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_11.addItem(spacerItem31)
-        self.in_mcpu_4_statu_btn = QtWidgets.QPushButton(self.inmcpu_widget)
-        self.in_mcpu_4_statu_btn.setObjectName("in_mcpu_4_statu_btn")
-        self.horizontalLayout_11.addWidget(self.in_mcpu_4_statu_btn)
-        spacerItem32 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_11.addItem(spacerItem32)
-        self.in_mcpu_5_statu_btn = QtWidgets.QPushButton(self.inmcpu_widget)
-        self.in_mcpu_5_statu_btn.setObjectName("in_mcpu_5_statu_btn")
-        self.horizontalLayout_11.addWidget(self.in_mcpu_5_statu_btn)
-        spacerItem33 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_11.addItem(spacerItem33)
-        self.in_mcpu_6_statu_btn = QtWidgets.QPushButton(self.inmcpu_widget)
-        self.in_mcpu_6_statu_btn.setObjectName("in_mcpu_6_statu_btn")
-        self.horizontalLayout_11.addWidget(self.in_mcpu_6_statu_btn)
-        spacerItem34 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
-        self.horizontalLayout_11.addItem(spacerItem34)
-        self.horizontalLayout_11.setStretch(1, 4)
-        self.horizontalLayout_11.setStretch(3, 4)
-        self.horizontalLayout_11.setStretch(5, 4)
-        self.horizontalLayout_11.setStretch(7, 4)
-        self.horizontalLayout_11.setStretch(9, 4)
-        self.horizontalLayout_11.setStretch(11, 4)
-        self.verticalLayout_7.addWidget(self.inmcpu_widget)
-        self.unit_labelLayout = QtWidgets.QHBoxLayout()
-        self.unit_labelLayout.setObjectName("unit_labelLayout")
-        self.A_label_3 = QtWidgets.QLabel(self.in_widget)
+        self.export_2_label.setFont(font)
+        self.export_2_label.setStyleSheet("color: blue")
+        self.export_2_label.setAlignment(QtCore.Qt.AlignCenter)
+        self.export_2_label.setObjectName("export_2_label")
+        self.export_horizontalLayout.addWidget(self.export_2_label)
+        self.export_3_label = QtWidgets.QLabel(self.process)
         font = QtGui.QFont()
-        font.setPointSize(32)
-        font.setBold(True)
-        font.setWeight(75)
-        self.A_label_3.setFont(font)
-        self.A_label_3.setAlignment(QtCore.Qt.AlignCenter)
-        self.A_label_3.setObjectName("A_label_3")
-        self.unit_labelLayout.addWidget(self.A_label_3)
-        self.B_label_3 = QtWidgets.QLabel(self.in_widget)
-        font = QtGui.QFont()
-        font.setPointSize(32)
-        font.setBold(True)
-        font.setWeight(75)
-        self.B_label_3.setFont(font)
-        self.B_label_3.setAlignment(QtCore.Qt.AlignCenter)
-        self.B_label_3.setObjectName("B_label_3")
-        self.unit_labelLayout.addWidget(self.B_label_3)
-        self.C_label_3 = QtWidgets.QLabel(self.in_widget)
-        font = QtGui.QFont()
-        font.setPointSize(32)
+        font.setFamily("华文楷体")
+        font.setPointSize(30)
         font.setBold(True)
         font.setWeight(75)
-        self.C_label_3.setFont(font)
-        self.C_label_3.setAlignment(QtCore.Qt.AlignCenter)
-        self.C_label_3.setObjectName("C_label_3")
-        self.unit_labelLayout.addWidget(self.C_label_3)
-        self.verticalLayout_7.addLayout(self.unit_labelLayout)
-        self.process_verticalLayout.addWidget(self.in_widget)
-        self.process_verticalLayout.setStretch(0, 2)
-        self.process_verticalLayout.setStretch(1, 10)
-        self.process_verticalLayout.setStretch(2, 1)
-        self.verticalLayout_4.addLayout(self.process_verticalLayout)
+        self.export_3_label.setFont(font)
+        self.export_3_label.setStyleSheet("color: blue")
+        self.export_3_label.setAlignment(QtCore.Qt.AlignCenter)
+        self.export_3_label.setObjectName("export_3_label")
+        self.export_horizontalLayout.addWidget(self.export_3_label)
+        self.verticalLayout_4.addLayout(self.export_horizontalLayout)
         self.tabWidget.addTab(self.process, "")
         self.verticalLayout.addWidget(self.tabWidget)
         MainWindow.setCentralWidget(self.centralwidget)
@@ -472,7 +325,7 @@ class Ui_MainWindow(object):
         MainWindow.setStatusBar(self.statusbar)
 
         self.retranslateUi(MainWindow)
-        self.tabWidget.setCurrentIndex(1)
+        self.tabWidget.setCurrentIndex(0)
         QtCore.QMetaObject.connectSlotsByName(MainWindow)
 
     def retranslateUi(self, MainWindow):
@@ -494,25 +347,11 @@ class Ui_MainWindow(object):
         self.B_label.setText(_translate("MainWindow", "B库"))
         self.C_label.setText(_translate("MainWindow", "C库"))
         self.tabWidget.setTabText(self.tabWidget.indexOf(self.parkingspace), _translate("MainWindow", "车位管理"))
-        self.pushButton.setText(_translate("MainWindow", "橙色边框代表存车任务"))
-        self.pushButton_2.setText(_translate("MainWindow", "蓝色边框代表取车任务"))
-        self.pushButton_6.setText(_translate("MainWindow", "粉色底色代表任务排队中"))
-        self.pushButton_4.setText(_translate("MainWindow", "绿色底色代表任务已完成"))
-        self.pushButton_5.setText(_translate("MainWindow", "黄色底色代表任务工作中"))
-        self.pushButton_3.setText(_translate("MainWindow", "红色底色代表任务错误"))
-        self.out_mcpu_1_statu_btn.setText(_translate("MainWindow", "A1出口单片机---断连"))
-        self.out_mcpu_2_statu_btn.setText(_translate("MainWindow", "A2出口单片机---断连"))
-        self.out_mcpu_3_statu_btn.setText(_translate("MainWindow", "B1出口单片机---断连"))
-        self.out_mcpu_4_statu_btn.setText(_translate("MainWindow", "B2出口单片机---断连"))
-        self.out_mcpu_5_statu_btn.setText(_translate("MainWindow", "C1出口单片机---断连"))
-        self.out_mcpu_6_statu_btn.setText(_translate("MainWindow", "C2出口单片机---断连"))
-        self.in_mcpu_1_statu_btn.setText(_translate("MainWindow", "A1入口单片机---断连"))
-        self.in_mcpu_2_statu_btn.setText(_translate("MainWindow", "A2入口单片机---断连"))
-        self.in_mcpu_3_statu_btn.setText(_translate("MainWindow", "B1入口单片机---断连"))
-        self.in_mcpu_4_statu_btn.setText(_translate("MainWindow", "B2入口单片机---断连"))
-        self.in_mcpu_5_statu_btn.setText(_translate("MainWindow", "C1入口单片机---断连"))
-        self.in_mcpu_6_statu_btn.setText(_translate("MainWindow", "C2入口单片机---断连"))
-        self.A_label_3.setText(_translate("MainWindow", "A库任务"))
-        self.B_label_3.setText(_translate("MainWindow", "B库任务"))
-        self.C_label_3.setText(_translate("MainWindow", "C库任务"))
+        self.label.setText(_translate("MainWindow", "楚天智能立体停车库存取排队信息"))
+        self.A_label_2.setText(_translate("MainWindow", "A单元"))
+        self.B_label_2.setText(_translate("MainWindow", "B单元"))
+        self.C_label_2.setText(_translate("MainWindow", "C单元"))
+        self.export_1_label.setText(_translate("MainWindow", "(1,2)号口"))
+        self.export_2_label.setText(_translate("MainWindow", "(3,4)号口"))
+        self.export_3_label.setText(_translate("MainWindow", "(5,6)号口"))
         self.tabWidget.setTabText(self.tabWidget.indexOf(self.process), _translate("MainWindow", "流程监控"))

+ 176 - 603
管理节点/ui/spaceUi.ui

@@ -21,7 +21,7 @@
     <item>
      <widget class="QTabWidget" name="tabWidget">
       <property name="currentIndex">
-       <number>1</number>
+       <number>0</number>
       </property>
       <widget class="QWidget" name="parkingspace">
        <attribute name="title">
@@ -425,619 +425,192 @@
        <attribute name="title">
         <string>流程监控</string>
        </attribute>
-       <layout class="QVBoxLayout" name="verticalLayout_4" stretch="0">
+       <layout class="QVBoxLayout" name="verticalLayout_4">
         <item>
-         <layout class="QVBoxLayout" name="process_verticalLayout" stretch="2,10,1">
+         <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,2">
           <item>
-           <widget class="QWidget" name="out_wiget" native="true">
-            <layout class="QVBoxLayout" name="verticalLayout_6" stretch="0,0">
-             <item>
-              <layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0,1,0,1,0,1,0,1,0,1,0,1,0">
-               <item>
-                <spacer name="horizontalSpacer_33">
-                 <property name="orientation">
-                  <enum>Qt::Horizontal</enum>
-                 </property>
-                 <property name="sizeHint" stdset="0">
-                  <size>
-                   <width>40</width>
-                   <height>20</height>
-                  </size>
-                 </property>
-                </spacer>
-               </item>
-               <item>
-                <widget class="QPushButton" name="pushButton">
-                 <property name="minimumSize">
-                  <size>
-                   <width>0</width>
-                   <height>35</height>
-                  </size>
-                 </property>
-                 <property name="font">
-                  <font>
-                   <pointsize>11</pointsize>
-                   <weight>75</weight>
-                   <bold>true</bold>
-                  </font>
-                 </property>
-                 <property name="styleSheet">
-                  <string notr="true">border:3px groove orange;border-radius:10px;padding:2px 4px</string>
-                 </property>
-                 <property name="text">
-                  <string>橙色边框代表存车任务</string>
-                 </property>
-                </widget>
-               </item>
-               <item>
-                <spacer name="horizontalSpacer_29">
-                 <property name="orientation">
-                  <enum>Qt::Horizontal</enum>
-                 </property>
-                 <property name="sizeHint" stdset="0">
-                  <size>
-                   <width>40</width>
-                   <height>20</height>
-                  </size>
-                 </property>
-                </spacer>
-               </item>
-               <item>
-                <widget class="QPushButton" name="pushButton_2">
-                 <property name="minimumSize">
-                  <size>
-                   <width>0</width>
-                   <height>35</height>
-                  </size>
-                 </property>
-                 <property name="font">
-                  <font>
-                   <pointsize>11</pointsize>
-                   <weight>75</weight>
-                   <bold>true</bold>
-                  </font>
-                 </property>
-                 <property name="styleSheet">
-                  <string notr="true">border:3px groove blue;border-radius:10px;padding:2px 4px</string>
-                 </property>
-                 <property name="text">
-                  <string>蓝色边框代表取车任务</string>
-                 </property>
-                </widget>
-               </item>
-               <item>
-                <spacer name="horizontalSpacer_30">
-                 <property name="orientation">
-                  <enum>Qt::Horizontal</enum>
-                 </property>
-                 <property name="sizeHint" stdset="0">
-                  <size>
-                   <width>40</width>
-                   <height>20</height>
-                  </size>
-                 </property>
-                </spacer>
-               </item>
-               <item>
-                <widget class="QPushButton" name="pushButton_6">
-                 <property name="minimumSize">
-                  <size>
-                   <width>0</width>
-                   <height>35</height>
-                  </size>
-                 </property>
-                 <property name="font">
-                  <font>
-                   <pointsize>11</pointsize>
-                   <weight>75</weight>
-                   <bold>true</bold>
-                  </font>
-                 </property>
-                 <property name="styleSheet">
-                  <string notr="true">border:3px groove green;border-radius:10px;padding:2px 4px;background-color:rgb(241,158,194)</string>
-                 </property>
-                 <property name="text">
-                  <string>粉色底色代表任务排队中</string>
-                 </property>
-                </widget>
-               </item>
-               <item>
-                <spacer name="horizontalSpacer_35">
-                 <property name="orientation">
-                  <enum>Qt::Horizontal</enum>
-                 </property>
-                 <property name="sizeHint" stdset="0">
-                  <size>
-                   <width>40</width>
-                   <height>20</height>
-                  </size>
-                 </property>
-                </spacer>
-               </item>
-               <item>
-                <widget class="QPushButton" name="pushButton_4">
-                 <property name="minimumSize">
-                  <size>
-                   <width>0</width>
-                   <height>35</height>
-                  </size>
-                 </property>
-                 <property name="font">
-                  <font>
-                   <pointsize>11</pointsize>
-                   <weight>75</weight>
-                   <bold>true</bold>
-                  </font>
-                 </property>
-                 <property name="styleSheet">
-                  <string notr="true">border:3px groove green;border-radius:10px;padding:2px 4px;background-color:rgb(0,180,0)</string>
-                 </property>
-                 <property name="text">
-                  <string>绿色底色代表任务已完成</string>
-                 </property>
-                </widget>
-               </item>
-               <item>
-                <spacer name="horizontalSpacer_31">
-                 <property name="orientation">
-                  <enum>Qt::Horizontal</enum>
-                 </property>
-                 <property name="sizeHint" stdset="0">
-                  <size>
-                   <width>40</width>
-                   <height>20</height>
-                  </size>
-                 </property>
-                </spacer>
-               </item>
-               <item>
-                <widget class="QPushButton" name="pushButton_5">
-                 <property name="minimumSize">
-                  <size>
-                   <width>0</width>
-                   <height>35</height>
-                  </size>
-                 </property>
-                 <property name="font">
-                  <font>
-                   <pointsize>11</pointsize>
-                   <weight>75</weight>
-                   <bold>true</bold>
-                  </font>
-                 </property>
-                 <property name="styleSheet">
-                  <string notr="true">border:3px groove yellow;border-radius:10px;padding:2px 4px;background-color:rgb(248,239,71)</string>
-                 </property>
-                 <property name="text">
-                  <string>黄色底色代表任务工作中</string>
-                 </property>
-                </widget>
-               </item>
-               <item>
-                <spacer name="horizontalSpacer_32">
-                 <property name="orientation">
-                  <enum>Qt::Horizontal</enum>
-                 </property>
-                 <property name="sizeHint" stdset="0">
-                  <size>
-                   <width>40</width>
-                   <height>20</height>
-                  </size>
-                 </property>
-                </spacer>
-               </item>
-               <item>
-                <widget class="QPushButton" name="pushButton_3">
-                 <property name="minimumSize">
-                  <size>
-                   <width>0</width>
-                   <height>35</height>
-                  </size>
-                 </property>
-                 <property name="font">
-                  <font>
-                   <pointsize>11</pointsize>
-                   <weight>75</weight>
-                   <bold>true</bold>
-                  </font>
-                 </property>
-                 <property name="styleSheet">
-                  <string notr="true">border:3px groove red;border-radius:10px;padding:2px 4px;background-color:rgb(255,70,70)</string>
-                 </property>
-                 <property name="text">
-                  <string>红色底色代表任务错误</string>
-                 </property>
-                </widget>
-               </item>
-               <item>
-                <spacer name="horizontalSpacer_34">
-                 <property name="orientation">
-                  <enum>Qt::Horizontal</enum>
-                 </property>
-                 <property name="sizeHint" stdset="0">
-                  <size>
-                   <width>40</width>
-                   <height>20</height>
-                  </size>
-                 </property>
-                </spacer>
-               </item>
-              </layout>
-             </item>
-             <item>
-              <widget class="QWidget" name="outmcpu_widget" native="true">
-               <layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,4,0,4,0,4,0,4,0,4,0,4,0">
-                <item>
-                 <spacer name="horizontalSpacer_8">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item>
-                 <widget class="QPushButton" name="out_mcpu_1_statu_btn">
-                  <property name="text">
-                   <string>A1出口单片机---断连</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="horizontalSpacer_9">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item>
-                 <widget class="QPushButton" name="out_mcpu_2_statu_btn">
-                  <property name="text">
-                   <string>A2出口单片机---断连</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="horizontalSpacer_10">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item>
-                 <widget class="QPushButton" name="out_mcpu_3_statu_btn">
-                  <property name="text">
-                   <string>B1出口单片机---断连</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="horizontalSpacer_11">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item>
-                 <widget class="QPushButton" name="out_mcpu_4_statu_btn">
-                  <property name="text">
-                   <string>B2出口单片机---断连</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="horizontalSpacer_12">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item>
-                 <widget class="QPushButton" name="out_mcpu_5_statu_btn">
-                  <property name="text">
-                   <string>C1出口单片机---断连</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="horizontalSpacer_13">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item>
-                 <widget class="QPushButton" name="out_mcpu_6_statu_btn">
-                  <property name="text">
-                   <string>C2出口单片机---断连</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="horizontalSpacer_14">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-               </layout>
-              </widget>
-             </item>
-            </layout>
+           <widget class="QLabel" name="image_label">
+            <property name="text">
+             <string/>
+            </property>
            </widget>
           </item>
           <item>
-           <widget class="QWidget" name="process_widget" native="true">
+           <widget class="QLabel" name="label">
+            <property name="maximumSize">
+             <size>
+              <width>16777215</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="font">
+             <font>
+              <family>华文楷体</family>
+              <pointsize>60</pointsize>
+              <weight>75</weight>
+              <bold>true</bold>
+             </font>
+            </property>
+            <property name="styleSheet">
+             <string notr="true">color: blue</string>
+            </property>
+            <property name="text">
+             <string>楚天智能立体停车库存取排队信息</string>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="process_horizontalLayout">
+          <item>
+           <widget class="QListWidget" name="A_listWidget">
             <property name="styleSheet">
              <string notr="true"/>
             </property>
-            <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="2,19,2,19,2,19,2">
-             <item>
-              <widget class="QWidget" name="fill_22" native="true"/>
-             </item>
-             <item>
-              <layout class="QVBoxLayout" name="A_verticalLayout"/>
-             </item>
-             <item>
-              <widget class="QWidget" name="fill_20" native="true"/>
-             </item>
-             <item>
-              <layout class="QVBoxLayout" name="B_verticalLayout"/>
-             </item>
-             <item>
-              <widget class="QWidget" name="fill_21" native="true"/>
-             </item>
-             <item>
-              <layout class="QVBoxLayout" name="C_verticalLayout"/>
-             </item>
-             <item>
-              <widget class="QWidget" name="fill_19" native="true"/>
-             </item>
-            </layout>
-            <zorder>fill_20</zorder>
-            <zorder>fill_22</zorder>
-            <zorder>fill_21</zorder>
-            <zorder>fill_19</zorder>
            </widget>
           </item>
           <item>
-           <widget class="QWidget" name="in_widget" native="true">
-            <layout class="QVBoxLayout" name="verticalLayout_7">
-             <item>
-              <widget class="QWidget" name="inmcpu_widget" native="true">
-               <layout class="QHBoxLayout" name="horizontalLayout_11" stretch="0,4,0,4,0,4,0,4,0,4,0,4,0">
-                <item>
-                 <spacer name="horizontalSpacer">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item>
-                 <widget class="QPushButton" name="in_mcpu_1_statu_btn">
-                  <property name="text">
-                   <string>A1入口单片机---断连</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="horizontalSpacer_2">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item>
-                 <widget class="QPushButton" name="in_mcpu_2_statu_btn">
-                  <property name="text">
-                   <string>A2入口单片机---断连</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="horizontalSpacer_3">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item>
-                 <widget class="QPushButton" name="in_mcpu_3_statu_btn">
-                  <property name="text">
-                   <string>B1入口单片机---断连</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="horizontalSpacer_4">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item>
-                 <widget class="QPushButton" name="in_mcpu_4_statu_btn">
-                  <property name="text">
-                   <string>B2入口单片机---断连</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="horizontalSpacer_5">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item>
-                 <widget class="QPushButton" name="in_mcpu_5_statu_btn">
-                  <property name="text">
-                   <string>C1入口单片机---断连</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="horizontalSpacer_6">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-                <item>
-                 <widget class="QPushButton" name="in_mcpu_6_statu_btn">
-                  <property name="text">
-                   <string>C2入口单片机---断连</string>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <spacer name="horizontalSpacer_7">
-                  <property name="orientation">
-                   <enum>Qt::Horizontal</enum>
-                  </property>
-                  <property name="sizeHint" stdset="0">
-                   <size>
-                    <width>40</width>
-                    <height>20</height>
-                   </size>
-                  </property>
-                 </spacer>
-                </item>
-               </layout>
-              </widget>
-             </item>
-             <item>
-              <layout class="QHBoxLayout" name="unit_labelLayout">
-               <item>
-                <widget class="QLabel" name="A_label_3">
-                 <property name="font">
-                  <font>
-                   <pointsize>32</pointsize>
-                   <weight>75</weight>
-                   <bold>true</bold>
-                  </font>
-                 </property>
-                 <property name="text">
-                  <string>A库任务</string>
-                 </property>
-                 <property name="alignment">
-                  <set>Qt::AlignCenter</set>
-                 </property>
-                </widget>
-               </item>
-               <item>
-                <widget class="QLabel" name="B_label_3">
-                 <property name="font">
-                  <font>
-                   <pointsize>32</pointsize>
-                   <weight>75</weight>
-                   <bold>true</bold>
-                  </font>
-                 </property>
-                 <property name="text">
-                  <string>B库任务</string>
-                 </property>
-                 <property name="alignment">
-                  <set>Qt::AlignCenter</set>
-                 </property>
-                </widget>
-               </item>
-               <item>
-                <widget class="QLabel" name="C_label_3">
-                 <property name="font">
-                  <font>
-                   <pointsize>32</pointsize>
-                   <weight>75</weight>
-                   <bold>true</bold>
-                  </font>
-                 </property>
-                 <property name="text">
-                  <string>C库任务</string>
-                 </property>
-                 <property name="alignment">
-                  <set>Qt::AlignCenter</set>
-                 </property>
-                </widget>
-               </item>
-              </layout>
-             </item>
-            </layout>
+           <widget class="QListWidget" name="B_listWidget"/>
+          </item>
+          <item>
+           <widget class="QListWidget" name="C_listWidget"/>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="unit_horizontalLayout">
+          <item>
+           <widget class="QLabel" name="A_label_2">
+            <property name="font">
+             <font>
+              <family>华文楷体</family>
+              <pointsize>40</pointsize>
+              <weight>50</weight>
+              <bold>false</bold>
+             </font>
+            </property>
+            <property name="styleSheet">
+             <string notr="true">color: blue</string>
+            </property>
+            <property name="text">
+             <string>A单元</string>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="B_label_2">
+            <property name="font">
+             <font>
+              <family>华文楷体</family>
+              <pointsize>40</pointsize>
+              <weight>50</weight>
+              <bold>false</bold>
+             </font>
+            </property>
+            <property name="styleSheet">
+             <string notr="true">color: blue</string>
+            </property>
+            <property name="text">
+             <string>B单元</string>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="C_label_2">
+            <property name="font">
+             <font>
+              <family>华文楷体</family>
+              <pointsize>40</pointsize>
+              <weight>50</weight>
+              <bold>false</bold>
+             </font>
+            </property>
+            <property name="styleSheet">
+             <string notr="true">color: blue;</string>
+            </property>
+            <property name="text">
+             <string>C单元</string>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="export_horizontalLayout">
+          <item>
+           <widget class="QLabel" name="export_1_label">
+            <property name="font">
+             <font>
+              <family>华文楷体</family>
+              <pointsize>30</pointsize>
+              <weight>75</weight>
+              <bold>true</bold>
+             </font>
+            </property>
+            <property name="styleSheet">
+             <string notr="true">color: blue</string>
+            </property>
+            <property name="text">
+             <string>(1,2)号口</string>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="export_2_label">
+            <property name="font">
+             <font>
+              <family>华文楷体</family>
+              <pointsize>30</pointsize>
+              <weight>75</weight>
+              <bold>true</bold>
+             </font>
+            </property>
+            <property name="styleSheet">
+             <string notr="true">color: blue</string>
+            </property>
+            <property name="text">
+             <string>(3,4)号口</string>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="export_3_label">
+            <property name="font">
+             <font>
+              <family>华文楷体</family>
+              <pointsize>30</pointsize>
+              <weight>75</weight>
+              <bold>true</bold>
+             </font>
+            </property>
+            <property name="styleSheet">
+             <string notr="true">color: blue</string>
+            </property>
+            <property name="text">
+             <string>(5,6)号口</string>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignCenter</set>
+            </property>
            </widget>
           </item>
          </layout>

+ 32 - 32
终端/ct_terminal/ct_terminal/MainForm.Designer.cs

@@ -31,6 +31,7 @@
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
             this.MainPanel = new System.Windows.Forms.Panel();
             this.MainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
+            this.vlcControl1 = new Vlc.DotNet.Forms.VlcControl();
             this.ImagePictureBox = new System.Windows.Forms.PictureBox();
             this.BtnPanel = new System.Windows.Forms.Panel();
             this.pickupBtn = new System.Windows.Forms.Button();
@@ -44,22 +45,21 @@
             this.weather_pictureBox = new System.Windows.Forms.PictureBox();
             this.terminal_number_english_label = new System.Windows.Forms.Label();
             this.terminal_number_label = new System.Windows.Forms.Label();
-            this.zhixiang_pictureBox = new System.Windows.Forms.PictureBox();
-            this.vlcControl1 = new Vlc.DotNet.Forms.VlcControl();
+            this.zhixiang_pictureBox1 = new System.Windows.Forms.PictureBox();
             this.MainPanel.SuspendLayout();
             this.MainTableLayoutPanel.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.vlcControl1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.ImagePictureBox)).BeginInit();
             this.BtnPanel.SuspendLayout();
             this.weather_panel.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.weather_pictureBox)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.zhixiang_pictureBox)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.vlcControl1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.zhixiang_pictureBox1)).BeginInit();
             this.SuspendLayout();
             // 
             // MainPanel
             // 
             this.MainPanel.Controls.Add(this.MainTableLayoutPanel);
-            this.MainPanel.Location = new System.Drawing.Point(1, 0);
+            this.MainPanel.Location = new System.Drawing.Point(-4, 1);
             this.MainPanel.Name = "MainPanel";
             this.MainPanel.Size = new System.Drawing.Size(1080, 1800);
             this.MainPanel.TabIndex = 0;
@@ -81,6 +81,20 @@
             this.MainTableLayoutPanel.Size = new System.Drawing.Size(1080, 1800);
             this.MainTableLayoutPanel.TabIndex = 0;
             // 
+            // vlcControl1
+            // 
+            this.vlcControl1.BackColor = System.Drawing.Color.Black;
+            this.vlcControl1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.vlcControl1.Location = new System.Drawing.Point(3, 1101);
+            this.vlcControl1.Name = "vlcControl1";
+            this.vlcControl1.Size = new System.Drawing.Size(1074, 696);
+            this.vlcControl1.Spu = -1;
+            this.vlcControl1.TabIndex = 2;
+            this.vlcControl1.Text = "vlcControl1";
+            this.vlcControl1.VlcLibDirectory = null;
+            this.vlcControl1.VlcMediaplayerOptions = null;
+            this.vlcControl1.VlcLibDirectoryNeeded += new System.EventHandler<Vlc.DotNet.Forms.VlcLibDirectoryNeededEventArgs>(this.vlcControl1_VlcLibDirectoryNeeded);
+            // 
             // ImagePictureBox
             // 
             this.ImagePictureBox.BackgroundImage = global::ct_terminal.Properties.Resources._1;
@@ -101,7 +115,7 @@
             this.BtnPanel.Controls.Add(this.weather_panel);
             this.BtnPanel.Controls.Add(this.terminal_number_english_label);
             this.BtnPanel.Controls.Add(this.terminal_number_label);
-            this.BtnPanel.Controls.Add(this.zhixiang_pictureBox);
+            this.BtnPanel.Controls.Add(this.zhixiang_pictureBox1);
             this.BtnPanel.Dock = System.Windows.Forms.DockStyle.Fill;
             this.BtnPanel.Location = new System.Drawing.Point(3, 502);
             this.BtnPanel.Name = "BtnPanel";
@@ -242,36 +256,22 @@
             this.terminal_number_label.TabIndex = 7;
             this.terminal_number_label.Text = "智象泊车终端05号机";
             // 
-            // zhixiang_pictureBox
-            // 
-            this.zhixiang_pictureBox.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("zhixiang_pictureBox.BackgroundImage")));
-            this.zhixiang_pictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
-            this.zhixiang_pictureBox.Location = new System.Drawing.Point(43, 14);
-            this.zhixiang_pictureBox.Name = "zhixiang_pictureBox";
-            this.zhixiang_pictureBox.Size = new System.Drawing.Size(69, 60);
-            this.zhixiang_pictureBox.TabIndex = 6;
-            this.zhixiang_pictureBox.TabStop = false;
+            // zhixiang_pictureBox1
             // 
-            // vlcControl1
-            // 
-            this.vlcControl1.BackColor = System.Drawing.Color.Black;
-            this.vlcControl1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.vlcControl1.Location = new System.Drawing.Point(3, 1101);
-            this.vlcControl1.Name = "vlcControl1";
-            this.vlcControl1.Size = new System.Drawing.Size(1074, 696);
-            this.vlcControl1.Spu = -1;
-            this.vlcControl1.TabIndex = 2;
-            this.vlcControl1.Text = "vlcControl1";
-            this.vlcControl1.VlcLibDirectory = null;
-            this.vlcControl1.VlcMediaplayerOptions = null;
-            this.vlcControl1.VlcLibDirectoryNeeded += new System.EventHandler<Vlc.DotNet.Forms.VlcLibDirectoryNeededEventArgs>(this.vlcControl1_VlcLibDirectoryNeeded);
+            this.zhixiang_pictureBox1.BackgroundImage = global::ct_terminal.Properties.Resources.log2;
+            this.zhixiang_pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+            this.zhixiang_pictureBox1.Location = new System.Drawing.Point(43, 14);
+            this.zhixiang_pictureBox1.Name = "zhixiang_pictureBox1";
+            this.zhixiang_pictureBox1.Size = new System.Drawing.Size(69, 60);
+            this.zhixiang_pictureBox1.TabIndex = 6;
+            this.zhixiang_pictureBox1.TabStop = false;
             // 
             // MainForm
             // 
             this.AllowDrop = true;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
             this.AutoScroll = true;
-            this.ClientSize = new System.Drawing.Size(1100, 1100);
+            this.ClientSize = new System.Drawing.Size(1079, 1100);
             this.Controls.Add(this.MainPanel);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
             this.Name = "MainForm";
@@ -281,14 +281,14 @@
             this.SizeChanged += new System.EventHandler(this.MainForm_SizeChanged);
             this.MainPanel.ResumeLayout(false);
             this.MainTableLayoutPanel.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.vlcControl1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.ImagePictureBox)).EndInit();
             this.BtnPanel.ResumeLayout(false);
             this.BtnPanel.PerformLayout();
             this.weather_panel.ResumeLayout(false);
             this.weather_panel.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.weather_pictureBox)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.zhixiang_pictureBox)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.vlcControl1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.zhixiang_pictureBox1)).EndInit();
             this.ResumeLayout(false);
 
         }
@@ -310,7 +310,7 @@
         private System.Windows.Forms.PictureBox weather_pictureBox;
         private System.Windows.Forms.Label terminal_number_english_label;
         private System.Windows.Forms.Label terminal_number_label;
-        private System.Windows.Forms.PictureBox zhixiang_pictureBox;
+        private System.Windows.Forms.PictureBox zhixiang_pictureBox1;
         private Vlc.DotNet.Forms.VlcControl vlcControl1;
     }
 }

+ 64 - 57
终端/ct_terminal/ct_terminal/MainForm.cs

@@ -25,7 +25,7 @@ using RabbitMQ.Client.Events;
 
 namespace ct_terminal
 {
-    
+
 
     public partial class MainForm : Form
     {
@@ -61,7 +61,7 @@ namespace ct_terminal
 
         private TimedData<string> m_pick_command_response = new TimedData<string>("");
         private Process m_process = null;
-
+        private string m_image_path;
         private static readonly object Lock = new object();
         public MainForm()
         {
@@ -86,22 +86,22 @@ namespace ct_terminal
             string t_pick_queue_key = "pick_response_" + m_ternimalID.ToString() + "_queue";
             m_pick_consumer.consumer_init(m_rabbitmq_ip, m_rabbitmq_port, m_rabbitmq_user, m_rabbitmq_password, t_pick_queue_key, pick_response_thread);
 
-
+            m_image_path = System.AppDomain.CurrentDomain.BaseDirectory + "./Resource/";
 
 #if ENABLE_PACK
-                //获取号牌线程
-                m_car_number = new NumMachine.NumMachineLinker();
-                m_car_number_condition = true;
-                m_car_number_thread = new Thread(get_car_number_thread);
+            //获取号牌线程
+            m_car_number = new NumMachine.NumMachineLinker();
+            m_car_number_condition = true;
+            m_car_number_thread = new Thread(get_car_number_thread);
 
-                //初始化打印机
-                PrintManual.Instance.PrintManualInit();
+            //初始化打印机
+            PrintManual.Instance.PrintManualInit();
 
-                //初始化消费指令
-                string t_park_queue_key = "park_response_" + m_ternimalID.ToString() + "_queue";
-                m_park_consumer.consumer_init(m_rabbitmq_ip, m_rabbitmq_port, m_rabbitmq_user, m_rabbitmq_password, t_park_queue_key, park_response_thread);
+            //初始化消费指令
+            string t_park_queue_key = "park_response_" + m_ternimalID.ToString() + "_queue";
+            m_park_consumer.consumer_init(m_rabbitmq_ip, m_rabbitmq_port, m_rabbitmq_user, m_rabbitmq_password, t_park_queue_key, park_response_thread);
 #else
-                this.parkingBtn.BackgroundImage = Image.FromFile(System.AppDomain.CurrentDomain.BaseDirectory + "./Resource/" + "parkingBtn_gray.BackgroundImage.png");
+                this.parkingBtn.BackgroundImage = Image.FromFile(m_image_path + "parkingBtn_gray.BackgroundImage.png");
                 this.parkingBtn.Enabled = false;
 #endif
         }
@@ -145,8 +145,9 @@ namespace ct_terminal
 #endif
 
         }
-        public string startNumer(Random r)
+        public string randomNumer()
         {
+            Random r = new Random();
             char E1 = (char)r.Next(65, 90);
             char E2 = (char)r.Next(65, 90);
             int N1 = r.Next(10, 99);
@@ -160,6 +161,7 @@ namespace ct_terminal
 
         private void parkingBtn_Click(object sender, EventArgs e)
         {
+            //string car_license = randomNumer();
             string car_license = "";
             if (m_timed_car_license.IsTimeout() == false && m_timed_car_license.Value != "")
             {
@@ -187,15 +189,24 @@ namespace ct_terminal
                 messageBoxEe.Show("服务器连接失败!请联系管理员!");
                 return;
             }
-            //this.parkingBtn.BackgroundImage = Image.FromFile(System.AppDomain.CurrentDomain.BaseDirectory + "./Resource/" + "parkingBtn_gray.BackgroundImage.png");
+            this.parkingBtn.BackgroundImage = Image.FromFile(m_image_path + "parkingBtn_gray.BackgroundImage.png");
             this.parkingBtn.Enabled = false;
             while (!m_park_command_response.IsTimeout())
             {
-                if (m_park_command_response.Value == "")
-                    continue;
+                if (m_park_command_response.Value != "")
+                    break;
+            }
+            if (m_park_command_response.IsTimeout() && m_park_command_response.Value == "")
+            {
+                MessageBoxEe messageBoxEe = new MessageBoxEe();
+                messageBoxEe.Show("反馈超时,请重试或联系管理员!");
+            }
+            else
+            {
                 try
                 {
                     park_table response_Table = park_table.Parser.ParseText(m_park_command_response.Value);
+                    //response_Table.PrimaryKey = "ddddddddddd";
                     if (response_Table.Statu.ExecuteStatu == STATU.ENormal && response_Table.PrimaryKey != "")
                     {
                         PrintManual.Instance.PrintTicket(response_Table.PrimaryKey, response_Table.CarNumber);
@@ -211,7 +222,7 @@ namespace ct_terminal
                             }
                         });
                     }
-                    else 
+                    else
                     {
                         MessageBoxEe messageBoxEe = new MessageBoxEe();
                         messageBoxEe.Show(response_Table.Statu.StatuDescription);
@@ -222,21 +233,9 @@ namespace ct_terminal
                     MessageBoxEe messageBoxEe = new MessageBoxEe();
                     messageBoxEe.Show("反馈解析失败!\n" + ex.StackTrace);
                 }
-                m_park_command_response = "";
-                //this.parkingBtn.BackgroundImage = Image.FromFile(System.AppDomain.CurrentDomain.BaseDirectory + "./Resource/" + "parkingBtn.BackgroundImage.png");
-                this.parkingBtn.Enabled = true;
-                return;
-  
-            }
-            if (m_park_command_response.IsTimeout() && m_park_command_response.Value == "")
-            {
-                MessageBoxEe messageBoxEe = new MessageBoxEe();
-                messageBoxEe.Show("反馈超时,请重试或联系管理员!");
             }
             m_park_command_response = "";
-
-            //this.parkingBtn.BackgroundImage = Image.FromFile(System.AppDomain.CurrentDomain.BaseDirectory + "./Resource/" + "parkingBtn.BackgroundImage.png");
-
+            this.parkingBtn.BackgroundImage = Image.FromFile(m_image_path + "parkingBtn.BackgroundImage.png");
             this.parkingBtn.Enabled = true;
 
         }
@@ -265,42 +264,50 @@ namespace ct_terminal
                 messageBoxEe.Show("服务器连接失败!请联系管理员!");
                 return;
             }
-            //this.pickupBtn.BackgroundImage = Image.FromFile(System.AppDomain.CurrentDomain.BaseDirectory + "./Resource/" + "fetchingBtn_gray.BackgroundImage.png");
+            this.pickupBtn.BackgroundImage = Image.FromFile(m_image_path + "fetchingBtn_gray.BackgroundImage.png");
             this.pickupBtn.Enabled = false;
             while (!m_pick_command_response.IsTimeout())
             {
-                if (m_pick_command_response.Value == "")
-                    continue;
-                pick_table response_Table = new pick_table();
-                response_Table = pick_table.Parser.ParseText(m_pick_command_response.Value);
-                if (response_Table.Statu.ExecuteStatu == STATU.ENormal)
-                {
-
-                    MessageBoxEe messageBoxEe = new MessageBoxEe();
-                    messageBoxEe.Show(response_Table.CarNumber + " 取车成功,请观察LED屏幕提示取车!");
+                if (m_pick_command_response.Value != "")
                     break;
-  
-                }
-                else
-                {
-                    MessageBoxEe messageBoxEe = new MessageBoxEe();
-                    messageBoxEe.Show(response_Table.Statu.StatuDescription);
-                    break;
-                }
+               
             }
-            if (m_pick_command_response.IsTimeout()&& m_pick_command_response.Value == "")
+            if (m_pick_command_response.IsTimeout() && m_pick_command_response.Value == "")
             {
                 MessageBoxEe messageBoxEe = new MessageBoxEe();
                 messageBoxEe.Show("反馈超时,请重试或联系管理员!");
             }
+            else
+            {
+                try
+                {
+                    pick_table response_Table = new pick_table();
+                    response_Table = pick_table.Parser.ParseText(m_pick_command_response.Value);
+                    if (response_Table.Statu.ExecuteStatu == STATU.ENormal)
+                    {
+                        MessageBoxEe messageBoxEe = new MessageBoxEe();
+                        messageBoxEe.Show(response_Table.CarNumber + " 取车成功,请观察LED屏幕提示取车!");
+                    }
+                    else
+                    {
+                        MessageBoxEe messageBoxEe = new MessageBoxEe();
+                        messageBoxEe.Show(response_Table.Statu.StatuDescription);
+                    }
+                }
+                catch (Exception ex)
+                {
+                    MessageBoxEe messageBoxEe = new MessageBoxEe();
+                    messageBoxEe.Show("反馈解析失败!\n" + ex.StackTrace);
+                }
+            }
             m_pick_command_response = "";
-            //this.pickupBtn.BackgroundImage = Image.FromFile(System.AppDomain.CurrentDomain.BaseDirectory + "./Resource/" + "fetchingBtn.BackgroundImage.png");
+            this.pickupBtn.BackgroundImage = Image.FromFile(m_image_path + "fetchingBtn.BackgroundImage.png");
             this.pickupBtn.Enabled = true;
         }
         //停车反馈线程
-        void park_response_thread(string msg, ref IModel channel ,ref  BasicDeliverEventArgs args)
+        void park_response_thread(string msg, ref IModel channel, ref BasicDeliverEventArgs args)
         {
-            Console.WriteLine("停车反馈:"+msg);
+            Console.WriteLine("停车反馈:" + msg);
             if (msg != null && msg != "")
             {
                 m_park_command_response = msg;
@@ -310,7 +317,7 @@ namespace ct_terminal
             channel.BasicAck(args.DeliveryTag, true);
         }
         //取车反馈线程
-        void pick_response_thread(string msg,ref  IModel channel, ref BasicDeliverEventArgs args)
+        void pick_response_thread(string msg, ref IModel channel, ref BasicDeliverEventArgs args)
         {
             Console.WriteLine("取车反馈:" + msg);
             if (msg != null && msg != "")
@@ -345,7 +352,7 @@ namespace ct_terminal
             }
 #endif
         }
-       
+
 
         /// <summary>
         /// 获取号牌线程
@@ -355,7 +362,7 @@ namespace ct_terminal
             while (m_car_number_condition == true)
             {
                 string number = m_car_number.GetLicensePlate(0);
-             //   Console.WriteLine("号牌机接收到号牌:"+number);
+                //   Console.WriteLine("号牌机接收到号牌:"+number);
                 if (number != null && number != "")
                 {
                     lock (Lock)
@@ -364,7 +371,7 @@ namespace ct_terminal
                         m_timed_car_license.Set_timeout_ms(900000);
                     }
 
-                 //   MessageBoxEe.Show(m_timed_car_license.Value);
+                    //   MessageBoxEe.Show(m_timed_car_license.Value);
                 }
                 if (!m_timed_car_license.IsTimeout() && m_timed_car_license.Value != "")
                 {

File diff suppressed because it is too large
+ 0 - 8705
终端/ct_terminal/ct_terminal/MainForm.resx


+ 10 - 25
终端/ct_terminal/ct_terminal/MessageBoxEe.Designer.cs

@@ -36,12 +36,10 @@ namespace MessageBoxEE
             this.panel1 = new System.Windows.Forms.Panel();
             this.returnBtn = new System.Windows.Forms.Button();
             this.panelProgressBarContainer = new System.Windows.Forms.Panel();
-            this.OKbtn = new System.Windows.Forms.Button();
             this.panel2 = new System.Windows.Forms.Panel();
-            this.zhixiang_pictureBox = new System.Windows.Forms.PictureBox();
+            this.OKbtn = new System.Windows.Forms.Button();
             this.panel1.SuspendLayout();
             this.panel2.SuspendLayout();
-            ((System.ComponentModel.ISupportInitialize)(this.zhixiang_pictureBox)).BeginInit();
             this.SuspendLayout();
             // 
             // msgBox
@@ -59,7 +57,6 @@ namespace MessageBoxEE
             // panel1
             // 
             this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(13)))), ((int)(((byte)(114)))), ((int)(((byte)(223)))));
-            this.panel1.Controls.Add(this.zhixiang_pictureBox);
             this.panel1.Controls.Add(this.returnBtn);
             this.panel1.Controls.Add(this.panelProgressBarContainer);
             this.panel1.Location = new System.Drawing.Point(0, 0);
@@ -91,9 +88,17 @@ namespace MessageBoxEE
             this.panelProgressBarContainer.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(114)))), ((int)(((byte)(223)))));
             this.panelProgressBarContainer.Location = new System.Drawing.Point(0, 56);
             this.panelProgressBarContainer.Name = "panelProgressBarContainer";
-            this.panelProgressBarContainer.Size = new System.Drawing.Size(982, 10);
+            this.panelProgressBarContainer.Size = new System.Drawing.Size(630, 10);
             this.panelProgressBarContainer.TabIndex = 3;
             // 
+            // panel2
+            // 
+            this.panel2.Controls.Add(this.msgBox);
+            this.panel2.Location = new System.Drawing.Point(52, 102);
+            this.panel2.Name = "panel2";
+            this.panel2.Size = new System.Drawing.Size(520, 157);
+            this.panel2.TabIndex = 3;
+            // 
             // OKbtn
             // 
             this.OKbtn.BackgroundImage = global::ct_terminal.Properties.Resources.确认按钮;
@@ -110,24 +115,6 @@ namespace MessageBoxEE
             this.OKbtn.UseVisualStyleBackColor = true;
             this.OKbtn.Click += new System.EventHandler(this.OKbtn_Click);
             // 
-            // panel2
-            // 
-            this.panel2.Controls.Add(this.msgBox);
-            this.panel2.Location = new System.Drawing.Point(52, 102);
-            this.panel2.Name = "panel2";
-            this.panel2.Size = new System.Drawing.Size(520, 157);
-            this.panel2.TabIndex = 3;
-            // 
-            // zhixiang_pictureBox
-            // 
-            this.zhixiang_pictureBox.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("zhixiang_pictureBox.BackgroundImage")));
-            this.zhixiang_pictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
-            this.zhixiang_pictureBox.Location = new System.Drawing.Point(0, -1);
-            this.zhixiang_pictureBox.Name = "zhixiang_pictureBox";
-            this.zhixiang_pictureBox.Size = new System.Drawing.Size(209, 52);
-            this.zhixiang_pictureBox.TabIndex = 7;
-            this.zhixiang_pictureBox.TabStop = false;
-            // 
             // MessageBoxEe
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -147,7 +134,6 @@ namespace MessageBoxEE
             this.Load += new System.EventHandler(this.MessageBoxEe_Load);
             this.panel1.ResumeLayout(false);
             this.panel2.ResumeLayout(false);
-            ((System.ComponentModel.ISupportInitialize)(this.zhixiang_pictureBox)).EndInit();
             this.ResumeLayout(false);
 
         }
@@ -159,6 +145,5 @@ namespace MessageBoxEE
         private Panel panelProgressBarContainer;
         private Panel panel2;
         private Button returnBtn;
-        private PictureBox zhixiang_pictureBox;
     }
 }

File diff suppressed because it is too large
+ 0 - 12484
终端/ct_terminal/ct_terminal/MessageBoxEe.resx


+ 20 - 0
终端/ct_terminal/ct_terminal/Properties/Resources.Designer.cs

@@ -80,6 +80,26 @@ namespace ct_terminal.Properties {
             }
         }
         
+        /// <summary>
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
+        /// </summary>
+        internal static System.Drawing.Bitmap log1 {
+            get {
+                object obj = ResourceManager.GetObject("log1", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
+        /// <summary>
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
+        /// </summary>
+        internal static System.Drawing.Bitmap log2 {
+            get {
+                object obj = ResourceManager.GetObject("log2", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
         /// <summary>
         ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>

+ 14 - 8
终端/ct_terminal/ct_terminal/Properties/Resources.resx

@@ -118,19 +118,25 @@
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
-  <data name="parkingBtn.BackgroundImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
-    <value>..\Resource\parkingBtn.BackgroundImage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  <data name="panel2.BackgroundImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resource\panel2.BackgroundImage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
-  <data name="fetchingBtn.BackgroundImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
-    <value>..\Resource\fetchingBtn.BackgroundImage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  <data name="log2" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resource\log2.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
+  <data name="确认按钮" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resource\确认按钮.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
   <data name="1" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>..\Resource\1.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
-  <data name="panel2.BackgroundImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
-    <value>..\Resource\panel2.BackgroundImage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  <data name="fetchingBtn.BackgroundImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resource\fetchingBtn.BackgroundImage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
-  <data name="确认按钮" type="System.Resources.ResXFileRef, System.Windows.Forms">
-    <value>..\Resource\确认按钮.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  <data name="parkingBtn.BackgroundImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resource\parkingBtn.BackgroundImage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
+  <data name="log1" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resource\log1.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
 </root>

+ 6 - 0
终端/ct_terminal/ct_terminal/ct_terminal.csproj

@@ -158,6 +158,7 @@
     <Compile Include="tool\time_data\TimedData.cs" />
     <EmbeddedResource Include="FetchingFrom.resx">
       <DependentUpon>FetchingFrom.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="MainForm.resx">
       <DependentUpon>MainForm.cs</DependentUpon>
@@ -205,8 +206,13 @@
   </ItemGroup>
   <ItemGroup>
     <None Include="Resource\确认按钮.png" />
+    <None Include="Resources\log1.bmp" />
+    <Content Include="Resource\2.jpg" />
+    <Content Include="Resource\3.jpg" />
+    <EmbeddedResource Include="Resource\fetchingBtn_gray.BackgroundImage.png" />
     <Content Include="Resource\log1.jpg" />
     <Content Include="Resource\log2.jpg" />
+    <EmbeddedResource Include="Resource\parkingBtn_gray.BackgroundImage.png" />
     <Content Include="SDK\avcodec-57.dll">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>