|
@@ -309,11 +309,13 @@ namespace Terminal
|
|
|
{
|
|
|
terminalID = (short)id,
|
|
|
parkingFee = (short)32767,
|
|
|
+ receiptNum = (short)-1
|
|
|
};
|
|
|
TerminalStru tsFromTerminal = new TerminalStru
|
|
|
{
|
|
|
terminalID = (short)id,
|
|
|
btnStatus = (short)0,
|
|
|
+ receiptNum = (short)-1
|
|
|
};
|
|
|
Monitor.Monitor.PLC.WriteToPLC(tsFromCentral, PLCDataType.central);
|
|
|
Thread.Sleep(300);
|
|
@@ -505,11 +507,19 @@ namespace Terminal
|
|
|
catch (Exception e) { Log.WriteLog(LogType.process, LogFile.ERROR, "号牌" + license + "记录号牌异常\n" + e.StackTrace); }
|
|
|
}
|
|
|
Log.WriteLog(LogType.process, LogFile.INFO, "号牌" + license + "已记录");
|
|
|
-
|
|
|
+ MainBlockStru mb = new MainBlockStru
|
|
|
+ {
|
|
|
+ centralHearbeat = (short)-1,
|
|
|
+ bookParkCmd = -1,
|
|
|
+ bookFetchCmd = -1,
|
|
|
+ processCompleted = (short)0,
|
|
|
+ licenseReceived = (short)-1
|
|
|
+ };
|
|
|
+ Monitor.Monitor.PLC.WriteToPLC(mb, PLCDataType.central);
|
|
|
//未获得号牌,告知PLC终止,告诉终端提示用户重新操作
|
|
|
if (license == "")
|
|
|
{
|
|
|
- MainBlockStru mb = new MainBlockStru
|
|
|
+ MainBlockStru mbs = new MainBlockStru
|
|
|
{
|
|
|
centralHearbeat = (short)-1,
|
|
|
bookParkCmd = -1,
|
|
@@ -517,7 +527,7 @@ namespace Terminal
|
|
|
processCompleted = (short)-1,
|
|
|
licenseReceived = (short)2
|
|
|
};
|
|
|
- Monitor.Monitor.PLC.WriteToPLC(mb, PLCDataType.central);
|
|
|
+ Monitor.Monitor.PLC.WriteToPLC(mbs, PLCDataType.central);
|
|
|
TerminalStru ts = new TerminalStru
|
|
|
{
|
|
|
terminalID = (short)term.terminalID,
|
|
@@ -566,7 +576,7 @@ namespace Terminal
|
|
|
Monitor.Monitor.PLC.WriteToPLC(ts, PLCDataType.central);
|
|
|
}
|
|
|
//无论是否注册,皆告知PLC,已获取号牌或比对异常、终止流程
|
|
|
- MainBlockStru mb = new MainBlockStru
|
|
|
+ MainBlockStru mbst = new MainBlockStru
|
|
|
{
|
|
|
centralHearbeat = -1,
|
|
|
bookFetchCmd = -1,
|
|
@@ -574,7 +584,7 @@ namespace Terminal
|
|
|
processCompleted = (short)-1,
|
|
|
licenseReceived = (short)numReceivedStatus
|
|
|
};
|
|
|
- Monitor.Monitor.PLC.WriteToPLC(mb, PLCDataType.central);
|
|
|
+ Monitor.Monitor.PLC.WriteToPLC(mbst, PLCDataType.central);
|
|
|
//号牌获取结果被清零才跳出
|
|
|
Monitor.Monitor.SetNotification("已写入号牌获取结果,等待号牌机启动指令清零", parkMonitor.model.TextColor.Info);
|
|
|
}
|
|
@@ -598,6 +608,8 @@ namespace Terminal
|
|
|
/// </summary>
|
|
|
private static void ParkCompleteSubProcess()
|
|
|
{
|
|
|
+ Thread.Sleep(300);
|
|
|
+ Console.WriteLine(Monitor.Monitor.mainBlockInfo.parkingRunning+","+ Monitor.Monitor.mainBlockInfo.processCompleted);
|
|
|
int processAttrib = Monitor.Monitor.mainBlockInfo.parkingRunning;
|
|
|
//int processCompleted = Monitor.Monitor.mainBlockInfo.processCompleted;
|
|
|
int currentTerm = Monitor.Monitor.mainBlockInfo.terminalID;
|
|
@@ -607,11 +619,13 @@ namespace Terminal
|
|
|
TerminalStru term = new TerminalStru();
|
|
|
string license;
|
|
|
//等待完成信号
|
|
|
- while (Monitor.Monitor.mainBlockInfo.processCompleted != 1)
|
|
|
+ if (Monitor.Monitor.mainBlockInfo.parkingRunning != 1 || Monitor.Monitor.mainBlockInfo.processCompleted != 1)
|
|
|
{
|
|
|
if (Monitor.Monitor.mainBlockInfo.processStopped == 1)
|
|
|
- return;
|
|
|
- Thread.Sleep(200);
|
|
|
+ {
|
|
|
+ Console.WriteLine("中断");
|
|
|
+ }
|
|
|
+ return;
|
|
|
}
|
|
|
//找到终端号,判断是否注册用户
|
|
|
//拿到号牌
|
|
@@ -624,21 +638,23 @@ namespace Terminal
|
|
|
term = terminalInfo[i];
|
|
|
}
|
|
|
//term = terminalInfo[currentTerm - 1];
|
|
|
- Thread.Sleep(1500);
|
|
|
+ Thread.Sleep(1000);
|
|
|
+ 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;
|
|
|
- }
|
|
|
- }
|
|
|
+ //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;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
//无车位信息则跳出当前循环
|
|
|
if (parkingSpaceID == 0 || term.receiptNum == 0)
|
|
|
{
|
|
|
- try {
|
|
|
+ try
|
|
|
+ {
|
|
|
idLicMap.Remove(currentTerm);
|
|
|
ClearTerminal(term.terminalID);
|
|
|
MainBlockStru mbs = new MainBlockStru
|
|
@@ -701,15 +717,6 @@ namespace Terminal
|
|
|
//}
|
|
|
//中控清除车牌、凭证号、号牌验证等信息
|
|
|
ClearTerminal(term.terminalID);
|
|
|
- MainBlockStru mb = new MainBlockStru
|
|
|
- {
|
|
|
- centralHearbeat = (short)-1,
|
|
|
- bookParkCmd = -1,
|
|
|
- bookFetchCmd = -1,
|
|
|
- processCompleted = (short)0,
|
|
|
- licenseReceived = (short)-1
|
|
|
- };
|
|
|
- Monitor.Monitor.PLC.WriteToPLC(mb, PLCDataType.central);
|
|
|
try { idLicMap.Remove(currentTerm); }
|
|
|
catch { }
|
|
|
Monitor.Monitor.SetNotification(license + " 数据库已更新,停车流程结束", parkMonitor.model.TextColor.Info);
|
|
@@ -1139,6 +1146,15 @@ namespace Terminal
|
|
|
bool value = false;
|
|
|
if (termIndex != -1 && termCalcMap.Count >= termIndex && termCalcMap.TryGetValue(termIndex, out value) && !value && ts.cmd == 2 && receiptNum != 0)
|
|
|
{
|
|
|
+ MainBlockStru mb = new MainBlockStru
|
|
|
+ {
|
|
|
+ centralHearbeat = (short)-1,
|
|
|
+ bookParkCmd = -1,
|
|
|
+ bookFetchCmd = -1,
|
|
|
+ processCompleted = (short)0,
|
|
|
+ licenseReceived = (short)-1
|
|
|
+ };
|
|
|
+ Monitor.Monitor.PLC.WriteToPLC(mb, PLCDataType.central);
|
|
|
//fetchState = Monitor.Monitor.mainBlockInfo.fetchingRunning;
|
|
|
Monitor.Monitor.SetNotification(termIndex + "号终端准备计算费用", parkMonitor.model.TextColor.Log);
|
|
|
termCalcMap[termIndex] = true;
|
|
@@ -1261,15 +1277,15 @@ namespace Terminal
|
|
|
if (Monitor.Monitor.mainBlockInfo.processCompleted == 1)
|
|
|
{
|
|
|
UpdateSpecificParkingSpace();
|
|
|
- while (terminalInfo[termIndex].receiptNum != 0)
|
|
|
- {
|
|
|
- count++;
|
|
|
- if (count == 1)
|
|
|
- Monitor.Monitor.SetNotification("等待凭证号清除", parkMonitor.model.TextColor.Log);
|
|
|
- if (count > 10000)//避免int型数据溢出
|
|
|
- count = 2;
|
|
|
- Thread.Sleep(200);
|
|
|
- }
|
|
|
+ //while (terminalInfo[termIndex].receiptNum != 0)
|
|
|
+ //{
|
|
|
+ // count++;
|
|
|
+ // if (count == 1)
|
|
|
+ // Monitor.Monitor.SetNotification("等待凭证号清除", parkMonitor.model.TextColor.Log);
|
|
|
+ // if (count > 10000)//避免int型数据溢出
|
|
|
+ // count = 2;
|
|
|
+ // Thread.Sleep(200);
|
|
|
+ //}
|
|
|
int paymentStatus = 0;
|
|
|
for (int i = 0; i < terminalInfo.Count; i++)
|
|
|
{
|
|
@@ -1279,19 +1295,10 @@ namespace Terminal
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- Log.WriteLog(LogType.process, LogFile.INFO, "检测到凭证号已被清除");
|
|
|
+ //Log.WriteLog(LogType.process, LogFile.INFO, "检测到凭证号已被清除");
|
|
|
FetchInfo fi = null;
|
|
|
UpdateAllParkingSpace(false);
|
|
|
ClearTerminal(terminalInfo[termIndex].terminalID);
|
|
|
- MainBlockStru mb = new MainBlockStru
|
|
|
- {
|
|
|
- centralHearbeat = (short)-1,
|
|
|
- bookParkCmd = -1,
|
|
|
- bookFetchCmd = -1,
|
|
|
- processCompleted = (short)0,
|
|
|
- licenseReceived = (short)-1
|
|
|
- };
|
|
|
- Monitor.Monitor.PLC.WriteToPLC(mb, PLCDataType.central);
|
|
|
|
|
|
if (fetchInfoMap.ContainsKey(terminalInfo[termIndex].terminalID))
|
|
|
{
|