Pārlūkot izejas kodu

中控关闭异常的调整

yc_t 7 gadi atpakaļ
vecāks
revīzija
2cd0bc2c6d

BIN
modbus_PLC_laser_test/plc本地模拟.mbs


+ 1 - 1
modbus_PLC_laser_test/runtest.bat

@@ -1,2 +1,2 @@
-modbus_msvc.exe 192.168.0.1 30000 1 2
+modbus_msvc.exe 127.0.0.1 502 1 2
 pause

BIN
modbus_PLC_laser_test/新plc模拟.mbs


+ 4 - 4
parkMonitor/App.config

@@ -30,7 +30,7 @@
     <add key="ClientSettingsProvider.ServiceUri" value="" />
     <!--PLC基本配置-->
     <!--<add key="PLC_ip_address" value="192.168.0.10" />-->
-    <add key="PLC_ip_address" value="192.168.0.1" />
+    <add key="PLC_ip_address" value="127.0.0.1" />
     <add key="PLC_port" value="30000" />
     <add key="PLC_station" value="1" />
     <add key="PLC_start_address" value="0" />
@@ -67,7 +67,7 @@
     <add key="licenseTime" value="30" />
     <add key="userTime" value="30" />
     <!--上位机(Web线程)IP地址及配置serverScoket的端口-->
-    <add key="WebConfig" value="192.168.0.164:9000" />
+    <add key="WebConfig" value="192.168.111.254:9000" />
     <!--<add key ="WebConfig" value="127.0.0.1:9000"/>-->
 
     <!--车库入口-->
@@ -80,8 +80,8 @@
 
     <!--ip位置映射表-->
     <!--位置编号;基点横坐标;车位宽度;宽度补偿-->
-    <add key="192.168.0.50" value="1" />
-    <add key="192.168.0.51" value="1" />
+    <add key="192.168.0.20" value="1" />
+    <!--<add key="192.168.0.51" value="1" />-->
     <add key="parkingEntZ" value="0" />
     <add key="parkingEntZ" value="0" />
     <add key="parkingEntZ" value="0" />

+ 10 - 2
parkMonitor/manualParking/ManualParking.cs

@@ -32,7 +32,11 @@ namespace parkMonitor.manualParking
             storeCmd.commandType = 's';
             storeCmd.userID = locationOper.GetUserID(tel.Text).ToString();
             storeCmd.LicenseNum = numberPlate.Text;
-            storeCmd.garageID = Convert.ToInt32(selectGarage.Text);
+            try
+            {
+                storeCmd.garageID = Convert.ToInt32(selectGarage.Text);
+            }
+            catch { MessageBox.Show("非法车库号,请重新输入"); return; }
             int garageFreeSpace = 0;
             bool isTelRegister = locationOper.IsTelRegister(tel.Text);
             if (isTelRegister == false)
@@ -69,7 +73,11 @@ namespace parkMonitor.manualParking
             storeCmd.userID = locationOper.GetUserID(tel.Text).ToString();
             storeCmd.LicenseNum = numberPlate.Text;
             storeCmd.TimeRecord = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
-            storeCmd.garageID = Convert.ToInt32(selectGarage.Text);
+            try
+            {
+                storeCmd.garageID = Convert.ToInt32(selectGarage.Text);
+            }
+            catch { MessageBox.Show("非法车库号,请重新输入"); return; }
             bool isTelRegister = locationOper.IsTelRegister(tel.Text);
             bool isNumberPlate = locationOper.IsNumberPlate(storeCmd.LicenseNum, storeCmd.garageID);
             if (isTelRegister == false)

+ 5 - 5
parkMonitor/server/CoreThread/AbstractCmd.cs

@@ -81,7 +81,7 @@ namespace parkMonitor.server.CoreThread
         public void WaitForRobotResource(int robotID)
         {
             PLCMessage PLCMsg = null;
-            while (true)
+            while (!isClosing)
             {
                 lock (robot)
                 {
@@ -183,7 +183,7 @@ namespace parkMonitor.server.CoreThread
             cEntrance.parkingEntY = parkingEntY;
             cEntrance.parkingEntZ = parkingEntZ;
             Parking_Space ppp = new Parking_Space();
-            while (true)
+            while (!isClosing)
             {
                 if (!queueCmd.manual)
                 {
@@ -212,7 +212,7 @@ namespace parkMonitor.server.CoreThread
             bool jumpOut = false;
             PLCMessage PLCMsg = null;
             jumpOut = false;
-            while (true)
+            while (!isClosing)
             {
                 PLCMsg = (PLCMessage)PLC.GetMessage();
                 if (PLCMsg != null)
@@ -268,7 +268,7 @@ namespace parkMonitor.server.CoreThread
         private void WaitForStoreSignal(Command queueCmd, ref int parkingSpaceID, ref bool robotError)
         {
             PLCMessage PLCMsg = null;
-            while (true)
+            while (!isClosing)
             {
                 Thread.Sleep(1000);
                 PLCMsg = (PLCMessage)PLC.GetMessage();
@@ -606,7 +606,7 @@ namespace parkMonitor.server.CoreThread
             //等待PLC取车完成信号
             Task signalFromPLC = Task.Factory.StartNew(() =>
             {
-                while (true)
+                while (!isClosing)
                 {
                     Thread.Sleep(2000);
                     PLCMsg = (PLCMessage)PLC.GetMessage();

+ 5 - 3
parkMonitor/server/CoreThread/CoreThreadTest2.cs

@@ -28,6 +28,7 @@ namespace parkMonitor.server.CoreThread
         DBLocationOperator locationOper;
         DBOperation oper;
         int localGarageId = 0;
+        bool isClosing;
 
         string[] equipNames = new string[] { EquipmentName.PLC, EquipmentName.NumMachine, EquipmentName.Web, EquipmentName.Queue };
 
@@ -90,13 +91,14 @@ namespace parkMonitor.server.CoreThread
                 }
             }
             AbstractCmd.isClosing = true;//停止运行中指令
+            this.isClosing = true;
         }
 
         public void BeginWorking()
         {
             Task.Factory.StartNew(() =>
             {
-                while (true)
+                while (!isClosing)
                 {
                     Func<AbstractMessage> func = new Func<AbstractMessage>(GetExecuteNumberPlate);
 
@@ -164,7 +166,7 @@ namespace parkMonitor.server.CoreThread
         {
             PLCMessage PLCMsg = null;
             int normalStatus = 0;
-            while (true)
+            while (!isClosing)
             {
                 PLCMsg = (PLCMessage)PLC.GetMessage();
                 if (PLCMsg != null && PLCMsg.originalPlcList != null && PLCMsg.originalPlcList.Count != 0)
@@ -186,7 +188,7 @@ namespace parkMonitor.server.CoreThread
         private AbstractMessage GetExecuteNumberPlate()
         {
             AbstractMessage msg = null;
-            while (true)
+            while (!isClosing)
             {
                 msg = queuingThread.GetMessage();
                 if (msg != null)

+ 1 - 1
parkMonitor/server/NumMachine/NumMachine.cs

@@ -115,7 +115,7 @@ namespace parkMonitor.server
         {
             try
             {
-                while (true)
+                while (!isClosing)
                 {
                     SetDateTime setDate = new SetDateTime(
                     delegate

+ 1 - 1
parkMonitor/server/PLCLinker/PLCLinker.cs

@@ -231,7 +231,7 @@ namespace parkMonitor.server
                     {
                         Task.Factory.StartNew(() =>
                         {
-                            while (true)
+                            while (!isClosing)
                             {
                                 Console.WriteLine("尝试重连plc");
                                 UILogServer.ins.log("尝试重连plc");

+ 0 - 1
parkMonitor/view/FormModbus/FormModbus.cs

@@ -131,7 +131,6 @@ namespace PLC_Communication
             {
                 timer.Stop();
             }
-
             if (PLC_connected)
             {
                 busTcpClient.ConnectClose();