Ver Fonte

地面车位显示排序,取车完成操作放入线程,预约完善锁机制,PLCS7添加终端心跳

yc_t há 6 anos atrás
pai
commit
2e1d0a2f98

+ 13 - 4
NettyCommunication/NettyTest/Program.cs

@@ -22,14 +22,21 @@ namespace nettyCommunication
             Task.Factory.StartNew(() =>
             {
                 //初始化后与web持续连接
+                int count = 0;
                 while (true)
                 {
                     try
                     {
-                        Connections.close();
+                        if (count != 0)
+                        {
+                            Connections.close();
+                            Thread.Sleep(100);
+                        }
+                        //Thread.Sleep(100);
                         Connections.Connection();
                         connected = true;
                         comm = new Communication();
+                        count++;
                         break;
                     }
                     catch (Exception)
@@ -77,6 +84,7 @@ namespace nettyCommunication
                         try
                         {
                             Connections.close();
+                            Thread.Sleep(100);
                             Connections.Connection();
                         }
                         catch (Exception)
@@ -84,19 +92,20 @@ namespace nettyCommunication
                             Console.WriteLine("服务没有开启,请检查服务器");
                         }
                     }
-                    Thread.Sleep(200);
+                    Thread.Sleep(10000);
                 }
             });
             //持续接收消息
             receiveMsg = new Thread(() =>
             {
+                byte[] bytes = new byte[256];
                 while (true)
                 {
                     try
-                    {               
+                    {
                         if (connected && comm != null)
                         {
-                            MessageUTF8 msg = ((MessageUTF8)comm.ReceiveMessage());
+                            MessageUTF8 msg = ((MessageUTF8)comm.ReceiveMessage(out bytes));
                         }
                     }
                     catch { Console.WriteLine("线程已中断"); }

BIN
NettyCommunication/NettyTest/nettyCommunication.dll


+ 2 - 2
NettyCommunication/NettyTest/serversettings.json

@@ -1,8 +1,8 @@
 {
 
   "ssl": "false",
-  "host": "192.168.10.139",
+  "host": "192.168.10.106",
   "garageID":"10",
-  "port": "9000",
+  "port": "9001",
   "size": "1024"
 }

+ 1 - 0
PLCLinker/PLCLinker/PLCLinker.csproj

@@ -42,6 +42,7 @@
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Web" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />

+ 2 - 2
PLCLinker/PLCLinker/Program.cs

@@ -11,7 +11,7 @@ using System.Text;
 using System.Text.RegularExpressions;
 using System.Threading;
 using System.Threading.Tasks;
-
+using System.Web;
 namespace PLCTest
 {
     class Program
@@ -23,7 +23,7 @@ namespace PLCTest
             // tcp测试
             BlockingCollection<int> bq = new BlockingCollection<int>();
             bool connected = false;
-            Thread receiveMsg=null;
+            Thread receiveMsg = null;
             Task.Factory.StartNew(() =>
             {
                 while (true)

+ 1 - 1
PLCLinker/PLCLinker/obj/Release/PLCLinker.csproj.CoreCompileInputs.cache

@@ -1 +1 @@
-2f2a2cff2026c14e7b20a0582a7d3320ceed58c6
+1571e41c2debcd4bc70827c987a0b669ab9e335b

+ 1 - 0
PLCLinker/PLCS7/PLCS7.cs

@@ -387,6 +387,7 @@ namespace PLCS7
                         if (ts.licenseCodeC != -1) { plc.WriteBytes(DataType.DataBlock, terminalDB, 16 + offset, BitConverter.GetBytes(BytesRevert(ts.licenseCodeC))); }
                         if (ts.licenseCodeD != -1) { plc.WriteBytes(DataType.DataBlock, terminalDB, 20 + offset, BitConverter.GetBytes(BytesRevert(ts.licenseCodeD))); }
                         if (ts.receiptNum != -1) { plc.WriteBytes(DataType.DataBlock, terminalDB, 24 + offset, BitConverter.GetBytes(BytesRevert(ts.receiptNum))); }
+                        if (ts.termHeartbeat != 0) { plc.WriteBytes(DataType.DataBlock, terminalDB, 44 + offset, BitConverter.GetBytes(BytesRevert(ts.termHeartbeat))); }
                     }
                 }
                 else if (abstractPLCMsg.GetType().Equals(typeof(MainBlockStru)) && whoami.Equals(PLCDataType.central))

BIN
PLCLinker/PLCS7/bin/Release/PLCS7.dll


BIN
PLCLinker/PLCS7/bin/Release/PLCS7.pdb


BIN
PLCLinker/PLCS7/obj/Release/PLCS7.dll


BIN
PLCLinker/PLCS7/obj/Release/PLCS7.pdb


+ 2 - 2
PLCLinker/centralController/App.config

@@ -9,7 +9,7 @@
     <!--<add key="remoteDBConnStr" value="Data Source=59.175.148.85;port=3306;uid=root;pooling=true;max pool size=1024;pwd=x5;database=zxpark;CharSet=utf8;Allow Zero Datetime=true;"/>-->
     <!--<add key="remoteDBConnStr" value="Data Source=192.168.111.61;port=3306;uid=remote;pooling=true;max pool size=1024;pwd=x5;database=zxpark_cloud_2;CharSet=utf8;Allow Zero Datetime=true;"/>-->
     <!--<add key="remoteDBConnStr" value="Data Source=127.0.0.1;port=20000;uid=root;pooling=true;max pool size=1024;pwd=yct;database=zxpark_cloud_2;CharSet=utf8;Allow Zero Datetime=true;"/>-->
-    <add key="remoteDBConnStr" value="Data Source=192.168.10.121;port=3306;uid=remote;pooling=true;max pool size=1024;pwd=x5;database=zxpark_cloud_2;CharSet=utf8;Allow Zero Datetime=true;"/>
+    <add key="remoteDBConnStr" value="Data Source=192.168.0.121;port=3306;uid=remote;pooling=true;max pool size=1024;pwd=x5;database=zxpark_cloud_2;CharSet=utf8;Allow Zero Datetime=true;"/>
     <add key="localDBConnStr" value="Data Source=127.0.0.1;port=20000;uid=root;pooling=true;max pool size=1024;pwd=yct;database=zxpark_local;CharSet=utf8;Allow Zero Datetime=true;"/>
     <add key="DBtimeout" value="3"/>
     <!--号牌机信息-->
@@ -32,7 +32,7 @@
     <!--中控webServer端口-->
     <add key="webPort" value="9000"/>
     <!--车库信息-->
-    <add key="garageID" value="1"/>
+    <add key="garageID" value="2"/>
     <!--日志写入地址配置文件-->
     <add key="LogAddress" value="c:\\c#workspace\\LogDemo\\LoggerTest" />
     <!--广告存放路径-->

+ 214 - 71
PLCLinker/centralController/FormCentralController.Designer.cs

@@ -35,6 +35,10 @@
             this.dockSite4 = new DevComponents.DotNetBar.DockSite();
             this.dockSite_mainView = new DevComponents.DotNetBar.DockSite();
             this.bar_mainWin = new DevComponents.DotNetBar.Bar();
+            this.NumMachineMonitorPanel = new DevComponents.DotNetBar.PanelDockContainer();
+            this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
+            this.paymentPanel = new DevComponents.DotNetBar.PanelDockContainer();
+            this.ParkingSpaceMonitorPanel = new DevComponents.DotNetBar.PanelDockContainer();
             this.testPanel = new DevComponents.DotNetBar.PanelDockContainer();
             this.groupPanel2 = new DevComponents.DotNetBar.Controls.GroupPanel();
             this.pictureBox4 = new System.Windows.Forms.PictureBox();
@@ -50,10 +54,6 @@
             this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
             this.pictureBox1 = new System.Windows.Forms.PictureBox();
             this.labelX1 = new DevComponents.DotNetBar.LabelX();
-            this.NumMachineMonitorPanel = new DevComponents.DotNetBar.PanelDockContainer();
-            this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
-            this.paymentPanel = new DevComponents.DotNetBar.PanelDockContainer();
-            this.ParkingSpaceMonitorPanel = new DevComponents.DotNetBar.PanelDockContainer();
             this.dci_NumMachine = new DevComponents.DotNetBar.DockContainerItem();
             this.dci_payment = new DevComponents.DotNetBar.DockContainerItem();
             this.dci_ParkingSpace = new DevComponents.DotNetBar.DockContainerItem();
@@ -73,6 +73,7 @@
             this.dci_ParkingRecords = new DevComponents.DotNetBar.DockContainerItem();
             this.bar_side = new DevComponents.DotNetBar.Bar();
             this.terminalMonitorPanel = new DevComponents.DotNetBar.PanelDockContainer();
+            this.flp_Term = new System.Windows.Forms.FlowLayoutPanel();
             this.dci_terminal = new DevComponents.DotNetBar.DockContainerItem();
             this.dockSite1 = new DevComponents.DotNetBar.DockSite();
             this.dockSite_notification = new DevComponents.DotNetBar.DockSite();
@@ -105,6 +106,7 @@
             this.btn_records = new DevComponents.DotNetBar.ButtonItem();
             this.btn_devices = new DevComponents.DotNetBar.ButtonItem();
             this.btn_linkPLC = new DevComponents.DotNetBar.ButtonItem();
+            this.btn_linkWeb = new DevComponents.DotNetBar.ButtonItem();
             this.btn_PLCConf = new DevComponents.DotNetBar.ButtonItem();
             this.btn_numMachineConf = new DevComponents.DotNetBar.ButtonItem();
             this.btn_support = new DevComponents.DotNetBar.ButtonItem();
@@ -127,10 +129,18 @@
             this.dockContainerItem1 = new DevComponents.DotNetBar.DockContainerItem();
             this.panelDockContainer8 = new DevComponents.DotNetBar.PanelDockContainer();
             this.controlContainerItem1 = new DevComponents.DotNetBar.ControlContainerItem();
-            this.flp_Term = new System.Windows.Forms.FlowLayoutPanel();
+            this.dci_devStatus = new DevComponents.DotNetBar.DockContainerItem();
+            this.pdc_devStatus = new DevComponents.DotNetBar.PanelDockContainer();
+            this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
+            this.lbx_PLC = new DevComponents.DotNetBar.LabelX();
+            this.lbx_web = new DevComponents.DotNetBar.LabelX();
+            this.lbx_PLCStatus = new DevComponents.DotNetBar.LabelX();
+            this.lbx_webStatus = new DevComponents.DotNetBar.LabelX();
+            this.panel1 = new System.Windows.Forms.Panel();
             this.dockSite_mainView.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.bar_mainWin)).BeginInit();
             this.bar_mainWin.SuspendLayout();
+            this.NumMachineMonitorPanel.SuspendLayout();
             this.testPanel.SuspendLayout();
             this.groupPanel2.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
@@ -140,7 +150,6 @@
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
             this.tableLayoutPanel1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
-            this.NumMachineMonitorPanel.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.bar_bottom)).BeginInit();
             this.bar_bottom.SuspendLayout();
             this.RecordsMonitorPanel.SuspendLayout();
@@ -157,6 +166,9 @@
             ((System.ComponentModel.ISupportInitialize)(this.bar_shortcut)).BeginInit();
             this.bar_shortcut.SuspendLayout();
             this.panel_freeSpace.SuspendLayout();
+            this.pdc_devStatus.SuspendLayout();
+            this.tableLayoutPanel2.SuspendLayout();
+            this.panel1.SuspendLayout();
             this.SuspendLayout();
             // 
             // dotNetBarManager1
@@ -225,8 +237,9 @@
             this.bar_mainWin.CanDockRight = false;
             this.bar_mainWin.CanDockTop = false;
             this.bar_mainWin.CanHide = true;
-            this.bar_mainWin.Controls.Add(this.NumMachineMonitorPanel);
+            this.bar_mainWin.Controls.Add(this.pdc_devStatus);
             this.bar_mainWin.Controls.Add(this.paymentPanel);
+            this.bar_mainWin.Controls.Add(this.NumMachineMonitorPanel);
             this.bar_mainWin.Controls.Add(this.ParkingSpaceMonitorPanel);
             this.bar_mainWin.Controls.Add(this.testPanel);
             this.bar_mainWin.DockTabAlignment = DevComponents.DotNetBar.eTabStripAlignment.Top;
@@ -236,11 +249,12 @@
             this.dci_NumMachine,
             this.dci_payment,
             this.dci_ParkingSpace,
-            this.dci_Test});
+            this.dci_Test,
+            this.dci_devStatus});
             this.bar_mainWin.LayoutType = DevComponents.DotNetBar.eLayoutType.DockContainer;
             this.bar_mainWin.Location = new System.Drawing.Point(0, 0);
             this.bar_mainWin.Name = "bar_mainWin";
-            this.bar_mainWin.SelectedDockTab = 0;
+            this.bar_mainWin.SelectedDockTab = 4;
             this.bar_mainWin.SingleLineColor = System.Drawing.SystemColors.ControlDarkDark;
             this.bar_mainWin.Size = new System.Drawing.Size(503, 326);
             this.bar_mainWin.Stretch = true;
@@ -249,6 +263,56 @@
             this.bar_mainWin.TabNavigation = true;
             this.bar_mainWin.TabStop = false;
             // 
+            // NumMachineMonitorPanel
+            // 
+            this.NumMachineMonitorPanel.Controls.Add(this.flowLayoutPanel1);
+            this.NumMachineMonitorPanel.DisabledBackColor = System.Drawing.Color.Empty;
+            this.NumMachineMonitorPanel.Location = new System.Drawing.Point(3, 28);
+            this.NumMachineMonitorPanel.Name = "NumMachineMonitorPanel";
+            this.NumMachineMonitorPanel.Size = new System.Drawing.Size(497, 295);
+            this.NumMachineMonitorPanel.Style.Alignment = System.Drawing.StringAlignment.Center;
+            this.NumMachineMonitorPanel.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
+            this.NumMachineMonitorPanel.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
+            this.NumMachineMonitorPanel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText;
+            this.NumMachineMonitorPanel.Style.GradientAngle = 90;
+            this.NumMachineMonitorPanel.TabIndex = 0;
+            // 
+            // flowLayoutPanel1
+            // 
+            this.flowLayoutPanel1.BackColor = System.Drawing.SystemColors.GradientActiveCaption;
+            this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
+            this.flowLayoutPanel1.Name = "flowLayoutPanel1";
+            this.flowLayoutPanel1.Size = new System.Drawing.Size(497, 295);
+            this.flowLayoutPanel1.TabIndex = 1;
+            this.flowLayoutPanel1.Resize += new System.EventHandler(this.flowLayoutPanel1_Resize);
+            // 
+            // paymentPanel
+            // 
+            this.paymentPanel.DisabledBackColor = System.Drawing.Color.Empty;
+            this.paymentPanel.Location = new System.Drawing.Point(3, 28);
+            this.paymentPanel.Name = "paymentPanel";
+            this.paymentPanel.Size = new System.Drawing.Size(497, 295);
+            this.paymentPanel.Style.Alignment = System.Drawing.StringAlignment.Center;
+            this.paymentPanel.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
+            this.paymentPanel.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
+            this.paymentPanel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText;
+            this.paymentPanel.Style.GradientAngle = 90;
+            this.paymentPanel.TabIndex = 24;
+            // 
+            // ParkingSpaceMonitorPanel
+            // 
+            this.ParkingSpaceMonitorPanel.DisabledBackColor = System.Drawing.Color.Empty;
+            this.ParkingSpaceMonitorPanel.Location = new System.Drawing.Point(3, 28);
+            this.ParkingSpaceMonitorPanel.Name = "ParkingSpaceMonitorPanel";
+            this.ParkingSpaceMonitorPanel.Size = new System.Drawing.Size(497, 295);
+            this.ParkingSpaceMonitorPanel.Style.Alignment = System.Drawing.StringAlignment.Center;
+            this.ParkingSpaceMonitorPanel.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
+            this.ParkingSpaceMonitorPanel.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
+            this.ParkingSpaceMonitorPanel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText;
+            this.ParkingSpaceMonitorPanel.Style.GradientAngle = 90;
+            this.ParkingSpaceMonitorPanel.TabIndex = 9;
+            // 
             // testPanel
             // 
             this.testPanel.Controls.Add(this.groupPanel2);
@@ -485,56 +549,6 @@
             this.labelX1.Text = "label1\r\nlable2";
             this.labelX1.TextAlignment = System.Drawing.StringAlignment.Center;
             // 
-            // NumMachineMonitorPanel
-            // 
-            this.NumMachineMonitorPanel.Controls.Add(this.flowLayoutPanel1);
-            this.NumMachineMonitorPanel.DisabledBackColor = System.Drawing.Color.Empty;
-            this.NumMachineMonitorPanel.Location = new System.Drawing.Point(3, 28);
-            this.NumMachineMonitorPanel.Name = "NumMachineMonitorPanel";
-            this.NumMachineMonitorPanel.Size = new System.Drawing.Size(497, 295);
-            this.NumMachineMonitorPanel.Style.Alignment = System.Drawing.StringAlignment.Center;
-            this.NumMachineMonitorPanel.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
-            this.NumMachineMonitorPanel.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
-            this.NumMachineMonitorPanel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText;
-            this.NumMachineMonitorPanel.Style.GradientAngle = 90;
-            this.NumMachineMonitorPanel.TabIndex = 0;
-            // 
-            // flowLayoutPanel1
-            // 
-            this.flowLayoutPanel1.BackColor = System.Drawing.SystemColors.GradientActiveCaption;
-            this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
-            this.flowLayoutPanel1.Name = "flowLayoutPanel1";
-            this.flowLayoutPanel1.Size = new System.Drawing.Size(497, 295);
-            this.flowLayoutPanel1.TabIndex = 1;
-            this.flowLayoutPanel1.Resize += new System.EventHandler(this.flowLayoutPanel1_Resize);
-            // 
-            // paymentPanel
-            // 
-            this.paymentPanel.DisabledBackColor = System.Drawing.Color.Empty;
-            this.paymentPanel.Location = new System.Drawing.Point(3, 28);
-            this.paymentPanel.Name = "paymentPanel";
-            this.paymentPanel.Size = new System.Drawing.Size(497, 295);
-            this.paymentPanel.Style.Alignment = System.Drawing.StringAlignment.Center;
-            this.paymentPanel.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
-            this.paymentPanel.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
-            this.paymentPanel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText;
-            this.paymentPanel.Style.GradientAngle = 90;
-            this.paymentPanel.TabIndex = 24;
-            // 
-            // ParkingSpaceMonitorPanel
-            // 
-            this.ParkingSpaceMonitorPanel.DisabledBackColor = System.Drawing.Color.Empty;
-            this.ParkingSpaceMonitorPanel.Location = new System.Drawing.Point(3, 28);
-            this.ParkingSpaceMonitorPanel.Name = "ParkingSpaceMonitorPanel";
-            this.ParkingSpaceMonitorPanel.Size = new System.Drawing.Size(497, 295);
-            this.ParkingSpaceMonitorPanel.Style.Alignment = System.Drawing.StringAlignment.Center;
-            this.ParkingSpaceMonitorPanel.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
-            this.ParkingSpaceMonitorPanel.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
-            this.ParkingSpaceMonitorPanel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText;
-            this.ParkingSpaceMonitorPanel.Style.GradientAngle = 90;
-            this.ParkingSpaceMonitorPanel.TabIndex = 9;
-            // 
             // dci_NumMachine
             // 
             this.dci_NumMachine.Control = this.NumMachineMonitorPanel;
@@ -756,6 +770,16 @@
             this.terminalMonitorPanel.Style.GradientAngle = 90;
             this.terminalMonitorPanel.TabIndex = 0;
             // 
+            // flp_Term
+            // 
+            this.flp_Term.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
+            this.flp_Term.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.flp_Term.Location = new System.Drawing.Point(0, 0);
+            this.flp_Term.Name = "flp_Term";
+            this.flp_Term.Padding = new System.Windows.Forms.Padding(5);
+            this.flp_Term.Size = new System.Drawing.Size(354, 295);
+            this.flp_Term.TabIndex = 0;
+            // 
             // dci_terminal
             // 
             this.dci_terminal.Control = this.terminalMonitorPanel;
@@ -1041,6 +1065,7 @@
             this.btn_devices.Name = "btn_devices";
             this.btn_devices.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
             this.btn_linkPLC,
+            this.btn_linkWeb,
             this.btn_PLCConf,
             this.btn_numMachineConf});
             this.btn_devices.Text = "工具";
@@ -1051,6 +1076,12 @@
             this.btn_linkPLC.Text = "连接PLC";
             this.btn_linkPLC.Click += new System.EventHandler(this.btn_linkPLC_Click);
             // 
+            // btn_linkWeb
+            // 
+            this.btn_linkWeb.Name = "btn_linkWeb";
+            this.btn_linkWeb.Text = "连接Web";
+            this.btn_linkWeb.Click += new System.EventHandler(this.btn_linkWeb_Click);
+            // 
             // btn_PLCConf
             // 
             this.btn_PLCConf.Name = "btn_PLCConf";
@@ -1115,9 +1146,9 @@
             // 
             this.panel_freeSpace.Controls.Add(this.lbx_freeSpace);
             this.panel_freeSpace.Dock = System.Windows.Forms.DockStyle.Right;
-            this.panel_freeSpace.Location = new System.Drawing.Point(874, 0);
+            this.panel_freeSpace.Location = new System.Drawing.Point(866, 0);
             this.panel_freeSpace.Name = "panel_freeSpace";
-            this.panel_freeSpace.Size = new System.Drawing.Size(320, 93);
+            this.panel_freeSpace.Size = new System.Drawing.Size(328, 93);
             this.panel_freeSpace.TabIndex = 3;
             // 
             // lbx_freeSpace
@@ -1133,7 +1164,7 @@
             this.lbx_freeSpace.ForeColor = System.Drawing.Color.Tomato;
             this.lbx_freeSpace.Location = new System.Drawing.Point(0, 0);
             this.lbx_freeSpace.Name = "lbx_freeSpace";
-            this.lbx_freeSpace.Size = new System.Drawing.Size(320, 93);
+            this.lbx_freeSpace.Size = new System.Drawing.Size(328, 93);
             this.lbx_freeSpace.TabIndex = 2;
             this.lbx_freeSpace.Text = "currentFreeSpace";
             this.lbx_freeSpace.TextAlignment = System.Drawing.StringAlignment.Center;
@@ -1301,15 +1332,115 @@
             this.controlContainerItem1.MenuVisibility = DevComponents.DotNetBar.eMenuVisibility.VisibleAlways;
             this.controlContainerItem1.Name = "controlContainerItem1";
             // 
-            // flp_Term
+            // dci_devStatus
+            // 
+            this.dci_devStatus.Control = this.pdc_devStatus;
+            this.dci_devStatus.Name = "dci_devStatus";
+            this.dci_devStatus.Text = "设备状态监控";
+            // 
+            // pdc_devStatus
+            // 
+            this.pdc_devStatus.CanvasColor = System.Drawing.SystemColors.GradientInactiveCaption;
+            this.pdc_devStatus.Controls.Add(this.panel1);
+            this.pdc_devStatus.DisabledBackColor = System.Drawing.Color.Empty;
+            this.pdc_devStatus.Location = new System.Drawing.Point(3, 28);
+            this.pdc_devStatus.Name = "pdc_devStatus";
+            this.pdc_devStatus.Size = new System.Drawing.Size(497, 295);
+            this.pdc_devStatus.Style.Alignment = System.Drawing.StringAlignment.Center;
+            this.pdc_devStatus.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
+            this.pdc_devStatus.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
+            this.pdc_devStatus.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText;
+            this.pdc_devStatus.Style.GradientAngle = 90;
+            this.pdc_devStatus.TabIndex = 43;
+            // 
+            // tableLayoutPanel2
+            // 
+            this.tableLayoutPanel2.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
+            this.tableLayoutPanel2.ColumnCount = 2;
+            this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+            this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+            this.tableLayoutPanel2.Controls.Add(this.lbx_webStatus, 1, 1);
+            this.tableLayoutPanel2.Controls.Add(this.lbx_PLCStatus, 1, 0);
+            this.tableLayoutPanel2.Controls.Add(this.lbx_PLC, 0, 0);
+            this.tableLayoutPanel2.Controls.Add(this.lbx_web, 0, 1);
+            this.tableLayoutPanel2.Location = new System.Drawing.Point(12, 12);
+            this.tableLayoutPanel2.Name = "tableLayoutPanel2";
+            this.tableLayoutPanel2.RowCount = 3;
+            this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
+            this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
+            this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
+            this.tableLayoutPanel2.Size = new System.Drawing.Size(179, 121);
+            this.tableLayoutPanel2.TabIndex = 1;
+            // 
+            // lbx_PLC
+            // 
+            // 
             // 
-            this.flp_Term.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
-            this.flp_Term.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.flp_Term.Location = new System.Drawing.Point(0, 0);
-            this.flp_Term.Name = "flp_Term";
-            this.flp_Term.Padding = new System.Windows.Forms.Padding(5);
-            this.flp_Term.Size = new System.Drawing.Size(354, 295);
-            this.flp_Term.TabIndex = 0;
+            // 
+            this.lbx_PLC.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+            this.lbx_PLC.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.lbx_PLC.Location = new System.Drawing.Point(3, 3);
+            this.lbx_PLC.Name = "lbx_PLC";
+            this.lbx_PLC.Size = new System.Drawing.Size(83, 34);
+            this.lbx_PLC.TabIndex = 0;
+            this.lbx_PLC.Text = "PLC";
+            this.lbx_PLC.TextAlignment = System.Drawing.StringAlignment.Center;
+            // 
+            // lbx_web
+            // 
+            // 
+            // 
+            // 
+            this.lbx_web.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+            this.lbx_web.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.lbx_web.Location = new System.Drawing.Point(3, 43);
+            this.lbx_web.Name = "lbx_web";
+            this.lbx_web.Size = new System.Drawing.Size(83, 34);
+            this.lbx_web.TabIndex = 1;
+            this.lbx_web.Text = "web服务器";
+            this.lbx_web.TextAlignment = System.Drawing.StringAlignment.Center;
+            // 
+            // lbx_PLCStatus
+            // 
+            this.lbx_PLCStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
+            this.lbx_PLCStatus.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
+            // 
+            // 
+            // 
+            this.lbx_PLCStatus.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+            this.lbx_PLCStatus.Location = new System.Drawing.Point(112, 3);
+            this.lbx_PLCStatus.Name = "lbx_PLCStatus";
+            this.lbx_PLCStatus.Size = new System.Drawing.Size(44, 34);
+            this.lbx_PLCStatus.Symbol = "";
+            this.lbx_PLCStatus.SymbolColor = System.Drawing.Color.Crimson;
+            this.lbx_PLCStatus.SymbolSize = 25F;
+            this.lbx_PLCStatus.TabIndex = 2;
+            // 
+            // lbx_webStatus
+            // 
+            this.lbx_webStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
+            this.lbx_webStatus.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
+            // 
+            // 
+            // 
+            this.lbx_webStatus.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+            this.lbx_webStatus.Location = new System.Drawing.Point(112, 43);
+            this.lbx_webStatus.Name = "lbx_webStatus";
+            this.lbx_webStatus.Size = new System.Drawing.Size(43, 34);
+            this.lbx_webStatus.Symbol = "";
+            this.lbx_webStatus.SymbolColor = System.Drawing.Color.Crimson;
+            this.lbx_webStatus.SymbolSize = 25F;
+            this.lbx_webStatus.TabIndex = 3;
+            // 
+            // panel1
+            // 
+            this.panel1.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
+            this.panel1.Controls.Add(this.tableLayoutPanel2);
+            this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.panel1.Location = new System.Drawing.Point(0, 0);
+            this.panel1.Name = "panel1";
+            this.panel1.Size = new System.Drawing.Size(497, 295);
+            this.panel1.TabIndex = 2;
             // 
             // centralController
             // 
@@ -1336,6 +1467,7 @@
             this.dockSite_mainView.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.bar_mainWin)).EndInit();
             this.bar_mainWin.ResumeLayout(false);
+            this.NumMachineMonitorPanel.ResumeLayout(false);
             this.testPanel.ResumeLayout(false);
             this.testPanel.PerformLayout();
             this.groupPanel2.ResumeLayout(false);
@@ -1346,7 +1478,6 @@
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
             this.tableLayoutPanel1.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
-            this.NumMachineMonitorPanel.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.bar_bottom)).EndInit();
             this.bar_bottom.ResumeLayout(false);
             this.RecordsMonitorPanel.ResumeLayout(false);
@@ -1363,6 +1494,9 @@
             ((System.ComponentModel.ISupportInitialize)(this.bar_shortcut)).EndInit();
             this.bar_shortcut.ResumeLayout(false);
             this.panel_freeSpace.ResumeLayout(false);
+            this.pdc_devStatus.ResumeLayout(false);
+            this.tableLayoutPanel2.ResumeLayout(false);
+            this.panel1.ResumeLayout(false);
             this.ResumeLayout(false);
 
         }
@@ -1466,6 +1600,15 @@
         private System.Windows.Forms.PictureBox pictureBox5;
         private System.Windows.Forms.PictureBox pictureBox3;
         private System.Windows.Forms.FlowLayoutPanel flp_Term;
+        private DevComponents.DotNetBar.ButtonItem btn_linkWeb;
+        private DevComponents.DotNetBar.PanelDockContainer pdc_devStatus;
+        private DevComponents.DotNetBar.DockContainerItem dci_devStatus;
+        private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
+        private DevComponents.DotNetBar.LabelX lbx_PLC;
+        private DevComponents.DotNetBar.LabelX lbx_web;
+        private DevComponents.DotNetBar.LabelX lbx_webStatus;
+        private DevComponents.DotNetBar.LabelX lbx_PLCStatus;
+        private System.Windows.Forms.Panel panel1;
     }
 }
 

+ 124 - 31
PLCLinker/centralController/FormCentralController.cs

@@ -29,6 +29,7 @@ namespace centralController
         public centralController()
         {
             InitializeComponent();
+
             TermDispList = new List<TermModel>();
 
             if (Monitor.Monitor.ins == null)
@@ -76,42 +77,88 @@ namespace centralController
             freeSpaceTimer.Start();
             rtb_notification.Text = "";
 
+            //地面车位显示
             Task.Factory.StartNew(() =>
             {
-                while (!closing)
+                UpdateAllTerms();
+            });
+        }
+
+
+        /// <summary>
+        /// 实时更新所有车位显示
+        /// </summary>
+        private void UpdateAllTerms()
+        {
+            while (!closing)
+            {
+                List<TerminalStru> tList = Terminal.Terminal.terminalInfo;
+                this.Invoke(new Action(() =>
                 {
-                    List<TerminalStru> tList = Terminal.Terminal.terminalInfo;
+                    int currentDispID = 0;
+                    //出现终端丢失情况,必定是与PLC连接问题导致数据异常,重新初始化显示模块
+                    for (int i = 0; i < TermDispList.Count; i++)
+                    {
+                        bool finded = false;
+                        if (currentDispID < TermDispList[i].id)
+                        {
+                            currentDispID = TermDispList[i].id;
+                            for (int j = 0; j < tList.Count; j++)
+                            {
+                                if (currentDispID == tList[j].terminalID)
+                                {
+                                    finded = true; break;
+                                }
+                            }
+                        }
+                        else
+                        {
+                            finded = false;
+                        }
+                        if (!finded)
+                        {
+                            flp_Term.Controls.Clear();
+                            TermDispList.Clear();
+                            Console.WriteLine("******************************");
+                            break;
+                        }
+                    }
                     for (int i = 0; i < tList.Count; i++)
                     {
                         TerminalStru ts = tList[i];
-                        this.Invoke(new Action(() =>
+                        bool updated = false;
+                        for (int j = 0; j < TermDispList.Count; j++)
                         {
-                            bool updated = false;
-                            for (int j = 0; j < TermDispList.Count; j++)
+                            if (ts.terminalID == TermDispList[j].id)
                             {
-                                if (ts.terminalID == TermDispList[j].id)
-                                {
-                                    UpdateTermGP(TermDispList[j], ts.terminalID,
+                                UpdateTermGP(TermDispList[j], ts.terminalID,
                                         ts.terminalStatus == (short)1 ? true : false,
                                         ts.cmd == ts.terminalStatus ? true : false,
                                         ts.groundStatus == (short)1 ? true : false,
                                         ts.numMachineLaunch == (short)1 ? true : false);
-                                    updated = true;
-                                    break;
-                                }
+                                updated = true;
+                                break;
                             }
-                            if (!updated)
-                                InitTermGP(ts.terminalID,
+                        }
+                        if (!updated)
+                            InitTermGP(ts.terminalID,
                                             ts.terminalStatus == (short)1 ? true : false,
                                             ts.cmd == ts.terminalStatus ? true : false,
                                             ts.groundStatus == (short)1 ? true : false,
                                             ts.numMachineLaunch == (short)1 ? true : false);
-                        }));
                     }
-                    Thread.Sleep(5000);
-                }
-            });
+                }));
+                Thread.Sleep(5000);
+            }
         }
+        /// <summary>
+        /// 初始化地面车位信息
+        /// </summary>
+        /// <param name="id"></param>
+        /// <param name="park"></param>
+        /// <param name="launched"></param>
+        /// <param name="groundSensor"></param>
+        /// <param name="numMachine"></param>
         private void InitTermGP(int id, bool park, bool launched, bool groundSensor, bool numMachine)
         {
             GroupPanel gpTerm = new GroupPanel();
@@ -170,6 +217,15 @@ namespace centralController
             TermDispList.Add(tm);
             flp_Term.Controls.Add(gpTerm);
         }
+        /// <summary>
+        /// 更新地面车位信息
+        /// </summary>
+        /// <param name="tm"></param>
+        /// <param name="id"></param>
+        /// <param name="park"></param>
+        /// <param name="launched"></param>
+        /// <param name="groundSensor"></param>
+        /// <param name="numMachine"></param>
         private void UpdateTermGP(TermModel tm, int id, bool park, bool launched, bool groundSensor, bool numMachine)
         {
             tm.UpdateStatus(id, park, launched, groundSensor, numMachine);
@@ -197,6 +253,7 @@ namespace centralController
                     tm.pbNum.Visible = false;
             }
         }
+
         #region 测试
         /// <summary>
         /// 获取号牌测试
@@ -391,12 +448,41 @@ namespace centralController
         /// <param name="e"></param>
         private void btn_linkPLC_Click(object sender, EventArgs e)
         {
-            if (!Monitor.Monitor.PLC.isConnected)
+            if (Monitor.Monitor.PLC != null)
             {
-                Monitor.Monitor.PLC.PLCConnect();
+                if (!Monitor.Monitor.PLC.isConnected)
+                {
+                    Monitor.Monitor.PLC.PLCConnect();
+                }
+                else
+                {
+                    List<object> received = Monitor.Monitor.PLC.ReadFromPLC(PLCDataType.terminal, 0);
+                    if (received.Count != Monitor.Monitor.plcTerminalCount)
+                    {
+                        Monitor.Monitor.SetNotification("检测到PLC数据异常", TextColor.Warning);
+                        Monitor.Monitor.PLC.PLCDisconnect();
+                        Monitor.Monitor.PLC.PLCConnect();
+                    }
+                    else
+                    {
+                        Monitor.Monitor.SetNotification("PLC连接正常,无需连接", TextColor.Info);
+                    }
+                }
             }
         }
         /// <summary>
+        /// 手动连接Web
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void btn_linkWeb_Click(object sender, EventArgs e)
+        {
+            Task.Factory.StartNew(() =>
+            {
+                Monitor.Monitor.webServer.Connect();
+            });
+        }
+        /// <summary>
         /// PLC数据调试工具
         /// </summary>
         /// <param name="sender"></param>
@@ -419,7 +505,7 @@ namespace centralController
         #endregion
 
         /// <summary>
-        /// 更新提示信息
+        /// 更新提示信息,将被从外部调用
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
@@ -461,11 +547,12 @@ namespace centralController
             }
 
             //rtb_notification.Text = Monitor.Monitor.ins.GetNotification();
-            //rtb_notification.ScrollToCaret();
+            if (!rtb_notification.Focused)
+                rtb_notification.ScrollToCaret();
         }
 
         /// <summary>
-        /// 定时更新时间与空闲车位显示
+        /// 定时更新时间与空闲车位显示,以及设备连接状态
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
@@ -475,6 +562,9 @@ namespace centralController
             string freeSpace = "剩余车位:" + Monitor.Monitor.ins.GetFreeSpaceCount(0);
             string bookableSpace = "可预约车位:" + Monitor.Monitor.ins.GetFreeSpaceCount(2);
             lbx_freeSpace.Text = currentTime + "\r\n" + freeSpace + "     " + bookableSpace;
+
+            lbx_PLCStatus.SymbolColor = (Monitor.Monitor.PLC != null && Monitor.Monitor.PLC.isConnected) ? Color.Green : Color.OrangeRed;
+            lbx_webStatus.SymbolColor = (Monitor.Monitor.webServer != null && Monitor.Monitor.webServer.GetConnectStatus()) ? Color.Green : Color.OrangeRed;
         }
         /// <summary>
         /// 刷新停车记录显示
@@ -637,24 +727,27 @@ namespace centralController
         #endregion
 
         #region 快捷菜单栏
-
+        /// <summary>
+        /// 快捷显示系统信息
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
         private void shortcut_sysInfo_Click(object sender, EventArgs e)
         {
             FormSysInfo sysInfo = new FormSysInfo(Monitor.Monitor.GetSysInfo());
             sysInfo.ShowDialog();
         }
-
+        /// <summary>
+        /// 快捷关闭
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
         private void shortcut_close_Click(object sender, EventArgs e)
         {
-            DialogResult result = MessageBox.Show("确定退出系统吗?", "温馨提示", MessageBoxButtons.OKCancel);
-            if (result.Equals(DialogResult.OK))
-            {
-                Monitor.Monitor.ins.Stop();
-                closing = true;
-                Close();
-            }
+            Close();
         }
         #endregion
 
+
     }
 }

+ 8 - 3
PLCLinker/centralController/Monitor/Monitor.cs

@@ -133,10 +133,10 @@ namespace Monitor
                                 for (int i = 0; i < plcTerminalCount; i++)
                                 {
                                     Terminal.Terminal.terminalInfo.Add((TerminalStru)received[i]);
-                                    if (!Terminal.Terminal.termUsedMap.ContainsKey(((TerminalStru)received[i]).terminalID))
-                                        Terminal.Terminal.termUsedMap.Add(((TerminalStru)received[i]).terminalID, false);
+                                    if (!Terminal.Terminal.termCalcMap.ContainsKey(((TerminalStru)received[i]).terminalID))
+                                        Terminal.Terminal.termCalcMap.Add(((TerminalStru)received[i]).terminalID, false);
                                     else
-                                        Terminal.Terminal.termUsedMap[((TerminalStru)received[i]).terminalID] = false;
+                                        Terminal.Terminal.termCalcMap[((TerminalStru)received[i]).terminalID] = false;
                                 }
                             }
                         }
@@ -186,6 +186,11 @@ namespace Monitor
                         {
                             disconnected = true;
                             SetNotification("PLC掉线,请检查连接",TextColor.Warning);
+                        }else if (linkCount == 5)
+                        {
+                            Terminal.Terminal.terminalInfo.Clear();
+                            parkingSpaceInfo.Clear();
+                            mainBlockInfo = new MainBlockStru();
                         }
                     }
                 }

+ 176 - 120
PLCLinker/centralController/Terminal/Terminal.cs

@@ -23,8 +23,15 @@ namespace Terminal
         /// <summary>
         /// 取车地面位id与是否已计费标记映射
         /// </summary>
-        public static Dictionary<int, bool> termUsedMap = new Dictionary<int, bool>();
-        private static Dictionary<int, FetchInfo> fetchMap = new Dictionary<int, FetchInfo>();
+        public static Dictionary<int, bool> termCalcMap = new Dictionary<int, bool>();
+        /// <summary>
+        /// 终端ID与取车完成标志映射
+        /// </summary>
+        public static Dictionary<int, bool> fetchCompleteMap = new Dictionary<int, bool>();
+        /// <summary>
+        /// 终端ID与取车信息映射
+        /// </summary>
+        private static Dictionary<int, FetchInfo> fetchInfoMap = new Dictionary<int, FetchInfo>();
         private static List<bool> lockList = new List<bool>();
         public static bool isClosing = false;
 
@@ -126,7 +133,7 @@ namespace Terminal
                             }
                         }
                     }
-                    catch { }
+                    catch { Log.WriteLog(LogType.process, LogFile.INFO, "数据库车位查询异常"); }
                     try
                     {
                         reader.Close();
@@ -319,7 +326,7 @@ namespace Terminal
                         Monitor.Monitor.PLC.WriteToPLC(ts, PLCDataType.central);
                         status = 1;
                         Log.WriteLog(LogType.process, LogFile.INFO, "号牌验证成功");
-                        Monitor.Monitor.SetNotification("注册用户,号牌验证成功",parkMonitor.model.TextColor.Info);
+                        Monitor.Monitor.SetNotification("注册用户,号牌验证成功", parkMonitor.model.TextColor.Info);
                     }
                     else
                     {
@@ -327,7 +334,7 @@ namespace Terminal
                         Monitor.Monitor.PLC.WriteToPLC(ts, PLCDataType.central);
                         status = 2;
                         Log.WriteLog(LogType.process, LogFile.WARNING, "号牌验证失败");
-                        Monitor.Monitor.SetNotification("注册用户,号牌验证失败",parkMonitor.model.TextColor.Error);
+                        Monitor.Monitor.SetNotification("注册用户,号牌验证失败", parkMonitor.model.TextColor.Error);
                     }
                     try
                     {
@@ -373,12 +380,13 @@ namespace Terminal
             {
                 try
                 {
-                    if (reader.Read())
+                    while (reader.Read())
                     {
-                        recordsID = reader.GetInt32("parkingRecordsID");
+                        if (reader.HasRows)
+                            recordsID = reader.GetInt32("parkingRecordsID");
                     }
                 }
-                catch (Exception e) { Log.WriteLog(LogType.process, LogFile.ERROR, "查询停车记录id失败"); ; Console.WriteLine(e.Message); };
+                catch (Exception e) { Log.WriteLog(LogType.process, LogFile.ERROR, "查询停车记录id失败"); Console.WriteLine(e.Message); };
                 try
                 {
                     reader.Close();
@@ -388,21 +396,21 @@ namespace Terminal
             }
         }
 
-        private static void BookedCarProcess()
-        {
-            for (int i = 0; i < terminalInfo.Count; i++)
-            {
-                if (terminalInfo[i].groundStatus == 1 && terminalInfo[i].btnStatus == 0)
-                {
-                    string license = Monitor.Monitor.numMachineLinker.GetLicensePlate(terminalInfo[i].terminalID);
-                    if (license == "") { break; }
-                    else
-                    {
+        //private static void BookedCarProcess()
+        //{
+        //    for (int i = 0; i < terminalInfo.Count; i++)
+        //    {
+        //        if (terminalInfo[i].groundStatus == 1 && terminalInfo[i].btnStatus == 0)
+        //        {
+        //            string license = Monitor.Monitor.numMachineLinker.GetLicensePlate(terminalInfo[i].terminalID);
+        //            if (license == "") { break; }
+        //            else
+        //            {
 
-                    }
-                }
-            }
-        }
+        //            }
+        //        }
+        //    }
+        //}
         #region 获取号牌方法,已调整
         /// <summary>
         /// 停车流程,收到号牌机启动后操作过程
@@ -423,8 +431,8 @@ namespace Terminal
                         //判断之前是否已拍摄号牌
                         if (!idLicMap.ContainsKey(terminalInfo[i].terminalID))
                         {
-                            license = Monitor.Monitor.numMachineLinker.GetLicensePlate(terminalInfo[i].terminalID);
-                            Monitor.Monitor.SetNotification("启动" + terminalInfo[i].terminalID + "号号牌机,号牌:" + license,parkMonitor.model.TextColor.Info);
+                            license = "桂K88888"; //Monitor.Monitor.numMachineLinker.GetLicensePlate(terminalInfo[i].terminalID);
+                            Monitor.Monitor.SetNotification("启动" + terminalInfo[i].terminalID + "号号牌机,号牌:" + license, parkMonitor.model.TextColor.Info);
                         }
                         else
                         {
@@ -469,9 +477,9 @@ namespace Terminal
                                         idLicMap.Add(terminalInfo[i].terminalID, license);
                                     }
                                 }
-                                catch(Exception e) { Log.WriteLog(LogType.process, LogFile.ERROR, "号牌" + license + "记录号牌异常\n"+e.StackTrace); }
+                                catch (Exception e) { Log.WriteLog(LogType.process, LogFile.ERROR, "号牌" + license + "记录号牌异常\n" + e.StackTrace); }
                             }
-                            Log.WriteLog(LogType.process, LogFile.ERROR, "号牌" + license + "已记录");
+                            Log.WriteLog(LogType.process, LogFile.INFO, "号牌" + license + "已记录");
 
                             TerminalStru ts = new TerminalStru
                             {
@@ -509,14 +517,14 @@ namespace Terminal
                             };
                             Monitor.Monitor.PLC.WriteToPLC(mb, PLCDataType.central);
                             //号牌获取结果被清零才跳出
-                            Monitor.Monitor.SetNotification("已写入号牌获取结果,等待号牌机启动指令清零",parkMonitor.model.TextColor.Info);
+                            Monitor.Monitor.SetNotification("已写入号牌获取结果,等待号牌机启动指令清零", parkMonitor.model.TextColor.Info);
                         }
                         int countdown = 5;
                         while (countdown-- > 0)
                         {
                             if (term.numMachineLaunch == 0)
                             {
-                                Monitor.Monitor.SetNotification("号牌机启动指令已被清零",parkMonitor.model.TextColor.Info); break;
+                                Monitor.Monitor.SetNotification("号牌机启动指令已被清零", parkMonitor.model.TextColor.Info); break;
                             }
                             else
                                 Thread.Sleep(1000);
@@ -560,7 +568,7 @@ namespace Terminal
                     //找到停车位置
                     for (int s = 0; s < Monitor.Monitor.parkingSpaceInfo.Count; s++)
                     {
-                        Console.WriteLine(Monitor.Monitor.parkingSpaceInfo[s].receiptNum + "," + term.receiptNum);
+                        //Console.WriteLine(Monitor.Monitor.parkingSpaceInfo[s].receiptNum + "," + term.receiptNum);
                         if (Monitor.Monitor.parkingSpaceInfo[s].receiptNum == term.receiptNum)
                         {
                             parkingSpaceID = Monitor.Monitor.parkingSpaceInfo[s].parkingSpace;
@@ -571,7 +579,7 @@ namespace Terminal
                     if (parkingSpaceID == 0 || term.receiptNum == 0)
                     {
                         try { idLicMap.Remove(currentTerm); } catch { }
-                        Monitor.Monitor.SetNotification("无车位或凭证号",parkMonitor.model.TextColor.Warning);
+                        Monitor.Monitor.SetNotification("无车位或凭证号", parkMonitor.model.TextColor.Warning);
                         return;
                     }
                     UpdateVehicle(license, 0, 0, true, false, 0);
@@ -593,7 +601,7 @@ namespace Terminal
                     Monitor.Monitor.localDBOper.Insert(list);
                     Monitor.Monitor.remoteDBOper.Insert(list);
                     Log.WriteLog(LogType.process, LogFile.INFO, "停车记录已插入," + license + "停在" + parkingSpaceID + ",凭证号:" + term.receiptNum);
-                    Monitor.Monitor.SetNotification("停车记录已插入",parkMonitor.model.TextColor.Info);
+                    Monitor.Monitor.SetNotification("停车记录已插入", parkMonitor.model.TextColor.Info);
                     ////注册用户记录插入云端
                     //if (term.btnStatus == 0)
                     //{
@@ -605,7 +613,7 @@ namespace Terminal
                     int remoteParkingRecordsID = 0;
                     QueryParkingRecordsID(findRecordSql, out parkingRecordsID, false);
                     QueryParkingRecordsID(findRecordSql, out remoteParkingRecordsID, true);
-                    //更新本地车辆表
+                    //更新车辆表
                     if (parkingRecordsID != 0)
                     {
                         UpdateVehicle(license, 1, parkingRecordsID, true, false, parkingSpaceID);
@@ -625,7 +633,7 @@ namespace Terminal
                     //中控清除车牌、凭证号、号牌验证等信息
                     ClearTerminal(term.terminalID);
                     try { idLicMap.Remove(currentTerm); } catch { }
-                    Monitor.Monitor.SetNotification(license + " 数据库已更新,停车流程结束",parkMonitor.model.TextColor.Info);
+                    Monitor.Monitor.SetNotification(license + " 数据库已更新,停车流程结束", parkMonitor.model.TextColor.Info);
                 }
             }
         }
@@ -664,9 +672,9 @@ namespace Terminal
                 short registered = 4;
                 while (license == "" && countdown-- > 0)
                 {
-                    license = Monitor.Monitor.numMachineLinker.GetLicensePlate(terminalInfo[index].terminalID);
+                    license = "桂K88888"; //Monitor.Monitor.numMachineLinker.GetLicensePlate(terminalInfo[index].terminalID);
                 }
-                Monitor.Monitor.SetNotification(terminalInfo[index].terminalID + "号车位收到地感,拍到" + license,parkMonitor.model.TextColor.Log);
+                Monitor.Monitor.SetNotification(terminalInfo[index].terminalID + "号车位收到地感,拍到" + license, parkMonitor.model.TextColor.Log);
                 if (license != "")
                 {
                     //map中加入或更新号牌,供完成时写入数据库用
@@ -681,7 +689,7 @@ namespace Terminal
                     if (Monitor.Monitor.webServer.ReservedCarCheck(license))
                     {
                         registered = 3;
-                        Monitor.Monitor.SetNotification("预约车辆入场",parkMonitor.model.TextColor.Info);
+                        Monitor.Monitor.SetNotification("预约车辆入场", parkMonitor.model.TextColor.Info);
                     }
                     #region 通过数据库查询是否预约车,方法待定
                     //int vehicleState = -1;
@@ -723,7 +731,7 @@ namespace Terminal
                         receiptNum = -1
                     };
                     Monitor.Monitor.PLC.WriteToPLC(ts, PLCDataType.terminal);
-                    Monitor.Monitor.SetNotification("指令写入PLC:"+ts.btnStatus,parkMonitor.model.TextColor.Log);
+                    Monitor.Monitor.SetNotification("指令写入PLC:" + ts.btnStatus, parkMonitor.model.TextColor.Log);
                     Thread.Sleep(1000);
                 }
                 else
@@ -804,7 +812,7 @@ namespace Terminal
                 else
                 {
                     Log.WriteLog(LogType.process, LogFile.ERROR, "根据凭证号查询停车记录失败");
-                    Monitor.Monitor.SetNotification("取车流程, 根据凭证号查询停车记录失败",parkMonitor.model.TextColor.Error);
+                    Monitor.Monitor.SetNotification("取车流程, 根据凭证号查询停车记录失败", parkMonitor.model.TextColor.Error);
                     result = false;
                 }
                 //if (reader != null)
@@ -823,7 +831,8 @@ namespace Terminal
                 }
             }
             catch { }
-            Log.WriteLog(LogType.process, LogFile.INFO, "根据凭证号查询停车记录成功");
+            if (result)
+                Log.WriteLog(LogType.process, LogFile.INFO, "根据凭证号查询停车记录成功");
             return result;
         }
         private static bool FindRemoteParkingRecord(int receipt, out int recordID)
@@ -946,7 +955,26 @@ namespace Terminal
             if (orderRecordsID != 0)
             {
                 //修改orderTimeLength
+                string orderInfoSql = "select bookHour from orderrecords where orderRecordsID = '" + orderRecordsID + "';";
+                try
+                {
+                    reader = Monitor.Monitor.localDBOper.Query(vipInfoSql);
+                    if (reader != null && reader.Read())
+                    {
+                        orderTimeLength = new TimeSpan(reader.GetInt32("bookHour"), 0, 0);
+                    }
+                }
+                catch { }
             }
+            try
+            {
+                if (reader != null)
+                {
+                    reader.Close();
+                    reader.Dispose();
+                }
+            }
+            catch (Exception e) { Console.WriteLine(e.Message); }
             return result;
         }
         /// <summary>
@@ -971,7 +999,7 @@ namespace Terminal
                         {
                             if (hours > 24)
                             {
-                                parkFee = hours/24 * scheme.upperBound + Math.Min(scheme.intervalCharge * (hours%24) / scheme.chargeInterval, scheme.upperBound);
+                                parkFee = hours / 24 * scheme.upperBound + Math.Min(scheme.intervalCharge * (hours % 24) / scheme.chargeInterval, scheme.upperBound);
                             }
                             else
                             {
@@ -1029,11 +1057,11 @@ namespace Terminal
                 receiptNum = ts.receiptNum;
                 //取车状态、凭证号不为空,查询数据库计费
                 //Console.WriteLine((termIndex != -1) + "," + (termUsedMap.Count >= termIndex) + "," + termUsedMap.TryGetValue(termIndex, out bool valuee) + "," + (!valuee) + "," + (fetchState == 1) + "," + (receiptNum != 0));
-                if (termIndex != -1 && termUsedMap.Count >= termIndex && termUsedMap.TryGetValue(termIndex, out bool value) && !value && ts.cmd == 2 && receiptNum != 0)
+                if (termIndex != -1 && termCalcMap.Count >= termIndex && termCalcMap.TryGetValue(termIndex, out bool value) && !value && ts.cmd == 2 && receiptNum != 0)
                 {
                     //fetchState = Monitor.Monitor.mainBlockInfo.fetchingRunning;
-                    Monitor.Monitor.SetNotification(termIndex + "号终端准备计算费用",parkMonitor.model.TextColor.Log);
-                    termUsedMap[termIndex] = true;
+                    Monitor.Monitor.SetNotification(termIndex + "号终端准备计算费用", parkMonitor.model.TextColor.Log);
+                    termCalcMap[termIndex] = true;
                     Console.WriteLine("终端编号" + termIndex);
 
                     int parkingRecordsID = 0;
@@ -1064,8 +1092,12 @@ namespace Terminal
                     }
                     if (monthCardType == -1) monthCardType = 0;
                     //3.获取停车时刻,根据用户类型计费发送给PLC,暂认为无预约
-                    DateTime parkTime = DateTime.Parse(realParkTime);
-                    DateTime currentTime = DateTime.Now;
+                    DateTime parkTime = DateTime.Now, currentTime = DateTime.Now;
+                    try
+                    {
+                        parkTime = DateTime.Parse(realParkTime);
+                    }
+                    catch { failed = true; }
                     int fee = 32767;
                     if (failed) { monthCardType = -2; }
                     if (PaymentScheme.ins != null)
@@ -1099,12 +1131,18 @@ namespace Terminal
                         }
                         catch { Console.WriteLine("error"); }
                     }
-                    Monitor.Monitor.SetNotification("用户类型:" + (monthCardType+1) + ",费用:" + fee + ",等待凭证号被清除且流程结束后更新车辆状态",parkMonitor.model.TextColor.Log);
+                    Monitor.Monitor.SetNotification("用户类型:" + (monthCardType + 1) + ",费用:" + fee + ",等待凭证号被清除且流程结束后更新车辆状态", parkMonitor.model.TextColor.Log);
                     FetchInfo fetchInfo = new FetchInfo(license, parkingRecordsID, remoteParkingRecordsID, fee, receiptNum);
-                    if (!fetchMap.ContainsKey(termIndex))
-                        fetchMap.Add(termIndex, fetchInfo);
+                    if (!fetchInfoMap.ContainsKey(termIndex))
+                    {
+                        fetchInfoMap.Add(termIndex, fetchInfo);
+                        fetchCompleteMap.Add(termIndex, true);
+                    }
                     else
-                        fetchMap[termIndex] = fetchInfo;
+                    {
+                        fetchInfoMap[termIndex] = fetchInfo;
+                        fetchCompleteMap[termIndex] = true;
+                    }
                 }
             }
         }
@@ -1113,88 +1151,106 @@ namespace Terminal
         {
             int fetchState = Monitor.Monitor.mainBlockInfo.fetchingRunning;
             int termIndex = -1;
-            TerminalStru ts = new TerminalStru();
-            if (fetchState == 1)
+            try
             {
-                //找到当前取车终端
-                for (int i = 0; i < terminalInfo.Count; i++)
-                {
-                    if (terminalInfo[i].terminalID == Monitor.Monitor.mainBlockInfo.terminalID)
-                    {
-                        ts = terminalInfo[i];
-                        termIndex = ts.terminalID;
-                        break;
-                    }
-                }
-                //4.等待终端获得收费完成信号且将凭证号清除后,清除收费完成信号并将信息写入数据库
-                int count = 0;
-                while (!isClosing && termIndex != -1)
+                if (fetchState == 1)
                 {
-                    if (Monitor.Monitor.mainBlockInfo.processCompleted == 1)
+                    //找到当前取车终端
+                    for (int i = 0; i < terminalInfo.Count; i++)
                     {
-                        while (terminalInfo[termIndex - 1].receiptNum != 0)
+                        if (terminalInfo[i].terminalID == Monitor.Monitor.mainBlockInfo.terminalID && Monitor.Monitor.mainBlockInfo.terminalID != 0)
                         {
-                            count++;
-                            if (count == 1)
-                                Monitor.Monitor.SetNotification("等待凭证号清除",parkMonitor.model.TextColor.Log);
-                            if (count > 10000)//避免int型数据溢出
-                                count = 2;
-                            Thread.Sleep(200);
+                            termIndex = i;
+                            break;
                         }
-                        int paymentStatus = 0;
-                        for (int i = 0; i < terminalInfo.Count; i++)
+                    }
+                    if (fetchCompleteMap.ContainsKey(terminalInfo[termIndex].terminalID) && fetchCompleteMap[terminalInfo[termIndex].terminalID])
+                    {
+                        fetchCompleteMap[terminalInfo[termIndex].terminalID] = false;
+                        Task.Factory.StartNew(() =>
                         {
-                            if (terminalInfo[i].terminalID == Monitor.Monitor.mainBlockInfo.terminalID)
+                            //4.等待终端获得收费完成信号且将凭证号清除后,清除收费完成信号并将信息写入数据库
+                            int count = 0;
+                            while (!isClosing && termIndex != -1)
                             {
-                                paymentStatus = terminalInfo[i].paymentStatus;
-                                break;
-                            }
-                        }
-                        Log.WriteLog(LogType.process, LogFile.INFO, "检测到凭证号已被清除");
-                        FetchInfo fi = null;
-                        if (fetchMap.ContainsKey(termIndex))
-                        {
-                            fi = fetchMap[termIndex];
-                        }
-                        else
-                        {
-                            Monitor.Monitor.SetNotification("未查询到该取车终端存在计费操作",parkMonitor.model.TextColor.Error);
-                            return;
-                        }
-                        //TerminalStru fetchReset = new TerminalStru
-                        //{
-                        //    terminalID = (short)termIndex,
-                        //    paymentStatus = (short)0,
-                        //    licVerification = (short)0,
-                        //    parkingFee = (short)32767,
-                        //    userType = (short)0
-                        //};
-                        //Monitor.Monitor.PLC.WriteToPLC(fetchReset, PLCDataType.central);
-                        ClearTerminal(termIndex);
-                        //更新停车记录与车辆状态
-                        string updateParkingRecordsSql = "update parkingrecords set parkingRecordsState = 6,realGetTime = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") +
-                            "',parkingPrice = " + fi.fee + ",paymentStatus = " + paymentStatus + " where receiptNum = '" + fi.receiptNum + "';";
-                        List<string> list = new List<string>();
-                        list.Add(updateParkingRecordsSql);
+                                if (Monitor.Monitor.mainBlockInfo.processStopped == 1)
+                                {
+                                    Log.WriteLog(LogType.process, LogFile.INFO, "检测到流程中断");
+                                    break;
+                                }
+                                if (Monitor.Monitor.mainBlockInfo.processCompleted == 1)
+                                {
+                                    while (terminalInfo[termIndex].receiptNum != 0)
+                                    {
+                                        count++;
+                                        if (count == 1)
+                                            Monitor.Monitor.SetNotification("等待凭证号清除", parkMonitor.model.TextColor.Log);
+                                        if (count > 10000)//避免int型数据溢出
+                                            count = 2;
+                                        Thread.Sleep(200);
+                                    }
+                                    int paymentStatus = 0;
+                                    for (int i = 0; i < terminalInfo.Count; i++)
+                                    {
+                                        if (terminalInfo[i].terminalID == Monitor.Monitor.mainBlockInfo.terminalID)
+                                        {
+                                            paymentStatus = terminalInfo[i].paymentStatus;
+                                            break;
+                                        }
+                                    }
+                                    Log.WriteLog(LogType.process, LogFile.INFO, "检测到凭证号已被清除");
+                                    FetchInfo fi = null;
+                                    UpdateAllParkingSpace();
+                                    ClearTerminal(terminalInfo[termIndex].terminalID);
+                                    if (fetchInfoMap.ContainsKey(terminalInfo[termIndex].terminalID))
+                                    {
+                                        fi = fetchInfoMap[terminalInfo[termIndex].terminalID];
+                                    }
+                                    else
+                                    {
+                                        Monitor.Monitor.SetNotification("未查询到该取车终端存在计费操作", parkMonitor.model.TextColor.Error);
+                                        Log.WriteLog(LogType.process, LogFile.ERROR, "终端" + terminalInfo[termIndex].terminalID + "无计费操作");
+                                        return;
+                                    }
+                                    //TerminalStru fetchReset = new TerminalStru
+                                    //{
+                                    //    terminalID = (short)termIndex,
+                                    //    paymentStatus = (short)0,
+                                    //    licVerification = (short)0,
+                                    //    parkingFee = (short)32767,
+                                    //    userType = (short)0
+                                    //};
+                                    //Monitor.Monitor.PLC.WriteToPLC(fetchReset, PLCDataType.central);
 
-                        lock (Monitor.Monitor.localDBOper)
-                        {
-                            Monitor.Monitor.localDBOper.UpdateTransaction(list);
-                            UpdateVehicle(fi.license, 0, fi.parkingRecordsID, false, false, 0);
-                        }
-                        lock (Monitor.Monitor.remoteDBOper)
-                        {
-                            Monitor.Monitor.remoteDBOper.UpdateTransaction(list);
-                            UpdateVehicle(fi.license, 0, fi.remoteParkingRecordsID, false, true, 0);
-                        }
-                        Monitor.Monitor.SetNotification(fi.license + " 取车流程结束",parkMonitor.model.TextColor.Info);
-                        break;
+                                    //更新停车记录与车辆状态
+                                    string updateParkingRecordsSql = "update parkingrecords set parkingRecordsState = 6,realGetTime = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") +
+                                        "',parkingPrice = " + fi.fee + ",paymentStatus = " + paymentStatus + " where receiptNum = '" + fi.receiptNum + "';";
+                                    List<string> list = new List<string>();
+                                    list.Add(updateParkingRecordsSql);
+
+                                    lock (Monitor.Monitor.localDBOper)
+                                    {
+                                        Monitor.Monitor.localDBOper.UpdateTransaction(list);
+                                        UpdateVehicle(fi.license, 0, fi.parkingRecordsID, false, false, 0);
+                                    }
+                                    lock (Monitor.Monitor.remoteDBOper)
+                                    {
+                                        Monitor.Monitor.remoteDBOper.UpdateTransaction(list);
+                                        UpdateVehicle(fi.license, 0, fi.remoteParkingRecordsID, false, true, 0);
+                                    }
+                                    Monitor.Monitor.SetNotification(fi.license + " 取车流程结束", parkMonitor.model.TextColor.Info);
+                                    break;
+                                }
+                                Thread.Sleep(200);
+                            }
+                            termCalcMap[terminalInfo[termIndex].terminalID] = false;
+                            fetchInfoMap.Remove(terminalInfo[termIndex].terminalID);
+                            fetchCompleteMap.Remove(terminalInfo[termIndex].terminalID);
+                        }); 
                     }
-                    Thread.Sleep(300);
                 }
-                termUsedMap[termIndex] = false;
-                fetchMap.Remove(termIndex);
             }
+            catch (Exception ex) { Log.WriteLog(LogType.process, LogFile.ERROR, "取车完成流程异常," + ex.StackTrace); }
         }
 
         /// <summary>

+ 10 - 0
PLCLinker/centralController/WebServer/CentralForWebSocketServer.cs

@@ -255,5 +255,15 @@ namespace centralController.WebServer
         {
             throw new NotImplementedException();
         }
+
+        public void Connect()
+        {
+            throw new NotImplementedException();
+        }
+
+        public bool GetConnectStatus()
+        {
+            throw new NotImplementedException();
+        }
     }
 }

+ 3 - 0
PLCLinker/centralController/WebServer/IWebServer.cs

@@ -18,5 +18,8 @@ namespace centralController.WebServer
 
         bool ReservedCarCheck(string license);
 
+        void Connect();
+
+        bool GetConnectStatus();
     }
 }

+ 136 - 71
PLCLinker/centralController/WebServer/WebServer.cs

@@ -19,6 +19,13 @@ namespace centralController.WebServer
         private Communication comm = null;
         private Thread receiveMsg = null;
         private bool isClosing { get; set; }
+        /// <summary>
+        /// 是否正在调用函数进行连接
+        /// </summary>
+        private bool connecting { get; set; }
+        /// <summary>
+        /// 连接状态
+        /// </summary>
         private bool connected { get; set; }
 
         public void BookFetchRecord()
@@ -179,18 +186,20 @@ namespace centralController.WebServer
         /// <returns></returns>
         private bool ReservationValidate(MessageUTF8 msg)
         {
-            //可预约车位总数
-            int allBookableSpace = Monitor.Monitor.ins.GetFreeSpaceCount(3);
-            int count = 0;
-            DateTime start, end;
-            try
-            {
-                start = DateTime.Parse(msg.bookTime);
-                end = start.AddHours(msg.bookLength);
-            }
-            catch { return false; }
+            int allBookableSpace, count;
             lock (waitToReserveLock)
             {
+                //可预约车位总数
+                allBookableSpace = Monitor.Monitor.ins.GetFreeSpaceCount(3);
+                count = 0;
+                DateTime start, end;
+                try
+                {
+                    start = DateTime.Parse(msg.bookTime);
+                    end = start.AddHours(msg.bookLength);
+                }
+                catch { return false; }
+
                 Queue<MessageUTF8>.Enumerator enumer = waitToReserveQueue.GetEnumerator();
                 while (enumer.MoveNext())
                 {
@@ -204,7 +213,8 @@ namespace centralController.WebServer
                     if (!((tempStart - end).TotalMinutes > 0 || (start - tempEnd).TotalMinutes > 0)) { count += 1; }
                 }
             }
-            if (allBookableSpace >= count)
+            Console.WriteLine(msg.context+":"+allBookableSpace+","+count);
+            if (allBookableSpace > count)
                 return true;
             else
                 return false;
@@ -228,8 +238,10 @@ namespace centralController.WebServer
                             {
                                 //回复预约失败给web
                                 returnMsg.cmd = "FAILED";
+                                returnMsg.garageID = Monitor.Monitor.garageID;
+                                returnMsg.context = msg.context;
                                 comm.SendMessage(returnMsg);
-                                Monitor.Monitor.SetNotification("车辆" + msg.context + "预约停车,已无可预约车位",parkMonitor.model.TextColor.Warning);
+                                Monitor.Monitor.SetNotification("车辆" + msg.context + "预约停车,已无可预约车位", parkMonitor.model.TextColor.Warning);
                             }
                             else
                             {
@@ -241,9 +253,11 @@ namespace centralController.WebServer
                                 ReserveDBOperation(true, msg.sender, true, msg.context, msg.bookTime, msg.bookLength);
                                 ReserveDBOperation(false, msg.sender, true, msg.context, msg.bookTime, msg.bookLength);
                                 //回复成功给web
-                                returnMsg.cmd = "0";
+                                returnMsg.cmd = "OK";
+                                returnMsg.garageID = Monitor.Monitor.garageID;
+                                returnMsg.context = msg.context;
                                 comm.SendMessage(returnMsg);
-                                Monitor.Monitor.SetNotification("车辆" + msg.context + "预约停车,操作成功",parkMonitor.model.TextColor.Log);
+                                Monitor.Monitor.SetNotification("车辆" + msg.context + "预约停车,操作成功", parkMonitor.model.TextColor.Log);
                             }
                         }
                         break;
@@ -261,7 +275,7 @@ namespace centralController.WebServer
                         break;
                     //连接断开消息
                     case "DISCONNECT":
-                        Monitor.Monitor.SetNotification("收到连接断开提示消息",parkMonitor.model.TextColor.Warning);
+                        Monitor.Monitor.SetNotification("收到连接断开提示消息", parkMonitor.model.TextColor.Warning);
                         break;
                     //更新广告
                     case "ADVERT":
@@ -269,15 +283,25 @@ namespace centralController.WebServer
                         bool result = Monitor.Monitor.advertMgr.UpdateAdvert(out adAlert);
                         if (!result)
                         {
-                            Monitor.Monitor.SetNotification("广告更新失败,请尝试手动更新",parkMonitor.model.TextColor.Warning);
+                            Monitor.Monitor.SetNotification("广告更新失败,请尝试手动更新", parkMonitor.model.TextColor.Warning);
                         }
                         else
                         {
-                            Monitor.Monitor.SetNotification("广告更新成功\n" + adAlert,parkMonitor.model.TextColor.Log);
+                            Monitor.Monitor.SetNotification("广告更新成功\n" + adAlert, parkMonitor.model.TextColor.Log);
+                        }
+                        break;
+                    case "RESPONSE":
+                        if (msg.context == "REGSUCCESS")
+                        {
+                            Console.WriteLine("收到web注册指令");
+                        }
+                        else if (msg.context == "HEARTSUCCESS")
+                        {
+                            Console.WriteLine("收到web心跳指令");
                         }
                         break;
                     default:
-                        Monitor.Monitor.SetNotification("接收到无法识别的指令",parkMonitor.model.TextColor.Warning);
+                        Monitor.Monitor.SetNotification("接收到无法识别的指令", parkMonitor.model.TextColor.Warning);
                         break;
                 }
             }
@@ -301,12 +325,12 @@ namespace centralController.WebServer
                         licenseReceived = -1
                     };
                     Monitor.Monitor.PLC.WriteToPLC(mb, PLCDataType.central);
-                    Monitor.Monitor.SetNotification(mb.bookParkCmd + "," + mb.bookFetchCmd + "预约停车指令写入PLC",parkMonitor.model.TextColor.Log);
+                    Monitor.Monitor.SetNotification(mb.bookParkCmd + "," + mb.bookFetchCmd + "预约停车指令写入PLC", parkMonitor.model.TextColor.Log);
                     break;
                 }
                 if (countdown == 2)
                 {
-                    Monitor.Monitor.SetNotification("未能获取预约指令位0状态,尝试手动清除",parkMonitor.model.TextColor.Warning);
+                    Monitor.Monitor.SetNotification("未能获取预约指令位0状态,尝试手动清除", parkMonitor.model.TextColor.Warning);
                     MainBlockStru mb = new MainBlockStru
                     {
                         centralHearbeat = -1,
@@ -345,7 +369,7 @@ namespace centralController.WebServer
                                 if (msg.cmd == "RESERVE")
                                 {
                                     SendBookCmd(true, 1);
-                                    Monitor.Monitor.SetNotification("通知PLC减少可预约车位",parkMonitor.model.TextColor.Log);
+                                    Monitor.Monitor.SetNotification("通知PLC减少可预约车位", parkMonitor.model.TextColor.Log);
                                 }
                                 reservedQueue.Enqueue(msg);
                             }
@@ -370,7 +394,7 @@ namespace centralController.WebServer
                             //预约超时
                             if (ts.TotalMinutes > msg.bookLength * 60)
                             {
-                                Monitor.Monitor.SetNotification(msg.context+" 预约已超时",parkMonitor.model.TextColor.Warning);
+                                Monitor.Monitor.SetNotification(msg.context + " 预约已超时", parkMonitor.model.TextColor.Warning);
                                 //通知PLC将可预约车位数恢复一个
                                 SendBookCmd(true, 2);
                                 //恢复车辆状态
@@ -396,6 +420,7 @@ namespace centralController.WebServer
         public bool Start(int port)
         {
             isClosing = false;
+            connecting = false;
             waitToReserveQueue = new Queue<MessageUTF8>();
             reservedQueue = new Queue<MessageUTF8>();
             //MessageUTF8 message = new MessageUTF8();
@@ -423,54 +448,7 @@ namespace centralController.WebServer
                     }
                     Thread.Sleep(2000);
                 }
-                //持续判断连接状态并重连
-                while (!isClosing)
-                {
-                    if(receiveMsg!=null)
-                        Console.WriteLine(Connections.isAlive() + ", " + receiveMsg.ThreadState.ToString());
-                    if (Connections.isAlive())
-                    {
-                        if (!connected)
-                        {
-                            comm = new Communication();
-                        }
-                        connected = true;
-                        if (receiveMsg!=null && receiveMsg.ThreadState == ThreadState.Aborted)
-                        {
-                            try
-                            {
-                                receiveMsg.Start();
-                            }
-                            catch (Exception ex) { Console.WriteLine(ex.Message); }
-                        }
-                    }
-                    else
-                    {
-                        connected = false;
-                        try
-                        {
-                            if (receiveMsg!=null && receiveMsg.ThreadState == ThreadState.WaitSleepJoin)
-                            {
-                                receiveMsg.Interrupt();
-                            }
-                        }
-                        catch (Exception ex)
-                        {
-                            Monitor.Monitor.SetNotification("连接断开,终止消息接收线程",parkMonitor.model.TextColor.Log);
-                        }
-                        Console.WriteLine(" 连接关闭,需要重新连接注册");
-                        try
-                        {
-                            Connections.close();
-                            Connections.Connection();
-                        }
-                        catch (Exception)
-                        {
-                            Console.WriteLine("服务没有开启,请检查服务器");
-                        }
-                    }
-                    Thread.Sleep(1000);
-                }
+                Connect();
             });
             //持续接收消息
             receiveMsg = new Thread(() =>
@@ -481,7 +459,15 @@ namespace centralController.WebServer
                     {
                         if (connected && comm != null)
                         {
-                            MessageUTF8 msg = ((MessageUTF8)comm.ReceiveMessage());
+                            byte[] bytes = new byte[256];
+                            MessageUTF8 msg = ((MessageUTF8)comm.ReceiveMessage(out bytes));
+                            string str = "";
+                            //for (int i = 0; i < bytes.Length &&bytes[i]!=0x00; i++)
+                            //{
+                            //    str += bytes[i] + " ";
+                            //}
+                            str = Encoding.Default.GetString(bytes);
+                            Console.WriteLine(str);
                             if (msg != null)
                             {
                                 MsgHandling(msg);
@@ -546,5 +532,84 @@ namespace centralController.WebServer
             }
             return false;
         }
+        /// <summary>
+        /// 主动连接web服务器
+        /// </summary>
+        public void Connect()
+        {
+            //持续判断连接状态并重连
+            if (!connecting)
+            {
+                connecting = true;
+                int count = 12;
+                while (!isClosing)
+                {
+                    if (receiveMsg != null)
+                        Console.WriteLine(Connections.isAlive() + ", " + receiveMsg.ThreadState.ToString());
+                    if (Connections.isAlive())
+                    {
+                        if (!connected)
+                        {
+                            comm = new Communication();
+                            Monitor.Monitor.SetNotification("web已连接上", parkMonitor.model.TextColor.Info);
+                        }
+                        connected = true;
+                        if (receiveMsg != null && receiveMsg.ThreadState == ThreadState.Aborted)
+                        {
+                            try
+                            {
+                                receiveMsg.Start();
+                            }
+                            catch (Exception ex) { Console.WriteLine(ex.Message); }
+                        }
+                    }
+                    else
+                    {
+                        if (count == 12 && connected)
+                            Monitor.Monitor.SetNotification("web连接已断开", parkMonitor.model.TextColor.Warning);
+                        else if (count == 0)
+                            break;
+                        connected = false;
+                        count--;
+                        try
+                        {
+                            if (receiveMsg != null && receiveMsg.ThreadState == ThreadState.WaitSleepJoin)
+                            {
+                                receiveMsg.Interrupt();
+                            }
+                        }
+                        catch (Exception ex)
+                        {
+                            Monitor.Monitor.SetNotification("连接断开,终止消息接收线程", parkMonitor.model.TextColor.Log);
+                        }
+                        Console.WriteLine(" 连接关闭,需要重新连接注册");
+                        try
+                        {
+                            Connections.close();
+                            Connections.Connection();
+                        }
+                        catch (Exception)
+                        {
+                            Console.WriteLine("服务没有开启,请检查服务器");
+                        }
+                    }
+                    Thread.Sleep(1000);
+                }
+                Monitor.Monitor.SetNotification("重连web服务器超时,请检查网络并手动连接web服务器", parkMonitor.model.TextColor.Error);
+                connecting = false;
+            }
+            else
+            {
+                Monitor.Monitor.SetNotification("正在尝试连接,请勿重复点击", parkMonitor.model.TextColor.Warning);
+            }
+        }
+        /// <summary>
+        /// 获取连接状态
+        /// </summary>
+        /// <returns></returns>
+        public bool GetConnectStatus()
+        {
+            return connected;
+        }
     }
 }

BIN
PLCLinker/centralController/obj/Release/centralController.csproj.GenerateResource.Cache


BIN
PLCLinker/centralController/sdk/PLC/PLCS7.dll


BIN
PLCLinker/centralController/sdk/dotNetty/nettyCommunication.dll


+ 1 - 1
PLCLinker/centralController/serversettings.json

@@ -1,7 +1,7 @@
 {
 
   "ssl": "false",
-  "host": "192.168.10.121",
+  "host": "192.168.0.121",
   "garageID":"2",
   "port": "9000",
   "size": "1024"

BIN
nettyCommunication.dll


Diff do ficheiro suprimidas por serem muito extensas
+ 4238 - 0
zxpark_cloud_2_1203.sql


+ 454 - 0
zxpark_local1203.sql

@@ -0,0 +1,454 @@
+/*
+Navicat MySQL Data Transfer
+
+Source Server         : 127.0.0.1
+Source Server Version : 50638
+Source Host           : 127.0.0.1:20000
+Source Database       : zxpark_local
+
+Target Server Type    : MYSQL
+Target Server Version : 50638
+File Encoding         : 65001
+
+Date: 2018-12-03 09:56:33
+*/
+
+SET FOREIGN_KEY_CHECKS=0;
+
+-- ----------------------------
+-- Table structure for garageproperties
+-- ----------------------------
+DROP TABLE IF EXISTS `garageproperties`;
+CREATE TABLE `garageproperties` (
+  `garageID` int(8) NOT NULL AUTO_INCREMENT,
+  `paymentSchemeID` int(8) NOT NULL COMMENT '收费策略',
+  `totalBookableSpace` int(4) NOT NULL DEFAULT '0' COMMENT '可预约车位总数',
+  `currentBookableSpace` int(4) NOT NULL DEFAULT '0' COMMENT '当前可预约车位数',
+  `garageCapacity` int(4) NOT NULL DEFAULT '0' COMMENT '车库容量',
+  `garageFreeSpace` int(4) NOT NULL DEFAULT '0' COMMENT '当前剩余车位数',
+  PRIMARY KEY (`garageID`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of garageproperties
+-- ----------------------------
+INSERT INTO `garageproperties` VALUES ('1', '1', '20', '19', '200', '180');
+
+-- ----------------------------
+-- Table structure for manager
+-- ----------------------------
+DROP TABLE IF EXISTS `manager`;
+CREATE TABLE `manager` (
+  `managerID` int(10) NOT NULL AUTO_INCREMENT,
+  `managerPassword` varchar(50) NOT NULL,
+  `managerTel` varchar(11) NOT NULL,
+  `managerName` varchar(50) NOT NULL,
+  `roleID` int(8) NOT NULL,
+  PRIMARY KEY (`managerID`),
+  KEY `manager_ibfk_1` (`roleID`),
+  CONSTRAINT `manager_ibfk_1` FOREIGN KEY (`roleID`) REFERENCES `role` (`roleID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+-- Records of manager
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for monthcardrecords
+-- ----------------------------
+DROP TABLE IF EXISTS `monthcardrecords`;
+CREATE TABLE `monthcardrecords` (
+  `monthCardRecordsID` int(8) NOT NULL AUTO_INCREMENT,
+  `monthCardType` int(1) unsigned zerofill NOT NULL COMMENT '月卡类型,0无,1体验,2月,3季度,4半年,5年',
+  `numberPlate` char(8) NOT NULL COMMENT '车牌号',
+  `garageID` int(4) NOT NULL,
+  `monthCardDetail` varchar(50) DEFAULT NULL,
+  `startTime` varchar(50) NOT NULL,
+  `endTime` varchar(50) NOT NULL,
+  PRIMARY KEY (`monthCardRecordsID`),
+  KEY `monthCardRecords_ibfk_1` (`numberPlate`),
+  KEY `monthCardRecords_ibfk_2` (`garageID`),
+  CONSTRAINT `monthcardrecords_ibfk_1` FOREIGN KEY (`numberPlate`) REFERENCES `vehicle` (`numberPlate`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of monthcardrecords
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for numberplatemapping
+-- ----------------------------
+DROP TABLE IF EXISTS `numberplatemapping`;
+CREATE TABLE `numberplatemapping` (
+  `numberPlateHeader` varchar(5) NOT NULL,
+  `mappedString` char(2) NOT NULL,
+  PRIMARY KEY (`numberPlateHeader`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of numberplatemapping
+-- ----------------------------
+INSERT INTO `numberplatemapping` VALUES ('云', '07');
+INSERT INTO `numberplatemapping` VALUES ('京', '01');
+INSERT INTO `numberplatemapping` VALUES ('使', '32');
+INSERT INTO `numberplatemapping` VALUES ('冀', '05');
+INSERT INTO `numberplatemapping` VALUES ('吉', '23');
+INSERT INTO `numberplatemapping` VALUES ('学', '35');
+INSERT INTO `numberplatemapping` VALUES ('宁', '30');
+INSERT INTO `numberplatemapping` VALUES ('川', '29');
+INSERT INTO `numberplatemapping` VALUES ('挂', '34');
+INSERT INTO `numberplatemapping` VALUES ('新', '13');
+INSERT INTO `numberplatemapping` VALUES ('晋', '21');
+INSERT INTO `numberplatemapping` VALUES ('桂', '18');
+INSERT INTO `numberplatemapping` VALUES ('沪', '03');
+INSERT INTO `numberplatemapping` VALUES ('津', '02');
+INSERT INTO `numberplatemapping` VALUES ('浙', '15');
+INSERT INTO `numberplatemapping` VALUES ('渝', '04');
+INSERT INTO `numberplatemapping` VALUES ('港', '37');
+INSERT INTO `numberplatemapping` VALUES ('湘', '10');
+INSERT INTO `numberplatemapping` VALUES ('澳', '38');
+INSERT INTO `numberplatemapping` VALUES ('琼', '31');
+INSERT INTO `numberplatemapping` VALUES ('甘', '19');
+INSERT INTO `numberplatemapping` VALUES ('皖', '11');
+INSERT INTO `numberplatemapping` VALUES ('粤', '26');
+INSERT INTO `numberplatemapping` VALUES ('苏', '14');
+INSERT INTO `numberplatemapping` VALUES ('蒙', '20');
+INSERT INTO `numberplatemapping` VALUES ('藏', '28');
+INSERT INTO `numberplatemapping` VALUES ('警', '36');
+INSERT INTO `numberplatemapping` VALUES ('豫', '06');
+INSERT INTO `numberplatemapping` VALUES ('贵', '25');
+INSERT INTO `numberplatemapping` VALUES ('赣', '16');
+INSERT INTO `numberplatemapping` VALUES ('辽', '08');
+INSERT INTO `numberplatemapping` VALUES ('鄂', '17');
+INSERT INTO `numberplatemapping` VALUES ('闽', '24');
+INSERT INTO `numberplatemapping` VALUES ('陕', '22');
+INSERT INTO `numberplatemapping` VALUES ('青', '27');
+INSERT INTO `numberplatemapping` VALUES ('领', '33');
+INSERT INTO `numberplatemapping` VALUES ('鲁', '12');
+INSERT INTO `numberplatemapping` VALUES ('黑', '09');
+
+-- ----------------------------
+-- Table structure for orderrecords
+-- ----------------------------
+DROP TABLE IF EXISTS `orderrecords`;
+CREATE TABLE `orderrecords` (
+  `orderRecordsID` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '预约记录id',
+  `userID` int(8) NOT NULL COMMENT '用户id',
+  `numberPlate` char(8) NOT NULL COMMENT '车牌号',
+  `garageID` int(4) NOT NULL,
+  `bookParkTime` varchar(50) DEFAULT NULL COMMENT '预约时间',
+  `cancelBookTime` varchar(50) DEFAULT NULL COMMENT '取消预约时间',
+  `bookFetchTime` varchar(50) DEFAULT NULL,
+  `bookHour` int(2) unsigned DEFAULT NULL COMMENT '预约时长',
+  `bookPrice` int(11) unsigned zerofill DEFAULT NULL COMMENT '价格',
+  `bookState` int(1) unsigned zerofill NOT NULL COMMENT '是否超过预约时间,默认0预停开始,1预停超时,2预取开始,3预取超时,4订单支付完成',
+  PRIMARY KEY (`orderRecordsID`),
+  KEY `orderRecords_ibfk_3` (`garageID`),
+  KEY `orderRecords_ibfk_1` (`userID`),
+  KEY `orderRecords_ibfk_2` (`numberPlate`),
+  CONSTRAINT `orderrecords_ibfk_1` FOREIGN KEY (`numberPlate`) REFERENCES `vehicle` (`numberPlate`)
+) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of orderrecords
+-- ----------------------------
+INSERT INTO `orderrecords` VALUES ('1', '1', '鄂A12345', '1', '2018-11-07 16:21:02', null, null, '1', '00000000003', '4');
+INSERT INTO `orderrecords` VALUES ('2', '8', '苏B56789', '1', '2018-11-14 23:30:22', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('3', '8', '鄂A12345', '1', '2018-11-14 23:36:19', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('4', '8', '苏B56789', '1', '2018-11-15 00:51:07', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('5', '8', '苏B56789', '1', '2018-11-15 01:08:10', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('6', '8', '苏B56789', '1', '2018-11-13 17:42:49', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('7', '8', '鄂A12345', '1', '2018-11-13 17:59:43', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('8', '8', '苏B56789', '1', '2018-11-13 18:14:30', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('9', '8', '苏B56789', '1', '2018-11-13 18:16:21', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('10', '8', '苏B56789', '1', '2018-11-13 18:21:36', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('11', '8', '苏B56789', '1', '2018-11-15 09:15:08', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('12', '8', '鄂A12345', '1', '2018-11-21 08:46:55', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('13', '8', '桂K88888', '1', '2018-11-21 14:00:52', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('14', '8', '桂K88888', '1', '2018-11-23 14:08:14', null, null, '2', null, '0');
+INSERT INTO `orderrecords` VALUES ('15', '8', '桂K88888', '1', '2018-11-23 15:23:22', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('16', '8', '桂K88888', '1', '2018-11-23 16:16:24', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('17', '8', '桂K88888', '1', '2018-11-23 16:19:06', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('18', '8', '桂K88888', '1', '2018-11-23 16:28:13', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('19', '8', '桂K88888', '1', '2018-11-23 16:31:15', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('20', '8', '桂K88888', '1', '2018-11-23 16:40:05', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('21', '8', '桂K88888', '1', '2018-11-23 16:42:51', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('22', '8', '桂K88888', '1', '2018-11-23 16:49:59', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('23', '8', '桂K88888', '1', '2018-11-27 13:51:44', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('24', '8', '苏B56789', '1', '2018-11-27 13:56:21', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('25', '8', '鄂A12345', '1', '2018-11-27 13:57:18', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('30', '8', '鄂A19999', '1', '2018-11-27 14:31:47', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('31', '8', '鄂A19999', '1', '2018-11-27 14:34:30', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('32', '8', '苏B56789', '1', '2018-11-27 14:37:32', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('33', '8', '桂K88888', '1', '2018-11-28 14:56:13', null, null, '2', null, '0');
+INSERT INTO `orderrecords` VALUES ('34', '8', '桂K88888', '1', '2018-11-28 15:52:04', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('35', '8', '桂K88888', '1', '2018-11-28 15:57:23', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('36', '8', '桂K88888', '1', '2018-11-28 15:59:19', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('37', '8', '桂K88888', '1', '2018-11-28 16:05:15', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('38', '8', '桂K88888', '1', '2018-11-28 16:08:34', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('39', '8', '桂K88888', '1', '2018-11-28 17:01:32', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('40', '8', '桂K88888', '1', '2018-11-28 17:16:23', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('41', '8', '桂K88888', '1', '2018-11-28 17:32:59', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('42', '8', '桂K88888', '1', '2018-11-28 18:05:59', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('43', '8', '桂K88888', '1', '2018-11-29 10:28:43', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('44', '8', '桂K88888', '1', '2018-11-29 10:42:13', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('45', '8', '桂K88888', '1', '2018-11-29 11:01:50', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('46', '8', '苏B56789', '1', '2018-11-29 11:43:52', null, null, '3', null, '0');
+INSERT INTO `orderrecords` VALUES ('47', '28', '桂K88888', '1', '2018-11-29 14:31:49', null, null, '1', null, '0');
+INSERT INTO `orderrecords` VALUES ('48', '28', '桂K88888', '1', '2018-11-29 14:55:50', null, null, '1', null, '0');
+INSERT INTO `orderrecords` VALUES ('49', '8', '桂K88888', '1', '2018-12-01 16:04:59', null, null, '3', null, '0');
+
+-- ----------------------------
+-- Table structure for parkingrecords
+-- ----------------------------
+DROP TABLE IF EXISTS `parkingrecords`;
+CREATE TABLE `parkingrecords` (
+  `parkingRecordsID` int(11) NOT NULL AUTO_INCREMENT COMMENT '订单ID',
+  `userID` int(8) NOT NULL COMMENT '用户ID',
+  `numberPlate` char(8) NOT NULL COMMENT '车牌号',
+  `parkingSpaceID` int(4) NOT NULL COMMENT '车位ID',
+  `garageID` int(4) NOT NULL COMMENT '车库ID',
+  `parkingRecordsState` int(11) NOT NULL COMMENT '订单状态',
+  `realParkTime` varchar(50) DEFAULT NULL COMMENT '实际停车时间',
+  `realGetTime` varchar(50) DEFAULT NULL COMMENT '实际取车时间',
+  `receiptNum` int(8) DEFAULT NULL COMMENT '流水号',
+  `parkingPrice` int(11) DEFAULT NULL COMMENT '价格',
+  `paymentStatus` int(4) DEFAULT '0' COMMENT '支付状态',
+  PRIMARY KEY (`parkingRecordsID`),
+  KEY `r_userID` (`userID`) USING BTREE,
+  KEY `r_parkingSpaceID` (`parkingSpaceID`) USING BTREE,
+  KEY `r_garageID` (`garageID`) USING BTREE,
+  KEY `r_numberPlate` (`numberPlate`) USING BTREE,
+  CONSTRAINT `parkingrecords_ibfk_1` FOREIGN KEY (`parkingSpaceID`) REFERENCES `parkingspace` (`parkingSpaceID`),
+  CONSTRAINT `parkingrecords_ibfk_2` FOREIGN KEY (`numberPlate`) REFERENCES `vehicle` (`numberPlate`)
+) ENGINE=InnoDB AUTO_INCREMENT=97 DEFAULT CHARSET=utf8mb4 COMMENT='停车记录表\r\n订单状态 :1表示预约,2表示预约订单被取消,3表示正在停车(车已入库),4表示预约取车,5表示付款没有取车,6表示取车并付款';
+
+-- ----------------------------
+-- Records of parkingrecords
+-- ----------------------------
+INSERT INTO `parkingrecords` VALUES ('2', '1', '鄂A12233', '1', '1', '6', '2018-05-18 10:48:22', '2018-09-21 13:58:44', '11221122', '233', '0');
+INSERT INTO `parkingrecords` VALUES ('5', '1', '苏B56789', '1', '1', '3', '2018-09-26 11:56:23', null, '1622026', null, '0');
+INSERT INTO `parkingrecords` VALUES ('8', '1', '苏B56789', '1', '1', '3', '2018-09-26 12:10:37', null, '1622026', null, '0');
+INSERT INTO `parkingrecords` VALUES ('9', '1', '苏B56789', '1', '1', '3', '2018-09-26 13:44:25', null, '1622026', null, '0');
+INSERT INTO `parkingrecords` VALUES ('10', '1', '苏B56789', '1', '1', '3', '2018-09-26 13:47:00', null, '1622026', null, '0');
+INSERT INTO `parkingrecords` VALUES ('11', '1', '苏B56789', '1', '1', '3', '2018-09-26 14:00:08', null, '1624203', null, '0');
+INSERT INTO `parkingrecords` VALUES ('12', '8', '苏B56789', '1', '1', '3', '2018-09-26 14:58:34', null, '1494417', null, '0');
+INSERT INTO `parkingrecords` VALUES ('13', '8', '苏B56789', '1', '1', '3', '2018-09-26 16:21:05', null, '1345361', null, '0');
+INSERT INTO `parkingrecords` VALUES ('14', '8', '苏B56789', '1', '1', '3', '2018-09-26 16:26:00', null, '1180161', null, '0');
+INSERT INTO `parkingrecords` VALUES ('15', '1', '苏B56789', '1', '1', '6', '2018-09-26 16:29:16', '2018-09-27 10:18:59', '1527193', '40', '0');
+INSERT INTO `parkingrecords` VALUES ('16', '8', '苏B56789', '1', '1', '6', '2018-09-27 10:44:45', '2018-09-27 11:12:34', '1002214', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('17', '8', '苏B56789', '1', '1', '6', '2018-09-27 13:57:59', '2018-09-27 15:02:42', '1472774', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('18', '8', '苏B56789', '1', '1', '6', '2018-09-27 16:17:24', '2018-09-27 16:40:34', '1044488', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('19', '8', '苏B56789', '1', '1', '6', '2018-09-28 09:36:49', '2018-09-28 09:43:40', '1145362', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('20', '8', '苏B56789', '1', '1', '6', '2018-09-28 10:01:09', '2018-09-28 10:17:07', '1732795', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('21', '8', '苏B56789', '1', '1', '3', '2018-09-28 13:44:43', null, '1508983', null, '0');
+INSERT INTO `parkingrecords` VALUES ('22', '8', '桂K88888', '1', '1', '6', '2018-09-30 10:13:48', '2018-09-30 10:50:41', '1313380', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('25', '8', '桂K88888', '1', '1', '3', '2018-09-30 10:59:45', null, '1542033', null, '0');
+INSERT INTO `parkingrecords` VALUES ('26', '8', '桂K88888', '1', '1', '6', '2018-09-30 11:10:01', '2018-09-30 11:11:22', '1789265', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('27', '8', '桂K88888', '1', '1', '6', '2018-09-30 13:54:21', '2018-09-30 13:56:10', '1303863', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('28', '8', '桂K88888', '1', '1', '6', '2018-09-30 14:09:12', '2018-09-30 14:10:11', '1791456', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('29', '8', '桂K88888', '1', '1', '6', '2018-09-30 15:03:59', '2018-09-30 15:04:54', '1363018', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('30', '8', '桂K88888', '1', '1', '6', '2018-09-30 15:15:41', '2018-09-30 15:16:19', '1713154', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('31', '8', '桂K88888', '1', '1', '6', '2018-09-30 15:23:53', '2018-09-30 15:24:34', '1073471', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('32', '8', '桂K88888', '1', '1', '6', '2018-09-30 15:29:57', '2018-09-30 15:30:30', '1787452', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('33', '8', '桂K88888', '1', '1', '6', '2018-09-30 15:40:31', '2018-09-30 15:41:13', '1905061', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('34', '8', '桂K88888', '1', '1', '6', '2018-09-30 16:02:56', '2018-09-30 16:06:32', '1615494', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('35', '1', '桂K88888', '1', '1', '3', '2018-09-30 16:09:23', null, '1195242', null, '0');
+INSERT INTO `parkingrecords` VALUES ('36', '8', '桂K88888', '1', '1', '6', '2018-09-30 17:48:30', '2018-09-30 17:49:34', '1266260', '5', '0');
+INSERT INTO `parkingrecords` VALUES ('37', '8', '苏B56789', '1', '1', '6', '2018-10-18 18:10:04', '2018-10-18 18:12:07', '1112262', '3', '0');
+INSERT INTO `parkingrecords` VALUES ('38', '1', '苏B56789', '1', '1', '3', '2018-10-24 15:23:58', null, '1228329', null, '0');
+INSERT INTO `parkingrecords` VALUES ('39', '1', '桂K88888', '1', '1', '3', '2018-10-26 19:18:14', null, '1742459', null, '0');
+INSERT INTO `parkingrecords` VALUES ('40', '1', '冀E5942Z', '1', '1', '6', '2018-10-29 16:27:45', '2018-10-29 16:59:21', '1203521', '3', '0');
+INSERT INTO `parkingrecords` VALUES ('41', '28', '冀E5942Z', '1', '1', '3', '2018-10-29 17:44:41', null, '0', null, '0');
+INSERT INTO `parkingrecords` VALUES ('42', '28', '冀E5942Z', '1', '1', '6', '2018-10-29 18:03:01', '2018-10-29 18:09:18', '1128960', '3', '0');
+INSERT INTO `parkingrecords` VALUES ('43', '1', '桂K88888', '1', '1', '6', '2018-10-30 09:54:11', '2018-10-30 10:04:06', '1841507', '3', '2');
+INSERT INTO `parkingrecords` VALUES ('44', '1', '桂K88888', '1', '1', '3', '2018-10-30 10:55:06', null, '0', null, '0');
+INSERT INTO `parkingrecords` VALUES ('45', '1', '桂K88888', '1', '1', '6', '2018-10-30 14:28:56', '2018-10-30 14:34:01', '1403530', '3', '2');
+INSERT INTO `parkingrecords` VALUES ('46', '1', '桂K88888', '1', '1', '6', '2018-10-30 15:17:07', '2018-10-30 15:17:34', '1668397', '3', '2');
+INSERT INTO `parkingrecords` VALUES ('47', '1', '桂K88888', '1', '1', '6', '2018-10-30 16:45:56', '2018-12-01 15:45:17', '1809574', '1440', '2');
+INSERT INTO `parkingrecords` VALUES ('48', '28', '桂K88888', '1', '1', '6', '2018-10-30 16:59:00', '2018-10-31 12:15:34', '1424288', '30', '2');
+INSERT INTO `parkingrecords` VALUES ('49', '28', '桂K88888', '1', '1', '6', '2018-10-31 12:22:27', '2018-10-31 14:36:03', '1417303', '9', '0');
+INSERT INTO `parkingrecords` VALUES ('50', '28', '桂K88888', '1', '1', '6', '2018-10-31 15:03:34', '2018-10-31 15:04:30', '1908614', '0', '0');
+INSERT INTO `parkingrecords` VALUES ('51', '28', '桂K888S8', '1', '1', '6', '2018-10-31 16:36:14', '2018-11-02 14:51:49', '1803570', '30', '2');
+INSERT INTO `parkingrecords` VALUES ('52', '28', '桂K88888', '1', '1', '6', '2018-10-31 16:45:57', '2018-10-31 16:48:50', '1403631', '0', '0');
+INSERT INTO `parkingrecords` VALUES ('53', '1', '冀E5942Z', '1', '1', '3', '2018-11-01 12:01:37', null, '0', null, '0');
+INSERT INTO `parkingrecords` VALUES ('54', '1', '冀E5942Z', '1', '1', '6', '2018-11-01 18:22:49', '2018-11-02 14:43:36', '1357863', '30', '0');
+INSERT INTO `parkingrecords` VALUES ('55', '1', '冀E5942Z', '1', '1', '6', '2018-11-02 11:13:44', '2018-11-02 13:53:12', '1542039', '9', '2');
+INSERT INTO `parkingrecords` VALUES ('56', '1', '冀E5942Z', '1', '1', '6', '2018-11-02 13:46:50', '2018-11-02 13:51:40', '1512420', '0', '2');
+INSERT INTO `parkingrecords` VALUES ('57', '1', '冀E5942Z', '1', '1', '6', '2018-11-02 16:28:57', '2018-12-01 15:45:17', '1809574', '1440', '2');
+INSERT INTO `parkingrecords` VALUES ('58', '1', '冀E5942Z', '1', '1', '6', '2018-11-02 17:05:20', '2018-11-02 17:37:32', '1319356', '0', '2');
+INSERT INTO `parkingrecords` VALUES ('59', '1', '桂K88888', '1', '1', '3', '2018-11-02 17:05:38', null, '0', null, '0');
+INSERT INTO `parkingrecords` VALUES ('60', '1', '桂K88888', '1', '1', '3', '2018-11-02 17:17:05', null, '0', null, '0');
+INSERT INTO `parkingrecords` VALUES ('61', '1', '桂K88888', '1', '1', '6', '2018-11-02 17:31:17', '2018-11-02 17:55:24', '1014233', '0', '2');
+INSERT INTO `parkingrecords` VALUES ('62', '1', '冀E5942Z', '1', '1', '6', '2018-11-02 17:33:28', '2018-11-02 17:37:32', '1319356', '0', '2');
+INSERT INTO `parkingrecords` VALUES ('63', '1', '桂K88888', '1', '1', '6', '2018-11-02 17:33:35', '2018-11-02 17:37:54', '1697756', '0', '2');
+INSERT INTO `parkingrecords` VALUES ('64', '1', '桂K88888', '1', '1', '3', '2018-11-06 16:21:23', null, '0', null, '0');
+INSERT INTO `parkingrecords` VALUES ('65', '1', '桂K88888', '1', '1', '6', '2018-11-06 16:38:38', '2018-11-06 16:49:22', '1323758', '0', '2');
+INSERT INTO `parkingrecords` VALUES ('66', '1', '桂K88888', '1', '1', '3', '2018-11-07 16:21:02', null, '1143459', null, '0');
+INSERT INTO `parkingrecords` VALUES ('67', '1', '桂K88888', '1', '1', '6', '2018-11-19 16:44:46', '2018-11-19 16:56:16', '1681655', '0', '2');
+INSERT INTO `parkingrecords` VALUES ('68', '1', '桂K88888', '1', '1', '3', '2018-11-20 17:34:10', null, '1875784', null, '0');
+INSERT INTO `parkingrecords` VALUES ('69', '1', '桂K88888', '1', '1', '6', '2018-11-20 17:57:53', '2018-11-21 18:05:33', '1934622', '45', '2');
+INSERT INTO `parkingrecords` VALUES ('70', '1', '桂K88888', '1', '1', '6', '2018-11-20 18:19:34', '2018-11-22 16:47:29', '1406008', '55', '2');
+INSERT INTO `parkingrecords` VALUES ('71', '1', '桂K88888', '1', '1', '3', '2018-11-21 16:31:34', null, '1855999', null, '0');
+INSERT INTO `parkingrecords` VALUES ('72', '1', '桂K88888', '1', '1', '6', '2018-11-21 16:54:53', '2018-11-22 17:05:35', '1949669', '40', '2');
+INSERT INTO `parkingrecords` VALUES ('73', '1', '桂K88888', '1', '1', '6', '2018-11-21 17:34:32', '2018-11-22 17:16:48', '1460653', '40', '2');
+INSERT INTO `parkingrecords` VALUES ('74', '1', '桂K88888', '1', '1', '6', '2018-11-21 17:42:08', '2018-11-22 17:56:27', '1831761', '45', '2');
+INSERT INTO `parkingrecords` VALUES ('75', '1', '桂K88888', '1', '1', '3', '2018-11-21 17:43:48', null, '1735393', null, '0');
+INSERT INTO `parkingrecords` VALUES ('76', '1', '桂K88888', '1', '1', '3', '2018-11-23 14:24:08', null, '1243846', null, '0');
+INSERT INTO `parkingrecords` VALUES ('77', '1', '桂K88888', '1', '1', '6', '2018-11-28 15:02:29', '2018-11-28 15:46:07', '19904197', '0', '2');
+INSERT INTO `parkingrecords` VALUES ('78', '8', '桂K88888', '1', '1', '6', '2018-11-28 16:36:06', '2018-11-29 09:25:59', '11693929', '45', '2');
+INSERT INTO `parkingrecords` VALUES ('79', '8', '桂K88888', '1', '1', '6', '2018-11-28 17:14:34', '2018-11-29 09:28:05', '13000056', '45', '2');
+INSERT INTO `parkingrecords` VALUES ('80', '8', '桂K88888', '1', '1', '6', '2018-11-28 17:29:54', '2018-11-30 17:26:45', '11353354', '90', '2');
+INSERT INTO `parkingrecords` VALUES ('81', '1', '桂K88888', '1', '1', '6', '2018-11-28 18:03:08', '2018-11-30 17:26:45', '11353354', '90', '2');
+INSERT INTO `parkingrecords` VALUES ('82', '8', '桂K88888', '1', '1', '3', '2018-11-28 18:26:03', null, '13286054', null, '0');
+INSERT INTO `parkingrecords` VALUES ('83', '8', '桂K88888', '1', '1', '3', '2018-11-29 11:05:18', null, '11080629', null, '0');
+INSERT INTO `parkingrecords` VALUES ('84', '8', '桂K88888', '1', '1', '6', '2018-11-29 11:11:55', '2018-11-29 11:29:02', '18217415', '0', '2');
+INSERT INTO `parkingrecords` VALUES ('85', '28', '桂K88888', '1', '1', '3', '2018-11-29 11:33:24', null, '16495655', null, '0');
+INSERT INTO `parkingrecords` VALUES ('86', '28', '桂K88888', '1', '1', '3', '2018-11-29 14:36:16', null, '18009734', null, '0');
+INSERT INTO `parkingrecords` VALUES ('87', '1', '桂K88888', '1', '1', '3', '2018-11-29 14:45:24', null, '11726712', null, '0');
+INSERT INTO `parkingrecords` VALUES ('88', '1', '桂K88888', '1', '1', '3', '2018-11-29 14:47:29', null, '17828365', null, '0');
+INSERT INTO `parkingrecords` VALUES ('89', '1', '桂K88888', '1', '1', '3', '2018-11-29 14:49:02', null, '14255689', null, '0');
+INSERT INTO `parkingrecords` VALUES ('90', '28', '桂K88888', '1', '1', '3', '2018-11-29 14:53:02', null, '19620689', null, '0');
+INSERT INTO `parkingrecords` VALUES ('91', '28', '桂K88888', '1', '1', '3', '2018-11-29 14:58:19', null, '10596443', null, '0');
+INSERT INTO `parkingrecords` VALUES ('92', '1', '桂K88888', '1', '1', '6', '2018-11-30 16:43:12', '2018-11-30 17:23:57', '19137507', '0', '2');
+INSERT INTO `parkingrecords` VALUES ('93', '1', '桂K88888', '1', '1', '3', '2018-11-30 17:08:29', null, '16495655', null, '0');
+INSERT INTO `parkingrecords` VALUES ('94', '1', '桂K88888', '1', '1', '3', '2018-11-30 17:11:20', null, '17211871', null, '0');
+INSERT INTO `parkingrecords` VALUES ('95', '1', '桂K88888', '1', '1', '6', '2018-12-01 15:41:59', '2018-12-01 15:45:17', '1809574', '1440', '2');
+INSERT INTO `parkingrecords` VALUES ('96', '8', '桂K88888', '1', '1', '6', '2018-12-01 16:07:43', '2018-12-01 16:18:09', '10744640', '0', '2');
+
+-- ----------------------------
+-- Table structure for parkingspace
+-- ----------------------------
+DROP TABLE IF EXISTS `parkingspace`;
+CREATE TABLE `parkingspace` (
+  `parkingSpaceID` int(4) NOT NULL AUTO_INCREMENT COMMENT '车位ID',
+  `parkingSpaceName` varchar(8) DEFAULT NULL COMMENT '车位编号',
+  `parkingSpaceX` int(11) NOT NULL COMMENT '车位坐标X',
+  `parkingSpaceY` int(11) NOT NULL COMMENT '车位坐标Y',
+  `parkingSpaceZ` int(11) NOT NULL COMMENT '车位坐标Z',
+  `parkingSpaceState` int(1) NOT NULL COMMENT '车位状态。0空闲,1占用,2已预约',
+  PRIMARY KEY (`parkingSpaceID`)
+) ENGINE=InnoDB AUTO_INCREMENT=5407 DEFAULT CHARSET=utf8mb4 COMMENT='车位信息表\r\n车位状态0表示空闲,1表示占用';
+
+-- ----------------------------
+-- Records of parkingspace
+-- ----------------------------
+INSERT INTO `parkingspace` VALUES ('1', 'a1', '0', '0', '0', '0');
+
+-- ----------------------------
+-- Table structure for paymentscheme
+-- ----------------------------
+DROP TABLE IF EXISTS `paymentscheme`;
+CREATE TABLE `paymentscheme` (
+  `paymentSchemeID` int(8) NOT NULL AUTO_INCREMENT,
+  `schemeType` int(2) unsigned NOT NULL COMMENT '策略类型。1按时,2按天,3按时间段',
+  `freeTime` int(4) NOT NULL COMMENT '单位:分钟',
+  `firstChargeTime` int(4) NOT NULL COMMENT '首段收费时间,单位:分钟',
+  `firstCharge` int(3) NOT NULL COMMENT '首段费用',
+  `chargeInterval` int(4) NOT NULL COMMENT '间隔收费时间,单位:分钟',
+  `intervalCharge` int(3) NOT NULL COMMENT '间隔收费单价',
+  `upperBound` int(5) NOT NULL COMMENT '每日停车收费上限',
+  `eachCharge` int(4) NOT NULL COMMENT '按次收费,每次费用',
+  `overnightCharge` int(3) NOT NULL COMMENT '按次收费,加收过夜费',
+  `startChargeTime` varchar(30) NOT NULL COMMENT '按时间段收费,起始时间',
+  `endChargeTime` varchar(30) NOT NULL COMMENT '按时间段收费,终止时间',
+  `chargeStandard` int(4) NOT NULL COMMENT '按时间段收费,每小时费用',
+  `monthCardCharge` int(4) NOT NULL COMMENT '月卡办理价格',
+  `seasonCardCharge` int(4) NOT NULL COMMENT '季卡办理价格',
+  `halfYearCardCharge` int(4) NOT NULL COMMENT '半年卡办理价格',
+  `yearCardCharge` int(4) NOT NULL COMMENT '年卡办理价格',
+  `bookCharge` int(4) NOT NULL COMMENT '预约小时费用',
+  PRIMARY KEY (`paymentSchemeID`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of paymentscheme
+-- ----------------------------
+INSERT INTO `paymentscheme` VALUES ('1', '1', '1', '1', '3', '1', '3', '45', '25', '15', '8:30:00', '23:30:00', '6', '288', '588', '888', '1288', '4');
+
+-- ----------------------------
+-- Table structure for permission
+-- ----------------------------
+DROP TABLE IF EXISTS `permission`;
+CREATE TABLE `permission` (
+  `permissionID` int(8) NOT NULL AUTO_INCREMENT,
+  `permissionName` varchar(50) NOT NULL,
+  PRIMARY KEY (`permissionID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of permission
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for role
+-- ----------------------------
+DROP TABLE IF EXISTS `role`;
+CREATE TABLE `role` (
+  `roleID` int(8) NOT NULL,
+  `roleName` varchar(30) NOT NULL COMMENT '角色名',
+  PRIMARY KEY (`roleID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of role
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for rolepermissionrelation
+-- ----------------------------
+DROP TABLE IF EXISTS `rolepermissionrelation`;
+CREATE TABLE `rolepermissionrelation` (
+  `roleID` int(8) NOT NULL,
+  `permissionID` int(8) NOT NULL,
+  PRIMARY KEY (`roleID`),
+  KEY `rolePermissionRelation` (`permissionID`),
+  CONSTRAINT `rolepermissionrelation_ibfk_1` FOREIGN KEY (`permissionID`) REFERENCES `permission` (`permissionID`),
+  CONSTRAINT `rolepermissionrelation_ibfk_2` FOREIGN KEY (`roleID`) REFERENCES `role` (`roleID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of rolepermissionrelation
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for vehicle
+-- ----------------------------
+DROP TABLE IF EXISTS `vehicle`;
+CREATE TABLE `vehicle` (
+  `numberPlate` char(8) NOT NULL COMMENT '车牌号',
+  `vehicleTypeID` int(8) DEFAULT '0' COMMENT '车型ID',
+  `vehicleTypeConfirm` int(1) NOT NULL DEFAULT '0' COMMENT '车型确认状态',
+  `vehicleTypeChange` int(1) NOT NULL DEFAULT '5' COMMENT '车型可修改次数',
+  `parkingSpaceID` int(4) DEFAULT NULL COMMENT '车位ID',
+  `garageID` int(4) DEFAULT NULL COMMENT '车库ID',
+  `vehiclepParkState` int(1) NOT NULL DEFAULT '0' COMMENT '车辆停车状态,0未停入,1停入,2停车中,3取车中,4停车预约,5预约取车',
+  `orderRecordsID` int(10) unsigned DEFAULT NULL COMMENT '预约记录id',
+  `parkingRecordsID` int(11) DEFAULT NULL COMMENT '停车记录ID',
+  `frontwheelbase` int(11) NOT NULL DEFAULT '0' COMMENT '前轮轮距',
+  `rearwheelbase` int(11) NOT NULL DEFAULT '0' COMMENT '后轮轮距',
+  `monthCardType` int(1) unsigned zerofill NOT NULL DEFAULT '0' COMMENT '月卡类型,0无,1体验,2月,3季度,4半年,5年',
+  `monthCardTime` varchar(50) DEFAULT NULL COMMENT '月卡到期时间',
+  PRIMARY KEY (`numberPlate`),
+  KEY `vehicleTypeID` (`vehicleTypeID`) USING BTREE,
+  KEY `parkingSpaceID` (`parkingSpaceID`) USING BTREE,
+  KEY `parkingRecordsID` (`parkingRecordsID`) USING BTREE,
+  KEY `v_garageID` (`garageID`) USING BTREE,
+  KEY `vehicle_ibfk_5` (`orderRecordsID`),
+  CONSTRAINT `vehicle_ibfk_1` FOREIGN KEY (`parkingRecordsID`) REFERENCES `parkingrecords` (`parkingRecordsID`),
+  CONSTRAINT `vehicle_ibfk_2` FOREIGN KEY (`parkingSpaceID`) REFERENCES `parkingspace` (`parkingSpaceID`),
+  CONSTRAINT `vehicle_ibfk_5` FOREIGN KEY (`orderRecordsID`) REFERENCES `orderrecords` (`orderRecordsID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='车辆信息表\r\n停车状态:0表示未停车,1表示已停车,2表示用户已经发送停车指令但系统还未处理,3表示用户已经发送取车指令但系统还未处理,4表示用户已经发送预约停车指令,5表示用户已经发送预约取车指令\r\n车型确认状态:0表示未确认,1表示已确认。';
+
+-- ----------------------------
+-- Records of vehicle
+-- ----------------------------
+INSERT INTO `vehicle` VALUES ('冀E5942Z', null, '0', '5', null, null, '0', null, '58', '0', '0', '0', null);
+INSERT INTO `vehicle` VALUES ('桂K88888', null, '0', '5', null, null, '0', '49', '96', '0', '0', '0', null);
+INSERT INTO `vehicle` VALUES ('桂K888S8', null, '0', '5', null, null, '0', null, '51', '0', '0', '0', null);
+INSERT INTO `vehicle` VALUES ('苏B56789', null, '0', '5', null, null, '4', '46', '38', '0', '0', '0', null);
+INSERT INTO `vehicle` VALUES ('鄂A11111', '3', '0', '5', null, null, '0', null, null, '0', '0', '0', '');
+INSERT INTO `vehicle` VALUES ('鄂A12233', null, '0', '5', null, null, '1', null, null, '0', '0', '0', '');
+INSERT INTO `vehicle` VALUES ('鄂A12345', '2', '0', '5', null, null, '4', '25', null, '0', '0', '0', '');
+INSERT INTO `vehicle` VALUES ('鄂A19999', '0', '0', '5', null, null, '4', '31', null, '0', '0', '0', null);
+INSERT INTO `vehicle` VALUES ('鄂A22222', null, '0', '5', null, null, '0', null, null, '0', '0', '0', null);