ソースを参照

确认无法拍到号牌源于共用licBuffer,导致相同号牌无法入队。加入停车车辆开走后状态清除。

yct 5 年 前
コミット
7664319888

+ 7 - 7
PLCLinker/centralController/NumMachine/NumMachine.cs

@@ -392,7 +392,7 @@ namespace NumMachine
                     //号牌不为空
                     //号牌不为空
                     if (!(plateInformation.plate.Contains("_无_")))
                     if (!(plateInformation.plate.Contains("_无_")))
                     {
                     {
-                        Log.WriteLog(LogType.process, LogFile.INFO, nmn.id + "收到号牌回调信息: [" + plateInformation.plate + "]");
+                        //Log.WriteLog(LogType.process, LogFile.INFO, nmn.id + "收到号牌回调信息: [" + plateInformation.plate + "]");
                         nmn.SetLic(strIP, nmn.id, plateInformation.plate, DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"), GetStatus(strIP));
                         nmn.SetLic(strIP, nmn.id, plateInformation.plate, DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"), GetStatus(strIP));
                         FilterLic(strIP, (NumberMachineNode)nmn.Clone());
                         FilterLic(strIP, (NumberMachineNode)nmn.Clone());
                     }
                     }
@@ -493,7 +493,7 @@ namespace NumMachine
                         while (enumer.MoveNext())
                         while (enumer.MoveNext())
                         {
                         {
                             ////遍历,计数达标且队列中无此号牌
                             ////遍历,计数达标且队列中无此号牌
-                            Log.WriteLog(LogType.process, LogFile.INFO, "filter中号牌:" + enumer.Current.Key.LicenseNum + ", 个数:" + enumer.Current.Value);
+                            //Log.WriteLog(LogType.process, LogFile.INFO, "filter中号牌:" + enumer.Current.Key.LicenseNum + ", 个数:" + enumer.Current.Value);
                             //if (enumer.Current.Value >= (int)(filterCount * filterRatio) && enumer.Current.Key != null && !LicBuffer.Contains(enumer.Current.Key))
                             //if (enumer.Current.Value >= (int)(filterCount * filterRatio) && enumer.Current.Key != null && !LicBuffer.Contains(enumer.Current.Key))
                             //找到最大计数及相应号牌信息
                             //找到最大计数及相应号牌信息
                             if (enumer.Current.Value >= maxCount && enumer.Current.Key != null)// && !LicBuffer.Contains(enumer.Current.Key))
                             if (enumer.Current.Value >= maxCount && enumer.Current.Key != null)// && !LicBuffer.Contains(enumer.Current.Key))
@@ -503,7 +503,7 @@ namespace NumMachine
                                 //{
                                 //{
                                 maxCount = enumer.Current.Value;
                                 maxCount = enumer.Current.Value;
                                 node = (NumberMachineNode)enumer.Current.Key.Clone();
                                 node = (NumberMachineNode)enumer.Current.Key.Clone();
-                                Log.WriteLog(LogType.process, LogFile.INFO, "筛出号牌:" + node);
+                                //Log.WriteLog(LogType.process, LogFile.INFO, "筛出号牌:" + node);
                                 //}
                                 //}
                             }
                             }
                         }
                         }
@@ -971,13 +971,13 @@ namespace NumMachine
                     }
                     }
                 }
                 }
             }
             }
-
+            node = null;
             int timeLimit = FILTERINGNUMBER * 2;
             int timeLimit = FILTERINGNUMBER * 2;
             while (node == null && timeLimit-- > 0)
             while (node == null && timeLimit-- > 0)
             {
             {
                 lock (LicBuffer)
                 lock (LicBuffer)
                 {
                 {
-                    Log.WriteLog(LogType.process, LogFile.INFO, "licBuffer 元素个数:" + LicBuffer.Count);
+                    //Log.WriteLog(LogType.process, LogFile.INFO, "licBuffer 元素个数:" + LicBuffer.Count);
                     for (int i = 0; i < LicBuffer.Count; i++)
                     for (int i = 0; i < LicBuffer.Count; i++)
                     {
                     {
                         node = LicBuffer.Dequeue();
                         node = LicBuffer.Dequeue();
@@ -986,12 +986,12 @@ namespace NumMachine
                             if (node.id == id && node.LicenseNum != "")
                             if (node.id == id && node.LicenseNum != "")
                             {
                             {
                                 license = node.LicenseNum;
                                 license = node.LicenseNum;
-                                Log.WriteLog(LogType.process, LogFile.INFO, "license: " + license + ", id: " + id);
+                                //Log.WriteLog(LogType.process, LogFile.INFO, "license: " + license + ", id: " + id);
                                 break;
                                 break;
                             }
                             }
                             else
                             else
                             {
                             {
-                                Log.WriteLog(LogType.process, LogFile.INFO, "other license: " + node.LicenseNum + ", id: " + node.id);
+                                //Log.WriteLog(LogType.process, LogFile.INFO, "other license: " + node.LicenseNum + ", id: " + node.id);
                                 LicBuffer.Enqueue(node);
                                 LicBuffer.Enqueue(node);
                             }
                             }
                         }
                         }

+ 25 - 5
PLCLinker/centralController/Terminal/Terminal.cs

@@ -284,7 +284,7 @@ namespace Terminal
             }
             }
         }
         }
         /// <summary>
         /// <summary>
-        /// 流程结束清除终端相关信息
+        /// 流程结束清除终端相关信息,同时允许再次根据地感拍号牌
         /// </summary>
         /// </summary>
         /// <param name="id"></param>
         /// <param name="id"></param>
         private static void ClearTerminal(int id, bool removeReceipt)
         private static void ClearTerminal(int id, bool removeReceipt)
@@ -294,6 +294,7 @@ namespace Terminal
                 if (terminalInfo[i].terminalID == id)
                 if (terminalInfo[i].terminalID == id)
                 {
                 {
                     Log.WriteLog(LogType.process, LogFile.WARNING, "即将删除终端" + id + "数据:" + terminalInfo[i].ToString());
                     Log.WriteLog(LogType.process, LogFile.WARNING, "即将删除终端" + id + "数据:" + terminalInfo[i].ToString());
+                    lockList[i] = false;
                 }
                 }
             }
             }
             TerminalStru tsFromCentral = new TerminalStru
             TerminalStru tsFromCentral = new TerminalStru
@@ -800,15 +801,33 @@ namespace Terminal
                 }
                 }
             }
             }
 
 
-            //找到停车终端,且有地感无按钮数据
             for (int i = 0; i < terminalInfo.Count; i++)
             for (int i = 0; i < terminalInfo.Count; i++)
             {
             {
                 //Console.WriteLine(i);
                 //Console.WriteLine(i);
+                //找到停车终端,且有地感无按钮数据,拍摄号牌
                 if (terminalInfo[i].terminalStatus == 1 && terminalInfo[i].groundStatus == 1 && terminalInfo[i].btnStatus == 0 && !lockList[i])
                 if (terminalInfo[i].terminalStatus == 1 && terminalInfo[i].groundStatus == 1 && terminalInfo[i].btnStatus == 0 && !lockList[i])
                 {
                 {
                     lockList[i] = true;
                     lockList[i] = true;
                     Action<int> reserveAction = new Action<int>(ReservedOper);
                     Action<int> reserveAction = new Action<int>(ReservedOper);
                     reserveAction(i);
                     reserveAction(i);
+                //找到停车终端,且无地感有按钮数据,空闲状态,清除按钮状态
+                }else if(terminalInfo[i].terminalStatus == 1 && terminalInfo[i].groundStatus == 0 && terminalInfo[i].btnStatus != 0 && terminalInfo[i].cmd == 0)
+                {
+                    TerminalStru ts = new TerminalStru
+                    {
+                        terminalID = terminalInfo[i].terminalID,
+                        paymentStatus = (short)-1,
+                        btnStatus = 0,
+                        cmd = (short)-1,
+                        licenseCodeA = -1,
+                        licenseCodeB = -1,
+                        licenseCodeC = -1,
+                        licenseCodeD = -1,
+                        receiptNum = -1
+                    };
+                    Monitor.Monitor.PLC.WriteToPLC(ts, PLCDataType.terminal);
+                    Log.WriteLog(LogType.process, LogFile.INFO, "清除按钮状态,写入PLC:" + ts.btnStatus);
+                    lockList[i] = false;
                 }
                 }
                 //else if (lockList[i] && terminalInfo[i].terminalID == 1)
                 //else if (lockList[i] && terminalInfo[i].terminalID == 1)
                 //{
                 //{
@@ -887,14 +906,15 @@ namespace Terminal
                     Monitor.Monitor.SetNotification("指令写入PLC:" + ts.btnStatus, parkMonitor.model.TextColor.Log);
                     Monitor.Monitor.SetNotification("指令写入PLC:" + ts.btnStatus, parkMonitor.model.TextColor.Log);
                     Log.WriteLog(LogType.process, LogFile.INFO, "指令写入PLC:" + ts.btnStatus);
                     Log.WriteLog(LogType.process, LogFile.INFO, "指令写入PLC:" + ts.btnStatus);
                     Thread.Sleep(1000);
                     Thread.Sleep(1000);
+                    lockList[index] = false;
                 }
                 }
                 else
                 else
                 {
                 {
-                    //Monitor.Monitor.SetNotification("收到地感后,尝试5次未拍到号牌。", parkMonitor.model.TextColor.Log);
-                    //Log.WriteLog(LogType.process, LogFile.ERROR, "收到地感后,尝试5次未拍到号牌。");
+                    Monitor.Monitor.SetNotification("收到地感后,尝试5次未拍到号牌。", parkMonitor.model.TextColor.Log);
+                    Log.WriteLog(LogType.process, LogFile.ERROR, "收到地感后,尝试5次未拍到号牌。");
                     Thread.Sleep(200);
                     Thread.Sleep(200);
                 }
                 }
-                lockList[index] = false;
+                
                 
                 
             });
             });
         }
         }