Browse Source

数据库dll相关调整,激光重测分频控制,提示信息界面显示,指令超时标记改为指令类型e,cmd加ip属性尝试保存截图

yc_t 7 năm trước cách đây
mục cha
commit
d668c15f0e

BIN
modbus_PLC_laser_test/plc本地模拟.mbs


+ 123 - 0
packages/MySql.Data.6.7.9/CHANGES

@@ -0,0 +1,123 @@
+6.7.9
+- Changed handshake process to use bytes instead of encoded strings.
+- Added support for Chinese character set gb18030. (Oracle bug # 21098546).
+- Added support for Json type. (WL # 8132).
+- Added changes for metadata information in generated columns with 5.7 (WL #411)
+
+
+6.7.8
+ - Changed default SSL mode to Preferred in connection string. Now the server connections will be using SSL if server allows it by default but it's possible to override this configuration.
+
+
+6.7.7
+- Fix for Exception "The given key was not present in the dictionary" when using utf16le charset in a query. (MySql #72737, Oracle Bug #19355906)
+- Fix for Memory leak in a loop opening a connection to the database and executing a command (MySql Bug #73122, Oracle Bug #19467233).
+- Fix for Multiple issues caused by trailing and leading white space character in params using MySql Membership Provider (MySql Bug #73411, Oracle Bug #19453313)
+- Fix for bad assumption leads to modify query adding CALL statement to the beginning of the sql query even when CommandType.Text is specified (MySql Bug #72736, Oracle Bug #19325120).
+- Fix for Incorrect query result with Entity Framework 6 (MySql bug #74918, Oracle bug #20129927).
+- Fix for GetTimeZoneOffset to use date and time to calculate timediff (MySQL Bug #74905, Oracle Bug #20065691).
+- Fix for Invalid SQL query when eager loading two nested collections (MySQL Bug #70941, Oracle bug #18049862).
+- Fix for chinese characters used in the connection string when connecting to MySql Server (MySQL Bug #70041, Oracle Bug #18141356).
+
+
+6.7.6
+- Fix for open sockets connections left when connection open fails, the error happens when the client try to get a connection when the max number of connections is reached in the server. (MySql #72025, Oracle Bug #18665388).
+- Fix for Exception of "duplicate entry" in MySqlSessionProvider (MySql Bug #70409, Oracle bug #18657550).
+- Fix for Unable to read geometry column when it has been set with a SRID value. (MySql Bug #71869, Oracle Bug #19137999).
+- Fix for Error when Calling MySqlConnection.GetSchema("PROCEDURES WITH PARAMETERS", ...) (Oracle bug #19285959).
+- Fix for EF provider reports ManifestProviderToken = 5.6 for server 5.7 (Oracle bug #19453814).
+- Fix for Fluent API DbModelBuilder.HasColumnType is ignored in EF6 (Oracle bug #19456229).
+- Fix for Setting a PK GUID identity in Code First in EF6 no longer works in Server 5.7 (Oracle bug #19456452).
+- Non PKs declared as Identity GUID have no GUID autogenerated (Oracle bug #19456415).
+- Disabled installation on-demand in Installer (Oracle Bug #19670596).
+- Fix for Generated SQL requests column that doesn't exist in LINQ to Entities (MySql bug #72004, Oracle bug #19681348).
+- Fix for MySQL Connector/NET generates incorrect SQL for LINQ 'StartsWith' queries (MySql bug #72058, Oracle bug #19680236).
+- Fix for Exception when using IEnumerable.Contains(model.property) in Where predicate (MySql bug #73643, Oracle bug #19690370).
+- Fix for Generated Sql does not contain ORDER BY statement whose is requested by LINQ (MySql bug #73549, Oracle bug #19698010).
+- Fix for Error of "Every derived table must have an alias" in LINQ to Entities when using EF6 + DbFirst + View + Take
+  (MySql Bug #72148, Oracle bug #19356006).
+- Fix for 'the method or operation is not implemented' when using linq with orderby (MySQL Bug #70722, Oracle Bug #19681723).
+
+
+6.7.5
+- Fix for bad query when using LINQ to Entities with a query using Take, OrderBy & Contains in Code First (MySql bug #69751, Oracle bug #17194945).
+- Fix for LINQ to Entities error for bad aliasing in column for expression (MySql bug #69922, Oracle bug #17285548).
+- Installer adds MySql.Data, MySql.Data.Entity, and MySql.Web to machine.config and into GAC (MySQL Bug #69760, Oracle Bug #17601689).
+- Added MySql.Web.dll for .NET Framework 4.5
+- Fix for NullReferenceException when try to save entity with TINYINY or BIGINT as PK (MySql bug #70888, Oracle bug #17866076).
+- Fix for .Net connector does not add auto_increment to bigint columns (MySql Bug #70602, Oracle Bug #17924407).
+- Fix for Entity Framework migration with Foreign Key fails. (MySql Bug #70795, Oracle Bug #17924399).
+- Fix for fields of type TIME(3) don't read milliseconds (MySql bug #70377, Oracle Bug #17923814).
+- Fix for Wrong milliseconds serialization (MySql bug #70686, Oracle Bug #17924388).
+- Fix for Case incorrect on table in SQL queries for MySqlSessionStateStore (MySql bug #69652, Oracle bug #17960855).
+- Fix for rename column operation in Entity Framework migrations (MySQL Bug #71102, Oracle Bug #17959787). 
+- Fix for Entity Framework Inserts broken on tables with unsigned bigint as auto increment (MySql Bug #71242, Oracle Bug #18189217).
+- Fix for code To SQL Generation Broken For Foreign Keys/Indexes On Table Create (MySQL #70079, Oracle Bug #18049272)
+- Fix for DotNet Connector keepalive in milliseconds instead of seconds (MySql Bug #69484, Oracle Bug #17981275).
+- Fix for EF SQL Generator, Union Syntax (Concat operator) is missing required parentheses (may cause semantic changes 
+  when combined with Limit clause (Take operator)) (MySql bug #70828, Oracle bug #18049691).
+- Fix for support for Entity Framework 4.3 Code first Identifiers for Migrations & EF6 (MySql Bug #67285, Oracle bug #16286397).
+- Added threading and custom failover support for Replication & Load balancing (MySQL Bug #69832, Oracle Bug #18112966).
+- Fix for maximumpoolsize and minimumpoolsize as invalid properties in connection string (Oracle Bug #18182246).
+- Fix for 'default table cache age' connection string property, set default value to 60 seconds.
+- Fix for MySqlDataTime.Millisecond to be a value between 0 and 999.
+- Added Microsecond to MySqlDateTime for 6-digit precision support.
+- Renamed MySql.Data.Entity.dll to MySql.Data.Entity.EF5.dll for Entity Framework 5 and .NET Framework 4.5 or above.
+  For EF 5 and .NET Framework 4.0 or below remains the same name.
+
+
+6.7.4
+- Fix for Entity Framework when inserts data having Identity columns (Oracle bug #16494585).
+- Fix for Connector/NET cannot read data from a MySql table using UTF-16/UTF-32 (MySql bug #69169, Oracle bug #16776818).
+- Fix for Malformed query in Entity Framework when eager loading due to multiple projections (MySql bug #67183, Oracle bug #16872852).
+- Fix for database objects with 'dbo' prefix when using automatic migrations in Entity Framework 5.0 (Oracle bug #16909439).
+- Fix for bug IIS application pool reset worker process causes website to crash (Oracle bug #16909237, Mysql Bug #67665).  
+- Fix for bug Error in LINQ to Entities query when using Distinct().Count() (MySql Bug #68513, Oracle bug #16950146).
+- Fix for occasionally return no data when socket connection is slow, interrupted or delayed (MySql bug #69039, Oracle bug #16950212).
+- Fix for ConstraintException when filling a datatable (MySql bug #65065, Oracle bug #16952323).
+- Fix for Data Provider is not found after uninstalling Mysql for visual studio (Oracle bug #16973456).
+- Fix for nested sql generated for LINQ to Entities query with Take and Order by (MySql bug #65723, Oracle bug #16973939).
+
+
+6.7.3
+- Fix for bug in Replication & load balancing (Oracle bug #16762427)
+- Added support for Entity Framework 5.0 when using .net 4.0 (WorkItem #228).
+
+
+6.7.2
+- Fix for Bug "REPAIR" option on connector/net_installer, raise an exception (Oracle Bug #16630567).
+- Fix for Bug Entity Framework 5.0 (.net 4.0) with mysql connector/net 6.7.0 alpha (Oracle Bug #16694050).
+- Added WinRT support.
+- Fix for Incorrect assemblies runtime version installed (Oracle Bug #16725274).
+- Fix for Core assemblies not listed in add reference dialog for .net 4.5 (Oracle Bug #16704115).
+
+
+6.7.1
+- Fix for Bug Assemblies for .net 4.5 are not included in the installation (Oracle Bug #16463655).
+- Fix for Bug Geometry Provider Incompatible Exception (Oracle Bug # 16453250).
+
+
+6.7.0
+- Fix for bug Keyword not supported. Parameter name: AttachDbFilename (Mysql bug #66880, Oracle bug #14733472).
+- Fix for bug "Unable to connect using IPv6 connections" (MySQL bug #67253, Oracle bug #14835718).
+- Added auto-generated values for Guid identity columns (MySql bug #67450, Oracle bug #15834176).
+- Fix for method FirstOrDefault not supported in some LINQ to Entities queries (MySql bug #67377, Oracle bug #15856964). 
+- Fixed missing keywords not working as ids (wihout quoting) in parser: value, status, unknown & some unit tests from Arnaud feedback.
+- Fix for Datetime precision doesn't work with code first or model first. (Oracle bug #15972773).
+- Fix for Support for current_timestamp as default for datetime with ef for server 5.6 (Oracle bug #15935094).
+- Adding support for Geometry type. Unit Tests included. Supporting server 5.1 and further.
+- Added support for new connect attributes feature in server 5.6 (Oracle bug #15935112).
+- Added protocol support for password expiration (Oracle bug #15935104).
+- Added support for password hashing with appropriate strength for server 5.6 (Oracle bug #15935128).
+- Added a more friendly message for error when trying to authenticate with old password.
+- Fix for GetSchema returning MySqlException instead of ArgumentException when passing an invalid collection name
+  (Oracle bug #16271425, MySql bug #67901).
+- Fix for EF 4.3 failing when FK identifiers are too long (MySql bug #67285, Oracle bug #16286397).
+- Fix for race condition on ConnectionStringBuilder when using multiple threads 
+  (MySql bug #68217, Oracle bug #16310698).
+- Fix for Specifying delete cascade in EF migrations does not work (MySql bug #68457, Oracle bug #16398432).
+- Fix for InvalidCastException thrown when executing an stored function (MySql bug #64633, Oracle bug #13864627).
+- Fix for Default Command Timeout not applying for EFMySqlCommand (MySql bug #67171, Oracle bug #14825670).
+- Fix for Cannot use geometry function on new instances created with ef code first (Oracle bug #16446399).
+
+

BIN
packages/MySql.Data.6.7.9/MySql.Data.6.7.9.nupkg


+ 15 - 0
packages/MySql.Data.6.7.9/Readme.txt

@@ -0,0 +1,15 @@
+Connector/Net 6.7  Release Notes
+------------------------------------
+
+Welcome to the release notes for Connector/Net 6.7
+
+What's new in 6.7
+--------------------
+
+- WinRT Connector.
+- Load Balancing client support.
+- Entity Framework 5 support.
+- Memcached client.
+
+
+Be sure and check the documentation for more information on these new features.

+ 9 - 0
packages/MySql.Data.6.7.9/content/app.config.transform

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <system.data>
+    <DbProviderFactories>
+      <remove invariant="MySql.Data.MySqlClient" />
+      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.7.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
+    </DbProviderFactories>
+  </system.data>
+</configuration>

+ 9 - 0
packages/MySql.Data.6.7.9/content/web.config.transform

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <system.data>
+    <DbProviderFactories>
+      <remove invariant="MySql.Data.MySqlClient" />
+      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.7.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
+    </DbProviderFactories>
+  </system.data>
+</configuration>

BIN
packages/MySql.Data.6.7.9/lib/net20-cf/MySql.Data.CF.dll


BIN
packages/MySql.Data.6.7.9/lib/net20/MySql.Data.dll


BIN
packages/MySql.Data.6.7.9/lib/net40/MySql.Data.dll


BIN
packages/MySql.Data.6.7.9/lib/net45/MySql.Data.dll


+ 39 - 34
parkMonitor/App.config

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
   <configSections>
     <section name="Equipments" type="parkMonitor.model.EquipmentsSection,parkMonitor" allowDefinition="Everywhere" />
@@ -8,7 +8,7 @@
   </startup>
   <Equipments>
     <Equipment key="Core" value="parkMonitor.server.CoreThread.CoreThreadTest" />
-    <Equipment key="Monitor" value="parkMonitor.server.MonitorServer"/>
+    <Equipment key="Monitor" value="parkMonitor.server.MonitorServer" />
     <Equipment key="PLC" value="parkMonitor.server.PLCLinker" />
     <Equipment key="Num" value="parkMonitor.server.NumMachineLinker" />
     <Equipment key="Web" value="parkMonitor.server.WebThread.CentralForWeb" />
@@ -16,8 +16,8 @@
   </Equipments>
   <appSettings>
     <!--数据库连接配置文件-->
-    <add key="SqlConnectionStr" value="Data Source=127.0.0.1;port=3306;uid=root;pooling=true;pwd=yct;database=zxpark;CharSet=utf8;Allow Zero Datetime=true;" />
-    <!--<add key="SqlConnectionStr" value="Data Source=13.229.217.199;port=3306;uid=Ubuntu;pooling=true;pwd=12345678;database=zxpark;CharSet=utf8;Allow Zero Datetime=true;" />-->
+    <!--<add key="SqlConnectionStr" value="Data Source=127.0.0.1;port=3306;uid=root;pooling=true;pwd=yct;database=zxpark;CharSet=utf8;Allow Zero Datetime=true;" />-->
+    <add key="SqlConnectionStr" value="Data Source=13.229.217.199;port=3306;uid=Ubuntu1;pooling=true;pwd=12345678;database=zxpark;CharSet=utf8;Allow Zero Datetime=true;" />
     <!--<add key="SqlConnectionStr" value="Data Source=192.168.0.55;port=3306;uid=root;pooling=true;pwd=x5;database=zxpark;CharSet=utf8;Allow Zero Datetime=true;" />-->
     
     <!--日志写入地址配置文件-->
@@ -30,48 +30,48 @@
     <!---->
     <add key="ClientSettingsProvider.ServiceUri" value="" />
     <!--PLC基本配置-->
-    <add key="PLC_ip_address" value="127.0.0.1"/>
-    <add key="PLC_port" value="127.0.0.1"/>
-    <add key="PLC_station" value="127.0.0.1"/>
-    <add key="PLC_start_address" value="127.0.0.1"/>
-    <add key="PLC_address_length" value="127.0.0.1"/>
-    
+    <add key="PLC_ip_address" value="127.0.0.1" />
+    <add key="PLC_port" value="502" />
+    <add key="PLC_station" value="1" />
+    <add key="PLC_start_address" value="0" />
+    <add key="PLC_address_length" value="50" />
+    <add key="PLC_refresh_interval" value="100"/>
     <!--PLC停取车地址配置-->
-    <add key="fetch_completed_address" value="9"/>
-    <add key="park_command_address" value="0"/>
-    <add key="park_completed_address" value="8"/>
-    <add key="laser_countdown" value="100"/>
+    <add key="fetch_completed_address" value="9" />
+    <add key="park_command_address" value="0" />
+    <add key="park_completed_address" value="8" />
+    <add key="laser_countdown" value="100" />
     <!--一号激光设备配置-->
-    <add key="laser1_status_address" value="1"/>
+    <add key="laser1_status_address" value="1" />
     <!--二号激光设备配置-->
-    <add key="laser2_status_address" value=""/>
+    <add key="laser2_status_address" value="" />
     <!--激光重测次数-->
-    <add key="laser_rescan_count" value="3"/>
+    <add key="laser_rescan_count" value="3" />
     
     <!--停取车比例-->
-    <add key="fetch_store_ratio" value="3"/>
+    <add key="fetch_store_ratio" value="3" />
     
     <!--上位机(Web线程)IP地址及配置serverScoket的端口-->
-    <!--<add key ="WebConfig" value="192.168.111.8:9000"/>-->
-    <add key ="WebConfig" value="127.0.0.1:9000"/>
+    <add key="WebConfig" value="192.168.111.8:9000" />
+    <!--<add key ="WebConfig" value="127.0.0.1:9000"/>-->
     <!--PLC总控状态-->
-    <add key="equipmentStatus_address" value="28"/>
+    <add key="equipmentStatus_address" value="28" />
     <!--取车写入PLC-->
-    <add key="fetching_startRobot_address" value="12"/>
-    <add key="parkingSpaceID_address" value="13"/>
-    <add key="parkingSpaceX_address" value="14"/>
-    <add key="parkingSpaceY_address" value="15"/>
-    <add key="parkingSpaceZ_address" value="16"/>
-    <add key="parkingLaserCenterX_address" value="17"/>
+    <add key="fetching_startRobot_address" value="12" />
+    <add key="parkingSpaceID_address" value="13" />
+    <add key="parkingSpaceX_address" value="14" />
+    <add key="parkingSpaceY_address" value="15" />
+    <add key="parkingSpaceZ_address" value="16" />
+    <add key="parkingLaserCenterX_address" value="17" />
     <!--停车启动机械手-->
-    <add key="parking_startRobot_address" value="11"/>
+    <add key="parking_startRobot_address" value="11" />
     <!--车库入口-->
-    <add key="parkingEntX" value="24"/>
-    <add key="parkingEntY" value="25"/>
-    <add key="parkingEntZ" value="26"/>
+    <add key="parkingEntX" value="24" />
+    <add key="parkingEntY" value="25" />
+    <add key="parkingEntZ" value="26" />
     <!--排队时间限制-->
-    <add key="licenseTime" value="30"/>
-    <add key="userTime" value="5"/>
+    <add key="licenseTime" value="1" />
+    <add key="userTime" value="1" />
   </appSettings>
   <system.web>
     <membership defaultProvider="ClientAuthenticationMembershipProvider">
@@ -85,4 +85,9 @@
       </providers>
     </roleManager>
   </system.web>
-</configuration>
+<system.data>
+    <DbProviderFactories>
+      <remove invariant="MySql.Data.MySqlClient" />
+      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.7.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
+    </DbProviderFactories>
+  </system.data></configuration>

+ 32 - 17
parkMonitor/bll/MainBll.cs

@@ -10,18 +10,22 @@ using System.Text;
 using System.Threading.Tasks;
 using MySql.Data.MySqlClient;
 
-namespace parkMonitor.bll {
-	/// <summary>主业务逻辑</summary>
-	public class MainBll {
-		public void init() {
-			//中控状态监控服务
-			PcStatusServer.ins.start();
-			//监控线程
-			//PLCMonitorServer.ins.Start();
-			var monitorThread = EquipmentSimpleFactory.ins.CreateEquipment(EquipmentName.Monitor);
-			if(monitorThread != null) {
-				monitorThread.Start();
-			}
+namespace parkMonitor.bll
+{
+    /// <summary>主业务逻辑</summary>
+    public class MainBll
+    {
+        public void init()
+        {
+            //中控状态监控服务
+            PcStatusServer.ins.start();
+            //监控线程
+            //PLCMonitorServer.ins.Start();
+            var monitorThread = EquipmentSimpleFactory.ins.CreateEquipment(EquipmentName.Monitor);
+            if (monitorThread != null)
+            {
+                monitorThread.Start();
+            }
             //核心线程
             var coreThread = EquipmentSimpleFactory.ins.CreateEquipment(EquipmentName.Core);
             if (coreThread != null)
@@ -35,7 +39,8 @@ namespace parkMonitor.bll {
 
             //数据库测试
             //IDBOperator oper = new Operator();
-            //string sql = "insert into zxpark.vehicle value('京PH33X4','3','','','1','1','','1','','11')";
+            ////string sql = "insert into zxpark.vehicle value('京PH33X4','3','','','1','1','','1','','11')";
+            //string sql = "select * from parkingspace where parkingSpaceState = 0 ";
             //MySqlConnection con = oper.getConn();
             //try
             //{
@@ -46,12 +51,22 @@ namespace parkMonitor.bll {
             //    Console.WriteLine(ex.Message);
             //}
             //MySqlCommand cmd = oper.getComm(sql, con);
-            //oper.getInsert(cmd);
+            //try
+            //{
+            //    MySqlDataReader reader = oper.getResultSet(cmd);
+                
+            //}
+            //catch (Exception) { Console.WriteLine("读不到数据"); }
+            ////oper.getInsert(cmd);
             //con.Close();
 
-            //var dbt = new DBTest();
-            //dbt.TestMethod();
             //DBOperation o = new DBOperation();
+            //List<Parking_Space> l = o.GetParkingSpace();
+            //if (l.Count != 0)
+            //{
+            //    Console.WriteLine("输出:"+l[0].parkingSpaceID);
+            //}
+
             //IEquipments nml = EquipmentSimpleFactory.ins.FindEquipment(EquipmentName.NumMachine);
             //int count = 10;
             //Task.Factory.StartNew(() =>
@@ -100,5 +115,5 @@ namespace parkMonitor.bll {
                 monitorThread.Stop();
             });
         }
-	}
+    }
 }

+ 3 - 0
parkMonitor/entity/AbstractMessage.cs

@@ -241,6 +241,7 @@ namespace parkMonitor.entity
         public int garageID;
         public int parkingRecordsID;
         public string TimeRecord;
+        public string ip;
 
         public Command()
         {
@@ -251,6 +252,7 @@ namespace parkMonitor.entity
             parkingRecordsID = 0;
             TimeRecord = "";
             parkingRecordsID = 0;
+            ip = "";
         }
 
         public object Clone()
@@ -263,6 +265,7 @@ namespace parkMonitor.entity
             cmdClone.parkingRecordsID = parkingRecordsID;
             cmdClone.TimeRecord = TimeRecord;
             cmdClone.parkingRecordsID = parkingRecordsID;
+            cmdClone.ip = ip;
             return cmdClone;
         }
     }

+ 1 - 1
parkMonitor/model/MainModel.cs

@@ -87,7 +87,7 @@ namespace parkMonitor.model {
 		public MainWindow mainWin = null;
 		public MainWinVM mainWinVM { get{ return mainWin.winVM; } }
 
-		public XmlCtl xmlConfig = null;
+		//public XmlCtl xmlConfig = null;
 
 		public PLCConfigMd plcConfigMd = new PLCConfigMd();
 	}

+ 4 - 0
parkMonitor/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="MySql.Data" version="6.7.9" targetFramework="net45" />
+</packages>

+ 2 - 1
parkMonitor/parkMonitor.csproj

@@ -49,7 +49,7 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>sdk\log4net\log4net.dll</HintPath>
     </Reference>
-    <Reference Include="MySql.Data, Version=6.0.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
+    <Reference Include="MySql.Data, Version=6.7.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>sdk\mysql\MySql.Data.dll</HintPath>
     </Reference>
@@ -495,6 +495,7 @@
     <EmbeddedResource Include="view\FormModbus\VideoCfg_Form.resx">
       <DependentUpon>VideoCfg_Form.cs</DependentUpon>
     </EmbeddedResource>
+    <None Include="packages.config" />
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>

BIN
parkMonitor/sdk/mysql/MySql.Data.dll


+ 19 - 19
parkMonitor/server/CoreThread/CoreThreadTest.cs

@@ -118,6 +118,7 @@ namespace parkMonitor.server.CoreThread
                         //设备总控状态
                         if (normalStatus == 1)
                         {
+                            UILogServer.ins.info("设备总状态正常");
                             break;
                         }
                         Thread.Sleep(100);
@@ -142,15 +143,15 @@ namespace parkMonitor.server.CoreThread
                 {
                     foreach (NumberMachineNode node in numMessage.data)
                     {
-                        if(node.status == EnumNumberMachineStatus.Offline)
+                        if (node.status == EnumNumberMachineStatus.Offline)
                         {
                             LogFile logError = LogFile.ERROR;
-                            Log.WriteLog(logError,"ip为 "+node.ip+" 的号牌机 连接中断。");
-                            UILogServer.ins.error("ip为 " + node.ip + " 的号牌机 连接中断。");
+                            Log.WriteLog(logError, "ip为 " + node.ip + " 的号牌机 连接中断。");
+                            UILogServer.ins.info("ip为 " + node.ip + " 的号牌机 连接中断。");
                         }
                     }
                 }
-                
+
                 if (queueCmd.commandType == 'f')
                 {
                     Vehicle vehiclelist = oper.GetVehicle(queueCmd.LicenseNum);
@@ -170,7 +171,7 @@ namespace parkMonitor.server.CoreThread
                     PLC.SetMessage(pm);
                     Console.WriteLine("取车:" + queueCmd.LicenseNum);
                     Log.WriteLog("取车:" + queueCmd.LicenseNum);
-                    UILogServer.ins.error("取车:" + queueCmd.LicenseNum);
+                    UILogServer.ins.info("取车:" + queueCmd.LicenseNum);
                     //等待PLC取车完成信号
                     Task signalFromPLC = Task.Factory.StartNew(() =>
                     {
@@ -201,19 +202,18 @@ namespace parkMonitor.server.CoreThread
                     //更新停车记录表
                     oper.UpdateParkingRecords(6, queueCmd.TimeRecord, queueCmd.parkingRecordsID);
                 }
-
+                if (queueCmd.commandType == 'e')
+                {
+                    int userId = Convert.ToInt32(queueCmd.userID);
+                    //过期用户指令
+                    oper.InsertToMessageQueue(userId, "停车异常,请联系管理员!", 2);
+                    LogFile logFile = LogFile.ERROR_NUMBERPLATE;
+                    Log.WriteLog(logFile, "过期用户指令,车牌号:" + queueCmd.LicenseNum);
+                    UILogServer.ins.error("过期用户指令,车牌号:" + queueCmd.LicenseNum);
+                    continue;
+                }
                 if (queueCmd.commandType == 's')
                 {
-                    if (queueCmd.LicenseNum == "")
-                    {
-                        int userId = Convert.ToInt32(queueCmd.userID);
-                        //过期用户指令
-                        oper.InsertToMessageQueue(userId,"停车异常,请联系管理员!",2);
-                        LogFile logFile = LogFile.ERROR_NUMBERPLATE;
-                        Log.WriteLog(logFile, "过期用户指令");
-                        UILogServer.ins.error("过期用户指令");
-                        continue;
-                    }
                     int status = 1;//停车
                     ParkingMessage pm = new ParkingMessage();
                     pm.status = status;
@@ -294,7 +294,7 @@ namespace parkMonitor.server.CoreThread
                     {
                         while (true)
                         {
-                            Thread.Sleep(2000);
+                            Thread.Sleep(1000);
                             PLCMsg = (PLCMessage)PLC.GetMessage();
                             int storeStatus = Convert.ToInt32(PLCMsg.plcList[park_completed_address].Value);
                             //停车完成信号
@@ -315,7 +315,7 @@ namespace parkMonitor.server.CoreThread
                     int vehicleTypeID = oper.getVehicleTypeID(numberPlate);
                     //判断测量数据是否准确
                     //bool isDataRight = oper.IsDataRight(vehicleTypeLength, vehicleTypeWidth, vehicleTypeHeight, vehicleTypeWheelbase, vehicleTypeID);
-                    
+
                     //正常写入数据库
                     if (userID != 0)
                     {
@@ -333,7 +333,7 @@ namespace parkMonitor.server.CoreThread
                         //插入消息队列表
                         oper.InsertToMessageQueue(userID, "停车成功", 1);
                     }
-                     //异常写入日志文件
+                    //异常写入日志文件
                     else
                     {
                         LogFile logFile = LogFile.ERROR_NUMBERPLATE;

+ 15 - 3
parkMonitor/server/CoreThread/QueuingThread.cs

@@ -9,6 +9,7 @@ using parkMonitor.model;
 using parkMonitor.server;
 using System.Configuration;
 using parkMonitor.tools;
+using parkMonitor.server.uiLogServer;
 
 /*  需要utf8+numNode, 阻塞队列   */
 namespace parkMonitor.server.CoreThread
@@ -37,7 +38,7 @@ namespace parkMonitor.server.CoreThread
                 licenseTime = Int32.Parse(ConfigurationManager.AppSettings.Get("licenseTime"));
                 userTime = Int32.Parse(ConfigurationManager.AppSettings.Get("userTime"));
             }
-            catch (Exception) { fetchStoreRatio = 3; Console.WriteLine("未找到停取车比例参数"); }
+            catch (Exception) { fetchStoreRatio = 3; UILogServer.ins.error("未找到停取车比例与计时参数"); }
         }
 
         private void ReceiveFromWebThread()
@@ -61,6 +62,7 @@ namespace parkMonitor.server.CoreThread
                     cmd.parkingRecordsID = webMsg.parkingRecordsID;
                     cmd.TimeRecord = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                     webMsg = null;
+                    UILogServer.ins.info("收到web指令:"+cmd.commandType+"--"+cmd.LicenseNum);
                 }
                 //input user command
                 if (cmd != null)
@@ -76,6 +78,7 @@ namespace parkMonitor.server.CoreThread
                     else
                     {
                         Console.WriteLine("invalid user command.");
+                        UILogServer.ins.error("无法识别用户指令");
                     }
                 }
                 Thread.Sleep(500);
@@ -103,7 +106,10 @@ namespace parkMonitor.server.CoreThread
                     //Console.WriteLine("指令已扫描时间:" + userTimeSpan.TotalSeconds);
                     if (userTimeSpan.TotalMinutes >= userTime)
                     {
-                        cmd.LicenseNum = "";
+                        UILogServer.ins.error("异常:用户指令已存在时间:" + userTimeSpan.TotalSeconds + "秒 ,强制出队");
+                        //Console.WriteLine("指令已扫描时间:" + userTimeSpan.TotalSeconds);
+                        //cmd.LicenseNum = "";
+                        cmd.commandType = 'e';
                         ValidStoreCmdQueue.Enqueue((Command)cmd.Clone());
                         if (StoreCmdQueue.Count != 0)
                             cmd = StoreCmdQueue.Dequeue();
@@ -131,8 +137,10 @@ namespace parkMonitor.server.CoreThread
                     //Console.WriteLine("号牌已扫描时间:"+ licTimeSpan.TotalSeconds);
                     if (licTimeSpan.TotalMinutes >= licenseTime && license.ip!="")
                     {
-                        license.ip = "";
+                        UILogServer.ins.error("异常:号牌已扫描时间:" + licTimeSpan.TotalSeconds + "秒 ,强制出队");
+                        //Console.WriteLine("号牌已扫描时间:" + licTimeSpan.TotalSeconds);
                         cmd = new Command();
+                        cmd.ip = license.ip;
                         cmd.commandType = 's';
                         cmd.LicenseNum = license.LicenseNum;
                         cmd.userID = "";
@@ -140,6 +148,8 @@ namespace parkMonitor.server.CoreThread
                         cmd.parkingRecordsID = 0;
                         cmd.TimeRecord = license.TimeRecord;
                         ValidStoreCmdQueue.Enqueue((Command)cmd.Clone());
+                        numMachineHandle.SetMessage((AbstractMessage)cmd.Clone());
+                        license.ip = "";
                     }
                 }
 
@@ -149,11 +159,13 @@ namespace parkMonitor.server.CoreThread
                 {
                     cmd = FetchCmdQueue.Dequeue();
                     ExecutableCmdQueue.Enqueue((Command)cmd.Clone());
+                    UILogServer.ins.info("任务:取出号牌为 "+cmd.LicenseNum+" 的车辆,开始排队"); 
                 }
                 if (ValidStoreCmdQueue.Count != 0)
                 {
                     cmd = ValidStoreCmdQueue.Dequeue();
                     ExecutableCmdQueue.Enqueue((Command)cmd.Clone());
+                    UILogServer.ins.info("任务:存入号牌为 " + cmd.LicenseNum + " 的车辆,开始排队");
                 }
                 Thread.Sleep(1000);
             }

+ 65 - 21
parkMonitor/server/NumMachine/NumMachine.cs

@@ -16,6 +16,9 @@ using System.Diagnostics;
 using System.Threading.Tasks;
 using parkMonitor.model;
 using parkMonitor.viewModel.objectTree;
+using parkMonitor.server.uiLogServer;
+using System.Configuration;
+using parkMonitor.LOG;
 
 /*
  * try { 
@@ -52,21 +55,24 @@ namespace parkMonitor.server
     {
         public const int REFRESHINGTIME = 500, FILTERINGNUMBER = 6;
 
-        //通过设备句柄访问pic;链接时add,系统关闭时remove
+        ///<summary>通过设备句柄访问pic;链接时add,系统关闭时remove</summary>
         private Dictionary<int, PictureBox> devPicMap = new Dictionary<int, PictureBox>();
-        //通过名字获取pic对象;创建pic时add,系统关闭remove
+        ///<summary>通过名字获取pic对象;创建pic时add,系统关闭remove</summary>
         private Dictionary<string, PictureBox> picNameMap = new Dictionary<string, PictureBox>();
-        //通过ip获取设备id;产生ip时创建
+        ///<summary>通过ip获取设备id;产生ip时创建</summary>
         private Dictionary<string, int> ipIdMap = new Dictionary<string, int>();
-        //通过ip获取设备句柄;产生句柄时创建
+        ///<summary>通过ip获取设备句柄;产生句柄时创建</summary>
         private Dictionary<string, int> ipHandleMap = new Dictionary<string, int>();
-        //号牌队列
+        ///<summary>号牌队列</summary>
         private Queue<NumberMachineNode> LicBuffer = new Queue<NumberMachineNode>();
-        //计数Map
+        ///<summary>计数Map</summary>
         private Dictionary<string, Dictionary<NumberMachineNode, int>> filterMap = new Dictionary<string, Dictionary<NumberMachineNode, int>>();
-
-        private int filterCount = 0;//筛选计数
-        private bool closing = false;//系统关闭
+        /// <summary></summary>
+        private Dictionary<int, IntPtr> handleImgMap = new Dictionary<int, IntPtr>();
+        /// <summary>筛选计数</summary>
+        private int filterCount = 0;
+        /// <summary>系统关闭</summary>
+        private bool closing = false;
 
         private NumberMachineMessage nmMsg = new NumberMachineMessage();
         VzClientSDK.VZLPRC_FIND_DEVICE_CALLBACK_EX find_DeviceCB = null;
@@ -94,8 +100,6 @@ namespace parkMonitor.server
         public delegate void SetDateTime();////定义时钟委托
         public delegate void Begin_Read();//实时采集 
 
-        private bool timer_Stared = false;
-
         private void FormSiemens_Load(object sender, EventArgs e)
         {
             Thread thread = new Thread(new ThreadStart(DateTimeInfo));
@@ -106,9 +110,8 @@ namespace parkMonitor.server
 
             hwndMain = this.Handle;
             //m_sAppPath = System.IO.Directory.GetCurrentDirectory();
-
-            // outputbox.SelectedIndex = 0;
-
+            //this.ShowInTaskbar = false;
+            //this.Opacity = 0;
 
         }
 
@@ -194,9 +197,13 @@ namespace parkMonitor.server
                     foreach (NumberMachineNode nmn in nmMsg.data)
                     {
                         if (GetStatus(nmn.ip) == 1)
+                        {
                             nmn.status = EnumNumberMachineStatus.Normal;
+                        }
                         else
+                        {
                             nmn.status = EnumNumberMachineStatus.Offline;
+                        }
                     }
                     Thread.Sleep(REFRESHINGTIME);
                 }
@@ -260,7 +267,7 @@ namespace parkMonitor.server
                         // 设置车牌识别结果回调
 
                         m_PlateResultCB = new VzClientSDK.VZLPRC_PLATE_INFO_CALLBACK(OnPlateResult);
-                        VzClientSDK.VzLPRClient_SetPlateInfoCallBack(handle, m_PlateResultCB, IntPtr.Zero, 0);
+                        VzClientSDK.VzLPRClient_SetPlateInfoCallBack(handle, m_PlateResultCB, IntPtr.Zero, 1);
                         VzClientSDK.VzLPRClient_StopRealPlay(handle);
                     }
                 }
@@ -282,7 +289,7 @@ namespace parkMonitor.server
                                 // 设置车牌识别结果回调
                                 //VzClientSDK.VZLPRC_PLATE_INFO_CALLBACK m_PlateResultCB;
                                 m_PlateResultCB = new VzClientSDK.VZLPRC_PLATE_INFO_CALLBACK(OnPlateResult);
-                                VzClientSDK.VzLPRClient_SetPlateInfoCallBack(handle, m_PlateResultCB, IntPtr.Zero, 0);
+                                VzClientSDK.VzLPRClient_SetPlateInfoCallBack(handle, m_PlateResultCB, IntPtr.Zero, 1);
                                 VzClientSDK.VzLPRClient_StopRealPlay(handle);
                                 break;
                             }
@@ -312,8 +319,16 @@ namespace parkMonitor.server
                 VzClientSDK.VZ_LPR_MSG_PLATE_INFO plateInfo = new VzClientSDK.VZ_LPR_MSG_PLATE_INFO();
                 plateInfo.plate = strLicense;
 
-                DateTime now = DateTime.Now;
-                string sTime = string.Format("{0:yyyyMMddHHmmssffff}", now);
+                //加入句柄与图像结构体映射关系
+                if (!handleImgMap.ContainsKey(handle))
+                {
+                    handleImgMap.Add(handle, pImgFull);
+                }
+                else
+                {
+                    handleImgMap.Remove(handle);
+                    handleImgMap.Add(handle, pImgFull);
+                }
 
                 int size = Marshal.SizeOf(plateInfo);
                 IntPtr intptr = Marshal.AllocHGlobal(size);
@@ -385,6 +400,7 @@ namespace parkMonitor.server
                     FilterLic(strIP, (NumberMachineNode)nmn.Clone());
                 }
             }
+
             //新设备,号牌不为空
             if (!found && !(plateInformation.plate == "_无_"))
             {
@@ -438,7 +454,7 @@ namespace parkMonitor.server
                 do
                 {
                     //遍历,筛到号牌则入队
-                    if (enumer.Current.Value >= (int)(filterCount * 0.8) && !LicBuffer.Contains(enumer.Current.Key) && (nmMsg.aModel == null || nmMsg.aModel.LicenseNum!= enumer.Current.Key.LicenseNum) )
+                    if (enumer.Current.Value >= (int)(filterCount * 0.8) && !LicBuffer.Contains(enumer.Current.Key) && (nmMsg.aModel == null || nmMsg.aModel.LicenseNum != enumer.Current.Key.LicenseNum))
                     {
                         LicBuffer.Enqueue((NumberMachineNode)enumer.Current.Key.Clone());
                     }
@@ -537,6 +553,7 @@ namespace parkMonitor.server
             Task.Run(() =>
             {
                 closing = false;
+                
                 try
                 {
                     VzClientSDK.VZLPRClient_StopFindDevice();
@@ -548,6 +565,7 @@ namespace parkMonitor.server
                 {
                     Debug.WriteLine(ex.ToString());
                 }
+               this.Show();
             });
 
             Task.Factory.StartNew(() =>
@@ -576,22 +594,48 @@ namespace parkMonitor.server
             picNameMap.Clear();
             ipIdMap.Clear();
             ipHandleMap.Clear();
+            this.Close();
+            VzClientSDK.VzLPRClient_Cleanup();
         }
 
         //调用时,核心线程需将aModel里ip置为空字符串
         public AbstractMessage GetMessage()
         {
             //buffer不为空且,aModel不存在或其中ip已被修改
-            if (LicBuffer.Count != 0 && (nmMsg.aModel==null || nmMsg.aModel.ip==""))
+            if (LicBuffer.Count != 0 && (nmMsg.aModel == null || nmMsg.aModel.ip == ""))
             {
                 nmMsg.aModel = LicBuffer.Dequeue();
+                UILogServer.ins.info("号牌:" + nmMsg.aModel.LicenseNum + ",准备入队");
             }
             return nmMsg;
         }
 
         public void SetMessage(AbstractMessage message)
         {
-            //it won't do anything
+            //传入异常号牌,根据ip找到handle,并以此获得intPtr 图像结构体,调用VzLPRClient_ImageSaveToJpeg,存下图片
+            if (message.GetType().Equals(typeof(Command)))
+            {
+                Command cmd = (Command)message;
+                if (cmd != null && cmd.ip != "" && ipHandleMap.TryGetValue(cmd.ip, out int handle) && handleImgMap.TryGetValue(handle, out IntPtr pImgFull))
+                //if (cmd != null && cmd.ip != "" && ipHandleMap.TryGetValue(cmd.ip, out int handle) && devPicMap.TryGetValue(handle, out PictureBox pic))
+                {
+                    string strFilePath = ConfigurationManager.AppSettings["LogPath"] + DateTime.Now.ToString("yyyyMMddHHmmssffff");
+                    if (!Directory.Exists(strFilePath))
+                    {
+                        Directory.CreateDirectory(strFilePath);
+                    }
+                    string path = strFilePath + "\\" + cmd.ip + ".jpg";
+                    int temp = VzClientSDK.VzLPRClient_ImageSaveToJpeg(pImgFull, path, 100);
+                    //VzClientSDK.VzLPRClient_GetSnapShootToJpeg2(handle,path,100);
+                    LogFile logFile = LogFile.ERROR_NUMBERPLATE;
+                    Log.WriteLog(logFile, "异常号牌" + cmd.ip + "已拍照保存于 " + strFilePath);
+                    UILogServer.ins.error(temp + "..异常号牌" + cmd.ip + "已拍照保存于 " + strFilePath);
+                }
+                else
+                {
+                    UILogServer.ins.error("参数错误,异常号牌图片未保存");
+                }
+            }
         }
 
     }

+ 2 - 2
parkMonitor/server/NumMachine/NumMachine.designer.cs

@@ -111,7 +111,7 @@
             this.label39.Size = new System.Drawing.Size(0, 17);
             this.label39.TabIndex = 59;
             // 
-            // FormModbus
+            // NumMachineLinker
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@@ -120,7 +120,7 @@
             this.Controls.Add(this.statusStrip1);
             this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
-            this.Name = "NumMachine";
+            this.Name = "NumMachineLinker";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.Text = "Modbus Tcp_PLC_Comm";
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormSiemens_FormClosing);

+ 40 - 14
parkMonitor/server/PLCLinker/PLCLinker.cs

@@ -78,8 +78,9 @@ namespace parkMonitor.server
         private bool laser1_record, laser2_record, laser1_heartbeatTest, laser2_heartbeatTest, laser1_normal, laser2_normal;
         private HashSet<int> laser1_heartbeat = new HashSet<int>();
         private HashSet<int> laser2_heartbeat = new HashSet<int>();
-        private int laser1CountDown, laser2CountDown, laser1_rescan, laser2_rescan;
+        private int laser1CountDown, laser2CountDown, laser1_rescan, laser2_rescan, laser1_frequencyDivision, laser2_frequencyDivision;
         private int laser_rescan_count;
+        private int PLC_refresh_interval;
 
         public PLCLinker()
         {
@@ -102,7 +103,9 @@ namespace parkMonitor.server
                 fetch_completed_address = Int32.Parse(ConfigurationManager.AppSettings.Get("fetch_completed_address"));
                 string laser1 = ConfigurationManager.AppSettings.Get("laser1_status_address");
                 string laser2 = ConfigurationManager.AppSettings.Get("laser2_status_address");
-                laser1_rescan = laser2_rescan = laser_rescan_count;//激光重测次数
+                PLC_refresh_interval = Int32.Parse(ConfigurationManager.AppSettings.Get("PLC_refresh_interval"));
+                laser1_rescan = laser2_rescan = laser_rescan_count;
+                laser1_frequencyDivision = laser2_frequencyDivision = laser_rescan_count * (int)(1000.0 / PLC_refresh_interval);//激光重测次数
                 if (laser1 != "")
                     laser1_status_addr = Int32.Parse(laser1);
                 else
@@ -199,7 +202,7 @@ namespace parkMonitor.server
         {
             try
             {
-                timer = new System.Timers.Timer(Int32.Parse(ConfigurationManager.AppSettings.Get("PLCFreshInterval")));
+                timer = new System.Timers.Timer(PLC_refresh_interval);
             }
             catch (Exception)
             {
@@ -216,9 +219,12 @@ namespace parkMonitor.server
         {
             try
             {
-                //从哪个地址开始,读取长度
-                PLC_Read((ushort)startAddr, (ushort)addrLength);
-                LaserMonitor();
+                if (isConnection)
+                {
+                    //从哪个地址开始,读取长度
+                    PLC_Read((ushort)startAddr, (ushort)addrLength);
+                    LaserMonitor();
+                }
             }
             catch (Exception ex)
             {
@@ -240,6 +246,7 @@ namespace parkMonitor.server
                             while (true)
                             {
                                 Console.WriteLine("尝试重连plc");
+                                UILogServer.ins.error("尝试重连plc");
                                 LinkStart();
                                 Thread.Sleep(10000);
                                 if (isConnection)
@@ -317,23 +324,28 @@ namespace parkMonitor.server
                         {
                             laser.status = value;
                             laser1_record = false;
+                            plcMsg.plcList = JsonHelper.DeserializeJsonToList<PLCNode>(json);
+                            laser1_frequencyDivision--;
                             //启动重测指令
-                            if (laser1_rescan > 0)
+                            if (laser1_frequencyDivision % ((int)(1000.0 / PLC_refresh_interval)) == 0 && laser1_rescan > 0)
                             {
+                                laser1_frequencyDivision = laser_rescan_count * (int)(1000.0 / PLC_refresh_interval);
+                                UILogServer.ins.error("激光1结算异常,重新测量");
                                 laser1_rescan--;
                                 //停车完成置0
                                 SendtoPLC(park_completed_addr.ToString(), "0");
                                 //开始停车归零后置1
                                 SendtoPLC(park_command_addr.ToString(), "0");
-                                Thread.Sleep(100);
                                 SendtoPLC(park_command_addr.ToString(), "1");
                             }
-                            else
+                            else if (laser1_rescan == 0)
                             {
                                 //激光1异常
+                                laser1_rescan = -1;
                                 AsyncCmdServer.ins.send(AsyncCmdType.Laser1CalcException);
-                                laser1_rescan = laser_rescan_count;
+                                //laser1_rescan = laser_rescan_count;
                                 laser1_heartbeatTest = true;
+                                UILogServer.ins.error("激光1结算异常超过重测次数,请检查");
                             }
                         }
 
@@ -351,23 +363,29 @@ namespace parkMonitor.server
                         else
                         {
                             laser2_record = false;
+                            plcMsg.plcList = JsonHelper.DeserializeJsonToList<PLCNode>(json);
+                            //启动重测指令
+                            laser2_frequencyDivision--;
                             //启动重测指令
-                            if (laser2_rescan > 0)
+                            if (laser2_frequencyDivision % ((int)(1000.0 / PLC_refresh_interval)) == 0 && laser2_rescan > 0)
                             {
+                                laser2_frequencyDivision = laser_rescan_count * (int)(1000.0 / PLC_refresh_interval);
+                                UILogServer.ins.error("激光2结算异常,重新测量");
                                 laser2_rescan--;
                                 //停车完成置0
                                 SendtoPLC(park_completed_addr.ToString(), "0");
                                 //开始停车归零后置1
                                 SendtoPLC(park_command_addr.ToString(), "0");
-                                Thread.Sleep(100);
                                 SendtoPLC(park_command_addr.ToString(), "1");
                             }
-                            else
+                            else if (laser2_rescan == 0)
                             {
                                 //激光2异常
+                                laser2_rescan = -1;
                                 AsyncCmdServer.ins.send(AsyncCmdType.Laser2CalcException);
-                                laser2_rescan = laser_rescan_count;
+                                //laser2_rescan = laser_rescan_count;
                                 laser2_heartbeatTest = true;
+                                UILogServer.ins.error("激光2结算异常超过重测次数,请检查");
                             }
                         }
 
@@ -382,12 +400,14 @@ namespace parkMonitor.server
                         laser1_heartbeatTest = false;
                         AsyncCmdServer.ins.send(AsyncCmdType.Laser1SystemException);
                         Console.WriteLine("激光1系统状态异常");
+                        UILogServer.ins.error("激光1系统异常");
                     }
                     else
                     {
                         laser2_heartbeatTest = false;
                         AsyncCmdServer.ins.send(AsyncCmdType.Laser2SystemException);
                         Console.WriteLine("激光2系统状态异常");
+                        UILogServer.ins.error("激光2系统异常");
                     }
                     laser.status = 5;
                 }
@@ -403,6 +423,7 @@ namespace parkMonitor.server
                         Console.WriteLine("已检测到心跳");
                         laser1_normal = true;
                         laser1_heartbeat.Clear();
+                        UILogServer.ins.info("激光1连接正常");
                     }
                     //fail to check laser heartbeat
                     if (laser1CountDown <= 0)
@@ -411,6 +432,7 @@ namespace parkMonitor.server
                         laser1_normal = false;
                         laser.status = -1;
                         Console.WriteLine("心跳检测失败");
+                        UILogServer.ins.error("激光1连接异常");
                     }
                 }
                 else if (laser_id == 2 && laser2_heartbeatTest && laser2CountDown-- > 0 && value != 3 && value != 4)
@@ -424,6 +446,7 @@ namespace parkMonitor.server
                         Console.WriteLine("已检测到心跳");
                         laser2_normal = true;
                         laser2_heartbeat.Clear();
+                        UILogServer.ins.info("激光2连接正常");
                     }
                     //fail to check laser heartbeat
                     if (laser2CountDown <= 0)
@@ -432,6 +455,7 @@ namespace parkMonitor.server
                         laser.status = -1;
                         Console.WriteLine("心跳检测失败");
                         laser2_normal = false;
+                        UILogServer.ins.error("激光2连接异常");
                     }
                 }
             }
@@ -506,10 +530,12 @@ namespace parkMonitor.server
                         SendtoPLC(park_command_addr.ToString(), "0");
                         //Console.WriteLine("流程完成,停车状态复位");
                     }
+                    //Task.Factory.StartNew(()=> {
                     if (laser1_status_addr != -1)
                         LaserStatusChecking(1, addr, value);
                     if (laser2_status_addr != -1)
                         LaserStatusChecking(2, addr, value);
+                    //});
                 }
                 if (laser1_status_addr != -1)
                     LaserRecord(1, ref laser1_normal, ref laser1_record, listForLaser);

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

@@ -136,6 +136,7 @@ namespace PLC_Communication
             {
                 busTcpClient.ConnectClose();
             }
+
         }
 
         /// <summary>