Browse Source

2022/6/8 上传楚天管理员界面

wk 3 years ago
parent
commit
bd7c87bf1f
71 changed files with 36617 additions and 1733 deletions
  1. 22 2
      chutian_modules.sln
  2. 2 2
      communicate_module/App.config
  3. 7 1
      communicate_module/Program.cs
  4. 45 2
      communicate_module/communicate_module.csproj
  5. 66 11
      communicate_module/communication/TerminalSimul.cs
  6. 477 0
      communicate_module/db_manager/DBManager.cs
  7. 5 4
      communicate_module/packages.config
  8. 4 4
      parkspace_manager/App.config
  9. 46 0
      parkspace_manager/Arrow.Designer.cs
  10. 532 0
      parkspace_manager/Arrow.cs
  11. 0 0
      parkspace_manager/Arrow.resx
  12. 0 89
      parkspace_manager/Form1.Designer.cs
  13. 0 65
      parkspace_manager/Form1.cs
  14. 1428 0
      parkspace_manager/FormMonitor.Designer.cs
  15. 97 0
      parkspace_manager/FormMonitor.cs
  16. 0 0
      parkspace_manager/FormMonitor.resx
  17. 0 166
      parkspace_manager/FormParkSpaceStatus.Designer.cs
  18. 0 500
      parkspace_manager/FormParkSpaceStatus.cs
  19. 1 1
      parkspace_manager/FormStatusSelect.Designer.cs
  20. 21 5
      parkspace_manager/FormStatusSelect.cs
  21. 47 0
      parkspace_manager/LED.Designer.cs
  22. 471 0
      parkspace_manager/LED.cs
  23. 120 0
      parkspace_manager/LED.resx
  24. 63 0
      parkspace_manager/MainForm.Designer.cs
  25. 84 0
      parkspace_manager/MainForm.cs
  26. 120 0
      parkspace_manager/MainForm.resx
  27. 1 1
      parkspace_manager/Monitor/Monitor.cs
  28. 1811 0
      parkspace_manager/MonitorMainWindows.Designer.cs
  29. 1193 0
      parkspace_manager/MonitorMainWindows.cs
  30. 120 0
      parkspace_manager/MonitorMainWindows.resx
  31. 4 2
      parkspace_manager/Program.cs
  32. 26 34
      parkspace_manager/Properties/Resources.Designer.cs
  33. 13 17
      parkspace_manager/Properties/Settings.Designer.cs
  34. 52 0
      parkspace_manager/StepControl.Designer.cs
  35. 357 0
      parkspace_manager/StepControl.cs
  36. 123 0
      parkspace_manager/StepControl.resx
  37. 52 0
      parkspace_manager/TimedData.cs
  38. 194 0
      parkspace_manager/UIMessageData.cs
  39. 0 433
      parkspace_manager/communication/Communicator.cs
  40. 419 0
      parkspace_manager/communication/communication_socket_base.cs
  41. 435 0
      parkspace_manager/communication/monitor_communication.cs
  42. 1 1
      parkspace_manager/db_manager/DBManager.cs
  43. 1442 0
      parkspace_manager/message/CentralControlMessage.cs
  44. 6781 0
      parkspace_manager/message/DispatchMessage.cs
  45. 4124 0
      parkspace_manager/message/MeasureMessage.cs
  46. 782 100
      parkspace_manager/message/MessageBase.cs
  47. 1259 260
      parkspace_manager/message/ParkspaceAllocationMessage.cs
  48. 6766 0
      parkspace_manager/message/ProcessMessage.cs
  49. 3913 0
      parkspace_manager/message/SinglechipMsg.cs
  50. 1408 0
      parkspace_manager/message/TerminalMessage.cs
  51. 400 0
      parkspace_manager/message/UnNormalizedModuleMessage.cs
  52. 11 0
      parkspace_manager/message/UnNormalized_module_message.proto
  53. 54 0
      parkspace_manager/message/central_control_message.proto
  54. 344 0
      parkspace_manager/message/dispatch_message.proto
  55. 185 0
      parkspace_manager/message/measure_message.proto
  56. 27 7
      parkspace_manager/message/message_base.proto
  57. 23 6
      parkspace_manager/message/parkspace_allocation_message.proto
  58. 156 0
      parkspace_manager/message/process_message.proto
  59. 1 0
      parkspace_manager/message/proto.bat
  60. 211 0
      parkspace_manager/message/singlechip_msg.proto
  61. 39 0
      parkspace_manager/message/terminal_message.proto
  62. 2 1
      parkspace_manager/packages.config
  63. 107 16
      parkspace_manager/parkspace_manager.csproj
  64. 2 2
      parkspace_manager/sdk/dotNetty/Microsoft.Extensions.FileProviders.Abstractions.xml
  65. 1 1
      parkspace_manager/sdk/dotNetty/Microsoft.Extensions.FileProviders.Physical.xml
  66. 0 0
      parkspace_manager/tool/LOG/Credence.cs
  67. 0 0
      parkspace_manager/tool/LOG/LogManager.cs
  68. 0 0
      parkspace_manager/tool/LOG/LogTest.cs
  69. 0 0
      parkspace_manager/tool/LOG/log.cs
  70. 96 0
      parkspace_manager/tool/jsonfileoperation/json_file_operation.cs
  71. 24 0
      parkspace_manager/tool/singleton/singleton.cs

+ 22 - 2
chutian_modules.sln

@@ -1,7 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.27428.2043
+# Visual Studio Version 17
+VisualStudioVersion = 17.1.32319.34
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "parkspace_manager", "parkspace_manager\parkspace_manager.csproj", "{B4FF8229-BC04-4D00-833F-1C250AAF2470}"
 EndProject
@@ -10,17 +10,37 @@ EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
 		Release|Any CPU = Release|Any CPU
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Debug|x64.ActiveCfg = Debug|x64
+		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Debug|x64.Build.0 = Debug|x64
+		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Debug|x86.ActiveCfg = Debug|x86
+		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Debug|x86.Build.0 = Debug|x86
 		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Release|Any CPU.Build.0 = Release|Any CPU
+		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Release|x64.ActiveCfg = Release|x64
+		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Release|x64.Build.0 = Release|x64
+		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Release|x86.ActiveCfg = Release|x86
+		{B4FF8229-BC04-4D00-833F-1C250AAF2470}.Release|x86.Build.0 = Release|x86
 		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Debug|x64.ActiveCfg = Debug|x64
+		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Debug|x64.Build.0 = Debug|x64
+		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Debug|x86.ActiveCfg = Debug|x86
+		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Debug|x86.Build.0 = Debug|x86
 		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Release|Any CPU.Build.0 = Release|Any CPU
+		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Release|x64.ActiveCfg = Release|x64
+		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Release|x64.Build.0 = Release|x64
+		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Release|x86.ActiveCfg = Release|x86
+		{480BEED1-2511-4EF1-A154-5CA2A2465B89}.Release|x86.Build.0 = Release|x86
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 2 - 2
communicate_module/App.config

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
     <startup> 
-        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
     </startup>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@@ -15,4 +15,4 @@
       </dependentAssembly>
     </assemblyBinding>
   </runtime>
-</configuration>
+</configuration>

+ 7 - 1
communicate_module/Program.cs

@@ -4,6 +4,7 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;
 
 namespace communicate_module
@@ -13,9 +14,14 @@ namespace communicate_module
         static void Main(string[] args)
         {
             TerminalSimul.GetInstance().Init();
-            TerminalSimul.GetInstance().Bind("tcp://192.168.2.154:15000");
+            //TerminalSimul.GetInstance().Bind("tcp://192.168.2.159:15000");
             TerminalSimul.GetInstance().Connect("tcp://192.168.2.127:30000");
             TerminalSimul.GetInstance().CreateSimulThread();
+            while(Console.Read() != 'q')
+            {
+                Thread.Sleep(1000*10);
+            }
+            TerminalSimul.GetInstance().Uninit();
         }
     }
 }

+ 45 - 2
communicate_module/communicate_module.csproj

@@ -8,10 +8,11 @@
     <OutputType>Exe</OutputType>
     <RootNamespace>communicate_module</RootNamespace>
     <AssemblyName>communicate_module</AssemblyName>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -32,10 +33,53 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x64\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <LangVersion>7.3</LangVersion>
+    <ErrorReport>prompt</ErrorReport>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+    <OutputPath>bin\x64\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <LangVersion>7.3</LangVersion>
+    <ErrorReport>prompt</ErrorReport>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="Google.Protobuf, Version=3.17.3.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
       <HintPath>..\packages\Google.Protobuf.3.17.3\lib\net45\Google.Protobuf.dll</HintPath>
     </Reference>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
     <Reference Include="NNanomsg, Version=0.5.2.0, Culture=neutral, processorArchitecture=MSIL">
       <HintPath>..\packages\NNanomsg.0.5.2\lib\net40\NNanomsg.dll</HintPath>
     </Reference>
@@ -79,7 +123,6 @@
     <None Include="message\process_message.proto" />
     <None Include="message\terminal_message.proto" />
     <None Include="packages.config" />
-    <None Include="proto.bat" />
     <None Include="x64\libnanomsg.so">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>

+ 66 - 11
communicate_module/communication/TerminalSimul.cs

@@ -16,7 +16,7 @@ namespace communicate_module.communication
         {
             map_lock = new object();
             license_status_map = new Dictionary<string, CAR_STATUS>();
-            for (int i = 0; i < 10; i++)
+            for (int i = 0; i < 11; i++)
             {
                 string str = String.Format("鄂A{0:D5}", i);
                 license_status_map.Add(str, CAR_STATUS.eCAR_IDEL);
@@ -100,15 +100,70 @@ namespace communicate_module.communication
             if (msgStamped == null || msgStamped.header==null)
                 return false;
 
+            //Console.WriteLine("接收消息:"+msgStamped.header.ToString());
             switch(msgStamped.header.MsgType)
             {
                 case Message_type.EStoreCommandResponseMsg:
                     Store_command_response_msg store_Command_Response_Msg = Store_command_response_msg.Parser.ParseFrom(msgStamped.msg);
-                    Console.WriteLine("停车终端 " + store_Command_Response_Msg.TerminalId + " 签收, " + (store_Command_Response_Msg.Code.ErrorCode == 0?"成功":"失败"));
+                    lock (map_lock)
+                    {
+                        if (park_license_map.ContainsKey(store_Command_Response_Msg.TerminalId))
+                        {
+                            string park_lic = park_license_map[store_Command_Response_Msg.TerminalId];
+                            // 失败不将车辆复位,由状态消息复位
+                            if (store_Command_Response_Msg.Code.ErrorCode != 0)
+                            {
+                                if (license_status_map.ContainsKey(park_lic))
+                                {
+                                    //license_status_map[park_lic] = CAR_STATUS.eCAR_IDEL;
+                                    Console.WriteLine(store_Command_Response_Msg.TerminalId + "停车签收失败已将" + park_lic + "置为空闲");
+                                }
+                                else
+                                {
+                                    Console.WriteLine(store_Command_Response_Msg.TerminalId + "!!!!!停车签收未找到终端对应号牌车辆状态");
+                                }
+                            }
+                            else
+                            {
+                                Console.WriteLine("停车终端 " + store_Command_Response_Msg.TerminalId + " 签收! 号牌 "+ park_lic);
+                            }
+                        }
+                        else
+                        {
+                            Console.WriteLine(store_Command_Response_Msg.TerminalId + "!!!!!停车签收未找到终端对应号牌");
+                        }
+                    }
                     break;
                 case Message_type.EPickupCommandResponseMsg:
                     Pickup_command_response_msg pickup_Command_Response_Msg = Pickup_command_response_msg.Parser.ParseFrom(msgStamped.msg);
-                    Console.WriteLine("取车终端 " + pickup_Command_Response_Msg.TerminalId + " 签收, " + (pickup_Command_Response_Msg.Code.ErrorCode == 0 ? "成功" : "失败"));
+                    lock (map_lock)
+                    {
+                        if (fetch_license_map.ContainsKey(pickup_Command_Response_Msg.TerminalId))
+                        {
+                            string fetch_lic = fetch_license_map[pickup_Command_Response_Msg.TerminalId];
+                            // 失败不将车辆复位,由状态消息复位
+                            if (pickup_Command_Response_Msg.Code.ErrorCode != 0)
+                            {
+                                if (license_status_map.ContainsKey(fetch_lic))
+                                {
+                                    //license_status_map[fetch_lic] = CAR_STATUS.eCAR_PARKED;
+                                    Console.WriteLine(pickup_Command_Response_Msg.TerminalId + "取车签收失败已将" + fetch_lic + "置为占用");
+                                }
+                                else
+                                {
+                                    Console.WriteLine(pickup_Command_Response_Msg.TerminalId + "!!!!!取车签收未找到终端对应号牌车辆状态");
+                                }
+                            }
+                            else
+                            {
+                                Console.WriteLine("取车终端 " + pickup_Command_Response_Msg.TerminalId + " 签收! 号牌 " + fetch_lic);
+                            }
+                        }
+                        else
+                        {
+                            Console.WriteLine(pickup_Command_Response_Msg.TerminalId + "!!!!!取车签收未找到终端对应号牌");
+                        }
+                    }
                     break;
                 case Message_type.EStoringProcessStatuMsg:
                     Storing_process_statu_msg storing_Process_Statu_Msg = Storing_process_statu_msg.Parser.ParseFrom(msgStamped.msg);
@@ -120,7 +175,7 @@ namespace communicate_module.communication
                             if (park_license_map.ContainsKey(storing_Process_Statu_Msg.TerminalId))
                             {
                                 string lic = park_license_map[storing_Process_Statu_Msg.TerminalId];
-                                if (license_status_map.ContainsKey(lic))
+                                if (license_status_map.ContainsKey(lic) && lic == storing_Process_Statu_Msg.License)
                                 {
                                     string whether_success = "";
                                     if (forward)
@@ -138,7 +193,7 @@ namespace communicate_module.communication
                                     park_license_map.Remove(storing_Process_Statu_Msg.TerminalId);
                                     // 停车终端复位
                                     park_terminal_status_map[storing_Process_Statu_Msg.TerminalId] = 0;
-                                    Console.WriteLine("停车 " + lic + " 完成, " + whether_success);
+                                    Console.WriteLine(storing_Process_Statu_Msg.TerminalId+"停车 " + lic + " 完成, " + whether_success);
                                 }
                             }
                             else
@@ -158,7 +213,7 @@ namespace communicate_module.communication
                             if (fetch_license_map.ContainsKey(picking_Process_Statu_Msg.TerminalId))
                             {
                                 string lic = fetch_license_map[picking_Process_Statu_Msg.TerminalId];
-                                if (license_status_map.ContainsKey(lic))
+                                if (license_status_map.ContainsKey(lic) && lic == picking_Process_Statu_Msg.License)
                                 {
                                     string whether_success = "";
                                     if (forward)
@@ -173,7 +228,7 @@ namespace communicate_module.communication
                                     }
                                     fetch_license_map.Remove(picking_Process_Statu_Msg.TerminalId);
                                     fetch_terminal_status_map[picking_Process_Statu_Msg.TerminalId] = 0;
-                                    Console.WriteLine("取车 " + lic + " 完成, " + whether_success);
+                                    Console.WriteLine(picking_Process_Statu_Msg.TerminalId+"取车 " + lic + " 完成, " + whether_success);
                                 }
                             }
                             else
@@ -240,11 +295,11 @@ namespace communicate_module.communication
                                         t_store_req.LocateInformation.LocateFrontTheta = 0f;
                                         t_store_req.CarInfo = new Car_info();
                                         t_store_req.CarInfo.License = park_lic;
-                                        t_store_req.CarInfo.CarHeight = 1.7f;
+                                        t_store_req.CarInfo.CarHeight = 1.8f+(float)(rnd.NextDouble()-0.5)*0.6f;
                                         t_store_req.CarInfo.CarWheelWidth = t_store_req.LocateInformation.LocateWheelWidth;
                                         t_store_req.CarInfo.CarWheelBase = t_store_req.LocateInformation.LocateWheelBase;
                                         // 发送停车指令
-                                        Console.WriteLine("停车 "+park_lic);
+                                        Console.WriteLine(termId+"停车指令 " +park_lic);
                                         Send_msg(t_store_req.ToByteString());
                                         license_status_map[park_lic] = CAR_STATUS.eCAR_PARKING;
                                         park_license_map.Add(termId, park_lic);
@@ -281,7 +336,7 @@ namespace communicate_module.communication
                                         pick_req.CarInfo = new Car_info();
                                         pick_req.CarInfo.License = fetch_lic;
                                         // 发送取车指令
-                                        Console.WriteLine("取车 " + fetch_lic);
+                                        Console.WriteLine(termId+"取车指令 " + fetch_lic);
                                         Send_msg(pick_req.ToByteString());
                                         license_status_map[fetch_lic] = CAR_STATUS.eCAR_FETCHING;
                                         fetch_license_map.Add(termId, fetch_lic);
@@ -294,7 +349,7 @@ namespace communicate_module.communication
                         }
                         
                     }
-                    Thread.Sleep(2000);
+                    Thread.Sleep(1000);
                 }
             });
         }

+ 477 - 0
communicate_module/db_manager/DBManager.cs

@@ -0,0 +1,477 @@
+using db;
+using MySql.Data.MySqlClient;
+using parkMonitor.LOG;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace parkspace_manager
+{
+    class DBManager
+    {
+        /// <summary>
+        /// 远程数据库操作句柄
+        /// </summary>
+        public static DBOperation remoteDBOper;
+        /// <summary>
+        /// 本地数据库操作句柄
+        /// </summary>
+        public static DBOperation localDBOper;
+
+        public DBManager()
+        {
+
+        }
+        ~DBManager()
+        {
+
+        }
+        ///// <summary>
+        ///// 返回停车记录信息
+        ///// </summary>
+        ///// <returns></returns>
+        //public static List<object[]> GetParkingRecords(string license = "", string startTime = "", string endTime = "")
+        //{
+        //    DateTime now = DateTime.Now;
+        //    List<object[]> result = new List<object[]>();
+        //    string getParkingRecordsSql = "";
+        //    if (startTime == "" || endTime == "")
+        //    {
+        //        DateTime yesterday = DateTime.Now - (new TimeSpan(1, 0, 0, 0));
+        //        DateTime twoDaysAgo = DateTime.Now - (new TimeSpan(2, 0, 0, 0));
+        //        getParkingRecordsSql = "select parkingRecordsID,userID,numberPlate,parkingSpaceID,realParkTime,realGetTime,receiptNum,parkingPrice,paymentStatus " +
+        //        "from parkingrecords where numberPlate " + (license == "" ? "like '%" : "= '" + license) + "' and (realParkTime like '" + now.ToString("yyyy-MM-dd") + "%' or realParkTime like '" + yesterday.ToString("yyyy-MM-dd") + "%' or realParkTime like '" + twoDaysAgo.ToString("yyyy-MM-dd") + "%');";
+        //    }
+        //    else
+        //    {
+        //        getParkingRecordsSql = "select parkingRecordsID,userID,numberPlate,parkingSpaceID,realParkTime,realGetTime,receiptNum,parkingPrice,paymentStatus " +
+        //        "from parkingrecords where numberPlate " + (license == "" ? "like '%" : "= '" + license) + "' and realParkTime >= '" + startTime + "' and realParkTime <= '" + endTime + "';";
+        //    }
+        //    if (localDBOper != null)
+        //    {
+        //        lock (localDBOper)
+        //        {
+        //            MySqlDataReader reader = localDBOper.Query(getParkingRecordsSql);
+        //            try
+        //            {
+        //                while (reader != null && reader.Read())
+        //                {
+        //                    if (reader.HasRows)
+        //                    {
+        //                        object[] temp = new object[reader.FieldCount];
+        //                        reader.GetValues(temp);
+        //                        result.Add(temp);
+        //                    }
+        //                }
+        //            }
+        //            catch (Exception e) { Console.WriteLine(e.Message); }
+        //            try
+        //            {
+        //                if (reader != null)
+        //                {
+        //                    reader.Close();
+        //                    reader.Dispose();
+        //                }
+        //            }
+        //            catch (Exception e) { Console.WriteLine(e.Message); }
+        //        }
+        //    }
+        //    result.Reverse();
+        //    return result;
+        //}
+        ///// <summary>
+        ///// 返回预约记录信息
+        ///// </summary>
+        ///// <returns></returns>
+        //public static List<object[]> GetOrderRecords(bool localDB, string license = "", string startTime = "", string endTime = "")
+        //{
+        //    DateTime now = DateTime.Now;
+        //    List<object[]> result = new List<object[]>();
+        //    string getOrderRecordsSql = "";
+        //    if (startTime == "" || endTime == "")
+        //    {
+        //        DateTime yesterday = DateTime.Now - (new TimeSpan(1, 0, 0, 0));
+        //        DateTime twoDaysAgo = DateTime.Now - (new TimeSpan(2, 0, 0, 0));
+        //        getOrderRecordsSql = "select orderRecordsID,userID,numberPlate,bookParkTime,cancelBookTime,bookFetchTime,bookHour,bookPrice,bookState " +
+        //        "from orderrecords where numberPlate " + (license == "" ? "like '%" : "= '" + license) + "' and (bookParkTime like '" + now.ToString("yyyy-MM-dd") +
+        //        "%' or bookParkTime like '" + yesterday.ToString("yyyy-MM-dd") + "%' or bookFetchTime like '" + now.ToString("yyyy-MM-dd") + "%' or bookFetchTime like '" + yesterday.ToString("yyyy-MM-dd") + "%');";
+        //    }
+        //    else
+        //    {
+        //        getOrderRecordsSql = "select orderRecordsID,userID,numberPlate,bookParkTime,cancelBookTime,bookFetchTime,bookHour,bookPrice,bookState " +
+        //        "from orderrecords where numberPlate " + (license == "" ? "like '%" : "= '" + license) + "' and ((bookParkTime >= '" + startTime + "' and bookParkTime <= '" + endTime + "') or (bookFetchTime >= '" + startTime + "' and bookFetchTime <= '" + endTime + "'));";
+        //    }
+        //    if (localDBOper != null)
+        //    {
+        //        lock (localDBOper)
+        //        {
+        //            MySqlDataReader reader;
+        //            if (localDB)
+        //                reader = localDBOper.Query(getOrderRecordsSql);
+        //            else
+        //                reader = remoteDBOper.Query(getOrderRecordsSql);
+        //            try
+        //            {
+        //                while (reader != null && reader.Read())
+        //                {
+        //                    if (reader.HasRows)
+        //                    {
+        //                        object[] temp = new object[reader.FieldCount];
+        //                        reader.GetValues(temp);
+        //                        result.Add(temp);
+        //                    }
+        //                }
+        //            }
+        //            catch (Exception e) { Console.WriteLine(e.Message); }
+        //            try
+        //            {
+        //                if (reader != null)
+        //                {
+        //                    reader.Close();
+        //                    reader.Dispose();
+        //                }
+        //            }
+        //            catch (Exception e) { Console.WriteLine(e.Message); }
+        //        }
+        //    }
+        //    result.Reverse();
+        //    return result;
+        //}
+        ///// <summary>
+        ///// 更新停车记录关于支付的信息
+        ///// </summary>
+        ///// <param name="license"></param>
+        ///// <param name="receiptNum"></param>
+        ///// <param name="parkingFee"></param>
+        ///// <param name="paymentStatus"></param>
+        ///// <returns></returns>
+        //public static bool UpdateParkingRecords(string license, string receiptNum, string parkingFee, string paymentStatus, bool local)
+        //{
+        //    bool result = false;
+        //    string updateRecordsSql = "update parkingrecords set parkingPrice = " + parkingFee + " ,paymentStatus = " + paymentStatus + " where numberPlate = '" + license + "' and receiptNum = " + receiptNum + ";";
+        //    List<string> updateList = new List<string>();
+        //    updateList.Add(updateRecordsSql);
+        //    if (local && localDBOper != null)
+        //    {
+        //        lock (localDBOper)
+        //        {
+        //            try
+        //            {
+        //                result = localDBOper.UpdateTransaction(updateList);
+        //            }
+        //            catch { Log.WriteLog(LogType.database, "更新本地停车记录中支付信息出现异常。\n" + updateRecordsSql); return false; }
+        //        }
+        //    }
+        //    else if (!local && remoteDBOper != null)
+        //    {
+        //        lock (remoteDBOper)
+        //        {
+        //            try
+        //            {
+        //                result = remoteDBOper.UpdateTransaction(updateList);
+        //            }
+        //            catch { Log.WriteLog(LogType.database, "更新云端记录中支付信息出现异常。\n" + updateRecordsSql); return false; }
+        //        }
+        //    }
+        //    return result;
+        //}
+        ///// <summary>
+        ///// 更新所有车位信息
+        ///// </summary>
+        //private static void UpdateAllParkingSpace(bool remote)
+        //{
+        //    string findParkingSpace = "select parkingSpaceID from parkingspace;";
+        //    HashSet<int> recordsIDSet = new HashSet<int>();
+        //    DBOperation dbHandle = null;
+        //    if (!remote)
+        //    {
+        //        dbHandle = localDBOper;
+        //    }
+        //    else
+        //    {
+        //        dbHandle = remoteDBOper;
+        //    }
+        //    lock (dbHandle)
+        //    {
+        //        MySqlDataReader reader = dbHandle.Query(findParkingSpace);
+        //        if (reader != null)
+        //        {
+        //            try
+        //            {
+        //                while (reader.Read())
+        //                {
+        //                    if (reader.HasRows)
+        //                    {
+        //                        recordsIDSet.Add(reader.GetInt32("parkingSpaceID"));
+        //                    }
+        //                }
+        //            }
+        //            catch { Log.WriteLog(LogType.process, LogFile.INFO, "数据库车位查询异常"); }
+        //            try
+        //            {
+        //                reader.Close();
+        //                reader.Dispose();
+        //            }
+        //            catch { }
+        //        }
+        //    }
+        //    List<string> updateSpaceList = new List<string>();
+        //    List<string> insertSpaceList = new List<string>();
+        //    string updateParkingSpace = "";
+        //    string insertParkingSpace = "";
+        //    for (int i = 0; i < parkingSpaceInfo.Count; i++)
+        //    {
+        //        if (recordsIDSet.Contains(parkingSpaceInfo[i].parkingSpace))
+        //        {
+        //            updateParkingSpace = "update parkingspace set parkingSpaceX = " + parkingSpaceInfo[i].coordX +
+        //                ",parkingSpaceY = " + parkingSpaceInfo[i].coordY + ",parkingSpaceZ = " + parkingSpaceInfo[i].floorNo + ",parkingSpaceState = " + parkingSpaceInfo[i].spaceStatus + " where (parkingSpaceID = " + parkingSpaceInfo[i].parkingSpace + ");";
+        //            updateSpaceList.Add(updateParkingSpace);
+        //        }
+        //        else
+        //        {
+        //            if (!remote)
+        //            {
+        //                insertParkingSpace = "insert into parkingspace (parkingSpaceID,parkingSpaceX,parkingSpaceY,parkingSpaceZ,parkingSpaceState) values (" + parkingSpaceInfo[i].parkingSpace + "," + parkingSpaceInfo[i].coordX +
+        //                    "," + parkingSpaceInfo[i].coordY + "," + parkingSpaceInfo[i].floorNo + "," + parkingSpaceInfo[i].spaceStatus + ");";
+        //                insertSpaceList.Add(insertParkingSpace);
+        //            }
+        //            else
+        //            {
+        //                insertParkingSpace = "insert into parkingspace (parkingSpaceID,parkingSpaceX,parkingSpaceY,parkingSpaceZ,parkingSpaceState,garageID,parkingSpaceName) values (" + parkingSpaceInfo[i].parkingSpace + "," + parkingSpaceInfo[i].coordX +
+        //                    "," + parkingSpaceInfo[i].coordY + "," + parkingSpaceInfo[i].floorNo + "," + parkingSpaceInfo[i].spaceStatus + "," + garageID + ",'默认');";
+        //                insertSpaceList.Add(insertParkingSpace);
+        //            }
+        //        }
+        //    }
+        //    try
+        //    {
+        //        lock (dbHandle)
+        //        {
+        //            int id = 0;
+        //            dbHandle.UpdateTransaction(updateSpaceList);
+        //            dbHandle.Insert(insertSpaceList, out id);
+        //        }
+        //    }
+        //    catch (Exception e) { Log.WriteLog(LogType.process, LogFile.ERROR, "更新本地所有车位异常"); Console.WriteLine("更新本地所有车位异常" + e.Message); }
+        //}
+        ///// <summary>
+        ///// 更新车辆状态
+        ///// </summary>
+        ///// <param name="lic"></param>
+        ///// <param name="state"></param>
+        //private static void UpdateVehicle(string lic, int state, int parkingRecordsID, bool park, bool remote, int parkingSpaceID)
+        //{
+        //    if (lic != "")
+        //    {
+        //        MySqlDataReader reader;
+        //        //查询车辆是否在车辆表中
+        //        string checkVehicleState = "select * from vehicle where numberPlate = '" + lic + "';";
+        //        if (!remote)
+        //        {
+        //            reader = localDBOper.Query(checkVehicleState);
+        //        }
+        //        else
+        //        {
+        //            //Log.WriteLog(LogType.database, "update, query: \n");
+        //            reader = remoteDBOper.Query(checkVehicleState);
+        //            //Log.WriteLog(LogType.database, "update, query: \n" + checkVehicleState);
+        //        }
+        //        if (reader != null)
+        //        {
+        //            if (reader.Read() && reader.HasRows)
+        //            {
+        //                //更新车辆状态
+        //                string updateVehicleState = "";
+        //                string updateRemoteVehicleState = "";
+        //                if (park)
+        //                {
+        //                    if (parkingRecordsID > 0)
+        //                    {
+        //                        if (parkingSpaceID == 0)
+        //                        {
+        //                            updateVehicleState = "update vehicle set vehiclepParkState = " + state + " ,parkingRecordsID = " + parkingRecordsID + " where numberPlate = '" + lic + "';";
+        //                            updateRemoteVehicleState = "update vehicle set vehiclepParkState = " + state + " ,parkingRecordsID = " + parkingRecordsID + ",garageID = " + garageID + " where numberPlate = '" + lic + "';";
+        //                        }
+        //                        else
+        //                        {
+        //                            updateVehicleState = "update vehicle set vehiclepParkState = " + state + " ,parkingRecordsID = " + parkingRecordsID + ",parkingSpaceID = " + parkingSpaceID + " where numberPlate = '" + lic + "';";
+        //                            updateRemoteVehicleState = "update vehicle set vehiclepParkState = " + state + " ,parkingRecordsID = " + parkingRecordsID + ",parkingSpaceID = " + parkingSpaceID + ",garageID = " + garageID + " where numberPlate = '" + lic + "';";
+        //                        }
+        //                    }
+        //                    else
+        //                    {
+        //                        updateVehicleState = "update vehicle set vehiclepParkState = " + state + " where numberPlate = '" + lic + "';";
+        //                        updateRemoteVehicleState = updateVehicleState;
+        //                    }
+        //                }
+        //                else
+        //                {
+        //                    updateVehicleState = "update vehicle set vehiclepParkState = " + state + " where numberPlate = '" + lic + "';";
+        //                    updateRemoteVehicleState = updateVehicleState;
+        //                }
+        //                List<string> list = new List<string>();
+        //                if (!remote)
+        //                {
+        //                    list.Add(updateVehicleState);
+        //                    localDBOper.UpdateTransaction(list);
+        //                }
+        //                else
+        //                {
+        //                    //Log.WriteLog(LogType.database, "update, update: \n");
+        //                    list.Add(updateRemoteVehicleState);
+        //                    remoteDBOper.UpdateTransaction(list);
+        //                    //Log.WriteLog(LogType.database, "update, update: \n" + updateRemoteVehicleState);
+        //                }
+        //            }
+        //            else
+        //            {
+        //                //插入车辆
+        //                string insertVehicleWithState = "";
+        //                if (park)
+        //                {
+        //                    if (parkingRecordsID > 0)
+        //                        insertVehicleWithState = "insert into vehicle (numberPlate,vehicleTypeID,vehiclepParkState,parkingRecordsID) values " +
+        //                    "('" + lic + "',NULL,'" + state + "'," + parkingRecordsID + ");";
+        //                    else
+        //                        insertVehicleWithState = "insert into vehicle (numberPlate,vehicleTypeID,vehiclepParkState) values " +
+        //                    "('" + lic + "',NULL,'" + state + "');";
+        //                }
+        //                else
+        //                {
+        //                    Log.WriteLog(LogType.process, LogFile.ERROR, "取车无法获得车辆信息");
+        //                    Console.WriteLine("明显异常,取车发现无车辆");
+        //                    try
+        //                    {
+        //                        reader.Close();
+        //                        reader.Dispose();
+        //                    }
+        //                    catch { }
+        //                    return;
+        //                }
+
+        //                List<string> list = new List<string>();
+        //                list.Add(insertVehicleWithState);
+        //                int id = 0;
+        //                if (!remote)
+        //                {
+        //                    localDBOper.Insert(list, out id);
+        //                }
+        //                else
+        //                {
+        //                    remoteDBOper.Insert(list, out id);
+        //                }
+        //            }
+        //            try
+        //            {
+        //                reader.Close();
+        //                reader.Dispose();
+        //            }
+        //            catch { }
+        //        }
+        //    }
+        //}
+        ///// <summary>
+        ///// 验证会员信息
+        ///// </summary>
+        ///// <param name="ts"></param>
+        ///// <param name="userID"></param>
+        ///// <param name="license"></param>
+        ///// <param name="status"></param>
+        //private static void ValidateUserInfo(TerminalStru ts, int userID, string license, out int status)
+        //{
+        //    status = 0;
+        //    //与云端数据比对
+        //    string checkNetSql = "select * from user where userID = 1;";
+        //    MySqlDataReader readerTest = remoteDBOper.Query(checkNetSql);
+        //    if (readerTest != null)
+        //    {
+        //        if (readerTest.Read() && readerTest.HasRows)
+        //        {
+        //            try
+        //            {
+        //                readerTest.Close();
+        //                readerTest.Dispose();
+        //            }
+        //            catch { }
+        //            string userInfoCheckSql = "select * from usercarrelation where userID = '" + userID + "' and numberPlate = '" + license + "';";
+        //            MySqlDataReader reader = remoteDBOper.Query(userInfoCheckSql);
+        //            if (reader != null && reader.Read() && reader.HasRows && userID != 0 && license != "")
+        //            {
+        //                //ts.licVerification = 1;//验证成功
+        //                //PLC.WriteToPLC(ts, PLCDataType.central);
+        //                status = 1;
+        //                Log.WriteLog(LogType.process, LogFile.INFO, "号牌验证成功");
+        //                SetNotification("注册用户,号牌验证成功", parkMonitor.model.TextColor.Info);
+        //            }
+        //            else
+        //            {
+        //                //ts.licVerification = 1;//验证失败
+        //                //PLC.WriteToPLC(ts, PLCDataType.central);
+        //                status = 2;
+        //                Log.WriteLog(LogType.process, LogFile.WARNING, "号牌验证失败");
+        //                SetNotification("注册用户,号牌验证失败", parkMonitor.model.TextColor.Error);
+        //            }
+        //            try
+        //            {
+        //                reader.Close();
+        //                reader.Dispose();
+        //            }
+        //            catch { }
+        //        }
+        //        else
+        //        {
+        //            try
+        //            {
+        //                readerTest.Close();
+        //                readerTest.Dispose();
+        //            }
+        //            catch { }
+        //            //ts.licVerification = 1;//网络异常,跳过验证
+        //            //PLC.WriteToPLC(ts, PLCDataType.central);
+        //            status = 1;
+        //            Log.WriteLog(LogType.process, LogFile.ERROR, "网络异常,无法验证号牌");
+        //        }
+        //    }
+        //}
+        ///// <summary>
+        ///// 查询停车记录id
+        ///// </summary>
+        ///// <param name="querySql"></param>
+        ///// <param name="recordsID"></param>
+        ///// <param name="remote"></param>
+        //private static void QueryParkingRecordsID(string querySql, out int recordsID, bool remote)
+        //{
+        //    recordsID = 0;
+        //    MySqlDataReader reader = null;
+        //    if (!remote)
+        //    {
+        //        reader = localDBOper.Query(querySql);
+        //    }
+        //    else
+        //    {
+        //        reader = remoteDBOper.Query(querySql);
+        //    }
+        //    if (reader != null)
+        //    {
+        //        try
+        //        {
+        //            while (reader.Read())
+        //            {
+        //                if (reader.HasRows)
+        //                    recordsID = reader.GetInt32("parkingRecordsID");
+        //            }
+        //        }
+        //        catch (Exception e) { Log.WriteLog(LogType.process, LogFile.ERROR, "查询停车记录id失败"); Console.WriteLine(e.Message); };
+        //        try
+        //        {
+        //            reader.Close();
+        //            reader.Dispose();
+        //        }
+        //        catch { }
+        //    }
+        //}
+
+    }
+}

+ 5 - 4
communicate_module/packages.config

@@ -2,8 +2,9 @@
 <packages>
   <package id="Google.Protobuf" version="3.17.3" targetFramework="net45" />
   <package id="Google.Protobuf.Tools" version="3.17.2" targetFramework="net45" />
-  <package id="NNanomsg" version="0.5.2" targetFramework="net45" />
-  <package id="System.Buffers" version="4.5.1" targetFramework="net45" />
-  <package id="System.Memory" version="4.5.4" targetFramework="net45" />
-  <package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net45" />
+  <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
+  <package id="NNanomsg" version="0.5.2" targetFramework="net48" />
+  <package id="System.Buffers" version="4.5.1" targetFramework="net45" requireReinstallation="true" />
+  <package id="System.Memory" version="4.5.4" targetFramework="net45" requireReinstallation="true" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net45" requireReinstallation="true" />
 </packages>

+ 4 - 4
parkspace_manager/App.config

@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
     <startup> 
-        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
     </startup>
   <appSettings>
     <!--日志写入地址配置文件-->
-    <add key="LogAddress" value="E:\\yct\\chutian_modules\\LogDemo\\LoggerTest" />
+    <add key="LogAddress" value="E:\\yct\\chutian_modules\\LogDemo\\LoggerTest"/>
   </appSettings>
-</configuration>
+</configuration>

+ 46 - 0
parkspace_manager/Arrow.Designer.cs

@@ -0,0 +1,46 @@
+
+namespace monitor_main_windows
+{
+    partial class Arrow
+    {
+        /// <summary> 
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region 组件设计器生成的代码
+
+        /// <summary> 
+        /// 设计器支持所需的方法 - 不要修改
+        /// 使用代码编辑器修改此方法的内容。
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.SuspendLayout();
+            // 
+            // Arrow
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Name = "Arrow";
+            this.Size = new System.Drawing.Size(135, 121);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+    }
+}

+ 532 - 0
parkspace_manager/Arrow.cs

@@ -0,0 +1,532 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace monitor_main_windows
+{
+    public partial class Arrow : UserControl
+    {
+        public Arrow()
+        {
+            InitializeComponent();
+            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
+            this.SetStyle(ControlStyles.DoubleBuffer, true);
+            this.SetStyle(ControlStyles.ResizeRedraw, true);
+            this.SetStyle(ControlStyles.Selectable, true);
+            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
+            this.SetStyle(ControlStyles.UserPaint, true);
+            this.ForeColor = Color.White;
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+            this.SizeChanged += Arrow_SizeChanged;
+            this.Size = new Size(100, 50);
+        }
+
+
+
+        /// <summary>
+        /// The arrow color
+        /// </summary>
+        private Color arrowColor = Color.FromArgb(255, 77, 59);
+
+        /// <summary>
+        /// Gets or sets the color of the arrow.
+        /// </summary>
+        /// <value>The color of the arrow.</value>
+        [Description("箭头颜色"), Category("自定义")]
+        public Color ArrowColor
+        {
+            get { return arrowColor; }
+            set
+            {
+                arrowColor = value;
+                Refresh();
+            }
+        }
+
+        /// <summary>
+        /// The border color
+        /// </summary>
+        private Color? borderColor = null;
+
+        /// <summary>
+        /// Gets or sets the color of the border.
+        /// </summary>
+        /// <value>The color of the border.</value>
+        [Description("箭头边框颜色,为空则无边框"), Category("自定义")]
+        public Color? BorderColor
+        {
+            get { return borderColor; }
+            set
+            {
+                borderColor = value;
+                Refresh();
+            }
+        }
+
+        /// <summary>
+        /// The direction
+        /// </summary>
+        private ArrowDirection direction = monitor_main_windows.ArrowDirection.Right;
+
+        /// <summary>
+        /// Gets or sets the direction.
+        /// </summary>
+        /// <value>The direction.</value>
+        [Description("箭头方向"), Category("自定义")]
+        public ArrowDirection Direction
+        {
+            get { return direction; }
+            set
+            {
+                direction = value;
+                ResetPath();
+                Refresh();
+            }
+        }
+        /// <summary>
+        /// 获取或设置控件显示的文字的字体。
+        /// </summary>
+        /// <value>The font.</value>
+        /// <PermissionSet>
+        ///   <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+        ///   <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+        ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
+        ///   <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+        /// </PermissionSet>
+        public override Font Font
+        {
+            get
+            {
+                return base.Font;
+            }
+            set
+            {
+                base.Font = value;
+                Refresh();
+            }
+        }
+        /// <summary>
+        /// 获取或设置控件的前景色。
+        /// </summary>
+        /// <value>The color of the fore.</value>
+        /// <PermissionSet>
+        ///   <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+        /// </PermissionSet>
+        public override Color ForeColor
+        {
+            get
+            {
+                return base.ForeColor;
+            }
+            set
+            {
+                base.ForeColor = value;
+                Refresh();
+            }
+        }
+        /// <summary>
+        /// The text
+        /// </summary>
+        private string text;
+        /// <summary>
+        /// Gets or sets the text.
+        /// </summary>
+        /// <value>The text.</value>
+        [Bindable(true)]
+        [Browsable(true)]
+        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+        [EditorBrowsable(EditorBrowsableState.Always)]
+        [Localizable(true)]
+        [Description("箭头文字"), Category("自定义")]
+        public override string Text
+        {
+            get
+            {
+                return text;
+            }
+            set
+            {
+                text = value;
+                Refresh();
+            }
+        }
+        /// <summary>
+        /// The m path
+        /// </summary>
+        GraphicsPath m_path;
+        /// <summary>
+        /// Initializes a new instance of the <see cref="UCArrow" /> class.
+   
+
+        /// <summary>
+        /// Handles the SizeChanged event of the UCArrow control.
+        /// </summary>
+        /// <param name="sender">The source of the event.</param>
+        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
+        void Arrow_SizeChanged(object sender, EventArgs e)
+        {
+            ResetPath();
+        }
+
+        /// <summary>
+        /// Resets the path.
+        /// </summary>
+        private void ResetPath()
+        {
+            Point[] ps = null;
+            int arrow_h = 20;
+            switch (direction)
+            {
+                case ArrowDirection.Left:
+                    arrow_h = Width / 3+1;
+                    ps = new Point[]
+                    {
+                        new Point(0,this.Height/2),
+                        new Point(arrow_h,0),
+                        new Point(arrow_h,this.Height/4),
+                        new Point(this.Width-1,this.Height/4),
+                        new Point(this.Width-1,this.Height-this.Height/4),
+                        new Point(arrow_h,this.Height-this.Height/4),
+                        new Point(arrow_h,this.Height),
+                        new Point(0,this.Height/2)
+                    };
+                    break;
+                case ArrowDirection.Right:
+                    arrow_h = Width / 3 + 1;
+                    ps = new Point[]
+                    {
+                        new Point(0,this.Height/4),
+                        new Point(this.Width-arrow_h,this.Height/4),
+                        new Point(this.Width-arrow_h,0),
+                        new Point(this.Width-1,this.Height/2),
+                        new Point(this.Width-arrow_h,this.Height),
+                        new Point(this.Width-arrow_h,this.Height-this.Height/4),
+                        new Point(0,this.Height-this.Height/4),
+                        new Point(0,this.Height/4)
+                    };
+                    break;
+                case ArrowDirection.Top:
+                    arrow_h = Height / 3 + 1;
+                    ps = new Point[]
+                    {
+                       new Point(this.Width/2,0),
+                       new Point(this.Width,arrow_h),
+                       new Point(this.Width-this.Width/4,arrow_h),
+                       new Point(this.Width-this.Width/4,this.Height-1),
+                       new Point(this.Width/4,this.Height-1),
+                       new Point(this.Width/4,arrow_h),
+                       new Point(0,arrow_h),
+                       new Point(this.Width/2,0),
+                    };
+                    break;
+                case ArrowDirection.Bottom:
+                    arrow_h = Height / 3 + 1;
+                    ps = new Point[]
+                    {
+                       new Point(this.Width-this.Width/4,0),
+                       new Point(this.Width-this.Width/4,this.Height-arrow_h),
+                       new Point(this.Width,this.Height-arrow_h),
+                       new Point(this.Width/2,this.Height-1),
+                       new Point(0,this.Height-arrow_h),
+                       new Point(this.Width/4,this.Height-arrow_h),
+                       new Point(this.Width/4,0),
+                       new Point(this.Width-this.Width/4,0),
+                    };
+                    break;
+                case ArrowDirection.Left_Right:
+                    ps = new Point[]
+                    {
+                        new Point(0,this.Height/2),
+                        new Point(arrow_h,0),
+                        new Point(arrow_h,this.Height/4),
+                        new Point(this.Width-arrow_h,this.Height/4),
+                        new Point(this.Width-arrow_h,0),
+                        new Point(this.Width-1,this.Height/2),
+                        new Point(this.Width-arrow_h,this.Height),
+                        new Point(this.Width-arrow_h,this.Height-this.Height/4),
+                        new Point(arrow_h,this.Height-this.Height/4),
+                        new Point(arrow_h,this.Height),
+                        new Point(0,this.Height/2),
+                    };
+                    break;
+                case ArrowDirection.Top_Bottom:
+                    ps = new Point[]
+                    {
+                       new Point(this.Width/2,0),
+                       new Point(this.Width,arrow_h),
+                       new Point(this.Width-this.Width/4,arrow_h),
+                       new Point(this.Width-this.Width/4,this.Height-arrow_h),
+                       new Point(this.Width,this.Height-arrow_h),
+                       new Point(this.Width/2,this.Height-1),
+                       new Point(0,this.Height-arrow_h),
+                       new Point(this.Width/4,this.Height-arrow_h),
+                       new Point(this.Width/4,arrow_h),
+                       new Point(0,arrow_h),
+                       new Point(this.Width/2,0),
+                    };
+                    break;
+
+                case ArrowDirection.TopRight:
+                    arrow_h = Math.Min(Width / 5, Height / 3);
+                    ps = new Point[]
+                    {
+                        new Point(Width/2+5*arrow_h/2,Height/2-arrow_h/2),
+                        new Point(Width/2+3*arrow_h/2,Height/2-3*arrow_h/2),
+                        new Point(Width/2+3*arrow_h/2,Height/2-arrow_h),
+                        new Point(Width/2+arrow_h/2,Height/2-arrow_h),
+                        new Point(Width/2+arrow_h/2,Height/2),
+                        new Point(Width/2+3*arrow_h/2,Height/2),
+                        new Point(Width/2+3*arrow_h/2,Height/2+arrow_h/2),
+                        new Point(Width/2+5*arrow_h/2,Height/2-arrow_h/2)
+                    };
+                    break;
+                case ArrowDirection.TopLeft:
+                    arrow_h = Math.Min(Width / 5, Height / 3);
+                    ps = new Point[]
+                    {
+                        new Point(Width/2-5*arrow_h/2,Height/2-arrow_h/2),
+                        new Point(Width/2-3*arrow_h/2,Height/2-3*arrow_h/2),
+                        new Point(Width/2-3*arrow_h/2,Height/2-arrow_h),
+                        new Point(Width/2-arrow_h/2+1,Height/2-arrow_h),
+                        new Point(Width/2-arrow_h/2+1,Height/2),
+                        new Point(Width/2-3*arrow_h/2,Height/2),
+                        new Point(Width/2-3*arrow_h/2,Height/2+arrow_h/2),
+                        new Point(Width/2-5*arrow_h/2,Height/2-arrow_h/2)
+                    };
+                    break;
+
+                case ArrowDirection.LeftTop:
+                    arrow_h = Math.Min(Width /3, Height /5);
+                    ps = new Point[]
+                    {
+                        new Point(Width/2-arrow_h/2,Height/2-5*arrow_h/2),
+                        new Point(Width/2-3*arrow_h/2,Height/2-3*arrow_h/2),
+                        new Point(Width/2-arrow_h,Height/2-3*arrow_h/2),
+                        new Point(Width/2-arrow_h,Height/2-arrow_h/2+1),
+                        new Point(Width/2,Height/2-arrow_h/2+1),
+                        new Point(Width/2,Height/2-3*arrow_h/2),
+                        new Point(Width/2+arrow_h/2,Height/2-3*arrow_h/2),
+                        new Point(Width/2-arrow_h/2,Height/2-5*arrow_h/2)
+                    };
+                    break;
+                case ArrowDirection.LeftDown:
+                    arrow_h = Math.Min(Width / 3, Height / 5);
+                    ps = new Point[]
+                    {
+                        new Point(Width/2-arrow_h/2,Height/2+5*arrow_h/2),
+                        new Point(Width/2-3*arrow_h/2,Height/2+3*arrow_h/2),
+                        new Point(Width/2-arrow_h,Height/2+3*arrow_h/2),
+                        new Point(Width/2-arrow_h,Height/2+arrow_h/2-1),
+                        new Point(Width/2,Height/2+arrow_h/2-1),
+                        new Point(Width/2,Height/2+3*arrow_h/2),
+                        new Point(Width/2+arrow_h/2,Height/2+3*arrow_h/2),
+                        new Point(Width/2-arrow_h/2,Height/2+5*arrow_h/2)
+                    };
+                    break;
+
+                case ArrowDirection.RightTop:
+                    arrow_h = Math.Min(Width / 3, Height / 5);
+                    ps = new Point[]
+                    {
+                        new Point(Width/2+arrow_h/2,Height/2-5*arrow_h/2),
+                        new Point(Width/2+3*arrow_h/2,Height/2-3*arrow_h/2),
+                        new Point(Width/2+arrow_h,Height/2-3*arrow_h/2),
+                        new Point(Width/2+arrow_h,Height/2-arrow_h/2+1),
+                        new Point(Width/2,Height/2-arrow_h/2+1),
+                        new Point(Width/2,Height/2-3*arrow_h/2),
+                        new Point(Width/2-arrow_h/2,Height/2-3*arrow_h/2),
+                        new Point(Width/2+arrow_h/2,Height/2-5*arrow_h/2)
+                    };
+                    break;
+                case ArrowDirection.RightDown:
+                    arrow_h = Math.Min(Width / 3, Height / 5);
+                    ps = new Point[]
+                    {
+                        new Point(Width/2+arrow_h/2,Height/2+5*arrow_h/2),
+                        new Point(Width/2+3*arrow_h/2,Height/2+3*arrow_h/2),
+                        new Point(Width/2+arrow_h,Height/2+3*arrow_h/2),
+                        new Point(Width/2+arrow_h,Height/2+arrow_h/2-1),
+                        new Point(Width/2,Height/2+arrow_h/2-1),
+                        new Point(Width/2,Height/2+3*arrow_h/2),
+                        new Point(Width/2-arrow_h/2,Height/2+3*arrow_h/2),
+                        new Point(Width/2+arrow_h/2,Height/2+5*arrow_h/2)
+                    };
+                    break;
+                case ArrowDirection.DownLeft:
+                    arrow_h = Math.Min(Width / 5, Height / 3);
+                    ps = new Point[]
+                    {
+                        new Point(Width/2-5*arrow_h/2,Height/2+arrow_h/2),
+                        new Point(Width/2-3*arrow_h/2,Height/2+3*arrow_h/2),
+                        new Point(Width/2-3*arrow_h/2,Height/2+arrow_h),
+                        new Point(Width/2-arrow_h/2+1,Height/2+arrow_h),
+                        new Point(Width/2-arrow_h/2+1,Height/2),
+                        new Point(Width/2-3*arrow_h/2,Height/2),
+                        new Point(Width/2-3*arrow_h/2,Height/2-arrow_h/2),
+                        new Point(Width/2-5*arrow_h/2,Height/2+arrow_h/2)
+                    };
+                    break;
+                case ArrowDirection.DownRight:
+                    arrow_h = Math.Min(Width / 5, Height / 3);
+                    ps = new Point[]
+                    {
+                        new Point(Width/2+5*arrow_h/2,Height/2+arrow_h/2),
+                        new Point(Width/2+3*arrow_h/2,Height/2+3*arrow_h/2),
+                        new Point(Width/2+3*arrow_h/2,Height/2+arrow_h),
+                        new Point(Width/2+arrow_h/2-1,Height/2+arrow_h),
+                        new Point(Width/2+arrow_h/2-1,Height/2),
+                        new Point(Width/2+3*arrow_h/2,Height/2),
+                        new Point(Width/2+3*arrow_h/2,Height/2-arrow_h/2),
+                        new Point(Width/2+5*arrow_h/2,Height/2+arrow_h/2)
+                    };
+                    break;
+            }
+            m_path = new GraphicsPath();
+            m_path.AddLines(ps);
+            m_path.CloseAllFigures();
+        }
+
+        /// <summary>
+        /// 引发 <see cref="E:System.Windows.Forms.Control.Paint" /> 事件。
+        /// </summary>
+        /// <param name="e">包含事件数据的 <see cref="T:System.Windows.Forms.PaintEventArgs" />。</param>
+        protected override void OnPaint(PaintEventArgs e)
+        {
+            base.OnPaint(e);
+            var g = e.Graphics;
+
+            g.SmoothingMode = SmoothingMode.AntiAlias;  //使绘图质量最高,即消除锯齿
+            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
+            g.CompositingQuality = CompositingQuality.HighQuality;
+            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
+            //base.Region = new Region(m_path);
+
+            
+            g.FillPath(new SolidBrush(arrowColor), m_path);
+
+            if (borderColor != null && borderColor != Color.Empty)
+                g.DrawPath(new Pen(new SolidBrush(borderColor.Value)), m_path);
+            
+
+            if (direction == ArrowDirection.TopRight)
+            {
+                int arrow_h = Math.Min(Width / 5, Height / 3);
+                g.FillPie(new SolidBrush(arrowColor),
+                    new Rectangle((Width - arrow_h)/ 2, Height / 2 - arrow_h, arrow_h * 2+1, arrow_h * 2+1), 180,90);
+                 g.FillRectangle(new SolidBrush(arrowColor),
+                     new RectangleF(new PointF((Width  - arrow_h) / 2, Height / 2),new SizeF(arrow_h, Height / 2)));
+            }
+            if (direction == ArrowDirection.TopLeft)
+            {
+                int arrow_h = Math.Min(Width / 5, Height / 3);
+                g.FillPie(new SolidBrush(arrowColor),
+                    new Rectangle((Width - 3*arrow_h) / 2, Height / 2 - arrow_h, arrow_h * 2, arrow_h * 2 + 1), 270, 90);
+                g.FillRectangle(new SolidBrush(arrowColor),
+                    new RectangleF(new PointF((Width - arrow_h) / 2, Height / 2), new SizeF(arrow_h, Height / 2)));
+            }
+            if (direction == ArrowDirection.LeftTop)
+            {
+                int arrow_h = Math.Min(Width /3, Height / 5);
+                g.FillPie(new SolidBrush(arrowColor),
+                    new Rectangle(Width / 2 - arrow_h,(Height - 3 * arrow_h) / 2, arrow_h * 2+1, arrow_h * 2), 90, 90);
+                g.FillRectangle(new SolidBrush(arrowColor),
+                    new RectangleF(new PointF(Width / 2,(Height - arrow_h) / 2), new SizeF(Width / 2,arrow_h)));
+            }
+            if (direction == ArrowDirection.LeftDown)
+            {
+                int arrow_h = Math.Min(Width / 3, Height / 5);
+                g.FillPie(new SolidBrush(arrowColor),
+                    new Rectangle(Width / 2 - arrow_h, (Height -  arrow_h) / 2, arrow_h * 2+1 , arrow_h * 2), 180, 90);
+                g.FillRectangle(new SolidBrush(arrowColor),
+                    new RectangleF(new PointF(Width / 2, (Height - arrow_h) / 2), new SizeF(Width / 2, arrow_h)));
+            }
+            if (direction == ArrowDirection.RightTop)
+            {
+                int arrow_h = Math.Min(Width / 3, Height / 5);
+                g.FillPie(new SolidBrush(arrowColor),
+                    new Rectangle(Width / 2 - arrow_h, (Height - 3 * arrow_h) / 2, arrow_h * 2 , arrow_h * 2), 0, 90);
+                g.FillRectangle(new SolidBrush(arrowColor),
+                    new RectangleF(new PointF(0, (Height - arrow_h) / 2), new SizeF(Width / 2+1, arrow_h)));
+            }
+            if (direction == ArrowDirection.RightDown)
+            {
+                int arrow_h = Math.Min(Width / 3, Height / 5);
+                g.FillPie(new SolidBrush(arrowColor),
+                    new Rectangle(Width / 2 - arrow_h, (Height -   arrow_h+1) / 2, arrow_h * 2, arrow_h * 2), 270, 90);
+                g.FillRectangle(new SolidBrush(arrowColor),
+                    new RectangleF(new PointF(0, (Height - arrow_h) / 2), new SizeF(Width / 2 + 1, arrow_h)));
+            }
+            if (direction == ArrowDirection.DownLeft)
+            {
+                int arrow_h = Math.Min(Width / 5, Height / 3);
+                g.FillPie(new SolidBrush(arrowColor),
+                    new Rectangle((Width - 3 * arrow_h) / 2, Height / 2 - arrow_h, arrow_h * 2, arrow_h * 2 ), 0, 90);
+                g.FillRectangle(new SolidBrush(arrowColor),
+                    new RectangleF(new PointF((Width - arrow_h) / 2, 0), new SizeF(arrow_h, Height / 2+1)));
+            }
+            if (direction == ArrowDirection.DownRight)
+            {
+                int arrow_h = Math.Min(Width / 5, Height / 3);
+                g.FillPie(new SolidBrush(arrowColor),
+                    new Rectangle((Width - arrow_h) / 2, Height / 2 - arrow_h, arrow_h * 2, arrow_h * 2), 90, 90);
+                g.FillRectangle(new SolidBrush(arrowColor),
+                    new RectangleF(new PointF((Width - arrow_h) / 2, 0), new SizeF(arrow_h, Height / 2 + 1)));
+            }
+
+            if (!string.IsNullOrEmpty(text))
+            {
+                var size = g.MeasureString(Text, Font);
+                g.DrawString(Text, Font, new SolidBrush(ForeColor), new PointF((this.Width - size.Width) / 2, (this.Height - size.Height) / 2));
+            }
+
+
+        }
+    }
+
+    /// <summary>
+    /// Enum ArrowDirection
+    /// </summary>
+    public enum ArrowDirection
+    {
+        /// <summary>
+        /// The left
+        /// </summary>
+        Left,
+        /// <summary>
+        /// The right
+        /// </summary>
+        Right,
+        /// <summary>
+        /// The top
+        /// </summary>
+        Top,
+        /// <summary>
+        /// The bottom
+        /// </summary>
+        Bottom,
+        /// <summary>
+        /// The left right
+        /// </summary>
+        Left_Right,
+        /// <summary>
+        /// The top bottom
+        /// </summary>
+        Top_Bottom,
+
+        LeftTop,
+        LeftDown,
+        RightTop,
+        RightDown,
+        TopLeft,
+        TopRight,
+        DownLeft,
+        DownRight
+    }
+}

parkspace_manager/Form1.resx → parkspace_manager/Arrow.resx


+ 0 - 89
parkspace_manager/Form1.Designer.cs

@@ -1,89 +0,0 @@
-namespace parkspace_manager
-{
-    partial class Form1
-    {
-        /// <summary>
-        /// 必需的设计器变量。
-        /// </summary>
-        private System.ComponentModel.IContainer components = null;
-
-        /// <summary>
-        /// 清理所有正在使用的资源。
-        /// </summary>
-        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
-        protected override void Dispose(bool disposing)
-        {
-            if (disposing && (components != null))
-            {
-                components.Dispose();
-            }
-            base.Dispose(disposing);
-        }
-
-        #region Windows 窗体设计器生成的代码
-
-        /// <summary>
-        /// 设计器支持所需的方法 - 不要修改
-        /// 使用代码编辑器修改此方法的内容。
-        /// </summary>
-        private void InitializeComponent()
-        {
-            this.button1 = new System.Windows.Forms.Button();
-            this.button2 = new System.Windows.Forms.Button();
-            this.button3 = new System.Windows.Forms.Button();
-            this.SuspendLayout();
-            // 
-            // button1
-            // 
-            this.button1.Location = new System.Drawing.Point(52, 44);
-            this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(75, 23);
-            this.button1.TabIndex = 0;
-            this.button1.Text = "开始";
-            this.button1.UseVisualStyleBackColor = true;
-            this.button1.Click += new System.EventHandler(this.button1_Click);
-            this.button1.MouseHover += new System.EventHandler(this.button1_MouseHover);
-            // 
-            // button2
-            // 
-            this.button2.Location = new System.Drawing.Point(177, 44);
-            this.button2.Name = "button2";
-            this.button2.Size = new System.Drawing.Size(75, 23);
-            this.button2.TabIndex = 1;
-            this.button2.Text = "结束";
-            this.button2.UseVisualStyleBackColor = true;
-            this.button2.Click += new System.EventHandler(this.button2_Click);
-            // 
-            // button3
-            // 
-            this.button3.Location = new System.Drawing.Point(304, 197);
-            this.button3.Name = "button3";
-            this.button3.Size = new System.Drawing.Size(134, 108);
-            this.button3.TabIndex = 2;
-            this.button3.Text = "打开窗口";
-            this.button3.UseVisualStyleBackColor = true;
-            this.button3.Click += new System.EventHandler(this.button3_Click);
-            // 
-            // Form1
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(724, 451);
-            this.Controls.Add(this.button3);
-            this.Controls.Add(this.button2);
-            this.Controls.Add(this.button1);
-            this.Name = "Form1";
-            this.Text = "Form1";
-            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
-            this.ResumeLayout(false);
-
-        }
-
-        #endregion
-
-        private System.Windows.Forms.Button button1;
-        private System.Windows.Forms.Button button2;
-        private System.Windows.Forms.Button button3;
-    }
-}
-

+ 0 - 65
parkspace_manager/Form1.cs

@@ -1,65 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace parkspace_manager
-{
-    public partial class Form1 : Form
-    {
-        //Communicator com;
-        FormParkSpaceStatus formParkSpaceStatus = null;
-        public Form1()
-        {
-            InitializeComponent();
-            formParkSpaceStatus = new FormParkSpaceStatus();
-            //com = Communicator.Instance;
-        }
-
-        private void button1_Click(object sender, EventArgs e)
-        {
-            //com.Init();
-            //com.Bind("tcp://192.168.2.144:20000");
-            //com.Connect("tcp://192.168.2.125:20000");
-        }
-
-        private void button2_Click(object sender, EventArgs e)
-        {
-            //com.Uninit();
-        }
-
-        private void button3_Click(object sender, EventArgs e)
-        {
-            if (formParkSpaceStatus != null)
-            {
-                formParkSpaceStatus.Show();
-            }
-        }
-
-        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
-        {
-            formParkSpaceStatus.Uninit();
-        }
-
-        private void button1_MouseHover(object sender, EventArgs e)
-        {
-            Button btn = (Button)sender;
-            // 创建the ToolTip 
-            ToolTip toolTip1 = new ToolTip();
-
-            // 设置显示样式
-            toolTip1.AutoPopDelay = 5000;//提示信息的可见时间
-            toolTip1.InitialDelay = 500;//事件触发多久后出现提示
-            toolTip1.ReshowDelay = 500;//指针从一个控件移向另一个控件时,经过多久才会显示下一个提示框
-            toolTip1.ShowAlways = true;//是否显示提示框
-
-            //  设置伴随的对象.
-            toolTip1.SetToolTip(btn, "开始?");//设置提示按钮和提示内容
-        }
-    }
-}

File diff suppressed because it is too large
+ 1428 - 0
parkspace_manager/FormMonitor.Designer.cs


+ 97 - 0
parkspace_manager/FormMonitor.cs

@@ -0,0 +1,97 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace monitor_main_windows
+{
+    public partial class FormMonitor : Form
+    {
+        Timer timer = new Timer();
+        public FormMonitor()
+        {
+            InitializeComponent();
+            
+        }
+
+        private void Timer_Tick(object sender, EventArgs e)
+        {
+            led_A_plc.Statu = UIMeaasgeData.Instance.PLCStatuA.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.PLCStatuA.Value;
+            led_B_plc.Statu = UIMeaasgeData.Instance.PLCStatuB.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.PLCStatuB.Value;
+            led_C_plc.Statu = UIMeaasgeData.Instance.PLCStatuC.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.PLCStatuC.Value;
+
+            led_A1_terminal.Statu = UIMeaasgeData.Instance.TerminalStatuA1.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.TerminalStatuA1.Value;
+            led_A2_terminal.Statu = UIMeaasgeData.Instance.TerminalStatuA2.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.TerminalStatuA2.Value;
+            led_B1_terminal.Statu = UIMeaasgeData.Instance.TerminalStatuB1.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.TerminalStatuB1.Value;
+            led_B2_terminal.Statu = UIMeaasgeData.Instance.TerminalStatuB2.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.TerminalStatuB2.Value;
+            led_C1_terminal.Statu = UIMeaasgeData.Instance.TerminalStatuC1.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.TerminalStatuC1.Value;
+            led_C2_terminal.Statu = UIMeaasgeData.Instance.TerminalStatuC2.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.TerminalStatuC2.Value;
+
+            led_A1_lidar.Statu = UIMeaasgeData.Instance.LidarStatuA1.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.LidarStatuA1.Value;
+            led_A2_lidar.Statu = UIMeaasgeData.Instance.LidarStatuA2.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.LidarStatuA2.Value;
+            led_B1_lidar.Statu = UIMeaasgeData.Instance.LidarStatuB1.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.LidarStatuB1.Value;
+            led_B2_lidar.Statu = UIMeaasgeData.Instance.LidarStatuB2.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.LidarStatuB2.Value;
+            led_C1_lidar.Statu = UIMeaasgeData.Instance.LidarStatuC1.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.LidarStatuC1.Value;
+            led_C2_lidar.Statu = UIMeaasgeData.Instance.LidarStatuC2.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.LidarStatuC2.Value;
+
+            led_main.Statu = UIMeaasgeData.Instance.MainNodeStatu.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.MainNodeStatu.Value;
+            led_database.Statu = UIMeaasgeData.Instance.DatabaseNodeStatu.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.DatabaseNodeStatu.Value;
+            led_out_terminal1.Statu = UIMeaasgeData.Instance.OutputTerminal1Statu.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.OutputTerminal1Statu.Value;
+            led_out_terminal2.Statu = UIMeaasgeData.Instance.OutputTerminal2Statu.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.OutputTerminal2Statu.Value;
+            led_out_unnormal.Statu = UIMeaasgeData.Instance.OutputUnnormalNodeStatu.IsTimeout() ? monitor_main_windows.LED.LED_Statu.Disconnected :
+                (monitor_main_windows.LED.LED_Statu)UIMeaasgeData.Instance.OutputUnnormalNodeStatu.Value;
+
+
+        }
+        private void FormMonitor_Load(object sender, EventArgs e)
+        {
+            timer.Enabled = true;
+            timer.Interval = 500;
+            timer.Tick += Timer_Tick;
+        }
+
+        public void UpdataCommand()
+        {
+            monitor_main_windows.StepControl step = new StepControl();
+            step.Label = System.DateTime.Now.ToString();
+            step.Steps = new string[] { "开始", "分配车位" };
+            step.BackSteps = new string[] { "清除车位", "异常结束" };
+            step.StepIndex = 3;
+            step.Dock = DockStyle.Top;
+            panel_input_B1.Controls.Add(step);
+
+            monitor_main_windows.StepControl step1 = new StepControl();
+            
+            step1.Steps = new string[] { "开始", "分配车位","搬运中","确认车位","完成" };
+           
+            step1.StepIndex = 3;
+            step1.Dock = DockStyle.Top;
+            step1.Label = System.DateTime.Now.ToString();
+            panel_input_B2.Controls.Add(step1);
+        }
+    }
+}

parkspace_manager/FormParkSpaceStatus.resx → parkspace_manager/FormMonitor.resx


+ 0 - 166
parkspace_manager/FormParkSpaceStatus.Designer.cs

@@ -1,166 +0,0 @@
-namespace parkspace_manager
-{
-    partial class FormParkSpaceStatus
-    {
-        /// <summary>
-        /// Required designer variable.
-        /// </summary>
-        private System.ComponentModel.IContainer components = null;
-
-        /// <summary>
-        /// Clean up any resources being used.
-        /// </summary>
-        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
-        protected override void Dispose(bool disposing)
-        {
-            if (disposing && (components != null))
-            {
-                components.Dispose();
-            }
-            base.Dispose(disposing);
-        }
-
-        #region Windows Form Designer generated code
-
-        /// <summary>
-        /// Required method for Designer support - do not modify
-        /// the contents of this method with the code editor.
-        /// </summary>
-        private void InitializeComponent()
-        {
-            this.ParkingSpaceMonitorPanel = new System.Windows.Forms.Panel();
-            this.parkspaceStatusSamplePanel = new System.Windows.Forms.Panel();
-            this.btn_unknown = new System.Windows.Forms.Button();
-            this.btn_error = new System.Windows.Forms.Button();
-            this.btn_locked = new System.Windows.Forms.Button();
-            this.btn_reserved = new System.Windows.Forms.Button();
-            this.btn_occupied = new System.Windows.Forms.Button();
-            this.btn_empty = new System.Windows.Forms.Button();
-            this.btn_clear = new System.Windows.Forms.Button();
-            this.parkspaceStatusSamplePanel.SuspendLayout();
-            this.SuspendLayout();
-            // 
-            // ParkingSpaceMonitorPanel
-            // 
-            this.ParkingSpaceMonitorPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
-            this.ParkingSpaceMonitorPanel.Location = new System.Drawing.Point(0, 79);
-            this.ParkingSpaceMonitorPanel.Name = "ParkingSpaceMonitorPanel";
-            this.ParkingSpaceMonitorPanel.Size = new System.Drawing.Size(1574, 727);
-            this.ParkingSpaceMonitorPanel.TabIndex = 0;
-            // 
-            // parkspaceStatusSamplePanel
-            // 
-            this.parkspaceStatusSamplePanel.Controls.Add(this.btn_clear);
-            this.parkspaceStatusSamplePanel.Controls.Add(this.btn_unknown);
-            this.parkspaceStatusSamplePanel.Controls.Add(this.btn_error);
-            this.parkspaceStatusSamplePanel.Controls.Add(this.btn_locked);
-            this.parkspaceStatusSamplePanel.Controls.Add(this.btn_reserved);
-            this.parkspaceStatusSamplePanel.Controls.Add(this.btn_occupied);
-            this.parkspaceStatusSamplePanel.Controls.Add(this.btn_empty);
-            this.parkspaceStatusSamplePanel.Dock = System.Windows.Forms.DockStyle.Top;
-            this.parkspaceStatusSamplePanel.Location = new System.Drawing.Point(0, 0);
-            this.parkspaceStatusSamplePanel.Name = "parkspaceStatusSamplePanel";
-            this.parkspaceStatusSamplePanel.Size = new System.Drawing.Size(1574, 73);
-            this.parkspaceStatusSamplePanel.TabIndex = 1;
-            // 
-            // btn_unknown
-            // 
-            this.btn_unknown.BackColor = System.Drawing.Color.Violet;
-            this.btn_unknown.Location = new System.Drawing.Point(864, 22);
-            this.btn_unknown.Name = "btn_unknown";
-            this.btn_unknown.Size = new System.Drawing.Size(133, 33);
-            this.btn_unknown.TabIndex = 5;
-            this.btn_unknown.Text = "未知";
-            this.btn_unknown.UseVisualStyleBackColor = false;
-            // 
-            // btn_error
-            // 
-            this.btn_error.BackColor = System.Drawing.Color.Red;
-            this.btn_error.Location = new System.Drawing.Point(700, 22);
-            this.btn_error.Name = "btn_error";
-            this.btn_error.Size = new System.Drawing.Size(133, 33);
-            this.btn_error.TabIndex = 4;
-            this.btn_error.Text = "故障";
-            this.btn_error.UseVisualStyleBackColor = false;
-            // 
-            // btn_locked
-            // 
-            this.btn_locked.BackColor = System.Drawing.Color.LightGreen;
-            this.btn_locked.Location = new System.Drawing.Point(528, 22);
-            this.btn_locked.Name = "btn_locked";
-            this.btn_locked.Size = new System.Drawing.Size(133, 33);
-            this.btn_locked.TabIndex = 3;
-            this.btn_locked.Text = "已锁定";
-            this.btn_locked.UseVisualStyleBackColor = false;
-            // 
-            // btn_reserved
-            // 
-            this.btn_reserved.BackColor = System.Drawing.Color.SkyBlue;
-            this.btn_reserved.Location = new System.Drawing.Point(356, 22);
-            this.btn_reserved.Name = "btn_reserved";
-            this.btn_reserved.Size = new System.Drawing.Size(133, 33);
-            this.btn_reserved.TabIndex = 2;
-            this.btn_reserved.Text = "已预约";
-            this.btn_reserved.UseVisualStyleBackColor = false;
-            // 
-            // btn_occupied
-            // 
-            this.btn_occupied.BackColor = System.Drawing.Color.Yellow;
-            this.btn_occupied.Location = new System.Drawing.Point(183, 22);
-            this.btn_occupied.Name = "btn_occupied";
-            this.btn_occupied.Size = new System.Drawing.Size(133, 33);
-            this.btn_occupied.TabIndex = 1;
-            this.btn_occupied.Text = "占用";
-            this.btn_occupied.UseVisualStyleBackColor = false;
-            // 
-            // btn_empty
-            // 
-            this.btn_empty.BackColor = System.Drawing.Color.White;
-            this.btn_empty.Location = new System.Drawing.Point(12, 22);
-            this.btn_empty.Name = "btn_empty";
-            this.btn_empty.Size = new System.Drawing.Size(133, 33);
-            this.btn_empty.TabIndex = 0;
-            this.btn_empty.Text = "空闲";
-            this.btn_empty.UseVisualStyleBackColor = false;
-            // 
-            // btn_clear
-            // 
-            this.btn_clear.BackColor = System.Drawing.Color.Orange;
-            this.btn_clear.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.btn_clear.Location = new System.Drawing.Point(1187, 22);
-            this.btn_clear.Name = "btn_clear";
-            this.btn_clear.Size = new System.Drawing.Size(133, 33);
-            this.btn_clear.TabIndex = 6;
-            this.btn_clear.Text = "一键清除";
-            this.btn_clear.UseVisualStyleBackColor = false;
-            this.btn_clear.Click += new System.EventHandler(this.btn_clear_Click);
-            // 
-            // FormParkSpaceStatus
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1574, 806);
-            this.Controls.Add(this.parkspaceStatusSamplePanel);
-            this.Controls.Add(this.ParkingSpaceMonitorPanel);
-            this.Name = "FormParkSpaceStatus";
-            this.Text = "FormParkSpaceStatus";
-            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormParkSpaceStatus_FormClosing);
-            this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormParkSpaceStatus_FormClosed);
-            this.parkspaceStatusSamplePanel.ResumeLayout(false);
-            this.ResumeLayout(false);
-
-        }
-
-        #endregion
-
-        private System.Windows.Forms.Panel ParkingSpaceMonitorPanel;
-        private System.Windows.Forms.Panel parkspaceStatusSamplePanel;
-        private System.Windows.Forms.Button btn_empty;
-        private System.Windows.Forms.Button btn_occupied;
-        private System.Windows.Forms.Button btn_reserved;
-        private System.Windows.Forms.Button btn_locked;
-        private System.Windows.Forms.Button btn_error;
-        private System.Windows.Forms.Button btn_unknown;
-        private System.Windows.Forms.Button btn_clear;
-    }
-}

+ 0 - 500
parkspace_manager/FormParkSpaceStatus.cs

@@ -1,500 +0,0 @@
-using Google.Protobuf;
-using Message;
-using parkMonitor.LOG;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace parkspace_manager
-{
-    public partial class FormParkSpaceStatus : Form
-    {
-        public static int s_spacesInRow = 18;
-        public static int s_floors = 13;
-        public static int s_rows = 1;
-        public static bool s_isClosing;
-        private static object s_map_update_lock;
-        private static object s_parkspace_force_update_queue_lock;
-        private static object s_parkspace_status_lock;
-        /// <summary>
-        /// 车位id与车位信息映射
-        /// </summary>
-        private Dictionary<int, Parkspace_info> m_idPssMap;
-        /// <summary>
-        /// 强制更新反馈消息队列,用于处理同时收到多个反馈消息的情况
-        /// </summary>
-        private Queue<Parkspace_force_update_response_msg> m_parkspace_force_update_response_queue;
-        /// <summary>
-        /// 当前所有车位状态,由界面更新线程主动更新
-        /// </summary>
-        Parkspace_allocation_data_msg m_parkspace_status;
-        Thread m_update_display_thread;
-
-        public FormParkSpaceStatus()
-        {
-            m_parkspace_status = new Parkspace_allocation_data_msg();
-            s_map_update_lock = new object();
-            s_parkspace_force_update_queue_lock = new object();
-            s_parkspace_status_lock = new object();
-            m_parkspace_force_update_response_queue = new Queue<Parkspace_force_update_response_msg>();
-            m_idPssMap = new Dictionary<int, Parkspace_info>();
-            s_isClosing = false;
-
-            InitializeComponent();
-
-            Communicator.Instance.Init();
-            Communicator.Instance.Bind("tcp://192.168.2.154:12333");
-            Communicator.Instance.Connect("tcp://192.168.2.127:30008");
-            Communicator.Instance.Connect("tcp://192.168.2.127:30000");
-            Communicator.Instance.SetParkspaceForceUpdateResponseDelegate(ParkspaceForceUpdateResponseCallback);
-
-            // 库位显示
-            m_update_display_thread = new Thread(new ThreadStart(UpdateParkingSpaceView));
-            m_update_display_thread.Start();
-        }
-
-        public void Uninit()
-        {
-            s_isClosing = true;
-            Communicator.Instance.Uninit();
-            //if(m_update_display_thread!=null)
-            //{
-            //    m_update_display_thread.Join();
-            //}
-        }
-
-        /// <summary>
-        /// 接收到强制更新车位反馈消息回调
-        /// </summary>
-        /// <param name="response"></param>
-        void ParkspaceForceUpdateResponseCallback(Parkspace_force_update_response_msg response)
-        {
-            lock (s_parkspace_force_update_queue_lock)
-            {
-                if (m_parkspace_force_update_response_queue != null)
-                {
-                    m_parkspace_force_update_response_queue.Enqueue(response);
-                }
-            }
-        }
-
-        /// <summary>
-        /// 更新立体停车位显示
-        /// </summary>
-        private void UpdateParkingSpaceView()
-        {
-            while (!s_isClosing)
-            {
-                bool needUpdate = false;
-                List<Parkspace_info> psList = null;
-                Thread.Sleep(1000);
-                bool get_status_result = Communicator.Instance.Get_parkspace_status(ref m_parkspace_status);
-                lock (s_parkspace_status_lock)
-                {
-                    if (get_status_result && (m_parkspace_status == null || m_parkspace_status.ParkspaceInfoEx == null))
-                    {
-                        get_status_result = false;
-                    }
-                }
-                if (!get_status_result)
-                {
-                    lock (s_map_update_lock)
-                    {
-                        m_idPssMap.Clear();
-                    }
-                    continue;
-                }
-                else
-                {
-                    lock (s_parkspace_status_lock)
-                    {
-                        psList = m_parkspace_status.ParkspaceInfoEx.ToList();
-                    }
-                }
-                if (psList == null || psList.Count <= 0)
-                {
-                    Thread.Sleep(1000);
-                    continue;
-                }
-                //更新映射表
-                try
-                {
-                    lock (s_map_update_lock)
-                    {
-                        if (m_idPssMap.Count != psList.Count)
-                        {
-                            m_idPssMap.Clear();
-                            for (int i = 0; i < psList.Count; i++)
-                            {
-                                m_idPssMap.Add(psList[i].ParkingspaceIndexId, psList[i]);
-                            }
-                        }
-                        else
-                        {
-                            for (int i = 0; i < psList.Count; i++)
-                            {
-                                m_idPssMap[psList[i].ParkingspaceIndexId] = psList[i];
-                            }
-                        }
-                    }
-                }
-                catch (Exception e) { Console.WriteLine(e.StackTrace); /*Log.WriteLog(LogType.process, LogFile.WARNING, "实时更新所有库位异常");*/ }
-                Action action = () =>
-                {
-                    int blockSize = s_spacesInRow * s_floors * s_rows;
-                    int offset = (s_rows + 1 - ((blockSize / s_spacesInRow) % s_rows)) * s_spacesInRow;
-                    //创建控件
-                    if (ParkingSpaceMonitorPanel != null && ParkingSpaceMonitorPanel.Controls.Count == 0 || needUpdate)
-                    {
-                        TableLayoutPanel tlp = new TableLayoutPanel();
-                        tlp.Name = "tlp_ParkingSpace";
-                        tlp.ColumnCount = s_rows;
-                        tlp.RowCount = 1;
-                        tlp.Dock = DockStyle.Fill;
-                        tlp.AutoScroll = true;
-                        tlp.BackColor = SystemColors.GradientActiveCaption;
-
-                        for (int i = 0; i < s_rows; i++)
-                        {
-                            TableLayoutPanel temp = new TableLayoutPanel();
-                            temp.Name = "tlp_ParkingSpaceSection" + (i + 1).ToString();
-                            temp.RowCount = s_floors;
-                            temp.ColumnCount = s_spacesInRow;
-                            temp.Dock = DockStyle.Fill;
-                            temp.AutoSize = true;
-                            temp.BackColor = SystemColors.GradientActiveCaption;
-                            temp.Margin = new Padding(1, 2, 1, 2);
-                            for (int j = Math.Max(psList.Count, blockSize) - 1; j >= 0; j--)
-                            {
-                                Button btn = new Button();
-                                btn.Anchor = (AnchorStyles.Top | AnchorStyles.Left);
-                                btn.AutoSize = true;
-                                btn.Location = new Point(5, 5);
-                                btn.Margin = new Padding(1, 2, 1, 2);
-                                btn.Padding = new Padding(5);
-                                btn.Name = "lb_parkingSpace" + j;
-                                btn.TextAlign = ContentAlignment.MiddleCenter;
-                                btn.MouseClick += new MouseEventHandler(Btnvalue_Click);
-                                btn.MouseHover += new EventHandler(Btnvalue_Mouse_Hover);
-                                if (((j + offset) / s_spacesInRow) % s_rows == i)
-                                {
-                                    if (j > psList.Count - 1)
-                                    {
-                                        btn.Text = "#####";
-                                        temp.Controls.Add(btn);
-                                        btn.BackColor = GetPSColor(Parkspace_status.EParkspaceError);
-                                    }
-                                    else
-                                    {
-                                        try
-                                        {
-                                            btn.Text = "车位" + psList[j].ParkingspaceIndexId;
-                                            btn.BackColor = GetPSColor(psList[j].ParkingspaceStatus);
-                                            temp.Controls.Add(btn);
-                                        }
-                                        catch { Log.WriteLog(LogType.process, LogFile.WARNING, "实时更新单一库位异常"); }
-                                    }
-                                }
-                            }
-                            tlp.Controls.Add(temp);
-                            //tlpList.Add(temp);
-                        }
-                        ParkingSpaceMonitorPanel.Controls.Clear();
-                        ParkingSpaceMonitorPanel.Controls.Add(tlp);
-                        needUpdate = false;
-                    }
-                    //更新控件
-                    else
-                    {
-                        Control.ControlCollection psCC = ParkingSpaceMonitorPanel.Controls;
-                        foreach (Control segment in psCC)
-                        {
-                            Control.ControlCollection segmentCC = segment.Controls;
-                            //Console.WriteLine("seg::"+segmentCC.Count);
-                            foreach (Control spaces in segmentCC)
-                            {
-                                Control.ControlCollection spaceCC = spaces.Controls;
-                                //Console.WriteLine("spaces::"+spaceCC.Count);
-                                foreach (Control space in spaceCC)
-                                {
-                                    if (space.GetType() == typeof(Button))
-                                    {
-                                        int index = -1;
-                                        bool result = int.TryParse(space.Text.Substring(2), out index);
-                                        lock (s_map_update_lock)
-                                        {
-                                            //Console.WriteLine("text is :" + space.Text+", index:"+index);
-                                            if (m_idPssMap.ContainsKey(index))
-                                            {
-                                                //Console.WriteLine("index:" + index+", status:"+ idPssMap[index].spaceStatus);
-                                                space.BackColor = GetPSColor(m_idPssMap[index].ParkingspaceStatus);
-                                            }
-                                            else if (result)
-                                            {
-                                                needUpdate = true;
-                                                //Console.WriteLine("need update:"+index);
-                                                break;
-                                            }
-                                        }
-                                    }
-                                }
-                            }
-                            if (needUpdate)
-                            {
-                                break;
-                            }
-                        }
-                    }
-                };
-                if (this != null && this.IsHandleCreated)
-                {
-                    this.Invoke(action);
-                }
-            }
-        }
-
-        /// <summary>
-        /// 按钮点击事件
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void Btnvalue_Click(object sender, MouseEventArgs e)
-        {
-            Button btn = (Button)sender;
-            //实例化窗口,选择待修改状态
-            FormStatusSelect formStatusSelect = new FormStatusSelect(btn);
-            formStatusSelect.Location = Control.MousePosition;
-            formStatusSelect.StartPosition = FormStartPosition.Manual;
-            formStatusSelect.SetCallback(ForceUpdateStatusCallback);
-            formStatusSelect.ShowDialog();
-        }
-
-        private void Btnvalue_Mouse_Hover(object sender, EventArgs e)
-        {
-            Button btn = (Button)sender;
-            // 创建the ToolTip 
-            ToolTip toolTip_parkspace_info = new ToolTip();
-
-            // 设置显示样式
-            toolTip_parkspace_info.AutoPopDelay = 20000;//提示信息的可见时间
-            toolTip_parkspace_info.InitialDelay = 500;//事件触发多久后出现提示
-            toolTip_parkspace_info.ReshowDelay = 1000;//指针从一个控件移向另一个控件时,经过多久才会显示下一个提示框
-            toolTip_parkspace_info.ShowAlways = false;//是否显示提示框
-
-            // 获取车位信息,处理后显示
-            int parkspaceID = GetParkspaceIdFromButton(btn);
-            Parkspace_info space_info = null;
-            lock (s_parkspace_status_lock)
-            {
-                if (parkspaceID <= 0 || m_parkspace_status == null || m_parkspace_status.ParkspaceInfoEx == null)
-                    return;
-                for (int i = 0; i < m_parkspace_status.ParkspaceInfoEx.Count; i++)
-                {
-                    if (m_parkspace_status.ParkspaceInfoEx[i].ParkingspaceIndexId == parkspaceID)
-                    {
-                        space_info = m_parkspace_status.ParkspaceInfoEx[i];
-                        break;
-                    }
-                }
-            }
-            if (space_info == null)
-                return;
-            //  设置伴随的对象
-            toolTip_parkspace_info.SetToolTip(btn, space_info.ToString().Replace(",", "\n"));//设置提示按钮和提示内容
-        }
-
-        /// <summary>
-        /// 定义用于发送修改请求,以及修改button状态的回调函数
-        /// </summary>
-        /// <param name="status"></param>
-        private void ForceUpdateStatusCallback(Parkspace_status status, Button btn)
-        {
-            int parkspaceID = GetParkspaceIdFromButton(btn);
-            lock(s_parkspace_status_lock)
-            {
-                if (parkspaceID <= 0 || m_parkspace_status == null || m_parkspace_status.ParkspaceInfoEx == null)
-                    return;
-            }
-            SendAndReceive(status, parkspaceID);
-        }
-
-        /// <summary>
-        /// 发送后接收对应反馈消息
-        /// </summary>
-        private void SendAndReceive(Parkspace_status status, int parkspaceID)
-        {
-            // 遍历强制更新反馈队列,清除对应车位已存在的反馈消息,即将非对应车位的消息放回队列
-            lock (s_parkspace_force_update_queue_lock)
-            {
-                for (int i = 0; i < m_parkspace_force_update_response_queue.Count; i++)
-                {
-                    Parkspace_force_update_response_msg response = m_parkspace_force_update_response_queue.Dequeue();
-                    if (response.ManualParkspaceInfoEx != null && response.ManualParkspaceInfoEx.Count > 0 && response.ManualParkspaceInfoEx[0].ParkingspaceIndexId != parkspaceID)
-                    {
-                        m_parkspace_force_update_response_queue.Enqueue(response);
-                    }
-                }
-            }
-            // 发送强制更新请求
-            Parkspace_info space_info = null;
-            lock (s_parkspace_status_lock)
-            {
-                //用于清除所有车位状态的特殊指令
-                if (parkspaceID == 9999)
-                {
-                    space_info = new Parkspace_info();
-                    if (m_parkspace_status.ParkspaceInfoEx.Count() > 0)
-                    {
-                        space_info = m_parkspace_status.ParkspaceInfoEx[0];
-                    }
-                    space_info.ParkingspaceIndexId = 9999;
-                }
-                else
-                {
-                    for (int i = 0; i < m_parkspace_status.ParkspaceInfoEx.Count; i++)
-                    {
-                        if (m_parkspace_status.ParkspaceInfoEx[i].ParkingspaceIndexId == parkspaceID)
-                        {
-                            space_info = m_parkspace_status.ParkspaceInfoEx[i];
-                            break;
-                        }
-                    }
-                }
-            }
-            DateTime startTime = DateTime.Now;
-            string commandKey = startTime.ToString("yyyy-MM-dd_HH:mm:ss:ffff");
-            try
-            {
-                space_info.ParkingspaceStatus = status;
-                Parkspace_force_update_request_msg parkspace_force_update_request_msg = new Parkspace_force_update_request_msg();
-                Base_info base_Info = new Base_info();
-                base_Info.MsgType = Message_type.EParkspaceForceUpdateRequestMsg;
-                base_Info.TimeoutMs = 2000;
-                base_Info.Sender = Message.Communicator.EParkspace;
-                base_Info.Receiver = Message.Communicator.EParkspace;
-                parkspace_force_update_request_msg.BaseInfo = base_Info;
-                parkspace_force_update_request_msg.CommandKey = commandKey;
-                parkspace_force_update_request_msg.ManualParkspaceInfoEx.Add(space_info);
-                Communicator.Instance.Send_msg(parkspace_force_update_request_msg.ToByteString());
-            }
-            catch (Exception ex) { Console.WriteLine(ex.StackTrace); }
-
-            // 遍历强制更新反馈队列,寻找对应反馈消息
-            bool get_result = false;
-            while ((DateTime.Now - startTime).TotalMilliseconds < Communicator.Instance.m_timeout_milli)
-            {
-                lock (s_parkspace_force_update_queue_lock)
-                {
-                    for (int i = 0; i < m_parkspace_force_update_response_queue.Count; i++)
-                    {
-                        Parkspace_force_update_response_msg response = m_parkspace_force_update_response_queue.Dequeue();
-                        if (response.ManualParkspaceInfoEx != null && response.ManualParkspaceInfoEx.Count > 0 && response.CommandKey == commandKey && response.ManualParkspaceInfoEx[0].ParkingspaceIndexId== parkspaceID)
-                        {
-                            get_result = true;
-                            if (response.ErrorManager != null)
-                            {
-                                if (response.ErrorManager.ErrorCode != 0)
-                                {
-                                    //btn.BackColor = GetPSColor(status);
-                                    Console.WriteLine("force update failed, code: " + response.ErrorManager.ErrorCode + ", description: " + response.ErrorManager.ErrorDescription);
-                                }
-                            }
-                            break;
-                        }
-                        else
-                        {
-                            m_parkspace_force_update_response_queue.Enqueue(response);
-                        }
-                    }
-                }
-                if (get_result)
-                    break;
-                Thread.Sleep(50);
-            }
-            if (!get_result && space_info != null)
-            {
-                MessageBox.Show("force update get response timeout: " + space_info.ToString());
-            }
-        }
-
-        /// <summary>
-        /// 通过按钮信息截取车位id,失败返回-1
-        /// </summary>
-        /// <param name="btn"></param>
-        /// <returns></returns>
-        private int GetParkspaceIdFromButton(Button btn)
-        {
-            if (btn == null || btn.Text.Length < 3)
-                return -1;
-            int parkspaceID = -1;
-            bool parse_result = int.TryParse(btn.Text.Substring(2), out parkspaceID);
-            if (parse_result)
-            {
-                return parkspaceID;
-            }
-            else
-            {
-                return -1;
-            }
-        }
-
-        /// <summary>
-        /// 获取状态对应颜色
-        /// </summary>
-        /// <param name="status"></param>
-        /// <returns></returns>
-        private Color GetPSColor(Parkspace_status status)
-        {
-            switch (status)
-            {
-                case Parkspace_status.EParkspaceEmpty: return Color.White;
-                case Parkspace_status.EParkspaceOccupied: return Color.Yellow;
-                case Parkspace_status.EParkspaceReserved: return Color.SkyBlue;
-                case Parkspace_status.EParkspaceLocked: return Color.LightGreen;
-                case Parkspace_status.EParkspaceError: return Color.Red;
-                default: return Color.Violet;
-            }
-        }
-
-        private void FormParkSpaceStatus_FormClosing(object sender, FormClosingEventArgs e)
-        {
-            e.Cancel = true;
-            this.Visible = false;
-        }
-
-        private void FormParkSpaceStatus_FormClosed(object sender, FormClosedEventArgs e)
-        {
-            try
-            {
-                if (m_update_display_thread != null)
-                {
-                    m_update_display_thread.Abort();
-                }
-            }
-            catch { Console.WriteLine("线程退出"); }
-            //s_isClosing = true;
-            ////if (m_update_display_thread != null)
-            ////{
-            ////    m_update_display_thread.Join();
-            ////}
-            //Communicator.Instance.Uninit();
-        }
-
-        /// <summary>
-        /// 一键清除所有号牌,车位全部设置空闲,调试用
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void btn_clear_Click(object sender, EventArgs e)
-        {
-            SendAndReceive(Parkspace_status.EParkspaceEmpty, 9999);
-        }
-    }
-}

+ 1 - 1
parkspace_manager/FormStatusSelect.Designer.cs

@@ -1,4 +1,4 @@
-namespace parkspace_manager
+namespace monitor_main_windows
 {
     partial class FormStatusSelect
     {

+ 21 - 5
parkspace_manager/FormStatusSelect.cs

@@ -9,7 +9,7 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 
-namespace parkspace_manager
+namespace monitor_main_windows
 {
     public partial class FormStatusSelect : Form
     {
@@ -57,8 +57,16 @@ namespace parkspace_manager
         {
             Task.Factory.StartNew(() => {
                 this.Invoke(new Action(()=> {
-                    Index2status(listBox_status.SelectedIndex);
-                    m_set_status_callback?.Invoke(m_selected_status, m_linked_btn);
+                    //检查执行者状态
+                    if (!Monitor_communication.Instance.check_connect())
+                    {
+                        MessageBox.Show("数据库未连接,请检查网络状态!");
+                    }
+                    else
+                    {
+                        Index2status(listBox_status.SelectedIndex);
+                        m_set_status_callback?.Invoke(m_selected_status, m_linked_btn);
+                    }
                     Close();
                 }));
             });
@@ -106,8 +114,16 @@ namespace parkspace_manager
         {
             Task.Factory.StartNew(() => {
                 this.Invoke(new Action(() => {
-                    Index2status(listBox_status.SelectedIndex);
-                    m_set_status_callback?.Invoke(m_selected_status, m_linked_btn);
+                    //检查执行者状态
+                    if (!Monitor_communication.Instance.check_connect())
+                    {
+                        MessageBox.Show("数据库未连接,请检查网络状态!");
+                    }
+                    else
+                    {
+                        Index2status(listBox_status.SelectedIndex);
+                        m_set_status_callback?.Invoke(m_selected_status, m_linked_btn);
+                    }
                     Close();
                 }));
             });

+ 47 - 0
parkspace_manager/LED.Designer.cs

@@ -0,0 +1,47 @@
+
+namespace monitor_main_windows
+{
+    partial class LED
+    {
+        /// <summary> 
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region 组件设计器生成的代码
+
+        /// <summary> 
+        /// 设计器支持所需的方法 - 不要修改
+        /// 使用代码编辑器修改此方法的内容。
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.SuspendLayout();
+            // 
+            // LED
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Name = "LED";
+            this.Size = new System.Drawing.Size(56, 68);
+            this.Load += new System.EventHandler(this.LED_Load);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+    }
+}

+ 471 - 0
parkspace_manager/LED.cs

@@ -0,0 +1,471 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace monitor_main_windows
+{
+    public partial class LED : UserControl
+    {
+        protected Color m_color = Color.DimGray;
+        public LED()
+        {
+
+            InitializeComponent();
+
+            #region 【1】设置双缓冲等属性
+
+            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
+            this.SetStyle(ControlStyles.DoubleBuffer, true);
+            this.SetStyle(ControlStyles.ResizeRedraw, true);
+            this.SetStyle(ControlStyles.Selectable, true);
+            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
+            this.SetStyle(ControlStyles.UserPaint, true);
+
+            timer.Enabled = true;
+            timer.Interval = 500;
+            timer.Tick += Timer_Tick;
+
+            #endregion
+
+        }
+
+        private void LED_Load(object sender, EventArgs e)
+        {
+
+        }
+
+        private void Timer_Tick(object sender, EventArgs e)
+        {
+
+            if(Statu==LED_Statu.Normal)
+            {
+                m_color = LedNormalColor;
+            }
+            if (Statu == LED_Statu.Error)
+            {
+                m_color = m_color == LampColor ? LedErrorColor : LampColor;
+            }
+            if (Statu == LED_Statu.Disconnected)
+            {
+                m_color = m_color == LampColor ? LedDisconnectedColor : LampColor;
+            }
+
+            this.Invalidate();
+
+        }
+
+        #region 【2】定义三个字段
+
+        private SolidBrush sb;
+
+        Timer timer = new Timer();
+
+        #endregion
+
+        #region 【3】添加一个设置Graphics的方法
+
+        /*private void SetGraphics(Graphics g)
+        {
+            //设置画布的属性
+            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
+            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
+
+            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
+            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
+        }*/
+
+        #endregion
+
+        #region 【4】根据实际控件分析的结果,创建属性
+
+        private string m_label = "控件";
+        [Category("text属性")]
+        [Description("")]
+        public string Label
+        {
+            get { return m_label; }
+            set
+            {
+                m_label = value;
+                Refresh();
+            }
+        }
+
+        public enum Font_Location
+        {
+            Top=0,
+            Bottom=1,
+            Left=2,
+            Right=3,
+        }
+        protected Font_Location m_font_location = Font_Location.Bottom;
+        [Category("字体位置属性")]
+        [Description("")]
+        public Font_Location FontLocation
+        {
+            get { return m_font_location; }
+            set
+            {
+                m_font_location = value;
+                Refresh();
+            }
+        }
+
+        protected bool font_horizontal = true;
+        [Category("字体位置属性")]
+        [Description("")]
+        public bool FontHorizontal
+        {
+            get { return font_horizontal; }
+            set
+            {
+                font_horizontal = value;
+                Refresh();
+            }
+        }
+
+        public enum LED_Statu
+        {
+            Normal=0,
+            Error,
+            Disconnected
+        }
+        protected LED_Statu m_led_statu = LED_Statu.Error;
+        public LED_Statu Statu
+        {
+            get { return m_led_statu; }
+            set
+            {
+                m_led_statu = value;
+                Refresh();
+            }
+        }
+
+        [Category("jason控件属性")]
+        [Description("TRUE的时候LED指示灯颜色")]
+        private Color m_ledNormalColor = Color.Green;
+        public Color LedNormalColor
+        {
+            get { return m_ledNormalColor; }
+            set
+            {
+                m_ledNormalColor = value;
+                this.Invalidate();
+            }
+        }
+
+        private Color m_ledErrorColor = Color.Red;
+
+        [Category("jason控件属性")]
+        [Description("False的时候LED指示灯颜色")]
+        public Color LedErrorColor
+        {
+            get { return m_ledErrorColor; }
+            set
+            {
+                m_ledErrorColor = value;
+                this.Invalidate();
+            }
+        }
+
+        private Color m_ledDisconnectedColor = Color.DimGray;
+
+        [Category("jason控件属性")]
+        [Description("False的时候LED指示灯颜色")]
+        public Color LedDisconnectedColor
+        {
+            get { return m_ledDisconnectedColor; }
+            set
+            {
+                m_ledDisconnectedColor = value;
+                this.Invalidate();
+            }
+        }
+
+
+        private Color m_lampColor = Color.Transparent;
+
+        [Category("jason控件属性")]
+        [Description("LED指示灯演示")]
+        public Color LampColor
+        {
+            get { return m_lampColor; }
+            set
+            {
+                m_lampColor = value;
+                this.Invalidate();
+            }
+        }
+
+        private bool isBorder = true;
+
+        [Category("jason控件属性")]
+        [Description("是否有边框")]
+        public bool IsBorder
+        {
+            get { return isBorder; }
+            set
+            {
+                isBorder = value;
+                this.Invalidate();
+            }
+        }
+
+        private int borderWidth = 5;
+
+        [Category("jason控件属性")]
+        [Description("圆环的宽度")]
+        public int BorderWidth
+        {
+            get { return borderWidth; }
+            set
+            {
+                borderWidth = value;
+                this.Invalidate();
+            }
+        }
+
+        
+        private bool isHighLight = true;
+
+        [Category("jason控件属性")]
+        [Description("是否高亮")]
+        public bool IsHighLight
+        {
+            get { return isHighLight; }
+            set
+            {
+                isHighLight = value;
+                this.Invalidate();
+            }
+        }
+
+        private Color centerColor = Color.White;
+
+        [Category("jason控件属性")]
+        [Description("渐变中心的颜色")]
+        public Color CenterColor
+        {
+            get { return centerColor; }
+            set
+            {
+                centerColor = value;
+                this.Invalidate();
+            }
+        }
+
+        private bool isFlash = true;
+
+        [Category("jason控件属性")]
+        [Description("是否闪烁")]
+        public bool IsFlash
+        {
+            get { return isFlash; }
+            set
+            {
+                isFlash = value;
+                this.Invalidate();
+            }
+        }
+
+        private int flashInterval = 500;
+
+        [Category("jason控件属性")]
+        [Description("闪烁的频率")]
+        public int FlashInterval
+        {
+            get { return flashInterval; }
+            set
+            {
+                flashInterval = value;
+                timer.Interval = flashInterval;//timer的时间间隔要放在这里
+                this.Invalidate();
+            }
+        }
+
+        
+
+        #endregion
+
+        #region 【5】创建重绘的事件
+
+        protected override void OnPaint(PaintEventArgs e)
+        {
+            base.OnPaint(e);
+            var g = e.Graphics;
+
+            g.SmoothingMode = SmoothingMode.AntiAlias;  //图片柔顺模式
+            g.InterpolationMode = InterpolationMode.HighQualityBicubic;//高质量
+            g.CompositingQuality = CompositingQuality.HighQuality;//  
+            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
+            //g.Clear(this.BackColor);
+            System.Drawing.SizeF sizeFont = g.MeasureString(Label, this.Font);
+            #region 1,画一个圆
+            int bord = 2;
+            int w1 = this.Width-2*bord ;
+            int w2 = this.Height - (int)sizeFont.Height - 2*bord;
+            int LEDWidth = Math.Min(w1, w2);
+            int cx = (this.Width - LEDWidth) / 2 + 1;
+            int cy = 1;
+
+            int txtX = (this.Width - (int)sizeFont.Width) / 2 + 1;
+            int txtY = Height  - (int)sizeFont.Height;
+
+            if (FontHorizontal == false)
+            {
+                w1 = this.Width-2*bord;
+                w2 = this.Height  - (int)sizeFont.Width - bord;
+                LEDWidth = Math.Min(w1, w2);
+
+                cx = (this.Width - LEDWidth) / 2 + 1;
+                cy = (this.Height - (int)sizeFont.Width - bord - LEDWidth) / 2 + 1;
+                txtX = (this.Width - (int)sizeFont.Height) / 2 + 1;
+                txtY = Height- (int)sizeFont.Width;
+            }
+            if (FontLocation == Font_Location.Top)
+            {
+                if (FontHorizontal==true)
+                {
+                    cy = (Height-(int)sizeFont.Height-bord)/2-LEDWidth/2+ (int)sizeFont.Height + bord;
+                    txtX = (this.Width - (int)sizeFont.Width) / 2 + 1;
+                    txtY = 1;
+                }
+                else
+                {
+                    w1 = this.Width-2*bord;
+                    w2 = this.Height -  (int)sizeFont.Width - 2*bord;
+                    LEDWidth = Math.Min(w1, w2);
+
+                    cx = (this.Width - LEDWidth) / 2 + 1;
+                    cy = (Height - (int)sizeFont.Width - bord) / 2 -LEDWidth/2+ (int)sizeFont.Width + bord;
+                    txtX = (this.Width - (int)sizeFont.Height) / 2 + 1;
+                    txtY = bord;
+                }
+            }
+            if(FontLocation==Font_Location.Left)
+            {
+                //横向
+                if (FontHorizontal==true)
+                {
+                    w1 = Width -   bord - (int)sizeFont.Width - bord;
+                    w2 = Height-2*bord ;
+                    LEDWidth = Math.Min(w1, w2);
+
+                    cx =  bord + (int)sizeFont.Width ;
+                    cy = (Height - LEDWidth) / 2 + 1;
+
+                    txtX = 1;
+                    txtY = (Height - (int)sizeFont.Height) / 2 + 1;
+                }
+                else
+                {
+                    //竖向
+                    w1 = Width -  bord - (int)sizeFont.Height;
+                    w2 = Height-2*bord;
+                    LEDWidth = Math.Min(w1, w2);
+                    cx =(Width-(int)sizeFont.Height-bord)/2-LEDWidth/2+ (int)sizeFont.Height+bord;
+                    cy = (Height-LEDWidth)/2+1 ;
+
+                    txtX = 1;
+                    txtY = (Height - (int)sizeFont.Width) / 2 + 1;
+                }
+            }
+            if (FontLocation == Font_Location.Right)
+            {
+                
+                //横向
+                if (FontHorizontal == true)
+                {
+                    w1 = Width - (int)sizeFont.Width - bord;
+                    w2 = Height-2*bord;
+                    LEDWidth = Math.Min(w1, w2);
+                    cx = (Width - (int)sizeFont.Width-LEDWidth)/2+1;
+                    cy = (Height-LEDWidth)/2+1 ;
+
+                    txtX = Width - (int)sizeFont.Width;
+                    txtY = (Height - (int)sizeFont.Height) / 2 + 1;
+                }
+                else
+                {
+                    //竖向
+                    w1 = Width  - (int)sizeFont.Height - bord;
+                    w2 = Height-2*bord;
+                    LEDWidth = Math.Min(w1, w2);
+                    cx = (Width - (int)sizeFont.Height - LEDWidth) / 2 + 1;
+                    cy = (Height - LEDWidth) / 2 + 1;
+
+                    txtX = Width - (int)sizeFont.Height;
+                    txtY = (Height - (int)sizeFont.Width) / 2 + 1;
+                }
+            }
+
+            if (LEDWidth <= 0 || cx < 0 || cy < 0)
+                return;
+
+            sb = new SolidBrush(m_color);
+            
+            RectangleF rec = new RectangleF(cx, cy, LEDWidth, LEDWidth);//创建矩形
+            g.DrawEllipse(new Pen(m_color), rec);
+            g.FillEllipse(sb, rec);//画圆
+
+            #endregion
+
+            #region 2,在圆里面画一个圆环
+
+            //如果有边框,那就画一个圆环
+           /* if (isBorder)//参数这里用字段或属性都可以,如果用属性,程序要都走一些判断的代码
+            {
+                p = new Pen(this.BackColor, borderWidth);//使用背景色
+                                                         //p = new Pen(Color.Red, borderWidth);
+                float x = 1 + gapWidth + borderWidth * 0.5f;
+                rec = new RectangleF(x+cx, x, LEDWidth - 2 * x, LEDWidth - 2 * x);
+                g.DrawEllipse(p, rec);//画圆环
+            }*/
+
+            #endregion
+
+            #region 3,渐变色绘制,是否高亮
+
+            if (isHighLight)
+            {
+                GraphicsPath gp = new GraphicsPath();
+                //float x = isBorder ? 1 + borderWidth : 1;//使用三元运算来判断,优化代码
+                //rec = new RectangleF(cx-LEDWidth/2, cy-LEDWidth/2, LEDWidth , LEDWidth);
+                gp.AddEllipse(rec);//把矩形添加到路径
+
+                //渐变色画刷,高亮
+                PathGradientBrush pgb = new PathGradientBrush(gp);//把路径传入
+
+                Color[] surroundColor = new Color[] { m_color };
+
+                pgb.CenterColor = this.centerColor;
+
+                //设置有多少组颜色来渐变
+                pgb.SurroundColors = surroundColor;
+                g.FillPath(pgb, gp);
+            }
+
+            #endregion
+            
+            if (FontHorizontal == false)
+            {
+                g.DrawString(Label, Font, new SolidBrush(Color.DodgerBlue),
+                          new Point(txtX, txtY),new StringFormat(StringFormatFlags.DirectionVertical));
+            }
+            else
+            {
+                g.DrawString(Label, Font, new SolidBrush(Color.DodgerBlue),
+                          new Point(txtX, txtY));
+            }
+        }
+
+        #endregion
+    }
+}

+ 120 - 0
parkspace_manager/LED.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 63 - 0
parkspace_manager/MainForm.Designer.cs

@@ -0,0 +1,63 @@
+namespace monitor_main_windows
+{
+    partial class MainForm
+    {
+        /// <summary>
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows 窗体设计器生成的代码
+
+        /// <summary>
+        /// 设计器支持所需的方法 - 不要修改
+        /// 使用代码编辑器修改此方法的内容。
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.button_open = new System.Windows.Forms.Button();
+            this.SuspendLayout();
+            // 
+            // button_open
+            // 
+            this.button_open.Location = new System.Drawing.Point(210, 113);
+            this.button_open.Margin = new System.Windows.Forms.Padding(2);
+            this.button_open.Name = "button_open";
+            this.button_open.Size = new System.Drawing.Size(100, 86);
+            this.button_open.TabIndex = 2;
+            this.button_open.Text = "打开窗口";
+            this.button_open.UseVisualStyleBackColor = true;
+            this.button_open.Click += new System.EventHandler(this.button_open_Click);
+            // 
+            // MainForm
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(543, 361);
+            this.Controls.Add(this.button_open);
+            this.Margin = new System.Windows.Forms.Padding(2);
+            this.Name = "MainForm";
+            this.Text = "MainForm";
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+        private System.Windows.Forms.Button button_open;
+    }
+}
+

+ 84 - 0
parkspace_manager/MainForm.cs

@@ -0,0 +1,84 @@
+using Google.Protobuf;
+using Newtonsoft.Json.Linq;
+using NNanomsg.Protocols;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using tool;
+
+namespace monitor_main_windows
+{
+    public partial class MainForm : Form
+    {
+        //Communicator com;
+        MonitorMainWindows MonitorMainWindows = null;
+        public MainForm()
+        {
+            InitializeComponent();
+        }
+
+
+        private void button_open_Click(object sender, EventArgs e)
+        {
+            MonitorMainWindows = new MonitorMainWindows();
+            MonitorMainWindows.Show();
+        }
+
+        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            MonitorMainWindows?.Uninit();
+
+        }
+
+        private void button1_MouseHover(object sender, EventArgs e)
+        {
+            Button btn = (Button)sender;
+            // 创建the ToolTip 
+            ToolTip toolTip1 = new ToolTip();
+
+            // 设置显示样式
+            toolTip1.AutoPopDelay = 5000;//提示信息的可见时间
+            toolTip1.InitialDelay = 500;//事件触发多久后出现提示
+            toolTip1.ReshowDelay = 500;//指针从一个控件移向另一个控件时,经过多久才会显示下一个提示框
+            toolTip1.ShowAlways = true;//是否显示提示框
+
+            //  设置伴随的对象.
+            toolTip1.SetToolTip(btn, "开始?");//设置提示按钮和提示内容
+        }
+
+        
+        //生成指定长度唯一码
+        public static string GetUniqueIdentifier(int length)
+        {
+            int maxSize = length;
+            char[] chars = new char[62];
+            string a;
+            a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
+            chars = a.ToCharArray();
+            int size = maxSize;
+            byte[] data = new byte[1];
+            var crypto = new RNGCryptoServiceProvider();
+            crypto.GetNonZeroBytes(data);
+            size = maxSize;
+            data = new byte[size];
+            crypto.GetNonZeroBytes(data);
+            var result = new StringBuilder(size);
+            foreach (byte b in data)
+            {
+                result.Append(chars[b % (chars.Length - 1)]);
+            }
+            if (result[0] >= '0' && result[0] <= '9')
+            {
+                return GetUniqueIdentifier(length);
+            }
+            return result.ToString();
+        }
+    }
+}

+ 120 - 0
parkspace_manager/MainForm.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 1 - 1
parkspace_manager/Monitor/Monitor.cs

@@ -4,7 +4,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace parkspace_manager.Monitor
+namespace monitor_main_windows.Monitor
 {
     class Monitor
     {

File diff suppressed because it is too large
+ 1811 - 0
parkspace_manager/MonitorMainWindows.Designer.cs


File diff suppressed because it is too large
+ 1193 - 0
parkspace_manager/MonitorMainWindows.cs


+ 120 - 0
parkspace_manager/MonitorMainWindows.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 4 - 2
parkspace_manager/Program.cs

@@ -1,10 +1,11 @@
 using System;
+using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 
-namespace parkspace_manager
+namespace monitor_main_windows
 {
     static class Program
     {
@@ -14,9 +15,10 @@ namespace parkspace_manager
         [STAThread]
         static void Main()
         {
+
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
-            Application.Run(new Form1());
+            Application.Run(new MainForm());
         }
     }
 }

+ 26 - 34
parkspace_manager/Properties/Resources.Designer.cs

@@ -1,69 +1,61 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     此代码由工具生成。
-//     运行时版本: 4.0.30319.42000
+//     运行时版本:4.0.30319.42000
 //
-//     对此文件的更改可能导致不正确的行为,如果
-//     重新生成代码,则所做更改将丢失。
+//     对此文件的更改可能导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
 // </auto-generated>
 //------------------------------------------------------------------------------
 
-namespace parkspace_manager.Properties
-{
-
-
+namespace parkspace_manager.Properties {
+    using System;
+    
+    
     /// <summary>
-    ///   强类型资源类,用于查找本地化字符串等。
+    ///   一个强类型资源类,用于查找本地化字符串等。
     /// </summary>
     // 此类是由 StronglyTypedResourceBuilder
     // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
-    // 若要添加或除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // 若要添加或除成员,请编辑 .ResX 文件,然后重新运行 ResGen
     // (以 /str 作为命令选项),或重新生成 VS 项目。
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    internal class Resources
-    {
-
+    internal class Resources {
+        
         private static global::System.Resources.ResourceManager resourceMan;
-
+        
         private static global::System.Globalization.CultureInfo resourceCulture;
-
+        
         [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
-        internal Resources()
-        {
+        internal Resources() {
         }
-
+        
         /// <summary>
-        ///   返回此类使用的缓存 ResourceManager 实例。
+        ///   返回此类使用的缓存 ResourceManager 实例。
         /// </summary>
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        internal static global::System.Resources.ResourceManager ResourceManager
-        {
-            get
-            {
-                if ((resourceMan == null))
-                {
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
                     global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("parkspace_manager.Properties.Resources", typeof(Resources).Assembly);
                     resourceMan = temp;
                 }
                 return resourceMan;
             }
         }
-
+        
         /// <summary>
-        ///   覆盖当前线程的 CurrentUICulture 属性
-        ///   使用此强类型资源类的资源查找。
+        ///   重写当前线程的 CurrentUICulture 属性,对
+        ///   使用此强类型资源类的所有资源查找执行重写
         /// </summary>
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        internal static global::System.Globalization.CultureInfo Culture
-        {
-            get
-            {
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
                 return resourceCulture;
             }
-            set
-            {
+            set {
                 resourceCulture = value;
             }
         }

+ 13 - 17
parkspace_manager/Properties/Settings.Designer.cs

@@ -1,28 +1,24 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
-//     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
 //
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
 // </auto-generated>
 //------------------------------------------------------------------------------
 
-namespace parkspace_manager.Properties
-{
-
-
+namespace parkspace_manager.Properties {
+    
+    
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
-    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
-    {
-
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+        
         private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
-        public static Settings Default
-        {
-            get
-            {
+        
+        public static Settings Default {
+            get {
                 return defaultInstance;
             }
         }

+ 52 - 0
parkspace_manager/StepControl.Designer.cs

@@ -0,0 +1,52 @@
+
+namespace monitor_main_windows
+{
+    partial class StepControl
+    {
+        /// <summary> 
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region 组件设计器生成的代码
+
+        /// <summary> 
+        /// 设计器支持所需的方法 - 不要修改
+        /// 使用代码编辑器修改此方法的内容。
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.components = new System.ComponentModel.Container();
+            this.toolTip = new System.Windows.Forms.ToolTip(this.components);
+            this.SuspendLayout();
+            // 
+            // StepControl
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Name = "StepControl";
+            this.Size = new System.Drawing.Size(316, 117);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        public System.Windows.Forms.ToolTip toolTip;
+    }
+}

+ 357 - 0
parkspace_manager/StepControl.cs

@@ -0,0 +1,357 @@
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Drawing.Drawing2D;
+
+namespace monitor_main_windows
+{
+    public partial class StepControl : UserControl
+    {
+
+        [Description("步骤更改事件"), Category("自定义")]
+        public event EventHandler IndexChecked;
+
+        private Color m_stepCompleteColor = Color.Green;
+        private Color m_stepRunningColor = Color.Yellow;
+        private Color m_stepWaitColor = Color.FromArgb(100, 100, 100);
+        private Color m_stepErrorColor = Color.Red;
+
+        private Timer m_timer = new Timer();
+        /// <summary>
+        /// 步骤背景色
+        /// </summary>
+        [Description("步骤等待色"), Category("自定义")]
+        public Color StepWaitColor
+        {
+            get { return m_stepWaitColor; }
+            set { m_stepWaitColor = value; }
+        }
+        [Description("步骤运行色"), Category("自定义")]
+        public Color StepRunningColor
+        {
+            get { return m_stepRunningColor; }
+            set { m_stepRunningColor = value; }
+        }
+        [Description("步骤完成色"), Category("自定义")]
+        public Color StepCompleteColor
+        {
+            get { return m_stepCompleteColor; }
+            set { m_stepCompleteColor = value; }
+        }
+        [Description("步骤故障色"), Category("自定义")]
+        public Color StepErrorColor
+        {
+            get { return m_stepErrorColor; }
+            set { m_stepErrorColor = value; }
+        }
+
+        private Color m_stepFontColor = Color.White;
+        /// <summary>
+        /// 步骤文字颜色
+        /// </summary>
+        [Description("步骤文字景色"), Category("自定义")]
+        public Color StepFontColor
+        {
+            get { return m_stepFontColor; }
+            set { m_stepFontColor = value; }
+        }
+
+
+        private string[] m_steps =  new string[] { /*"停车开始", "预定车位","搬运","确认车位","完成"*/ };
+        private string[] m_back_steps = new string[] { };
+
+         [Description("步骤"), Category("自定义")]
+         public string[] Steps
+         {
+             get { return m_steps; }
+             set
+             {
+                 if (m_steps == null )
+                     return;
+                 m_steps = value;
+                 Refresh();
+             }
+         }
+
+        [Description("回退步骤"), Category("自定义")]
+        public string[] BackSteps
+        {
+            get { return m_back_steps; }
+            set
+            {
+                if (m_back_steps == null)
+                    return;
+                m_back_steps = value;
+                Refresh();
+            }
+        }
+
+        private int m_stepIndex = 1;
+
+        private string m_label = "车牌:鄂A00000";
+        [Description("标题文字"), Category("自定义")]
+        public string Label
+        {
+            get { return m_label; }
+            set { m_label = value; }
+        }
+
+
+        [Description("步骤位置"), Category("自定义")]
+        public int StepIndex
+        {
+            get { return m_stepIndex; }
+            set
+            {
+                if (m_stepIndex > m_steps.Length+ m_back_steps.Length)
+                    return;
+                m_stepIndex = value;
+                Refresh();
+                if (IndexChecked != null)
+                {
+                    IndexChecked(this, null);
+                }
+            }
+        }
+
+        public StepControl()
+        {
+            InitializeComponent();
+            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
+            this.SetStyle(ControlStyles.DoubleBuffer, true);
+            this.SetStyle(ControlStyles.ResizeRedraw, true);
+            this.SetStyle(ControlStyles.Selectable, true);
+            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
+            this.SetStyle(ControlStyles.UserPaint, true);
+            this.BorderStyle = BorderStyle.FixedSingle;
+            m_timer.Enabled = true;
+            m_timer.Tick += Timer_Tick;
+            m_timer.Interval = 500;
+        }
+        private void Timer_Tick(object sender, EventArgs e)
+        {
+            m_stepRunningColor = m_stepRunningColor==Color.Green?Color.Yellow:Color.Green;
+            Refresh();
+        }
+        protected override void OnPaint(PaintEventArgs e)
+        {
+            base.OnPaint(e);
+            var g = e.Graphics;
+
+            if (BackSteps.Length == 0)
+                g.Clear(Color.PaleGreen);
+            else
+                g.Clear(Color.LightPink);
+            g.SmoothingMode = SmoothingMode.HighQuality;  //图片柔顺模式
+            g.InterpolationMode = InterpolationMode.HighQualityBicubic;//高质量
+            g.CompositingQuality = CompositingQuality.HighQuality;//
+
+            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
+
+            //g.SmoothingMode = SmoothingMode.AntiAlias;  //使绘图质量最高,即消除锯齿
+
+
+            int vertical_line = BackSteps.Length>0?20:0;
+            int step_w = 25;
+            System.Drawing.SizeF sizeFirst = g.MeasureString(m_steps[0], this.Font);
+            if (BackSteps.Length > 0)
+            {
+                System.Drawing.SizeF sizeBacKEnd = g.MeasureString(BackSteps[BackSteps.Length-1], this.Font);
+                if (sizeBacKEnd.Width > sizeFirst.Width)
+                    sizeFirst = sizeBacKEnd;
+            }
+
+            System.Drawing.SizeF sizeLabel = g.MeasureString(Label, this.Font);
+            int label_x = (Width - (int)sizeLabel.Width) / 2;
+            label_x = label_x >= 0 ? label_x : 0;
+            g.DrawString(Label, Font, new SolidBrush(m_stepCompleteColor), new Point(label_x, 3));
+
+
+            int y =  5 + (int)sizeFirst.Height;
+            if (y < 0)
+                y = 0;
+
+            int intTxtY = y + step_w + 3;
+            int intLeft = 3;
+            if (sizeFirst.Width > step_w)
+            {
+                intLeft = (int)(sizeFirst.Width - step_w) / 2 + 1;
+            }
+
+            int intRight = 3;
+
+            System.Drawing.SizeF sizeEnd = g.MeasureString(m_steps[m_steps.Length - 1], this.Font);
+            if(BackSteps.Length>0)
+            {
+                System.Drawing.SizeF sizeBacKFirst = g.MeasureString(BackSteps[0], this.Font);
+                if (sizeBacKFirst.Width > sizeEnd.Width)
+                    sizeEnd = sizeBacKFirst;
+            }
+
+            if (sizeEnd.Width > step_w)
+            {
+                intRight = (int)(sizeEnd.Width - step_w) / 2 + 1;
+            }
+
+            int intSplitWidth = 0;
+            intSplitWidth = (this.Width-intLeft - (m_steps.Length * step_w) - intRight) / (m_steps.Length - 1);
+            if (intSplitWidth < 10)
+                intSplitWidth = 10;
+
+            for (int i = 0; i < m_steps.Length; i++)
+            {
+                #region 画圆,横线
+                
+                g.FillEllipse(new SolidBrush(m_stepWaitColor), new Rectangle(new Point(intLeft + i * (step_w + intSplitWidth), y), new Size(step_w, step_w)));
+                
+                if (m_stepIndex > i)
+                {
+                    //存在回退步骤时, 最后一个表示错误
+                    if (m_back_steps.Length > 0 && i == m_steps.Length - 1)
+                    {
+                        g.FillEllipse(new SolidBrush(m_stepErrorColor),
+                            new Rectangle(new Point(intLeft + i * (step_w + intSplitWidth) + 2, y + 2),
+                            new Size(step_w - 4, step_w - 4)));
+                    }
+                    else
+                    {
+                        g.FillEllipse(new SolidBrush(m_stepCompleteColor),
+                            new Rectangle(new Point(intLeft + i * (step_w + intSplitWidth) + 2, y + 2),
+                            new Size(step_w - 4, step_w - 4)));
+                    }
+                    if (i != m_steps.Length - 1)
+                    {
+
+                        if (m_stepIndex == i + 1)
+                        {
+                            //当前步骤运行中闪烁,完成绿色
+
+                            g.FillEllipse(new SolidBrush(m_stepRunningColor),
+                                  new Rectangle(new Point(intLeft + i * (step_w + intSplitWidth) + 2, y + 2),
+                                   new Size(step_w - 4, step_w - 4)));
+                            g.DrawLine(new Pen(m_stepWaitColor, 2), new Point(intLeft + i * (step_w + intSplitWidth) + step_w, y + (step_w / 2)), 
+                                new Point(intLeft + (i+1) * (step_w + intSplitWidth) , y + (step_w / 2)));
+                        }
+                        else
+                        {
+                            g.DrawLine(new Pen(m_stepCompleteColor, 2), new Point(intLeft + i * (step_w + intSplitWidth) + step_w, y + (step_w / 2)),
+                                new Point(intLeft + (i+1) * (step_w + intSplitWidth) , y + (step_w / 2)));
+                        }
+                    }
+                   
+                }
+                else
+                {
+                    if (i != m_steps.Length - 1)
+                    {
+                        g.DrawLine(new Pen(m_stepWaitColor, 2), new Point(intLeft + i * (step_w + intSplitWidth) + step_w, y + (step_w / 2)), 
+                            new Point(intLeft + (i+1) * (step_w + intSplitWidth) , y + (step_w / 2)));
+                    }
+                }
+
+                System.Drawing.SizeF _numSize = g.MeasureString((i + 1).ToString(), this.Font);
+                g.DrawString((i + 1).ToString(), Font, new SolidBrush(m_stepFontColor), 
+                    new Point(intLeft + i * (step_w + intSplitWidth) + (step_w - (int)_numSize.Width) / 2 , y + (step_w - (int)_numSize.Height) / 2 + 1));
+                #endregion
+
+                System.Drawing.SizeF sizeTxt = g.MeasureString(m_steps[i], this.Font);
+                g.DrawString(m_steps[i], Font, new SolidBrush(m_stepIndex > i ? m_stepCompleteColor : m_stepWaitColor), 
+                    new Point(intLeft + i * (step_w + intSplitWidth) + (step_w - (int)sizeTxt.Width) / 2 , intTxtY));
+
+
+            }
+            //绘制回退
+            if (m_back_steps.Length > 0)
+            {
+                int winHeight = step_w * 2 + vertical_line + 20 + 3 * (int)sizeFirst.Height;
+                if (Height < winHeight)
+                    Height = winHeight;
+                
+                int by = intTxtY + (int)sizeFirst.Height + vertical_line;
+                int brx = intLeft + (m_steps.Length - 1) * (step_w + intSplitWidth);
+
+                int back_step_index = m_stepIndex - m_steps.Length;
+                back_step_index = back_step_index >= 0 ? back_step_index : 0;
+                if (back_step_index > 0)
+                {
+                    g.DrawLine(new Pen(m_stepCompleteColor, 2), new Point(brx + step_w / 2, by - vertical_line),
+                        new Point(brx + step_w / 2, by));
+                }
+                else
+                {
+                    g.DrawLine(new Pen(m_stepWaitColor, 2), new Point(brx + step_w / 2, by - vertical_line),
+                       new Point(brx + step_w / 2, by));
+                }
+
+               
+                
+                for (int i = 0; i < m_back_steps.Length; i++)
+                {
+                    g.FillEllipse(new SolidBrush(m_stepWaitColor),
+                         new Rectangle(new Point(brx - i * (step_w + intSplitWidth), by),
+                         new Size(step_w, step_w)));
+                    if (back_step_index > i)
+                    {
+                        if (back_step_index == i + 1)
+                        {
+                            //当前步骤运行中闪烁,完成绿色
+                            g.FillEllipse(new SolidBrush(m_stepRunningColor),
+                             new Rectangle(new Point(brx - i * (step_w + intSplitWidth) + 2, by + 2),
+                             new Size(step_w - 4, step_w - 4)));
+
+                        }
+                        else
+                        {
+                            g.FillEllipse(new SolidBrush(m_stepCompleteColor),
+                            new Rectangle(new Point(brx - i * (step_w + intSplitWidth) + 2, by + 2),
+                            new Size(step_w - 4, step_w - 4)));
+                        }
+
+                        if (i != m_back_steps.Length - 1)
+                        {
+                            if (back_step_index == i + 1)
+                            {
+                                g.DrawLine(new Pen(m_stepWaitColor, 2),
+                                    new Point(brx - i * (step_w + intSplitWidth), by + (step_w / 2)),
+                                    new Point(brx - (i + 1) * (step_w + intSplitWidth), by + (step_w / 2)));
+                            }
+                            else
+                            {
+                                g.DrawLine(new Pen(m_stepCompleteColor, 2),
+                                    new Point(brx - i * (step_w + intSplitWidth), by + (step_w / 2)),
+                                    new Point(brx - (i + 1) * (step_w + intSplitWidth), by + (step_w / 2)));
+                            }
+                        }
+                    }
+                    else
+                    {
+                        if (i != m_back_steps.Length - 1)
+                        {
+                            g.DrawLine(new Pen(m_stepWaitColor, 2), new Point(brx - i * (step_w + intSplitWidth), by + (step_w / 2)),
+                                new Point(brx - (i + 1) * (step_w + intSplitWidth), by + (step_w / 2)));
+                        }
+                    }
+
+                    System.Drawing.SizeF _numSize = g.MeasureString((i + 1).ToString(), this.Font);
+                    g.DrawString((m_steps.Length + i + 1).ToString(), Font, new SolidBrush(m_stepFontColor),
+                        new Point(brx - i * (step_w + intSplitWidth) + step_w / 2 - (int)_numSize.Width / 2, by + (step_w - (int)_numSize.Height) / 2 + 1));
+
+
+                    System.Drawing.SizeF sizeTxt = g.MeasureString(m_back_steps[i], this.Font);
+                    g.DrawString(m_back_steps[i], Font, new SolidBrush(back_step_index > i ? m_stepCompleteColor : m_stepWaitColor),
+                        new Point(brx - i * (step_w + intSplitWidth) + (step_w - (int)sizeTxt.Width) / 2 + 1, by + step_w + (int)sizeTxt.Height / 2 + 1));
+
+
+                }
+            }
+
+
+        }
+
+    }
+}

+ 123 - 0
parkspace_manager/StepControl.resx

@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+</root>

+ 52 - 0
parkspace_manager/TimedData.cs

@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace monitor_main_windows
+{
+    public class TimedData<Data_type>
+    {
+        private Data_type m_data;
+        private DateTime m_time_point;
+        private double m_time_out_ms = 3000;
+        private object m_lock = new object();
+        public TimedData(Data_type data)
+        {
+            m_data = data;
+            m_time_point = DateTime.Now;
+        }
+        public static implicit operator TimedData<Data_type>(Data_type data)
+        {
+            
+            return new TimedData<Data_type>(data);
+        }
+
+        public bool IsTimeout()
+        {
+            DateTime time = DateTime.Now;
+            if((time-m_time_point).TotalMilliseconds> m_time_out_ms)
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public Data_type Value
+        {
+            get
+            {
+                return m_data;
+            }
+        }
+        public void Set_timeout_ms(int ms=1000)
+        {
+            lock (m_lock)
+            {
+                m_time_out_ms = ms;
+            }
+        }
+    }
+}

+ 194 - 0
parkspace_manager/UIMessageData.cs

@@ -0,0 +1,194 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Collections.Concurrent;
+namespace monitor_main_windows
+{
+    class UIMessageData
+    {
+        public enum NodeStatu
+        {
+            Normal=0,
+            Error
+        }
+
+        private TimedData<NodeStatu> m_lidar_statu_A1 = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_lidar_statu_A2 = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_lidar_statu_B1 = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_lidar_statu_B2 = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_lidar_statu_C1 = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_lidar_statu_C2 = new TimedData<NodeStatu>(NodeStatu.Normal);
+
+        private TimedData<NodeStatu> m_terminal_statu_A1 = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_terminal_statu_A2 = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_terminal_statu_B1 = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_terminal_statu_B2 = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_terminal_statu_C1 = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_terminal_statu_C2 = new TimedData<NodeStatu>(NodeStatu.Normal);
+
+        private TimedData<NodeStatu> m_PLC_statu_A = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_PLC_statu_B = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_PLC_statu_C = new TimedData<NodeStatu>(NodeStatu.Normal);
+
+        private TimedData<NodeStatu> m_main_node_statu = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_database_node_statu = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_output_terminal_node1_statu = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_output_terminal_node2_statu = new TimedData<NodeStatu>(NodeStatu.Normal);
+        private TimedData<NodeStatu> m_output_unnormilized_statu = new TimedData<NodeStatu>(NodeStatu.Normal);
+
+        public class CommandInfo
+        {
+            public CommandInfo() { }
+            public CommandInfo(string[] steps,string[] backsteps,int index)
+            {
+                Steps = steps;
+                BackSteps = backsteps;
+                StepIndex = index;
+            }
+            public string[] Steps;
+            public string[] BackSteps;
+            public int StepIndex = 0;
+        }
+        //控件label为string内容
+        private ConcurrentDictionary<string, TimedData<CommandInfo>> m_command_map = 
+            new ConcurrentDictionary<string, TimedData<CommandInfo>>();
+        class Nested
+        {
+            // 创建模板类实例,参数2设为true表示支持私有构造函数
+            internal static readonly UIMessageData instance = Activator.CreateInstance(typeof(UIMessageData), true) as UIMessageData;
+        }
+      
+        private static UIMessageData instance = null;
+       
+        public static UIMessageData Instance
+        {
+            get
+            {
+                return Nested.instance;
+            }
+        }
+        private UIMessageData()
+        {
+        }
+
+        #region  雷达节点状态
+        public TimedData<NodeStatu> LidarStatuA1
+        {
+            get { return m_lidar_statu_A1; }
+            set { m_lidar_statu_A1 = value; }
+        }
+        public TimedData<NodeStatu> LidarStatuA2
+        {
+            get { return m_lidar_statu_A2; }
+            set { m_lidar_statu_A2 = value; }
+        }
+        public TimedData<NodeStatu> LidarStatuB1
+        {
+            get { return m_lidar_statu_B1; }
+            set { m_lidar_statu_B1 = value; }
+        }
+        public TimedData<NodeStatu> LidarStatuB2
+        {
+            get { return m_lidar_statu_B2; }
+            set { m_lidar_statu_B2 = value; }
+        }
+        public TimedData<NodeStatu> LidarStatuC1
+        {
+            get { return m_lidar_statu_C1; }
+            set { m_lidar_statu_C1 = value; }
+        }
+        public TimedData<NodeStatu> LidarStatuC2
+        {
+            get { return m_lidar_statu_C2; }
+            set { m_lidar_statu_C2 = value; }
+        }
+        #endregion
+
+        #region 终端节点状态
+
+        public TimedData<NodeStatu> TerminalStatuA1
+        {
+            get { return m_terminal_statu_A1; }
+            set { m_terminal_statu_A1 = value; }
+        }
+        public TimedData<NodeStatu> TerminalStatuA2
+        {
+            get { return m_terminal_statu_A2; }
+            set { m_terminal_statu_A2 = value; }
+        }
+        public TimedData<NodeStatu> TerminalStatuB1
+        {
+            get { return m_terminal_statu_B1; }
+            set { m_terminal_statu_B1 = value; }
+        }
+        public TimedData<NodeStatu> TerminalStatuB2
+        {
+            get { return m_terminal_statu_B2; }
+            set { m_terminal_statu_B2 = value; }
+        }
+        public TimedData<NodeStatu> TerminalStatuC1
+        {
+            get { return m_terminal_statu_C1; }
+            set { m_terminal_statu_C1 = value; }
+        }
+        public TimedData<NodeStatu> TerminalStatuC2
+        {
+            get { return m_terminal_statu_C2; }
+            set { m_terminal_statu_C2 = value; }
+        }
+        #endregion
+
+        #region  PLC状态
+        public TimedData<NodeStatu> PLCStatuA
+        {
+            get { return m_PLC_statu_A; }
+            set { m_PLC_statu_A = value; }
+        }
+        public TimedData<NodeStatu> PLCStatuB
+        {
+            get { return m_PLC_statu_B; }
+            set { m_PLC_statu_B = value; }
+        }
+        public TimedData<NodeStatu> PLCStatuC
+        {
+            get { return m_PLC_statu_C; }
+            set { m_PLC_statu_C = value; }
+        }
+
+        #endregion
+
+        public TimedData<NodeStatu> MainNodeStatu
+        {
+            get { return m_main_node_statu; }
+            set { m_main_node_statu = value; }
+        }
+        public TimedData<NodeStatu> DatabaseNodeStatu
+        {
+            get { return m_database_node_statu; }
+            set { m_database_node_statu = value; }
+        }
+        public TimedData<NodeStatu> OutputTerminal1Statu
+        {
+            get { return m_output_terminal_node1_statu; }
+            set { m_output_terminal_node1_statu = value; }
+        }
+        public TimedData<NodeStatu> OutputTerminal2Statu
+        {
+            get { return m_output_terminal_node2_statu; }
+            set { m_output_terminal_node2_statu = value; }
+        }
+        public TimedData<NodeStatu> OutputUnnormalNodeStatu
+        {
+            get { return m_output_unnormilized_statu; }
+            set { m_output_unnormilized_statu = value; }
+        }
+
+        public ConcurrentDictionary<string, TimedData<CommandInfo>>  CommandMap
+        {
+            get { return m_command_map; }
+        }
+
+    }
+}

+ 0 - 433
parkspace_manager/communication/Communicator.cs

@@ -1,433 +0,0 @@
-using NNanomsg;
-using NNanomsg.Protocols;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Google.Protobuf;
-using Message;
-
-namespace parkspace_manager
-{
-    class Communicator
-    {
-        // 各类消息委托,收到对应消息即调用对应委托/回调
-        public delegate void parkspaceStatusDelegate(Parkspace_allocation_data_msg parkspace_status);
-        public delegate void parkspaceForceUpdateResponseDelegate(Parkspace_force_update_response_msg response);
-        // 对应委托/回调句柄
-        private parkspaceStatusDelegate m_parkspaceStatusCallback;
-        private parkspaceForceUpdateResponseDelegate m_parkspaceForceUpdateResponseCallback;
-        // 对应委托/回调句柄设置函数
-        public void SetParkspaceStatusDelegate(parkspaceStatusDelegate callback)
-        {
-            m_parkspaceStatusCallback = callback;
-        }
-        public void SetParkspaceForceUpdateResponseDelegate(parkspaceForceUpdateResponseDelegate callback)
-        {
-            m_parkspaceForceUpdateResponseCallback = callback;
-        }
-
-        /// <summary>
-        /// 消息超时时间
-        /// </summary>
-        public int m_timeout_milli = 2000;
-        /// <summary>
-        /// 单例锁对象
-        /// </summary>
-        private readonly static object lockObj = new object();
-        /// <summary>
-        /// 单例
-        /// </summary>
-        private static Communicator instance = null;
-        /// <summary>
-        /// 接收解析锁
-        /// </summary>
-        private object m_receive_lock;
-        /// <summary>
-        /// 发送锁
-        /// </summary>
-        private object m_send_lock;
-        /// <summary>
-        /// 车位状态访问锁
-        /// </summary>
-        private object m_parkspace_status_access_lock;
-        /// <summary>
-        /// 车位消息队列
-        /// </summary>
-        private Parkspace_allocation_data_msg m_parkspace_current_status;
-        /// <summary>
-        /// 当前时间
-        /// </summary>
-        private DateTime m_last_parkspace_status_time;
-        /// <summary>
-        /// 发送队列
-        /// </summary>
-        private Queue<ByteString> m_send_queue;
-        /// <summary>
-        /// 接收队列
-        /// </summary>
-        private Queue<ByteString> m_receive_queue;
-        /// <summary>
-        /// 发送线程
-        /// </summary>
-        private Thread m_thread_send;
-        /// <summary>
-        /// 接收线程
-        /// </summary>
-        private Thread m_thread_receive;
-        /// <summary>
-        /// 解析接收string到protobuf消息
-        /// </summary>
-        private Thread m_thread_decode_receive;
-        /// <summary>
-        /// nanomsg 通信句柄
-        /// </summary>
-        private BusSocket m_socket;
-        /// <summary>
-        /// nnxx生成id队列
-        /// </summary>
-        private Queue<NanomsgEndpoint> nanomsgEndpoints_queue;
-        /// <summary>
-        /// 实例退出标记
-        /// </summary>
-        public bool mb_exit;
-        /// <summary>
-        /// 初始化标记
-        /// </summary>
-        public bool mb_initialized;
-
-        /// <summary>
-        /// 构造函数
-        /// </summary>
-        /// <param name="server_ip"></param>
-        /// <param name="server_port"></param>
-        private Communicator()
-        {
-            mb_exit = false;
-            mb_initialized = false;
-            m_receive_lock = new object();
-            m_send_lock = new object();
-            m_parkspace_status_access_lock = new object();
-            m_receive_queue = new Queue<ByteString>();
-            m_send_queue = new Queue<ByteString>();
-            m_parkspace_current_status = new Parkspace_allocation_data_msg();
-            nanomsgEndpoints_queue = new Queue<NanomsgEndpoint>();
-        }
-
-        /// <summary>
-        /// 析构函数
-        /// </summary>
-        ~Communicator()
-        {
-            mb_exit = true;
-            if (m_thread_send != null)
-            {
-                m_thread_send.Abort();
-            }
-            if (m_thread_receive != null)
-            {
-                m_thread_receive.Abort();
-            }
-            if (m_thread_decode_receive != null)
-                m_thread_decode_receive.Abort();
-        }
-
-        /// <summary>
-        /// 单例访问
-        /// </summary>
-        public static Communicator Instance
-        {
-            get
-            {
-                if (instance == null)
-                {
-                    lock (lockObj)
-                    {
-                        if (instance == null)
-                        {
-                            instance = new Communicator();
-                        }
-                    }
-                }
-                return instance;
-            }
-        }
-
-        /// <summary>
-        /// 初始化
-        /// </summary>
-        /// <returns></returns>
-        public bool Init()
-        {
-            try
-            {
-                if (!mb_initialized)
-                {
-                    mb_exit = false;
-                    mb_initialized = true;
-                    m_socket = new BusSocket();
-                    m_thread_receive = new Thread(new ParameterizedThreadStart(Receive_thread_function));
-                    m_thread_send = new Thread(new ParameterizedThreadStart(Send_thread_function));
-                    m_thread_decode_receive = new Thread(new ParameterizedThreadStart(Decode_thread_function));
-                    m_thread_receive.Start(this);
-                    m_thread_send.Start(this);
-                    m_thread_decode_receive.Start(this);
-                    // 设置车位状态回调
-                    SetParkspaceStatusDelegate(ParkspaceStatusUpdate);
-
-                    // 设置车位刷新线程
-                    Task.Factory.StartNew(()=> {
-                        while (!mb_exit)
-                        {
-                            Parkspace_refresh_request_msg t_refresh_req = new Parkspace_refresh_request_msg();
-                            t_refresh_req.BaseInfo = new Base_info();
-                            t_refresh_req.BaseInfo.MsgType = Message_type.EParkspaceAllocationDataMsg;
-                            t_refresh_req.BaseInfo.TimeoutMs = 5000;
-                            t_refresh_req.BaseInfo.Sender = Message.Communicator.EEmpty;
-                            t_refresh_req.BaseInfo.Receiver = Message.Communicator.EParkspace;
-                            Send_msg(t_refresh_req.ToByteString());
-                            Thread.Sleep(1000 * 5);
-                        }
-                    });
-                    return true;
-                }
-                else
-                {
-                    return false;
-                }
-            }
-            catch (Exception ex) { Console.WriteLine(ex.StackTrace); return false; }
-        }
-
-        /// <summary>
-        /// 反初始化
-        /// </summary>
-        /// <returns></returns>
-        public bool Uninit()
-        {
-            mb_exit = true;
-            if (m_thread_receive != null)
-                m_thread_receive.Join();
-            if (m_thread_send != null)
-                m_thread_send.Join();
-            if (m_thread_decode_receive != null)
-                m_thread_decode_receive.Join();
-            if(m_socket!=null)
-            {
-                while(nanomsgEndpoints_queue.Count>0)
-                {
-                    NanomsgEndpoint nnep = nanomsgEndpoints_queue.Dequeue();
-                    m_socket.Shutdown(nnep);
-                }
-                m_socket.Dispose();
-            }
-            mb_initialized = false;
-            return true;
-        }
-
-        /// <summary>
-        /// 连接
-        /// </summary>
-        /// <param name="server_address"></param>
-        /// <returns></returns>
-        public bool Connect(string server_address)
-        {
-            if (m_socket == null)
-                return false;
-            NanomsgEndpoint end_point = m_socket.Connect(server_address);
-            nanomsgEndpoints_queue.Enqueue(end_point);
-            return true;
-        }
-
-        /// <summary>
-        /// 绑定本地端口监听
-        /// </summary>
-        /// <param name="self_address"></param>
-        /// <returns></returns>
-        public bool Bind(string self_address)
-        {
-            if (m_socket == null)
-                return false;
-            NanomsgEndpoint end_point = m_socket.Bind(self_address);
-            nanomsgEndpoints_queue.Enqueue(end_point);
-            return true;
-        }
-
-        /// <summary>
-        /// 车位更新回调内部定义
-        /// </summary>
-        /// <param name="parkspace_status"></param>
-        private void ParkspaceStatusUpdate(Parkspace_allocation_data_msg parkspace_status)
-        {
-            lock (m_parkspace_status_access_lock)
-            {
-                m_parkspace_current_status = parkspace_status;
-                //comm.m_parkspace_current_status.MergeFrom(parkspace_status);
-                m_last_parkspace_status_time = DateTime.Now;
-            }
-        }
-
-        /// <summary>
-        /// 获取当前车位状态
-        /// </summary>
-        public bool Get_parkspace_status(ref Parkspace_allocation_data_msg msg)
-        {
-            lock (m_parkspace_status_access_lock)
-            {
-                msg = new Parkspace_allocation_data_msg();
-                msg.MergeFrom(m_parkspace_current_status);
-            }
-            if ((DateTime.Now - m_last_parkspace_status_time).Milliseconds > m_timeout_milli)
-            {
-                return false;
-            }
-            else
-            {
-                return true;
-            }
-        }
-
-        /// <summary>
-        /// 发送手动更新车位消息
-        /// </summary>
-        /// <returns></returns>
-        public bool Send_msg(ByteString bs)
-        {
-            lock(m_send_lock)
-            {
-                m_send_queue.Enqueue(bs);
-            }
-            return true;
-        }
-
-        /// <summary>
-        /// 接收线程函数
-        /// </summary>
-        /// <param name="handle"></param>
-        private static void Receive_thread_function(object handle)
-        {
-            if (handle == null)
-                return;
-            Communicator comm = (Communicator)handle;
-            while (!comm.mb_exit)
-            {
-                try
-                {
-                    if (!comm.mb_initialized || comm.m_socket == null)
-                        continue;
-                    byte[] data = comm.m_socket.ReceiveImmediate();
-                    if (data != null && data.Length > 0 && comm.m_receive_queue != null)
-                    {
-                        lock (comm.m_receive_lock)
-                        {
-                            //ByteString tmp = ByteString.CopyFrom(data);
-                            //Base_msg base_msg = Base_msg.Parser.ParseFrom(tmp);
-                            //Console.WriteLine(base_msg.ToString());
-                            //Console.WriteLine("msg received");
-                            comm.m_receive_queue.Enqueue(ByteString.CopyFrom(data));
-                        }
-                    }
-                }
-                catch (Exception ex) { Console.WriteLine(ex.StackTrace); }
-                Thread.Sleep(50);
-            }
-            Console.WriteLine("receive thread exit");
-        }
-
-        /// <summary>
-        /// 发送线程函数
-        /// </summary>
-        /// <param name="handle"></param>
-        private static void Send_thread_function(object handle)
-        {
-            if (handle == null)
-                return;
-            Communicator comm = (Communicator)handle;
-            while (!comm.mb_exit)
-            {
-                try
-                {
-                    if (!comm.mb_initialized || comm.m_socket == null)
-                        continue;
-                    lock (comm.m_send_lock)
-                    {
-                        while (comm.m_send_queue.Count > 0)
-                        {
-                            ByteString bs = comm.m_send_queue.Dequeue();
-                            comm.m_socket.Send(bs.ToByteArray());
-                        }
-                    }
-                    //Console.WriteLine("msg sent");
-                }
-                catch (Exception ex) { Console.WriteLine(ex.StackTrace); }
-                Thread.Sleep(50);
-            }
-            Console.WriteLine("send thread exit");
-        }
-
-        /// <summary>
-        /// 解析线程函数
-        /// </summary>
-        /// <param name="handle"></param>
-        private static void Decode_thread_function(object handle)
-        {
-            if (handle == null)
-                return;
-            Communicator comm = (Communicator)handle;
-            while (!comm.mb_exit)
-            {
-                try
-                {
-                    DateTime current_time = DateTime.Now;
-
-                    if (!comm.mb_initialized)
-                        continue;
-                    ByteString msg_str = null;
-                    lock (comm.m_receive_lock)
-                    {
-                        if (comm.m_receive_queue.Count > 0)
-                        {
-                            msg_str = comm.m_receive_queue.Dequeue();
-                        }
-                    }
-                    // 解析
-                    comm.Decode_msg(msg_str);
-                    //Console.WriteLine("msg parsed");
-                }
-                catch (Exception ex) { Console.WriteLine(ex.StackTrace); }
-                Thread.Sleep(50);
-            }
-            Console.WriteLine("decode thread exit");
-        }
-
-        /// <summary>
-        /// 解析string到protobuf消息
-        /// </summary>
-        private void Decode_msg(ByteString msg)
-        {
-            if (msg == null)
-                return;
-            Base_msg base_msg = Base_msg.Parser.ParseFrom(msg);
-            //Console.WriteLine(base_msg.ToString());
-            switch(base_msg.BaseInfo.MsgType)
-            {
-                case Message_type.EParkspaceAllocationDataMsg:
-                    Parkspace_allocation_data_msg parkspace_status_msg = Parkspace_allocation_data_msg.Parser.ParseFrom(msg);
-                    m_parkspaceStatusCallback?.Invoke(parkspace_status_msg);
-                    break;
-                case Message_type.EParkspaceForceUpdateResponseMsg:
-                    Console.WriteLine("update response");
-                    Parkspace_force_update_response_msg parkspace_force_update_msg = Parkspace_force_update_response_msg.Parser.ParseFrom(msg);
-                    Console.WriteLine(parkspace_force_update_msg.ToString());
-                    m_parkspaceForceUpdateResponseCallback?.Invoke(parkspace_force_update_msg);
-                    break;
-                default:
-                    //Console.WriteLine("unrecognized message received");
-                    break;
-            }
-        }
-
-    }
-}

+ 419 - 0
parkspace_manager/communication/communication_socket_base.cs

@@ -0,0 +1,419 @@
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using NNanomsg.Protocols;
+using System.Threading;
+using Newtonsoft.Json.Linq;
+using Google.Protobuf;
+using tool;
+using System.Runtime.InteropServices;
+using System.Windows.Forms;
+
+namespace communication_base
+{
+    class Communication_socket_base
+    {
+        //[DllImport("nnxx_socket_lib.dll")]
+        //private static extern int nnxx_init();
+        //[DllImport("nnxx_socket_lib.dll")]
+        //private static extern int nnxx_uninit();
+        //[DllImport("nnxx_socket_lib.dll")]
+        //private static extern int nnxx_bind(string addr);
+
+        //[DllImport("nnxx_socket_lib.dll")]
+        //private static extern int nnxx_connect(string addr);
+
+        //[DllImport("nnxx_socket_lib.dll")]
+        //private static extern int nnxx_recv(byte[] addr, uint len, int flags = 0);
+
+        //[DllImport("nnxx_socket_lib.dll")]
+        //private static extern int nnxx_send(byte[] addr, uint len, int flags = 0);
+
+        //[DllImport("nnxx_socket_lib.dll")]
+        //private static extern void nnxx_close();
+
+        [DllImport("nanomsg_nng_lib.dll")]
+        private static extern void nanomsg_nng_init();
+        [DllImport("nanomsg_nng_lib.dll")]
+        private static extern void nanomsg_nng_uninit();
+        [DllImport("nanomsg_nng_lib.dll")]
+        private static extern int nanomsg_nng_bind(string addr);
+
+        [DllImport("nanomsg_nng_lib.dll")]
+        private static extern int nanomsg_nng_connect(string addr);
+
+        [DllImport("nanomsg_nng_lib.dll")]
+        private static extern int nanomsg_nng_recv(byte[] addr, uint len);
+
+        [DllImport("nanomsg_nng_lib.dll")]
+        private static extern int nanomsg_nng_send(byte[] addr, uint len);
+
+        //通信状态
+        public enum Communication_statu
+        {
+            COMMUNICATION_UNKNOW = 0,            //通信状态 未知
+            COMMUNICATION_READY = 1,            //通信状态 正常
+            COMMUNICATION_FAULT = 2,            //通信状态 错误
+        };
+        public Communication_socket_base()
+        {
+            m_communication_statu = Communication_statu.COMMUNICATION_UNKNOW;
+
+            mp_receive_data_thread = null;
+            mp_analysis_data_thread = null;
+            mp_send_data_thread = null;
+            mp_encapsulate_data_thread = null;
+
+        }
+        //初始化通信模块--默认从json文件读取
+        public virtual void communication_init()
+        {
+            //m_socket = new BusSocket();
+            //nnxx_init();
+            nanomsg_nng_init();
+            m_receive_data_queue = new Queue<ByteString>();
+            m_send_data_queue = new Queue<ByteString>();
+
+            //接受线程默认循环
+            m_receive_data_condition = true;
+            mp_receive_data_thread = new Thread(receive_data_thread);
+            //解析线程默认等待, 需要接受线程去唤醒, 超时1ms, 超时后主动遍历m_receive_data_queue
+            m_analysis_data_condition = true;
+            mp_analysis_data_thread = new Thread(analysis_data_thread);
+            //发送线程默认循环
+            m_send_data_condition = true;
+            mp_send_data_thread = new Thread(send_data_thread);
+            //封装线程默认循环
+            m_encapsulate_data_condition = true;
+            mp_encapsulate_data_thread = new Thread(encapsulate_data_thread);
+
+            m_event_exit = new EventWaitHandle(false, EventResetMode.ManualReset);
+
+            m_analysis_cycle_time = 1000;//默认1000ms,就自动解析(接受list)
+            m_encapsulate_cycle_time = 1000;//默认1000ms,就自动发送一次状态信息
+
+            //绑定
+            string bind_string = json_file_operation.Instance.read_json_string("communication_bind");
+            communication_bind(bind_string);
+
+            //连接
+            JArray connect_string = json_file_operation.Instance.read_json_jarray("communication_connect");
+            foreach (var connect in connect_string)
+            {
+                communication_connect(connect.ToString());
+            }
+
+            //启动通信, run thread
+            communication_run();
+        }
+        //绑定
+        public virtual void communication_bind(string bind_string)
+        {
+            //m_socket.Bind(bind_string);
+            //nnxx_bind(bind_string);
+            int results = nanomsg_nng_bind(bind_string);
+            if (results == 0)
+            {
+                Console.WriteLine("communication_bind:" + bind_string + "  success !");
+            }
+            else
+            {
+                Console.WriteLine("communication_bind:" + bind_string + "  fail !!!!");
+                MessageBox.Show("communication_bind:" + bind_string + "  fail !!!!");
+
+            }
+        }
+        //连接
+        public virtual void communication_connect(string connect_string)
+        {
+            //m_socket.Connect(connect_string);
+            //nnxx_connect(connect_string);
+            int results = nanomsg_nng_connect(connect_string);
+            if (results == 0)
+            {
+                Console.WriteLine("communication_connect:" + connect_string + "  success !");
+            }
+            else
+            {
+                Console.WriteLine("communication_connect:" + connect_string + "  fail !!!!");
+                MessageBox.Show("communication_connect:" + connect_string + "  fail !!!!");
+
+            }
+        }
+        //启动通信
+        public virtual void communication_run()
+        {
+            m_communication_statu = Communication_statu.COMMUNICATION_READY;
+            //启动4个线程。
+            mp_receive_data_thread.Start();
+            mp_analysis_data_thread.Start();
+            mp_send_data_thread.Start();
+            mp_encapsulate_data_thread.Start();
+
+        }
+        //反初始化
+        public virtual void communication_uninit()
+        {
+            //关闭几个线程
+            m_receive_data_condition = false;
+            m_analysis_data_condition = false;
+            m_send_data_condition = false;
+            m_encapsulate_data_condition = false;
+
+            //回收4个线程的资源
+            if (mp_receive_data_thread != null)
+            {
+                mp_receive_data_thread.Join();
+            }
+            if (mp_analysis_data_thread != null)
+            {
+                mp_analysis_data_thread.Join();
+            }
+            if (mp_send_data_thread != null)
+            {
+                mp_send_data_thread.Join();
+            }
+            if (mp_encapsulate_data_thread != null)
+            {
+                mp_encapsulate_data_thread.Join();
+            }
+            //清空list
+            lock (m_receive_list_lock)
+            {
+                m_receive_data_queue.Clear();
+            }
+            lock (m_send_list_lock)
+            {
+                m_send_data_queue.Clear();
+            }
+            //nnxx_close();
+            //nnxx_uninit();
+            nanomsg_nng_uninit();
+            m_communication_statu = Communication_statu.COMMUNICATION_UNKNOW;
+        }
+
+
+        //设置解析时间
+        public void set_analysis_cycle_time(int analysis_cycle_time)
+        {
+            m_analysis_cycle_time = analysis_cycle_time;
+
+        }
+        //设置封装时间
+        public void set_encapsulate_cycle_time(int encapsulate_cycle_time)
+        {
+            m_encapsulate_cycle_time = encapsulate_cycle_time;
+
+        }
+
+        //mp_receive_data_thread 接受线程执行函数,
+        //receive_data_thread 内部线程负责接受消息
+        protected void receive_data_thread()
+        {
+            Console.WriteLine(" Communication_socket_base::receive_data_thread start  ");
+
+            //通信接受线程, 负责接受socket消息, 并存入 m_receive_data_queue
+            while (m_receive_data_condition && !m_event_exit.WaitOne(1))
+            {
+                if (m_receive_data_condition)
+                {
+                    //非阻塞接受消息, 如果接收到消息, data!=null
+                    //byte[] data = m_socket.ReceiveImmediate();
+                    byte[] data = new byte[65536];
+                    int length = nanomsg_nng_recv(data, 65536);
+                    if (length > 0)
+                    //if (data != null)
+                    {
+
+                        //截取实际长度
+                        ByteString message = ByteString.CopyFrom(data.Skip(0).Take(length).ToArray());
+                        //ByteString message = ByteString.CopyFrom(data.ToArray());
+
+                        Message.Base_info base_Info = Message.Base_msg.Parser.ParseFrom(message).BaseInfo;
+                        //Console.WriteLine(base_Info.ToString());
+                        //检查消息是否有效, 主要检查消息类型和接受者, 判断这条消息是不是给我的.
+                        if (check_msg(message))
+                        {
+                            lock (m_receive_list_lock)
+                            {
+                                //添加入队列
+                                m_receive_data_queue.Enqueue(message);
+                            }
+                        }
+                    }
+                }
+            }
+            Console.WriteLine(" Communication_socket_base::receive_data_thread end  ");
+
+        }
+
+        //mp_analysis_data_thread 解析线程执行函数,
+        //analysis_data_thread 内部线程负责解析消息
+        protected void analysis_data_thread()
+        {
+            Console.WriteLine(" Communication_socket_base::analysis_data_thread start  ");
+            //通信解析线程, 负责巡检m_receive_data_queue, 并解析和处理消息
+            while (m_analysis_data_condition && !m_event_exit.WaitOne(1))
+            {
+                if (m_analysis_data_condition)
+                {
+                    //处理队列信息
+                    lock (m_receive_list_lock)
+                    {
+                        if (m_receive_data_queue.Count > 0)
+                        {
+                            //取出消息
+                            ByteString message = m_receive_data_queue.Dequeue();
+                            //检查消息是否可以被处理
+                            if (check_executer())
+                            {
+                                //处理消息
+                                execute_msg(message);
+                            }
+                            else
+                            {
+                                //不能处理就放到末尾 等能处理时处理
+                                m_receive_data_queue.Enqueue(message);
+                            }
+                        }
+                        //没有消息直接跳过
+                    }
+                }
+            }
+            Console.WriteLine(" Communication_socket_base::analysis_data_thread end  ");
+
+        }
+
+        //mp_send_data_thread 发送线程执行函数,
+        //send_data_thread 内部线程负责发送消息
+        protected void send_data_thread()
+        {
+            Console.WriteLine(" Communication_socket_base::send_data_thread start  ");
+            //通信发送线程, 负责巡检m_send_data_queue, 并发送消息
+            while (m_send_data_condition && !m_event_exit.WaitOne(1))
+            {
+                if (m_send_data_condition)
+                {
+                    lock (m_send_list_lock)
+                    {
+                        if (m_send_data_queue.Count > 0)
+                        {
+                            ByteString message = m_send_data_queue.Dequeue();
+                            //m_socket.Send(message.ToByteArray());
+                            //nnxx_send(message.ToByteArray(), (uint)message.ToByteArray().Length, 1);
+                            nanomsg_nng_send(message.ToByteArray(), (uint)message.ToByteArray().Length);
+                        }
+                    }
+                }
+            }
+
+            Console.WriteLine(" Communication_socket_base::send_data_thread end  ");
+            return;
+        }
+
+
+        //mp_encapsulate_data_thread 封装线程执行函数,
+        //encapsulate_data_thread 内部线程负责封装消息
+        protected void encapsulate_data_thread()
+        {
+            Console.WriteLine(" Communication_socket_base::encapsulate_data_thread start  ");
+            //通信封装线程, 负责定时封装消息, 并存入 m_send_data_queue
+            while (m_encapsulate_data_condition && !m_event_exit.WaitOne(m_encapsulate_cycle_time))
+            {
+
+                if (m_encapsulate_data_condition)
+                {
+                    encapsulate_send_data();
+                }
+            }
+            Console.WriteLine(" Communication_socket_base::encapsulate_data_thread end  ");
+
+        }
+        //检查消息是否有效, 主要检查消息类型和接受者, 判断这条消息是不是给我的.
+        //子类必须重载, 增加自己模块的判断逻辑
+        public virtual bool check_msg(ByteString message)
+        {
+            // Message.Base_info base_Info = Message.Base_info.Parser.ParseJson(message);
+            Message.Base_info base_Info = Message.Base_msg.Parser.ParseFrom(message).BaseInfo;
+            if (base_Info.Receiver == Message.Communicator.EMain)
+            {
+                return true;
+            }
+            else
+            {
+                //无效的消息
+                return true;
+            }
+        }
+        //检查执行者的状态, 判断能否处理这条消息, 需要子类重载
+        public virtual bool check_executer()
+        {
+            //检查对应模块的状态, 判断是否可以处理这条消息
+            if (m_communication_statu == Communication_statu.COMMUNICATION_READY)
+                return true;
+            return false;
+        }
+        //处理消息, 需要子类重载
+        public virtual void execute_msg(ByteString message)
+        {
+            //处理消息必须子类重载,本模块只负责通信
+        }
+        //封装消息, 需要子类重载
+        public virtual void encapsulate_msg(ByteString message)
+        {
+            lock (m_send_list_lock)
+            {
+                m_send_data_queue.Enqueue(message);
+            }
+        }
+        //定时封装发送消息, 一般为心跳和状态信息, 需要子类重载
+        public virtual void encapsulate_send_data()
+        {
+            return;
+            Message.Base_msg t_base_msg;
+            Message.Store_command_request_msg msg;
+            t_base_msg.BaseInfo.MsgType = Message.Message_type.EBaseMsg;
+            t_base_msg.BaseInfo.TimeoutMs = 5000;
+            t_base_msg.BaseInfo.Sender = Message.Communicator.EMain;
+            t_base_msg.BaseInfo.Receiver = Message.Communicator.EMain;
+            m_send_data_queue.Enqueue(t_base_msg.ToByteString());
+        }
+
+
+
+        //通用的网络编程接口, 默认使用总线模式, (网状结构)
+          protected BusSocket m_socket;
+
+
+        //数据锁
+        //作用:将会锁住代码块的内容,并阻止其他线程进入该代码块,直到该代码块运行完成,释放该锁。
+        //注意:定义的锁对象应该是 私有的,静态的,只读的,引用类型的对象,这样可以防止外部改变锁对象
+        private static readonly object m_receive_list_lock = new object();
+        private static readonly object m_send_list_lock = new object();
+
+        //通信状态
+        protected Communication_statu m_communication_statu;          //通信状态
+
+        //接受模块,
+        private Queue<ByteString> m_receive_data_queue;            //接受的队列容器
+        protected Thread mp_receive_data_thread;         //接受的线程
+        protected bool m_receive_data_condition;		//接受的条件变量
+        protected Thread mp_analysis_data_thread;        //解析的线程
+        protected bool m_analysis_data_condition;		//解析的条件变量
+        protected int m_analysis_cycle_time;          //自动解析的时间周期
+
+        //发送模块,
+        private Queue<ByteString> m_send_data_queue;         //发送的队列容器
+        protected Thread mp_send_data_thread;            //发送的线程
+        protected bool m_send_data_condition;			//发送的条件变量
+        protected Thread mp_encapsulate_data_thread;     //封装的线程
+        protected bool m_encapsulate_data_condition;	//封装的条件变量
+        protected int m_encapsulate_cycle_time;         //自动封装的时间周期
+
+        protected EventWaitHandle m_event_exit;                   //防止CPU卡死
+
+    }
+}

+ 435 - 0
parkspace_manager/communication/monitor_communication.cs

@@ -0,0 +1,435 @@
+using NNanomsg;
+using NNanomsg.Protocols;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Google.Protobuf;
+using Message;
+using tool;
+using Newtonsoft.Json.Linq;
+using System.Runtime.InteropServices;
+using communication_base;
+
+namespace monitor_main_windows
+{
+    class Monitor_communication : communication_base.Communication_socket_base
+    {
+        //由于C#不能多继承 就只能直接写成单例模式了
+        /// <summary>
+        /// 单例
+        /// </summary>
+        class Nested
+        {
+            // 创建模板类实例,参数2设为true表示支持私有构造函数
+            internal static readonly Monitor_communication instance = Activator.CreateInstance(typeof(Monitor_communication), true) as Monitor_communication;
+        }
+        private static Monitor_communication instance = null;
+        public static Monitor_communication Instance
+        {
+            get
+            {
+                return Nested.instance;
+            }
+        }
+
+        // 各类消息委托,收到对应消息即调用对应委托/回调
+        public delegate void parkspaceStatusDelegate(Parkspace_allocation_data_msg parkspace_status);
+        public delegate void parkspaceForceUpdateResponseDelegate(Parkspace_force_update_response_msg response);
+        public delegate void parkspace_manual_search_ResponseDelegate(Parkspace_manual_search_response_msg response);
+
+
+        //停车流程进度消息
+        public delegate void storing_process_statu_msgDelegate(Storing_process_statu_msg response);
+        //取车流程进度消息
+        public delegate void picking_process_statu_msgDelegate(Picking_process_statu_msg response);
+
+        // 对应委托/回调句柄
+        private parkspaceStatusDelegate m_parkspaceStatusCallback;
+        private parkspaceForceUpdateResponseDelegate m_parkspaceForceUpdateResponseCallback;
+        private parkspace_manual_search_ResponseDelegate m_parkspacemanual_search_Callback;
+
+
+        private storing_process_statu_msgDelegate m_storing_process_statu_Callback;
+        private picking_process_statu_msgDelegate m_picking_process_statu_Callback;
+
+        // 对应委托/回调句柄设置函数
+        public void SetParkspaceStatusDelegate(parkspaceStatusDelegate callback)
+        {
+            m_parkspaceStatusCallback = callback;
+        }
+        public void SetParkspaceForceUpdateResponseDelegate(parkspaceForceUpdateResponseDelegate callback)
+        {
+            m_parkspaceForceUpdateResponseCallback = callback;
+        }
+        public void SetParkspace_manual_search_ResponseDelegate(parkspace_manual_search_ResponseDelegate callback)
+        {
+            m_parkspacemanual_search_Callback = callback;
+        }
+        public void SetStoring_process_statu_msgDelegate(storing_process_statu_msgDelegate callback)
+        {
+            m_storing_process_statu_Callback = callback;
+        }
+        public void SetPicking_process_statu_msgDelegate(picking_process_statu_msgDelegate callback)
+        {
+            m_picking_process_statu_Callback = callback;
+        }
+
+        private Monitor_communication()
+        {
+            m_parkspace_status_access_lock = new object();
+            // 设置车位状态回调
+            SetParkspaceStatusDelegate(ParkspaceStatusUpdate);
+        }
+
+        /// <summary>
+        /// 初始化
+        /// </summary>
+        /// <returns></returns>
+        public void monitor_communication_init()
+        {
+            base.communication_init();
+        }
+        /// <summary>
+        /// 反初始化
+        /// </summary>
+        /// <returns></returns>
+        public void monitor_communication_uninit()
+        {
+            base.communication_uninit();
+        }
+
+        /// <summary>
+        /// 车位更新回调内部定义
+        /// </summary>
+        /// <param name="parkspace_status"></param>
+        private void ParkspaceStatusUpdate(Parkspace_allocation_data_msg parkspace_status)
+        {
+            lock (m_parkspace_status_access_lock)
+            {
+                m_parkspace_data_msg = parkspace_status;
+                //comm.m_parkspace_current_status.MergeFrom(parkspace_status);
+                m_last_parkspace_status_time = DateTime.Now;
+            }
+        }
+        /// <summary>
+        /// 获取当前车位状态
+        /// </summary>
+        public bool Get_parkspace_status(ref Parkspace_allocation_data_msg msg)
+        {
+            lock (m_parkspace_status_access_lock)
+            {
+                msg = new Parkspace_allocation_data_msg();
+                msg.MergeFrom(m_parkspace_data_msg);
+            }
+            if ((DateTime.Now - m_last_parkspace_status_time).TotalMilliseconds > m_timeout_milli)
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+        //重载检查消息--检查是否给终端的消息
+        /// <summary>
+        /// 检查消息
+        /// </summary>
+        /// <param name="header"></param>
+        /// <returns></returns>
+        public override bool check_msg(ByteString message)
+        {
+            return true;
+        }
+        /// <summary>
+        /// 检查执行器状态
+        /// </summary>
+        /// <param name="header"></param>
+        /// <param name="receiveTime"></param>
+        /// <returns></returns>
+        public override bool check_executer()
+        {
+            return base.check_executer();
+        }
+        /// <summary>
+        /// 检查连接状态
+        /// </summary>
+        /// <param name="header"></param>
+        /// <param name="receiveTime"></param>
+        /// <returns></returns>
+        public  bool check_connect()
+        {
+            if ((DateTime.Now.Ticks / 10000 - m_recv_parkspace_status_time.Ticks / 10000) > m_timeout_milli)
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+        /// <summary>
+        /// 发送消息
+        /// </summary>
+        /// <param name="msg"></param>
+        public override void encapsulate_msg(ByteString msg)
+        {
+            base.encapsulate_msg(msg);
+        }
+        /// <summary>
+        /// 定时封装发送消息, 一般为心跳和状态信
+        /// </summary>
+        public override void encapsulate_send_data()
+        {
+            Parkspace_refresh_request_msg t_refresh_req = new Parkspace_refresh_request_msg();
+            t_refresh_req.BaseInfo = new Base_info();
+            t_refresh_req.BaseInfo.MsgType = Message_type.EParkspaceRefreshRequestMsg;
+            t_refresh_req.BaseInfo.TimeoutMs = 5000;
+            t_refresh_req.BaseInfo.Sender = Message.Communicator.EEmpty;
+            t_refresh_req.BaseInfo.Receiver = Message.Communicator.EParkspace;
+
+            encapsulate_msg(t_refresh_req.ToByteString());
+            //   Console.WriteLine(terminal_Status_Msg.ToString());
+        }
+        //重载处理消息
+        public override void execute_msg(ByteString messgae)
+        {
+
+            Base_msg base_msg = new Base_msg();
+            try
+            {
+                base_msg = Base_msg.Parser.ParseFrom(messgae);
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine("message analysis error ! ");
+            }
+            if (base_msg.BaseInfo != null)
+            {
+                switch (base_msg.BaseInfo.MsgType)
+                {
+                    //车位数据反馈消息
+                    case Message_type.EParkspaceAllocationDataResponseMsg:
+                        {
+                            Parkspace_allocation_data_msg parkspace_status_msg = Parkspace_allocation_data_msg.Parser.ParseFrom(messgae);
+                            m_parkspaceStatusCallback?.Invoke(parkspace_status_msg);
+                        }
+                        break;
+                    //手动修改车位反馈消息
+                    case Message_type.EParkspaceForceUpdateResponseMsg:
+                        {
+                            Parkspace_force_update_response_msg parkspace_force_update_msg = Parkspace_force_update_response_msg.Parser.ParseFrom(messgae);
+                            m_parkspaceForceUpdateResponseCallback?.Invoke(parkspace_force_update_msg);
+                        }
+                        break;
+                    //手动查询车位反馈消息
+                    case Message_type.EParkspaceManualSearchResponseMsg:
+                        {
+                            Parkspace_manual_search_response_msg parkspace_Manual_Search_Response_Msg = Parkspace_manual_search_response_msg.Parser.ParseFrom(messgae);
+                            m_parkspacemanual_search_Callback?.Invoke(parkspace_Manual_Search_Response_Msg);
+                        }
+                        break;
+                    //数据库状态消息,包括车位信息
+                    case Message_type.EParkspaceAllocationStatusMsg:
+                        {
+                            m_recv_parkspace_status_time = DateTime.Now;
+                            Parkspace_allocation_data_msg parkspace_allocation_data_msg = Parkspace_allocation_data_msg.Parser.ParseFrom(messgae);
+                            if (parkspace_allocation_data_msg.ErrorManager.ErrorCode == 0)
+                            {
+                                UIMessageData.Instance.DatabaseNodeStatu = UIMessageData.NodeStatu.Normal;
+                            }
+                            else
+                            {
+                                UIMessageData.Instance.DatabaseNodeStatu = UIMessageData.NodeStatu.Error;
+                            }
+                        }
+                        break;
+                    //停车指令进度条消息
+                    case Message_type.EStoringProcessStatuMsg:
+                        {
+                            Storing_process_statu_msg storing_Process_Statu_Msg = Storing_process_statu_msg.Parser.ParseFrom(messgae);
+                            m_storing_process_statu_Callback?.Invoke(storing_Process_Statu_Msg);
+                        }
+                        break;
+                    //取车指令进度条消息
+                    case Message_type.EPickingProcessStatuMsg:
+                        {
+                            Picking_process_statu_msg picking_Process_Statu_Msg = Picking_process_statu_msg.Parser.ParseFrom(messgae);
+                            m_picking_process_statu_Callback?.Invoke(picking_Process_Statu_Msg);
+                        }
+                        break;
+                    //中控系统状态消息
+                    case Message_type.ECentralControllerStatuMsg:
+                        {
+                            UIMessageData.Instance.MainNodeStatu = UIMessageData.NodeStatu.Normal;
+                        }
+                        break;
+                    //出口LED系统状态消息
+                    case Message_type.ENotifyStatusMsg:
+                        {
+                            UIMessageData.Instance.OutputUnnormalNodeStatu = UIMessageData.NodeStatu.Normal;
+                        }
+                        break;
+                    //调度模块硬件状态消息
+                    case Message_type.EDispatchStatusMsg:
+                        {
+                            Dispatch_terminal_status_msg dispatch_Terminal_Status_Msg = Dispatch_terminal_status_msg.Parser.ParseFrom(messgae);
+                            UIMessageData.NodeStatu nodeStatu = UIMessageData.NodeStatu.Error;
+                            if (dispatch_Terminal_Status_Msg.TerminalStatus != Terminal_status.ETerminalFault &&
+                                dispatch_Terminal_Status_Msg.TerminalStatus != Terminal_status.ETerminalUnknow)
+                            {
+                                nodeStatu = UIMessageData.NodeStatu.Normal;
+                            }
+                            else
+                            {
+                                nodeStatu = UIMessageData.NodeStatu.Error;
+                            }
+                            switch (dispatch_Terminal_Status_Msg.IdStruct.UnitId)
+                            {
+                                case 0:
+                                {
+                                    UIMessageData.Instance.PLCStatuA = nodeStatu;
+                                }
+                                break;
+                                case 1:
+                                {
+                                    UIMessageData.Instance.PLCStatuB = nodeStatu;
+                                }
+                                break;
+                                case 2:
+                                {
+                                    UIMessageData.Instance.PLCStatuC = nodeStatu;
+                                }
+                                break;
+                                default:
+                                    break;
+                            }
+                        }
+                        break;
+                    //终端状态消息
+                    case Message_type.ETerminalStatusMsg:
+                        {
+                            Terminal_status_msg terminal_Status_Msg = Terminal_status_msg.Parser.ParseFrom(messgae);
+                            //Console.WriteLine(terminal_Status_Msg.ToString());
+                            switch (terminal_Status_Msg.IdStruct.TerminalId)
+                            {
+                                case 0:
+                                {
+                                    UIMessageData.Instance.TerminalStatuA1 = UIMessageData.NodeStatu.Normal;
+                                }
+                                break;
+                                case 1:
+                                {
+                                    UIMessageData.Instance.TerminalStatuA2 = UIMessageData.NodeStatu.Normal;
+                                }
+                                break;
+                                case 2:
+                                {
+                                    UIMessageData.Instance.TerminalStatuB1 = UIMessageData.NodeStatu.Normal;
+                                }
+                                break;
+                                case 3:
+                                {
+                                    UIMessageData.Instance.TerminalStatuB2 = UIMessageData.NodeStatu.Normal;
+                                }
+                                break;
+                                case 4:
+                                {
+                                    UIMessageData.Instance.TerminalStatuC1 = UIMessageData.NodeStatu.Normal;
+                                }
+                                break;
+                                case 5:
+                                {
+                                    UIMessageData.Instance.TerminalStatuC2 = UIMessageData.NodeStatu.Normal;
+                                }
+                                break;
+                                case 6:
+                                {
+                                    UIMessageData.Instance.OutputTerminal1Statu = UIMessageData.NodeStatu.Normal;
+                                }
+                                break;
+                                case 7:
+                                {
+                                    UIMessageData.Instance.OutputTerminal2Statu = UIMessageData.NodeStatu.Normal;
+                                }
+                                break;
+                                default:
+                                    break;
+                            }
+                        }
+                        break;
+                    //地面雷达状态消息
+                    case Message_type.EGroundStatusMsg:
+                    {
+                        Ground_status_msg ground_Statu_Msg = Ground_status_msg.Parser.ParseFrom(messgae);
+                        UIMessageData.NodeStatu nodeStatu = UIMessageData.NodeStatu.Error;
+                        if (ground_Statu_Msg.ErrorManager.ErrorLevel == Error_level.MinorError ||
+                            ground_Statu_Msg.ErrorManager.ErrorLevel == Error_level.NegligibleError ||
+                            ground_Statu_Msg.ErrorManager.ErrorCode == 0)
+                        {
+                            nodeStatu = UIMessageData.NodeStatu.Normal;
+                        }
+                        else
+                        {
+                            nodeStatu = UIMessageData.NodeStatu.Error;
+                        }
+                        switch (ground_Statu_Msg.IdStruct.TerminalId)
+                        {
+                            case 0:
+                            {
+                                UIMessageData.Instance.LidarStatuA1 = nodeStatu;
+                            }
+                            break;
+                            case 1:
+                            {
+                                UIMessageData.Instance.LidarStatuA2 = nodeStatu;
+                            }
+                            break;
+                            case 2:
+                            {
+                                UIMessageData.Instance.LidarStatuB1 = nodeStatu;
+                            }
+                            break;
+                            case 3:
+                            {
+                                UIMessageData.Instance.LidarStatuB2 = nodeStatu;
+                            }
+                            break;
+                            case 4:
+                            {
+                                UIMessageData.Instance.LidarStatuC1 = nodeStatu;
+                            }
+                            break;
+                            case 5:
+                            {
+                                UIMessageData.Instance.LidarStatuC2 = nodeStatu;
+                            }
+                            break;
+                            default:
+                                break;
+                        }
+                    }
+                    break;
+                    default:
+                        //Console.WriteLine("unrecognized message received");
+                        break;
+                }
+            }
+        }
+
+
+        private DateTime m_recv_parkspace_status_time;                  //接收车位状态时间
+        private Parkspace_allocation_data_msg m_parkspace_data_msg;     //车位数据
+        /// <summary>
+        /// 车位状态访问锁
+        /// </summary>
+        private object m_parkspace_status_access_lock;
+        /// <summary>
+        /// 当前时间
+        /// </summary>
+        private DateTime m_last_parkspace_status_time;
+        public int      m_timeout_milli = 3000;
+    }
+}

+ 1 - 1
parkspace_manager/db_manager/DBManager.cs

@@ -7,7 +7,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace parkspace_manager
+namespace monitor_main_windows
 {
     class DBManager
     {

File diff suppressed because it is too large
+ 1442 - 0
parkspace_manager/message/CentralControlMessage.cs


File diff suppressed because it is too large
+ 6781 - 0
parkspace_manager/message/DispatchMessage.cs


File diff suppressed because it is too large
+ 4124 - 0
parkspace_manager/message/MeasureMessage.cs


File diff suppressed because it is too large
+ 782 - 100
parkspace_manager/message/MessageBase.cs


File diff suppressed because it is too large
+ 1259 - 260
parkspace_manager/message/ParkspaceAllocationMessage.cs


File diff suppressed because it is too large
+ 6766 - 0
parkspace_manager/message/ProcessMessage.cs


File diff suppressed because it is too large
+ 3913 - 0
parkspace_manager/message/SinglechipMsg.cs


File diff suppressed because it is too large
+ 1408 - 0
parkspace_manager/message/TerminalMessage.cs


+ 400 - 0
parkspace_manager/message/UnNormalizedModuleMessage.cs

@@ -0,0 +1,400 @@
+// <auto-generated>
+//     Generated by the protocol buffer compiler.  DO NOT EDIT!
+//     source: UnNormalized_module_message.proto
+// </auto-generated>
+#pragma warning disable 1591, 0612, 3021
+#region Designer generated code
+
+using pb = global::Google.Protobuf;
+using pbc = global::Google.Protobuf.Collections;
+using pbr = global::Google.Protobuf.Reflection;
+using scg = global::System.Collections.Generic;
+namespace Message {
+
+  /// <summary>Holder for reflection information generated from UnNormalized_module_message.proto</summary>
+  public static partial class UnNormalizedModuleMessageReflection {
+
+    #region Descriptor
+    /// <summary>File descriptor for UnNormalized_module_message.proto</summary>
+    public static pbr::FileDescriptor Descriptor {
+      get { return descriptor; }
+    }
+    private static pbr::FileDescriptor descriptor;
+
+    static UnNormalizedModuleMessageReflection() {
+      byte[] descriptorData = global::System.Convert.FromBase64String(
+          string.Concat(
+            "CiFVbk5vcm1hbGl6ZWRfbW9kdWxlX21lc3NhZ2UucHJvdG8SB21lc3NhZ2Ua",
+            "Em1lc3NhZ2VfYmFzZS5wcm90byKuAQodVW5Ob3JtYWxpemVkX21vZHVsZV9z",
+            "dGF0dV9tc2cSJQoJYmFzZV9pbmZvGAEgAigLMhIubWVzc2FnZS5CYXNlX2lu",
+            "Zm8SJQoJaWRfc3RydWN0GAIgAigLMhIubWVzc2FnZS5JZF9zdHJ1Y3QSKgoK",
+            "c3RhdHVfY29kZRgDIAIoCzIWLm1lc3NhZ2UuRXJyb3JfbWFuYWdlchITCgtj",
+            "YXJfbGljZW5zZRgEIAEoCQ=="));
+      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
+          new pbr::FileDescriptor[] { global::Message.MessageBaseReflection.Descriptor, },
+          new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
+            new pbr::GeneratedClrTypeInfo(typeof(global::Message.UnNormalized_module_statu_msg), global::Message.UnNormalized_module_statu_msg.Parser, new[]{ "BaseInfo", "IdStruct", "StatuCode", "CarLicense" }, null, null, null, null)
+          }));
+    }
+    #endregion
+
+  }
+  #region Messages
+  /// <summary>
+  ///地面定位模块测量结果 
+  /// </summary>
+  public sealed partial class UnNormalized_module_statu_msg : pb::IMessage<UnNormalized_module_statu_msg>
+  #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+      , pb::IBufferMessage
+  #endif
+  {
+    private static readonly pb::MessageParser<UnNormalized_module_statu_msg> _parser = new pb::MessageParser<UnNormalized_module_statu_msg>(() => new UnNormalized_module_statu_msg());
+    private pb::UnknownFieldSet _unknownFields;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public static pb::MessageParser<UnNormalized_module_statu_msg> Parser { get { return _parser; } }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public static pbr::MessageDescriptor Descriptor {
+      get { return global::Message.UnNormalizedModuleMessageReflection.Descriptor.MessageTypes[0]; }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    pbr::MessageDescriptor pb::IMessage.Descriptor {
+      get { return Descriptor; }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public UnNormalized_module_statu_msg() {
+      OnConstruction();
+    }
+
+    partial void OnConstruction();
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public UnNormalized_module_statu_msg(UnNormalized_module_statu_msg other) : this() {
+      baseInfo_ = other.baseInfo_ != null ? other.baseInfo_.Clone() : null;
+      idStruct_ = other.idStruct_ != null ? other.idStruct_.Clone() : null;
+      statuCode_ = other.statuCode_ != null ? other.statuCode_.Clone() : null;
+      carLicense_ = other.carLicense_;
+      _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public UnNormalized_module_statu_msg Clone() {
+      return new UnNormalized_module_statu_msg(this);
+    }
+
+    /// <summary>Field number for the "base_info" field.</summary>
+    public const int BaseInfoFieldNumber = 1;
+    private global::Message.Base_info baseInfo_;
+    /// <summary>
+    ///消息类型 
+    /// </summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public global::Message.Base_info BaseInfo {
+      get { return baseInfo_; }
+      set {
+        baseInfo_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "id_struct" field.</summary>
+    public const int IdStructFieldNumber = 2;
+    private global::Message.Id_struct idStruct_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public global::Message.Id_struct IdStruct {
+      get { return idStruct_; }
+      set {
+        idStruct_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "statu_code" field.</summary>
+    public const int StatuCodeFieldNumber = 3;
+    private global::Message.Error_manager statuCode_;
+    /// <summary>
+    ///模块状态 
+    /// </summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public global::Message.Error_manager StatuCode {
+      get { return statuCode_; }
+      set {
+        statuCode_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "car_license" field.</summary>
+    public const int CarLicenseFieldNumber = 4;
+    private readonly static string CarLicenseDefaultValue = "";
+
+    private string carLicense_;
+    /// <summary>
+    ///号牌数据 
+    /// </summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public string CarLicense {
+      get { return carLicense_ ?? CarLicenseDefaultValue; }
+      set {
+        carLicense_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+    /// <summary>Gets whether the "car_license" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasCarLicense {
+      get { return carLicense_ != null; }
+    }
+    /// <summary>Clears the value of the "car_license" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearCarLicense() {
+      carLicense_ = null;
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public override bool Equals(object other) {
+      return Equals(other as UnNormalized_module_statu_msg);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool Equals(UnNormalized_module_statu_msg other) {
+      if (ReferenceEquals(other, null)) {
+        return false;
+      }
+      if (ReferenceEquals(other, this)) {
+        return true;
+      }
+      if (!object.Equals(BaseInfo, other.BaseInfo)) return false;
+      if (!object.Equals(IdStruct, other.IdStruct)) return false;
+      if (!object.Equals(StatuCode, other.StatuCode)) return false;
+      if (CarLicense != other.CarLicense) return false;
+      return Equals(_unknownFields, other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public override int GetHashCode() {
+      int hash = 1;
+      if (baseInfo_ != null) hash ^= BaseInfo.GetHashCode();
+      if (idStruct_ != null) hash ^= IdStruct.GetHashCode();
+      if (statuCode_ != null) hash ^= StatuCode.GetHashCode();
+      if (HasCarLicense) hash ^= CarLicense.GetHashCode();
+      if (_unknownFields != null) {
+        hash ^= _unknownFields.GetHashCode();
+      }
+      return hash;
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public override string ToString() {
+      return pb::JsonFormatter.ToDiagnosticString(this);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void WriteTo(pb::CodedOutputStream output) {
+    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+      output.WriteRawMessage(this);
+    #else
+      if (baseInfo_ != null) {
+        output.WriteRawTag(10);
+        output.WriteMessage(BaseInfo);
+      }
+      if (idStruct_ != null) {
+        output.WriteRawTag(18);
+        output.WriteMessage(IdStruct);
+      }
+      if (statuCode_ != null) {
+        output.WriteRawTag(26);
+        output.WriteMessage(StatuCode);
+      }
+      if (HasCarLicense) {
+        output.WriteRawTag(34);
+        output.WriteString(CarLicense);
+      }
+      if (_unknownFields != null) {
+        _unknownFields.WriteTo(output);
+      }
+    #endif
+    }
+
+    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
+      if (baseInfo_ != null) {
+        output.WriteRawTag(10);
+        output.WriteMessage(BaseInfo);
+      }
+      if (idStruct_ != null) {
+        output.WriteRawTag(18);
+        output.WriteMessage(IdStruct);
+      }
+      if (statuCode_ != null) {
+        output.WriteRawTag(26);
+        output.WriteMessage(StatuCode);
+      }
+      if (HasCarLicense) {
+        output.WriteRawTag(34);
+        output.WriteString(CarLicense);
+      }
+      if (_unknownFields != null) {
+        _unknownFields.WriteTo(ref output);
+      }
+    }
+    #endif
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public int CalculateSize() {
+      int size = 0;
+      if (baseInfo_ != null) {
+        size += 1 + pb::CodedOutputStream.ComputeMessageSize(BaseInfo);
+      }
+      if (idStruct_ != null) {
+        size += 1 + pb::CodedOutputStream.ComputeMessageSize(IdStruct);
+      }
+      if (statuCode_ != null) {
+        size += 1 + pb::CodedOutputStream.ComputeMessageSize(StatuCode);
+      }
+      if (HasCarLicense) {
+        size += 1 + pb::CodedOutputStream.ComputeStringSize(CarLicense);
+      }
+      if (_unknownFields != null) {
+        size += _unknownFields.CalculateSize();
+      }
+      return size;
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void MergeFrom(UnNormalized_module_statu_msg other) {
+      if (other == null) {
+        return;
+      }
+      if (other.baseInfo_ != null) {
+        if (baseInfo_ == null) {
+          BaseInfo = new global::Message.Base_info();
+        }
+        BaseInfo.MergeFrom(other.BaseInfo);
+      }
+      if (other.idStruct_ != null) {
+        if (idStruct_ == null) {
+          IdStruct = new global::Message.Id_struct();
+        }
+        IdStruct.MergeFrom(other.IdStruct);
+      }
+      if (other.statuCode_ != null) {
+        if (statuCode_ == null) {
+          StatuCode = new global::Message.Error_manager();
+        }
+        StatuCode.MergeFrom(other.StatuCode);
+      }
+      if (other.HasCarLicense) {
+        CarLicense = other.CarLicense;
+      }
+      _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void MergeFrom(pb::CodedInputStream input) {
+    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+      input.ReadRawMessage(this);
+    #else
+      uint tag;
+      while ((tag = input.ReadTag()) != 0) {
+        switch(tag) {
+          default:
+            _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+            break;
+          case 10: {
+            if (baseInfo_ == null) {
+              BaseInfo = new global::Message.Base_info();
+            }
+            input.ReadMessage(BaseInfo);
+            break;
+          }
+          case 18: {
+            if (idStruct_ == null) {
+              IdStruct = new global::Message.Id_struct();
+            }
+            input.ReadMessage(IdStruct);
+            break;
+          }
+          case 26: {
+            if (statuCode_ == null) {
+              StatuCode = new global::Message.Error_manager();
+            }
+            input.ReadMessage(StatuCode);
+            break;
+          }
+          case 34: {
+            CarLicense = input.ReadString();
+            break;
+          }
+        }
+      }
+    #endif
+    }
+
+    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
+      uint tag;
+      while ((tag = input.ReadTag()) != 0) {
+        switch(tag) {
+          default:
+            _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
+            break;
+          case 10: {
+            if (baseInfo_ == null) {
+              BaseInfo = new global::Message.Base_info();
+            }
+            input.ReadMessage(BaseInfo);
+            break;
+          }
+          case 18: {
+            if (idStruct_ == null) {
+              IdStruct = new global::Message.Id_struct();
+            }
+            input.ReadMessage(IdStruct);
+            break;
+          }
+          case 26: {
+            if (statuCode_ == null) {
+              StatuCode = new global::Message.Error_manager();
+            }
+            input.ReadMessage(StatuCode);
+            break;
+          }
+          case 34: {
+            CarLicense = input.ReadString();
+            break;
+          }
+        }
+      }
+    }
+    #endif
+
+  }
+
+  #endregion
+
+}
+
+#endregion Designer generated code

+ 11 - 0
parkspace_manager/message/UnNormalized_module_message.proto

@@ -0,0 +1,11 @@
+syntax = "proto2";
+ package message;
+ import "message_base.proto";
+ //地面定位模块测量结果 
+message UnNormalized_module_statu_msg
+ {
+	required Base_info base_info=1; //消息类型 
+	required Id_struct   id_struct=2; 
+	required Error_manager statu_code=3; //模块状态 
+	optional string car_license=4; //号牌数据 
+}

+ 54 - 0
parkspace_manager/message/central_control_message.proto

@@ -0,0 +1,54 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+
+//针对流程的手动操作类型
+enum Process_operation_type
+{
+    eManual_cancel=0;                   //取消流程
+    eManual_retry=1;                    //重试
+    eManual_ignore=2;                   //忽略
+}
+
+enum Module_statu
+{
+    eConnected=0;               //连接
+    eDisconnected=1;            //连接丢失
+    eFault=2;                   //故障
+}
+
+//出入口状态
+message Entrance_statu
+{
+    required    bool                paused=1;
+    optional    Module_statu        parkspace_statu=2;
+    optional    Module_statu        dispatch_statu=3;
+    optional    Module_statu        notify_statu=4;
+}
+
+//中控状态消息
+message Central_controller_statu_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    repeated Entrance_statu             entrance_statu_vector=2;    //入口状态(关闭或者开放)
+    repeated Entrance_statu             export_statu_vector=3;      //出口状态
+}
+
+//出入口手动急停/启动消息
+message Entrance_manual_operation_msg
+{
+    required Base_info                  base_info=1;
+    required Id_struct                      id_struct=2;
+    required Process_type               process_type=3;
+    required bool                       paused=4;           //是否急停
+}
+
+//流程手动操作消息
+message Process_manual_operation_msg
+{
+    required Base_info                  base_info=1;
+    required string                     license=2;
+    required Step_type                  step_type=3;
+    required Process_operation_type     operate_type=4;
+}

+ 344 - 0
parkspace_manager/message/dispatch_message.proto

@@ -0,0 +1,344 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+
+
+//终端流程状态, 表示这个出入口到楼上停车位之间的所有设备总状态
+enum Terminal_status
+{
+    E_TERMINAL_UNKNOW               = 0;     //未知
+    E_TERMINAL_READY                = 1;     //准备,待机
+    E_TERMINAL_STORE                = 2;	    //正在存车
+    E_TERMINAL_PICKUP               = 3;	    //正在取车
+
+    E_TERMINAL_FAULT                = 10;     //故障
+}
+
+//通道口属性, 出入口的方向属性, 表示这个通道允许停车或者取车
+enum Passageway_direction
+{
+    E_INLET             =0;         //入口
+    E_OUTLET            =1;         //出口
+    E_BILATERAL         =2;         //双向口
+}
+
+
+
+//调度流程状态
+enum Dispatch_process_status
+{
+    E_DISPATCH_POCESS_UNKNOW                = 0;     //未知
+    E_DISPATCH_POCESS_WAIT                  = 1;     //等待
+    E_DISPATCH_POCESS_WORKING               = 2;     //工作
+    E_DISPATCH_POCESS_OVER                  = 3;     //完成
+
+    E_DISPATCH_POCESS_FAULT                 = 100;     //故障
+}
+
+//调度流程信息
+message Dispatch_process_information
+{
+    optional string                     car_numberPlate=1;					    //车牌号
+    optional string                     command_key=2;                          //指令唯一标识符id
+    optional Dispatch_motion_direction  dispatch_motion_direction=3;            //调度方向, 停车取车
+    optional Id_struct                  id_struct=4;                            //id
+    optional Locate_information         locate_information=5;                   //汽车测量信息, 只有停车时有数据, 取车时没有数据.
+    repeated Parkspace_info             parkspace_info_ex=6;                    //车位编号, 停车位(B方案, 分配3个停车位)
+    optional Car_type                   car_type=7;                             //汽车大小
+
+    optional Dispatch_process_status    dispatch_process_status=8;              //调度流程状态
+    optional int32                      m_wait_number=9;                        //只有等待才有等待编号
+}
+
+//调度模块终端出入口的状态
+message Dispatch_terminal_status_msg
+{
+    required Base_info                  base_info=1;                    //消息类型
+    optional Id_struct                  id_struct=2;                    //id
+    required Terminal_status            terminal_status = 3;            //终端流程状态, 表示这个出入口到楼上停车位之间的所有设备总状态
+    required Passageway_direction       passageway_direction = 4;       //通道口属性, 出入口的方向属性, 表示这个通道允许停车或者取车
+
+    repeated Dispatch_process_information   dispatch_store_process_information_vector = 5;                          //
+    optional string                         dispatch_store_process_information_updata_time=6;                        //
+    repeated Dispatch_process_information   dispatch_pickup_process_information_vector = 7;                         //
+    optional string                         dispatch_pickup_process_information_updata_time=8;                        //
+}
+
+//调度方向, 停车取车, 表示正在执行的动作
+enum Dispatch_motion_direction
+{
+    E_STORE_CAR             =0;         //停车, 出入口 -> 停车位
+    E_PICKUP_CAR            =1;         //取车, 停车位 -> 出入口
+}
+
+
+
+//执行搬运请求(主控->调度管理)
+message Dispatch_request_msg
+{
+    required Base_info                  base_info=1;                            //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+
+    optional Dispatch_motion_direction  dispatch_motion_direction=3;            //调度方向, 停车取车
+    optional Id_struct                  id_struct=4;                              //id
+    optional Locate_information         locate_information=5;                   //汽车测量信息, 只有停车时有数据, 取车时没有数据.
+
+    repeated Parkspace_info             parkspace_info_ex=6;                         //车位编号, 停车位(B方案, 分配3个停车位)
+    optional Car_type                   car_type=7;                             //汽车大小
+}
+
+//搬运动作执行完成后反馈结果(调度管理->主控)
+message Dispatch_response_msg
+{
+    required Base_info                  base_info=1;                    //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+
+    optional Dispatch_motion_direction  dispatch_motion_direction=3;            //调度方向, 停车取车
+    optional Id_struct                  id_struct=4;                              //id
+    optional Locate_information         locate_information=5;                   //汽车测量信息, 只有停车时有数据, 取车时没有数据.
+
+    repeated Parkspace_info             parkspace_info_ex=6;                         //车位编号, 停车位(B方案, 分配3个停车位)
+    optional Car_type                   car_type=7;                             //汽车大小
+
+    optional Error_manager              error_manager = 8;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+//调度管理 的状态
+enum Dispatch_manager_status
+{
+    E_DISPATCH_MANAGER_UNKNOW               = 0;    //未知
+    E_DISPATCH_MANAGER_READY                = 1;    //准备,待机
+    E_DISPATCH_MANAGER_STORE                = 2;    //正在存车
+    E_DISPATCH_MANAGER_PICKUP               = 3;    //正在取车
+
+    E_DISPATCH_MANAGER_FAULT               = 100;    //故障
+}
+
+//设备状态,这个类的总状态,这里指工作任务流程
+	enum Dispatch_device_status
+	{
+	    DISPATCH_DEVICE_UNKNOW               	= 0;    //未知
+    	DISPATCH_DEVICE_READY               	= 1;    //准备,待机
+    	DISPATCH_DEVICE_BUSY					= 2; 	//工作正忙
+
+    	DISPATCH_DEVICE_ONE_LEVEL_OVER		= 3; 	//一级工作完成;
+    	DISPATCH_DEVICE_ONE_LEVEL_WORK		= 4;	//一级工作状态; 就是普通的移动任务
+    	DISPATCH_DEVICE_TWO_LEVEL_OVER		= 5; 	//一级工作完成;
+    	DISPATCH_DEVICE_TWO_LEVEL_WORK		= 6;	//二级工作状态; 就是紧急避让; 插队任务(会在执行一级任务的过程中; 插队并优先执行二级任务)
+    	DISPATCH_DEVICE_THREE_LEVEL_OVER		= 7; 	//一级工作完成;
+    	DISPATCH_DEVICE_THREE_LEVEL_WORK		= 8;	//三级工作任务; 就是锁定硬件资源; 不让插队; (除非急停或者取消任务)
+
+       	DISPATCH_DEVICE_FAULT					= 100;	//故障
+    	DISPATCH_DEVICE_DISCONNECT			= 101; 	//通信故障
+	};
+
+	//调度任务的等级
+	enum Dispatch_task_level
+	{
+//	    DISPATCH_TASK_UNKNOW_LEVEL          = 0;    //无效任务
+		DISPATCH_TASK_ONE_LEVEL             = 1;    //一级任务
+		DISPATCH_TASK_TWO_LEVEL				= 2;	//二级任务
+		DISPATCH_TASK_THREE_LEVEL			= 3;	//三级任务
+	};
+
+	//抓车的夹杆
+	enum Clamp_motion
+	{
+		E_CLAMP_NO_ACTION            	= 0;    //无动作.
+		E_CLAMP_TIGHT               	= 1;    //夹紧夹杆
+		E_CLAMP_LOOSE					= 2;	//松开夹杆
+	};
+
+	//中跑车和平层轨道的对接
+	enum Joint_motion
+	{
+		E_JOINT_NO_ACTION            	= 0;    //无动作.
+		E_JOINT_HOLD_OUT               	= 1;    //伸出对接,之后中跑车可以x轴移动,电梯不能Z轴移动
+		E_JOINT_TAKE_BACK				= 2;	//收回对接,之后中跑车固定在电梯上不能X轴移动,电梯可以Z轴移动
+	};
+
+	//小跑车的位置,是否在中跑车上面
+	enum Small_sports_car_motion
+	{
+		E_SMALL_SPORTS_NO_ACTION		= 0;    //无动作.
+		E_SMALL_SPORTS_CAR_GET_AWAY 	= 1;    //小跑车离开中跑车
+		E_SMALL_SPORTS_CAR_GET_BACK		= 2;	//小跑车返回中跑车
+	};
+
+
+	//指令完成状态, 设备答复指令, 返回任务完成的情况
+	enum Respons_status
+	{
+		RESPONS_WORKING            	= 0;    //任务进行中
+		RESPONS_OVER               	= 1;    //任务完成
+		RESPONS_MINOR_ERROR			= 100;	//一般故障, 可恢复
+		RESPONS_CRITICAL_ERROR		= 101;	//致命故障,不可恢复
+	};
+
+	//设备的硬件设备状态
+	enum Hardware_device_status
+	{
+		DEVICE_UNKNOWN              = 0;    //设备未知
+		DEVICE_READY                = 1;    //设备空闲(可以接受新的指令任务)
+		DEVICE_WORKING				= 2;	//设备工作中
+		DEVICE_EMERGENCY_STOP		= 3;	//设备急停
+		DEVICE_UNSAFETY				= 4;	//设备不安全(暂时不考虑是否处于安全位置)
+		DEVICE_COLLISION			= 5;	//设备发生碰撞
+		DEVICE_FAULT				= 6;	//设备故障
+	};
+
+	//设备的负载状态, 小跑车上面是否有车.
+	enum Load_status
+	{
+		LOAD_UNKNOWN				= 0;	//负载未知
+		HAVE_CAR               		= 1;    //有车
+		NO_CAR            			= 2;    //没车
+	};
+
+	//7号出口 转台方向
+	enum Turntable_direction
+	{
+		TURNTABLE_DIRECTION_UNKNOWN				= 0;	//方向未知,
+		TURNTABLE_DIRECTION_INSIDE 				= 1;    //方向朝里,对接内门的小跑车
+		TURNTABLE_DIRECTION_OUTSIDE  			= 2;    //没车朝外,对接外门的出口
+	};
+
+	//出入口 门的开关状态
+	enum Door_motion
+	{
+		DOOR_UNKNOWN            = 0;    //门的开关状态 未知, 或者工作到一半,正在工作中.
+	    DOOR_OPEN               = 1;    //开门
+		DOOR_CLOSE				= 2;	//关门
+		DOOR_ERROR				= 3;	//
+	};
+
+	//边界判断,是否超界
+	enum Overstep_the_boundary
+	{
+		BOUNDARY_NORMAL			= 0;	//边界 正常
+		BOUNDARY_OVERSTEP       = 1;    //超界
+	};
+
+
+
+
+//抓取器的状态(机器手)
+message Catcher_data
+{
+    required Dispatch_device_type               dispatch_device_type=1;         //调度设备的类型
+    required Dispatch_device_status             dispatch_device_status=2;       //设备总状态, 控制任务流程(长流程)
+
+    required int32                              device_id=3;                    //设备id,
+	optional Hardware_device_status				actual_device_status=4;			//机器人的硬件设备状态(短流程)
+	optional Load_status						actual_load_status=5;	        //机器人的负载状态, 机器人上面是否有车.
+
+    optional int32 								actual_coordinates_id=6;		//机器人真实 空间位置的id.
+	optional float 								actual_x=7;					    //机器人坐标x轴,
+	optional float 								actual_y=8;					    //机器人坐标y轴,
+	optional float 								actual_b=9;					    //机器人坐标b轴, 旋转范围80~280
+	optional float 								actual_z=10;				    //机器人坐标z轴,
+	optional float 								actual_d1=11;				    //机器人坐标d1轴, 机器人抓车杆纵向移动(前轮抓杆)
+	optional float 								actual_d2=12;				    //机器人坐标d2轴, 机器人抓车杆纵向移动(后轮抓杆)
+	optional Clamp_motion						actual_clamp_motion1=13;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+	optional Clamp_motion						actual_clamp_motion2=14;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+	optional Clamp_motion						actual_clamp_motion3=15;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+	optional Clamp_motion						actual_clamp_motion4=16;		//机器人夹车杆. 0=无动作,1=夹紧,2=松开
+
+    optional string                             actual_error_code=17;	        //机器人设备的故障信息位
+    optional string                             actual_warning_code=18;     	//机器人设备的警告信息位
+    optional string							    actual_error_description=19;    //机器人设备的错误描述
+}
+
+//搬运器的状态
+message Carrier_data
+{
+    required Dispatch_device_type               dispatch_device_type=1;         //调度设备的类型
+    required Dispatch_device_status             dispatch_device_status=2;       //设备总状态, 控制任务流程(长流程)
+
+    required int32                              device_id=3;                    //设备id,
+	optional Hardware_device_status				actual_device_status=4;			//搬运器的硬件设备状态(短流程)
+	optional Load_status						actual_load_status=5;	        //搬运器的负载状态, 小跑车上面是否有车.
+
+    optional int32 								actual_coordinates_id=6;	    //搬运器真实 空间位置的id.
+	optional float 								actual_x=7;					    //搬运器坐标x轴, 中跑车控制横向移动
+	optional float 								actual_y=8;					    //搬运器坐标y轴, 小跑车控制纵向移动
+	optional float 								actual_z=9;					    //搬运器坐标z轴, 电梯控制上下移动
+	optional float 								actual_y1=10;				        //搬运器坐标y1轴, 小跑车控制纵向移动(前轮抓杆)
+	optional float 								actual_y2=11;				        //搬运器坐标y2轴, 小跑车控制纵向移动(后轮抓杆)
+	optional Clamp_motion						actual_clamp_motion1=12;		    //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	optional Clamp_motion						actual_clamp_motion2=13;		    //小跑车夹车杆. 0=无动作,1=夹紧,2=松开
+	optional Small_sports_car_motion			actual_small_sports_car_motion=14;	//小跑车的位置,是否在中跑车上面, 0=无动作,1=出发到位,2=返回到位
+	optional Joint_motion						actual_joint_motion_x1=15;		    //电梯与X轴的横向轨道对接,0=无动作,1=伸出到位,2=收回到位
+	optional Joint_motion						actual_joint_motion_x2=16;		    //电梯与X轴的横向轨道对接,0=无动作,1=伸出到位,2=收回到位
+
+    optional string                             actual_error_code=17;	        //搬运器设备的故障信息位
+    optional string                             actual_warning_code=18;	        //搬运器设备的警告信息位
+    optional string							    actual_error_description=19;    //搬运器设备的错误描述
+}
+
+//出入口的状态
+message Passageway_data
+{
+    required Dispatch_device_type               dispatch_device_type=1;         //调度设备的类型
+    required Dispatch_device_status             dispatch_device_status=2;       //设备总状态, 控制任务流程(长流程)
+
+    required int32                              device_id=3;                    //设备id,
+    //通道口的设备状态数据,
+	optional Hardware_device_status				actual_device_status=4;			//通道口的硬件设备状态(短流程)
+	optional Load_status						actual_inside_load_status=5;	        //通道口的内部负载状态, 门内地感是否有车.
+	optional Load_status						actual_outside_load_status=6;	        //通道口的外部负载状态, 门外地感是否有车.
+	optional Overstep_the_boundary				actual_front_overstep_the_boundary=7;	//通道口 汽车前边界
+	optional Overstep_the_boundary				actual_back_overstep_the_boundary=8;	//通道口 汽车后边界
+	optional Overstep_the_boundary				actual_height_overstep_the_boundary=9;	//通道口 车辆是否超高
+	optional Load_status						actual_outside_door_sensor=10;	//通道口 的外门处的传感器, 判断是否有车经过外门
+	//通道口的真实状态, 可能是路径中间的坐标
+    optional Door_motion						actual_inside_door_motion=11;	//通道口 内门动作
+	optional Door_motion						actual_outside_door_motion=12;	//通道口 外门动作
+	optional Load_status						actual_turntable_load_status=13;	//通道口 转盘负载状态, 是否有车.
+	optional Turntable_direction				actual_turntable_direction=14;	//通道口 转台方向
+
+    optional string                             actual_error_code=15;	        //通道口设备的故障信息位
+    optional string                             actual_warning_code=16;	        //通道口设备的警告信息位
+    optional string							    actual_error_description=17;    //通道口设备的错误描述
+}
+
+
+//调度管理总管理的状态
+message Dispatch_manager_status_msg
+{
+    required Base_info                  base_info=1;                    //消息类型
+
+    required int32                      dispatch_id=2;                  //调度管理模块 id
+    required Dispatch_manager_status    dispatch_manager_status = 3;    //调度管理模块 状态
+
+    repeated Catcher_data               catcher_data_map = 4;           //机器手的数据
+    repeated Carrier_data               carrier_data_map = 5;           //搬运器的数据
+    repeated Passageway_data            passageway_data_map = 6;           //出入口的数据
+
+}
+
+
+
+
+
+//调度管理的设备详细的数据信息
+message Dispatch_manager_data_msg
+{
+    //后续再加
+}

+ 185 - 0
parkspace_manager/message/measure_message.proto

@@ -0,0 +1,185 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+//雷达管理模块的工作状态
+enum Laser_manager_status
+{
+    LASER_MANAGER_UNKNOW               	= 0;    //未知
+    LASER_MANAGER_READY               	= 1;    //准备,待机
+	LASER_MANAGER_ISSUED_TASK			= 2;	//工作下发任务
+	LASER_MANAGER_WAIT_REPLY			= 3;	//工作等待答复
+	LASER_MANAGER_FAULT					= 4;	//故障
+}
+	
+//子雷达状态
+enum Laser_statu
+{
+	LASER_DISCONNECT	=0;	        //雷达断连
+	LASER_READY			=1;			//雷达正常待机,空闲
+	LASER_BUSY			=2;	        //雷达正在工作,正忙
+	LASER_FAULT			=3;         //雷达错误
+}
+
+//定位管理模块的工作状态
+enum Locate_manager_status
+{
+	LOCATE_MANAGER_UNKNOW               	= 0;    //未知
+	LOCATE_MANAGER_READY               		= 1;    //准备,待机
+	LOCATE_MANAGER_SIFT						= 2;	//sift点云筛选; 将车身和轮胎的点剥离出来
+	LOCATE_MANAGER_CAR						= 3;	//通过车身 计算汽车的定位信息.
+	LOCATE_MANAGER_WHEEL					= 4;	//通过车轮 计算汽车的定位信息.
+	LOCATE_MANAGER_FAULT					= 5;	//故障
+}
+	
+
+//雷达管理的状态
+enum Wanji_manager_status
+{
+	WANJI_MANAGER_UNKNOWN              	= 0;    //未知
+	WANJI_MANAGER_READY               	= 1;    //准备,待机
+	WANJI_MANAGER_BUSY					= 2; 	//工作正忙
+
+	WANJI_MANAGER_ISSUED_SCAN			= 3; 	//下发任务; 获取点云
+	WANJI_MANAGER_WAIT_SCAN				= 4;	//等待任务; 扫描点云
+
+	WANJI_MANAGER_ISSUED_DETECT			= 5; 	//下发任务; 算法预测
+	WANJI_MANAGER_WAIT_DETECT			= 6; 	//等待任务; 算法预测
+
+	WANJI_MANAGER_FAULT					= 10;	//故障
+}
+
+//万集设备身状态
+enum Wanji_lidar_device_status
+{
+	WANJI_LIDAR_DEVICE_UNKNOWN              	= 0;    //未知
+	WANJI_LIDAR_DEVICE_READY	             	= 1;    //正常待机
+	WANJI_LIDAR_DEVICE_DISCONNECT			= 2;	//断连
+
+	WANJI_LIDAR_DEVICE_BUSY					= 3; 	//工作正忙
+
+	WANJI_LIDAR_DEVICE_FAULT					=10;	//故障
+}
+
+//万集区域功能的状态
+enum Region_worker_status
+{
+	REGION_WORKER_UNKNOWN              	= 0;    //未知
+	REGION_WORKER_READY               	= 1;    //准备,待机
+	REGION_WORKER_BUSY					= 2; 	//工作正忙
+
+	REGION_WORKER_FAULT					= 10;	//故障
+}
+
+//定位模块状态
+message Measure_status_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required Id_struct					id_struct=2;
+
+    required Laser_manager_status       laser_manager_status = 3;       //大疆管理状态
+    repeated Laser_statu                laser_statu_vector = 4;         //大疆雷达设备状态
+    required Locate_manager_status      locate_manager_status = 5;      //大疆定位算法状态
+
+    required Error_manager              error_manager = 6;
+}
+
+
+//定位请求消息
+message Measure_request_msg
+{
+    required Base_info                  base_info=1;        //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+    required Id_struct					id_struct=3;          //终端id
+}
+
+//定位测量返回消息
+message Measure_response_msg
+{
+    required Base_info                  base_info=1;                         //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+    required Id_struct					id_struct=3;
+
+    optional Locate_information         locate_information=4;
+    required Error_manager              error_manager = 5;
+}
+
+//地面测量请求消息
+message Ground_detect_request_msg
+{
+    required Base_info                  base_info=1;        //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+    required Id_struct					id_struct=3;          //终端id
+}
+
+//地面测量反馈消息
+message Ground_detect_response_msg
+{
+    required Base_info                  base_info=1;                     //消息类型
+    required string                     command_key=2;                   //指令唯一标识符id
+    required Id_struct					id_struct=3;
+
+    optional Locate_information         locate_information=4;
+    required Error_manager              error_manager = 5;
+}
+
+// 电子围栏状态
+enum Ground_statu
+{
+    Nothing=0;
+    Noise=1;
+    Car_correct=2;
+    Car_border_reached=3;
+}
+
+message Ground_status_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required Id_struct					id_struct=2;
+
+    required Wanji_manager_status       wanji_manager_status = 3;       //万集管理状态
+    repeated Wanji_lidar_device_status  wanji_lidar_device_status = 4;  //万集设备身状态
+    required Region_worker_status       region_worker_status = 5;       //万集区域功能的状态
+    required Locate_information         locate_information_realtime = 6;//地面雷达的 实时定位信息
+    required Ground_statu               ground_status=7; // 电子围栏状态
+    required int32               	border_status=8; // 超界状态,为0表示正常,从末尾开始123456位分别代表前、后、左、右、底盘、车高超界
+
+    required Error_manager              error_manager = 9;
+    repeated Cloud_coordinate           cloud=10;     //点云坐标
+}
+
+
+
+//点云坐标
+message Cloud_coordinate
+{
+    required float                      x=1;
+    required float                      y=2;
+    required float                      z=3;
+}
+//点云类型
+message Cloud_type
+{
+    required int32                      type=1;
+}
+
+//筛选点云; 请求消息
+message Locate_sift_request_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;          //指令唯一标识符id
+    required Id_struct					id_struct=3;          //终端id
+    required int32                      lidar_id=4;             //雷达id
+    repeated Cloud_coordinate           cloud_coordinates=5;     //点云坐标
+}
+
+//筛选点云; 答复消息
+message Locate_sift_response_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;          //指令唯一标识符id
+    required Id_struct					id_struct=3;          //终端id
+    required int32                      lidar_id=4;             //雷达id
+    repeated Cloud_type                 cloud_type=5;            //点云类型
+    required Error_manager              error_manager = 6;      //错误码
+}

+ 27 - 7
parkspace_manager/message/message_base.proto

@@ -30,15 +30,17 @@ enum Message_type
     eParkspace_force_update_response_msg = 0x39;//手动修改车位反馈消息
     eParkspace_confirm_alloc_request_msg = 0x3A;//确认分配车位请求消息
     eParkspace_confirm_alloc_response_msg = 0x3B;//确认分配车位反馈消息
-    eParkspace_allocation_data_msg = 0x3C;     //车位分配模块车位数据消息
-    eParkspace_allocation_data_response_msg =0x3D;//车位数据反馈消息
+    eParkspace_refresh_request_msg=0x3C;                //请求更新车位数据
+    eParkspace_allocation_data_response_msg=0x3D;       //车位数据反馈消息
+    eParkspace_manual_search_request_msg = 0x3E;	//手动查询车位请求消息
+    eParkspace_manual_search_response_msg = 0x3F;//手动查询车位反馈消息
 
     eStore_command_request_msg=0x41;        //终端停车请求消息
     eStore_command_response_msg=0x42;       //停车请求反馈消息
     ePickup_command_request_msg=0x43;       //取车请求消息
     ePickup_command_response_msg=0x44;       //取车请求反馈消息
 
-
+    eTerminal_status_msg = 0x50;	 //终端状态消息
 
     eStoring_process_statu_msg=0x90;        //停车指令进度条消息
     ePicking_process_statu_msg=0x91;        //取车指令进度消息
@@ -50,6 +52,12 @@ enum Message_type
     eEntrance_manual_operation_msg=0xb0;            //针对出入口状态操作的手动消息
     eProcess_manual_operation_msg=0xb1;             //针对流程的手动消息
 
+    eNotify_request_msg=0xc0;               //取车等候区通知请求
+    eNotify_response_msg=0xc1;              //等候区反馈
+    eNotify_status_msg=0xc2;                //等候区通知节点状态
+
+    eUnNormalized_module_statu_msg = 0xd0; //非标节点状态
+
     eDispatch_plan_request_msg          = 0xe0;     //调度总规划的请求(用于启动整个调度算法)(调度管理->调度算法)
     eDispatch_plan_response_msg         = 0xe1;     //调度总规划的答复(调度算法->调度管理)
     eDispatch_control_request_msg       = 0xe2;     //调度控制的任务请求(调度算法->调度管理)
@@ -82,7 +90,8 @@ enum Communicator
     //调度机构
     eDispatch_control=0x0401;
     //...
-
+  //取车等候区通知节点
+    eNotify=0x0501;
 
     //地面测量单元
 	eGround_measurer=0x0f00;
@@ -145,6 +154,9 @@ message Locate_information
     optional bool locate_correct = 9[default = false];		    //整车的校准标记位
 
     optional float locate_front_theta = 10[default = 0];	    //整车的前轮的旋转角
+    optional float uniformed_car_x = 11;
+    optional float uniformed_car_y = 12;
+
 }
 
 //车辆基本信息
@@ -153,9 +165,10 @@ message Car_info
     optional float                      car_length=1[default = 0];           //车长
     optional float                      car_width=2[default = 0];            //车宽
     optional float                      car_height=3[default = 0];           //车高
-    optional string                     license=4[default = ""];              //车辆凭证号
-    optional float                      car_wheel_base = 5[default = 0];	    //整车的轮距; 前后轮的距离; 用于机器人或agv的抓车
-    optional float                      car_wheel_width = 6[default = 0];	//整车的轮距; 左右轮的距离; 用于机器人或agv的抓车
+    optional string                     license=4[default = ""];             //车辆凭证号(车牌号+唯一码)
+    optional string                     car_numberPlate = 5[default = ""];   //车牌号
+    optional float                      car_wheel_base = 6[default = 0];	 //整车的轮距; 前后轮的距离; 用于机器人或agv的抓车
+    optional float                      car_wheel_width = 7[default = 0];	 //整车的轮距; 左右轮的距离; 用于机器人或agv的抓车
 }
 
 //车位状态枚举
@@ -287,4 +300,11 @@ enum Dispatch_device_type
     PASSAGEWAY_5                            = 305;      //5号出入口
     PASSAGEWAY_6                            = 306;      //6号出入口
     PASSAGEWAY_7                            = 307;      //7号出口(在右侧电梯井, 只能取车)
+}
+
+//id结构体
+message Id_struct
+{
+    optional int32              terminal_id = 1;            //终端ID
+    optional int32              unit_id =  2;               //单元号
 }

+ 23 - 6
parkspace_manager/message/parkspace_allocation_message.proto

@@ -42,7 +42,7 @@ message Parkspace_allocation_request_msg
     required Base_info                  base_info=1;            //消息类型
     required string                     command_key=2;           //指令唯一标识符id
     required Car_info                   car_info=3;
-    required int32                      terminal_id=4;          //终端id,优化车位分配用
+    required Id_struct					id_struct=4;          //终端id,优化车位分配用
 }
 
 //分配车位反馈
@@ -55,7 +55,7 @@ message Parkspace_allocation_response_msg
     optional Car_type                   car_type = 5;//汽车类型
 }
 
-//2.查询车辆位置请求
+//2.查询车辆位置请求(根据车辆唯一标识码查询)
 message Parkspace_search_request_msg
 {
     required Base_info                  base_info=1;            //消息类型
@@ -71,6 +71,22 @@ message Parkspace_search_response_msg
     required Error_manager              error_manager=3;        //分配成功与否标志
     repeated Parkspace_info             query_parkspace_info_ex=4;         //待查询车辆存放位置
 }
+//手动查询车辆位置请求(根据车牌号查询)
+message Parkspace_manual_search_request_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;           //指令唯一标识符id
+    required Car_info                   car_info=3;              //车辆凭证或号牌
+}
+
+//手动查询车辆位置反馈
+message Parkspace_manual_search_response_msg
+{
+    required Base_info                  base_info=1;            //消息类型
+    required string                     command_key=2;           //指令唯一标识符id
+    required Error_manager              error_manager=3;        //分配成功与否标志
+    repeated Parkspace_info             query_parkspace_info_ex=4;         //待查询车辆存放位置
+}
 
 //3.释放车位请求
 message Parkspace_release_request_msg
@@ -133,10 +149,11 @@ message Parkspace_allocation_status_msg
     required Error_manager                  error_manager=2;
     required Database_controller_status     database_controller_status=3;           //数据库的状态
     required Parkspace_manager_satus        parkspace_manager_satus=4;              //车位管理状态
-    required int32                          small_parkspace_remaining_number=5;    //小型车位剩余数量
-    required int32                          medium_parkspace_remaining_number=6;   //中型车位剩余数量
-    required int32                          large_parkspace_remaining_number=7;    //大型车位剩余数量
-    required int32                          total_parkspace_remaining_number=8;    //所有车位剩余数量
+	required int32                          unit_id=5;								//单元号
+    required int32                          small_parkspace_remaining_number=6;    //小型车位剩余数量
+    required int32                          medium_parkspace_remaining_number=7;   //中型车位剩余数量
+    required int32                          large_parkspace_remaining_number=8;    //大型车位剩余数量
+    required int32                          total_parkspace_remaining_number=9;    //所有车位剩余数量
 }
 
 //更新车位数据请求

+ 156 - 0
parkspace_manager/message/process_message.proto

@@ -0,0 +1,156 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+//分配车位步骤状态
+message Alloc_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Car_info                   car_info=2;         //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_alloc_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             allocated_parkspace_info_ex=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+
+//查询车位步骤状态
+message Search_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             search_parkspace_info_ex=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_search_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Car_info                   car_info=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+
+//确认占用车位步骤状态
+message Confirm_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             confirm_parkspace_info_ex=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_confirm_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             confirm_parkspace_info_ex=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+
+//解锁/释放车位步骤状态
+message Release_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             release_parkspace_info_ex=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_release_space_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             release_parkspace_info_ex=2;       //当前状态附带信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+
+//对比节点
+message Compare_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Locate_information         locate_info_wj=2;      //wj定位结果
+    optional Locate_information         locate_info_dj=3;      //dj定位结果
+    optional Locate_information         locate_info_result=4;      //定位结果
+    optional string                     description=5;      //状态说明/错误说明
+}
+message Back_compare_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Locate_information         locate_info_wj=2;      //wj定位结果
+    optional Locate_information         locate_info_dj=3;      //wj定位结果
+    optional Locate_information         locate_info_result=4;      //wj定位结果
+    optional string                     description=5;      //状态说明/错误说明
+}
+//停车调度步骤状态
+message Dispatch_store_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Locate_information         locate_info=2;      //定位结果
+    repeated Parkspace_info             allocated_parkspace_info_ex=3;//目标车位
+    optional string                     description=4;      //状态说明/错误说明
+}
+message Back_dispatch_store_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Locate_information         locate_info=2;      //定位结果
+    repeated Parkspace_info             allocated_parkspace_info_ex=3;//目标车位
+    optional string                     description=4;      //状态说明/错误说明
+}
+
+//取车调度步骤状态
+message Dispatch_pick_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             search_parkspace_info_ex=2;//目标车位
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_dispatch_pick_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    repeated Parkspace_info             search_parkspace_info_ex=2;       //目标车位
+    optional string                     description=3;      //状态说明/错误说明
+}
+
+//取车等待车辆离开
+message Waitfor_leave_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Car_info                   car_info=2;         //车辆信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+message Back_waitfor_leave_step_statu
+{
+    optional Step_statu                 step_statu=1 [default=eWaiting];       //状态
+    optional Car_info                   car_info=2;         //车辆信息
+    optional string                     description=3;      //状态说明/错误说明
+}
+
+//停车流程进度消息
+message Storing_process_statu_msg
+{
+    required Base_info                          base_info=1;
+    required Id_struct							id_struct=2;              //终端id
+    required string                             license=3;
+
+    optional Alloc_space_step_statu             alloc_space_step=4;
+    optional Compare_step_statu                 compare_step=6;
+    optional Dispatch_store_step_statu          dispatch_step=7;
+    optional Confirm_space_step_statu           confirm_space_step=8;
+    optional bool                              completed=9 [default=false];
+    optional Back_confirm_space_step_statu      back_confirm_step=10;
+    optional Back_dispatch_store_step_statu     back_dispatch_step=11;
+    optional Back_compare_step_statu            back_compare_step=12;
+    optional Back_alloc_space_step_statu        back_alloc_space_step=14;
+    optional bool                               back_completed=15 [default=false];
+}
+
+//取车流程进度消息
+message Picking_process_statu_msg
+{
+    required Base_info                          base_info=1;
+    required Id_struct							id_struct=2;              //终端id
+    required string                             license=3;
+    optional Search_space_step_statu            search_space_step=4;
+    optional Dispatch_pick_step_statu           dispatch_step=5;
+    optional Release_space_step_statu           release_space_step=6;
+    optional Waitfor_leave_step_statu           waitfor_leave_step=7;
+    optional bool                               completed=8 [default=false];
+    optional Back_waitfor_leave_step_statu      back_waitfor_leave_step=9;
+    optional Back_dispatch_pick_step_statu      back_dispatch_step=10;
+    optional Back_search_space_step_statu       back_search_space_step_statu=11;
+    optional bool                               back_completed=12 [default=false];
+}

+ 1 - 0
parkspace_manager/message/proto.bat

@@ -0,0 +1 @@
+D:\protobuf-master\protobuf-MD-build\Release\protoc.exe  --csharp_out=.\ .\*.proto

+ 211 - 0
parkspace_manager/message/singlechip_msg.proto

@@ -0,0 +1,211 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+//连接口
+message InputDi
+{
+	optional int32	Di0 = 1;  //停车超前光电(0正常,1超界故障)
+	optional int32	Di1 = 2;  //停车超后光电(0正常,1超界故障)
+	optional int32	Di2 = 3;  //停车超左光电(0正常,1超界故障)
+	optional int32	Di3 = 4;  //停车超1550光电(0正常,1超界故障)
+	optional int32	Di4 = 5;  //2050高度(0默认,1被触发)
+	optional int32	Di5 = 6;  //1750高度(0默认,1被触发)
+	optional int32	Di6 = 7;  //2050高度(0默认,1被触发)
+	optional int32	Di7 = 8;  //预留
+	optional int32	Di8 = 9;  //停车库门开到位(1表示开到位)	
+	optional int32	Di9 = 10; //停车库门关到位(1表示关到位)
+	optional int32	Di10 = 11;//预留的门故障位(1表示门故障)
+	optional int32	Di11 = 12;//调度完成标志位,是否允许终端放下一辆车进入入口(0调度正忙,1调度允许下一辆车)
+	optional int32	Di12 = 13;//库内光电,判断门内是否有车(0无车,1有车)
+	optional int32	Di13 = 14;//库外地磁 ,判断门外(0无车,1有车)
+	optional int32	Di14 = 15;//重启
+	optional int32	Di15 = 16;//急停
+}
+//连接口
+message OutputDo
+{
+	optional int32	Do0 = 1;	//外门 开门(1)
+	optional int32	Do1 = 2;    //外门 关门(1)
+	optional int32	Do2 = 3;    //备用
+	optional int32	Do3 = 4;	//备用
+	optional int32	Do4 = 5;	//备用
+	optional int32	Do5 = 6;	//备用
+	optional int32	Do6 = 7;	//备用
+	optional int32	Do7 = 8;	//备用
+
+}
+//流程控制
+enum Process_control
+{
+	PROCESS_CONTROL_UNKNOWN			= 0;//未知
+	PROCESS_CONTROL_FULL_AUTO		= 1;//全自动,
+	PROCESS_CONTROL_MANUAL			= 2;//手动
+	PROCESS_CONTROL_AUTO_CLOSE		= 3;//半自动关门
+	PROCESS_CONTROL_AUTO_OPEN		= 4;//半自动开门
+	PROCESS_CONTROL_TO_READY		= 5;//切换到待机
+
+
+	PROCESS_CONTROL_RESET			= 7;//重启
+	PROCESS_CONTROL_STOP			= 8;//急停
+	PROCESS_CONTROL_FAULT			= 9;//故障
+
+	
+	PROCESS_CONTROL_INLET_0		= 10 ;//未知
+	PROCESS_CONTROL_INLET_1		= 11 ;//未知
+	PROCESS_CONTROL_INLET_2		= 12 ;//未知
+	PROCESS_CONTROL_INLET_3		= 13 ;//未知
+	PROCESS_CONTROL_INLET_4		= 14 ;//未知
+	PROCESS_CONTROL_INLET_5		= 15 ;//未知
+	PROCESS_CONTROL_INLET_6		= 16 ;//未知
+	PROCESS_CONTROL_INLET_7		= 17 ;//未知
+	PROCESS_CONTROL_INLET_8		= 18 ;//未知
+	PROCESS_CONTROL_INLET_9		= 19 ;//未知
+	
+	PROCESS_CONTROL_OUTLET_0		= 30 ;//未知
+	PROCESS_CONTROL_OUTLET_1		= 31 ;//未知
+	PROCESS_CONTROL_OUTLET_2		= 32 ;//未知
+	PROCESS_CONTROL_OUTLET_3		= 33 ;//未知
+	PROCESS_CONTROL_OUTLET_4		= 34 ;//未知
+	PROCESS_CONTROL_OUTLET_5		= 35 ;//未知
+	PROCESS_CONTROL_OUTLET_6		= 36 ;//未知
+	PROCESS_CONTROL_OUTLET_7		= 37 ;//未知
+	PROCESS_CONTROL_OUTLET_8		= 38 ;//未知
+	PROCESS_CONTROL_OUTLET_9		= 39 ;//未知
+	
+};
+//终端给单片机
+message terminal_msg
+{
+    optional    int32		        TerminalID = 1;		// 终端号(单片机号)
+    optional    int32   		    DispatchDirection= 2;	// 方向(1入口,2出口)
+    optional    Process_control 	ProcessControl= 3;	 	// 门控
+    optional    OutputDo       	    OutPutDo= 4; 		// 输入口
+
+}
+//超界状态
+enum Over_border_status
+{
+	OVER_BORDER_STATUS_UNKNOWN		= 0 ;//未知
+	OVER_BORDER_STATUS_NORMAL		= 1 ;//正常
+	OVER_BORDER_STATUS_FRONT		= 2 ;//前超界
+	OVER_BORDER_STATUS_BACK			= 3 ;//后超界
+	OVER_BORDER_STATUS_LEFT			= 4 ;//左超界
+	OVER_BORDER_STATUS_RIGHT		= 5 ;//右超界
+};
+//车高状态
+enum Car_height_status	
+{
+	CAR_HEIGHT_STATUS_UNKNOWN		= 0 ;//未知
+	CAR_HEIGHT_STATUS_SMALL 		= 1 ;//小车
+	CAR_HEIGHT_STATUS_MEDIUM 		= 2 ;//中车
+	CAR_HEIGHT_STATUS_LARGE			= 3 ;//大车
+	CAR_HEIGHT_STATUS_HUGE			= 4 ;//巨大车
+	CAR_HEIGHT_STATUS_FAULT			= 5 ;//故障车
+};
+
+//外门的状态
+enum Outside_door_status
+{
+	OUTSIDE_DOOR_STATUS_UNKNOWN		= 0 ;//未知
+	OUTSIDE_DOOR_STATUS_OPEN		= 1 ;//外门开到位
+	OUTSIDE_DOOR_STATUS_CLOSE		= 2 ;//外门关到位
+	OUTSIDE_DOOR_STATUS_RUN			= 3 ;//外门运行中
+	OUTSIDE_DOOR_STATUS_FAULT		= 4 ;//外门故障
+};
+
+//外门的控制
+enum Outside_door_control
+{
+	OUTSIDE_DOOR_CONTROL_UNKNOWN	= 0 ;//未知
+	OUTSIDE_DOOR_CONTROL_OPEN		= 1 ;//外门开
+	OUTSIDE_DOOR_CONTROL_CLOSE		= 2 ;//外门关
+
+};
+//流程状态
+enum Process_status
+{
+	PROCESS_STATUS_UNKNOWN			= 0;//未知
+	PROCESS_STATUS_FULL_AUTO	    = 1;//全自动,
+	PROCESS_STATUS_MANUAL			= 2;//手动
+	PROCESS_STATUS_AUTO_CLOSE		= 3;//半自动关门
+	PROCESS_STATUS_AUTO_OPEN		= 4;//半自动开门
+	PROCESS_STATUS_TO_READY			= 5;//切换到待机
+	
+	PROCESS_STATUS_RESET			= 7;//重启
+	PROCESS_STATUS_STOP				= 8;//急停
+	PROCESS_STATUS_FAULT			= 9;//故障
+	
+	//自动模式的步骤
+	PROCESS_STATUS_INLET_0		= 10 ;//入口待机, 等待门外地感触发。
+	PROCESS_STATUS_INLET_1		= 11 ;//执行开门
+	PROCESS_STATUS_INLET_2		= 12 ;//等待门开到位
+	PROCESS_STATUS_INLET_3		= 13 ;//等待汽车进入
+	PROCESS_STATUS_INLET_4		= 14 ;//停车完成,统计汽车经过门口的车高。
+	PROCESS_STATUS_INLET_5		= 15 ;//等待终端关门,执行关门
+	PROCESS_STATUS_INLET_6		= 16 ;//等待门关到位
+	PROCESS_STATUS_INLET_7		= 17 ;//等待plc调度,或者终端重置
+	PROCESS_STATUS_INLET_8		= 18 ;//未知
+	PROCESS_STATUS_INLET_9		= 19 ;//未知
+
+	PROCESS_STATUS_INLET_10		= 20 ;//入口待机, 等待门外地感触发。
+	PROCESS_STATUS_INLET_11		= 21 ;//执行开门
+	PROCESS_STATUS_INLET_12		= 22 ;//等待门开到位
+	PROCESS_STATUS_INLET_13		= 23 ;//等待汽车进入
+	PROCESS_STATUS_INLET_14		= 24 ;//停车完成,统计汽车经过门口的车高。
+	PROCESS_STATUS_INLET_15		= 25 ;//等待终端关门,执行关门
+	PROCESS_STATUS_INLET_16		= 26 ;//等待门关到位
+	PROCESS_STATUS_INLET_17		= 27 ;//等待plc调度,或者终端重置
+	PROCESS_STATUS_INLET_18		= 28 ;//未知
+	PROCESS_STATUS_INLET_19		= 29 ;//未知
+	
+	PROCESS_STATUS_OUTLET_0		= 30 ;//出口待机,等待终端开门,执行开门
+	PROCESS_STATUS_OUTLET_1		= 31 ;//等待门开到位
+	PROCESS_STATUS_OUTLET_2		= 32 ;//等待门口的光电产生信号,表示汽车正从车库出去。汽车正在离开中。
+	PROCESS_STATUS_OUTLET_3		= 33 ;//汽车离开后,延迟5秒关门,执行关门
+	PROCESS_STATUS_OUTLET_4		= 34 ;//等待门关到位
+	PROCESS_STATUS_OUTLET_5		= 35 ;//等待plc调度,或者终端重置
+	PROCESS_STATUS_OUTLET_6		= 36 ;//未知
+	PROCESS_STATUS_OUTLET_7		= 37 ;//未知
+	PROCESS_STATUS_OUTLET_8		= 38 ;//未知
+	PROCESS_STATUS_OUTLET_9		= 39 ;//未知
+	
+	PROCESS_STATUS_OUTLET_10		= 40 ;//出口待机,等待终端开门,执行开门
+	PROCESS_STATUS_OUTLET_11		= 41 ;//等待门开到位
+	PROCESS_STATUS_OUTLET_12		= 42 ;//等待门口的光电产生信号,表示汽车正从车库出去。汽车正在离开中。
+	PROCESS_STATUS_OUTLET_13		= 43 ;//汽车离开后,延迟5秒关门,执行关门
+	PROCESS_STATUS_OUTLET_14		= 44 ;//等待门关到位
+	PROCESS_STATUS_OUTLET_15		= 45 ;//等待plc调度,或者终端重置
+	PROCESS_STATUS_OUTLET_16		= 46 ;//未知
+	PROCESS_STATUS_OUTLET_17		= 47 ;//未知
+	PROCESS_STATUS_OUTLET_18		= 48 ;//未知
+	PROCESS_STATUS_OUTLET_19		= 49 ;//未知
+};
+//单片机给终端
+message Singlechip_data
+{
+    optional  int32		            TerminalID= 1;	  	// 终端号(单片机号)
+    optional  int32   		        DispatchDirection= 2;	// 方向(1入口,2出口)
+    optional  Process_status	    ProcessStatus=   3;		//流程状态
+    optional  InputDi		        InPutDi = 4; 		// 输入口
+    optional  int32		            ResetFlag = 5;		//重置标志位
+    optional  Process_control	    ProcessControl = 6;		//流程控制
+    optional  int32		            InsideExistenceFlag = 7;	//内部存在标志
+    optional  Over_border_status	OverBorderStatus = 8;	//边界状态
+    optional  Car_height_status	    CarHeightStatusCurrent = 9;	//当前车高状态--斜角对射光电
+    optional  Car_height_status	    CarHeightStatusPassing = 10;	//车高状态--门口经过式光电
+    optional  int32		            StopFlag = 11;		//停车标志位
+    optional  Outside_door_status	OutsideDoorStatus = 12;	//外门状态
+    optional  Outside_door_control	OutsideDoorControl = 13;	//外门控制
+    optional  int32		            DispatchFinishFlag = 14;	//调度完成标志
+    optional  int32		            OutsideExistenceFlag = 15;	//外部存在标志
+}
+//终端状态消息
+message Terminal_status_msg
+{
+	required Base_info	 	    base_info =1; //消息类型
+	optional Id_struct	 	    id_struct=2; //终端号
+	optional Singlechip_data	singlechipData=3; //单片机的数据
+	optional bool		singlechip_validity = 4;//单片机数据有效性
+}
+
+

+ 39 - 0
parkspace_manager/message/terminal_message.proto

@@ -0,0 +1,39 @@
+syntax = "proto2";
+package message;
+import "message_base.proto";
+
+
+message Store_command_request_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required Id_struct					id_struct=2;              //终端id
+    required Locate_information         locate_information=3;       //终端测量数据,主要需要车高和车宽
+    required Car_info                   car_info=4;                  //车辆标识(车牌号)
+}
+
+
+message Store_command_response_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required Id_struct					id_struct=2;              //终端id
+    required Error_manager              code=3;            //请求结果码
+    optional string                     license=4;
+}
+
+
+message Pickup_command_request_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required Id_struct					id_struct=2;              //终端id
+    required Car_info                    car_info=4;                  //车辆信息
+
+}
+
+
+message Pickup_command_response_msg
+{
+    required Base_info                  base_info=1;                 //消息类型
+    required Id_struct					id_struct=2;              //终端id
+    required Error_manager              code=3;            //请求结果码
+    optional string                     license=4;
+}

+ 2 - 1
parkspace_manager/packages.config

@@ -2,7 +2,8 @@
 <packages>
   <package id="Google.Protobuf" version="3.17.3" targetFramework="net45" />
   <package id="Google.Protobuf.Tools" version="3.12.4" targetFramework="net45" />
-  <package id="NNanomsg" version="0.5.2" targetFramework="net45" />
+  <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
+  <package id="NNanomsg" version="0.5.2" targetFramework="net48" />
   <package id="System.Buffers" version="4.4.0" targetFramework="net45" />
   <package id="System.Memory" version="4.5.3" targetFramework="net45" />
   <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net45" />

+ 107 - 16
parkspace_manager/parkspace_manager.csproj

@@ -8,10 +8,11 @@
     <OutputType>WinExe</OutputType>
     <RootNamespace>parkspace_manager</RootNamespace>
     <AssemblyName>parkspace_manager</AssemblyName>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -32,6 +33,46 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x64\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <LangVersion>7.3</LangVersion>
+    <ErrorReport>prompt</ErrorReport>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+    <OutputPath>bin\x64\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <LangVersion>7.3</LangVersion>
+    <ErrorReport>prompt</ErrorReport>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="db, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -44,6 +85,9 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>sdk\mysql\MySql.Data.dll</HintPath>
     </Reference>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
     <Reference Include="NNanomsg, Version=0.5.2.0, Culture=neutral, processorArchitecture=MSIL">
       <HintPath>..\packages\NNanomsg.0.5.2\lib\net40\NNanomsg.dll</HintPath>
     </Reference>
@@ -70,19 +114,31 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="communication\Communicator.cs" />
+    <Compile Include="Arrow.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="Arrow.Designer.cs">
+      <DependentUpon>Arrow.cs</DependentUpon>
+    </Compile>
+    <Compile Include="communication\communication_socket_base.cs" />
+    <Compile Include="communication\monitor_communication.cs" />
     <Compile Include="db_manager\DBManager.cs" />
-    <Compile Include="Form1.cs">
+    <Compile Include="MainForm.cs">
       <SubType>Form</SubType>
     </Compile>
-    <Compile Include="Form1.Designer.cs">
-      <DependentUpon>Form1.cs</DependentUpon>
+    <Compile Include="MainForm.Designer.cs">
+      <DependentUpon>MainForm.cs</DependentUpon>
     </Compile>
-    <Compile Include="FormParkSpaceStatus.cs">
+    <Compile Include="message\DispatchMessage.cs" />
+    <Compile Include="message\MeasureMessage.cs" />
+    <Compile Include="message\ProcessMessage.cs" />
+    <Compile Include="message\SinglechipMsg.cs" />
+    <Compile Include="message\UnNormalizedModuleMessage.cs" />
+    <Compile Include="MonitorMainWindows.cs">
       <SubType>Form</SubType>
     </Compile>
-    <Compile Include="FormParkSpaceStatus.Designer.cs">
-      <DependentUpon>FormParkSpaceStatus.cs</DependentUpon>
+    <Compile Include="MonitorMainWindows.Designer.cs">
+      <DependentUpon>MonitorMainWindows.cs</DependentUpon>
     </Compile>
     <Compile Include="FormStatusSelect.cs">
       <SubType>Form</SubType>
@@ -90,24 +146,47 @@
     <Compile Include="FormStatusSelect.Designer.cs">
       <DependentUpon>FormStatusSelect.cs</DependentUpon>
     </Compile>
-    <Compile Include="LOG\Credence.cs" />
-    <Compile Include="LOG\log.cs" />
-    <Compile Include="LOG\LogManager.cs" />
-    <Compile Include="LOG\LogTest.cs" />
+    <Compile Include="LED.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="LED.Designer.cs">
+      <DependentUpon>LED.cs</DependentUpon>
+    </Compile>
     <Compile Include="message\MessageBase.cs" />
     <Compile Include="message\ParkspaceAllocationMessage.cs" />
+    <Compile Include="message\TerminalMessage.cs" />
     <Compile Include="Monitor\Monitor.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <EmbeddedResource Include="Form1.resx">
-      <DependentUpon>Form1.cs</DependentUpon>
+    <Compile Include="StepControl.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="StepControl.Designer.cs">
+      <DependentUpon>StepControl.cs</DependentUpon>
+    </Compile>
+    <Compile Include="TimedData.cs" />
+    <Compile Include="tool\jsonfileoperation\json_file_operation.cs" />
+    <Compile Include="tool\LOG\Credence.cs" />
+    <Compile Include="tool\LOG\log.cs" />
+    <Compile Include="tool\LOG\LogManager.cs" />
+    <Compile Include="tool\LOG\LogTest.cs" />
+    <Compile Include="tool\singleton\singleton.cs" />
+    <Compile Include="UIMessageData.cs" />
+    <EmbeddedResource Include="Arrow.resx">
+      <DependentUpon>Arrow.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="FormParkSpaceStatus.resx">
-      <DependentUpon>FormParkSpaceStatus.cs</DependentUpon>
+    <EmbeddedResource Include="MainForm.resx">
+      <DependentUpon>MainForm.cs</DependentUpon>
+    </EmbeddedResource>
+    <EmbeddedResource Include="MonitorMainWindows.resx">
+      <DependentUpon>MonitorMainWindows.cs</DependentUpon>
     </EmbeddedResource>
     <EmbeddedResource Include="FormStatusSelect.resx">
       <DependentUpon>FormStatusSelect.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="LED.resx">
+      <DependentUpon>LED.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -116,9 +195,21 @@
     <Compile Include="Properties\Resources.Designer.cs">
       <AutoGen>True</AutoGen>
       <DependentUpon>Resources.resx</DependentUpon>
+      <DesignTime>True</DesignTime>
     </Compile>
+    <EmbeddedResource Include="StepControl.resx">
+      <DependentUpon>StepControl.cs</DependentUpon>
+    </EmbeddedResource>
+    <None Include="bin\x86\Debug\settings.json" />
+    <None Include="bin\x86\Release\settings.json" />
+    <None Include="message\dispatch_message.proto" />
+    <None Include="message\measure_message.proto" />
     <None Include="message\message_base.proto" />
     <None Include="message\parkspace_allocation_message.proto" />
+    <None Include="message\process_message.proto" />
+    <None Include="message\singlechip_msg.proto" />
+    <None Include="message\terminal_message.proto" />
+    <None Include="message\UnNormalized_module_message.proto" />
     <None Include="packages.config" />
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>

+ 2 - 2
parkspace_manager/sdk/dotNetty/Microsoft.Extensions.FileProviders.Abstractions.xml

@@ -78,7 +78,7 @@
             <summary>
             Creates a <see cref="T:Microsoft.Extensions.Primitives.IChangeToken"/> for the specified <paramref name="filter"/>.
             </summary>
-            <param name="filter">Filter string used to determine what files or folders to monitor. Example: **/*.cs, *.*, subFolder/**/*.cshtml.</param>
+            <param name="filter">Filter string used to determine what files or folders to monitor_main_windows. Example: **/*.cs, *.*, subFolder/**/*.cshtml.</param>
             <returns>An <see cref="T:Microsoft.Extensions.Primitives.IChangeToken"/> that is notified when a file matching <paramref name="filter"/> is added, modified or deleted.</returns>
         </member>
         <member name="T:Microsoft.Extensions.FileProviders.NotFoundDirectoryContents">
@@ -200,7 +200,7 @@
             <summary>
             Returns a <see cref="T:Microsoft.Extensions.Primitives.IChangeToken"/> that monitors nothing.
             </summary>
-            <param name="filter">Filter string used to determine what files or folders to monitor. This parameter is ignored.</param>
+            <param name="filter">Filter string used to determine what files or folders to monitor_main_windows. This parameter is ignored.</param>
             <returns>A <see cref="T:Microsoft.Extensions.Primitives.IChangeToken"/> that does not register callbacks.</returns>
         </member>
     </members>

+ 1 - 1
parkspace_manager/sdk/dotNetty/Microsoft.Extensions.FileProviders.Physical.xml

@@ -315,7 +315,7 @@
                 <para>Globbing patterns are interpreted by <seealso cref="T:Microsoft.Extensions.FileSystemGlobbing.Matcher" />.</para>
             </summary>
             <param name="filter">
-            Filter string used to determine what files or folders to monitor. Example: **/*.cs, *.*,
+            Filter string used to determine what files or folders to monitor_main_windows. Example: **/*.cs, *.*,
             subFolder/**/*.cshtml.
             </param>
             <returns>

parkspace_manager/LOG/Credence.cs → parkspace_manager/tool/LOG/Credence.cs


parkspace_manager/LOG/LogManager.cs → parkspace_manager/tool/LOG/LogManager.cs


parkspace_manager/LOG/LogTest.cs → parkspace_manager/tool/LOG/LogTest.cs


parkspace_manager/LOG/log.cs → parkspace_manager/tool/LOG/log.cs


+ 96 - 0
parkspace_manager/tool/jsonfileoperation/json_file_operation.cs

@@ -0,0 +1,96 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System.Windows.Forms;
+namespace tool
+{
+    //json文件操作类  暂时只有读取字段功能 后续可拓展
+    class json_file_operation : Singleton<json_file_operation>
+    {
+        private json_file_operation()
+        {
+        }
+        //初始化--传入json文件路径
+        public void json_file_operation_init(string jsonPath)
+        {
+            this.jsonPath = jsonPath;
+            //string jsonArrayText1 = "[{'communication_bind':'127.0.0.1'} ,{'communication_bind':'127.0.0.2'} ]";
+            //JArray ja = (JArray)JsonConvert.DeserializeObject(jsonArrayText1);
+            //string ja1a = ja[1]["communication_bind"].ToString();
+            //Console.WriteLine(ja1a);
+
+        }
+        //读取json文件指定字段 返回string
+        public JArray read_json_jarray(string key)
+        {
+            try
+            {
+                using (System.IO.StreamReader file = System.IO.File.OpenText(jsonPath))
+                {
+                    try
+                    {
+                        using (JsonTextReader reader = new JsonTextReader(file))
+                        {
+                            JObject o = (JObject)JToken.ReadFrom(reader);
+                            string jsonArrayText1 = o[key].ToString();
+                            JArray ja = (JArray)JsonConvert.DeserializeObject(jsonArrayText1);
+                            return ja;
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        string tip = key + "字段不存在!";
+                        MessageBox.Show(tip);
+                        return null;
+
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                string tip = jsonPath + "  文件路径不存在!";
+                MessageBox.Show(tip);
+                return null;
+            }
+
+        }
+        //读取json文件指定字段 返回string
+        public string read_json_string(string key)
+        {
+            try
+            {
+                using (System.IO.StreamReader file = System.IO.File.OpenText(jsonPath))
+                {
+                    try
+                    {
+                        using (JsonTextReader reader = new JsonTextReader(file))
+                        {
+                            JObject o = (JObject)JToken.ReadFrom(reader);
+                            var value = o[key].ToString();
+                            return value;
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        string tip = key + "字段不存在!";
+                        MessageBox.Show(tip);
+                        return null;
+
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                string tip = jsonPath + "  文件路径不存在!";
+                MessageBox.Show(tip);
+                return null;
+            }
+
+        }
+        protected string jsonPath;
+    }
+}

+ 24 - 0
parkspace_manager/tool/singleton/singleton.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+namespace tool
+{
+    // 由于单例基类不能实例化,故设计为抽象类
+    public abstract class Singleton<T> where T : class
+    {
+        class Nested
+        {
+            // 创建模板类实例,参数2设为true表示支持私有构造函数
+            internal static readonly T instance = Activator.CreateInstance(typeof(T), true) as T;
+        }
+        private static T instance = null;
+        public static T Instance
+        {
+            get
+            {
+                return Nested.instance;
+            }
+        }
+    }
+}
+