Browse Source

加入部分提示

yc_t 6 năm trước cách đây
mục cha
commit
16212088ed

+ 2 - 2
PLCLinker/PLCS7/PLCS7.cs

@@ -396,8 +396,8 @@ namespace PLCS7
                     //byte[] temp = BitConverter.GetBytes(BytesRevert(mbs.licenseReceived));
                     if (mbs.centralHearbeat != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset + 8, BitConverter.GetBytes(BytesRevert(mbs.centralHearbeat))); }
                     if (mbs.licenseReceived != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset, BitConverter.GetBytes(BytesRevert(mbs.licenseReceived))); }
-                    if (mbs.bookParkCmd != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset, BitConverter.GetBytes(BytesRevert(mbs.bookParkCmd))); }
-                    if (mbs.bookFetchCmd != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset, BitConverter.GetBytes(BytesRevert(mbs.bookFetchCmd))); }
+                    if (mbs.bookParkCmd != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset - 4, BitConverter.GetBytes(BytesRevert(mbs.bookParkCmd))); }
+                    if (mbs.bookFetchCmd != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset - 2, BitConverter.GetBytes(BytesRevert(mbs.bookFetchCmd))); }
                     //ErrorCode ec = plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset, temp);
                     //if (!ec.Equals(ErrorCode.NoError)) { return false; }
                 }

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


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


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


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


+ 2 - 2
PLCLinker/centralController/App.config

@@ -8,8 +8,8 @@
     <!--数据库信息-->
     <!--<add key="remoteDBConnStr" value="Data Source=59.175.148.85;port=3306;uid=root;pooling=true;max pool size=1024;pwd=x5;database=zxpark;CharSet=utf8;Allow Zero Datetime=true;"/>-->
     <!--<add key="remoteDBConnStr" value="Data Source=192.168.111.61;port=3306;uid=remote;pooling=true;max pool size=1024;pwd=x5;database=zxpark_cloud_2;CharSet=utf8;Allow Zero Datetime=true;"/>-->
-    <add key="remoteDBConnStr" value="Data Source=127.0.0.1;port=20000;uid=root;pooling=true;max pool size=1024;pwd=yct;database=zxpark_cloud_2;CharSet=utf8;Allow Zero Datetime=true;"/>
-    <!--<add key="remoteDBConnStr" value="Data Source=192.168.10.121;port=3306;uid=remote;pooling=true;max pool size=1024;pwd=x5;database=zxpark_cloud_2;CharSet=utf8;Allow Zero Datetime=true;"/>-->
+    <!--<add key="remoteDBConnStr" value="Data Source=127.0.0.1;port=20000;uid=root;pooling=true;max pool size=1024;pwd=yct;database=zxpark_cloud_2;CharSet=utf8;Allow Zero Datetime=true;"/>-->
+    <add key="remoteDBConnStr" value="Data Source=192.168.10.121;port=3306;uid=remote;pooling=true;max pool size=1024;pwd=x5;database=zxpark_cloud_2;CharSet=utf8;Allow Zero Datetime=true;"/>
     <add key="localDBConnStr" value="Data Source=127.0.0.1;port=20000;uid=root;pooling=true;max pool size=1024;pwd=yct;database=zxpark_local;CharSet=utf8;Allow Zero Datetime=true;"/>
     <add key="DBtimeout" value="3"/>
     <!--号牌机信息-->

+ 2 - 0
PLCLinker/centralController/Terminal/Terminal.cs

@@ -682,6 +682,7 @@ namespace Terminal
                     if (Monitor.Monitor.webServer.ReservedCarCheck(license))
                     {
                         registered = 3;
+                        Monitor.Monitor.SetNotification("预约车辆入场");
                     }
                     #region 通过数据库查询是否预约车,方法待定
                     //int vehicleState = -1;
@@ -723,6 +724,7 @@ namespace Terminal
                         receiptNum = -1
                     };
                     Monitor.Monitor.PLC.WriteToPLC(ts, PLCDataType.terminal);
+                    Monitor.Monitor.SetNotification("指令写入PLC:"+ts.btnStatus);
                     Thread.Sleep(1000);
                 }
                 else

+ 10 - 4
PLCLinker/centralController/WebServer/WebServer.cs

@@ -222,11 +222,12 @@ namespace centralController.WebServer
                     case "RESERVE":
                         if (msg.sender != "" && msg.bookTime != "" && msg.bookLength != 0)
                         {
+                            MessageUTF8 returnMsg = new MessageUTF8();
                             if (!ReservationValidate(msg))
                             {
                                 //回复预约失败给web
-                                msg.cmd = "FAILED";
-                                comm.SendMessage(msg);
+                                returnMsg.cmd = "FAILED";
+                                comm.SendMessage(returnMsg);
                             }
                             else
                             {
@@ -238,8 +239,8 @@ namespace centralController.WebServer
                                 ReserveDBOperation(true, msg.sender, true, msg.context, msg.bookTime, msg.bookLength);
                                 ReserveDBOperation(false, msg.sender, true, msg.context, msg.bookTime, msg.bookLength);
                                 //回复成功给web
-                                msg.cmd = "0";
-                                comm.SendMessage(msg);
+                                returnMsg.cmd = "0";
+                                comm.SendMessage(returnMsg);
                             }
                         }
                         break;
@@ -297,6 +298,7 @@ namespace centralController.WebServer
                         licenseReceived = -1
                     };
                     Monitor.Monitor.PLC.WriteToPLC(mb, PLCDataType.central);
+                    Monitor.Monitor.SetNotification(mb.bookParkCmd+","+mb.bookFetchCmd+"预约停车指令写入PLC");
                     break;
                 }
                 if (countdown == 2)
@@ -332,12 +334,15 @@ namespace centralController.WebServer
                             DateTime startTime = DateTime.Parse(msg.bookTime);
                             TimeSpan ts = DateTime.Now - startTime;
                             //达到预约启动时间,放入已预约队列
+                            Console.WriteLine("当前时间差:"+ts.TotalMinutes+",指令类型:"+msg.cmd);
                             if (ts.TotalMinutes >= 0)
                             {
+                                Console.WriteLine();
                                 //如果是预约停车,通知PLC减少一个可预约车位数
                                 if (msg.cmd == "RESERVE")
                                 {
                                     SendBookCmd(true, 1);
+                                    Monitor.Monitor.SetNotification("通知PLC减少可预约车位");
                                 }
                                 lock (reservedLock)
                                 {
@@ -365,6 +370,7 @@ namespace centralController.WebServer
                             //预约超时
                             if (ts.TotalMinutes > msg.bookLength * 60)
                             {
+                                Monitor.Monitor.SetNotification("预约已超时");
                                 //通知PLC将可预约车位数恢复一个
                                 SendBookCmd(true, 2);
                                 //恢复车辆状态

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