|
@@ -155,25 +155,25 @@ namespace parkMonitor.server.CoreThread
|
|
|
if (!queueCmd.manual)
|
|
|
{
|
|
|
connectionStr = "SqlConnectionStr";
|
|
|
- int freeSpaceCount = oper.getGarageFreeSpace(connectionStr,queueCmd.garageID);
|
|
|
+ int freeSpaceCount = oper.getGarageFreeSpace(connectionStr, queueCmd.garageID);
|
|
|
if (isParking)
|
|
|
{
|
|
|
- oper.UpdateVehicleParkState(connectionStr,queueCmd.LicenseNum, 0);
|
|
|
+ oper.UpdateVehicleParkState(connectionStr, queueCmd.LicenseNum, 0);
|
|
|
if (parkingSpaceUpdated)
|
|
|
{
|
|
|
freeSpaceCount = freeSpaceCount + 1;
|
|
|
- oper.UpdateGarageFreeSpace(connectionStr,freeSpaceCount, queueCmd.garageID);
|
|
|
- oper.UpdateParkingSpaceState(connectionStr,parkingSpaceID, 0);
|
|
|
+ oper.UpdateGarageFreeSpace(connectionStr, freeSpaceCount, queueCmd.garageID);
|
|
|
+ oper.UpdateParkingSpaceState(connectionStr, parkingSpaceID, 0);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
- {
|
|
|
- oper.UpdateVehicleParkState(connectionStr,queueCmd.LicenseNum, 1);
|
|
|
+ {
|
|
|
+ oper.UpdateVehicleParkState(connectionStr, queueCmd.LicenseNum, 1);
|
|
|
if (parkingSpaceUpdated)
|
|
|
{
|
|
|
freeSpaceCount = freeSpaceCount - 1;
|
|
|
- oper.UpdateGarageFreeSpace(connectionStr,freeSpaceCount, queueCmd.garageID);
|
|
|
- oper.UpdateParkingSpaceState(connectionStr,parkingSpaceID, 1);
|
|
|
+ oper.UpdateGarageFreeSpace(connectionStr, freeSpaceCount, queueCmd.garageID);
|
|
|
+ oper.UpdateParkingSpaceState(connectionStr, parkingSpaceID, 1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -182,18 +182,18 @@ namespace parkMonitor.server.CoreThread
|
|
|
connectionStr = "SqlConnectionLocation";
|
|
|
if (isParking)
|
|
|
{
|
|
|
- oper.UpdateVehicleParkState(connectionStr,queueCmd.LicenseNum, 0);
|
|
|
+ oper.UpdateVehicleParkState(connectionStr, queueCmd.LicenseNum, 0);
|
|
|
if (parkingSpaceUpdated)
|
|
|
{
|
|
|
- oper.UpdateParkingSpaceState(connectionStr,parkingSpaceID, 0);
|
|
|
+ oper.UpdateParkingSpaceState(connectionStr, parkingSpaceID, 0);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- oper.UpdateVehicleParkState(connectionStr,queueCmd.LicenseNum, 1);
|
|
|
+ oper.UpdateVehicleParkState(connectionStr, queueCmd.LicenseNum, 1);
|
|
|
if (parkingSpaceUpdated)
|
|
|
{
|
|
|
- oper.UpdateParkingSpaceState(connectionStr,parkingSpaceID, 1);
|
|
|
+ oper.UpdateParkingSpaceState(connectionStr, parkingSpaceID, 1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -393,7 +393,7 @@ namespace parkMonitor.server.CoreThread
|
|
|
/// <summary>
|
|
|
/// 停车完成
|
|
|
/// </summary>
|
|
|
- private bool WaitForStoreCompletionSignal(Command queueCmd, ref int parkingSpaceID, ref bool robotError, int status)
|
|
|
+ private bool WaitForStoreCompletionSignal(Command queueCmd, int parkingSpaceID, ref bool robotError, int status)
|
|
|
{
|
|
|
string connectionStr = null;
|
|
|
PLCMessage PLCMsg = null;
|
|
@@ -418,12 +418,12 @@ namespace parkMonitor.server.CoreThread
|
|
|
if (!queueCmd.manual)
|
|
|
{
|
|
|
connectionStr = "SqlConnectionStr";
|
|
|
- oper.UpdateParkingSpaceState(connectionStr,parkingSpaceID, 0);
|
|
|
+ oper.UpdateParkingSpaceState(connectionStr, parkingSpaceID, 0);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
connectionStr = "SqlConnectionLocation";
|
|
|
- oper.UpdateParkingSpaceState(connectionStr,parkingSpaceID, 0);
|
|
|
+ oper.UpdateParkingSpaceState(connectionStr, parkingSpaceID, 0);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -510,95 +510,102 @@ namespace parkMonitor.server.CoreThread
|
|
|
Log.WriteLog("停车流程,车牌号为" + queueCmd.LicenseNum + "的车辆准备开启激光");
|
|
|
UILogServer.ins.info("停车流程,车牌号为" + queueCmd.LicenseNum + "的车辆准备开启激光");
|
|
|
|
|
|
- //获取车位资源
|
|
|
+ //车位分配数据库操作加锁,直到启动机械手
|
|
|
Parking_Space ppp = new Parking_Space();
|
|
|
- ppp = WaitForParkingSpaceResource(queueCmd);
|
|
|
-
|
|
|
- //过期号牌判断
|
|
|
- if (queueCmd.userID != "")
|
|
|
+ Data dataReal = new Data();
|
|
|
+ int garageID;
|
|
|
+ string realParkTime;
|
|
|
+ lock (Parking_Space.spaceLock)
|
|
|
{
|
|
|
- userID = Convert.ToInt32(queueCmd.userID);
|
|
|
- }
|
|
|
- int garageID = queueCmd.garageID;
|
|
|
- string realParkTime = queueCmd.TimeRecord;
|
|
|
- //定义号牌验证与机械手异常标志
|
|
|
- //Task checkNum = Task.Factory.StartNew(() =>
|
|
|
- //{
|
|
|
- // DateTime startTime = DateTime.Now;
|
|
|
- // DateTime endTime = DateTime.Now;
|
|
|
- // TimeSpan t = startTime - endTime;
|
|
|
- // while (!stopChecking && t.TotalSeconds <= 600)
|
|
|
- // {
|
|
|
- // //号牌验证,异常则退回队列
|
|
|
- // Func<Command, int, float, bool> numValidationResult = new Func<Command, int, float, bool>(NumValidation);
|
|
|
- // IAsyncResult result = numValidationResult.BeginInvoke(queueCmd, 10, 0.7f, null, null);
|
|
|
- // bool checkResult = numValidationResult.EndInvoke(result);
|
|
|
- // if (stopChecking)
|
|
|
- // {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // if (!checkResult)
|
|
|
- // {
|
|
|
- // UILogServer.ins.info("停车命令" + queueCmd.LicenseNum + " 与当前车辆不一致");
|
|
|
- // disappeared = true;
|
|
|
- // return;
|
|
|
- // //未能停车,将车辆状态复位
|
|
|
- // //oper.UpdateVehicleParkState(queueCmd.LicenseNum, 0);
|
|
|
- // }
|
|
|
- // endTime = DateTime.Now;
|
|
|
- // t = startTime - endTime;
|
|
|
- // }
|
|
|
- //});
|
|
|
+ //获取车位资源
|
|
|
+ ppp = WaitForParkingSpaceResource(queueCmd);
|
|
|
|
|
|
- Data dataReal = new Data();
|
|
|
- dataReal = WaitForLaserResource(queueCmd, disappeared);
|
|
|
+ //过期号牌判断
|
|
|
+ if (queueCmd.userID != "")
|
|
|
+ {
|
|
|
+ userID = Convert.ToInt32(queueCmd.userID);
|
|
|
+ }
|
|
|
+ garageID = queueCmd.garageID;
|
|
|
+ realParkTime = queueCmd.TimeRecord;
|
|
|
+ //定义号牌验证与机械手异常标志
|
|
|
+ //Task checkNum = Task.Factory.StartNew(() =>
|
|
|
+ //{
|
|
|
+ // DateTime startTime = DateTime.Now;
|
|
|
+ // DateTime endTime = DateTime.Now;
|
|
|
+ // TimeSpan t = startTime - endTime;
|
|
|
+ // while (!stopChecking && t.TotalSeconds <= 600)
|
|
|
+ // {
|
|
|
+ // //号牌验证,异常则退回队列
|
|
|
+ // Func<Command, int, float, bool> numValidationResult = new Func<Command, int, float, bool>(NumValidation);
|
|
|
+ // IAsyncResult result = numValidationResult.BeginInvoke(queueCmd, 10, 0.7f, null, null);
|
|
|
+ // bool checkResult = numValidationResult.EndInvoke(result);
|
|
|
+ // if (stopChecking)
|
|
|
+ // {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (!checkResult)
|
|
|
+ // {
|
|
|
+ // UILogServer.ins.info("停车命令" + queueCmd.LicenseNum + " 与当前车辆不一致");
|
|
|
+ // disappeared = true;
|
|
|
+ // return;
|
|
|
+ // //未能停车,将车辆状态复位
|
|
|
+ // //oper.UpdateVehicleParkState(queueCmd.LicenseNum, 0);
|
|
|
+ // }
|
|
|
+ // endTime = DateTime.Now;
|
|
|
+ // t = startTime - endTime;
|
|
|
+ // }
|
|
|
+ //});
|
|
|
|
|
|
- //判断车位与激光资源有效性,无效则回滚
|
|
|
- if (ppp == null || dataReal == null)
|
|
|
- {
|
|
|
- Rollback(queueCmd, ppp.parkingSpaceID, false, true);
|
|
|
- return;
|
|
|
- }
|
|
|
- //车位赋值与写数据库
|
|
|
- int parkingSpaceID = ppp.parkingSpaceID;
|
|
|
- int parkingSpaceX = ppp.parkingSpaceX;
|
|
|
- int parkingSpaceY = ppp.parkingSpaceY;
|
|
|
- int parkingSpaceZ = ppp.parkingSpaceZ;
|
|
|
- if (!queueCmd.manual)
|
|
|
- {
|
|
|
- connectionStr = "SqlConnectionStr";
|
|
|
- //更新云端车位表车位状态
|
|
|
- oper.UpdateParkingSpaceState(connectionStr,parkingSpaceID, 1);
|
|
|
- //更新车库表剩余车位数
|
|
|
- int freeSpaceCount = oper.getGarageFreeSpace(connectionStr, garageID);
|
|
|
- freeSpaceCount = freeSpaceCount - 1;
|
|
|
- oper.UpdateGarageFreeSpace(connectionStr, freeSpaceCount, garageID);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- connectionStr = "SqlConnectionLocation";
|
|
|
- //更新本地车位表车位状态
|
|
|
- oper.UpdateParkingSpaceState(connectionStr,parkingSpaceID, 1);
|
|
|
- //更新车库表剩余车位数
|
|
|
- int freeSpaceCount = oper.getGarageFreeSpace(connectionStr,garageID);
|
|
|
- freeSpaceCount = freeSpaceCount - 1;
|
|
|
- oper.UpdateGarageFreeSpace(connectionStr,freeSpaceCount, garageID);
|
|
|
- }
|
|
|
- //号牌失效,数据库回滚
|
|
|
- if (disappeared)
|
|
|
- {
|
|
|
- NumReset(queueCmd);
|
|
|
+ dataReal = WaitForLaserResource(queueCmd, disappeared);
|
|
|
+
|
|
|
+ //判断车位与激光资源有效性,无效则回滚
|
|
|
+ if (ppp == null || dataReal == null)
|
|
|
+ {
|
|
|
+ Rollback(queueCmd, ppp.parkingSpaceID, false, true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //车位赋值与写数据库
|
|
|
+ int parkingSpaceID = ppp.parkingSpaceID;
|
|
|
+ int parkingSpaceX = ppp.parkingSpaceX;
|
|
|
+ int parkingSpaceY = ppp.parkingSpaceY;
|
|
|
+ int parkingSpaceZ = ppp.parkingSpaceZ;
|
|
|
if (!queueCmd.manual)
|
|
|
{
|
|
|
connectionStr = "SqlConnectionStr";
|
|
|
- oper.UpdateVehicleParkState(connectionStr,queueCmd.LicenseNum, 0);
|
|
|
+ //更新云端车位表车位状态
|
|
|
+ oper.UpdateParkingSpaceState(connectionStr, parkingSpaceID, 1);
|
|
|
+ //更新车库表剩余车位数
|
|
|
+ int freeSpaceCount = oper.getGarageFreeSpace(connectionStr, garageID);
|
|
|
+ freeSpaceCount = freeSpaceCount - 1;
|
|
|
+ oper.UpdateGarageFreeSpace(connectionStr, freeSpaceCount, garageID);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
connectionStr = "SqlConnectionLocation";
|
|
|
- oper.UpdateVehicleParkState(connectionStr,queueCmd.LicenseNum, 0);
|
|
|
+ //更新本地车位表车位状态
|
|
|
+ oper.UpdateParkingSpaceState(connectionStr, parkingSpaceID, 1);
|
|
|
+ //更新车库表剩余车位数
|
|
|
+ int freeSpaceCount = oper.getGarageFreeSpace(connectionStr, garageID);
|
|
|
+ freeSpaceCount = freeSpaceCount - 1;
|
|
|
+ oper.UpdateGarageFreeSpace(connectionStr, freeSpaceCount, garageID);
|
|
|
+ }
|
|
|
+ //号牌失效,数据库回滚
|
|
|
+ if (disappeared)
|
|
|
+ {
|
|
|
+ NumReset(queueCmd);
|
|
|
+ if (!queueCmd.manual)
|
|
|
+ {
|
|
|
+ connectionStr = "SqlConnectionStr";
|
|
|
+ oper.UpdateVehicleParkState(connectionStr, queueCmd.LicenseNum, 0);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ connectionStr = "SqlConnectionLocation";
|
|
|
+ oper.UpdateVehicleParkState(connectionStr, queueCmd.LicenseNum, 0);
|
|
|
+ }
|
|
|
+ return;
|
|
|
}
|
|
|
- return;
|
|
|
}
|
|
|
//开始启动机械手,停止检测号牌
|
|
|
stopChecking = true;
|
|
@@ -611,7 +618,7 @@ namespace parkMonitor.server.CoreThread
|
|
|
|
|
|
if (!WaitForRobotResource(robotID))
|
|
|
{
|
|
|
- Rollback(queueCmd, parkingSpaceID, true, true);
|
|
|
+ Rollback(queueCmd, ppp.parkingSpaceID, true, true);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -627,22 +634,22 @@ namespace parkMonitor.server.CoreThread
|
|
|
cm.length = Convert.ToString(dataReal.length);
|
|
|
cm.width = Convert.ToString(dataReal.width);
|
|
|
cm.height = Convert.ToString(dataReal.height);
|
|
|
- cm.parkingSpaceID = Convert.ToString(parkingSpaceID);
|
|
|
- cm.parkingSpaceX = Convert.ToString(parkingSpaceX);
|
|
|
- cm.parkingSpaceY = Convert.ToString(parkingSpaceY);
|
|
|
- cm.parkingSpaceZ = Convert.ToString(parkingSpaceZ);
|
|
|
+ cm.parkingSpaceID = Convert.ToString(ppp.parkingSpaceID);
|
|
|
+ cm.parkingSpaceX = Convert.ToString(ppp.parkingSpaceX);
|
|
|
+ cm.parkingSpaceY = Convert.ToString(ppp.parkingSpaceY);
|
|
|
+ cm.parkingSpaceZ = Convert.ToString(ppp.parkingSpaceZ);
|
|
|
PLC.SetMessage(cm);
|
|
|
Log.WriteLog("停车流程,抓车:" + queueCmd.LicenseNum);
|
|
|
UILogServer.ins.info("停车流程,抓车:" + queueCmd.LicenseNum);
|
|
|
|
|
|
if (!WaitWheelbase(ref frontWheelbase, ref rearWheelbase))
|
|
|
{
|
|
|
- Rollback(queueCmd, parkingSpaceID, true, true);
|
|
|
+ Rollback(queueCmd, ppp.parkingSpaceID, true, true);
|
|
|
return;
|
|
|
}
|
|
|
- if (!WaitForStoreCompletionSignal(queueCmd, ref parkingSpaceID, ref robotError, 1))
|
|
|
+ if (!WaitForStoreCompletionSignal(queueCmd, ppp.parkingSpaceID, ref robotError, 1))
|
|
|
{
|
|
|
- Rollback(queueCmd, parkingSpaceID, true, true);
|
|
|
+ Rollback(queueCmd, ppp.parkingSpaceID, true, true);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -651,9 +658,9 @@ namespace parkMonitor.server.CoreThread
|
|
|
cm.status = status;
|
|
|
PLC.SetMessage(cm);
|
|
|
//机械手异常则回滚
|
|
|
- if (!WaitForStoreCompletionSignal(queueCmd, ref parkingSpaceID, ref robotError, 0))
|
|
|
+ if (!WaitForStoreCompletionSignal(queueCmd, ppp.parkingSpaceID, ref robotError, 0))
|
|
|
{
|
|
|
- Rollback(queueCmd, parkingSpaceID, true, true);
|
|
|
+ Rollback(queueCmd, ppp.parkingSpaceID, true, true);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -677,17 +684,17 @@ namespace parkMonitor.server.CoreThread
|
|
|
connectionStr = "SqlConnectionStr";
|
|
|
//更新云端数据库
|
|
|
//插入停车记录表
|
|
|
- int parkingRecordsID = oper.InsertToParkingRecords(connectionStr,userID, numberPlate, parkingSpaceID, garageID, 3, realParkTime);
|
|
|
+ int parkingRecordsID = oper.InsertToParkingRecords(connectionStr, userID, numberPlate, ppp.parkingSpaceID, ppp.garageID, 3, realParkTime);
|
|
|
//车辆表更新车辆信息
|
|
|
- oper.UpdateVehicle(connectionStr,numberPlate, 1, realParkTime, parkingRecordsID, parkingSpaceID, 1, frontWheelbase, rearWheelbase);
|
|
|
+ oper.UpdateVehicle(connectionStr, numberPlate, 1, realParkTime, parkingRecordsID, ppp.parkingSpaceID, 1, frontWheelbase, rearWheelbase);
|
|
|
//插入消息队列表
|
|
|
- oper.InsertToMessageQueue(connectionStr,userID, "停车成功", 1);
|
|
|
+ oper.InsertToMessageQueue(connectionStr, userID, "停车成功", 1);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
connectionStr = "SqlConnectionLocation";
|
|
|
//插入停车记录表
|
|
|
- int parkingRecordsID = oper.InsertToLocalParkingRecords(connectionStr,1, userID, numberPlate, parkingSpaceID, garageID, 3, realParkTime, frontWheelbase, rearWheelbase);
|
|
|
+ int parkingRecordsID = oper.InsertToLocalParkingRecords(connectionStr, 1, userID, numberPlate, ppp.parkingSpaceID, garageID, 3, realParkTime, frontWheelbase, rearWheelbase);
|
|
|
}
|
|
|
}
|
|
|
//异常写入日志文件
|
|
@@ -696,10 +703,10 @@ namespace parkMonitor.server.CoreThread
|
|
|
LogFile logFile = LogFile.ERROR_NUMBERPLATE;
|
|
|
Log.WriteLog(logFile, "号牌:" + numberPlate);
|
|
|
Log.WriteLog(logFile, "入库时间:" + realParkTime);
|
|
|
- Log.WriteLog(logFile, "车位id:" + parkingSpaceID);
|
|
|
- Log.WriteLog(logFile, "车位x:" + parkingSpaceX);
|
|
|
- Log.WriteLog(logFile, "车位y:" + parkingSpaceY);
|
|
|
- Log.WriteLog(logFile, "车位z:" + parkingSpaceZ);
|
|
|
+ Log.WriteLog(logFile, "车位id:" + ppp.parkingSpaceID);
|
|
|
+ Log.WriteLog(logFile, "车位x:" + ppp.parkingSpaceX);
|
|
|
+ Log.WriteLog(logFile, "车位y:" + ppp.parkingSpaceY);
|
|
|
+ Log.WriteLog(logFile, "车位z:" + ppp.parkingSpaceZ);
|
|
|
//异常情况处理有待讨论
|
|
|
}
|
|
|
}
|
|
@@ -710,7 +717,7 @@ namespace parkMonitor.server.CoreThread
|
|
|
/// </summary>
|
|
|
public class FetchCmd : AbstractCmd
|
|
|
{
|
|
|
- private bool waitForFetchCompletionSignal(Command queueCmd, ref int parkingSpaceID, ref bool robotError, int status)
|
|
|
+ private bool waitForFetchCompletionSignal(Command queueCmd, int parkingSpaceID, ref bool robotError, int status)
|
|
|
{
|
|
|
string connectionStr = null;
|
|
|
PLCMessage PLCMsg = null;
|
|
@@ -736,12 +743,12 @@ namespace parkMonitor.server.CoreThread
|
|
|
if (!queueCmd.manual)
|
|
|
{
|
|
|
connectionStr = "SqlConnectionStr";
|
|
|
- oper.UpdateParkingSpaceState(connectionStr,parkingSpaceID, 0);
|
|
|
+ oper.UpdateParkingSpaceState(connectionStr, parkingSpaceID, 0);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
connectionStr = "SqlConnectionLocation";
|
|
|
- oper.UpdateParkingSpaceState(connectionStr,parkingSpaceID, 0);
|
|
|
+ oper.UpdateParkingSpaceState(connectionStr, parkingSpaceID, 0);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -769,36 +776,38 @@ namespace parkMonitor.server.CoreThread
|
|
|
string connectionStr = null;
|
|
|
PLCMessage PLCMsg = null;
|
|
|
Vehicle vehiclelist = null;
|
|
|
+ ControlMessage cm = null;
|
|
|
+ Parking_Space ps = null;
|
|
|
+ int frontwheelbase;
|
|
|
+ int rearwheelbase;
|
|
|
+ int garageID;
|
|
|
+ bool robotError = false;
|
|
|
+ //车位更新数据库操作加锁,直到启动机械手
|
|
|
if (queueCmd.manual)
|
|
|
{
|
|
|
connectionStr = "SqlConnectionLocation";
|
|
|
- vehiclelist = oper.GetLocalVehicle(connectionStr,queueCmd.LicenseNum, queueCmd.garageID);
|
|
|
+ vehiclelist = oper.GetLocalVehicle(connectionStr, queueCmd.LicenseNum, queueCmd.garageID);
|
|
|
}
|
|
|
else
|
|
|
- {
|
|
|
+ {
|
|
|
connectionStr = "SqlConnectionStr";
|
|
|
- vehiclelist = oper.GetVehicle(connectionStr,queueCmd.LicenseNum);
|
|
|
+ vehiclelist = oper.GetVehicle(connectionStr, queueCmd.LicenseNum);
|
|
|
}
|
|
|
int parkingSpaceID = vehiclelist.parkingSpaceID;
|
|
|
- int garageID = vehiclelist.garageID;
|
|
|
- int frontwheelbase = vehiclelist.frontwheelbase;
|
|
|
- int rearwheelbase = vehiclelist.rearwheelbase;
|
|
|
- bool robotError = false;
|
|
|
- Fetching_Space fslist = null;
|
|
|
+ garageID = vehiclelist.garageID;
|
|
|
+ frontwheelbase = vehiclelist.frontwheelbase;
|
|
|
+ rearwheelbase = vehiclelist.rearwheelbase;
|
|
|
if (queueCmd.manual)
|
|
|
{
|
|
|
connectionStr = "SqlConnectionLocation";
|
|
|
- fslist = oper.GetFetchingSpace(connectionStr,parkingSpaceID);
|
|
|
+ ps = oper.GetFetchingSpace(connectionStr, parkingSpaceID);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
connectionStr = "SqlConnectionStr";
|
|
|
- fslist = oper.GetFetchingSpace(connectionStr,parkingSpaceID);
|
|
|
+ ps = oper.GetFetchingSpace(connectionStr, parkingSpaceID);
|
|
|
}
|
|
|
- int parkingSpaceX = fslist.parkingSpaceX;
|
|
|
- int parkingSpaceY = fslist.parkingSpaceY;
|
|
|
- int parkingSpaceZ = fslist.parkingSpaceZ;
|
|
|
- ControlMessage cm = new ControlMessage();
|
|
|
+ cm = new ControlMessage();
|
|
|
|
|
|
int robotID = 0;
|
|
|
robotID = parkingSpaceID / 15 + 1;
|
|
@@ -807,17 +816,16 @@ namespace parkMonitor.server.CoreThread
|
|
|
Rollback(queueCmd, parkingSpaceID, true, false);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
//取车
|
|
|
int status = 4;
|
|
|
cm.status = status;
|
|
|
//先手动赋值
|
|
|
cm.RobotID = 1;
|
|
|
cm.fetchPosition = 1;//放置地址
|
|
|
- cm.parkingSpaceID = Convert.ToString(parkingSpaceID);
|
|
|
- cm.parkingSpaceX = Convert.ToString(parkingSpaceX);
|
|
|
- cm.parkingSpaceY = Convert.ToString(parkingSpaceY);
|
|
|
- cm.parkingSpaceZ = Convert.ToString(parkingSpaceZ);
|
|
|
+ cm.parkingSpaceID = Convert.ToString(ps.parkingSpaceID);
|
|
|
+ cm.parkingSpaceX = Convert.ToString(ps.parkingSpaceX);
|
|
|
+ cm.parkingSpaceY = Convert.ToString(ps.parkingSpaceY);
|
|
|
+ cm.parkingSpaceZ = Convert.ToString(ps.parkingSpaceZ);
|
|
|
cm.frontWheelbase = frontwheelbase;
|
|
|
cm.rearWheelbase = rearwheelbase;
|
|
|
PLC.SetMessage(cm);
|
|
@@ -826,9 +834,9 @@ namespace parkMonitor.server.CoreThread
|
|
|
Log.WriteLog("取车:" + queueCmd.LicenseNum);
|
|
|
UILogServer.ins.info("取车:" + queueCmd.LicenseNum);
|
|
|
//等待PLC取车完成信号
|
|
|
- if (!waitForFetchCompletionSignal(queueCmd, ref parkingSpaceID, ref robotError, 1))
|
|
|
+ if (!waitForFetchCompletionSignal(queueCmd, ps.parkingSpaceID, ref robotError, 1))
|
|
|
{
|
|
|
- Rollback(queueCmd, parkingSpaceID, true, false);
|
|
|
+ Rollback(queueCmd, ps.parkingSpaceID, true, false);
|
|
|
return;
|
|
|
}
|
|
|
//取车完成
|
|
@@ -838,16 +846,16 @@ namespace parkMonitor.server.CoreThread
|
|
|
//先手动赋值
|
|
|
cm2.RobotID = 1;
|
|
|
PLC.SetMessage(cm2);
|
|
|
- if (!waitForFetchCompletionSignal(queueCmd, ref parkingSpaceID, ref robotError, 0))
|
|
|
+ if (!waitForFetchCompletionSignal(queueCmd, ps.parkingSpaceID, ref robotError, 0))
|
|
|
{
|
|
|
- Rollback(queueCmd, parkingSpaceID, true, false);
|
|
|
+ Rollback(queueCmd, ps.parkingSpaceID, true, false);
|
|
|
return;
|
|
|
}
|
|
|
Robot.robot1.occupied = false;
|
|
|
Log.WriteLog("号牌:" + queueCmd.LicenseNum + "取车完成");
|
|
|
UILogServer.ins.info("号牌:" + queueCmd.LicenseNum + "取车完成");
|
|
|
//自动化测试用
|
|
|
- ManualParkingSimul.ins.Update(Int32.Parse(queueCmd.LicenseNum.Substring(2,1)));
|
|
|
+ ManualParkingSimul.ins.Update(Int32.Parse(queueCmd.LicenseNum.Substring(2, 1)));
|
|
|
|
|
|
//数据库更新
|
|
|
if (!queueCmd.manual)
|
|
@@ -855,38 +863,29 @@ namespace parkMonitor.server.CoreThread
|
|
|
connectionStr = "SqlConnectionStr";
|
|
|
//云端数据库更新
|
|
|
//更新车库表车位数
|
|
|
- int freeSpaceCount = oper.getGarageFreeSpace(connectionStr,garageID);
|
|
|
+ int freeSpaceCount = oper.getGarageFreeSpace(connectionStr, garageID);
|
|
|
freeSpaceCount = freeSpaceCount + 1;
|
|
|
- oper.UpdateGarageFreeSpace(connectionStr,freeSpaceCount, garageID);
|
|
|
+ oper.UpdateGarageFreeSpace(connectionStr, freeSpaceCount, garageID);
|
|
|
//更新车位表车位状态
|
|
|
- oper.UpdateParkingSpaceState(connectionStr,parkingSpaceID, 0);
|
|
|
+ oper.UpdateParkingSpaceState(connectionStr, ps.parkingSpaceID, 0);
|
|
|
//更新车辆表车辆停车状态
|
|
|
- oper.UpdateVehicleParkState(connectionStr,queueCmd.LicenseNum, 0);
|
|
|
+ oper.UpdateVehicleParkState(connectionStr, queueCmd.LicenseNum, 0);
|
|
|
//更新停车记录表
|
|
|
- oper.UpdateParkingRecords(connectionStr,6, queueCmd.TimeRecord, queueCmd.parkingRecordsID);
|
|
|
-
|
|
|
- ////本地数据库更新
|
|
|
- //locationOper.UpdateGarageFreeSpace(freeSpaceCount, garageID);
|
|
|
- ////更新车位表车位状态
|
|
|
- //locationOper.UpdateParkingSpaceState(parkingSpaceID, 0);
|
|
|
- ////更新车辆表车辆停车状态
|
|
|
- //locationOper.UpdateVehicleParkState(queueCmd.LicenseNum, 0);
|
|
|
- ////更新停车记录表
|
|
|
- //locationOper.UpdateParkingRecords(0, 6, queueCmd.TimeRecord, queueCmd.parkingRecordsID);
|
|
|
+ oper.UpdateParkingRecords(connectionStr, 6, queueCmd.TimeRecord, queueCmd.parkingRecordsID);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
connectionStr = "SqlConnectionLocation";
|
|
|
//更新车库表车位数
|
|
|
- int freeSpaceCount = oper.getGarageFreeSpace(connectionStr,garageID);
|
|
|
+ int freeSpaceCount = oper.getGarageFreeSpace(connectionStr, garageID);
|
|
|
freeSpaceCount = freeSpaceCount + 1;
|
|
|
- oper.UpdateGarageFreeSpace(connectionStr,freeSpaceCount, garageID);
|
|
|
+ oper.UpdateGarageFreeSpace(connectionStr, freeSpaceCount, garageID);
|
|
|
//更新车位表车位状态
|
|
|
- oper.UpdateParkingSpaceState(connectionStr,parkingSpaceID, 0);
|
|
|
+ oper.UpdateParkingSpaceState(connectionStr, ps.parkingSpaceID, 0);
|
|
|
////更新车辆表车辆停车状态
|
|
|
//locationOper.UpdateVehicleParkState(queueCmd.LicenseNum, 0);
|
|
|
//更新停车记录表
|
|
|
- oper.UpdateParkingRecords(connectionStr,0, 6, queueCmd.TimeRecord, queueCmd.parkingRecordsID);
|
|
|
+ oper.UpdateParkingRecords(connectionStr, 0, 6, queueCmd.TimeRecord, queueCmd.parkingRecordsID);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -903,9 +902,9 @@ namespace parkMonitor.server.CoreThread
|
|
|
{
|
|
|
int userId = Convert.ToInt32(queueCmd.userID);
|
|
|
//过期用户指令
|
|
|
- oper.InsertToMessageQueue(connectionStr,userId, "停车异常,请联系管理员!", 2);
|
|
|
+ oper.InsertToMessageQueue(connectionStr, userId, "停车异常,请联系管理员!", 2);
|
|
|
//未能停车,将车辆状态复位
|
|
|
- oper.UpdateVehicleParkState(connectionStr,queueCmd.LicenseNum, 0);
|
|
|
+ oper.UpdateVehicleParkState(connectionStr, queueCmd.LicenseNum, 0);
|
|
|
LogFile logFile = LogFile.ERROR_NUMBERPLATE;
|
|
|
Log.WriteLog(logFile, "过期用户指令,车牌号:" + queueCmd.LicenseNum);
|
|
|
UILogServer.ins.error("过期用户指令,车牌号:" + queueCmd.LicenseNum);
|