Commit 03579498 LN

增加运行日志打印

1 个父辈 c94c8fec
...@@ -113,6 +113,16 @@ ...@@ -113,6 +113,16 @@
<conversionPattern value="[%date][%t]%-5p %m%n" /> <conversionPattern value="[%date][%t]%-5p %m%n" />
</layout> </layout>
</appender> </appender>
<appender name="RunLog" type="log4net.Appender.RollingFileAppender">
<file value="logs/log/RunLog-line.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value=" %m%n" />
</layout>
</appender>
<logger name="RollingLogFileAppender"> <logger name="RollingLogFileAppender">
<level value="Info" /> <level value="Info" />
<appender-ref ref="RollingLogFileAppender" /> <appender-ref ref="RollingLogFileAppender" />
...@@ -125,6 +135,10 @@ ...@@ -125,6 +135,10 @@
<level value="Info" /> <level value="Info" />
<appender-ref ref="AIOBOX" /> <appender-ref ref="AIOBOX" />
</logger> </logger>
<logger name="RunLog">
<level value="Info" />
<appender-ref ref="RunLog" />
</logger>
<!--<root> <!--<root>
<level value="Info" /> <level value="Info" />
<appender-ref ref="RollingLogFileAppender" /> <appender-ref ref="RollingLogFileAppender" />
......
...@@ -302,6 +302,7 @@ namespace OnlineStore.AssemblyLine ...@@ -302,6 +302,7 @@ namespace OnlineStore.AssemblyLine
{ {
LogUtil.info("即将退出程序,停止" + lineBean.Name + "运行 "); LogUtil.info("即将退出程序,停止" + lineBean.Name + "运行 ");
lineBean.StopRun(); lineBean.StopRun();
lineBean.SetWarnMsg();
} }
foreach (EquipBase equip in lineBean.AllEquipMap.Values) foreach (EquipBase equip in lineBean.AllEquipMap.Values)
{ {
...@@ -309,6 +310,7 @@ namespace OnlineStore.AssemblyLine ...@@ -309,6 +310,7 @@ namespace OnlineStore.AssemblyLine
{ {
LogUtil.info("即将退出程序,停止" + equip.Name + "运行 "); LogUtil.info("即将退出程序,停止" + equip.Name + "运行 ");
equip.StopRun(); equip.StopRun();
equip.SetWarnMsg();
} }
} }
// IOManager.instance.CloseAllDO(); // IOManager.instance.CloseAllDO();
...@@ -318,7 +320,7 @@ namespace OnlineStore.AssemblyLine ...@@ -318,7 +320,7 @@ namespace OnlineStore.AssemblyLine
if (Camera._cam != null) if (Camera._cam != null)
{ {
Camera._cam.CloseAll(); Camera._cam.CloseAll();
} }
// CodeManager.CloseAllCamera(); // CodeManager.CloseAllCamera();
// RFIDManager.Close(); // RFIDManager.Close();
//System.Environment.Exit(System.Environment.ExitCode); //System.Environment.Exit(System.Environment.ExitCode);
......
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
<Compile Include="util\NetTCPServer.cs"> <Compile Include="util\NetTCPServer.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="util\RunLogUtil.cs" />
<Compile Include="util\TcpClient.cs" /> <Compile Include="util\TcpClient.cs" />
<Compile Include="util\TcpServer.cs" /> <Compile Include="util\TcpServer.cs" />
<Compile Include="util\UdpServer.cs" /> <Compile Include="util\UdpServer.cs" />
......
...@@ -89,7 +89,7 @@ namespace OnlineStore.Common ...@@ -89,7 +89,7 @@ namespace OnlineStore.Common
} }
public static void error(ILog log, string errorMsg, Exception ex = null) public static void error(ILog log, string errorMsg, Exception ex = null)
{ {
if (errorMsg.Trim().Equals("")&&(ex==null)) if (errorMsg.Trim().Equals("") && (ex == null))
{ {
return; return;
} }
...@@ -103,7 +103,7 @@ namespace OnlineStore.Common ...@@ -103,7 +103,7 @@ namespace OnlineStore.Common
} }
AddToBox(errorMsg, Color.Red); AddToBox(errorMsg, Color.Red);
} }
private static object lockObj = ""; private static object lockObj = "";
private static void AddToBox(string msg, Color color) private static void AddToBox(string msg, Color color)
{ {
if (Monitor.TryEnter(lockObj, 2)) if (Monitor.TryEnter(lockObj, 2))
...@@ -123,7 +123,7 @@ namespace OnlineStore.Common ...@@ -123,7 +123,7 @@ namespace OnlineStore.Common
} }
else else
{ {
LOGGER.Debug ("ShowLogPro【" + msg + "】失败,未得到锁"); LOGGER.Debug("ShowLogPro【" + msg + "】失败,未得到锁");
} }
} }
private static List<string> logList = new List<string>(); private static List<string> logList = new List<string>();
...@@ -132,7 +132,7 @@ namespace OnlineStore.Common ...@@ -132,7 +132,7 @@ namespace OnlineStore.Common
private static void ShowLogPro(string msg, Color color) private static void ShowLogPro(string msg, Color color)
{ {
try try
{ {
if (logList.Count >= showCount) if (logList.Count >= showCount)
{ {
logList.RemoveAt(0); logList.RemoveAt(0);
...@@ -174,7 +174,7 @@ namespace OnlineStore.Common ...@@ -174,7 +174,7 @@ namespace OnlineStore.Common
LOGGER.Error("出错:" + ex.ToString()); LOGGER.Error("出错:" + ex.ToString());
} }
} }
private static DateTime lastTime = DateTime.Now; private static DateTime lastTime = DateTime.Now;
public static void UpdateLogbox() public static void UpdateLogbox()
{ {
if (logBox != null && logBox.Visible) if (logBox != null && logBox.Visible)
...@@ -192,7 +192,7 @@ namespace OnlineStore.Common ...@@ -192,7 +192,7 @@ namespace OnlineStore.Common
} }
public static void ClearLog() public static void ClearLog()
{ {
if (logBox != null) if (logBox != null)
{ {
LastText = ""; LastText = "";
...@@ -204,9 +204,9 @@ namespace OnlineStore.Common ...@@ -204,9 +204,9 @@ namespace OnlineStore.Common
{ {
debug(LOGGER, msg); debug(LOGGER, msg);
} }
public static void error(string errorMsg,Exception ex=null) public static void error(string errorMsg, Exception ex = null)
{ {
error(LOGGER, errorMsg,ex); error(LOGGER, errorMsg, ex);
} }
public static void info(string msg) public static void info(string msg)
{ {
......
using log4net;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace OnlineStore.Common
{
public class RunLogUtil
{
public static readonly ILog RunLog = LogManager.GetLogger("RunLog");
public static void ErrorLog(ErrorLog log)
{
string jsonStr = JsonHelper.SerializeObject(log);
RunLog.Error(jsonStr);
}
public static void MoveLog(MoveLog log)
{
//if (log == null || (!log.IsValid()))
//{
// return;
//}
//string jsonStr = JsonHelper.SerializeObject(log);
//RunLog.Info(jsonStr);
}
public static void MoveEndLog(MoveEndLog log)
{
if (log == null || (!log.IsValid()))
{
return;
}
string jsonStr = JsonHelper.SerializeObject(log);
RunLog.Info(jsonStr);
}
public static void AxisLog(AxisMoveLog log)
{
string jsonStr = JsonHelper.SerializeObject(log);
RunLog.Error(jsonStr);
}
}
public class BaseLog
{
[JsonProperty(Order = 0)]
public string Name { get; set; } = "四楼环形线";
[JsonProperty(Order = 1)]
public string DeviceName { get; set; } = "";
[JsonProperty(Order = 2)]
public string LogType { get; set; } = "";
[JsonProperty(Order = 3)]
public string StartTime { get; set; } = "";
[JsonProperty(Order = 4)]
public string EndTime { get; set; } = "";
[JsonProperty(Order = 5)]
public string timeSpan { get; set; } = "";
}
public class ErrorLog : BaseLog
{
public ErrorLog()
{
this.LogType = "Error";
}
public ErrorLog(string deviceName, string errType, string errMsg, DateTime startTime, DateTime endTime, string operType = "", string posid = "", string barcode = "")
{
this.LogType = "Error";
this.DeviceName = deviceName.Trim();
this.ErrorType = errType.Trim();
this.ErrorMsg = errMsg.Trim();
this.StartTime = startTime.ToString("yyyy-MM-dd HH:mm:ss");
this.EndTime = endTime.ToString("yyyy-MM-dd HH:mm:ss");
this.OperateType = operType.Trim();
this.PosId = posid.Trim();
this.Barcode = barcode.Trim();
TimeSpan span = endTime - startTime;
this.timeSpan = (Math.Round(span.TotalMinutes, 2)).ToString();//两位小数的分钟
}
public bool IsValid()
{
if (string.IsNullOrEmpty(DeviceName) || String.IsNullOrEmpty(LogType) || string.IsNullOrEmpty(ErrorType) || string.IsNullOrEmpty(ErrorMsg))
{
return false;
}
return true;
}
[JsonProperty(Order = 11)]
public string ErrorType { get; set; } = "";
[JsonProperty(Order = 12)]
public string ErrorMsg { get; set; } = "";
[JsonProperty(Order = 13)]
public string OperateType { get; set; } = "";
[JsonProperty(Order = 14)]
public string PosId { get; set; } = "";
[JsonProperty(Order = 15)]
public string Barcode { get; set; } = "";
}
public class MoveLog : BaseLog
{
public MoveLog()
{
this.LogType = "Running";
}
public MoveLog(string deviceName, string moveType, string moveMsg, DateTime startTime, DateTime endTime, string posid = "", string barcode = "")
{
this.LogType = "Running";
this.DeviceName = deviceName.Replace("-Move", "").Replace("-SMove", "").Trim();
this.MoveType = moveType.Trim();
this.MoveMsg = moveMsg.Trim();
this.StartTime = startTime.ToString("yyyy-MM-dd HH:mm:ss");
this.EndTime = endTime.ToString("yyyy-MM-dd HH:mm:ss");
this.PosId = posid.Trim();
this.Barcode = barcode.Trim();
TimeSpan span = endTime - startTime;
this.timeSpan = (Math.Round(span.TotalMinutes, 2)).ToString();//两位小数的分钟
}
public bool IsValid()
{
if (string.IsNullOrEmpty(DeviceName) || String.IsNullOrEmpty(LogType) || string.IsNullOrEmpty(MoveType) || string.IsNullOrEmpty(MoveMsg))
{
return false;
}
return true;
}
[JsonProperty(Order = 11)]
public string MoveType { get; set; } = "";
[JsonProperty(Order = 12)]
public string MoveMsg { get; set; } = "";
[JsonProperty(Order = 13)]
public string PosId { get; set; } = "";
[JsonProperty(Order = 14)]
public string Barcode { get; set; } = "";
}
public class MoveEndLog : BaseLog
{
public MoveEndLog()
{
this.LogType = "InoutEnd";
}
public MoveEndLog(string deviceName, string moveType, DateTime startTime, DateTime endTime, string posid = "", string barcode = "")
{
this.LogType = "InoutEnd";
this.DeviceName = deviceName.Replace("-Move", "").Replace("-SMove", "").Trim();
this.MoveType = moveType.Trim();
this.StartTime = startTime.ToString("yyyy-MM-dd HH:mm:ss");
this.EndTime = endTime.ToString("yyyy-MM-dd HH:mm:ss");
this.PosId = posid.Trim();
this.Barcode = barcode.Trim();
TimeSpan span = endTime - startTime;
this.timeSpan = (Math.Round(span.TotalMinutes, 2)).ToString();//两位小数的分钟
}
public bool IsValid()
{
if (string.IsNullOrEmpty(DeviceName) || string.IsNullOrEmpty(MoveType))
{
return false;
}
return true;
}
[JsonProperty(Order = 11)]
public string MoveType { get; set; } = "";
[JsonProperty(Order = 12)]
public string PosId { get; set; } = "";
[JsonProperty(Order = 13)]
public string Barcode { get; set; } = "";
}
public class AxisMoveLog : BaseLog
{
public AxisMoveLog()
{
this.LogType = "Axis";
}
public AxisMoveLog(string deviceName, string axisName, string moveType, int targetP, int speed, DateTime startTime, DateTime endTime, string posid = "", string barcode = "")
{
this.LogType = "Axis";
this.DeviceName = deviceName.Replace("-Move", "").Replace("-SMove", "").Trim();
this.MoveType = moveType.Trim();
this.AxisName = axisName;
this.TargetPos = targetP;
this.StartTime = startTime.ToString("yyyy-MM-dd HH:mm:ss");
this.EndTime = endTime.ToString("yyyy-MM-dd HH:mm:ss");
this.PosId = posid.Trim();
this.Barcode = barcode.Trim();
TimeSpan span = endTime - startTime;
this.timeSpan = (Math.Round(span.TotalMinutes, 2)).ToString();//两位小数的分钟
this.Speed = speed;
}
public bool IsValid()
{
if (string.IsNullOrEmpty(DeviceName) || string.IsNullOrEmpty(MoveType))
{
return false;
}
return true;
}
[JsonProperty(Order = 11)]
public string AxisName { get; set; } = "";
[JsonProperty(Order = 12)]
public string MoveType { get; set; } = "";
[JsonProperty(Order = 13)]
public int TargetPos { get; set; } = 0;
[JsonProperty(Order = 14)]
public int Speed { get; set; }
[JsonProperty(Order = 15)]
public string PosId { get; set; } = "";
[JsonProperty(Order = 16)]
public string Barcode { get; set; } = "";
}
}
...@@ -194,6 +194,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -194,6 +194,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
RunLogUtil.MoveEndLog(new MoveEndLog(Name, "复位", MoveInfo.MoveStartTime, DateTime.Now));
MoveEndS(); MoveEndS();
SecondMoveInfo.EndMove(); SecondMoveInfo.EndMove();
break; break;
...@@ -262,7 +263,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -262,7 +263,7 @@ namespace OnlineStore.DeviceLibrary
Thread.Sleep(300); Thread.Sleep(300);
if (IOValue(IO_Type.DLine_SuddenStop).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.DLine_SuddenStop).Equals(IO_VALUE.LOW))
{ {
SetWarnMsg(Name + "收到急停信号,急停报警"); SetWarnMsg(Name + "收到急停信号,急停报警", "急停报警");
Alarm(LineAlarmType.SuddenStop); Alarm(LineAlarmType.SuddenStop);
return; return;
} }
......
...@@ -190,6 +190,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -190,6 +190,8 @@ namespace OnlineStore.DeviceLibrary
int robotIndex = GetRobotIndex(); int robotIndex = GetRobotIndex();
LogUtil.info(hengyiName + MoveInfo.SLog + "送料,接驳台有料,调用arriveRobotLocation=" + robotIndex + "[" + StationInfo_Move.CodeStr + "]"); LogUtil.info(hengyiName + MoveInfo.SLog + "送料,接驳台有料,调用arriveRobotLocation=" + robotIndex + "[" + StationInfo_Move.CodeStr + "]");
string msg = SServerManager.arriveRobotLocation(Name, robotIndex, StationInfo_Move.CodeStr); string msg = SServerManager.arriveRobotLocation(Name, robotIndex, StationInfo_Move.CodeStr);
MoveEndS(); MoveEndS();
LogUtil.info(hengyiName + MoveInfo.SLog + "送料结束 [" + msg + "]"); LogUtil.info(hengyiName + MoveInfo.SLog + "送料结束 [" + msg + "]");
} }
...@@ -206,6 +208,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -206,6 +208,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.MoveStep.Equals(LineMoveStep.DON_08_CRun)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.DON_08_CRun))
{ {
SeparateStopRun(); SeparateStopRun();
RunLogUtil.MoveEndLog(new MoveEndLog(Name, "送料", MoveInfo.MoveStartTime, DateTime.Now, "", StationInfo_Move.CodeStr));
MoveEndS(); MoveEndS();
LogUtil.info(hengyiName + MoveInfo.SLog + "送料结束,停止接驳台皮带线 "); LogUtil.info(hengyiName + MoveInfo.SLog + "送料结束,停止接驳台皮带线 ");
} }
......
...@@ -185,19 +185,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -185,19 +185,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("IOTimeOutProcess出错:",ex); LogUtil.error("IOTimeOutProcess出错:",ex);
} }
} }
protected void ClearTimeoutAlarm(string msg)
{
if (isInSuddenDown || isNoAirCheck)
{
return;
}
if (WarnMsg.Contains(msg) && alarmType.Equals(LineAlarmType.IoSingleTimeOut))
{
LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 ");
alarmType = LineAlarmType.None;
SetWarnMsg("");
}
}
protected bool CanStartRun() protected bool CanStartRun()
{ {
string canResult = LineManager.Line.CanStart(); string canResult = LineManager.Line.CanStart();
...@@ -380,7 +369,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -380,7 +369,7 @@ namespace OnlineStore.DeviceLibrary
IOMove(axis.Config.BreakOnDO, IO_VALUE.HIGH); IOMove(axis.Config.BreakOnDO, IO_VALUE.HIGH);
return true; return true;
} }
SetWarnMsg(Name + msg); SetWarnMsg(Name + msg,axis.Config.DisplayStr+"_轴报警");
//WarnMsg = DateTime.Now.ToLongTimeString() + " " + Name + msg; //WarnMsg = DateTime.Now.ToLongTimeString() + " " + Name + msg;
Alarm(LineAlarmType.AxisAlarm); Alarm(LineAlarmType.AxisAlarm);
return false; return false;
...@@ -443,16 +432,24 @@ namespace OnlineStore.DeviceLibrary ...@@ -443,16 +432,24 @@ namespace OnlineStore.DeviceLibrary
if (wait.IsHomeMove) if (wait.IsHomeMove)
{ {
wait.IsEnd = AxisBean.HomeMoveIsEnd(moveInfo, wait.AxisInfo, out msg); wait.IsEnd = AxisBean.HomeMoveIsEnd(moveInfo, wait.AxisInfo, out msg);
if (wait.IsEnd)
{
RunLogUtil.AxisLog(new AxisMoveLog(Name, wait.AxisInfo.Explain, "回原点", 0, wait.AxisInfo.HomeHighSpeed, moveInfo.LastSetpTime, DateTime.Now, moveInfo.MoveParam.PosId, moveInfo.MoveParam.WareCode));
}
} }
else else
{ {
wait.IsEnd = AxisBean.ACAxisMoveIsEnd(moveInfo, wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg); wait.IsEnd = AxisBean.ACAxisMoveIsEnd(moveInfo, wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
if (wait.IsEnd)
{
RunLogUtil.AxisLog(new AxisMoveLog(Name, wait.AxisInfo.Explain, "绝对运动", wait.TargetPosition, wait.TargetSpeed, moveInfo.LastSetpTime, DateTime.Now, moveInfo.MoveParam.PosId, moveInfo.MoveParam.WareCode));
}
} }
if (!msg.Equals("")) if (!msg.Equals(""))
{ {
isOk = false; isOk = false;
WarnMsg = Name + msg; string type = moveInfo.GetStepDes() + "_轴运动报警";
SetWarnMsg(msg, type,moveInfo);
Alarm(LineAlarmType.AxisMoveError); Alarm(LineAlarmType.AxisMoveError);
CheckAlarmProcess(moveInfo, LineAlarmType.AxisMoveError); CheckAlarmProcess(moveInfo, LineAlarmType.AxisMoveError);
LogUtil.error(WarnMsg, DeviceID * 1000 + 14); LogUtil.error(WarnMsg, DeviceID * 1000 + 14);
...@@ -477,9 +474,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -477,9 +474,12 @@ namespace OnlineStore.DeviceLibrary
if (span.TotalSeconds > LineManager.Config.IOSingle_TimerOut && alarmType <= LineAlarmType.IoSingleTimeOut) if (span.TotalSeconds > LineManager.Config.IOSingle_TimerOut && alarmType <= LineAlarmType.IoSingleTimeOut)
{ {
ConfigIO io = baseConfig.getWaitIO(wait.IoType); ConfigIO io = baseConfig.getWaitIO(wait.IoType);
WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒"; string msg= moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒";
LogUtil.error(MoveInfo.Name + WarnMsg, DeviceID * 1000 + 13); string type = moveInfo.GetStepDes() + "_" + "超时报警";
SetWarnMsg(msg, type,moveInfo);
//WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒";
//LogUtil.error(MoveInfo.Name + WarnMsg, DeviceID * 1000 + 13);
if (NoAlarm()) if (NoAlarm())
{ {
Alarm(LineAlarmType.IoSingleTimeOut); Alarm(LineAlarmType.IoSingleTimeOut);
...@@ -559,11 +559,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -559,11 +559,11 @@ namespace OnlineStore.DeviceLibrary
if (isOk) if (isOk)
{ {
moveInfo.EndStepWait(); moveInfo.EndStepWait();
ClearStepAlarm(moveInfo.GetStepDes());
} }
else if (span.TotalSeconds > moveInfo.TimeOutSeconds) else if (span.TotalSeconds > moveInfo.TimeOutSeconds)
{ {
WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待" + NotOkMsg
+ "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
int second = 10; int second = 10;
if (IsLowAlarm(moveInfo)) if (IsLowAlarm(moveInfo))
{ {
...@@ -577,7 +577,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -577,7 +577,12 @@ namespace OnlineStore.DeviceLibrary
{ {
second = 10; second = 10;
} }
LogUtil.error(WarnMsg, DeviceID * 1000 + 15, second); //WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待" + NotOkMsg+ "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 15, second);
string msg= moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待" + NotOkMsg + "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
string type = moveInfo.GetStepDes() + "_" + "超时报警";
SetWarnMsg(msg, type,moveInfo, second);
Alarm(LineAlarmType.IoSingleTimeOut); Alarm(LineAlarmType.IoSingleTimeOut);
CheckAlarmProcess(moveInfo, LineAlarmType.IoSingleTimeOut); CheckAlarmProcess(moveInfo, LineAlarmType.IoSingleTimeOut);
} }
...@@ -587,6 +592,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -587,6 +592,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(moveInfo.Name + " [" + moveInfo.MoveStep + "] CheckWait 出错:", ex); LogUtil.error(moveInfo.Name + " [" + moveInfo.MoveStep + "] CheckWait 出错:", ex);
} }
} }
private bool IsLowAlarm(LineMoveInfo moveInfo) private bool IsLowAlarm(LineMoveInfo moveInfo)
{ {
//托盘卡的信号不报警,只提示 //托盘卡的信号不报警,只提示
......
...@@ -291,6 +291,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -291,6 +291,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo("重置完成,出口检测到有料架,调用 " + Config.AgvOutName + " AgvClient.NeedLeave"); LogInfo("重置完成,出口检测到有料架,调用 " + Config.AgvOutName + " AgvClient.NeedLeave");
AgvClient.NeedLeave(Config.AgvOutName, LastOutShelfId, level); AgvClient.NeedLeave(Config.AgvOutName, LastOutShelfId, level);
} }
RunLogUtil.MoveEndLog(new MoveEndLog(Name, "复位", MoveInfo.MoveStartTime, DateTime.Now));
MoveEndS(); MoveEndS();
break; break;
default: break; default: break;
...@@ -557,9 +558,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -557,9 +558,10 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
WarnMsg = Name + "TrayLCylinderAfter:提升轴当前不在下降位置P2,不后退定位气缸"; //WarnMsg = Name + "TrayLCylinderAfter:提升轴当前不在下降位置P2,不后退定位气缸";
//LogUtil.error(Name + "TrayLCylinderAfter:提升轴当前不在下降位置P2,不后退定位气缸");
SetWarnMsg("TrayLCylinderAfter:提升轴当前不在下降位置P2,不后退定位气缸");
Alarm(LineAlarmType.IoSingleTimeOut); Alarm(LineAlarmType.IoSingleTimeOut);
LogUtil.error(Name + "TrayLCylinderAfter:提升轴当前不在下降位置P2,不后退定位气缸");
} }
} }
if (moveinfo != null) if (moveinfo != null)
...@@ -655,7 +657,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -655,7 +657,7 @@ namespace OnlineStore.DeviceLibrary
IsInProcess = true; IsInProcess = true;
lastOkTime = DateTime.Now; lastOkTime = DateTime.Now;
if (IOValue(TargetIoType).Equals(TargetIoValue)) if (IOValue(TargetIoType).Equals(TargetIoValue))
{ {
LogUtil.info(Name + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",停止运动"); LogUtil.info(Name + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",停止运动");
BatchAxis.SuddenStop(); BatchAxis.SuddenStop();
BatchAxisStopCheck(); BatchAxisStopCheck();
......
...@@ -436,8 +436,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -436,8 +436,8 @@ namespace OnlineStore.DeviceLibrary
{ {
if (SecondMoveInfo.IsTimeOut(15)) if (SecondMoveInfo.IsTimeOut(15))
{ {
WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待入库托盘超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; string msg= SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待入库托盘超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg + ",暂时放托盘离开"); LogUtil.error(msg + ",暂时放托盘离开");
TrayMoveOk(); TrayMoveOk();
} }
} }
...@@ -448,24 +448,23 @@ namespace OnlineStore.DeviceLibrary ...@@ -448,24 +448,23 @@ namespace OnlineStore.DeviceLibrary
if (StartTrayOut(SecondMoveInfo.MoveParam)) if (StartTrayOut(SecondMoveInfo.MoveParam))
{ {
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_201_WaitOutEnd); SecondMoveInfo.NextMoveStep(LineMoveStep.MO_201_WaitOutEnd);
} }
//如果当前无料串,或者料串已离开,直接放行 托盘
//如果当前无料串,或者料串已离开,直接放行 托盘
else if (SecondMoveInfo.IsTimeOut(30)) else if (SecondMoveInfo.IsTimeOut(30))
{ {
WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待出库移栽超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; string msg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待出库移栽超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg + ",暂时放托盘离开"); LogUtil.error(msg + ",暂时放托盘离开");
TrayMoveOk(); TrayMoveOk();
} }
else if (SecondMoveInfo.IsTimeOut(20)) else if (SecondMoveInfo.IsTimeOut(20))
{ {
WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待出库移栽超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; MoveTimeoutAlarm(SecondMoveInfo, "等待出库移栽超时");
LogUtil.error(WarnMsg, DeviceID * 1000 + 21); //WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待出库移栽超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
Alarm(LineAlarmType.IoSingleTimeOut); //LogUtil.error(WarnMsg, DeviceID * 1000 + 21);
} //Alarm(LineAlarmType.IoSingleTimeOut);
}
} }
} }
private void TrayMoveOk(bool needCheck = false) private void TrayMoveOk(bool needCheck = false)
{ {
if (needCheck && (!SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_11_CodeRember))) if (needCheck && (!SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_11_CodeRember)))
...@@ -792,9 +791,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -792,9 +791,10 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsTimeOut(60)) else if (MoveInfo.IsTimeOut(60))
{ {
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 扫码执行结束超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; MoveTimeoutAlarm(MoveInfo, "扫码执行结束超时");
LogUtil.error(WarnMsg, DeviceID * 1000 + 30); //WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 扫码执行结束超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
Alarm(LineAlarmType.IoSingleTimeOut); //LogUtil.error(WarnMsg, DeviceID * 1000 + 30);
//Alarm(LineAlarmType.IoSingleTimeOut);
} }
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_14_CylinderTake)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_14_CylinderTake))
...@@ -1001,9 +1001,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1001,9 +1001,10 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsTimeOut(180)) else if (MoveInfo.IsTimeOut(180))
{ {
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.SLog + "]等待空托盘到达超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; MoveTimeoutAlarm(MoveInfo, "等待空托盘到达超时");
LogUtil.error(WarnMsg, DeviceID * 1000 + 22); //WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.SLog + "]等待空托盘到达超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
Alarm(LineAlarmType.IoSingleTimeOut); //LogUtil.error(WarnMsg, DeviceID * 1000 + 22);
//Alarm(LineAlarmType.IoSingleTimeOut);
} }
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_26_CylinderDown)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_26_CylinderDown))
...@@ -1162,7 +1163,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1162,7 +1163,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_59_TopDown)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_59_TopDown))
{ {
MoveEndS(); MoveEndS();
// MoveInfo.NextMoveStep(LineMoveStep.FI_39_OutLineRun); // MoveInfo.NextMoveStep(LineMoveStep.FI_39_OutLineRun);
LastOutShelfId = CurrShelfId; LastOutShelfId = CurrShelfId;
...@@ -1191,9 +1192,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1191,9 +1192,10 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsTimeOut(15)) else if (MoveInfo.IsTimeOut(15))
{ {
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 获取库位号超时 " + getPosIdMsg + " [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; MoveTimeoutAlarm(MoveInfo, "获取库位号超时 " + getPosIdMsg + "");
LogUtil.error(WarnMsg, DeviceID * 1000 + 30); //WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 获取库位号超时 " + getPosIdMsg + " [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
Alarm(LineAlarmType.IoSingleTimeOut); //LogUtil.error(WarnMsg, DeviceID * 1000 + 30);
//Alarm(LineAlarmType.IoSingleTimeOut);
} }
} }
...@@ -1447,9 +1449,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1447,9 +1449,10 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsTimeOut(60)) else if (MoveInfo.IsTimeOut(60))
{ {
WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待预扫码结束超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; MoveTimeoutAlarm(MoveInfo, "等待预扫码结束超时");
LogUtil.error(WarnMsg, DeviceID * 1000 + 21); //WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待预扫码结束超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
Alarm(LineAlarmType.IoSingleTimeOut); //LogUtil.error(WarnMsg, DeviceID * 1000 + 21);
//Alarm(LineAlarmType.IoSingleTimeOut);
} }
} }
else else
...@@ -1499,8 +1502,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -1499,8 +1502,9 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
WarnMsg = Name + "提升轴运动报警。上升到P3点已重复" + LoopCount + "次,仍未检测到料盘信号"; //WarnMsg = Name + "提升轴运动报警。上升到P3点已重复" + LoopCount + "次,仍未检测到料盘信号";
LogUtil.error(WarnMsg); //LogUtil.error(WarnMsg);
SetWarnMsg("提升轴运动报警。上升到P3点已重复" + LoopCount + "次,仍未检测到料盘信号", "提升轴运动报警,未检测到料盘信号");
Alarm(LineAlarmType.AxisMoveError); Alarm(LineAlarmType.AxisMoveError);
} }
return; return;
......
...@@ -744,9 +744,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -744,9 +744,10 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsTimeOut(60)) else if (MoveInfo.IsTimeOut(60))
{ {
WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待给服务器发送afterPut完成超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; MoveTimeoutAlarm(MoveInfo, "等待给服务器发送afterPut完成超时");
LogUtil.error(WarnMsg, DeviceID * 1000 + 21); //WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待给服务器发送afterPut完成超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
Alarm(LineAlarmType.IoSingleTimeOut); //LogUtil.error(WarnMsg, DeviceID * 1000 + 21);
//Alarm(LineAlarmType.IoSingleTimeOut);
} }
} }
} }
......
...@@ -719,7 +719,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -719,7 +719,7 @@ namespace OnlineStore.DeviceLibrary
Thread.Sleep(300); Thread.Sleep(300);
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{ {
SetWarnMsg("收到急停信号,报警急停"); SetWarnMsg("收到急停信号,报警急停","急停报警");
Alarm(LineAlarmType.SuddenStop); Alarm(LineAlarmType.SuddenStop);
} }
//}); //});
...@@ -865,7 +865,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -865,7 +865,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if ((DateTime.Now - lastAirCloseTime).TotalSeconds > Config.AirCheckSeconds) if ((DateTime.Now - lastAirCloseTime).TotalSeconds > Config.AirCheckSeconds)
{ {
SetWarnMsg("持续"+Config.AirCheckSeconds+"秒未检测到气压信号"); SetWarnMsg("持续"+Config.AirCheckSeconds+"秒未检测到气压信号","未检测到气压信号");
//SendAlarmCode(0, LineAlarm.NoAirCheck); //SendAlarmCode(0, LineAlarm.NoAirCheck);
airValue = IO_VALUE.LOW; airValue = IO_VALUE.LOW;
Alarm(LineAlarmType.NoAirCheck ); Alarm(LineAlarmType.NoAirCheck );
...@@ -1028,8 +1028,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -1028,8 +1028,8 @@ namespace OnlineStore.DeviceLibrary
} }
else if (span.TotalSeconds > 120) else if (span.TotalSeconds > 120)
{ {
WarnMsg = Name + "[" + MoveInfo.MoveStep + "][" + msg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒"; string wMsg = Name + "[" + MoveInfo.MoveStep + "][" + msg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, 903); SetWarnMsg(wMsg,$"{msg}超时", MoveInfo);
Alarm(LineAlarmType.IoSingleTimeOut); Alarm(LineAlarmType.IoSingleTimeOut);
} }
} }
......
...@@ -110,9 +110,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -110,9 +110,9 @@ namespace OnlineStore.DeviceLibrary
if (span.TotalSeconds > LineManager.Config.IOSingle_TimerOut && NoAlarm()) if (span.TotalSeconds > LineManager.Config.IOSingle_TimerOut && NoAlarm())
{ {
ConfigIO io = baseConfig.getWaitIO(wait.IoType); ConfigIO io = baseConfig.getWaitIO(wait.IoType);
WarnMsg = Name + "[" + checkWaitInfo.MoveStep + "]等待" + NotOkMsg + " 超时"; string warnMsg= checkWaitInfo.Name + "[" + checkWaitInfo.MoveStep + "]等待" + NotOkMsg + " 超时";
SetWarnMsg(warnMsg, checkWaitInfo.GetStepDes()+"_超时报警", checkWaitInfo);
Alarm(LineAlarmType.IoSingleTimeOut); Alarm(LineAlarmType.IoSingleTimeOut);
LogUtil.error(MoveInfo.Name + WarnMsg, 901);
} }
//超过报警时长 //超过报警时长
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2) else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2)
...@@ -183,11 +183,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -183,11 +183,12 @@ namespace OnlineStore.DeviceLibrary
if (isOk) if (isOk)
{ {
checkWaitInfo.EndStepWait(); checkWaitInfo.EndStepWait();
ClearStepAlarm(checkWaitInfo.GetStepDes());
} }
else if (span.TotalSeconds > checkWaitInfo.TimeOutSeconds) else if (span.TotalSeconds > checkWaitInfo.TimeOutSeconds)
{ {
WarnMsg = checkWaitInfo.Name + "[" + checkWaitInfo.MoveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒"; string wanMsg = checkWaitInfo.Name + "[" + checkWaitInfo.MoveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, 900); SetWarnMsg(wanMsg, checkWaitInfo.GetStepDes()+"_超时报警" , checkWaitInfo);
Alarm(LineAlarmType.IoSingleTimeOut); Alarm(LineAlarmType.IoSingleTimeOut);
} }
} }
......
...@@ -285,9 +285,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -285,9 +285,10 @@ namespace OnlineStore.DeviceLibrary
} }
else if (Shunt_MoveInfo.IsTimeOut(120)) else if (Shunt_MoveInfo.IsTimeOut(120))
{ {
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.SLog + "]等待分流横移2可以上升[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; MoveTimeoutAlarm(Shunt_MoveInfo, "等待分流横移2可以上升");
LogUtil.error(WarnMsg, DeviceID * 1000 + 12); //WarnMsg = Shunt_MoveInfo.Name + "[" + Shunt_MoveInfo.MoveType + "][" + Shunt_MoveInfo.SLog + "]等待分流横移2可以上升[" + Math.Round(Shunt_MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
Alarm(LineAlarmType.IoSingleTimeOut); //LogUtil.error(WarnMsg, DeviceID * 1000 + 12);
//Alarm(LineAlarmType.IoSingleTimeOut);
} }
} }
else if (Shunt_MoveInfo.MoveStep.Equals(LineMoveStep.Shunt07_Top2Up)) else if (Shunt_MoveInfo.MoveStep.Equals(LineMoveStep.Shunt07_Top2Up))
......
...@@ -337,9 +337,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -337,9 +337,10 @@ namespace OnlineStore.DeviceLibrary
} }
else if (Shunt2_MoveInfo.IsTimeOut(120)) else if (Shunt2_MoveInfo.IsTimeOut(120))
{ {
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.SLog + "]等待分流横移22可以上升[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; MoveTimeoutAlarm(Shunt2_MoveInfo, "等待分流横移2可以上升");
LogUtil.error(WarnMsg, DeviceID * 1000 + 12); //WarnMsg = Shunt2_MoveInfo.Name + "[" + Shunt2_MoveInfo.MoveType + "][" + Shunt2_MoveInfo.SLog + "]等待分流横移22可以上升[" + Math.Round(Shunt2_MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
Alarm(LineAlarmType.IoSingleTimeOut); //LogUtil.error(WarnMsg, DeviceID * 1000 + 12);
//Alarm(LineAlarmType.IoSingleTimeOut);
} }
} }
else if (Shunt2_MoveInfo.MoveStep.Equals(LineMoveStep.Shunt07_Top2Up)) else if (Shunt2_MoveInfo.MoveStep.Equals(LineMoveStep.Shunt07_Top2Up))
......
...@@ -161,6 +161,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -161,6 +161,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
RunLogUtil.MoveEndLog(new MoveEndLog(Name, "复位", MoveInfo.MoveStartTime, DateTime.Now));
ResetEnd(); ResetEnd();
} }
......
...@@ -249,6 +249,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -249,6 +249,8 @@ namespace OnlineStore.DeviceLibrary
CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down); CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
OutLog("出库处理结束!"); OutLog("出库处理结束!");
RunLogUtil.MoveEndLog(new MoveEndLog(Name, "出库", MoveInfo.MoveStartTime, DateTime.Now, MoveInfo.MoveParam.PosId, MoveInfo.MoveParam.WareCode));
MoveEndS(); MoveEndS();
} }
...@@ -275,9 +277,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -275,9 +277,10 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsTimeOut(300)) else if (MoveInfo.IsTimeOut(300))
{ {
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.SLog + "]等待空托盘到达超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; MoveTimeoutAlarm(MoveInfo, "等待空托盘到达超时");
LogUtil.error(WarnMsg, DeviceID * 1000 + 12); //WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.SLog + "]等待空托盘到达超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
Alarm(LineAlarmType.IoSingleTimeOut); //LogUtil.error(WarnMsg, DeviceID * 1000 + 12);
//Alarm(LineAlarmType.IoSingleTimeOut);
return false; return false;
} }
return false; return false;
...@@ -521,13 +524,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -521,13 +524,14 @@ namespace OnlineStore.DeviceLibrary
if (sendCount >= 3) if (sendCount >= 3)
{ {
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] " + " 等待BOX开始入库超时 已发送" + sendCount + "次"; SetWarnMsg(MoveInfo.Name + "[" + MoveInfo.MoveStep + "] " + " 等待BOX开始入库超时 已发送" + sendCount + "次","等待BOX开始入库超时");
LogUtil.error(WarnMsg); //LogUtil.error(WarnMsg);
Alarm(LineAlarmType.IoSingleTimeOut); Alarm(LineAlarmType.IoSingleTimeOut);
} }
} }
else else
{ {
RunLogUtil.MoveEndLog(new MoveEndLog(Name, "入库", MoveInfo.MoveStartTime, DateTime.Now, MoveInfo.MoveParam.PosId, MoveInfo.MoveParam.WareCode));
sendCount = 0; sendCount = 0;
LogInfo("入库【" + posId + "】处理(移栽)全部完成!"); LogInfo("入库【" + posId + "】处理(移栽)全部完成!");
MoveEndS(); MoveEndS();
...@@ -535,6 +539,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -535,6 +539,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_16_SendEnd)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_16_SendEnd))
{ {
RunLogUtil.MoveEndLog(new MoveEndLog(Name, "入库", MoveInfo.MoveStartTime, DateTime.Now, MoveInfo.MoveParam.PosId, MoveInfo.MoveParam.WareCode));
LogInfo("入库【" + posId + "】处理(移栽)全部完成!"); LogInfo("入库【" + posId + "】处理(移栽)全部完成!");
MoveEndS(); MoveEndS();
} }
...@@ -1072,8 +1077,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -1072,8 +1077,8 @@ namespace OnlineStore.DeviceLibrary
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_09_WaitLetFixtureGo); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_09_WaitLetFixtureGo);
}else if (SecondMoveInfo.IsTimeOut(30)) }else if (SecondMoveInfo.IsTimeOut(30))
{ {
WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待开始入库超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; string msg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待开始入库超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg + ",暂时放托盘离开"); LogUtil.error(msg + ",暂时放托盘离开");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopDown); SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopDown);
InLog("放托盘(放开阻挡): " + MoveInfo.SLog + " 入库超时,放托盘离开,顶升气缸1下降"); InLog("放托盘(放开阻挡): " + MoveInfo.SLog + " 入库超时,放托盘离开,顶升气缸1下降");
CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down); CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
...@@ -1131,9 +1136,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1131,9 +1136,10 @@ namespace OnlineStore.DeviceLibrary
} }
else if (SecondMoveInfo.IsTimeOut(120)) else if (SecondMoveInfo.IsTimeOut(120))
{ {
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.SLog + "]等待分流横移1空闲[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; MoveTimeoutAlarm(SecondMoveInfo, "等待分流横移1空闲");
LogUtil.error(WarnMsg, DeviceID * 1000 + 12); //WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveType + "][" + SecondMoveInfo.SLog + "]等待分流横移1空闲[" + Math.Round(SecondMoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
Alarm(LineAlarmType.IoSingleTimeOut); //LogUtil.error(WarnMsg, DeviceID * 1000 + 12);
//Alarm(LineAlarmType.IoSingleTimeOut);
} }
} }
......
...@@ -133,6 +133,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -133,6 +133,7 @@ namespace OnlineStore.DeviceLibrary
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Slack, IO_Type.ClampCylinder_Tighten); CylinderMove(MoveInfo, IO_Type.ClampCylinder_Slack, IO_Type.ClampCylinder_Tighten);
break; break;
case LineMoveStep.MH_OtherCylinderBack: case LineMoveStep.MH_OtherCylinderBack:
RunLogUtil.MoveEndLog(new MoveEndLog(Name, "复位", MoveInfo.MoveStartTime, DateTime.Now));
MoveInfo.EndMove(); MoveInfo.EndMove();
SecondMoveInfo.EndMove(); SecondMoveInfo.EndMove();
LogInfo(MoveInfo.MoveType + " 完成!"); LogInfo(MoveInfo.MoveType + " 完成!");
......
...@@ -423,8 +423,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -423,8 +423,9 @@ namespace OnlineStore.DeviceLibrary
} }
else if(SecondMoveInfo.IsTimeOut(30)) else if(SecondMoveInfo.IsTimeOut(30))
{ {
WarnMsg = Name + TrayDisableManager.ProWarnMsg+ "[" + currTrayNum + "], 请处理并启用托盘,已超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; MoveTimeoutAlarm(SecondMoveInfo, "等待处理并启用托盘超时");
LogUtil.error(WarnMsg, DeviceID * 1000 + 20); //WarnMsg = Name + TrayDisableManager.ProWarnMsg+ "[" + currTrayNum + "], 请处理并启用托盘,已超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 20);
} }
else else
{ {
...@@ -639,10 +640,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -639,10 +640,10 @@ namespace OnlineStore.DeviceLibrary
PO_07_CylinderBefore(); PO_07_CylinderBefore();
} }
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_05_ClampCheck)) //else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_05_ClampCheck))
{ //{
PO_07_CylinderBefore(); // PO_07_CylinderBefore();
} //}
//else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_06_WaitBox)) //else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_06_WaitBox))
//{ //{
// MoveInfo.NextMoveStep(LineMoveStep.PO_07_CylinderBefore); // MoveInfo.NextMoveStep(LineMoveStep.PO_07_CylinderBefore);
...@@ -681,9 +682,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -681,9 +682,10 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsTimeOut()) else if (MoveInfo.IsTimeOut())
{ {
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待 皮带线可放料 " + "超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; MoveTimeoutAlarm(MoveInfo, "等待皮带线可放料超时");
LogUtil.error(WarnMsg, DeviceID * 1000 + 20); //WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待 皮带线可放料 " + "超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
Alarm(LineAlarmType.IoSingleTimeOut); //LogUtil.error(WarnMsg, DeviceID * 1000 + 20);
//Alarm(LineAlarmType.IoSingleTimeOut);
} }
} }
else else
...@@ -707,14 +709,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -707,14 +709,16 @@ namespace OnlineStore.DeviceLibrary
{ {
if (afterPutCutOK) if (afterPutCutOK)
{ {
RunLogUtil.MoveEndLog(new MoveEndLog(Name, "出库", MoveInfo.MoveStartTime, DateTime.Now, MoveInfo.MoveParam.PosId, MoveInfo.MoveParam.WareCode));
OutLog("出料【" + posId + "】处理完成!"); OutLog("出料【" + posId + "】处理完成!");
MoveEndS(); MoveEndS();
} }
else if (MoveInfo.IsTimeOut(60)) else if (MoveInfo.IsTimeOut(60))
{ {
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待 给服务器发送afterPutCutTask完成 " + "超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; MoveTimeoutAlarm(MoveInfo, "等待给服务器发送afterPutCutTask完成超时");
LogUtil.error(WarnMsg, DeviceID * 1000 + 20); //WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待 给服务器发送afterPutCutTask完成 " + "超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
Alarm(LineAlarmType.IoSingleTimeOut); //LogUtil.error(WarnMsg, DeviceID * 1000 + 20);
//Alarm(LineAlarmType.IoSingleTimeOut);
} }
} }
} }
......
...@@ -3,6 +3,7 @@ using OnlineStore.DeviceLibrary; ...@@ -3,6 +3,7 @@ using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -36,6 +37,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -36,6 +37,9 @@ namespace OnlineStore.DeviceLibrary
public DateTime LastSetpTime { get; set; } public DateTime LastSetpTime { get; set; }
public DateTime MoveStartTime { get; set; }
/// <summary> /// <summary>
/// =true表示满足一个等待条件,就可以完成此步骤的等待 /// =true表示满足一个等待条件,就可以完成此步骤的等待
/// </summary> /// </summary>
...@@ -82,6 +86,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -82,6 +86,22 @@ namespace OnlineStore.DeviceLibrary
{ {
get { return moveStep; } get { return moveStep; }
} }
public string GetStepDes()
{
string currName = moveStep.ToString();
try
{
if (LineManager.StepDesMap.ContainsKey(currName))
{
return LineManager.StepDesMap[currName];
}
}
catch (Exception ex)
{
LogUtil.error("GetStepDes 出错:" + ex.ToString());
}
return currName;
}
public string SLog public string SLog
{ {
get { return " "+MoveStep + " "; } get { return " "+MoveStep + " "; }
...@@ -100,8 +120,31 @@ namespace OnlineStore.DeviceLibrary ...@@ -100,8 +120,31 @@ namespace OnlineStore.DeviceLibrary
TimeSpan span = DateTime.Now - LastSetpTime; TimeSpan span = DateTime.Now - LastSetpTime;
return span; return span;
} }
public string GetMoveType()
{
switch (moveType)
{
case LineMoveType.CheckFixture:
return "托盘处理";
break;
case LineMoveType.InStore:
return "入料";
break;
case LineMoveType.OutStore:
return "出料";
break;
case LineMoveType.Reset :
return "复位";
break;
case LineMoveType.ReturnHome:
return "回原";
break;
}
return "";
}
public void NextMoveStep(LineMoveStep step) public void NextMoveStep(LineMoveStep step)
{ {
StepMoveLog();
PreMoveStep = moveStep; PreMoveStep = moveStep;
moveStep = step; moveStep = step;
LastSetpTime = DateTime.Now; LastSetpTime = DateTime.Now;
...@@ -111,6 +154,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -111,6 +154,18 @@ namespace OnlineStore.DeviceLibrary
OneWaitCanEndStep = false; OneWaitCanEndStep = false;
CanWhileCount = 5; CanWhileCount = 5;
} }
private void StepMoveLog()
{
try
{
RunLogUtil.MoveLog(new MoveLog(Name, GetMoveType(), GetStepDes(), LastSetpTime, DateTime.Now, MoveParam.PosId, MoveParam.WareCode));
}
catch (Exception ex)
{
}
}
/// <summary> /// <summary>
/// 当前步骤执行完成 /// 当前步骤执行完成
/// </summary> /// </summary>
...@@ -128,6 +183,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -128,6 +183,7 @@ namespace OnlineStore.DeviceLibrary
WaitList = new List<WaitResultInfo>(); WaitList = new List<WaitResultInfo>();
WriteIoList = new List<WriteIOInfo>(); WriteIoList = new List<WriteIOInfo>();
MoveNum++; MoveNum++;
MoveStartTime = DateTime.Now;
} }
public void NewMove(LineMoveType type, InOutParam param) public void NewMove(LineMoveType type, InOutParam param)
{ {
...@@ -137,9 +193,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -137,9 +193,11 @@ namespace OnlineStore.DeviceLibrary
LastSetpTime = DateTime.Now; LastSetpTime = DateTime.Now;
WaitList = new List<WaitResultInfo>(); WaitList = new List<WaitResultInfo>();
WriteIoList = new List<WriteIOInfo>(); WriteIoList = new List<WriteIOInfo>();
MoveStartTime = DateTime.Now;
} }
public void EndMove() public void EndMove()
{ {
StepMoveLog();
this.moveType = LineMoveType.None; this.moveType = LineMoveType.None;
this.MoveParam = null; this.MoveParam = null;
moveStep = LineMoveStep.Wait; moveStep = LineMoveStep.Wait;
...@@ -217,40 +275,40 @@ namespace OnlineStore.DeviceLibrary ...@@ -217,40 +275,40 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = false; wait.IsEnd = false;
return wait; return wait;
} }
public static WaitResultInfo WaitStell(byte slvAddr, int targetPosition, int speed) //public static WaitResultInfo WaitStell(byte slvAddr, int targetPosition, int speed)
{ //{
WaitResultInfo wait = new WaitResultInfo(); // WaitResultInfo wait = new WaitResultInfo();
wait.CanWhileMoveCount =10; // wait.CanWhileMoveCount =10;
wait.WaitType = WaitEnum.W004_StellMove; // wait.WaitType = WaitEnum.W004_StellMove;
wait.SlvAddr = slvAddr; // wait.SlvAddr = slvAddr;
wait.IsHomeMove = false; // wait.IsHomeMove = false;
wait.TargetPosition = targetPosition; // wait.TargetPosition = targetPosition;
wait.TargetSpeed = speed; // wait.TargetSpeed = speed;
wait.IsEnd = false; // wait.IsEnd = false;
return wait; // return wait;
} //}
public static WaitResultInfo WaitStellHome(byte slvAddr, int targetPosition, int speed) // public static WaitResultInfo WaitStellHome(byte slvAddr, int targetPosition, int speed)
{ //{
WaitResultInfo wait = new WaitResultInfo(); // WaitResultInfo wait = new WaitResultInfo();
wait.CanWhileMoveCount = 10; // wait.CanWhileMoveCount = 10;
wait.WaitType = WaitEnum.W004_StellMove; // wait.WaitType = WaitEnum.W004_StellMove;
wait.SlvAddr = slvAddr; // wait.SlvAddr = slvAddr;
wait.IsHomeMove = true; // wait.IsHomeMove = true;
wait.TargetPosition = 0; // wait.TargetPosition = 0;
wait.TargetSpeed = speed; // wait.TargetSpeed = speed;
wait.IsEnd = false; // wait.IsEnd = false;
return wait; // return wait;
} //}
public static WaitResultInfo WaitShuoKe(int slvAddr, int targetPosition, bool isHome) // public static WaitResultInfo WaitShuoKe(int slvAddr, int targetPosition, bool isHome)
{ // {
WaitResultInfo wait = new WaitResultInfo(); // WaitResultInfo wait = new WaitResultInfo();
wait.CanWhileMoveCount = 0; // wait.CanWhileMoveCount = 0;
wait.WaitType = WaitEnum.W005_ShuoKe; // wait.WaitType = WaitEnum.W005_ShuoKe;
wait.SlvAddr =(byte) slvAddr; // wait.SlvAddr =(byte) slvAddr;
wait.TargetPosition = targetPosition; // wait.TargetPosition = targetPosition;
wait.IsHomeMove = isHome; // wait.IsHomeMove = isHome;
return wait; // return wait;
} // }
public static WaitResultInfo WaitTime(int MScends) public static WaitResultInfo WaitTime(int MScends)
{ {
WaitResultInfo wait = new WaitResultInfo(); WaitResultInfo wait = new WaitResultInfo();
...@@ -572,10 +630,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -572,10 +630,6 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 移栽装置的停止,需要先远点返回,然后停止 /// 移栽装置的停止,需要先远点返回,然后停止
/// </summary> /// </summary>
StopMove = 5, StopMove = 5,
///// <summary>
///// 移栽检测托盘
///// </summary>
//CheckFixture=6,
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!