|
@@ -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);
|
|
|
//恢复车辆状态
|