public void On_Transaction_TimeOut(Transaction Txn) { logger.Debug(_Config.DeviceName + "(On_Transaction_TimeOut Txn is timeout:" + Txn.CommandEncodeStr); Txn.SetTimeOutMonitor(false); if (TransactionList.TryRemove(Txn.AdrNo + Txn.IsInterrupt.ToString(), out Txn)) { Node Node = NodeManagement.GetByController(_Config.DeviceName, Txn.AdrNo); if (Node != null) { _ReportTarget.On_Command_TimeOut(Node, Txn); } else { logger.Debug(_Config.DeviceName + "(On_Transaction_TimeOut Get Node fail."); } } else { logger.Debug(_Config.DeviceName + "(On_Transaction_TimeOut TryRemove Txn fail."); } }
public void On_Transaction_TimeOut(Transaction Txn) { logger.Debug(_Config.DeviceName + "(On_Transaction_TimeOut Txn is timeout:" + Txn.CommandEncodeStr); string key = ""; if (_Config.Vendor.ToUpper().Equals("KAWASAKI")) { key = Txn.Seq; } else { key = Txn.AdrNo + Txn.Type; } Txn.SetTimeOutMonitor(false); if (TransactionList.TryRemove(key, out Txn)) { Node Node = NodeManagement.GetByController(_Config.DeviceName, Txn.AdrNo); if (Node.State.Equals("Pause")) { logger.Debug("Txn timeout,but state is pause. ignore this."); TransactionList.TryAdd(key, Txn); return; } if (Node != null) { _ReportTarget.On_Command_TimeOut(Node, Txn); } else { logger.Debug(_Config.DeviceName + "(On_Transaction_TimeOut Get Node fail."); } } else { logger.Debug(_Config.DeviceName + "(On_Transaction_TimeOut TryRemove Txn fail."); } }
private void TimeOutMonitor(object sender, System.Timers.ElapsedEventArgs e) { timeOutTimer.Enabled = false; SetStatus(Idle); logger.Error("Time out! Send to:" + IP + ":" + Port + " Command:" + LastSendCommand); tObj.On_Command_TimeOut(ControllerName, LastSendCommand, LastJob); }
public void On_Transaction_TimeOut(Transaction Txn) { logger.Debug(DeviceName + "(On_Transaction_TimeOut Txn is timeout:" + Txn.Method); _ReportTarget.On_Message_Log("CMD", DeviceName + "(On_Transaction_TimeOut Txn is timeout:" + Txn.Method); string key = ""; if (Vendor.ToUpper().Equals("KAWASAKI")) { key = Txn.Seq; } else if (Vendor.ToUpper().Equals("HST") || Vendor.ToUpper().Equals("COGNEX")) { key = "1"; } else if (Vendor.ToUpper().Equals("SANWA") || Vendor.ToUpper().Equals("ATEL_NEW")) { key = Txn.AdrNo + Txn.Method; for (int seq = 0; seq <= 99; seq++) { string tmpKey = key + seq.ToString("00"); if (TransactionList.ContainsKey(tmpKey)) { key = tmpKey; break; } if (seq == 99) { logger.Error("seq is run out!"); } } } else { key = Txn.AdrNo; } Txn.SetTimeOutMonitor(false); if (TransactionList.ContainsKey(key)) { if (TransactionList.TryRemove(key, out Txn)) { //Node Node = NodeManagement.GetByController(DeviceName, Txn.AdrNo); Node Node = NodeManagement.Get(Txn.NodeName); Node.IsExcuting = false; if (Node.State.Equals("Pause")) { logger.Debug("Txn timeout,but state is pause. ignore this."); TransactionList.TryAdd(key, Txn); return; } //if (Node != null) //{ // _ReportTarget.On_Command_TimeOut(Node, Txn); //} //else //{ // logger.Debug(DeviceName + "(On_Transaction_TimeOut Get Node fail."); //} } else { logger.Debug(DeviceName + "(On_Transaction_TimeOut TryRemove Txn fail."); } } _ReportTarget.On_Command_TimeOut(NodeManagement.Get(Txn.NodeName), Txn); }