Commit ec01efbe 张东亮

添加拒绝包装料架解绑

1 个父辈 85bff5cf
...@@ -10,44 +10,6 @@ using RestSharp; ...@@ -10,44 +10,6 @@ using RestSharp;
namespace AGVControl namespace AGVControl
{ {
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);
}
}
public class AGVManager public class AGVManager
{ {
private static string Addr_CurSO = "/rest/api/qisda/device/currentOutLine"; private static string Addr_CurSO = "/rest/api/qisda/device/currentOutLine";
......
...@@ -98,7 +98,6 @@ namespace AGVControl ...@@ -98,7 +98,6 @@ namespace AGVControl
public static ChargeStatus chargeStatus; public static ChargeStatus chargeStatus;
public static string itsHttp; public static string itsHttp;
public static log4net.ILog log; public static log4net.ILog log;
public static log4net.ILog runLog;
public static Dictionary<string, string> agvMission; public static Dictionary<string, string> agvMission;
public static Dictionary<string, string> showNameMissionName; public static Dictionary<string, string> showNameMissionName;
//public static Dictionary<string, string> agvProductionLine; //public static Dictionary<string, string> agvProductionLine;
...@@ -110,7 +109,10 @@ namespace AGVControl ...@@ -110,7 +109,10 @@ namespace AGVControl
private static string preLog = ""; private static string preLog = "";
public static readonly string CONFIG_PATH = AppDomain.CurrentDomain.BaseDirectory + "Config\\"; public static readonly string CONFIG_PATH = AppDomain.CurrentDomain.BaseDirectory + "Config\\";
#region 任务日志
static log4net.ILog runLog = log4net.LogManager.GetLogger("RunLog");
static Dictionary<string, RunInfo> runInfoMap = new Dictionary<string, RunInfo>(); static Dictionary<string, RunInfo> runInfoMap = new Dictionary<string, RunInfo>();
public static void RunLogInfo(RunInfo info) public static void RunLogInfo(RunInfo info)
{ {
if (runInfoMap == null) if (runInfoMap == null)
...@@ -128,6 +130,12 @@ namespace AGVControl ...@@ -128,6 +130,12 @@ namespace AGVControl
runLog.Info(info.ToString()); runLog.Info(info.ToString());
} }
} }
public static void ErrorLogRecord(ErrorInfo errorInfo)
{
runLog.Info(errorInfo.ToString());
}
#endregion
public static string ReadIni(string section, string key) public static string ReadIni(string section, string key)
{ {
return IniHelper.ReadValue(section, key, CONFIG_PATH + SettingString.FileName_tempData); return IniHelper.ReadValue(section, key, CONFIG_PATH + SettingString.FileName_tempData);
...@@ -1263,7 +1271,139 @@ namespace AGVControl ...@@ -1263,7 +1271,139 @@ namespace AGVControl
} }
} }
public class RunInfo
{
/// <summary>
/// AGV编号
/// </summary>
public string AGVNum { get; set; } = "";
/// <summary>
/// 任务名称
/// </summary>
public string TaskName { get; set; } = "";
/// <summary>
/// 目的地
/// </summary>
public string TargetPlace { get; set; } = "";
/// <summary>
/// 任务步骤
/// </summary>
public string TaskStep { get; set; } = "";
/// <summary>
/// 任务内容
/// </summary>
public string MissionInfo { get; set; } = "";
/// <summary>
/// 开始时间
/// </summary>
public string DateTime { get; set; } = "";
/// <summary>
/// 结束时间
/// </summary>
public string EndDateTime { get; set; } = "";
/// <summary>
/// 任务运行时长
/// </summary>
public string TaskRunTime { get; set; } = "";
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; } = "Task";
public RunInfo(string AGVNum, string taskName, string targetPlace, string taskStep, string missionInfo, DateTime startTime)
{
//开始时间 2006-01-02 15:04:05
DateTime = startTime.ToString("yyyy-MM-dd HH:mm:ss");
EndDateTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
this.AGVNum = AGVNum;
MissionInfo = missionInfo;
TaskName = taskName;
TaskRunTime = (System.DateTime.Now - startTime).TotalMinutes.ToString("f2");
TargetPlace = targetPlace;
TaskStep = taskStep;
}
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);
}
}
public class ErrorInfo
{
/// <summary>
/// AGV编号
/// </summary>
public string AGVNum
{
get { return agvname; }
set {
agvname = value.PadLeft(4, '0');
}
}
private string agvname = "";
/// <summary>
/// 开始时间
/// </summary>
public string DateTime { get; set; } = "";
/// <summary>
/// 结束时间
/// </summary>
public string EndDateTime { get; set; } = "";
/// <summary>
/// 异常信息
/// </summary>
public string ErrorMsg { get; set; } = "";
public string ErrorLastTime { get; set; } = "";
/// <summary>
/// 任务名称
/// </summary>
public string TaskName { get; set; } = "";
/// <summary>
/// AGV的当前任务
/// </summary>
public string AGVMissionName { get; set; } = "";
public string MissionInfo { get; set; } = "";
/// <summary>
/// 目的地
/// </summary>
public string TargetPlace { get; set; } = "";
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; } = "Error";
public ErrorInfo(Agv_Info agv)
{
DateTime = agv.errStartTime.ToString("yyyy-MM-dd HH:mm:ss");
AGVNum = agv.Name;
EndDateTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
ErrorMsg = agv.ErrorMsg;
ErrorLastTime = (System.DateTime.Now - agv.errStartTime).TotalMinutes.ToString("f2");
if (agv.CurJob != null)
{
TaskName = agv.CurJob.JobName;
MissionInfo = agv.CurJob.runInfo;
}
AGVMissionName = agv.CurTaskName;
TargetPlace = agv.Place;
}
public override string ToString()
{
return JsonHelper.SerializeObject(this);
}
}
public static class API public static class API
{ {
[DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)] [DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)]
......
...@@ -19,7 +19,7 @@ namespace AGVControl.BLL ...@@ -19,7 +19,7 @@ namespace AGVControl.BLL
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;
private System.Timers.Timer StateUpdateTimer; //private System.Timers.Timer StateUpdateTimer;
//public List<string> Marks; //public List<string> Marks;
private const int REG_STATUS = 20; private const int REG_STATUS = 20;
//private List<string> shelfLockedNodeNames; //private List<string> shelfLockedNodeNames;
...@@ -51,13 +51,13 @@ namespace AGVControl.BLL ...@@ -51,13 +51,13 @@ namespace AGVControl.BLL
Enabled = false Enabled = false
}; };
NodeStateTimer.Elapsed += NodeStateTimer_Elapsed; NodeStateTimer.Elapsed += NodeStateTimer_Elapsed;
StateUpdateTimer = new System.Timers.Timer //StateUpdateTimer = new System.Timers.Timer
{ //{
Interval = 3000, // Interval = 3000,
AutoReset = true, // AutoReset = true,
Enabled = false // Enabled = false
}; //};
StateUpdateTimer.Elapsed += StateUpdateTimer_Elapsed; //StateUpdateTimer.Elapsed += StateUpdateTimer_Elapsed;
} }
public void Start() public void Start()
...@@ -65,11 +65,11 @@ namespace AGVControl.BLL ...@@ -65,11 +65,11 @@ namespace AGVControl.BLL
AgvCallTimer.Enabled = true; AgvCallTimer.Enabled = true;
AgvStateTimer.Enabled = true; AgvStateTimer.Enabled = true;
NodeStateTimer.Enabled = true; NodeStateTimer.Enabled = true;
StateUpdateTimer.Enabled = true; //StateUpdateTimer.Enabled = true;
AgvCallTimer.Start(); AgvCallTimer.Start();
AgvStateTimer.Start(); AgvStateTimer.Start();
NodeStateTimer.Start(); NodeStateTimer.Start();
StateUpdateTimer.Start(); //StateUpdateTimer.Start();
} }
public void Stop() public void Stop()
...@@ -77,11 +77,11 @@ namespace AGVControl.BLL ...@@ -77,11 +77,11 @@ namespace AGVControl.BLL
AgvCallTimer.Enabled = false; AgvCallTimer.Enabled = false;
AgvStateTimer.Enabled = false; AgvStateTimer.Enabled = false;
NodeStateTimer.Enabled = false; NodeStateTimer.Enabled = false;
StateUpdateTimer.Enabled = false; //StateUpdateTimer.Enabled = false;
AgvCallTimer.Stop(); AgvCallTimer.Stop();
AgvStateTimer.Stop(); AgvStateTimer.Stop();
NodeStateTimer.Stop(); NodeStateTimer.Stop();
StateUpdateTimer.Stop(); // StateUpdateTimer.Stop();
} }
private bool NodeStateInProcess = false; private bool NodeStateInProcess = false;
private void NodeStateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private void NodeStateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
...@@ -178,62 +178,6 @@ namespace AGVControl.BLL ...@@ -178,62 +178,6 @@ namespace AGVControl.BLL
private bool AgvStateUpdateProcess = false; private bool AgvStateUpdateProcess = false;
private void StateUpdateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) 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 && !Common.agvInfo[i].IsUse)
{
isAlarm = true;
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".Msg", "停用"));
}
if (!isAlarm && !Common.agvInfo[i].IsCon)
{
isAlarm = true;
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".Msg", "离线"));
}
if (!isAlarm && (Common.agvInfo[i].StateID.Equals(eAGVState.Error) || Common.agvInfo[i].StateID.Equals(eAGVState.EmergencyStop) || Common.agvInfo[i].StateID.Equals(eAGVState.Pause)))
{
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 + ".Msg", "在" + Common.agvInfo[i].PlaceAliceName + "停留超时" + (DateTime.Now - Common.agvInfo[i].StandStartTime).TotalMinutes.ToString("f2") + "分钟"));
}
if (!isAlarm)
{
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));
Common.RunLogInfo(new AGVControl.RunInfo(Common.agvInfo[i].Name, Common.agvInfo[i].Msg));
}
else
{
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));
}
}
}
AGVManager.updateDeviceAlarmMsg(msglist);
}
catch (Exception ex)
{
Common.log.Error(Common.agvInfo[i].Name + "上报小车状态失败" + ex.Message + ex.StackTrace);
}
}
AgvStateUpdateProcess = false;
} }
/// <summary> /// <summary>
/// 从节点获取任务 /// 从节点获取任务
......
...@@ -75,6 +75,11 @@ namespace BLL ...@@ -75,6 +75,11 @@ namespace BLL
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "rfid=null" }; res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "rfid=null" };
Log.Error(string.Format("Unlock Request(POST) Failed [emptyStation={0},rfid=null]", emptyStation)); Log.Error(string.Format("Unlock Request(POST) Failed [emptyStation={0},rfid=null]", emptyStation));
} }
else if (rfid.StartsWith("A"))
{
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = $"rfid={rfid} can not be unlock" };
Log.Error(string.Format("Unlock Request(POST) Failed [emptyStation={0},rfid=null]", emptyStation));
}
else else
{ {
res = new Result() { Succeed = true, ResultData = rfid, ErrorMessage = "" }; res = new Result() { Succeed = true, ResultData = rfid, ErrorMessage = "" };
...@@ -110,10 +115,14 @@ namespace BLL ...@@ -110,10 +115,14 @@ namespace BLL
} }
if (Common.GetNodeNameByLineName(line, out string value)) if (Common.GetNodeNameByLineName(line, out string value))
{ {
if (RFID.StartsWith("A"))
if (!Common.missionManager.AddMission(value,RFID.ToUpper())) {
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = $"rfid={RFID} can not be unlock" };
Log.Error(string.Format("Unlock Request(POST) Failed [emptyStation={0},rfid={1}]", line,RFID));
}
else if (!Common.missionManager.AddMission(value, RFID.ToUpper()))
{ {
res = new Result() { Succeed = false, ResultData = "true", ErrorMessage = "CreateEmptyRecycleTask failed due it has been created or rfid=null: " + line +"rfid="+ RFID.ToUpper() }; res = new Result() { Succeed = false, ResultData = "true", ErrorMessage = "CreateEmptyRecycleTask failed due it has been created or rfid=null: " + line + "rfid=" + RFID.ToUpper() };
} }
else else
{ {
......
...@@ -451,7 +451,7 @@ namespace AGVControl ...@@ -451,7 +451,7 @@ namespace AGVControl
} }
if (MessageBox.Show("确定删除产线任务[" + cmbBoxLineName.SelectedItem.ToString() + "]", "手动删除解绑任务", MessageBoxButtons.YesNo) == DialogResult.No) if (MessageBox.Show("确定删除产线任务[" + cmbBoxLineName.SelectedItem.ToString() + "]", "手动删除解绑任务", MessageBoxButtons.YesNo) == DialogResult.No)
return; return;
if (txtRfid.Text.ToUpper().StartsWith("D") || txtRfid.Text.ToUpper().StartsWith("C")) // if (txtRfid.Text.ToUpper().StartsWith("D") || txtRfid.Text.ToUpper().StartsWith("C"))
{ {
int idx = Common.nodeInfo.FindIndex(s => s.AliceName.Equals(cmbBoxLineName.SelectedItem.ToString())); int idx = Common.nodeInfo.FindIndex(s => s.AliceName.Equals(cmbBoxLineName.SelectedItem.ToString()));
if (idx > -1) if (idx > -1)
......
...@@ -43,7 +43,6 @@ namespace AGVControl ...@@ -43,7 +43,6 @@ namespace AGVControl
//Common.logTextBox = new TextBox(); //Common.logTextBox = new TextBox();
//Common.missionView = new DataGridView(); //Common.missionView = new DataGridView();
Common.log = log4net.LogManager.GetLogger("AgvServer"); Common.log = log4net.LogManager.GetLogger("AgvServer");
Common.runLog = log4net.LogManager.GetLogger("RunLog");
Common.log.Info("=====程序开始====="); Common.log.Info("=====程序开始=====");
ReadConfig(); ReadConfig();
Common.ReadUnlockLineInfo(); Common.ReadUnlockLineInfo();
......
...@@ -131,6 +131,29 @@ namespace AGVControl ...@@ -131,6 +131,29 @@ namespace AGVControl
/// </summary> /// </summary>
public string BoxDestInfo { get; set; } = ""; public string BoxDestInfo { get; set; } = "";
/// <summary>
/// 错误消息
/// </summary>
public string ErrorMsg { get; set; } = "";
public string ErrorLastTime { get; set; } = "";
/// <summary>
/// 任务期间是否有错误
/// </summary>
public bool HasError { get; set; } = false;
public void SetErrorMsg(string msg, string lastTime)
{
if (ErrorMsg.Equals(""))
{
ErrorMsg = msg;
ErrorLastTime = lastTime;
errStartTime = DateTime.Now;
}
}
public void ClearErrorMsg()
{
ErrorLastTime = "";
ErrorMsg = "";
}
public string RunInfo() public string RunInfo()
{ {
string curJobTaskName = ""; string curJobTaskName = "";
...@@ -263,6 +286,7 @@ namespace AGVControl ...@@ -263,6 +286,7 @@ namespace AGVControl
int IoLastTime = 5000; int IoLastTime = 5000;
int StandLastTimeMinute = 5; int StandLastTimeMinute = 5;
public DateTime StandStartTime = DateTime.MaxValue; public DateTime StandStartTime = DateTime.MaxValue;
public DateTime errStartTime = DateTime.Now;
public bool SetState(eAGVState stateID, string stateText, int battery, string missionText, clsPosition position) public bool SetState(eAGVState stateID, string stateText, int battery, string missionText, clsPosition position)
{ {
bool isChange = false; bool isChange = false;
...@@ -305,18 +329,48 @@ namespace AGVControl ...@@ -305,18 +329,48 @@ namespace AGVControl
CurTaskState = stateText; CurTaskState = stateText;
Battery = battery; Battery = battery;
MissionText = missionText; MissionText = missionText;
CheckErrorState();
CheckOfflineTimeOut();
CheckStandTimeOut(position); CheckStandTimeOut(position);
UpdateDisplayBoard();
return isChange; return isChange;
} }
DateTime agvErrorStartTime = DateTime.MaxValue;
DateTime offlineStartTime = DateTime.MaxValue;
bool errorState = false;
int OfflineLastTimeSeconds = 30;
/// <summary>
/// 检查小车是否报错
/// </summary>
/// <returns></returns>
private void CheckErrorState()
{
if (StateID.Equals(eAGVState.Error) || StateID.Equals(eAGVState.EmergencyStop) || StateID.Equals(eAGVState.Pause))
{
//满足条件,计算持续时间
if (agvErrorStartTime == DateTime.MaxValue)
{
agvErrorStartTime = DateTime.Now;
}
TimeSpan lastTimeSpan = DateTime.Now - agvErrorStartTime;
errorState = (lastTimeSpan.TotalSeconds >= OfflineLastTimeSeconds);
}
else
{
errorState = false;
if ((DateTime.Now - agvErrorStartTime).TotalSeconds > OfflineLastTimeSeconds)
agvErrorStartTime = DateTime.Now;
}
}
/// <summary> /// <summary>
/// 检查小车是否在原地停留超时 /// 检查小车是否在原地停留超时
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private void CheckStandTimeOut(clsPosition position) private void CheckStandTimeOut(clsPosition position)
{ {
if (IsUse && CurJob !=null && !(CurJob is ChargeJob) && if (IsUse && CurJob != null && !(CurJob is ChargeJob) &&
( !CurTaskName.Contains(SettingString.Standby)))//!CurTaskName.Contains(SettingString.AutoCharge) || (!CurTaskName.Contains(SettingString.Standby)))//!CurTaskName.Contains(SettingString.AutoCharge) ||
{ {
if (Math.Abs(position.x - Position.x) < 1 && Math.Abs(position.y - Position.y) < 1) if (Math.Abs(position.x - Position.x) < 1 && Math.Abs(position.y - Position.y) < 1)
{ {
...@@ -336,7 +390,7 @@ namespace AGVControl ...@@ -336,7 +390,7 @@ namespace AGVControl
} }
} }
else if(CurJob != null && (CurJob is ChargeJob)) else if (CurJob != null && (CurJob is ChargeJob))
{ {
StandTimeOut = false; StandTimeOut = false;
StandStartTime = DateTime.Now; StandStartTime = DateTime.Now;
...@@ -348,6 +402,98 @@ namespace AGVControl ...@@ -348,6 +402,98 @@ namespace AGVControl
} }
Position = position; Position = position;
} }
/// <summary>
/// 离线超时
/// </summary>
private bool offlineTimeOut = false;
/// <summary>
/// 检查小车是否离线超时
/// </summary>
/// <returns></returns>
private void CheckOfflineTimeOut()
{
if (CurJob != null && !(CurJob is ChargeJob) && !IsCon)
{
//满足条件,计算持续时间
if (offlineStartTime == DateTime.MaxValue)
{
offlineStartTime = DateTime.Now;
}
TimeSpan lastTimeSpan = DateTime.Now - offlineStartTime;
offlineTimeOut = (lastTimeSpan.TotalSeconds >= OfflineLastTimeSeconds);
}
else
{
offlineTimeOut = false;
if ((DateTime.Now - offlineStartTime).TotalSeconds > OfflineLastTimeSeconds)
//LogUtil.error(string.Format("{0} 在{1}离线{2}秒", Name, PlaceAliceName, (DateTime.Now - offlineStartTime).TotalSeconds.ToString("f2")));
offlineStartTime = DateTime.Now;
}
}
private void UpdateDisplayBoard()
{
bool isAlarm = false;
List<AlarmMsg> msglist = new List<AlarmMsg>();
try
{
if (!IsCon && !IsUse)
{
isAlarm = true;
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Msg", "停用"));
}
if (!isAlarm && offlineTimeOut)
{
isAlarm = true;
SetErrorMsg("离线", (DateTime.Now - offlineStartTime).TotalMinutes.ToString("f2"));
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Msg", "离线"));
}
if (!isAlarm && errorState)
{
isAlarm = true;
SetErrorMsg("状态:"+StateID.ToString(), (DateTime.Now - errStartTime).TotalMinutes.ToString("f2"));
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Msg", StateID.ToString()));
}
if (!isAlarm && StandTimeOut)
{
isAlarm = true;
SetErrorMsg("在" + PlaceAliceName + "停留超时", (DateTime.Now - StandStartTime).TotalMinutes.ToString("f2"));
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Msg", "在" + PlaceAliceName + "停留超时" + (DateTime.Now - StandStartTime).TotalMinutes.ToString("f2") + "分钟"));
}
if (!isAlarm && HasError)
{
isAlarm = true;
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Msg", Msg));
}
if (!isAlarm)
{
if (!ErrorMsg.Equals(""))//异常消除后正常,打印异常
{
Common.ErrorLogRecord(new ErrorInfo(this));
ClearErrorMsg();
}
if (!Msg.Equals(""))
{
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Msg", Msg, 1));
}
else
{
if ((Place.Contains(SettingString.AutoCharge) || Place.Contains(SettingString.Standby)))
{
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Place", Place, 1));
}
}
}
AGVManager.updateDeviceAlarmMsg(msglist);
}
catch (Exception ex)
{
Common.log.Error(Name + "上报小车信息失败" + ex.Message + ex.StackTrace);
}
}
public string[] ToRow() public string[] ToRow()
{ {
......
...@@ -15,6 +15,7 @@ namespace AGVControl ...@@ -15,6 +15,7 @@ namespace AGVControl
/// 运行信息 /// 运行信息
/// </summary> /// </summary>
public abstract string RunInfo { get; } public abstract string RunInfo { get; }
public string runInfo = "";
/// <summary> /// <summary>
/// 根据任务状态继续执行任务 /// 根据任务状态继续执行任务
/// </summary> /// </summary>
...@@ -30,7 +31,18 @@ namespace AGVControl ...@@ -30,7 +31,18 @@ namespace AGVControl
/// 当前任务的执行状态 /// 当前任务的执行状态
/// </summary> /// </summary>
public string CurTaskState { get; set; } = "Wait"; public string CurTaskState { get; set; } = "Wait";
/// <summary>
/// Job开始时间
/// </summary>
public DateTime StartJobTime { get; set; } = DateTime.Now;
/// <summary>
/// Job名称
/// </summary>
public string JobName { get; set; } = "";
protected void RecordRunLog(Agv_Info agv, string JobStep, string runInfo, string targetPlace)
{
Common.RunLogInfo(new RunInfo(agv.Name.PadLeft(4, '0'), JobName, targetPlace, JobStep, runInfo, StartJobTime));
}
/// <summary> /// <summary>
/// 更新任务信息 /// 更新任务信息
/// </summary> /// </summary>
......
...@@ -22,7 +22,7 @@ namespace AGVControl ...@@ -22,7 +22,7 @@ namespace AGVControl
//不为空,且与上一个消息不一样才打印 //不为空,且与上一个消息不一样才打印
if (!value.Equals(msg)) if (!value.Equals(msg))
{ {
Common.LogInfo(value); // Common.LogInfo(value);
} }
} }
msg = value; msg = value;
...@@ -53,13 +53,12 @@ namespace AGVControl ...@@ -53,13 +53,12 @@ namespace AGVControl
/// </summary> /// </summary>
/// <param name="timeOutMilliseconds"></param> /// <param name="timeOutMilliseconds"></param>
/// <returns></returns> /// <returns></returns>
public bool IsTimeOut(int timeOutMilliseconds,out double timeOutValue) public bool IsTimeOut(int timeOutMilliseconds,out TimeSpan timeOutValue)
{ {
timeOutValue = 0;
TimeSpan span = DateTime.Now - startTime; TimeSpan span = DateTime.Now - startTime;
timeOutValue = span;
if (span.TotalMilliseconds > timeOutMilliseconds) if (span.TotalMilliseconds > timeOutMilliseconds)
{ {
timeOutValue = span.TotalSeconds;
return true; return true;
} }
return false; return false;
......
...@@ -53,7 +53,6 @@ namespace AGVControl ...@@ -53,7 +53,6 @@ namespace AGVControl
public eEnterLeaveType ActionType { get; set; } public eEnterLeaveType ActionType { get; set; }
private eShelfType shelfType; private eShelfType shelfType;
private string runInfo = "";
/// <summary> /// <summary>
/// 运行信息 /// 运行信息
/// </summary> /// </summary>
...@@ -114,7 +113,7 @@ namespace AGVControl ...@@ -114,7 +113,7 @@ namespace AGVControl
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Leave"]); rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Leave"]);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID); UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
} }
else if (EnterLeaveShelfStep.IsTimeOut(15000, out double timeOutValue)) else if (EnterLeaveShelfStep.IsTimeOut(15000, out TimeSpan timeOutValue))
{ {
EnterLeaveShelfStep.ToNextStep(ENTER_LEAVE_SHELF_STEP.NONE); EnterLeaveShelfStep.ToNextStep(ENTER_LEAVE_SHELF_STEP.NONE);
runInfo = "AGV到达 " + LineName + ",15秒后重新向产线发送入料架请求[ReadyEnter]"; runInfo = "AGV到达 " + LineName + ",15秒后重新向产线发送入料架请求[ReadyEnter]";
...@@ -135,7 +134,7 @@ namespace AGVControl ...@@ -135,7 +134,7 @@ namespace AGVControl
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Enter"]); rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Enter"]);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID); UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
} }
else if (EnterLeaveShelfStep.IsTimeOut(15000, out double timeOutValue)) else if (EnterLeaveShelfStep.IsTimeOut(15000, out TimeSpan timeOutValue))
{ {
EnterLeaveShelfStep.ToNextStep(ENTER_LEAVE_SHELF_STEP.NONE); EnterLeaveShelfStep.ToNextStep(ENTER_LEAVE_SHELF_STEP.NONE);
runInfo= "AGV到达 " + LineName + ",15秒后重新向产线发送入料架请求[ReadyLeave]"; runInfo= "AGV到达 " + LineName + ",15秒后重新向产线发送入料架请求[ReadyLeave]";
...@@ -157,7 +156,7 @@ namespace AGVControl ...@@ -157,7 +156,7 @@ namespace AGVControl
return new EmptyAGVBackJob(LineName); return new EmptyAGVBackJob(LineName);
} }
else if (EnterLeaveShelfStep.IsTimeOut(60000, out double timeOutValue)) else if (EnterLeaveShelfStep.IsTimeOut(60000, out TimeSpan timeOutValue))
{ {
//链条停止 //链条停止
runInfo= "料架在[" + LineName + "]离开小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架离开小车的情况"; runInfo= "料架在[" + LineName + "]离开小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架离开小车的情况";
...@@ -179,7 +178,7 @@ namespace AGVControl ...@@ -179,7 +178,7 @@ namespace AGVControl
Common.missionManager.DelMission(LineName,RFID); Common.missionManager.DelMission(LineName,RFID);
return new EmptyShelfBackJob(LineName,eShelfType.BigShelf); return new EmptyShelfBackJob(LineName,eShelfType.BigShelf);
} }
else if (EnterLeaveShelfStep.IsTimeOut(60000, out double timeOutValue)) else if (EnterLeaveShelfStep.IsTimeOut(60000, out TimeSpan timeOutValue))
{ {
//链条停止 //链条停止
runInfo= "料架在[" + LineName + "]进入小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架进入小车的情况"; runInfo= "料架在[" + LineName + "]进入小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架进入小车的情况";
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!