Commit 0522a86d 几米阳光

修改日志打印

1 个父辈 f1e41247
...@@ -105,46 +105,35 @@ namespace OnlineStore.DeviceLibrary ...@@ -105,46 +105,35 @@ 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();
}
LogUtil.error(LOGGER, WarnMsg, 12);
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType);
} }
if (list.Count > 0)
{
bool isOk = true; bool isOk = true;
if (StoreMove.OneWaitCanEndStep)
{
isOk = false;
}
foreach (WaitResultInfo wait in list) foreach (WaitResultInfo wait in list)
{ {
if (wait.IsEnd)
{
continue;
}
NotOkMsg = wait.ToStr();
if (wait.WaitType == 1) if (wait.WaitType == 1)
{ {
string msg = ""; string msg = "";
if (wait.IsHomeMove) if (wait.IsHomeMove)
{ {
if (wait.IsEnd.Equals(false) && (!ACHomeMoveIsEnd(wait.AxisInfo, out msg))) wait.IsEnd = ACHomeMoveIsEnd(wait.AxisInfo, out msg);
{
if (!msg.Equals(""))
{
WarnMsg = msg;
Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType);
}
isOk = false;
break;
} }
else else
{ {
wait.IsEnd = true; wait.IsEnd = ACAxisMoveIsEnd(wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
} }
}
else
{
if (!wait.IsEnd)
{
bool isEnd = ACAxisMoveIsEnd(wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
if (!msg.Equals("")) if (!msg.Equals(""))
{ {
isOk = false; isOk = false;
...@@ -152,105 +141,223 @@ namespace OnlineStore.DeviceLibrary ...@@ -152,105 +141,223 @@ namespace OnlineStore.DeviceLibrary
Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType); Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType);
break; break;
} }
else if (!isEnd)
{
isOk = false;
break;
}
else
{
wait.IsEnd = true;
}
}
else
{
}
}
} }
else if (wait.WaitType == 2) else if (wait.WaitType == 2)
{ {
if (!KNDIOValue(wait.IoType).Equals(wait.IoValue)) wait.IsEnd = KNDIOValue(wait.IoType).Equals(wait.IoValue);
{ int timeOutMs = Config.IOSingle_TimerOut;
//一分钟还未检测到 if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
if (span.TotalMilliseconds > Config.IOSingle_TimerOut)
{ {
ConfigIO io = Config.getWaitIO(wait.IoType); ConfigIO io = Config.getWaitIO(wait.IoType);
WarnMsg = StoreName + " 等待信号" + io.DisplayStr + "=" + wait.IoValue + "超时!"; WarnMsg = StoreName + " 等待信号" + io.DisplayStr + "=" + wait.IoValue + "超时!";
//SendAlarmCode(StoreID, LineAlarm.IoNotOk, wait.IoType);
Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, StoreMove.MoveType); Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, StoreMove.MoveType);
LogUtil.error(LOGGER, StoreName + wait.IoType + "等待信号(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", 14); LogUtil.error(LOGGER, StoreName + wait.IoType + "等待信号(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", 14);
}
isOk = false; isOk = false;
if (StoreMove.OneWaitCanEndStep.Equals(false))
{
break;
}
}
else if (StoreMove.OneWaitCanEndStep)
{
isOk = true;
break; break;
} }
} }
else if (wait.WaitType == 3) else if (wait.WaitType == 3)
{ {
if (span.TotalMilliseconds < wait.TimeMSeconds) wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
}
else if (wait.WaitType == 5)
{ {
isOk = false; if (wait.IsHomeMove)
if (StoreMove.OneWaitCanEndStep.Equals(false))
{ {
break; wait.IsEnd = ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime);
} }
else
{
wait.IsEnd = ShuoKeControls.IsMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime);
} }
else if (StoreMove.OneWaitCanEndStep) if (!wait.IsEnd)
{ {
isOk = true; ShuoKeControls.GetStatus(wait.SlvAddr);
break;
} }
} }
else if (wait.WaitType == 5) if (wait.IsEnd)
{ {
if (wait.IsHomeMove) if (StoreMove.OneWaitCanEndStep)
{
if (!ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime))
{ {
ShuoKeControls.GetStatus(wait.SlvAddr); isOk = true;
isOk = false;
break; break;
} }
else if (StoreMove.OneWaitCanEndStep)
{
isOk = true; break;
}
} }
else else
{ {
if (!ShuoKeControls.IsMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime)) if (!StoreMove.OneWaitCanEndStep)
{ {
ShuoKeControls.GetStatus(wait.SlvAddr);
isOk = false; isOk = false;
break; break;
} }
else if (StoreMove.OneWaitCanEndStep)
{
isOk = true; break;
}
} }
} }
}
if (isOk) if (isOk)
{ {
StoreMove.EndStepWait(); StoreMove.EndStepWait();
} }
} else if (span.TotalSeconds > 120)
else
{ {
StoreMove.EndStepWait(); 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>
......
...@@ -238,7 +238,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -238,7 +238,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
return "轴【" + AxisInfo.DisplayStr + "】绝对运动,目标位置【" + TargetPosition + "】"; return "轴【" + AxisInfo.DisplayStr + "】绝对运动【" + TargetPosition + "】";
} }
} }
else if (WaitType == 2) else if (WaitType == 2)
...@@ -261,6 +261,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -261,6 +261,7 @@ namespace OnlineStore.DeviceLibrary
{ {
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!