Commit d1886a64 张东亮

添加消息上报

1 个父辈 3be7d8f6
......@@ -80,6 +80,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="deviceLibrary\Msg.cs" />
<Compile Include="manager\agvClient\AgvClient.cs" />
<Compile Include="manager\agvClient\DoorInfo.cs" />
<Compile Include="manager\BufferDataManager.cs" />
......
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary.deviceLibrary
{
public class Msg
{
public static List<Msg> msg = new List<Msg>();
public string msgtxt;
public MsgLevel msgLevel;
public ErrInfo errInfo;
public DateTime datetime;
public static List<Msg> get()
{
if (_setlogones)
{
_setlogones = false;
foreach (var m in msg)
LogUtil.info(m.msgtxt);
}
List<Msg> mm = new List<Msg>(msg);
return mm;
}
public static void add(string m, MsgLevel ml, ErrInfo errInfo = ErrInfo.Empty)
{
lock (msg)
{
var fm = msg.Find((x) => x.msgtxt == m);
if (fm == null)
msg.Add(new Msg { msgtxt = m, msgLevel = ml, datetime = DateTime.Now, errInfo = errInfo });
}
}
static bool _setlogones = false;
internal static void setlogones()
{
_setlogones = true;
}
public static void clear()
{
msg.Clear();
}
}
public enum MsgLevel
{
warning,
info,
alarm,
critical,
}
public enum ErrInfo
{
Empty,
X09_BoxNotDetect,
ResetBtn,
RunBtn,
SuddenStop,
X09_Clear
}
}
using log4net;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary.deviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
......@@ -251,6 +252,10 @@ namespace OnlineStore.DeviceLibrary
}
}
WarnMsg = msg;
if(!string.IsNullOrEmpty(WarnMsg))
{
Msg.add(WarnMsg, MsgLevel.alarm);
}
}
public string GetRunStr( )
{
......

using OnlineStore.Common;
using OnlineStore.DeviceLibrary.deviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Concurrent;
......@@ -264,7 +265,7 @@ namespace OnlineStore.DeviceLibrary
if (alarmIo.Equals(1))
{
WarnMsg = Name + " " + axisInfo.AxisName + "报警";
Msg.add(WarnMsg, MsgLevel.alarm);
LogUtil.error(WarnMsg);
if (NeedAlarm)
......@@ -327,7 +328,7 @@ namespace OnlineStore.DeviceLibrary
{
isOk = false;
WarnMsg = Name + msg;
Msg.add(WarnMsg, MsgLevel.alarm);
Alarm(AlarmType.AxisMoveError);
LogUtil.error(WarnMsg, moveInfo.ErrorLogType, moveInfo.logSeconds());
break;
......@@ -351,7 +352,7 @@ namespace OnlineStore.DeviceLibrary
if (span.TotalSeconds > timeOutSeconds && alarmType <= AlarmType.IoSingleTimeOut)
{
ConfigIO io = baseConfig.getWaitIO(wait.IoType);
WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒";
WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 ";
LogUtil.error(WarnMsg, moveInfo.ErrorLogType, moveInfo.logSeconds());
if (NoAlarm())
......@@ -790,7 +791,7 @@ namespace OnlineStore.DeviceLibrary
}
protected void MoveTimeOut(DeviceMoveInfo move, string msg)
{
WarnMsg = move.Name + "[" + move.MoveStep + "] " + msg + " [" + FormUtil.GetSpanStr(move.StepSpan()) + "]";
WarnMsg = move.Name + "[" + move.MoveStep + "] " + msg + "超时";
int logId = DeviceID * 10000 + (int)move.MoveStep;
LogUtil.error(WarnMsg, logId);
Alarm(AlarmType.IoSingleTimeOut);
......
......@@ -253,7 +253,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (span.TotalSeconds > 120)
{
WarnMsg = Name + "[" + MoveInfo.MoveStep + "][" + msg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
WarnMsg = Name + "[" + MoveInfo.MoveStep + "][" + msg + "]已等待超过2分钟";
LogUtil.error(WarnMsg, MoveInfo.ErrorLogType);
Alarm(AlarmType.IoSingleTimeOut);
}
......@@ -472,7 +472,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (span.TotalSeconds > checkWaitInfo.TimeOutSeconds)
{
WarnMsg = checkWaitInfo.Name + "[" + checkWaitInfo.MoveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
WarnMsg = checkWaitInfo.Name + "[" + checkWaitInfo.MoveStep + "][" + NotOkMsg + "]超时";
LogUtil.error(WarnMsg, checkWaitInfo.ErrorLogType);
Alarm(AlarmType.IoSingleTimeOut);
}
......
using OnlineStore.Common;
using OnlineStore.DeviceLibrary.deviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Concurrent;
......@@ -962,24 +963,44 @@ namespace OnlineStore.DeviceLibrary
}
protected override void BaseTimerProcess()
{
if (isInSuddenDown || isNoAirpressure_Check)
{
return;
}
SecurityAccessProcess();
if (runStatus.Equals(RunStatus.Runing))
{
ExecuteOutListProcess();
}
if (isInitPosDebugInfo)
try
{
PosDebugProcess();
if (isInSuddenDown || isNoAirpressure_Check)
{
return;
}
SecurityAccessProcess();
if (runStatus.Equals(RunStatus.Runing))
{
ExecuteOutListProcess();
}
if (isInitPosDebugInfo)
{
PosDebugProcess();
}
BusyMoveProcess();
IOTimeOutProcess();
if (NoErrorAlarm())
{
CheckAxisAlarm();
}
var input = StoreManager.XLRStore?.inputEquip;
if (input != null)
{
if (!string.IsNullOrEmpty(input.InstoreNgMsg))
Msg.add(input.InstoreNgMsg, MsgLevel.warning);
if (!string.IsNullOrEmpty(input.WarnMsg))
{
Msg.add(input.WarnMsg, MsgLevel.warning);
}
}
}
BusyMoveProcess();
IOTimeOutProcess();
if (NoErrorAlarm())
catch (Exception ex) { LogUtil.error("boxequip BaseTimerProcess", ex); }
finally
{
CheckAxisAlarm();
ProcessMsg(Msg.get());
Msg.clear();
}
}
protected override void IOTimeOutProcess()
......
using Asa;
using log4net.Util;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary.deviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Concurrent;
......@@ -35,6 +36,7 @@ namespace OnlineStore.DeviceLibrary
private bool isInProcess = false;
private DateTime lastConTime = DateTime.Now;
object serverLoc = new object();
public string uploadMsg = "";
public void server_connect_timer_Tick(object sender, EventArgs e)
{
if (isInProcess)
......@@ -102,12 +104,12 @@ namespace OnlineStore.DeviceLibrary
{
if (operation.seq == resultOperation.seq)
{
LogUtil.info($"SendStoreState success,posid:{posid}, storeStatus:{storeStatus}");
LogUtil.info($"SendStoreState success,posid:{posid},barcode:{barcode}, storeStatus:{storeStatus}");
return true;
}
else
{
LogUtil.info($"SendStoreState error,posid:{posid}, storeStatus:{storeStatus}");
LogUtil.info($"SendStoreState error,posid:{posid},barcode:{barcode}, storeStatus:{storeStatus}");
Thread.Sleep(2000);
}
}
......@@ -125,6 +127,34 @@ namespace OnlineStore.DeviceLibrary
return false;
}
public void ProcessMsg(List<Msg> msg)
{
uploadMsg = string.Join(",", msg.Select(x =>
{
//if (x.msgLevel == MsgLevel.warning || x.msgLevel == MsgLevel.alarm)
{
return GetMsgPrefix(x.msgLevel) + x.msgtxt;
}
return null;
}
).Where(x => !string.IsNullOrEmpty(x)));
}
string GetMsgPrefix(MsgLevel msgLevel)
{
switch (msgLevel)
{
case MsgLevel.info:
return "I=";
case MsgLevel.warning:
return "W=";
case MsgLevel.alarm:
return "A=";
case MsgLevel.critical:
return "C=";
}
return "";
}
/// <summary>
/// 获取整个料仓的状态
/// </summary>
......@@ -137,30 +167,18 @@ namespace OnlineStore.DeviceLibrary
lineOperation.cid = CID;
lineOperation.seq = ConfigAppSettings.nextSeq();
lineOperation.status = 1;
var input = StoreManager.XLRStore?.inputEquip;
if (input != null && !string.IsNullOrEmpty(input.InstoreNgMsg))
{
WarnMsg = input.InstoreNgMsg;
}
else if (WarnMsg != "")
{
lineOperation.status = (int)DeviceStatus.Warning;
lineOperation.msg = $"W={WarnMsg}";
}
lineOperation.status = (int)DeviceStatus.StoreOnline;
BoxStatus boxStatus = new BoxStatus();
lineOperation.msg = uploadMsg;
boxStatus.boxId = 1;
boxStatus.msg = $"W={WarnMsg}"; ;
lineOperation.msg = $"W={WarnMsg}"; ;
if (WarnMsg.Equals(""))
{
boxStatus.msg = CodeMsg;
lineOperation.msg = CodeMsg;
}
CodeMsg = "";
boxStatus.msg = uploadMsg;
//if (WarnMsg.Equals(""))
//{
// boxStatus.msg = CodeMsg;
// lineOperation.msg = CodeMsg;
//}
//CodeMsg = "";
//WarnMsg = "";
//状态
boxStatus.status = (int)deviceStatus;
......@@ -396,7 +414,7 @@ namespace OnlineStore.DeviceLibrary
if (position == null)
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = Name + "未找到库位:【" + inoutParam.PosInfo.ToStr() + "】";
Msg.add(Name + "未找到库位:【" + inoutParam.PosInfo.ToStr() + "】", MsgLevel.warning);
LogUtil.error(WarnMsg);
continue;
}
......
using CodeLibrary;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary.deviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
......@@ -271,7 +272,10 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SI_05_GetReel:
if (!CheckReel(true))
{
WarnMsg = $"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查";
WarnMsg= $"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查";
Msg.add(WarnMsg, MsgLevel.critical);
return;
}
ignoreCurFork = false;
......@@ -335,6 +339,7 @@ namespace OnlineStore.DeviceLibrary
if (!CheckReel(true))
{
WarnMsg = $"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查";
Msg.add(WarnMsg, MsgLevel.critical);
return;
}
ignoreCurFork = false;
......@@ -348,6 +353,7 @@ namespace OnlineStore.DeviceLibrary
if (!CheckReel(true))
{
WarnMsg = $"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查";
Msg.add(WarnMsg, MsgLevel.critical);
return;
}
ignoreCurFork = false;
......@@ -391,6 +397,7 @@ namespace OnlineStore.DeviceLibrary
if (!CheckReel(true))
{
WarnMsg = $"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查";
Msg.add(WarnMsg, MsgLevel.critical);
return;
}
ignoreCurFork = false;
......@@ -404,6 +411,9 @@ namespace OnlineStore.DeviceLibrary
ComAxis_To_P2();
break;
case StepEnum.SI_14_ReleaseCompress:
if (!StoreManager.XLRStore.boxEquip.SendStoreState(MoveInfo.MoveParam.PosInfo.PosId, MoveInfo.MoveParam.PosInfo.barcode, DeviceStatus.InStoreEnd))
return;
Msg.add($"入库完成:【{MoveInfo.MoveParam.PosInfo.PosId}】【{MoveInfo.MoveParam.PosInfo.barcode}】【{DeviceStatus.InStoreEnd}】", MsgLevel.info);
MoveInfo.NextMoveStep(StepEnum.SI_15_UpDownBack);
LogInfo($"入库 {MoveInfo.SLog}:叉子从库位返回,[{MoveInfo.MoveParam.PosInfo.ToStr()}]入库完成,移栽升降轴到抽屉上方过度点P6/P12[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
//入库完成
......
using CodeLibrary;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary.deviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
......@@ -175,6 +176,7 @@ namespace OnlineStore.DeviceLibrary
if (!CheckReel(true))
{
WarnMsg = $"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查";
Msg.add(WarnMsg,MsgLevel.critical);
return;
}
ignoreCurFork = false;
......@@ -244,6 +246,7 @@ namespace OnlineStore.DeviceLibrary
if (!CheckReel(true))
{
WarnMsg = $"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查";
Msg.add(WarnMsg, MsgLevel.critical);
return;
}
ignoreCurFork = false;
......@@ -255,6 +258,7 @@ namespace OnlineStore.DeviceLibrary
if (!CheckReel(true))
{
WarnMsg = $"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查";
Msg.add(WarnMsg,MsgLevel.critical);
return;
}
ignoreCurFork = false;
......@@ -304,6 +308,7 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SO_18_PutReel:
if (!StoreManager.XLRStore.boxEquip.SendStoreState(MoveInfo.MoveParam.PosInfo.PosId, MoveInfo.MoveParam.PosInfo.barcode, DeviceStatus.OutStoreBoxEnd))
return;
Msg.add($"出库完成:【{MoveInfo.MoveParam.PosInfo.PosId}】【{MoveInfo.MoveParam.PosInfo.barcode}】【{DeviceStatus.OutStoreBoxEnd}】",MsgLevel.info);
MoveInfo.NextMoveStep(StepEnum.SO_19_InOutBackFromBuff);
LogInfo($"出库 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.ToStr()}]出库完成[耗时:{(DateTime.Now - startTime).TotalSeconds.ToString("f2")}秒],移栽X轴到待机点P1,行走机构到待机点P1[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
XAxis_To_P1();
......
using CodeLibrary;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary.deviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
......@@ -34,6 +35,7 @@ namespace OnlineStore.DeviceLibrary
if (!CheckBothReel(true))
{
WarnMsg = $"两面料叉上存在未检测到料盘,请检查";
Msg.add(WarnMsg, MsgLevel.critical);
return;
}
ignoreCurFork = false;
......@@ -93,6 +95,7 @@ namespace OnlineStore.DeviceLibrary
if (!CheckBothReel(false))
{
WarnMsg = $"两面料叉上还能检测到料盘,请检查";
Msg.add(WarnMsg, MsgLevel.critical);
return;
}
ignoreCurFork = false;
......
......@@ -959,7 +959,7 @@ namespace OnlineStore.DeviceLibrary
this.lastPosId = lastPosId;
this.lastBarcode = lastBarcode;
}
LogInfo($"设置状态:deviceStatus【{deviceStatus}】,runStatus=【{runStatus}】,lastPosId=【{lastPosId}】lastBarcode=【{lastBarcode}】");
this.deviceStatus = deviceStatus;
this.runStatus = runStatus;
}
......
using Asa;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary.deviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
......@@ -1163,6 +1164,7 @@ namespace OnlineStore.DeviceLibrary
{
if (!StoreManager.XLRStore.boxEquip.SendStoreState(MoveInfo.MoveParam.PosInfo.PosId, MoveInfo.MoveParam.PosInfo.barcode, DeviceStatus.OutStoreEnd))
return;
Msg.add($"出库完成:【{MoveInfo.MoveParam.PosInfo.PosId}】【{MoveInfo.MoveParam.PosInfo.barcode}】【{DeviceStatus.OutStoreEnd}】", MsgLevel.info);
if (shelf.Equals(1))
{
......@@ -1283,6 +1285,7 @@ namespace OnlineStore.DeviceLibrary
{
if (!StoreManager.XLRStore.boxEquip.SendStoreState(MoveInfo.MoveParam.PosInfo.PosId, MoveInfo.MoveParam.PosInfo.barcode, DeviceStatus.OutStoreEnd))
return;
Msg.add($"出库完成:紧急料【{MoveInfo.MoveParam.PosInfo.PosId}】【{MoveInfo.MoveParam.PosInfo.barcode}】【{DeviceStatus.OutStoreEnd}】", MsgLevel.info);
MoveInfo.NextMoveStep(StepEnum.I039_UpdownToP18);
MoveLog($" 出料->紧急箱 {MoveInfo.SLog}: 升降轴到P18(紧急料区放料高点){Config.Updown_P18_NGH}");
UpdownAxis.AbsMove(MoveInfo, Config.Updown_P18_NGH, Config.Updown_P18_Speed);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!