|
@@ -13,6 +13,7 @@ using parkMonitor.tools;
|
|
|
using parkMonitor.Database2;
|
|
|
using MySql.Data.MySqlClient;
|
|
|
using parkMonitor.server.NumMachine;
|
|
|
+using parkMonitor.server.broadcastModule;
|
|
|
|
|
|
namespace parkMonitor.server.CoreThread
|
|
|
{
|
|
@@ -137,7 +138,7 @@ namespace parkMonitor.server.CoreThread
|
|
|
PLCMsg = (PLCMessage)PLC.GetMessage();
|
|
|
}
|
|
|
bool occupied = true;
|
|
|
- if (PLCMsg != null && PLCMsg.originalPlcList.Count!=0)
|
|
|
+ if (PLCMsg != null && PLCMsg.originalPlcList.Count != 0)
|
|
|
{
|
|
|
if (robotID == 1)
|
|
|
{
|
|
@@ -201,9 +202,15 @@ namespace parkMonitor.server.CoreThread
|
|
|
/// <param name="isParking"></param>
|
|
|
public void Rollback(Command queueCmd, int parkingSpaceID, bool robotAllocated, bool isParking, LaserMessage lm)
|
|
|
{
|
|
|
- //命令回退
|
|
|
- queueCmd.returnedCount += 1;
|
|
|
- queuingThread.SetMessage(queueCmd);
|
|
|
+ if (queueCmd.id == 1)
|
|
|
+ {
|
|
|
+ BroadcastLinker.dispForAWhile(0, "流程中止", 8, false);
|
|
|
+ }
|
|
|
+ Console.WriteLine("回滚");
|
|
|
+ NumReset(queueCmd);
|
|
|
+ ////命令回退
|
|
|
+ //queueCmd.returnedCount += 1;
|
|
|
+ //queuingThread.SetMessage(queueCmd);
|
|
|
//机械手释放
|
|
|
if (robotAllocated)
|
|
|
{
|
|
@@ -221,6 +228,7 @@ namespace parkMonitor.server.CoreThread
|
|
|
RobotID = 1
|
|
|
};
|
|
|
PLC.SetMessage(cMsg);
|
|
|
+ oper.UpdateVehicleParkState(EntityForCore.remoteBQ, queueCmd.LicenseNum, 0);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -231,6 +239,7 @@ namespace parkMonitor.server.CoreThread
|
|
|
RobotID = 1
|
|
|
};
|
|
|
PLC.SetMessage(cMsg);
|
|
|
+ oper.UpdateVehicleParkState(EntityForCore.remoteBQ, queueCmd.LicenseNum, 1);
|
|
|
}
|
|
|
}
|
|
|
//释放激光
|
|
@@ -255,23 +264,6 @@ namespace parkMonitor.server.CoreThread
|
|
|
Log.WriteLog(LogType.NOT_DATABASE, LogFile.ERROR, "车位分配出现异常,需要重启");
|
|
|
return;
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ////复原已释放的车位
|
|
|
- //if (!ParkingSpaceManager.ins.SetParkingSpace(parkingSpaceID, 1))
|
|
|
- //{
|
|
|
- // EntityForCore.ins.globalStatus = false;
|
|
|
- // Log.WriteLog(LogType.NOT_DATABASE, LogFile.ERROR, "车位分配出现异常,需要重启");
|
|
|
- // return;
|
|
|
- //}
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (isParking)
|
|
|
- {
|
|
|
- oper.UpdateVehicleParkState(EntityForCore.remoteBQ, queueCmd.LicenseNum, 0);
|
|
|
if (robotAllocated)
|
|
|
{
|
|
|
oper.UpdateParkingSpaceState(EntityForCore.remoteBQ, parkingSpaceID, 0);
|
|
@@ -279,13 +271,50 @@ namespace parkMonitor.server.CoreThread
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- oper.UpdateVehicleParkState(EntityForCore.remoteBQ, queueCmd.LicenseNum, 1);
|
|
|
+ //复原已释放的车位
|
|
|
+ if (!ParkingSpaceManager.ins.SetParkingSpace(parkingSpaceID, 1))
|
|
|
+ {
|
|
|
+ EntityForCore.ins.globalStatus = false;
|
|
|
+ Log.WriteLog(LogType.NOT_DATABASE, LogFile.ERROR, "车位分配出现异常,需要重启");
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (robotAllocated)
|
|
|
{
|
|
|
oper.UpdateParkingSpaceState(EntityForCore.remoteBQ, parkingSpaceID, 1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //if (isParking)
|
|
|
+ //{
|
|
|
+ // oper.UpdateVehicleParkState(EntityForCore.remoteBQ, queueCmd.LicenseNum, 0);
|
|
|
+ // if (robotAllocated)
|
|
|
+ // {
|
|
|
+ // oper.UpdateParkingSpaceState(EntityForCore.remoteBQ, parkingSpaceID, 0);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // oper.UpdateVehicleParkState(EntityForCore.remoteBQ, queueCmd.LicenseNum, 1);
|
|
|
+ // if (robotAllocated)
|
|
|
+ // {
|
|
|
+ // oper.UpdateParkingSpaceState(EntityForCore.remoteBQ, parkingSpaceID, 1);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 号牌复位
|
|
|
+ /// </summary>
|
|
|
+ public void NumReset(Command queueCmd)
|
|
|
+ {
|
|
|
+ NumberMachineMessage numberMachineMessage = new NumberMachineMessage();
|
|
|
+ numberMachineMessage.aNode = new NumberMachineNode();
|
|
|
+ numberMachineMessage.aNode.ip = "";
|
|
|
+ numberMachineMessage.aNode.LicenseNum = queueCmd.LicenseNum;
|
|
|
+ queuingThread.SetMessage(numberMachineMessage);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -294,12 +323,52 @@ namespace parkMonitor.server.CoreThread
|
|
|
/// </summary>
|
|
|
public class StopCmd : AbstractCmd
|
|
|
{
|
|
|
- /// <summary>
|
|
|
- /// 停车数据库事务
|
|
|
- /// </summary>
|
|
|
- private void StopParkingSubmit()
|
|
|
+ private bool RangeValidation(Data data)
|
|
|
{
|
|
|
-
|
|
|
+ int temp = 0;
|
|
|
+ Console.WriteLine(data.centerX + "," + data.centerY + "," + data.angleA);
|
|
|
+ lock (EntityForCore.ins)
|
|
|
+ {
|
|
|
+ if (data.centerX > EntityForCore.ins.centerXLimit)
|
|
|
+ {
|
|
|
+ Console.WriteLine(EntityForCore.ins.centerXLimit);
|
|
|
+ BroadcastLinker.dispForAWhile(1, "x轴超限", 6, false);
|
|
|
+ //BroadcastLinker.ins.DispString(1, "x轴超限", 6);
|
|
|
+ BroadcastLinker.ins.AudioPlay("请注意");
|
|
|
+ temp += 1;
|
|
|
+ }
|
|
|
+ if (data.centerY > EntityForCore.ins.centerYLimit)
|
|
|
+ {
|
|
|
+ Console.WriteLine(EntityForCore.ins.centerYLimit);
|
|
|
+ BroadcastLinker.dispForAWhile(2, "y轴超限", 6, false);
|
|
|
+ //BroadcastLinker.ins.DispString(2, "y轴超限", 6);
|
|
|
+ BroadcastLinker.ins.AudioPlay("请注意");
|
|
|
+ temp += 2;
|
|
|
+ }
|
|
|
+ if (data.angleA > EntityForCore.ins.angleALimit)
|
|
|
+ {
|
|
|
+ Console.WriteLine(EntityForCore.ins.angleALimit);
|
|
|
+ BroadcastLinker.dispForAWhile(3, "角度超限", 6, false);
|
|
|
+ //BroadcastLinker.ins.DispString(3, "角度超限", 6);
|
|
|
+ BroadcastLinker.ins.AudioPlay("请注意");
|
|
|
+ temp += 4;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //Thread.Sleep(10000);
|
|
|
+ //for (int i = 0; i < 3; i++)
|
|
|
+ //{
|
|
|
+ // if ((state & 0x01) == 1)
|
|
|
+ // {
|
|
|
+ // BroadcastLinker.ins.DispDownStr(i + 1, 0);
|
|
|
+ // state = state >> 1;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //BroadcastLinker.ins.DispDownStr(1, 0);
|
|
|
+ //BroadcastLinker.ins.DispDownStr(2, 0);
|
|
|
+ //BroadcastLinker.ins.DispDownStr(3, 0);
|
|
|
+ if (temp > 0) return false;
|
|
|
+ else return true;
|
|
|
+ //return temp > 0 ? false : true;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 命令中号牌与对应号牌机中当前号牌比对,确认车辆
|
|
@@ -334,17 +403,7 @@ namespace parkMonitor.server.CoreThread
|
|
|
numberCheck.Wait();
|
|
|
return result;
|
|
|
}
|
|
|
- /// <summary>
|
|
|
- /// 号牌复位
|
|
|
- /// </summary>
|
|
|
- private void NumReset(Command queueCmd)
|
|
|
- {
|
|
|
- NumberMachineMessage numberMachineMessage = new NumberMachineMessage();
|
|
|
- numberMachineMessage.aNode = new NumberMachineNode();
|
|
|
- numberMachineMessage.aNode.ip = "";
|
|
|
- numberMachineMessage.aNode.LicenseNum = queueCmd.LicenseNum;
|
|
|
- queuingThread.SetMessage(numberMachineMessage);
|
|
|
- }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 车位资源
|
|
|
/// </summary>
|
|
@@ -618,6 +677,10 @@ namespace parkMonitor.server.CoreThread
|
|
|
public override void executeCmd(Command queueCmd)
|
|
|
{
|
|
|
//UILogServer.ins.info("停车流程:" + queueCmd.LicenseNum + "开始");
|
|
|
+ if (queueCmd.id == 1)
|
|
|
+ {
|
|
|
+ BroadcastLinker.dispForAWhile(0, "开始停车", 6, false);
|
|
|
+ }
|
|
|
Log.WriteLog(LogType.NOT_DATABASE, LogFile.LOG, "停车流程:" + queueCmd.LicenseNum + "开始");
|
|
|
string connectionStr = null; //数据库连接字符串
|
|
|
bool disappeared = false; //车辆检测结果
|
|
@@ -646,7 +709,8 @@ namespace parkMonitor.server.CoreThread
|
|
|
int freeSpaceCount = 0; //剩余空闲车位
|
|
|
dataReal = WaitForLaserResource(queueCmd, disappeared, out lmToBeReleased);
|
|
|
//判断激光资源有效性,无效代表超时且已点击回滚按钮
|
|
|
- if (dataReal == null)
|
|
|
+ //*****核对摆扫数据是否达标,未达标则将指令丢出,让用户重发指令
|
|
|
+ if (dataReal == null || !RangeValidation(dataReal))
|
|
|
{
|
|
|
Rollback(queueCmd, 0, false, true, lmToBeReleased);
|
|
|
return;
|
|
@@ -778,7 +842,16 @@ namespace parkMonitor.server.CoreThread
|
|
|
status = 2;
|
|
|
cm.status = status;
|
|
|
cm.RobotID = robotID;//启动对应机械手
|
|
|
-
|
|
|
+ if (queueCmd.id == 1)
|
|
|
+ {
|
|
|
+ //Task.Factory.StartNew(() =>
|
|
|
+ //{
|
|
|
+ BroadcastLinker.dispForAWhile(0, "抓车到" + ppp.parkingSpaceX, 60, false);
|
|
|
+ //BroadcastLinker.ins.DispString(0, "抓车到" + ppp.parkingSpaceX, 6);
|
|
|
+ //Thread.Sleep(5000);
|
|
|
+ //BroadcastLinker.ins.DispDownStr(0, 0);
|
|
|
+ //});
|
|
|
+ }
|
|
|
//激光数据
|
|
|
cm.centerX = Convert.ToString(dataReal.centerX);
|
|
|
cm.centerY = Convert.ToString(dataReal.centerY);
|
|
@@ -837,7 +910,17 @@ namespace parkMonitor.server.CoreThread
|
|
|
//int vehicleTypeID = oper.getVehicleTypeID(numberPlate);
|
|
|
//判断测量数据是否准确
|
|
|
//bool isDataRight = oper.IsDataRight(vehicleTypeLength, vehicleTypeWidth, vehicleTypeHeight, vehicleTypeWheelbase, vehicleTypeID);
|
|
|
-
|
|
|
+ if (queueCmd.id == 1)
|
|
|
+ {
|
|
|
+ //Task.Factory.StartNew(() =>
|
|
|
+ //{
|
|
|
+ BroadcastLinker.dispForAWhile(0, "停车完成", 10, true);
|
|
|
+ //BroadcastLinker.ins.DispString(0, "停车完成", 6);
|
|
|
+ BroadcastLinker.ins.AudioPlay("操作成功");
|
|
|
+ // Thread.Sleep(5000);
|
|
|
+ //BroadcastLinker.OriginState();
|
|
|
+ //});
|
|
|
+ }
|
|
|
//正常写入数据库
|
|
|
if (userID != 0)
|
|
|
{
|
|
@@ -1053,6 +1136,7 @@ namespace parkMonitor.server.CoreThread
|
|
|
public override void executeCmd(Command queueCmd)
|
|
|
{
|
|
|
//UILogServer.ins.info("取车流程:" + queueCmd.LicenseNum + "开始");
|
|
|
+ BroadcastLinker.dispForAWhile(0, "取车开始", 10, false);
|
|
|
Log.WriteLog(LogType.NOT_DATABASE, LogFile.LOG, "取车流程:" + queueCmd.LicenseNum + "开始");
|
|
|
Vehicle vehiclelist = null; //待取车辆信息
|
|
|
ControlMessage cm = null;
|
|
@@ -1140,6 +1224,12 @@ namespace parkMonitor.server.CoreThread
|
|
|
cm.rearWheelbase = rearwheelbase;
|
|
|
PLC.SetMessage(cm);
|
|
|
|
|
|
+
|
|
|
+ BroadcastLinker.dispForAWhile(0, "放车到" + ps.parkingSpaceX, 60, false);
|
|
|
+ //BroadcastLinker.ins.DispString(0, "放车到" + ps.parkingSpaceX, 6);
|
|
|
+ //Thread.Sleep(5000);
|
|
|
+ //BroadcastLinker.ins.DispDownStr(0, 0);
|
|
|
+
|
|
|
Log.WriteLog(LogType.NOT_DATABASE, LogFile.LOG, "取车流程:" + queueCmd.LicenseNum + "取车");
|
|
|
UILogServer.ins.info("取车流程:" + queueCmd.LicenseNum + "取车");
|
|
|
//等待PLC取车完成信号
|
|
@@ -1180,6 +1270,12 @@ namespace parkMonitor.server.CoreThread
|
|
|
//ManualParkingSimul.ins.Update(Int32.Parse(queueCmd.LicenseNum.Substring(2, 1)));
|
|
|
//ParkingSimul.ins.Update(Int32.Parse(queueCmd.LicenseNum.Substring(2, 1)));
|
|
|
|
|
|
+ BroadcastLinker.dispForAWhile(0, "取车完成", 10, true);
|
|
|
+ //BroadcastLinker.ins.DispString(0, "停车完成", 6);
|
|
|
+ BroadcastLinker.ins.AudioPlay("谢谢惠顾,一路顺风");
|
|
|
+ // Thread.Sleep(5000);
|
|
|
+ //BroadcastLinker.OriginState();
|
|
|
+
|
|
|
int freeSpaceCount = ParkingSpaceManager.ins.GetFreeSpaceCount();
|
|
|
//数据库更新
|
|
|
lock (Parking_Space.RecordLock)
|