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();
......
...@@ -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;
} }
...@@ -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>();
...@@ -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)
......
...@@ -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();
} }
} }
...@@ -449,20 +449,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -449,20 +449,19 @@ namespace OnlineStore.DeviceLibrary
{ {
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);
} }
} }
} }
...@@ -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))
...@@ -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.Common; ...@@ -3,6 +3,7 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -24,8 +25,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -24,8 +25,11 @@ namespace OnlineStore.DeviceLibrary
public LineManager() public LineManager()
{ {
} }
public static void CheckEnum(Type type) public static Dictionary<string, string> StepDesMap = new Dictionary<string, string>();
public static void CheckEnum(Type type, bool isStep = false)
{ {
if (type.IsEnum) if (type.IsEnum)
{ {
List<int> valueList = new List<int>(); List<int> valueList = new List<int>();
...@@ -34,11 +38,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -34,11 +38,18 @@ namespace OnlineStore.DeviceLibrary
{ {
if (valueList.Contains(item)) if (valueList.Contains(item))
{ {
LogUtil.error( type.Name + "枚举值:" + item + "重复存在,请检查代码!程序退出。"); LogUtil.error(type.Name + "枚举值:" + item + "重复存在,请检查代码!程序退出。");
Application.Exit(); Application.Exit();
break; break;
} }
valueList.Add(item); valueList.Add(item);
if (isStep)
{
LineMoveStep en = (LineMoveStep)item;
string des = EnumDesHelper.GetStepDes(en);
StepDesMap.Add(en.ToString(), des);
}
} }
} }
} }
...@@ -72,13 +83,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -72,13 +83,13 @@ namespace OnlineStore.DeviceLibrary
{ {
IsConnectServer = true; IsConnectServer = true;
} }
CheckEnum(typeof(LineMoveStep)); CheckEnum(typeof(LineMoveStep), true);
CheckEnum(typeof(LineStatus)); CheckEnum(typeof(LineStatus));
CheckEnum(typeof(LineRunStatus)); CheckEnum(typeof(LineRunStatus));
isInit = true; isInit = true;
string lineType = ConfigAppSettings.GetValue(Setting_Init.Line_Type); string lineType = ConfigAppSettings.GetValue(Setting_Init.Line_Type);
LogUtil.info( " 类型=" + lineType + ",开始加载 配置"); LogUtil.info(" 类型=" + lineType + ",开始加载 配置");
if (lineType == DeviceType.Line) if (lineType == DeviceType.Line)
{ {
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
...@@ -93,7 +104,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -93,7 +104,7 @@ namespace OnlineStore.DeviceLibrary
{ {
string nameStr = i.ToString().PadLeft(2, '0'); string nameStr = i.ToString().PadLeft(2, '0');
string config = appPath + moveEquipConfig.Replace(".csv", "_" + nameStr + ".csv"); string config = appPath + moveEquipConfig.Replace(".csv", "_" + nameStr + ".csv");
MoveEquip_Config moveConfig = CSVConfigReader.LoadMoveConfig(i,DeviceType.MoveEquip, config); MoveEquip_Config moveConfig = CSVConfigReader.LoadMoveConfig(i, DeviceType.MoveEquip, config);
int subType = i; int subType = i;
// moveConfig.SetIO(subType); // moveConfig.SetIO(subType);
moveECMap.Add(i, moveConfig); moveECMap.Add(i, moveConfig);
...@@ -111,7 +122,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -111,7 +122,7 @@ namespace OnlineStore.DeviceLibrary
{ {
int subType = 100 + i; int subType = 100 + i;
string config = appPath + feedingEquipConfig.Replace(".csv", "_" + i + ".csv"); string config = appPath + feedingEquipConfig.Replace(".csv", "_" + i + ".csv");
FeedingEquip_Config moveConfig = CSVConfigReader.LoadFeedingConfig(subType,DeviceType.FeedingEquip, config); FeedingEquip_Config moveConfig = CSVConfigReader.LoadFeedingConfig(subType, DeviceType.FeedingEquip, config);
moveConfig.SetIO(subType); moveConfig.SetIO(subType);
feedingECMap.Add(subType, moveConfig); feedingECMap.Add(subType, moveConfig);
allConfigMap.Add(subType, moveConfig); allConfigMap.Add(subType, moveConfig);
...@@ -123,7 +134,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -123,7 +134,7 @@ namespace OnlineStore.DeviceLibrary
{ {
int subType = 200 + i; int subType = 200 + i;
string config = appPath + providingEquipConfig.Replace(".csv", "_" + i + ".csv"); string config = appPath + providingEquipConfig.Replace(".csv", "_" + i + ".csv");
ProvidingEquip_Config moveConfig = CSVConfigReader.LoadProvidingConfig(subType,DeviceType.ProvidingEquip, config); ProvidingEquip_Config moveConfig = CSVConfigReader.LoadProvidingConfig(subType, DeviceType.ProvidingEquip, config);
moveConfig.SetIO(subType); moveConfig.SetIO(subType);
providingECMap.Add(subType, moveConfig); providingECMap.Add(subType, moveConfig);
allConfigMap.Add(subType, moveConfig); allConfigMap.Add(subType, moveConfig);
...@@ -135,7 +146,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -135,7 +146,7 @@ namespace OnlineStore.DeviceLibrary
{ {
int subType = 300 + i; int subType = 300 + i;
string config = appPath + dischargeLineConfig.Replace(".csv", "_" + i + ".csv"); string config = appPath + dischargeLineConfig.Replace(".csv", "_" + i + ".csv");
DischargeLine_Config moveConfig = CSVConfigReader.LoadDischargeLineConfig(subType,DeviceType.DischargeLine, config); DischargeLine_Config moveConfig = CSVConfigReader.LoadDischargeLineConfig(subType, DeviceType.DischargeLine, config);
moveConfig.SetIO(subType); moveConfig.SetIO(subType);
disChargeLineMap.Add(subType, moveConfig); disChargeLineMap.Add(subType, moveConfig);
allConfigMap.Add(subType, moveConfig); allConfigMap.Add(subType, moveConfig);
...@@ -143,7 +154,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -143,7 +154,7 @@ namespace OnlineStore.DeviceLibrary
Config.SetIO(1000); Config.SetIO(1000);
Line = new LineBean(Config, moveECMap, feedingECMap, providingECMap, disChargeLineMap); Line = new LineBean(Config, moveECMap, feedingECMap, providingECMap, disChargeLineMap);
LoadTrayCheck(); LoadTrayCheck();
LogUtil.info( "加载 完成!"); LogUtil.info("加载 完成!");
return true; return true;
} }
} }
...@@ -154,7 +165,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -154,7 +165,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("出错:",ex); LogUtil.error("出错:", ex);
MessageBox.Show(ex.ToString(), "加载配置错误(请检查配置)"); MessageBox.Show(ex.ToString(), "加载配置错误(请检查配置)");
Application.Exit(); Application.Exit();
} }
...@@ -169,9 +180,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -169,9 +180,9 @@ namespace OnlineStore.DeviceLibrary
//位置配置到文件中 //位置配置到文件中
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
string moveEquipConfig = ConfigAppSettings.GetValue(Setting_Init.ConfigPath_MoveEquip); string moveEquipConfig = ConfigAppSettings.GetValue(Setting_Init.ConfigPath_MoveEquip);
string configStr = appPath + moveEquipConfig.Replace(".csv", "_" + config.Id.ToString().PadLeft(2,'0') + ".csv"); string configStr = appPath + moveEquipConfig.Replace(".csv", "_" + config.Id.ToString().PadLeft(2, '0') + ".csv");
allConfigMap[config.Id] = config; allConfigMap[config.Id] = config;
bool result = CSVConfigReader.SaveConfig(configStr, config,typeof(MoveEquip_Config)); bool result = CSVConfigReader.SaveConfig(configStr, config, typeof(MoveEquip_Config));
if (!result) if (!result)
{ {
LogUtil.error("保存配置文件失败:" + configStr); LogUtil.error("保存配置文件失败:" + configStr);
...@@ -179,7 +190,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -179,7 +190,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("出错:",ex); LogUtil.error("出错:", ex);
} }
} }
public static void SaveFeedingEquipConfig(FeedingEquip_Config config) public static void SaveFeedingEquipConfig(FeedingEquip_Config config)
...@@ -191,9 +202,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -191,9 +202,9 @@ namespace OnlineStore.DeviceLibrary
string moveEquipConfig = ConfigAppSettings.GetValue(Setting_Init.ConfigPath_FeedingEquip); string moveEquipConfig = ConfigAppSettings.GetValue(Setting_Init.ConfigPath_FeedingEquip);
int id = config.Id - 100; int id = config.Id - 100;
string configStr = appPath + moveEquipConfig.Replace(".csv", "_" + id+ ".csv"); string configStr = appPath + moveEquipConfig.Replace(".csv", "_" + id + ".csv");
allConfigMap[config.Id] = config; allConfigMap[config.Id] = config;
bool result = CSVConfigReader.SaveConfig(configStr, config,typeof(FeedingEquip_Config)); bool result = CSVConfigReader.SaveConfig(configStr, config, typeof(FeedingEquip_Config));
if (!result) if (!result)
{ {
LogUtil.error("保存配置文件失败:" + configStr); LogUtil.error("保存配置文件失败:" + configStr);
...@@ -201,7 +212,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -201,7 +212,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("出错:",ex); LogUtil.error("出错:", ex);
} }
} }
public static void SaveProvidingEquipConfig(ProvidingEquip_Config config) public static void SaveProvidingEquipConfig(ProvidingEquip_Config config)
...@@ -214,7 +225,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -214,7 +225,7 @@ namespace OnlineStore.DeviceLibrary
int id = config.Id - 200; int id = config.Id - 200;
string configStr = appPath + moveEquipConfig.Replace(".csv", "_" + id + ".csv"); string configStr = appPath + moveEquipConfig.Replace(".csv", "_" + id + ".csv");
allConfigMap[config.Id] = config; allConfigMap[config.Id] = config;
bool result = CSVConfigReader.SaveConfig(configStr, config,typeof(ProvidingEquip_Config)); bool result = CSVConfigReader.SaveConfig(configStr, config, typeof(ProvidingEquip_Config));
if (!result) if (!result)
{ {
LogUtil.error("保存配置文件失败:" + configStr); LogUtil.error("保存配置文件失败:" + configStr);
...@@ -222,7 +233,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -222,7 +233,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("出错:",ex); LogUtil.error("出错:", ex);
} }
} }
...@@ -245,7 +256,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -245,7 +256,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("出错:",ex); LogUtil.error("出错:", ex);
} }
} }
...@@ -262,7 +273,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -262,7 +273,7 @@ namespace OnlineStore.DeviceLibrary
{ {
string config = ConfigAppSettings.GetValue(Setting_Init.UseTrayCheck); string config = ConfigAppSettings.GetValue(Setting_Init.UseTrayCheck);
string[] array = config.Split(','); string[] array = config.Split(',');
foreach(string st in array) foreach (string st in array)
{ {
try try
{ {
...@@ -284,7 +295,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -284,7 +295,7 @@ namespace OnlineStore.DeviceLibrary
} }
useTrayCheck.Add(id); useTrayCheck.Add(id);
string config = ""; string config = "";
foreach(int i in useTrayCheck) foreach (int i in useTrayCheck)
{ {
config += i + ","; config += i + ",";
} }
......
...@@ -28,10 +28,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -28,10 +28,9 @@ namespace OnlineStore.DeviceLibrary
/// 9=出库执行,10=出仓完成,11=出库失败 /// 9=出库执行,10=出仓完成,11=出库失败
/// </summary> /// </summary>
public LineStatus lineStatus = LineStatus.ResetMove; public LineStatus lineStatus = LineStatus.ResetMove;
/// <summary>
/// 提示消息,一般发给服务器后清空(LineBean表示报警提示消息,BoxBean表示出入库失败的原因记录)
/// </summary>
public string WarnMsg = ""; public string WarnMsg = "";
private WarnParam warnParam = new WarnParam();
public DeviceConfig baseConfig = null; public DeviceConfig baseConfig = null;
public string Name { get; set; } public string Name { get; set; }
public int DeviceID { get; set; } public int DeviceID { get; set; }
...@@ -132,7 +131,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -132,7 +131,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("BusyMoveProcess出错:",ex); LogUtil.error("BusyMoveProcess出错:", ex);
} }
isInPro = false; isInPro = false;
} }
...@@ -198,9 +197,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -198,9 +197,9 @@ namespace OnlineStore.DeviceLibrary
} }
if (alarmType.Equals(LineAlarmType.None)) if (alarmType.Equals(LineAlarmType.None))
{ {
return true ; return true;
} }
return false ; return false;
} }
/// <summary> /// <summary>
/// 开始运行 /// 开始运行
...@@ -214,7 +213,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -214,7 +213,7 @@ namespace OnlineStore.DeviceLibrary
/// 报警 /// 报警
/// </summary> /// </summary>
/// <param name="alarmType"></param> /// <param name="alarmType"></param>
public abstract void Alarm(LineAlarmType alarmType ); public abstract void Alarm(LineAlarmType alarmType);
/// <summary> /// <summary>
/// 重置(夹料装置状态不变) /// 重置(夹料装置状态不变)
/// </summary> /// </summary>
...@@ -223,7 +222,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -223,7 +222,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 停止所有运动 /// 停止所有运动
/// </summary> /// </summary>
internal abstract void StopMove( ); internal abstract void StopMove();
/// <summary> /// <summary>
/// 重置处理 /// 重置处理
...@@ -273,37 +272,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -273,37 +272,8 @@ namespace OnlineStore.DeviceLibrary
protected abstract void InStoreProcess(); protected abstract void InStoreProcess();
#endregion #endregion
public void SetWarnMsg(string msg = "")
{
if (String.IsNullOrEmpty(msg).Equals(false))
{
if (WarnMsg.Equals(msg))
{
if (msg.StartsWith(Name))
{
LogUtil.error(msg, 801);
}
else
{
LogUtil.error(Name + msg, 801);
}
}
else
{
if (msg.StartsWith(Name))
{
LogUtil.error(msg);
}
else
{
LogUtil.error(Name + msg);
}
}
}
WarnMsg = msg; public string GetRunStr()
}
public string GetRunStr( )
{ {
string sta = "运行中"; string sta = "运行中";
string aa = ""; string aa = "";
...@@ -368,7 +338,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -368,7 +338,7 @@ namespace OnlineStore.DeviceLibrary
if (isInSuddenDown) if (isInSuddenDown)
{ {
aa = "急停中"; aa = "急停中";
}else if (isNoAirCheck) } else if (isNoAirCheck)
{ {
aa = "无气压信号"; aa = "无气压信号";
} }
...@@ -457,7 +427,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -457,7 +427,7 @@ namespace OnlineStore.DeviceLibrary
} }
public bool CylinderIsOk(string IoLowType, string IoHighType) public bool CylinderIsOk(string IoLowType, string IoHighType)
{ {
if (IOManager.DIValue(IoLowType,DeviceID).Equals(IO_VALUE.LOW) && IOManager.DIValue(IoHighType, DeviceID).Equals(IO_VALUE.HIGH)){ if (IOManager.DIValue(IoLowType, DeviceID).Equals(IO_VALUE.LOW) && IOManager.DIValue(IoHighType, DeviceID).Equals(IO_VALUE.HIGH)) {
return true; return true;
} }
return false; return false;
...@@ -520,9 +490,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -520,9 +490,9 @@ namespace OnlineStore.DeviceLibrary
IOMove(IoLowType, IO_VALUE.LOW); IOMove(IoLowType, IO_VALUE.LOW);
IOMove(IoHighType, IO_VALUE.HIGH); IOMove(IoHighType, IO_VALUE.HIGH);
} }
}catch(Exception ex) } catch (Exception ex)
{ {
LogUtil.error(Name + "CylinderMove ["+moveInfo.Name+"] ["+IoLowType+"] ["+IoHighType+"] ["+isCheckMove+"] 出错:"+ex.ToString()); LogUtil.error(Name + "CylinderMove [" + moveInfo.Name + "] [" + IoLowType + "] [" + IoHighType + "] [" + isCheckMove + "] 出错:" + ex.ToString());
} }
} }
...@@ -555,7 +525,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -555,7 +525,7 @@ namespace OnlineStore.DeviceLibrary
IO_VALUE tValue = value.Equals(IO_VALUE.HIGH) ? IO_VALUE.LOW : IO_VALUE.HIGH; IO_VALUE tValue = value.Equals(IO_VALUE.HIGH) ? IO_VALUE.LOW : IO_VALUE.HIGH;
if (IOValue(IoType).Equals(tValue).Equals(false)) if (IOValue(IoType).Equals(tValue).Equals(false))
{ {
if (IoType.Equals(IO_Type.StopCylinder_Down1).Equals(false)&&IoType.Equals(IO_Type.SW_StopDown).Equals(false)) if (IoType.Equals(IO_Type.StopCylinder_Down1).Equals(false) && IoType.Equals(IO_Type.SW_StopDown).Equals(false))
{ {
LogUtil.info(Name + "定时回写IO: [" + IoType + "]=[" + value + "],[" + baseConfig.Id + "],msTime=" + msTime); LogUtil.info(Name + "定时回写IO: [" + IoType + "]=[" + value + "],[" + baseConfig.Id + "],msTime=" + msTime);
} }
...@@ -601,6 +571,143 @@ namespace OnlineStore.DeviceLibrary ...@@ -601,6 +571,143 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
} }
/// <summary>
/// 设置报警消息,报警类型,清除报警时记录日志
/// </summary>
/// <param name="msg"></param>
/// <param name="logtype"></param>
/// <param name="logseconds"></param>
public void SetWarnMsg(string msg = "", string alarmType = "", LineMoveInfo moveInfo = null, int logseconds = 10)
{
int logtype = 801;
if (moveInfo != null)
{
logtype = DeviceID * 10000 + (int)moveInfo.MoveStep;
}
if (String.IsNullOrEmpty(msg).Equals(false))
{
if (WarnMsg.Equals(msg))
{
if (msg.StartsWith(Name))
{
LogUtil.error(msg, logtype, logseconds);
}
else
{
LogUtil.error(Name + msg, logtype, logseconds);
}
}
else
{
if (msg.StartsWith(Name))
{
LogUtil.error(msg);
}
else
{
LogUtil.error(Name + msg);
}
}
}
if (!warnParam.AlarmType.Equals(alarmType))
{
//报警类型不一致,若之前不是空,记录日志
if (!String.IsNullOrEmpty(warnParam.AlarmType))
{
RunLogUtil.ErrorLog(new ErrorLog(Name, warnParam.AlarmType, WarnMsg, warnParam.StartTime, DateTime.Now, warnParam.OperteType, warnParam.PosId, warnParam.Barcode));
}
//更新开始时间
warnParam.StartTime = DateTime.Now;
if (moveInfo != null)
{
warnParam.PosId = moveInfo.MoveParam?.PosId;
warnParam.Barcode = moveInfo.MoveParam?.WareCode;
warnParam.OperteType = moveInfo.GetMoveType();
}
else
{
warnParam.PosId = "";
warnParam.Barcode = "";
warnParam.OperteType = "";
}
}
WarnMsg = msg;
warnParam.AlarmType = alarmType;
}
protected void MoveTimeoutAlarm(LineMoveInfo move, string alarmType)
{
SetWarnMsg(move.Name + "[" + move.GetMoveType() + "][" + move.SLog + "] " + alarmType + " [" + FormUtil.GetSpanStr(move.StepSpan()) + "]", alarmType, move);
Alarm(LineAlarmType.IoSingleTimeOut);
}
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 void ClearStepAlarm(string stepDes)
{
if (isInSuddenDown || isNoAirCheck)
{
return;
}
if (String.IsNullOrEmpty(WarnMsg).Equals(false) && String.IsNullOrEmpty(warnParam.AlarmType).Equals(false))
{
if (alarmType.Equals(LineAlarmType.IoSingleTimeOut)){
string alarmTypeStr = stepDes + "_超时报警";
if (warnParam.AlarmType.Equals(alarmTypeStr))
{
LogUtil.info(Name + $"步骤{stepDes}结束,清理【{ WarnMsg }】 ");
alarmType = LineAlarmType.None;
SetWarnMsg("");
}
} else if (alarmType.Equals(LineAlarmType.AxisMoveError))
{
string alarmTypeStr = stepDes + "_轴运动报警";
if (warnParam.AlarmType.Equals(alarmTypeStr))
{
LogUtil.info(Name + $"步骤{stepDes}结束,清理【{ WarnMsg }】 ");
alarmType = LineAlarmType.None;
SetWarnMsg("");
}
}
}
}
}
public class WarnParam
{
public WarnParam()
{
}
public WarnParam(string alarmType ,DateTime startTime,string operType,string posId,string barcode)
{
this.AlarmType = alarmType;
this.StartTime = startTime;
this.OperteType = operType;
this.PosId = posId;
this.Barcode = barcode;
}
public string AlarmType = "";
public DateTime StartTime = DateTime.Now;
public string OperteType = "";
public string PosId = "";
public string Barcode = "";
} }
} }
...@@ -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();
...@@ -573,9 +631,5 @@ namespace OnlineStore.DeviceLibrary ...@@ -573,9 +631,5 @@ namespace OnlineStore.DeviceLibrary
/// 移栽装置的停止,需要先远点返回,然后停止 /// 移栽装置的停止,需要先远点返回,然后停止
/// </summary> /// </summary>
StopMove = 5, StopMove = 5,
///// <summary>
///// 移栽检测托盘
///// </summary>
//CheckFixture=6,
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!