Commit bf97d423 LN

报警消息WarnMsg 改为WarnIfo对象。

1 个父辈 b6d40e83
......@@ -260,8 +260,8 @@ namespace OnlineStore.AutoInOutStore
return;
}
lblTemp.Text = store.currTempStr;
lblBatchMsg.Text = AutomaticBaiting.WarnMsg;
lblWarnMsg.Text = store.WarnMsg;
lblBatchMsg.Text = AutomaticBaiting.WarnObj.WarnMsg;
lblWarnMsg.Text = store.WarnObj.WarnMsg ;
BatchInoutStatus();
//忙碌状态不读取状态
if (!store.storeRunStatus.Equals(StoreRunStatus.Busy))
......
......@@ -253,16 +253,16 @@
<value>Alarm</value>
</data>
<data name="InStoreError" xml:space="preserve">
<value>Saving format error</value>
<value>Saving format error:code [{0}] posId [{1}]</value>
</data>
<data name="InStoreNoPosition" xml:space="preserve">
<value>Saving location not found</value>
<value>Saving location not found:code [{0}] posId [{1}]</value>
</data>
<data name="OutStoreError" xml:space="preserve">
<value>Providing format error</value>
<value>Providing format error{0}</value>
</data>
<data name="OutStoreNoPosition" xml:space="preserve">
<value>Providing location not found</value>
<value>Providing location not found{0}</value>
</data>
<data name="AbsMove" xml:space="preserve">
<value>Absolute move</value>
......@@ -875,7 +875,7 @@
<value>Access controller block</value>
</data>
<data name="Y16" xml:space="preserve">
<value >alarm buzzer</value>
<value>alarm buzzer</value>
</data>
<data name="X21" xml:space="preserve">
<value>Feeding door close</value>
......@@ -1153,7 +1153,6 @@
<data name="startFailAir" xml:space="preserve">
<value>Startup failure: no air pressure signal</value>
</data>
<data name="FrmStoreBox_groupAuto_Text" xml:space="preserve">
<value>auto storing</value>
</data>
......@@ -1190,7 +1189,6 @@
<data name="禁用调试" xml:space="preserve">
<value>Disable debugging</value>
</data>
<data name="X25" xml:space="preserve">
<value>Doorlock cylinder open 2</value>
</data>
......@@ -1221,4 +1219,31 @@
<data name="自动出入库操作" xml:space="preserve">
<value>Auto providing operation</value>
</data>
<data name="AxisAlarm" xml:space="preserve">
<value>Motion axis {0} alarm</value>
</data>
<data name="OpenAxisFail" xml:space="preserve">
<value>Failed to open axis {0}</value>
</data>
<data name="AxisHomeMoveAlarm" xml:space="preserve">
<value>The movement {0} axis {1} receives the origin completion signal, the current position [{2}], the error is too large, it needs to alarm</value>
</data>
<data name="AxisMoveAlarm" xml:space="preserve">
<value>Movement {0} axis {1} target position [{2}] current position {3} error is too large, need to alarm</value>
</data>
<data name="MoveTimeOut" xml:space="preserve">
<value>[{0}]Timeout{1}[{2}]</value>
</data>
<data name="WaitSingleTimeOut" xml:space="preserve">
<value>Wait signal {0}={1} timeout</value>
</data>
<data name="WaitInstoreTimeOut" xml:space="preserve">
<value>[{0}] timeout [wait to store][{1} seconds]</value>
</data>
<data name="InStoreNoCode" xml:space="preserve">
<value>The qr code is not scanned, the material plate needs to be sent out</value>
</data>
<data name="NoCodeMsg" xml:space="preserve">
<value>If the qr code is not scanned, please put it back into the material tray</value>
</data>
</root>
\ No newline at end of file
......@@ -253,16 +253,16 @@
<value>报警</value>
</data>
<data name="InStoreError" xml:space="preserve">
<value>入库库位格式错误:</value>
<value>入库库位格式错误条码[{0}]库位号[{1}]</value>
</data>
<data name="InStoreNoPosition" xml:space="preserve">
<value>入库未找到库位:</value>
<value>入库未找到库位:条码[{0}]库位号[{1}]</value>
</data>
<data name="OutStoreError" xml:space="preserve">
<value>出库格式错误:</value>
<value>出库格式错误{0}</value>
</data>
<data name="OutStoreNoPosition" xml:space="preserve">
<value>出库未找库位:</value>
<value>出库未找库位:{0}</value>
</data>
<data name="AbsMove" xml:space="preserve">
<value>绝对运动</value>
......@@ -871,7 +871,7 @@
<value>门禁功能屏蔽</value>
</data>
<data name="Y16" xml:space="preserve">
<value >报警蜂鸣器</value>
<value>报警蜂鸣器</value>
</data>
<data name="X21" xml:space="preserve">
<value>上料机构门关闭</value>
......@@ -1188,8 +1188,6 @@
<data name="禁用调试" xml:space="preserve">
<value>禁用调试</value>
</data>
<data name="X25" xml:space="preserve">
<value>门锁气缸打开端2</value>
</data>
......@@ -1220,4 +1218,31 @@
<data name="自动出入库操作" xml:space="preserve">
<value>自动出入库操作</value>
</data>
<data name="AxisAlarm" xml:space="preserve">
<value>运动轴{0}报警</value>
</data>
<data name="OpenAxisFail" xml:space="preserve">
<value>打开轴{0}失败</value>
</data>
<data name="AxisHomeMoveAlarm" xml:space="preserve">
<value>运动{0}轴{1}收到原点完成信号,当前位置[{2}],误差过大,需要报警</value>
</data>
<data name="AxisMoveAlarm" xml:space="preserve">
<value>运动{0}轴{1}目标位置[{2}]当前位置{3}误差过大,需要报警</value>
</data>
<data name="MoveTimeOut" xml:space="preserve">
<value>[{0}]超时{1}[{2}]</value>
</data>
<data name="WaitSingleTimeOut" xml:space="preserve">
<value>等待信号{0}={1}超时</value>
</data>
<data name="WaitInstoreTimeOut" xml:space="preserve">
<value>[{0}]超时[等待可以入库][{1}秒]</value>
</data>
<data name="InStoreNoCode" xml:space="preserve">
<value>未扫到二维码,需要将料盘送出</value>
</data>
<data name="NoCodeMsg" xml:space="preserve">
<value>未扫到二维码,请重新放入料盘</value>
</data>
</root>
\ No newline at end of file
......@@ -210,6 +210,7 @@ IO模块读取时间改为可配置。
20190610
部分中英文修改。
20190613
报警消息WarnMsg 改为WarnIfo对象。
......@@ -64,6 +64,14 @@ namespace OnlineStore.Common
/// </summary>
public string msg { get; set; }
/// <summary>
///提示消息类型
/// </summary>
public string msgCode { get; set; }
/// <summary>
/// 消息参数
/// </summary>
public string[] msgParam { get; set; }
/// <summary>
/// 包含的多个 BOX 的状态信息
/// </summary>
public Dictionary<int, BoxStatus> boxStatus = new Dictionary<int, BoxStatus>();
......@@ -71,6 +79,12 @@ namespace OnlineStore.Common
/// 报警集合
/// </summary>
public List<AlarmInfo> alarmList = new List<AlarmInfo>();
public void SetMsg(string msg, string type, params string[] param)
{
this.msg = msg;
this.msgCode = type;
this.msgParam = param;
}
}
/// <summary>
......@@ -97,6 +111,14 @@ namespace OnlineStore.Common
/// </summary>
public string msg { get; set; }
/// <summary>
///提示消息类型
/// </summary>
public string msgCode { get; set; }
/// <summary>
/// 消息参数
/// </summary>
public string[] msgParam { get; set; }
/// <summary>
/// 温度
/// </summary>
public string temperature { get; set; }
......@@ -115,6 +137,13 @@ namespace OnlineStore.Common
get { return _data; }
set { _data = value; }
}
public void SetMsg(string msg,string type,params string[] param)
{
this.msg = msg;
this.msgCode = type;
this.msgParam = param;
}
}
public class AlarmInfo
{
......@@ -163,7 +192,7 @@ namespace OnlineStore.Common
/// <summary>
/// 0,1=入库,2=出库
/// </summary>
public int inOutStatus { get; set; }
public int inOutStatus { get; set; }
}
public class ParamDefine
......
......@@ -18,7 +18,12 @@ namespace OnlineStore.DeviceLibrary
string result = GetStrEvent?.Invoke(value, value);
return result;
}
public static string GetString(string id, string defaultStr)
public static string GetString(string id, params object[] param)
{
string result = GetStringEvent?.Invoke(id, id, param);
return result;
}
public static string GetString(string id, string defaultStr)
{
string result = GetStrEvent?.Invoke(id, defaultStr);
return result;
......@@ -149,19 +154,19 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public static string Alarm = "Alarm";
/// <summary>
///"入库库位格式错误:"
///入库库位格式错误:条码[{0}]库位号[{1}]
/// </summary>
public static string InStoreError = "InStoreError";
/// <summary>
///"入库未找到库位:"
///"入库未找到库位:条码[{0}]库位号[{1}]"
/// </summary>
public static string InStoreNoPosition = "InStoreNoPosition";
/// <summary>
///"出库格式错误:"
///出库格式错误{0}
/// </summary>
public static string OutStoreError = "OutStoreError";
/// <summary>
///"出库未找库位:"
///"出库未找库位:{0}"
/// </summary>
public static string OutStoreNoPosition = "OutStoreNoPosition";
......@@ -314,5 +319,50 @@ namespace OnlineStore.DeviceLibrary
///启动失败:没有气压信号
/// </summary>
public static string startFailAir = "startFailAir";
/// <summary>
/// 打开轴{0}失败
/// </summary>
public static string OpenAxisFail = "OpenAxisFail";
/// <summary>
/// 运动轴{0}报警
/// </summary>
public static string AxisAlarm = "AxisAlarm";
/// <summary>
/// 等待信号{0}={1}超时
/// </summary>
public static string WaitSingleTimeOut = "WaitSingleTimeOut";
/// <summary>
/// 运动{0}轴{1}收到原点完成信号,当前位置[{2}],误差过大,需要报警
/// </summary>
public static string AxisHomeMoveAlarm = "AxisHomeMoveAlarm";
/// <summary>
/// 运动{0}轴{1}目标位置[{2}]当前位置{3}误差过大,需要报警
/// </summary>
public static string AxisMoveAlarm = "AxisMoveAlarm";
/// <summary>
/// [{0}]超时{1}[{2}]
/// </summary>
public static string MoveTimeOut = "MoveTimeOut";
/// <summary>
/// [{0}]超时[等待可以入库][{1}秒]
/// </summary>
public static string WaitInstoreTimeOut = "WaitInstoreTimeOut";
/// <summary>
/// 叉子料盘检测有料,请检查
/// </summary>
public static string HasWare = "HasWare";
/// <summary>
/// 未扫到二维码,请重新放入料盘
/// </summary>
public static string NoCodeMsg = "NoCodeMsg";
/// <summary>
/// 未扫到二维码,需要将料盘送出
/// </summary>
public static string InStoreNoCode = "InStoreNoCode";
}
}
......@@ -114,18 +114,13 @@ namespace OnlineStore.DeviceLibrary
if (IOManager.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
if (isInSuddenDown.Equals(false))
{
//LogUtil.error(LOGGER, StoreName + "收到急停信号,等待200后再次判断");
//Thread.Sleep(200);
//if (IOManager.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
//{
{
isInSuddenDown = true;
LogUtil.error(LOGGER, StoreName + "收到急停信号,报警急停");
WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.inSuddenStop, "Receive emergency stop signal, alarm to stop");
// WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.inSuddenStop, "收到急停信号,报警急停");
SetWarnMsg( ResourceControl.inSuddenStop);
//报警时会关闭所有轴
Alarm(StoreAlarmType.SuddenStop, "1", WarnMsg, StoreMoveType.None);
//}
Alarm(StoreAlarmType.SuddenStop, "1", WarnObj.WarnMsg, StoreMoveType.None);
}
}
else
......@@ -160,10 +155,11 @@ namespace OnlineStore.DeviceLibrary
TimeSpan span = DateTime.Now - lastAirCloseTime;
if (span.TotalSeconds > Config.AirCheckSeconds)
{
WarnMsg =ResourceControl.GetString(ResourceControl.NoAIr, "未检测到气压信号");
// WarnMsg = ResourceControl.GetString(ResourceControl.NoAIr, "未检测到气压信号");
SetWarnMsg( ResourceControl.NoAIr);
preAirValue = IO_VALUE.LOW;
LogUtil.info("已持续【" + FormUtil.GetSpanStr(span) + "】未检测到气压信号,报警");
Alarm(StoreAlarmType.NoAirCheck, "2", WarnMsg, StoreMoveType.None);
LogUtil.error("已持续【" + FormUtil.GetSpanStr(span) + "】未检测到气压信号,报警");
Alarm(StoreAlarmType.NoAirCheck, "2", WarnObj.WarnMsg, StoreMoveType.None);
return;
}
}
......@@ -212,16 +208,18 @@ namespace OnlineStore.DeviceLibrary
{
if (ShuoKeControls.isRun == false && (!StoreManager.OpenShuoKe(this)))
{
WarnMsg = ResourceControl.GetString(ResourceControl.PreConnectFail, "启动失败:压紧轴连接失败");
LogUtil.error(StoreName + "打开驱动器串口失败,启动失败!");
// WarnMsg = ResourceControl.GetString(ResourceControl.PreConnectFail, "启动失败:压紧轴连接失败");
SetWarnMsgAndLog(ResourceControl.PreConnectFail);
// LogUtil.error(StoreName + "打开驱动器串口失败,启动失败!");
return false;
}
}
string canStart = AutomaticBaiting.CanStart();
if (!canStart.Equals(""))
{
WarnMsg = canStart;
LogUtil.info(StoreName + canStart);
//WarnMsg = canStart;
SetWarnMsg(canStart);
// LogUtil.info(StoreName + canStart);
return false;
}
autoNext = false;
......@@ -259,13 +257,15 @@ namespace OnlineStore.DeviceLibrary
{
if (suddenBtn.Equals(IO_VALUE.LOW))
{
WarnMsg = ResourceControl.GetString(ResourceControl.startFail, "Startup failure: emergency stop not opened");
LogUtil.error(LOGGER, " (" + StoreName + ")启动出现错误:急停没开 !启动失败!");
//WarnMsg = ResourceControl.GetString(ResourceControl.startFail, "Startup failure: emergency stop not opened");
SetWarnMsgAndLog(ResourceControl.startFail);
// LogUtil.error(LOGGER, " (" + StoreName + ")启动出现错误:急停没开 !启动失败!");
}
else
{
WarnMsg = ResourceControl.GetString(ResourceControl.startFailAir, "Startup failure: no air pressure signal");
LogUtil.error(LOGGER, " (" + StoreName + ")启动出现错误:没有气压信号 !启动失败!");
// WarnMsg = ResourceControl.GetString(ResourceControl.startFailAir, "Startup failure: no air pressure signal");
// LogUtil.error(LOGGER, " (" + StoreName + ")启动出现错误:没有气压信号 !启动失败!");
SetWarnMsgAndLog(ResourceControl.startFailAir);
}
return false;
}
......@@ -280,8 +280,9 @@ namespace OnlineStore.DeviceLibrary
private void ReturnHome()
{
ResetEvent?.Invoke();
WarnMsg = "";
CurrInOutACount = 0;
// WarnMsg = "";
SetWarnMsg("");
CurrInOutACount = 0;
CurrInOutCount = 0;
IOManager.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.HIGH);
......@@ -339,8 +340,8 @@ namespace OnlineStore.DeviceLibrary
storeRunStatus = StoreRunStatus.Reset;
storeStatus = StoreStatus.ResetMove;
StoreMove.NewMove(StoreMoveType.StoreReset);
WarnMsg = "";
//WarnMsg = "";
SetWarnMsg("");
if (!RunAxis(true))
{
LogUtil.info(LOGGER, StoreName + "复位时打开轴失败,需要再次复位,直接报警停止复位");
......@@ -509,7 +510,8 @@ namespace OnlineStore.DeviceLibrary
storeRunStatus = StoreRunStatus.Runing;
if (alarmType.Equals(StoreAlarmType.None))
{
WarnMsg = "";
SetWarnMsg("");
//WarnMsg = "";
}
}
......@@ -668,8 +670,9 @@ namespace OnlineStore.DeviceLibrary
//如果此时轴三还在报警,需要提示错误并等待
if (ACServerManager.GetAlarmStatus(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue()) > 0)
{
WarnMsg = ResourceControl.GetString(ResourceControl.InoutAlarm, "进出轴报警!复位失败,请检查!");
LogUtil.error(LOGGER, "进出轴报警!复位失败,请检查!");
//WarnMsg = ResourceControl.GetString(ResourceControl.InoutAlarm, "进出轴报警!复位失败,请检查!");
//LogUtil.error(LOGGER, "进出轴报警!复位失败,请检查!");
SetWarnMsgAndLog(ResourceControl.InoutAlarm);
}
//复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
ResetLog("原点返回中 :压紧轴,旋转轴,上下轴开始原点返回");
......@@ -697,7 +700,8 @@ namespace OnlineStore.DeviceLibrary
storeRunStatus = StoreRunStatus.Runing;
StoreMove.EndMove();
storeStatus = StoreStatus.StoreOnline;
WarnMsg = "";
//WarnMsg = "";
SetWarnMsg("");
break;
default: break;
}
......@@ -772,9 +776,10 @@ namespace OnlineStore.DeviceLibrary
{
ACServerManager.ServoOff(axis.DeviceName, axis.GetAxisValue());
int alarmCode = GetAlarmCodeByAxis(axis);
WarnMsg = StoreName + "打开轴" + axis.Explain + "失败 ";
LogUtil.info(LOGGER, StoreName + WarnMsg);
Alarm(StoreAlarmType.AxisAlarm, GetAlarmCodeByAxis(axis).ToString(), WarnMsg, StoreMove.MoveType);
// WarnMsg = StoreName + "打开轴" + axis.Explain + "失败 ";
//LogUtil.info(LOGGER, StoreName + WarnMsg);
SetWarnMsgAndLog(ResourceControl.OpenAxisFail, axis.GetNameStr());
Alarm(StoreAlarmType.AxisAlarm, GetAlarmCodeByAxis(axis).ToString(), WarnObj.WarnMsg, StoreMove.MoveType);
return false;
}
}
......@@ -830,7 +835,8 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public override void StopRun()
{
WarnMsg = "";
SetWarnMsg("");
//WarnMsg = "";
autoNext = false;
IoCheckTimer.Enabled = false;
serverConnectTimer.Enabled = false;
......@@ -850,7 +856,8 @@ namespace OnlineStore.DeviceLibrary
ShuoKeControls.ClosePort();
}
HumitureController.Release();
StoreManager.CurrInOutType = 0;
//StoreManager.CurrInOutType = 0;
LogUtil.info(LOGGER, StoreName + "StopRun,停止运行,总运行时间:" + runTimeWatch.Elapsed.ToString());
}
public void Exit()
......@@ -1103,8 +1110,8 @@ namespace OnlineStore.DeviceLibrary
{
//收到复位信号
LogUtil.info(LOGGER, "收到复位信号,自动复位");
WarnMsg = ResourceControl.GetString(ResourceControl.AutoReset, "收到复位信号,自动复位");
// WarnMsg = ResourceControl.GetString(ResourceControl.AutoReset, "收到复位信号,自动复位");
SetWarnMsg(ResourceControl.AutoReset);
Reset();
}
}
......@@ -1166,33 +1173,35 @@ namespace OnlineStore.DeviceLibrary
//若BOX和移栽都没有在等待Io的过程中则此Io超时异常可能已经处理过
if (alarmType.Equals(StoreAlarmType.IoSingleTimeOut) && StoreMove.IsInWait == false)
{
LogUtil.info(StoreName + "当前空闲中,清理信号超时异常【" + StoreManager.Store.alarmType + "】" + WarnMsg);
LogUtil.info(StoreName + "当前空闲中,清理信号超时异常【" + StoreManager.Store.alarmType + "】" + WarnObj.WarnMsg);
alarmType = StoreAlarmType.None;
IOManager.IOMove(IO_Type.Buzzer_Sign, IO_VALUE.LOW);
WarnMsg = "";
// WarnMsg = "";
SetWarnMsg("");
}
else if (alarmType.Equals(StoreAlarmType.BatchAlarm) || alarmType.Equals(StoreAlarmType.BatchIoTimeOut))
{
if (AutomaticBaiting.AutoBaitingStatus.Equals(StoreRunStatus.Runing) && AutomaticBaiting.StoreMove.IsInWait.Equals(false))
{
LogUtil.info("批量上下料模块空闲中,清理报警【" + StoreManager.Store.alarmType + "】" + AutomaticBaiting.WarnMsg);
LogUtil.info("批量上下料模块空闲中,清理报警【" + StoreManager.Store.alarmType + "】" + AutomaticBaiting.WarnObj.WarnMsg);
alarmType = StoreAlarmType.None;
IOManager.IOMove(IO_Type.Buzzer_Sign, IO_VALUE.LOW);
AutomaticBaiting.WarnMsg = "";
AutomaticBaiting.SetWarnMsg( "");
}
}
}
if (alarmType.Equals(StoreAlarmType.None))
{
if (WarnMsg.Contains(AutomaticBaiting.TimeOut))
if (WarnObj.WarnMsg.Contains(AutomaticBaiting.TimeOut))
{
LogUtil.info("清理超时异常信息:"+WarnMsg);
WarnMsg = "";
LogUtil.info("清理超时异常信息:"+ WarnObj.WarnMsg);
//WarnMsg = "";
SetWarnMsg("");
}
if (AutomaticBaiting.WarnMsg.Contains(AutomaticBaiting.TimeOut))
if (AutomaticBaiting.WarnObj.WarnMsg.Contains(AutomaticBaiting.TimeOut))
{
LogUtil.info("清理超时异常信息:" + AutomaticBaiting.WarnMsg);
AutomaticBaiting.WarnMsg = "";
LogUtil.info("清理超时异常信息:" + AutomaticBaiting.WarnObj.WarnMsg);
AutomaticBaiting.SetWarnMsg("");
}
}
......@@ -1358,16 +1367,18 @@ namespace OnlineStore.DeviceLibrary
{
if (Config.Batch_Axis.IsSameAxis(axisInfo.DeviceName,axisInfo.GetAxisValue()) )
{
AutomaticBaiting.WarnMsg = ResourceControl.GetString(ResourceControl.MoveAxis, " 运动轴") + axisInfo.Explain + ResourceControl.GetString(ResourceControl.Alarm, "报警");
// AutomaticBaiting.WarnMsg = ResourceControl.GetString(ResourceControl.MoveAxis, " 运动轴") + axisInfo.Explain + ResourceControl.GetString(ResourceControl.Alarm, "报警");
AutomaticBaiting.SetWarnMsg(ResourceControl.AxisAlarm, axisInfo.GetNameStr());
info.AlarmIoValue = alarmIo;
Alarm(StoreAlarmType.BatchAxisAlarm, GetAlarmCodeByAxis(axisInfo).ToString(), WarnMsg, StoreMoveType.None);
Alarm(StoreAlarmType.BatchAxisAlarm, GetAlarmCodeByAxis(axisInfo).ToString(), AutomaticBaiting.WarnObj.WarnMsg, StoreMoveType.None);
}
else
{
WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.MoveAxis, " 运动轴") + axisInfo.Explain + ResourceControl.GetString(ResourceControl.Alarm, "报警");
// WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.MoveAxis, " 运动轴") + axisInfo.Explain + ResourceControl.GetString(ResourceControl.Alarm, "报警");
SetWarnMsg(ResourceControl.AxisAlarm,axisInfo.GetNameStr());
info.AlarmIoValue = alarmIo;
Alarm(StoreAlarmType.AxisAlarm, GetAlarmCodeByAxis(axisInfo).ToString(), WarnMsg, StoreMoveType.None);
Alarm(StoreAlarmType.AxisAlarm, GetAlarmCodeByAxis(axisInfo).ToString(), WarnObj.WarnMsg, StoreMoveType.None);
}
isInAlarm = true;
}
......@@ -1613,43 +1624,46 @@ namespace OnlineStore.DeviceLibrary
lineOperation.cid = CID;
lineOperation.seq = ConfigAppSettings.nextSeq();
lineOperation.status = 1;
if (WarnMsg != "")
if (WarnObj.WarnMsg != "")
{
lineOperation.status = (int)StoreStatus.Warning;
lineOperation.msg = WarnMsg;
lineOperation.status = (int)StoreStatus.Warning;
}
lineOperation.status = (int)StoreStatus.StoreOnline;
BoxStatus boxStatus = new BoxStatus();
boxStatus.boxId = StoreID;
boxStatus.msg = WarnMsg;
lineOperation.msg = WarnMsg;
if (WarnMsg.Equals(""))
boxStatus.SetMsg(WarnObj.WarnMsg,WarnObj.MsgCode,WarnObj.MsgParam);
lineOperation.SetMsg(WarnObj.WarnMsg, WarnObj.MsgCode,WarnObj.MsgParam);
if (lineOperation.msg.Equals(""))
{
boxStatus.msg = AutomaticBaiting.CodeMsg;
lineOperation.msg = AutomaticBaiting.CodeMsg;
WarnInfo obj = AutomaticBaiting.WarnObj;
boxStatus.SetMsg(obj.WarnMsg, obj.MsgCode, obj.MsgParam);
lineOperation.SetMsg(obj.WarnMsg, obj.MsgCode, obj.MsgParam);
}
if (lineOperation.msg.Equals(""))
{
boxStatus.SetMsg(AutomaticBaiting.CodeMsg, ResourceControl.NoCodeMsg );
lineOperation.SetMsg(AutomaticBaiting.CodeMsg, ResourceControl.NoCodeMsg);
AutomaticBaiting.CodeMsg = "";
}
if (boxStatus.msg.Equals(""))
if (lineOperation.msg.Equals(""))
{
boxStatus.msg = CodeOrInoutMsg;
lineOperation.msg = CodeOrInoutMsg;
boxStatus.SetMsg(CodeOrInoutMsg, ResourceControl.InStoreNoCode);
lineOperation.SetMsg(CodeOrInoutMsg, ResourceControl.InStoreNoCode);
CodeOrInoutMsg = "";
}
if (CodeOrInoutMsg.Equals(""))
{
if (storeRunStatus.Equals(StoreRunStatus.Runing)&&AutomaticBaiting.AutoBaitingStatus.Equals(StoreRunStatus.Runing)
&& IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{
boxStatus.msg = "叉子料盘检测有料,请检查";
lineOperation.msg = "叉子料盘检测有料,请检查";
boxStatus.SetMsg(ResourceControl.GetString(ResourceControl.HasWare, "叉子料盘检测有料,请检查"),ResourceControl.HasWare);
lineOperation.SetMsg(ResourceControl.GetString(ResourceControl.HasWare, "叉子料盘检测有料,请检查"), ResourceControl.HasWare);
}
}
CodeOrInoutMsg = "";
//WarnMsg = "";
//状态
boxStatus.status = GetStoreStatus();
......@@ -1905,8 +1919,9 @@ namespace OnlineStore.DeviceLibrary
string[] posArray = posId.Split('#');
if (posArray.Length != 2)
{
WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.OutStoreError, "出库格式错误:") + "【" + posId + "】";
LogUtil.error(LOGGER, "收到服务器出库命令:库位号【" + posId + "】格式错误");
//WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.OutStoreError, "出库格式错误:") + "【" + posId + "】";
SetWarnMsgAndLog( ResourceControl.OutStoreError,posId);
//LogUtil.error(LOGGER, "收到服务器出库命令:库位号【" + posId + "】格式错误");
continue;
}
int storeId = int.Parse(posArray[0]);
......@@ -1916,8 +1931,9 @@ namespace OnlineStore.DeviceLibrary
if (position == null)
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.OutStoreNoPosition, "出库未找库位:") + "【" + posId + "】";
LogUtil.error(LOGGER, "收到服务器出库命令:未找到【" + posId + "】的库位信息");
//WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.OutStoreNoPosition, "出库未找库位:") + "【" + posId + "】";
// LogUtil.error(LOGGER, "收到服务器出库命令:未找到【" + posId + "】的库位信息");
SetWarnMsgAndLog(ResourceControl.OutStoreNoPosition, posId);
continue;
}
else
......
......@@ -119,6 +119,7 @@ namespace OnlineStore.DeviceLibrary
//当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - StoreMove.LastSetpTime;
string NotOkMsg = "";
int waitType = 0;
if (list.Count <= 0)
{
StoreMove.EndStepWait();
......@@ -135,7 +136,9 @@ namespace OnlineStore.DeviceLibrary
{
continue;
}
NotOkMsg = wait.ToStr();
waitType = wait.WaitType;
if (wait.WaitType == (int)Wait_Type.AxisMove_1)
{
string msg = "";
......@@ -150,9 +153,9 @@ namespace OnlineStore.DeviceLibrary
if (!msg.Equals(""))
{
isOk = false;
WarnMsg = msg;
//WarnMsg = msg;
//LogUtil.info(msg);
Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType);
Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnObj.WarnMsg, StoreMove.MoveType);
return;
break;
}
......@@ -172,15 +175,16 @@ namespace OnlineStore.DeviceLibrary
if (!doValue.Equals(wait.IoValue))
{
LogUtil.error("等待[" + NotOkMsg + "],重写DO(" + ioType + "=" + wait.IoValue + ")");
IOManager.IOMove(ioType, wait.IoValue);
IOManager.IOMove(ioType, wait.IoValue);
}
}
if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
{
ConfigIO io = Config.getWaitIO(wait.IoType);
WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.WaitSingle, " 等待信号") + io.DisplayStr + "=" + wait.IoValue + ResourceControl.GetString(ResourceControl.TimeOut, "超时!");
Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, StoreMove.MoveType);
LogUtil.error( StoreName + wait.IoType + ResourceControl.GetString(ResourceControl.WaitSingle, " 等待信号") + "(" + io.DisplayStr + "=" + wait.IoValue + ") " + ResourceControl.GetString(ResourceControl.TimeOut, "超时"), 14);
// WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.WaitSingle, " 等待信号") + io.DisplayStr + "=" + wait.IoValue + ResourceControl.GetString(ResourceControl.TimeOut, "超时!");
SetWarnMsg(ResourceControl.WaitSingleTimeOut, io.ElectricalDefinition + "_" + io.ProName, wait.IoValue + "");
Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnObj.WarnMsg, StoreMove.MoveType);
LogUtil.error(WarnObj.WarnMsg, 14);
isOk = false;
return;
break;
......@@ -199,10 +203,10 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = AutomaticBaiting.IsGetTrayGo;
}
else if (wait.WaitType == (int)Wait_Type.BatchAxisMove_10)
{
{
if (!wait.IsEnd)
{
wait.IsEnd = AutomaticBaiting.BatchAxisIsEnd(wait,span);
wait.IsEnd = AutomaticBaiting.BatchAxisIsEnd(wait, span);
}
if (!wait.IsEnd)
{
......@@ -248,9 +252,12 @@ namespace OnlineStore.DeviceLibrary
}
else if (span.TotalSeconds > StoreMove.TimeOutSeconds)
{
WarnMsg = "[" + StoreMove.MoveStep + "]"+ResourceControl.GetString(ResourceControl.TimeOut, "超时" )+"[" + NotOkMsg + "][" + Math.Round(span.TotalSeconds, 1) + "]";
LogUtil.error(WarnMsg, 15);
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType);
string msg = ResourceControl.GetString(ResourceControl.MoveTimeOut, "[" + StoreMove.MoveStep + "]" +
ResourceControl.GetString(ResourceControl.TimeOut, "超时") + "[" + NotOkMsg + "][" + Math.Round(span.TotalSeconds, 1) + "]");
string newType = ResourceControl.MoveTimeOut + "_" + waitType.ToString().PadLeft(2, '0');
SetWaitWarnMsg(msg, newType, StoreMove.MoveStep + "", Math.Round(span.TotalSeconds, 1) + "");
LogUtil.error(WarnObj.WarnMsg, 15);
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnObj.WarnMsg, StoreMove.MoveType);
}
}
private bool ShuoKeIsEnd(WaitResultInfo wait, out string msg)
......
......@@ -27,7 +27,7 @@ namespace OnlineStore.DeviceLibrary
public static string LastCode = "";
private static string LastPosId = "";
public static int AxisChangeValue = ConfigAppSettings.GetIntValue(Setting_Init.AxisChangeValue);
public static string WarnMsg = "";
// public static string WarnMsg = "";
public static string CodeMsg = "";
public static string Name = "批量上下料 ";
public static StoreMoveInfo StoreMove = null;
......@@ -42,7 +42,35 @@ namespace OnlineStore.DeviceLibrary
public static int BatchInStoreCount = 0;
public static int BatchInStoreHeight = 0;
public static WarnInfo WarnObj = new WarnInfo();
public static void SetWarnMsg(string code, params string[] param)
{
if (code.Equals(""))
{
// WarnMsg =msg;
WarnObj.WarnMsg = "";
WarnObj.MsgCode = "";
WarnObj.MsgParam = null;
}
else
{
// WarnMsg = String.Format(msg, param);
WarnObj.WarnMsg = ResourceControl.GetString(code, param);
WarnObj.MsgCode = code;
WarnObj.MsgParam = param;
}
}
public static void SetWarnMsgAndLog(string type, params string[] param)
{
SetWarnMsg(type, param);
LogUtil.error("AutomaticBaiting WarnObj: Type[" + WarnObj.MsgCode + "]Msg[" + WarnObj.WarnMsg + "]");
}
public static void SetWaitWarnMsg(string myType, string type, params string[] param)
{
WarnObj.WarnMsg = myType;
WarnObj.MsgCode = type;
WarnObj.MsgParam = param;
}
/// <summary>
/// 初始化数据
/// </summary>
......@@ -88,8 +116,8 @@ namespace OnlineStore.DeviceLibrary
//需要判断门关闭
if (!DoorIsClose())
{
msg = (ResourceControl.GetString(ResourceControl.CloseError, "锁门失败:请先关闭上料机构")); ;
return msg;
// msg = (ResourceControl.GetString(ResourceControl.CloseError, "锁门失败:请先关闭上料机构")); ;
return ResourceControl.CloseError;
}
return msg;
......@@ -149,7 +177,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(Name + " 复位前,清理报警【" + StoreManager.Store.alarmType + "】");
StoreManager.Store.alarmType = StoreAlarmType.None;
IOManager.IOMove(IO_Type.Buzzer_Sign, IO_VALUE.LOW);
WarnMsg = "";
// WarnMsg = "";
SetWarnMsg("");
}
AutomaticBaiting.IsNeedStartInout = isNeedInout;
AutomaticBaiting.IsNeedAxisHome = isNeedHome;
......@@ -243,7 +272,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(Name + "复位完成");
StoreMove.EndMove();
AutoBaitingStatus = StoreRunStatus.Runing;
WarnMsg = "";
// WarnMsg = "";
SetWarnMsg("");
IsNeedStartInout = false;
break;
default: break;
......@@ -347,9 +377,10 @@ namespace OnlineStore.DeviceLibrary
else
{
//TODO 报警
WarnMsg = ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败");
StoreManager.Store.Alarm(StoreAlarmType.BatchAlarm, ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败"), WarnMsg, StoreMoveType.InStore);
LogUtil.error(WarnMsg, 103);
//WarnMsg = ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败");
SetWarnMsg(ResourceControl.XiLiaoError);
StoreManager.Store.Alarm(StoreAlarmType.BatchAlarm, WarnObj.WarnMsg, WarnObj.WarnMsg, StoreMoveType.InStore);
LogUtil.error(WarnObj.WarnMsg, 103);
}
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I06_SuckingDisc_Up))
......@@ -377,8 +408,9 @@ namespace OnlineStore.DeviceLibrary
}
else
{
WarnMsg = ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败");
StoreManager.Store.Alarm(StoreAlarmType.BatchAlarm, ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败"), WarnMsg, StoreMoveType.InStore);
// WarnMsg = ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败");
SetWarnMsg(ResourceControl.XiLiaoError);
StoreManager.Store.Alarm(StoreAlarmType.BatchAlarm, WarnObj.WarnMsg, WarnObj.WarnMsg, StoreMoveType.InStore);
LogUtil.error(Name + "入料: 吸盘上升后未检测到吸盘压力信号,吸取料盘失败", 105);
}
}
......@@ -427,15 +459,17 @@ namespace OnlineStore.DeviceLibrary
{
StoreManager.Store.LoguStatus();
//一分钟还未开始,报警超时
WarnMsg = "[" + StoreMove.MoveStep + "]" + ResourceControl.GetString(ResourceControl.TimeOut, "超时") + "[等待可以入库][" + Math.Round(span.TotalSeconds, 0) + "秒]";
LogUtil.error(WarnMsg, 105);
StoreManager.Store.Alarm(StoreAlarmType.BatchIoTimeOut, "", WarnMsg, StoreMove.MoveType);
// WarnMsg = "[" + StoreMove.MoveStep + "]" + ResourceControl.GetString(ResourceControl.TimeOut, "超时") + "[等待可以入库][" + Math.Round(span.TotalSeconds, 0) + "秒]";
SetWarnMsg(ResourceControl.WaitInstoreTimeOut, StoreMove.MoveStep + "", Math.Round(span.TotalSeconds, 0) + "");
LogUtil.error(WarnObj.WarnMsg, 105);
StoreManager.Store.Alarm(StoreAlarmType.BatchIoTimeOut, "", WarnObj.WarnMsg, StoreMove.MoveType);
}
}
else
{
WarnMsg = ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败");
StoreManager.Store.Alarm(StoreAlarmType.BatchAlarm, ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败"), WarnMsg, StoreMoveType.InStore);
//WarnMsg = ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败");
SetWarnMsg(ResourceControl.XiLiaoError);
StoreManager.Store.Alarm(StoreAlarmType.BatchAlarm, ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败"), WarnObj.WarnMsg, StoreMoveType.InStore);
LogUtil.error(Name + "入料: 吸盘上升后未检测到吸盘压力信号,吸取料盘失败", 105);
}
}
......@@ -569,9 +603,9 @@ namespace OnlineStore.DeviceLibrary
private static void ClearTimeOut()
{
if (WarnMsg.Contains(TimeOut))
if (WarnObj.WarnMsg.Contains(TimeOut))
{
WarnMsg = "";
SetWarnMsg( "");
}
}
......
......@@ -58,7 +58,10 @@ namespace OnlineStore.DeviceLibrary
}
else
{
msg = Name + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
// msg = Name + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
SetWarnMsgAndLog(ResourceControl.AxisHomeMoveAlarm, StoreMove.MoveStep + "", moveAxis.GetNameStr(), outCount + "");
msg = WarnObj.WarnMsg;
LogUtil.error(msg, 100);
return false;
}
......@@ -80,6 +83,7 @@ namespace OnlineStore.DeviceLibrary
//当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - StoreMove.LastSetpTime;
string NotOkMsg = "";
int waitType = 0;
bool isOk = !StoreMove.OneWaitCanEndStep;
foreach (WaitResultInfo wait in list)
{
......@@ -88,6 +92,7 @@ namespace OnlineStore.DeviceLibrary
continue;
}
NotOkMsg = wait.ToStr();
waitType = wait.WaitType;
if (wait.WaitType == (int)Wait_Type.AxisMove_1)
{
bool isAlarm = false;
......@@ -190,9 +195,11 @@ namespace OnlineStore.DeviceLibrary
}
else if (span.TotalSeconds > StoreMove.TimeOutSeconds)
{
WarnMsg = "[" + StoreMove.MoveStep + "]" + ResourceControl.GetString(ResourceControl.TimeOut, "超时") + " [" + NotOkMsg + "][" + Math.Round(span.TotalSeconds, 0) + "秒]";
LogUtil.error(WarnMsg, 102);
StoreManager.Store.Alarm(StoreAlarmType.BatchIoTimeOut, "", WarnMsg, StoreMove.MoveType);
string msg = "[" + StoreMove.MoveStep + "]" + ResourceControl.GetString(ResourceControl.TimeOut, "超时") + " [" + NotOkMsg + "][" + Math.Round(span.TotalSeconds, 0) + "秒]";
string newType = ResourceControl.MoveTimeOut + "_" + waitType.ToString().PadLeft(2, '0');
SetWaitWarnMsg(msg, newType,StoreMove.MoveStep+"", Math.Round(span.TotalSeconds, 0) + "");
LogUtil.error(msg, 102);
StoreManager.Store.Alarm(StoreAlarmType.BatchIoTimeOut, "", msg, StoreMove.MoveType);
}
}
......@@ -226,7 +233,10 @@ namespace OnlineStore.DeviceLibrary
}
else
{
msg = Name + moveAxis.DisplayStr + "目标[" + targetPosition + "]当前[" + outCount + "],误差过大,需要报警";
// msg = Name + moveAxis.DisplayStr + "目标[" + targetPosition + "]当前[" + outCount + "],误差过大,需要报警";
SetWarnMsgAndLog(ResourceControl.AxisMoveAlarm, StoreMove.MoveStep + "", moveAxis.GetNameStr(), targetPosition + "", outCount + "");
msg = WarnObj.WarnMsg;
LogUtil.error(msg);
}
}
......@@ -248,8 +258,8 @@ namespace OnlineStore.DeviceLibrary
if (!msg.Equals(""))
{
isAlarm = true;
WarnMsg = msg;
StoreManager.Store.Alarm(StoreAlarmType.BatchAxisAlarm, StoreManager.Store.GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType);
// WarnMsg = msg;
StoreManager.Store.Alarm(StoreAlarmType.BatchAxisAlarm, StoreManager.Store.GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnObj.WarnMsg, StoreMove.MoveType);
}
return wait.IsEnd;
......@@ -353,7 +363,7 @@ namespace OnlineStore.DeviceLibrary
}
if (LastCode.Equals(""))
{
StoreManager.Store.CodeOrInoutMsg = "未扫到二维码,需要将料盘送出";
StoreManager.Store.CodeOrInoutMsg =ResourceControl.GetString(ResourceControl.InStoreNoCode, "未扫到二维码,需要将料盘送出");
LogUtil.error("未扫到二维码,需要将料盘送出");
}
else
......@@ -461,7 +471,7 @@ namespace OnlineStore.DeviceLibrary
message = ScanCodeManager.ReplaceCode(message);
if (message.Equals("") || string.IsNullOrEmpty(message))
{
CodeMsg = "没有收到二维码信息,请重新放入料盘";
CodeMsg =ResourceControl.GetString(ResourceControl.NoCodeMsg, "没有收到二维码信息,请重新放入料盘");
LogUtil.info(LogName + "没有收到二维码信息,请重新放入料盘");
return null;
}
......@@ -523,8 +533,9 @@ namespace OnlineStore.DeviceLibrary
string[] posArray = posId.Split('#');
if (!(posArray.Length == 2))
{
WarnMsg = Name + ResourceControl.GetString(ResourceControl.InStoreError, "入库库位格式错误:") + "【" + message + "】【" + posId + "】";
LogUtil.error("服务器反馈 入库库位格式错误:二维码【" + message + "】库位【" + posId + "】");
// WarnMsg = Name + ResourceControl.GetString(ResourceControl.InStoreError, "入库库位格式错误:") + "【" + message + "】【" + posId + "】";
SetWarnMsgAndLog(ResourceControl.InStoreError, message, posId);
// LogUtil.error("服务器反馈 入库库位格式错误:二维码【" + message + "】库位【" + posId + "】");
return null;
}
......@@ -533,8 +544,9 @@ namespace OnlineStore.DeviceLibrary
AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(posId);
if (position == null)
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = ResourceControl.GetString(ResourceControl.InStoreNoPosition, "入库未找到库位:") + "【" + message + "】【" + posId + "】 ";
LogUtil.error("服务器反馈 入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
// WarnMsg = ResourceControl.GetString(ResourceControl.InStoreNoPosition, "入库未找到库位:") + "【" + message + "】【" + posId + "】 ";
SetWarnMsgAndLog(ResourceControl.InStoreNoPosition, message, posId);
// LogUtil.error("服务器反馈 入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
return null;
}
......
......@@ -8,7 +8,7 @@ using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
namespace OnlineStore.DeviceLibrary
{
......@@ -20,7 +20,7 @@ namespace OnlineStore.DeviceLibrary
protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public Stopwatch runTimeWatch = new Stopwatch();
/// <summary>
/// 最后一次气压检测变为0的时间
/// </summary>
......@@ -33,7 +33,7 @@ namespace OnlineStore.DeviceLibrary
/// 是否没有检测到气压
/// </summary>
public bool isNoAirCheck = false;
/// <summary>
/// 是否再报警中
/// </summary>
......@@ -45,7 +45,7 @@ namespace OnlineStore.DeviceLibrary
/// 料仓单个调试状态(默认不是调试状态)
/// </summary>
public bool IsDebug = false;
/// <summary>
///1=设备联机(正常就绪)(入库后,BOX恢复原始状态)(出库后,移载装置恢复原始状态),
///2=急停,3=故障,4=警告,5=调试
......@@ -65,11 +65,42 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 提示消息,一般发给服务器后清空(LineBean表示报警提示消息,BoxBean表示出入库失败的原因记录)
/// </summary>
public string WarnMsg = "";
// public string MyWarnMsg = "";
public WarnInfo WarnObj = new WarnInfo();
public void SetWarnMsg(string code , params string[] param)
{
if (code.Equals(""))
{
// WarnMsg =msg;
WarnObj.WarnMsg = "";
WarnObj.MsgCode = "";
WarnObj.MsgParam = param;
}
else
{
// WarnMsg = String.Format(msg, param);
WarnObj.WarnMsg = ResourceControl.GetString(code, param);
WarnObj.MsgCode = code;
WarnObj.MsgParam = param;
}
}
public void SetWarnMsgAndLog(string code, params string[] param)
{
SetWarnMsg(code, param);
LogUtil.error("WarnObj: Type[" + WarnObj.MsgCode + "]Msg[" + WarnObj.WarnMsg + "]");
}
public void SetWaitWarnMsg(string myType, string type, params string[] param)
{
WarnObj.WarnMsg = myType;
WarnObj.MsgCode = type;
WarnObj.MsgParam = param;
}
public string StoreName { get; set; }
public int StoreID { get; set; }
protected System.Timers.Timer mainTimer;
protected System.Timers.Timer serverConnectTimer = new System.Timers.Timer();
protected System.Timers.Timer IoCheckTimer = new System.Timers.Timer();
......@@ -83,7 +114,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
protected virtual void Init()
{
StoreMove = new StoreMoveInfo(StoreName);
StoreMove = new StoreMoveInfo(StoreName);
mainTimer = new System.Timers.Timer();
mainTimer.Enabled = false;
mainTimer.Interval = 300;
......@@ -104,7 +135,7 @@ namespace OnlineStore.DeviceLibrary
ledCheckTimer.AutoReset = true;
ledCheckTimer.Enabled = false;
//IoCheckTimer.Elapsed += IoCheckTimer_Elapsed;
}
}
/// <summary>
......@@ -179,10 +210,10 @@ namespace OnlineStore.DeviceLibrary
aa = ResourceControl.GetString(ResourceControl.OutMoveExecute, "出库完成");
break;
case StoreStatus.InStoreFaild:
aa = ResourceControl.GetString(ResourceControl.InStoreFailed, "入库失败") + "(" + WarnMsg + ")";
aa = ResourceControl.GetString(ResourceControl.InStoreFailed, "入库失败") + "(" + WarnObj.WarnMsg + ")";
break;
case StoreStatus.OutStoreFaild:
aa = ResourceControl.GetString(ResourceControl.OutStoreFailed, "出库失败") + "(" + WarnMsg + ")";
aa = ResourceControl.GetString(ResourceControl.OutStoreFailed, "出库失败") + "(" + WarnObj.WarnMsg + ")";
break;
}
if (!aa.Equals(""))
......@@ -206,7 +237,7 @@ namespace OnlineStore.DeviceLibrary
public object lastDiListLock = "";
public void addLastDI(string type, IO_VALUE value)
{
{
try
{
lock (lastDiListLock)
......@@ -223,14 +254,14 @@ namespace OnlineStore.DeviceLibrary
LOGGER.Error(ex.ToString());
}
}
/// <summary>
/// 运动处理
/// </summary>
protected bool isInPro = false;
protected virtual void BusyMoveProcess()
{
{
isInPro = true;
try
{
......@@ -254,12 +285,12 @@ namespace OnlineStore.DeviceLibrary
break;
default: break;
}
}catch(Exception ex)
} catch (Exception ex)
{
LogUtil.error("BusyMoveProcess出错:"+ex.ToString());
LogUtil.error("BusyMoveProcess出错:" + ex.ToString());
}
isInPro = false;
}
}
protected void SaveAlarmInfo(StoreAlarmType alarmType, string alarmDetial, string alarmMsg, StoreMoveType storeMoveType)
{
alarmMsg = alarmMsg.Replace(StoreName, "");
......@@ -295,7 +326,7 @@ namespace OnlineStore.DeviceLibrary
//case StoreAlarmType.StellAlarm:
// aType = 2;
// alarmDetial = "5";
//break;
//break;
default: break;
}
alarmInfo = new AlarmInfo(StoreID, aType, alarmDetial, alarmMsg, inoutStatus);
......@@ -304,7 +335,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始运行
/// </summary>
public abstract bool StartRun();
public abstract bool StartRun();
/// <summary>
/// 停止运行
/// </summary>
......@@ -318,12 +349,12 @@ namespace OnlineStore.DeviceLibrary
/// 重置(夹料装置状态不变)
/// </summary>
public abstract void Reset();
/// <summary>
/// 停止所有运动
/// </summary>
public abstract void StopMove( bool IsCloseAxis);
public abstract void StopMove(bool IsCloseAxis);
/// <summary>
/// 重置处理
/// </summary>
......@@ -340,8 +371,8 @@ namespace OnlineStore.DeviceLibrary
{
moveAxis.TargetPosition = 0;
LogUtil.debug(LOGGER, moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回");
StoreMove.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true));
ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed);
StoreMove.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true));
ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed);
}
/// <summary>
......@@ -362,20 +393,20 @@ namespace OnlineStore.DeviceLibrary
msg = "";
string deviceName = moveAxis.DeviceName;
int axisNo = moveAxis.GetAxisValue();
bool isOk = ACServerManager.GetBusyStatus(deviceName, axisNo).Equals(0);
int outCount = ACServerManager.GetActualtPosition(deviceName, axisNo);
int errorCount = Math.Abs(outCount - targetPosition);
if (isOk)
if (isOk)
{
if (errorCount > moveAxis.CanErrorCountMax)
{
{
//判断是否需要重新运动
if (StoreMove.CanWhileCount > 0)
{
LogUtil.error(LOGGER, moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount +
"],误差过大,重新开始运动,剩余[" + StoreMove.CanWhileCount + "]次");
ACServerManager.SuddenStop(moveAxis.DeviceName,moveAxis.GetAxisValue());
ACServerManager.SuddenStop(moveAxis.DeviceName, moveAxis.GetAxisValue());
Thread.Sleep(2000);
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
StoreMove.CanWhileCount--;
......@@ -383,9 +414,10 @@ namespace OnlineStore.DeviceLibrary
}
else
{
msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount
+ "],误差过大,需要报警";
LogUtil.error(LOGGER, msg);
// msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount+ "],误差过大,需要报警";
SetWarnMsgAndLog(ResourceControl.AxisMoveAlarm, StoreMove.MoveStep + "", moveAxis.GetNameStr(), targetPosition + "", outCount + "");
msg = WarnObj.WarnMsg;
// LogUtil.error(LOGGER, msg);
return false;
}
......@@ -424,13 +456,31 @@ namespace OnlineStore.DeviceLibrary
}
else
{
msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
LogUtil.error(LOGGER, msg);
}
// msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
SetWarnMsgAndLog(ResourceControl.AxisHomeMoveAlarm, StoreMove.MoveStep + "", moveAxis.GetNameStr(), outCount + "");
msg = WarnObj.WarnMsg;
// LogUtil.error(LOGGER, msg);
}
}
return false;
}
}
}
public class WarnInfo
{
public WarnInfo()
{
MsgCode = "";
WarnMsg = "";
MsgParam = null;
}
public string MsgCode { set; get; }
public string WarnMsg { set; get; }
public string[] MsgParam { set; get; }
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!