|
@@ -21,6 +21,10 @@ namespace Terminal
|
|
|
/// </summary>
|
|
|
private static Dictionary<int, string> idLicMap = new Dictionary<int, string>();
|
|
|
/// <summary>
|
|
|
+ /// 记录地面停车位id与凭证号映射
|
|
|
+ /// </summary>
|
|
|
+ private static Dictionary<int, int> idReceiptMap = new Dictionary<int, int>();
|
|
|
+ /// <summary>
|
|
|
/// 取车地面位id与是否已计费标记映射
|
|
|
/// </summary>
|
|
|
public static Dictionary<int, bool> termCalcMap = new Dictionary<int, bool>();
|
|
@@ -283,19 +287,19 @@ namespace Terminal
|
|
|
/// 流程结束清除终端相关信息
|
|
|
/// </summary>
|
|
|
/// <param name="id"></param>
|
|
|
- private static void ClearTerminal(int id)
|
|
|
+ private static void ClearTerminal(int id, bool removeReceipt)
|
|
|
{
|
|
|
TerminalStru tsFromCentral = new TerminalStru
|
|
|
{
|
|
|
terminalID = (short)id,
|
|
|
parkingFee = (short)32767,
|
|
|
- receiptNum = (short)-1
|
|
|
+ receiptNum = removeReceipt ? 0 : (short)-1
|
|
|
};
|
|
|
TerminalStru tsFromTerminal = new TerminalStru
|
|
|
{
|
|
|
terminalID = (short)id,
|
|
|
btnStatus = (short)0,
|
|
|
- receiptNum = (short)-1
|
|
|
+ receiptNum = removeReceipt ? 0 : (short)-1
|
|
|
};
|
|
|
Monitor.Monitor.PLC.WriteToPLC(tsFromCentral, PLCDataType.central);
|
|
|
Thread.Sleep(300);
|
|
@@ -473,7 +477,7 @@ namespace Terminal
|
|
|
{
|
|
|
if (!Monitor.Monitor.globalStatus)
|
|
|
{
|
|
|
- Monitor.Monitor.SetNotification("号牌系统已暂停,请检查无误后手动开启",parkMonitor.model.TextColor.Warning);
|
|
|
+ Monitor.Monitor.SetNotification("号牌系统已暂停,请检查无误后手动开启", parkMonitor.model.TextColor.Warning);
|
|
|
Thread.Sleep(5000);
|
|
|
return;
|
|
|
}
|
|
@@ -485,7 +489,7 @@ namespace Terminal
|
|
|
//判断之前是否已拍摄号牌
|
|
|
if (!idLicMap.ContainsKey(term.terminalID))
|
|
|
{
|
|
|
- license = "桂K88888";//Monitor.Monitor.numMachineLinker.GetLicensePlate(term.terminalID);
|
|
|
+ license = Monitor.Monitor.numMachineLinker.GetLicensePlate(term.terminalID);
|
|
|
Monitor.Monitor.SetNotification("启动" + term.terminalID + "号号牌机,号牌:" + license, parkMonitor.model.TextColor.Info);
|
|
|
}
|
|
|
else
|
|
@@ -510,6 +514,19 @@ namespace Terminal
|
|
|
}
|
|
|
}
|
|
|
catch (Exception e) { Log.WriteLog(LogType.process, LogFile.ERROR, "号牌" + license + "记录号牌异常\n" + e.StackTrace); }
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (idReceiptMap.ContainsKey(term.terminalID))
|
|
|
+ {
|
|
|
+ if (!idReceiptMap[term.terminalID].Equals(term.receiptNum))
|
|
|
+ idReceiptMap[term.terminalID] = term.receiptNum;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ idReceiptMap.Add(term.terminalID, term.receiptNum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception e) { Log.WriteLog(LogType.process, LogFile.ERROR, "凭证号" + term.receiptNum + "记录凭证号异常\n" + e.StackTrace); }
|
|
|
}
|
|
|
Log.WriteLog(LogType.process, LogFile.INFO, "号牌" + license + "已记录");
|
|
|
//未获得号牌,告知PLC终止,告诉终端提示用户重新操作
|
|
@@ -622,15 +639,15 @@ namespace Terminal
|
|
|
{
|
|
|
Log.WriteLog(LogType.process, LogFile.ERROR, "停车流程中断");
|
|
|
Monitor.Monitor.SetNotification("停车流程中断", parkMonitor.model.TextColor.Warning);
|
|
|
- Thread.Sleep(500);
|
|
|
- ClearTerminal(term.terminalID);
|
|
|
+ Thread.Sleep(2000);
|
|
|
+ ClearTerminal(term.terminalID,false);
|
|
|
ResetCompleteSignal();
|
|
|
//流程终端清除记录的号牌
|
|
|
try { idLicMap.Remove(currentTerm); }
|
|
|
catch { }
|
|
|
return;
|
|
|
}
|
|
|
- if(Monitor.Monitor.mainBlockInfo.processCompleted == 1)
|
|
|
+ if (Monitor.Monitor.mainBlockInfo.processCompleted == 1)
|
|
|
{
|
|
|
if (!idLicMap.ContainsKey(currentTerm))
|
|
|
{
|
|
@@ -653,26 +670,18 @@ namespace Terminal
|
|
|
//term = terminalInfo[currentTerm - 1];
|
|
|
Thread.Sleep(500);
|
|
|
parkingSpaceID = Monitor.Monitor.mainBlockInfo.currentParkingSpaceID;
|
|
|
- //找到停车位置
|
|
|
- //for (int s = 0; s < Monitor.Monitor.parkingSpaceInfo.Count; s++)
|
|
|
- //{
|
|
|
- // //Console.WriteLine(Monitor.Monitor.parkingSpaceInfo[s].receiptNum + "," + term.receiptNum);
|
|
|
- // if (Monitor.Monitor.parkingSpaceInfo[s].receiptNum == term.receiptNum)
|
|
|
- // {
|
|
|
- // parkingSpaceID = Monitor.Monitor.parkingSpaceInfo[s].parkingSpace;
|
|
|
- // break;
|
|
|
- // }
|
|
|
- //}
|
|
|
+ int receipt = 0;
|
|
|
+ idReceiptMap.TryGetValue(term.terminalID, out receipt);
|
|
|
//无车位信息则跳出当前循环
|
|
|
- if (parkingSpaceID == 0 || term.receiptNum == 0)
|
|
|
+ if (parkingSpaceID == 0 || receipt == 0)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
idLicMap.Remove(currentTerm);
|
|
|
- ClearTerminal(term.terminalID);
|
|
|
+ ClearTerminal(term.terminalID,false);
|
|
|
}
|
|
|
catch { }
|
|
|
- Monitor.Monitor.SetNotification("无车位或凭证号,车位:"+parkingSpaceID+",凭证号:"+term.receiptNum, parkMonitor.model.TextColor.Warning);
|
|
|
+ Monitor.Monitor.SetNotification("无车位或凭证号,车位:" + parkingSpaceID + ",凭证号:" + receipt, parkMonitor.model.TextColor.Warning);
|
|
|
return;
|
|
|
}
|
|
|
UpdateVehicle(license, 0, 0, true, false, 0);
|
|
@@ -682,12 +691,12 @@ namespace Terminal
|
|
|
if (term.licenseCodeA != 0)
|
|
|
{
|
|
|
parkingRecordsSql = "INSERT INTO parkingrecords (userID, numberPlate,parkingSpaceID,garageID,parkingRecordsState,realParkTime,receiptNum,parkingPrice)" +
|
|
|
- "values ('" + term.licenseCodeA + "','" + license + "','" + parkingSpaceID + "','" + Monitor.Monitor.garageID + "',3,'" + DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss") + "','" + term.receiptNum + "',NULL);";
|
|
|
+ "values ('" + term.licenseCodeA + "','" + license + "','" + parkingSpaceID + "','" + Monitor.Monitor.garageID + "',3,'" + DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss") + "','" + receipt + "',NULL);";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
parkingRecordsSql = "INSERT INTO parkingrecords (userID, numberPlate,parkingSpaceID,garageID,parkingRecordsState,realParkTime,receiptNum,parkingPrice)" +
|
|
|
- "values ('" + 1 + "','" + license + "','" + parkingSpaceID + "','" + Monitor.Monitor.garageID + "',3,'" + DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss") + "','" + term.receiptNum + "',NULL);";
|
|
|
+ "values ('" + 1 + "','" + license + "','" + parkingSpaceID + "','" + Monitor.Monitor.garageID + "',3,'" + DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss") + "','" + receipt + "',NULL);";
|
|
|
}
|
|
|
List<string> list = new List<string>();
|
|
|
list.Add(parkingRecordsSql);
|
|
@@ -695,7 +704,7 @@ namespace Terminal
|
|
|
int remoteParkingRecordsID = 0;
|
|
|
Monitor.Monitor.localDBOper.Insert(list, out parkingRecordsID);
|
|
|
Monitor.Monitor.remoteDBOper.Insert(list, out remoteParkingRecordsID);
|
|
|
- Log.WriteLog(LogType.process, LogFile.INFO, "停车记录已插入," + license + "停在" + parkingSpaceID + ",凭证号:" + term.receiptNum);
|
|
|
+ Log.WriteLog(LogType.process, LogFile.INFO, "停车记录已插入," + license + "停在" + parkingSpaceID + ",凭证号:" + receipt);
|
|
|
Monitor.Monitor.SetNotification("停车记录已插入", parkMonitor.model.TextColor.Info);
|
|
|
|
|
|
//查询记录ID号
|
|
@@ -720,9 +729,9 @@ namespace Terminal
|
|
|
// Thread.Sleep(1000);
|
|
|
//}
|
|
|
//中控清除车牌、凭证号、号牌验证等信息
|
|
|
- ClearTerminal(term.terminalID);
|
|
|
+ ClearTerminal(term.terminalID,false);
|
|
|
//停车流程确保已清除中控块完成信号
|
|
|
- Thread.Sleep(500);
|
|
|
+ Thread.Sleep(2000);
|
|
|
ResetCompleteSignal();
|
|
|
try { idLicMap.Remove(currentTerm); }
|
|
|
catch { }
|
|
@@ -765,7 +774,7 @@ namespace Terminal
|
|
|
short registered = 4;
|
|
|
while (license == "" && countdown-- > 0)
|
|
|
{
|
|
|
- license = "桂K88888";// Monitor.Monitor.numMachineLinker.GetLicensePlate(terminalInfo[index].terminalID);
|
|
|
+ license = Monitor.Monitor.numMachineLinker.GetLicensePlate(terminalInfo[index].terminalID);
|
|
|
}
|
|
|
Monitor.Monitor.SetNotification(terminalInfo[index].terminalID + "号车位收到地感,拍到" + license, parkMonitor.model.TextColor.Log);
|
|
|
if (license != "")
|
|
@@ -1277,9 +1286,9 @@ namespace Terminal
|
|
|
{
|
|
|
Log.WriteLog(LogType.process, LogFile.INFO, "取车流程中断");
|
|
|
Monitor.Monitor.SetNotification("取车流程中断", parkMonitor.model.TextColor.Warning);
|
|
|
- ClearTerminal(terminalInfo[termIndex].terminalID);
|
|
|
+ ClearTerminal(terminalInfo[termIndex].terminalID,false);
|
|
|
//停车流程确保已清除中控块完成信号
|
|
|
- Thread.Sleep(500);
|
|
|
+ Thread.Sleep(2000);
|
|
|
ResetCompleteSignal();
|
|
|
break;
|
|
|
}
|
|
@@ -1307,9 +1316,9 @@ namespace Terminal
|
|
|
//Log.WriteLog(LogType.process, LogFile.INFO, "检测到凭证号已被清除");
|
|
|
FetchInfo fi = null;
|
|
|
UpdateAllParkingSpace(false);
|
|
|
- ClearTerminal(terminalInfo[termIndex].terminalID);
|
|
|
+ ClearTerminal(terminalInfo[termIndex].terminalID,false);
|
|
|
//停车流程确保已清除中控块完成信号
|
|
|
- Thread.Sleep(500);
|
|
|
+ Thread.Sleep(2000);
|
|
|
ResetCompleteSignal();
|
|
|
if (fetchInfoMap.ContainsKey(terminalInfo[termIndex].terminalID))
|
|
|
{
|
|
@@ -1393,6 +1402,7 @@ namespace Terminal
|
|
|
{
|
|
|
lockList.Add(false);
|
|
|
}
|
|
|
+ ResetCompleteSignal();
|
|
|
ParkProcess();
|
|
|
FetchProcess();
|
|
|
//定时更新云端车位,5min
|