Commit 80f750cd 张东亮

1225

1 个父辈 16264432
......@@ -574,8 +574,8 @@ namespace AGVControl
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Get(server);
Common.log.Info("清理料架的缓存信息【" + server + "】【" + resultStr + "】");
RfidData rfidData = JsonHelper.DeserializeJsonToObject<RfidData>(resultStr);
//清理料架的缓存信息【http://10.85.199.25/myproject/rest/api/qisda/device/agvRemoveRfid?rfid=C2】【{"code":0,"msg":"ok","data":"料架放上AGV时,清理[C2]的缓存信息成功"}】
RfidData1 rfidData = JsonHelper.DeserializeJsonToObject<RfidData1>(resultStr);
if (rfidData == null)
{
......@@ -709,7 +709,15 @@ namespace AGVControl
public Dictionary<string, string> data { get; set; }
}
public class RfidData1
{
//{"code":0,"msg":"ok","data":"7"}
public int code { get; set; }
public string msg { get; set; }
public string data { get; set; }
}
/// <summary>
/// Mir位置
/// </summary>
......
......@@ -907,8 +907,8 @@ namespace AGVControl
{
// if (warnMsg.Equals(""))
{
warnMsg = string.Format("接驳台[{1}]有空料架未回收完,无法出满料,请检查接驳台RFID读取情况", clientNode.RFID, clientNode.Name);
Common.LogInfo(warnMsg);
warnMsg = string.Format("接驳台[{1}]有空料架未回收完,无法出满料", clientNode.RFID, clientNode.Name);
//Common.LogInfo(warnMsg);
}
return false;
}
......
......@@ -19,6 +19,7 @@ namespace AGVControl.BLL
private System.Timers.Timer AgvCallTimer;
private System.Timers.Timer AgvStateTimer;
private System.Timers.Timer NodeStateTimer;
private System.Timers.Timer StateUpdateTimer;
//public List<string> Marks;
private const int REG_STATUS = 20;
//private List<string> shelfLockedNodeNames;
......@@ -50,17 +51,25 @@ namespace AGVControl.BLL
Enabled = false
};
NodeStateTimer.Elapsed += NodeStateTimer_Elapsed;
StateUpdateTimer = new System.Timers.Timer
{
Interval = 3000,
AutoReset = true,
Enabled = false
};
StateUpdateTimer.Elapsed += StateUpdateTimer_Elapsed;
}
public void Start()
{
AgvCallTimer.Enabled = true;
AgvStateTimer.Enabled = true;
NodeStateTimer.Enabled = true;
StateUpdateTimer.Enabled = true;
AgvCallTimer.Start();
AgvStateTimer.Start();
NodeStateTimer.Start();
StateUpdateTimer.Start();
}
public void Stop()
......@@ -68,9 +77,11 @@ namespace AGVControl.BLL
AgvCallTimer.Enabled = false;
AgvStateTimer.Enabled = false;
NodeStateTimer.Enabled = false;
StateUpdateTimer.Enabled = false;
AgvCallTimer.Stop();
AgvStateTimer.Stop();
NodeStateTimer.Stop();
StateUpdateTimer.Stop();
}
private bool NodeStateInProcess = false;
private void NodeStateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
......@@ -87,11 +98,11 @@ namespace AGVControl.BLL
if (!Common.UpdateStationState(Common.nodeInfo[j]))
{
isAlarm = true;
msglist.Add(new AlarmMsg(Common.nodeInfo[j].AliceName, "lineAgv." + Common.nodeInfo[j].Name + ".WarnMsg", Common.nodeInfo[j].WarnMsg));
msglist.Add(new AlarmMsg(Common.nodeInfo[j].AliceName, "lineAgv." + Common.nodeInfo[j].Name + ".Msg", Common.nodeInfo[j].WarnMsg));
}
if (!isAlarm && !Common.nodeInfo[j].Online)
{
msglist.Add(new AlarmMsg(Common.nodeInfo[j].AliceName, "lineAgv." + Common.nodeInfo[j].Name + ".OffLine", "离线"));
msglist.Add(new AlarmMsg(Common.nodeInfo[j].AliceName, "lineAgv." + Common.nodeInfo[j].Name + ".Msg", "离线"));
}
if (Common.nodeInfo[j].Name.StartsWith(SettingString.D4_Name_Prefix) || Common.nodeInfo[j].Name.StartsWith(SettingString.C4_Name_Prefix))
{
......@@ -124,7 +135,7 @@ namespace AGVControl.BLL
}
AGVManager.updateDeviceAlarmMsg(msglist);
}
catch(Exception ex)
catch (Exception ex)
{
Common.log.Error("NodeStateTimer " + ex.Message + ex.StackTrace);
}
......@@ -137,13 +148,8 @@ namespace AGVControl.BLL
bool rtn;
if (AgvStateInProcess) return;
AgvStateInProcess = true;
List<AlarmMsg> msglist = new List<AlarmMsg>();
for (int i = 0; i < Common.agvInfo.Count; i++)
{
//上报异常
bool isAlarm = false;
//if (msglist.Count > 0)
// msglist.Clear();
try
{
if (!CheckOnline(i)) continue;
......@@ -155,57 +161,69 @@ namespace AGVControl.BLL
Thread.Sleep(50);
if (rtn) change = Common.agvInfo[i].SetState(stateID, stateStr, battery, mission_text, position);
// if (change)
// if (change)
{
AgvChanged?.Invoke(i);
}
}
catch (Exception ex)
{
Common.log.Error("AgvStateTimer_" + Common.agvInfo[i].Name + ex.Message + ex.StackTrace);
}
}
Thread.Sleep(50);
if (stateText.Equals("Error") || stateText.Equals("EmergencyStop") || stateText.Equals("Pause"))
AgvStateInProcess = false;
}
private bool AgvStateUpdateProcess = false;
private void StateUpdateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (AgvStateUpdateProcess) return;
AgvStateUpdateProcess = true;
List<AlarmMsg> msglist = new List<AlarmMsg>();
for (int i = 0; i < Common.agvInfo.Count; i++)
{
//上报异常
bool isAlarm = false;
try
{
if (!Common.agvInfo[i].IsCon)
{
isAlarm = true;
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".Error.EmergencyStop", "agv状态:" + stateText + ""));
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".Msg", "离线"));
}
if (!isAlarm && !Common.agvInfo[i].IsCon)
if (!isAlarm && (Common.agvInfo[i].StateID.Equals(eAGVState.Error) || Common.agvInfo[i].StateID.Equals(eAGVState.EmergencyStop) || Common.agvInfo[i].StateID.Equals(eAGVState.Pause)))
{
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".OffLine", "离线"));
isAlarm = true;
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".Msg", Common.agvInfo[i].StateID.ToString()));
}
if (!isAlarm && Common.agvInfo[i].StandTimeOut)
{
isAlarm = true;
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".StandTimeOut", "在" + Common.agvInfo[i].PlaceAliceName + "停留超时" + (DateTime.Now - Common.agvInfo[i].StandStartTime).TotalMinutes.ToString("f2") + "分钟"));
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".Msg", "在" + Common.agvInfo[i].PlaceAliceName + "停留超时" + (DateTime.Now - Common.agvInfo[i].StandStartTime).TotalMinutes.ToString("f2") + "分钟"));
}
if (!isAlarm)
{
try
if (!Common.agvInfo[i].Msg.Equals(""))
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".Msg", Common.agvInfo[i].Msg, 1));
else
{
if (!Common.agvInfo[i].Msg.Equals(""))
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".Msg", Common.agvInfo[i].Msg, 1));
else
if ((Common.agvInfo[i].Place.Contains(SettingString.AutoCharge) || Common.agvInfo[i].Place.Contains(SettingString.Standby)))
{
if ((Common.agvInfo[i].Place.Contains(SettingString.AutoCharge) || Common.agvInfo[i].Place.Contains(SettingString.Standby)))
{
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".Place", Common.agvInfo[i].Place, 1));
}
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".Place", Common.agvInfo[i].Place, 1));
}
}
catch (Exception ex)
{
Common.log.Error(Common.agvInfo[i].Name + "上报小车运行步骤失败" + ex.Message + ex.StackTrace);
}
}
AGVManager.updateDeviceAlarmMsg(msglist);
}
catch (Exception ex)
{
Common.log.Error("AgvStateTimer_" + Common.agvInfo[i].Name + ex.Message + ex.StackTrace);
Common.log.Error(Common.agvInfo[i].Name + "上报小车状态失败" + ex.Message + ex.StackTrace);
}
AGVManager.updateDeviceAlarmMsg(msglist);
}
AgvStateInProcess = false;
AgvStateUpdateProcess = false;
}
/// <summary>
/// 从节点获取任务
/// </summary>
......
......@@ -71,3 +71,4 @@ E:\Neotel\Projects\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLi
E:\Neotel\Projects\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.exe
E:\Neotel\Projects\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.pdb
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csprojAssemblyReference.cache
E:\Neotel\Projects\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csprojAssemblyReference.cache
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!