Commit 810d0935 张东亮

新增任务日志

1 个父辈 e7703a5b
...@@ -53,6 +53,21 @@ ...@@ -53,6 +53,21 @@
<conversionPattern value="[%date]%-5p %m%n"/> <conversionPattern value="[%date]%-5p %m%n"/>
</layout> </layout>
</appender> </appender>
<appender name="RunLog" type="log4net.Appender.RollingFileAppender">
<file value="logs/runLog/RunLog.json"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<param name="MaxSizeRollBackups" value="10" />
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m%n"/>
</layout>
</appender>
<logger name="RunLog">
<level value="Info"/>
<appender-ref ref="RunLog"/>
</logger>
<logger name="LineWebService"> <logger name="LineWebService">
<level value="Info"/> <level value="Info"/>
<appender-ref ref="LineWebService"/> <appender-ref ref="LineWebService"/>
......
文件属性发生变化
...@@ -65,8 +65,12 @@ namespace AGVControl ...@@ -65,8 +65,12 @@ namespace AGVControl
{ {
Invoke(new Action(() => Invoke(new Action(() =>
{ {
DgvNode.Rows[nodeIndex].DefaultCellStyle.ForeColor = AGVManager.nodeInfo[nodeIndex].Online && AGVManager.nodeInfo[nodeIndex].IsUse ? Color.Black : Color.Red; for (int i = 0; i < AGVManager.nodeInfo.Count; i++)
DgvNode.Rows[nodeIndex].SetValues(AGVManager.nodeInfo[nodeIndex].ToRow()); {
DgvNode.Rows[i].DefaultCellStyle.ForeColor = AGVManager.nodeInfo[i].Online && AGVManager.nodeInfo[i].IsUse ? Color.Black : Color.Red;
DgvNode.Rows[i].SetValues(AGVManager.nodeInfo[i].ToRow());
}
})); }));
System.GC.Collect(); System.GC.Collect();
} }
...@@ -75,8 +79,11 @@ namespace AGVControl ...@@ -75,8 +79,11 @@ namespace AGVControl
{ {
Invoke(new Action(() => Invoke(new Action(() =>
{ {
DgvNode.Rows[nodeIndex].DefaultCellStyle.ForeColor = AGVManager.nodeInfo[nodeIndex].Online ? Color.Black : Color.Red; for (int i = 0; i < AGVManager.nodeInfo.Count; i++)
DgvNode.Rows[nodeIndex].SetValues(AGVManager.nodeInfo[nodeIndex].ToRow()); {
DgvNode.Rows[i].DefaultCellStyle.ForeColor = AGVManager.nodeInfo[i].Online && AGVManager.nodeInfo[i].IsUse ? Color.Black : Color.Red;
DgvNode.Rows[i].SetValues(AGVManager.nodeInfo[i].ToRow());
}
})); }));
System.GC.Collect(); System.GC.Collect();
} }
......
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
...@@ -14,6 +14,9 @@ namespace DeviceLibrary ...@@ -14,6 +14,9 @@ namespace DeviceLibrary
public class Control public class Control
{ {
private static log4net.ILog log = log4net.LogManager.GetLogger("Control"); private static log4net.ILog log = log4net.LogManager.GetLogger("Control");
static log4net.ILog runLog = log4net.LogManager.GetLogger("RunLog");
static Dictionary<string, RunInfo> runInfoMap = new Dictionary<string, RunInfo>();
private System.Timers.Timer AgvCallTimer; private System.Timers.Timer AgvCallTimer;
private System.Timers.Timer AgvStateTimer; private System.Timers.Timer AgvStateTimer;
private System.Timers.Timer NodeStateTimer; private System.Timers.Timer NodeStateTimer;
...@@ -160,7 +163,11 @@ namespace DeviceLibrary ...@@ -160,7 +163,11 @@ namespace DeviceLibrary
try try
{ {
if (!AGVManager.agvInfo[i].Msg.Equals("")) if (!AGVManager.agvInfo[i].Msg.Equals(""))
{
RunLogInfo(new RunInfo(AGVManager.agvInfo[i].Name, AGVManager.agvInfo[i].Msg));
msglist.Add(new AlarmMsg(AGVManager.agvInfo[i].Name, "lineAgv." + AGVManager.agvInfo[i].Name + ".Msg", AGVManager.agvInfo[i].Msg, 1)); msglist.Add(new AlarmMsg(AGVManager.agvInfo[i].Name, "lineAgv." + AGVManager.agvInfo[i].Name + ".Msg", AGVManager.agvInfo[i].Msg, 1));
}
else else
{ {
if ((AGVManager.agvInfo[i].Place.Contains(SettingString.AutoCharge) || AGVManager.agvInfo[i].Place.Contains(SettingString.Standby))) if ((AGVManager.agvInfo[i].Place.Contains(SettingString.AutoCharge) || AGVManager.agvInfo[i].Place.Contains(SettingString.Standby)))
...@@ -184,7 +191,23 @@ namespace DeviceLibrary ...@@ -184,7 +191,23 @@ namespace DeviceLibrary
AgvStateInProcess = false; AgvStateInProcess = false;
} }
public static void RunLogInfo(RunInfo info)
{
if (runInfoMap == null)
return;
if (runInfoMap.Keys.Contains(info.AGVNum))
{
if (!runInfoMap[info.AGVNum].Equals(info))
{
runLog.Info(info.ToString());
}
}
else
{
runInfoMap.Add(info.AGVNum, info);
runLog.Info(info.ToString());
}
}
/// <summary> /// <summary>
/// 从节点获取任务 /// 从节点获取任务
/// </summary> /// </summary>
...@@ -294,4 +317,42 @@ namespace DeviceLibrary ...@@ -294,4 +317,42 @@ namespace DeviceLibrary
} }
} }
}
public class RunInfo
{
/// <summary>
/// AGV编号
/// </summary>
public string AGVNum { get; set; } = "";
/// <summary>
/// 时间
/// </summary>
public string DateTime { get; set; } = "";
/// <summary>
/// 任务信息
/// </summary>
public string MissionInfo { get; set; } = "";
public RunInfo(string AGVNum, string missionInfo)
{
//2006-01-02 15:04:05
DateTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
this.AGVNum = AGVNum;
MissionInfo = missionInfo;
}
public RunInfo() { }
public override bool Equals(object obj)
{
if (obj is RunInfo)
{
RunInfo info = (RunInfo)obj;
if (this.MissionInfo.Equals(info.MissionInfo))
return true;
this.MissionInfo = info.MissionInfo;
}
return false;
}
public override string ToString()
{
return JsonHelper.SerializeObject(this);
}
} }
\ No newline at end of file \ No newline at end of file
文件属性发生变化
文件属性发生变化
...@@ -397,9 +397,9 @@ namespace DeviceLibrary ...@@ -397,9 +397,9 @@ namespace DeviceLibrary
msg += string.Format("[{0}] {1}", jobStep.CurStep(), runInfo); msg += string.Format("[{0}] {1}", jobStep.CurStep(), runInfo);
jobStep.Msg = msg; jobStep.Msg = msg;
//4DfeederOut默认大料架 //4DfeederOut默认大料架
if (agv.Place.Equals(SettingString.RoomDFeederOut)) // if (agv.Place.Equals(SettingString.RoomDFeederOut))
return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.BigShelf); // return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.BigShelf);
else if (agv.RFID.StartsWith("D")) if (agv.RFID.StartsWith("D"))
return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.SmallShelf); return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.SmallShelf);
else if (agv.RFID.StartsWith("C")) else if (agv.RFID.StartsWith("C"))
......
...@@ -178,7 +178,7 @@ namespace DeviceLibrary ...@@ -178,7 +178,7 @@ namespace DeviceLibrary
if (RFID.StartsWith(SettingString.BigShelf_Prefix) && !FullShelfPlace.Equals(SettingString.RoomDFeederIn) && !FullShelfPlace.Equals(SettingString.RoomCFeederIn)) if (RFID.StartsWith(SettingString.BigShelf_Prefix) && !FullShelfPlace.Equals(SettingString.RoomDFeederIn) && !FullShelfPlace.Equals(SettingString.RoomCFeederIn))
{ {
jobStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_BIG_SHELF_UNLOCK); jobStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_BIG_SHELF_UNLOCK);
runInfo = "AGV到达 " + FullShelfPlace + ",并等待大料架解绑"; runInfo = "AGV到达 " + FullShelfPlace + ",并等待大料架移库操作";
msg += string.Format("[{0}] {1}", jobStep.CurStep(),runInfo); msg += string.Format("[{0}] {1}", jobStep.CurStep(),runInfo);
jobStep.Msg = msg; jobStep.Msg = msg;
} }
...@@ -200,7 +200,7 @@ namespace DeviceLibrary ...@@ -200,7 +200,7 @@ namespace DeviceLibrary
System.Threading.Thread.Sleep(50); System.Threading.Thread.Sleep(50);
if (HttpManager.GetRackBy(RFID, out string lineName) || (input != null && input[0])) if (HttpManager.GetRackBy(RFID, out string lineName) || (input != null && input[0]))
{ {
runInfo = "大料架在" + FullShelfPlace + "解绑完成[" + agv.BoxDestInfo + "]"; runInfo = "大料架在" + FullShelfPlace + "移库完成[" + agv.BoxDestInfo + "]";
agv.BoxDestInfo = ""; agv.BoxDestInfo = "";
msg += string.Format("[{0}] {1}", jobStep.CurStep(),runInfo); msg += string.Format("[{0}] {1}", jobStep.CurStep(),runInfo);
jobStep.Msg = msg; jobStep.Msg = msg;
......
...@@ -57,8 +57,8 @@ namespace DeviceLibrary ...@@ -57,8 +57,8 @@ namespace DeviceLibrary
} }
if (cnt < clientNode.EmptyShelfCnt) if (cnt < clientNode.EmptyShelfCnt)
{ {
int i = AGVManager.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(nodeName));
if (AGVManager.CheckStationState(clientNode, out rfid) && CanEmptyTask(emptyJobCnt)) if (i == -1 && AGVManager.CheckStationState(clientNode, out rfid) && CanEmptyTask(emptyJobCnt))
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName, rfid); return new GoEmptyShelfLineJob(currentAgv.Place, nodeName, rfid);
} }
return null; return null;
......
...@@ -473,7 +473,7 @@ namespace DeviceLibrary ...@@ -473,7 +473,7 @@ namespace DeviceLibrary
if (idx > -1) if (idx > -1)
{ {
nodeName = nodeInfo[idx].Name; nodeName = nodeInfo[idx].Name;
log.Debug(agv.Name + " 双层线右侧需要料架,准备去4C-" + nodeName); log.Debug(agv.Name + " 双层线右侧需要料架,准备去3C-" + nodeName);
return true; return true;
} }
} }
...@@ -484,7 +484,7 @@ namespace DeviceLibrary ...@@ -484,7 +484,7 @@ namespace DeviceLibrary
if (idx > -1) if (idx > -1)
{ {
nodeName = nodeInfo[idx].Name; nodeName = nodeInfo[idx].Name;
log.Debug(agv.Name + " 双层线右侧需要料架,准备去4D-" + nodeName); log.Debug(agv.Name + " 双层线右侧需要料架,准备去3D-" + nodeName);
return true; return true;
} }
...@@ -496,7 +496,7 @@ namespace DeviceLibrary ...@@ -496,7 +496,7 @@ namespace DeviceLibrary
if (!nearNodeName.Equals("")) if (!nearNodeName.Equals(""))
{ {
nodeName = nearNodeName; nodeName = nearNodeName;
log.Debug(agv.Name + " 双层线需要小料架,准备去4C-" + nearNodeName); log.Debug(agv.Name + " 双层线需要小料架,准备去3C-" + nearNodeName);
return true; return true;
} }
...@@ -509,7 +509,7 @@ namespace DeviceLibrary ...@@ -509,7 +509,7 @@ namespace DeviceLibrary
if (!nearNodeName.Equals("")) if (!nearNodeName.Equals(""))
{ {
nodeName = nearNodeName; nodeName = nearNodeName;
log.Debug(agv.Name + " 双层线需要小料架,准备去4D-" + nearNodeName); log.Debug(agv.Name + " 双层线需要小料架,准备去3D-" + nearNodeName);
return true; return true;
} }
......
...@@ -82,12 +82,12 @@ namespace DeviceLibrary ...@@ -82,12 +82,12 @@ namespace DeviceLibrary
if(rfid.Equals("")) if(rfid.Equals(""))
{ {
Log.Error(string.Format("添加空架任务失败 节点[{0}] RFID=null", value)); Log.Error(string.Format("添加空架任务失败 节点[{0}] RFID=null", value));
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed: emptyStation=" + emptyStation + " rfid=" + rfid }; res = new Result() { Succeed = false, ResultData = "true", ErrorMessage = "CreateEmptyRecycleTask failed: emptyStation=" + emptyStation + " rfid=" + rfid };
} }
else else
{ {
Log.Error(string.Format("添加空架任务失败 节点[{0}]RFID={1} 重复", value,rfid.ToUpper())); Log.Error(string.Format("添加空架任务失败 节点[{0}]RFID={1} 重复", value,rfid.ToUpper()));
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed due it has been created: emptyStation=" + emptyStation + " rfid=" + rfid}; res = new Result() { Succeed = false, ResultData = "true", ErrorMessage = "CreateEmptyRecycleTask failed due it has been created: emptyStation=" + emptyStation + " rfid=" + rfid};
} }
} }
else else
...@@ -97,7 +97,7 @@ namespace DeviceLibrary ...@@ -97,7 +97,7 @@ namespace DeviceLibrary
} }
else else
{ {
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find " + emptyStation }; res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find linename=" + emptyStation };
Log.Error("Unlock POST Response false:" + "Not find " + emptyStation); Log.Error("Unlock POST Response false:" + "Not find " + emptyStation);
} }
} }
...@@ -120,8 +120,8 @@ namespace DeviceLibrary ...@@ -120,8 +120,8 @@ namespace DeviceLibrary
Log.Debug(string.Format("Unlock Request(GET) [emptyStation={0},rfid={1}]", line, RFID.ToUpper())); Log.Debug(string.Format("Unlock Request(GET) [emptyStation={0},rfid={1}]", line, RFID.ToUpper()));
if (!AGVManager.unlockManager.AddMission(value,RFID.ToUpper())) if (!AGVManager.unlockManager.AddMission(value,RFID.ToUpper()))
{ {
Log.Error(string.Format("添加空架任务失败 节点[{0}]RFID={1} 重复", value, RFID.ToUpper())); Log.Error(string.Format("添加空架任务失败 节点[{0}]RFID={1} 重复/RFID为空", value, RFID.ToUpper()));
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed due it has been created: emptyStation=" + line + " rfid=" + RFID }; res = new Result() { Succeed = false, ResultData = "true", ErrorMessage = "CreateEmptyRecycleTask failed due it has been created or rfid=null: emptyStation=" + line + " rfid=" + RFID };
} }
else else
{ {
...@@ -131,10 +131,9 @@ namespace DeviceLibrary ...@@ -131,10 +131,9 @@ namespace DeviceLibrary
} }
else else
{ {
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find " + line }; res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find line=" + line };
Log.Error("Unlock GET Response false " + "Not find " + line); Log.Error("Unlock GET Response false " + "Not find " + line);
} }
//Log.Info(string.Format("WebService GET Request emptyStation={0},rfid={1}", line, RFID));
return JsonHelper.SerializeObject(res); return JsonHelper.SerializeObject(res);
} }
} }
......
文件属性发生变化
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!