Commit 0522a86d 几米阳光

修改日志打印

1 个父辈 f1e41247
...@@ -105,152 +105,259 @@ namespace OnlineStore.DeviceLibrary ...@@ -105,152 +105,259 @@ namespace OnlineStore.DeviceLibrary
List<WaitResultInfo> list = StoreMove.WaitList; List<WaitResultInfo> list = StoreMove.WaitList;
//当等待超过一分钟时,需要打印提示 //当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - StoreMove.LastSetpTime; TimeSpan span = DateTime.Now - StoreMove.LastSetpTime;
if (span.TotalMinutes > 5) string NotOkMsg = "";
if (list.Count <= 0)
{ {
WarnMsg = StoreName + "等待超时【" + StoreMove.MoveType + "】【" + StoreMove.MoveStep + "】已等待【" + Math.Round(span.TotalMinutes) + "】分钟,"; StoreMove.EndStepWait();
foreach (WaitResultInfo wait in list) return;
{ }
WarnMsg = WarnMsg + "\r\n" + wait.ToStr(); bool isOk = true;
} if (StoreMove.OneWaitCanEndStep)
LogUtil.error(LOGGER, WarnMsg, 12); {
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType); isOk = false;
} }
if (list.Count > 0) foreach (WaitResultInfo wait in list)
{ {
bool isOk = true; if (wait.IsEnd)
foreach (WaitResultInfo wait in list)
{ {
if (wait.WaitType == 1) continue;
{ }
string msg = ""; NotOkMsg = wait.ToStr();
if (wait.IsHomeMove) if (wait.WaitType == 1)
{ {
if (wait.IsEnd.Equals(false) && (!ACHomeMoveIsEnd(wait.AxisInfo, out msg))) string msg = "";
{ if (wait.IsHomeMove)
if (!msg.Equals("")) {
{ wait.IsEnd = ACHomeMoveIsEnd(wait.AxisInfo, out msg);
WarnMsg = msg; }
Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType); else
} {
isOk = false; wait.IsEnd = ACAxisMoveIsEnd(wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
break; }
} if (!msg.Equals(""))
else {
{ isOk = false;
wait.IsEnd = true; WarnMsg = msg;
} Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType);
} break;
else }
{ }
if (!wait.IsEnd) else if (wait.WaitType == 2)
{ {
bool isEnd = ACAxisMoveIsEnd(wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg); wait.IsEnd = KNDIOValue(wait.IoType).Equals(wait.IoValue);
if (!msg.Equals("")) int timeOutMs = Config.IOSingle_TimerOut;
{ if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
isOk = false; {
WarnMsg = msg; ConfigIO io = Config.getWaitIO(wait.IoType);
Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType); WarnMsg = StoreName + " 等待信号" + io.DisplayStr + "=" + wait.IoValue + "超时!";
break; Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, StoreMove.MoveType);
} LogUtil.error(LOGGER, StoreName + wait.IoType + "等待信号(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", 14);
else if (!isEnd) isOk = false;
{ break;
isOk = false; }
break; }
} else if (wait.WaitType == 3)
else {
{ wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
wait.IsEnd = true;
}
}
else
{
}
}
}
else if (wait.WaitType == 2)
{
if (!KNDIOValue(wait.IoType).Equals(wait.IoValue))
{
//一分钟还未检测到
if (span.TotalMilliseconds > Config.IOSingle_TimerOut)
{
ConfigIO io = Config.getWaitIO(wait.IoType);
WarnMsg = StoreName + " 等待信号" + io.DisplayStr + "=" + wait.IoValue + "超时!";
//SendAlarmCode(StoreID, LineAlarm.IoNotOk, wait.IoType);
Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, StoreMove.MoveType);
LogUtil.error(LOGGER, StoreName + wait.IoType + "等待信号(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", 14);
}
isOk = false;
if (StoreMove.OneWaitCanEndStep.Equals(false))
{
break;
}
}
else if (StoreMove.OneWaitCanEndStep)
{
isOk = true;
break;
}
}
else if (wait.WaitType == 3)
{
if (span.TotalMilliseconds < wait.TimeMSeconds)
{
isOk = false;
if (StoreMove.OneWaitCanEndStep.Equals(false))
{
break;
}
}
else if (StoreMove.OneWaitCanEndStep)
{
isOk = true;
break;
}
}
else if (wait.WaitType == 5)
{
if (wait.IsHomeMove)
{
if (!ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime))
{
ShuoKeControls.GetStatus(wait.SlvAddr);
isOk = false;
break;
}
else if (StoreMove.OneWaitCanEndStep)
{
isOk = true; break;
}
}
else
{
if (!ShuoKeControls.IsMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime))
{
ShuoKeControls.GetStatus(wait.SlvAddr);
isOk = false;
break;
}
else if (StoreMove.OneWaitCanEndStep)
{
isOk = true; break;
}
}
}
} }
if (isOk) else if (wait.WaitType == 5)
{ {
StoreMove.EndStepWait(); if (wait.IsHomeMove)
{
wait.IsEnd = ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime);
}
else
{
wait.IsEnd = ShuoKeControls.IsMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime);
}
if (!wait.IsEnd)
{
ShuoKeControls.GetStatus(wait.SlvAddr);
}
}
if (wait.IsEnd)
{
if (StoreMove.OneWaitCanEndStep)
{
isOk = true;
break;
}
}
else
{
if (!StoreMove.OneWaitCanEndStep)
{
isOk = false;
break;
}
} }
} }
else if (isOk)
{ {
StoreMove.EndStepWait(); StoreMove.EndStepWait();
} }
else if (span.TotalSeconds > 120)
{
WarnMsg = StoreName + "【" + StoreMove.MoveType + "】【" + StoreMove.MoveStep + "】等待超时 [" + NotOkMsg
+ "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(LOGGER, WarnMsg);
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType);
}
} }
//private void CheckWait()
//{
// List<WaitResultInfo> list = StoreMove.WaitList;
// //当等待超过一分钟时,需要打印提示
// TimeSpan span = DateTime.Now - StoreMove.LastSetpTime;
// if (span.TotalMinutes > 5)
// {
// WarnMsg = StoreName + "等待超时【" + StoreMove.MoveType + "】【" + StoreMove.MoveStep + "】已等待【" + Math.Round(span.TotalMinutes) + "】分钟,";
// foreach (WaitResultInfo wait in list)
// {
// WarnMsg = WarnMsg + "\r\n" + wait.ToStr();
// }
// LogUtil.error(LOGGER, WarnMsg, 12);
// Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType);
// }
// if (list.Count > 0)
// {
// bool isOk = true;
// foreach (WaitResultInfo wait in list)
// {
// if (wait.WaitType == 1)
// {
// string msg = "";
// if (wait.IsHomeMove)
// {
// if (wait.IsEnd.Equals(false) && (!ACHomeMoveIsEnd(wait.AxisInfo, out msg)))
// {
// if (!msg.Equals(""))
// {
// WarnMsg = msg;
// Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType);
// }
// isOk = false;
// break;
// }
// else
// {
// wait.IsEnd = true;
// }
// }
// else
// {
// if (!wait.IsEnd)
// {
// bool isEnd = ACAxisMoveIsEnd(wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
// if (!msg.Equals(""))
// {
// isOk = false;
// WarnMsg = msg;
// Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType);
// break;
// }
// else if (!isEnd)
// {
// isOk = false;
// break;
// }
// else
// {
// wait.IsEnd = true;
// }
// }
// else
// {
// }
// }
// }
// else if (wait.WaitType == 2)
// {
// if (!KNDIOValue(wait.IoType).Equals(wait.IoValue))
// {
// //一分钟还未检测到
// if (span.TotalMilliseconds > Config.IOSingle_TimerOut)
// {
// ConfigIO io = Config.getWaitIO(wait.IoType);
// WarnMsg = StoreName + " 等待信号" + io.DisplayStr + "=" + wait.IoValue + "超时!";
// //SendAlarmCode(StoreID, LineAlarm.IoNotOk, wait.IoType);
// Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, StoreMove.MoveType);
// LogUtil.error(LOGGER, StoreName + wait.IoType + "等待信号(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", 14);
// }
// isOk = false;
// if (StoreMove.OneWaitCanEndStep.Equals(false))
// {
// break;
// }
// }
// else if (StoreMove.OneWaitCanEndStep)
// {
// isOk = true;
// break;
// }
// }
// else if (wait.WaitType == 3)
// {
// if (span.TotalMilliseconds < wait.TimeMSeconds)
// {
// isOk = false;
// if (StoreMove.OneWaitCanEndStep.Equals(false))
// {
// break;
// }
// }
// else if (StoreMove.OneWaitCanEndStep)
// {
// isOk = true;
// break;
// }
// }
// else if (wait.WaitType == 5)
// {
// if (wait.IsHomeMove)
// {
// if (!ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime))
// {
// ShuoKeControls.GetStatus(wait.SlvAddr);
// isOk = false;
// break;
// }
// else if (StoreMove.OneWaitCanEndStep)
// {
// isOk = true; break;
// }
// }
// else
// {
// if (!ShuoKeControls.IsMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime))
// {
// ShuoKeControls.GetStatus(wait.SlvAddr);
// isOk = false;
// break;
// }
// else if (StoreMove.OneWaitCanEndStep)
// {
// isOk = true; break;
// }
// }
// }
// }
// if (isOk)
// {
// StoreMove.EndStepWait();
// }
// }
// else
// {
// StoreMove.EndStepWait();
// }
//}
#endregion #endregion
#region 入库 #region 入库
......
...@@ -263,8 +263,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -263,8 +263,8 @@ namespace OnlineStore.DeviceLibrary
{ {
moveAxis.TargetPosition = targetPosition; moveAxis.TargetPosition = targetPosition;
AddAxisMoveTime(moveAxis); AddAxisMoveTime(moveAxis);
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition,targetSpeed);
StoreMove.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, targetPosition, targetSpeed)); StoreMove.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, targetPosition, targetSpeed));
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
} }
/// <summary> /// <summary>
......
...@@ -234,11 +234,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -234,11 +234,11 @@ namespace OnlineStore.DeviceLibrary
{ {
if (IsHomeMove) if (IsHomeMove)
{ {
return "轴【" + AxisInfo.DisplayStr + "】原点返回"; return "轴【" + AxisInfo.DisplayStr + "】原点返回";
} }
else else
{ {
return "轴【" + AxisInfo.DisplayStr + "】绝对运动,目标位置【" + TargetPosition + "】"; return "轴【" + AxisInfo.DisplayStr + "】绝对运动【" + TargetPosition + "】";
} }
} }
else if (WaitType == 2) else if (WaitType == 2)
...@@ -259,8 +259,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -259,8 +259,9 @@ namespace OnlineStore.DeviceLibrary
} }
else if (WaitType == 6) else if (WaitType == 6)
{ {
return "轴【" + AxisInfo.DisplayStr + "】ORG信号:【" + IoValue + "】 "; return "轴【" + AxisInfo.DisplayStr + "】ORG信号:【" + IoValue + "】 ";
} }
else
{ {
return "Wait位置类型:WaitType=【" + WaitType + "】"; return "Wait位置类型:WaitType=【" + WaitType + "】";
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!