Commit 810d0935 张东亮

新增任务日志

1 个父辈 e7703a5b
......@@ -53,6 +53,21 @@
<conversionPattern value="[%date]%-5p %m%n"/>
</layout>
</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">
<level value="Info"/>
<appender-ref ref="LineWebService"/>
......
文件属性发生变化
......@@ -65,8 +65,12 @@ namespace AGVControl
{
Invoke(new Action(() =>
{
DgvNode.Rows[nodeIndex].DefaultCellStyle.ForeColor = AGVManager.nodeInfo[nodeIndex].Online && AGVManager.nodeInfo[nodeIndex].IsUse ? Color.Black : Color.Red;
DgvNode.Rows[nodeIndex].SetValues(AGVManager.nodeInfo[nodeIndex].ToRow());
for (int i = 0; i < AGVManager.nodeInfo.Count; i++)
{
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();
}
......@@ -75,8 +79,11 @@ namespace AGVControl
{
Invoke(new Action(() =>
{
DgvNode.Rows[nodeIndex].DefaultCellStyle.ForeColor = AGVManager.nodeInfo[nodeIndex].Online ? Color.Black : Color.Red;
DgvNode.Rows[nodeIndex].SetValues(AGVManager.nodeInfo[nodeIndex].ToRow());
for (int i = 0; i < AGVManager.nodeInfo.Count; i++)
{
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();
}
......
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
......@@ -14,6 +14,9 @@ namespace DeviceLibrary
public class 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 AgvStateTimer;
private System.Timers.Timer NodeStateTimer;
......@@ -160,7 +163,11 @@ namespace DeviceLibrary
try
{
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));
}
else
{
if ((AGVManager.agvInfo[i].Place.Contains(SettingString.AutoCharge) || AGVManager.agvInfo[i].Place.Contains(SettingString.Standby)))
......@@ -184,7 +191,23 @@ namespace DeviceLibrary
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>
......@@ -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
文件属性发生变化
文件属性发生变化
......@@ -397,9 +397,9 @@ namespace DeviceLibrary
msg += string.Format("[{0}] {1}", jobStep.CurStep(), runInfo);
jobStep.Msg = msg;
//4DfeederOut默认大料架
if (agv.Place.Equals(SettingString.RoomDFeederOut))
return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.BigShelf);
else if (agv.RFID.StartsWith("D"))
// if (agv.Place.Equals(SettingString.RoomDFeederOut))
// return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.BigShelf);
if (agv.RFID.StartsWith("D"))
return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.SmallShelf);
else if (agv.RFID.StartsWith("C"))
......
......@@ -178,7 +178,7 @@ namespace DeviceLibrary
if (RFID.StartsWith(SettingString.BigShelf_Prefix) && !FullShelfPlace.Equals(SettingString.RoomDFeederIn) && !FullShelfPlace.Equals(SettingString.RoomCFeederIn))
{
jobStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_BIG_SHELF_UNLOCK);
runInfo = "AGV到达 " + FullShelfPlace + ",并等待大料架解绑";
runInfo = "AGV到达 " + FullShelfPlace + ",并等待大料架移库操作";
msg += string.Format("[{0}] {1}", jobStep.CurStep(),runInfo);
jobStep.Msg = msg;
}
......@@ -200,7 +200,7 @@ namespace DeviceLibrary
System.Threading.Thread.Sleep(50);
if (HttpManager.GetRackBy(RFID, out string lineName) || (input != null && input[0]))
{
runInfo = "大料架在" + FullShelfPlace + "解绑完成[" + agv.BoxDestInfo + "]";
runInfo = "大料架在" + FullShelfPlace + "移库完成[" + agv.BoxDestInfo + "]";
agv.BoxDestInfo = "";
msg += string.Format("[{0}] {1}", jobStep.CurStep(),runInfo);
jobStep.Msg = msg;
......
......@@ -57,8 +57,8 @@ namespace DeviceLibrary
}
if (cnt < clientNode.EmptyShelfCnt)
{
if (AGVManager.CheckStationState(clientNode, out rfid) && CanEmptyTask(emptyJobCnt))
int i = AGVManager.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(nodeName));
if (i == -1 && AGVManager.CheckStationState(clientNode, out rfid) && CanEmptyTask(emptyJobCnt))
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName, rfid);
}
return null;
......
......@@ -473,7 +473,7 @@ namespace DeviceLibrary
if (idx > -1)
{
nodeName = nodeInfo[idx].Name;
log.Debug(agv.Name + " 双层线右侧需要料架,准备去4C-" + nodeName);
log.Debug(agv.Name + " 双层线右侧需要料架,准备去3C-" + nodeName);
return true;
}
}
......@@ -484,7 +484,7 @@ namespace DeviceLibrary
if (idx > -1)
{
nodeName = nodeInfo[idx].Name;
log.Debug(agv.Name + " 双层线右侧需要料架,准备去4D-" + nodeName);
log.Debug(agv.Name + " 双层线右侧需要料架,准备去3D-" + nodeName);
return true;
}
......@@ -496,7 +496,7 @@ namespace DeviceLibrary
if (!nearNodeName.Equals(""))
{
nodeName = nearNodeName;
log.Debug(agv.Name + " 双层线需要小料架,准备去4C-" + nearNodeName);
log.Debug(agv.Name + " 双层线需要小料架,准备去3C-" + nearNodeName);
return true;
}
......@@ -509,7 +509,7 @@ namespace DeviceLibrary
if (!nearNodeName.Equals(""))
{
nodeName = nearNodeName;
log.Debug(agv.Name + " 双层线需要小料架,准备去4D-" + nearNodeName);
log.Debug(agv.Name + " 双层线需要小料架,准备去3D-" + nearNodeName);
return true;
}
......
......@@ -82,12 +82,12 @@ namespace DeviceLibrary
if(rfid.Equals(""))
{
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
{
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
......@@ -97,7 +97,7 @@ namespace DeviceLibrary
}
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);
}
}
......@@ -120,8 +120,8 @@ namespace DeviceLibrary
Log.Debug(string.Format("Unlock Request(GET) [emptyStation={0},rfid={1}]", line, RFID.ToUpper()));
if (!AGVManager.unlockManager.AddMission(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=" + line + " rfid=" + RFID };
Log.Error(string.Format("添加空架任务失败 节点[{0}]RFID={1} 重复/RFID为空", value, RFID.ToUpper()));
res = new Result() { Succeed = false, ResultData = "true", ErrorMessage = "CreateEmptyRecycleTask failed due it has been created or rfid=null: emptyStation=" + line + " rfid=" + RFID };
}
else
{
......@@ -131,10 +131,9 @@ namespace DeviceLibrary
}
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.Info(string.Format("WebService GET Request emptyStation={0},rfid={1}", line, RFID));
return JsonHelper.SerializeObject(res);
}
}
......
文件属性发生变化
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!