Commit bf97d423 LN

报警消息WarnMsg 改为WarnIfo对象。

1 个父辈 b6d40e83
...@@ -260,8 +260,8 @@ namespace OnlineStore.AutoInOutStore ...@@ -260,8 +260,8 @@ namespace OnlineStore.AutoInOutStore
return; return;
} }
lblTemp.Text = store.currTempStr; lblTemp.Text = store.currTempStr;
lblBatchMsg.Text = AutomaticBaiting.WarnMsg; lblBatchMsg.Text = AutomaticBaiting.WarnObj.WarnMsg;
lblWarnMsg.Text = store.WarnMsg; lblWarnMsg.Text = store.WarnObj.WarnMsg ;
BatchInoutStatus(); BatchInoutStatus();
//忙碌状态不读取状态 //忙碌状态不读取状态
if (!store.storeRunStatus.Equals(StoreRunStatus.Busy)) if (!store.storeRunStatus.Equals(StoreRunStatus.Busy))
......
...@@ -253,16 +253,16 @@ ...@@ -253,16 +253,16 @@
<value>Alarm</value> <value>Alarm</value>
</data> </data>
<data name="InStoreError" xml:space="preserve"> <data name="InStoreError" xml:space="preserve">
<value>Saving format error</value> <value>Saving format error:code [{0}] posId [{1}]</value>
</data> </data>
<data name="InStoreNoPosition" xml:space="preserve"> <data name="InStoreNoPosition" xml:space="preserve">
<value>Saving location not found</value> <value>Saving location not found:code [{0}] posId [{1}]</value>
</data> </data>
<data name="OutStoreError" xml:space="preserve"> <data name="OutStoreError" xml:space="preserve">
<value>Providing format error</value> <value>Providing format error{0}</value>
</data> </data>
<data name="OutStoreNoPosition" xml:space="preserve"> <data name="OutStoreNoPosition" xml:space="preserve">
<value>Providing location not found</value> <value>Providing location not found{0}</value>
</data> </data>
<data name="AbsMove" xml:space="preserve"> <data name="AbsMove" xml:space="preserve">
<value>Absolute move</value> <value>Absolute move</value>
...@@ -875,7 +875,7 @@ ...@@ -875,7 +875,7 @@
<value>Access controller block</value> <value>Access controller block</value>
</data> </data>
<data name="Y16" xml:space="preserve"> <data name="Y16" xml:space="preserve">
<value >alarm buzzer</value> <value>alarm buzzer</value>
</data> </data>
<data name="X21" xml:space="preserve"> <data name="X21" xml:space="preserve">
<value>Feeding door close</value> <value>Feeding door close</value>
...@@ -1153,7 +1153,6 @@ ...@@ -1153,7 +1153,6 @@
<data name="startFailAir" xml:space="preserve"> <data name="startFailAir" xml:space="preserve">
<value>Startup failure: no air pressure signal</value> <value>Startup failure: no air pressure signal</value>
</data> </data>
<data name="FrmStoreBox_groupAuto_Text" xml:space="preserve"> <data name="FrmStoreBox_groupAuto_Text" xml:space="preserve">
<value>auto storing</value> <value>auto storing</value>
</data> </data>
...@@ -1190,7 +1189,6 @@ ...@@ -1190,7 +1189,6 @@
<data name="禁用调试" xml:space="preserve"> <data name="禁用调试" xml:space="preserve">
<value>Disable debugging</value> <value>Disable debugging</value>
</data> </data>
<data name="X25" xml:space="preserve"> <data name="X25" xml:space="preserve">
<value>Doorlock cylinder open 2</value> <value>Doorlock cylinder open 2</value>
</data> </data>
...@@ -1221,4 +1219,31 @@ ...@@ -1221,4 +1219,31 @@
<data name="自动出入库操作" xml:space="preserve"> <data name="自动出入库操作" xml:space="preserve">
<value>Auto providing operation</value> <value>Auto providing operation</value>
</data> </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> </root>
\ No newline at end of file \ No newline at end of file
...@@ -253,16 +253,16 @@ ...@@ -253,16 +253,16 @@
<value>报警</value> <value>报警</value>
</data> </data>
<data name="InStoreError" xml:space="preserve"> <data name="InStoreError" xml:space="preserve">
<value>入库库位格式错误:</value> <value>入库库位格式错误条码[{0}]库位号[{1}]</value>
</data> </data>
<data name="InStoreNoPosition" xml:space="preserve"> <data name="InStoreNoPosition" xml:space="preserve">
<value>入库未找到库位:</value> <value>入库未找到库位:条码[{0}]库位号[{1}]</value>
</data> </data>
<data name="OutStoreError" xml:space="preserve"> <data name="OutStoreError" xml:space="preserve">
<value>出库格式错误:</value> <value>出库格式错误{0}</value>
</data> </data>
<data name="OutStoreNoPosition" xml:space="preserve"> <data name="OutStoreNoPosition" xml:space="preserve">
<value>出库未找库位:</value> <value>出库未找库位:{0}</value>
</data> </data>
<data name="AbsMove" xml:space="preserve"> <data name="AbsMove" xml:space="preserve">
<value>绝对运动</value> <value>绝对运动</value>
...@@ -871,7 +871,7 @@ ...@@ -871,7 +871,7 @@
<value>门禁功能屏蔽</value> <value>门禁功能屏蔽</value>
</data> </data>
<data name="Y16" xml:space="preserve"> <data name="Y16" xml:space="preserve">
<value >报警蜂鸣器</value> <value>报警蜂鸣器</value>
</data> </data>
<data name="X21" xml:space="preserve"> <data name="X21" xml:space="preserve">
<value>上料机构门关闭</value> <value>上料机构门关闭</value>
...@@ -1188,8 +1188,6 @@ ...@@ -1188,8 +1188,6 @@
<data name="禁用调试" xml:space="preserve"> <data name="禁用调试" xml:space="preserve">
<value>禁用调试</value> <value>禁用调试</value>
</data> </data>
<data name="X25" xml:space="preserve"> <data name="X25" xml:space="preserve">
<value>门锁气缸打开端2</value> <value>门锁气缸打开端2</value>
</data> </data>
...@@ -1220,4 +1218,31 @@ ...@@ -1220,4 +1218,31 @@
<data name="自动出入库操作" xml:space="preserve"> <data name="自动出入库操作" xml:space="preserve">
<value>自动出入库操作</value> <value>自动出入库操作</value>
</data> </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> </root>
\ No newline at end of file \ No newline at end of file
...@@ -210,6 +210,7 @@ IO模块读取时间改为可配置。 ...@@ -210,6 +210,7 @@ IO模块读取时间改为可配置。
20190610 20190610
部分中英文修改。 部分中英文修改。
20190613
报警消息WarnMsg 改为WarnIfo对象。
...@@ -64,6 +64,14 @@ namespace OnlineStore.Common ...@@ -64,6 +64,14 @@ namespace OnlineStore.Common
/// </summary> /// </summary>
public string msg { get; set; } public string msg { get; set; }
/// <summary> /// <summary>
///提示消息类型
/// </summary>
public string msgCode { get; set; }
/// <summary>
/// 消息参数
/// </summary>
public string[] msgParam { get; set; }
/// <summary>
/// 包含的多个 BOX 的状态信息 /// 包含的多个 BOX 的状态信息
/// </summary> /// </summary>
public Dictionary<int, BoxStatus> boxStatus = new Dictionary<int, BoxStatus>(); public Dictionary<int, BoxStatus> boxStatus = new Dictionary<int, BoxStatus>();
...@@ -71,6 +79,12 @@ namespace OnlineStore.Common ...@@ -71,6 +79,12 @@ namespace OnlineStore.Common
/// 报警集合 /// 报警集合
/// </summary> /// </summary>
public List<AlarmInfo> alarmList = new List<AlarmInfo>(); 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> /// <summary>
...@@ -97,6 +111,14 @@ namespace OnlineStore.Common ...@@ -97,6 +111,14 @@ namespace OnlineStore.Common
/// </summary> /// </summary>
public string msg { get; set; } public string msg { get; set; }
/// <summary> /// <summary>
///提示消息类型
/// </summary>
public string msgCode { get; set; }
/// <summary>
/// 消息参数
/// </summary>
public string[] msgParam { get; set; }
/// <summary>
/// 温度 /// 温度
/// </summary> /// </summary>
public string temperature { get; set; } public string temperature { get; set; }
...@@ -115,6 +137,13 @@ namespace OnlineStore.Common ...@@ -115,6 +137,13 @@ namespace OnlineStore.Common
get { return _data; } get { return _data; }
set { _data = value; } 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 public class AlarmInfo
{ {
...@@ -163,7 +192,7 @@ namespace OnlineStore.Common ...@@ -163,7 +192,7 @@ namespace OnlineStore.Common
/// <summary> /// <summary>
/// 0,1=入库,2=出库 /// 0,1=入库,2=出库
/// </summary> /// </summary>
public int inOutStatus { get; set; } public int inOutStatus { get; set; }
} }
public class ParamDefine public class ParamDefine
......
...@@ -18,7 +18,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -18,7 +18,12 @@ namespace OnlineStore.DeviceLibrary
string result = GetStrEvent?.Invoke(value, value); string result = GetStrEvent?.Invoke(value, value);
return result; 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); string result = GetStrEvent?.Invoke(id, defaultStr);
return result; return result;
...@@ -149,19 +154,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -149,19 +154,19 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public static string Alarm = "Alarm"; public static string Alarm = "Alarm";
/// <summary> /// <summary>
///"入库库位格式错误:" ///入库库位格式错误:条码[{0}]库位号[{1}]
/// </summary> /// </summary>
public static string InStoreError = "InStoreError"; public static string InStoreError = "InStoreError";
/// <summary> /// <summary>
///"入库未找到库位:" ///"入库未找到库位:条码[{0}]库位号[{1}]"
/// </summary> /// </summary>
public static string InStoreNoPosition = "InStoreNoPosition"; public static string InStoreNoPosition = "InStoreNoPosition";
/// <summary> /// <summary>
///"出库格式错误:" ///出库格式错误{0}
/// </summary> /// </summary>
public static string OutStoreError = "OutStoreError"; public static string OutStoreError = "OutStoreError";
/// <summary> /// <summary>
///"出库未找库位:" ///"出库未找库位:{0}"
/// </summary> /// </summary>
public static string OutStoreNoPosition = "OutStoreNoPosition"; public static string OutStoreNoPosition = "OutStoreNoPosition";
...@@ -314,5 +319,50 @@ namespace OnlineStore.DeviceLibrary ...@@ -314,5 +319,50 @@ namespace OnlineStore.DeviceLibrary
///启动失败:没有气压信号 ///启动失败:没有气压信号
/// </summary> /// </summary>
public static string startFailAir = "startFailAir"; 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";
} }
} }
...@@ -119,6 +119,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -119,6 +119,7 @@ namespace OnlineStore.DeviceLibrary
//当等待超过一分钟时,需要打印提示 //当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - StoreMove.LastSetpTime; TimeSpan span = DateTime.Now - StoreMove.LastSetpTime;
string NotOkMsg = ""; string NotOkMsg = "";
int waitType = 0;
if (list.Count <= 0) if (list.Count <= 0)
{ {
StoreMove.EndStepWait(); StoreMove.EndStepWait();
...@@ -135,7 +136,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -135,7 +136,9 @@ namespace OnlineStore.DeviceLibrary
{ {
continue; continue;
} }
NotOkMsg = wait.ToStr(); NotOkMsg = wait.ToStr();
waitType = wait.WaitType;
if (wait.WaitType == (int)Wait_Type.AxisMove_1) if (wait.WaitType == (int)Wait_Type.AxisMove_1)
{ {
string msg = ""; string msg = "";
...@@ -150,9 +153,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -150,9 +153,9 @@ namespace OnlineStore.DeviceLibrary
if (!msg.Equals("")) if (!msg.Equals(""))
{ {
isOk = false; isOk = false;
WarnMsg = msg; //WarnMsg = msg;
//LogUtil.info(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; return;
break; break;
} }
...@@ -172,15 +175,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -172,15 +175,16 @@ namespace OnlineStore.DeviceLibrary
if (!doValue.Equals(wait.IoValue)) if (!doValue.Equals(wait.IoValue))
{ {
LogUtil.error("等待[" + NotOkMsg + "],重写DO(" + ioType + "=" + 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) if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
{ {
ConfigIO io = Config.getWaitIO(wait.IoType); ConfigIO io = Config.getWaitIO(wait.IoType);
WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.WaitSingle, " 等待信号") + io.DisplayStr + "=" + wait.IoValue + ResourceControl.GetString(ResourceControl.TimeOut, "超时!"); // WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.WaitSingle, " 等待信号") + io.DisplayStr + "=" + wait.IoValue + ResourceControl.GetString(ResourceControl.TimeOut, "超时!");
Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, StoreMove.MoveType); SetWarnMsg(ResourceControl.WaitSingleTimeOut, io.ElectricalDefinition + "_" + io.ProName, wait.IoValue + "");
LogUtil.error( StoreName + wait.IoType + ResourceControl.GetString(ResourceControl.WaitSingle, " 等待信号") + "(" + io.DisplayStr + "=" + wait.IoValue + ") " + ResourceControl.GetString(ResourceControl.TimeOut, "超时"), 14); Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnObj.WarnMsg, StoreMove.MoveType);
LogUtil.error(WarnObj.WarnMsg, 14);
isOk = false; isOk = false;
return; return;
break; break;
...@@ -199,10 +203,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -199,10 +203,10 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = AutomaticBaiting.IsGetTrayGo; wait.IsEnd = AutomaticBaiting.IsGetTrayGo;
} }
else if (wait.WaitType == (int)Wait_Type.BatchAxisMove_10) else if (wait.WaitType == (int)Wait_Type.BatchAxisMove_10)
{ {
if (!wait.IsEnd) if (!wait.IsEnd)
{ {
wait.IsEnd = AutomaticBaiting.BatchAxisIsEnd(wait,span); wait.IsEnd = AutomaticBaiting.BatchAxisIsEnd(wait, span);
} }
if (!wait.IsEnd) if (!wait.IsEnd)
{ {
...@@ -248,9 +252,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -248,9 +252,12 @@ namespace OnlineStore.DeviceLibrary
} }
else if (span.TotalSeconds > StoreMove.TimeOutSeconds) else if (span.TotalSeconds > StoreMove.TimeOutSeconds)
{ {
WarnMsg = "[" + StoreMove.MoveStep + "]"+ResourceControl.GetString(ResourceControl.TimeOut, "超时" )+"[" + NotOkMsg + "][" + Math.Round(span.TotalSeconds, 1) + "]"; string msg = ResourceControl.GetString(ResourceControl.MoveTimeOut, "[" + StoreMove.MoveStep + "]" +
LogUtil.error(WarnMsg, 15); ResourceControl.GetString(ResourceControl.TimeOut, "超时") + "[" + NotOkMsg + "][" + Math.Round(span.TotalSeconds, 1) + "]");
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType); 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) private bool ShuoKeIsEnd(WaitResultInfo wait, out string msg)
......
...@@ -27,7 +27,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -27,7 +27,7 @@ namespace OnlineStore.DeviceLibrary
public static string LastCode = ""; public static string LastCode = "";
private static string LastPosId = ""; private static string LastPosId = "";
public static int AxisChangeValue = ConfigAppSettings.GetIntValue(Setting_Init.AxisChangeValue); public static int AxisChangeValue = ConfigAppSettings.GetIntValue(Setting_Init.AxisChangeValue);
public static string WarnMsg = ""; // public static string WarnMsg = "";
public static string CodeMsg = ""; public static string CodeMsg = "";
public static string Name = "批量上下料 "; public static string Name = "批量上下料 ";
public static StoreMoveInfo StoreMove = null; public static StoreMoveInfo StoreMove = null;
...@@ -42,7 +42,35 @@ namespace OnlineStore.DeviceLibrary ...@@ -42,7 +42,35 @@ namespace OnlineStore.DeviceLibrary
public static int BatchInStoreCount = 0; public static int BatchInStoreCount = 0;
public static int BatchInStoreHeight = 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>
/// 初始化数据 /// 初始化数据
/// </summary> /// </summary>
...@@ -88,8 +116,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -88,8 +116,8 @@ namespace OnlineStore.DeviceLibrary
//需要判断门关闭 //需要判断门关闭
if (!DoorIsClose()) if (!DoorIsClose())
{ {
msg = (ResourceControl.GetString(ResourceControl.CloseError, "锁门失败:请先关闭上料机构")); ; // msg = (ResourceControl.GetString(ResourceControl.CloseError, "锁门失败:请先关闭上料机构")); ;
return msg; return ResourceControl.CloseError;
} }
return msg; return msg;
...@@ -149,7 +177,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -149,7 +177,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(Name + " 复位前,清理报警【" + StoreManager.Store.alarmType + "】"); LogUtil.info(Name + " 复位前,清理报警【" + StoreManager.Store.alarmType + "】");
StoreManager.Store.alarmType = StoreAlarmType.None; StoreManager.Store.alarmType = StoreAlarmType.None;
IOManager.IOMove(IO_Type.Buzzer_Sign, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Buzzer_Sign, IO_VALUE.LOW);
WarnMsg = ""; // WarnMsg = "";
SetWarnMsg("");
} }
AutomaticBaiting.IsNeedStartInout = isNeedInout; AutomaticBaiting.IsNeedStartInout = isNeedInout;
AutomaticBaiting.IsNeedAxisHome = isNeedHome; AutomaticBaiting.IsNeedAxisHome = isNeedHome;
...@@ -243,7 +272,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -243,7 +272,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(Name + "复位完成"); LogUtil.info(Name + "复位完成");
StoreMove.EndMove(); StoreMove.EndMove();
AutoBaitingStatus = StoreRunStatus.Runing; AutoBaitingStatus = StoreRunStatus.Runing;
WarnMsg = ""; // WarnMsg = "";
SetWarnMsg("");
IsNeedStartInout = false; IsNeedStartInout = false;
break; break;
default: break; default: break;
...@@ -347,9 +377,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -347,9 +377,10 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
//TODO 报警 //TODO 报警
WarnMsg = ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败"); //WarnMsg = ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败");
StoreManager.Store.Alarm(StoreAlarmType.BatchAlarm, ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败"), WarnMsg, StoreMoveType.InStore); SetWarnMsg(ResourceControl.XiLiaoError);
LogUtil.error(WarnMsg, 103); 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)) else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I06_SuckingDisc_Up))
...@@ -377,8 +408,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -377,8 +408,9 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
WarnMsg = ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败"); // WarnMsg = ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败");
StoreManager.Store.Alarm(StoreAlarmType.BatchAlarm, ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败"), WarnMsg, StoreMoveType.InStore); SetWarnMsg(ResourceControl.XiLiaoError);
StoreManager.Store.Alarm(StoreAlarmType.BatchAlarm, WarnObj.WarnMsg, WarnObj.WarnMsg, StoreMoveType.InStore);
LogUtil.error(Name + "入料: 吸盘上升后未检测到吸盘压力信号,吸取料盘失败", 105); LogUtil.error(Name + "入料: 吸盘上升后未检测到吸盘压力信号,吸取料盘失败", 105);
} }
} }
...@@ -427,15 +459,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -427,15 +459,17 @@ namespace OnlineStore.DeviceLibrary
{ {
StoreManager.Store.LoguStatus(); StoreManager.Store.LoguStatus();
//一分钟还未开始,报警超时 //一分钟还未开始,报警超时
WarnMsg = "[" + StoreMove.MoveStep + "]" + ResourceControl.GetString(ResourceControl.TimeOut, "超时") + "[等待可以入库][" + Math.Round(span.TotalSeconds, 0) + "秒]"; // WarnMsg = "[" + StoreMove.MoveStep + "]" + ResourceControl.GetString(ResourceControl.TimeOut, "超时") + "[等待可以入库][" + Math.Round(span.TotalSeconds, 0) + "秒]";
LogUtil.error(WarnMsg, 105); SetWarnMsg(ResourceControl.WaitInstoreTimeOut, StoreMove.MoveStep + "", Math.Round(span.TotalSeconds, 0) + "");
StoreManager.Store.Alarm(StoreAlarmType.BatchIoTimeOut, "", WarnMsg, StoreMove.MoveType); LogUtil.error(WarnObj.WarnMsg, 105);
StoreManager.Store.Alarm(StoreAlarmType.BatchIoTimeOut, "", WarnObj.WarnMsg, StoreMove.MoveType);
} }
} }
else else
{ {
WarnMsg = ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败"); //WarnMsg = ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败");
StoreManager.Store.Alarm(StoreAlarmType.BatchAlarm, ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败"), WarnMsg, StoreMoveType.InStore); SetWarnMsg(ResourceControl.XiLiaoError);
StoreManager.Store.Alarm(StoreAlarmType.BatchAlarm, ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败"), WarnObj.WarnMsg, StoreMoveType.InStore);
LogUtil.error(Name + "入料: 吸盘上升后未检测到吸盘压力信号,吸取料盘失败", 105); LogUtil.error(Name + "入料: 吸盘上升后未检测到吸盘压力信号,吸取料盘失败", 105);
} }
} }
...@@ -569,9 +603,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -569,9 +603,9 @@ namespace OnlineStore.DeviceLibrary
private static void ClearTimeOut() private static void ClearTimeOut()
{ {
if (WarnMsg.Contains(TimeOut)) if (WarnObj.WarnMsg.Contains(TimeOut))
{ {
WarnMsg = ""; SetWarnMsg( "");
} }
} }
......
...@@ -58,7 +58,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -58,7 +58,10 @@ namespace OnlineStore.DeviceLibrary
} }
else 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); LogUtil.error(msg, 100);
return false; return false;
} }
...@@ -80,6 +83,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -80,6 +83,7 @@ namespace OnlineStore.DeviceLibrary
//当等待超过一分钟时,需要打印提示 //当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - StoreMove.LastSetpTime; TimeSpan span = DateTime.Now - StoreMove.LastSetpTime;
string NotOkMsg = ""; string NotOkMsg = "";
int waitType = 0;
bool isOk = !StoreMove.OneWaitCanEndStep; bool isOk = !StoreMove.OneWaitCanEndStep;
foreach (WaitResultInfo wait in list) foreach (WaitResultInfo wait in list)
{ {
...@@ -88,6 +92,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -88,6 +92,7 @@ namespace OnlineStore.DeviceLibrary
continue; continue;
} }
NotOkMsg = wait.ToStr(); NotOkMsg = wait.ToStr();
waitType = wait.WaitType;
if (wait.WaitType == (int)Wait_Type.AxisMove_1) if (wait.WaitType == (int)Wait_Type.AxisMove_1)
{ {
bool isAlarm = false; bool isAlarm = false;
...@@ -190,9 +195,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -190,9 +195,11 @@ namespace OnlineStore.DeviceLibrary
} }
else if (span.TotalSeconds > StoreMove.TimeOutSeconds) else if (span.TotalSeconds > StoreMove.TimeOutSeconds)
{ {
WarnMsg = "[" + StoreMove.MoveStep + "]" + ResourceControl.GetString(ResourceControl.TimeOut, "超时") + " [" + NotOkMsg + "][" + Math.Round(span.TotalSeconds, 0) + "秒]"; string msg = "[" + StoreMove.MoveStep + "]" + ResourceControl.GetString(ResourceControl.TimeOut, "超时") + " [" + NotOkMsg + "][" + Math.Round(span.TotalSeconds, 0) + "秒]";
LogUtil.error(WarnMsg, 102); string newType = ResourceControl.MoveTimeOut + "_" + waitType.ToString().PadLeft(2, '0');
StoreManager.Store.Alarm(StoreAlarmType.BatchIoTimeOut, "", WarnMsg, StoreMove.MoveType); 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 ...@@ -226,7 +233,10 @@ namespace OnlineStore.DeviceLibrary
} }
else 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); LogUtil.error(msg);
} }
} }
...@@ -248,8 +258,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -248,8 +258,8 @@ namespace OnlineStore.DeviceLibrary
if (!msg.Equals("")) if (!msg.Equals(""))
{ {
isAlarm = true; isAlarm = true;
WarnMsg = msg; // WarnMsg = msg;
StoreManager.Store.Alarm(StoreAlarmType.BatchAxisAlarm, StoreManager.Store.GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType); StoreManager.Store.Alarm(StoreAlarmType.BatchAxisAlarm, StoreManager.Store.GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnObj.WarnMsg, StoreMove.MoveType);
} }
return wait.IsEnd; return wait.IsEnd;
...@@ -353,7 +363,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -353,7 +363,7 @@ namespace OnlineStore.DeviceLibrary
} }
if (LastCode.Equals("")) if (LastCode.Equals(""))
{ {
StoreManager.Store.CodeOrInoutMsg = "未扫到二维码,需要将料盘送出"; StoreManager.Store.CodeOrInoutMsg =ResourceControl.GetString(ResourceControl.InStoreNoCode, "未扫到二维码,需要将料盘送出");
LogUtil.error("未扫到二维码,需要将料盘送出"); LogUtil.error("未扫到二维码,需要将料盘送出");
} }
else else
...@@ -461,7 +471,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -461,7 +471,7 @@ namespace OnlineStore.DeviceLibrary
message = ScanCodeManager.ReplaceCode(message); message = ScanCodeManager.ReplaceCode(message);
if (message.Equals("") || string.IsNullOrEmpty(message)) if (message.Equals("") || string.IsNullOrEmpty(message))
{ {
CodeMsg = "没有收到二维码信息,请重新放入料盘"; CodeMsg =ResourceControl.GetString(ResourceControl.NoCodeMsg, "没有收到二维码信息,请重新放入料盘");
LogUtil.info(LogName + "没有收到二维码信息,请重新放入料盘"); LogUtil.info(LogName + "没有收到二维码信息,请重新放入料盘");
return null; return null;
} }
...@@ -523,8 +533,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -523,8 +533,9 @@ namespace OnlineStore.DeviceLibrary
string[] posArray = posId.Split('#'); string[] posArray = posId.Split('#');
if (!(posArray.Length == 2)) if (!(posArray.Length == 2))
{ {
WarnMsg = Name + ResourceControl.GetString(ResourceControl.InStoreError, "入库库位格式错误:") + "【" + message + "】【" + posId + "】"; // WarnMsg = Name + ResourceControl.GetString(ResourceControl.InStoreError, "入库库位格式错误:") + "【" + message + "】【" + posId + "】";
LogUtil.error("服务器反馈 入库库位格式错误:二维码【" + message + "】库位【" + posId + "】"); SetWarnMsgAndLog(ResourceControl.InStoreError, message, posId);
// LogUtil.error("服务器反馈 入库库位格式错误:二维码【" + message + "】库位【" + posId + "】");
return null; return null;
} }
...@@ -533,8 +544,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -533,8 +544,9 @@ namespace OnlineStore.DeviceLibrary
AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(posId); AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(posId);
if (position == null) if (position == null)
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因 { //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = ResourceControl.GetString(ResourceControl.InStoreNoPosition, "入库未找到库位:") + "【" + message + "】【" + posId + "】 "; // WarnMsg = ResourceControl.GetString(ResourceControl.InStoreNoPosition, "入库未找到库位:") + "【" + message + "】【" + posId + "】 ";
LogUtil.error("服务器反馈 入库未找到库位:二维码【" + message + "】库位【" + posId + "】"); SetWarnMsgAndLog(ResourceControl.InStoreNoPosition, message, posId);
// LogUtil.error("服务器反馈 入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
return null; return null;
} }
......
...@@ -8,7 +8,7 @@ using System.Drawing; ...@@ -8,7 +8,7 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
...@@ -20,7 +20,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -20,7 +20,7 @@ namespace OnlineStore.DeviceLibrary
protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public Stopwatch runTimeWatch = new Stopwatch(); public Stopwatch runTimeWatch = new Stopwatch();
/// <summary> /// <summary>
/// 最后一次气压检测变为0的时间 /// 最后一次气压检测变为0的时间
/// </summary> /// </summary>
...@@ -33,7 +33,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -33,7 +33,7 @@ namespace OnlineStore.DeviceLibrary
/// 是否没有检测到气压 /// 是否没有检测到气压
/// </summary> /// </summary>
public bool isNoAirCheck = false; public bool isNoAirCheck = false;
/// <summary> /// <summary>
/// 是否再报警中 /// 是否再报警中
/// </summary> /// </summary>
...@@ -45,7 +45,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -45,7 +45,7 @@ namespace OnlineStore.DeviceLibrary
/// 料仓单个调试状态(默认不是调试状态) /// 料仓单个调试状态(默认不是调试状态)
/// </summary> /// </summary>
public bool IsDebug = false; public bool IsDebug = false;
/// <summary> /// <summary>
///1=设备联机(正常就绪)(入库后,BOX恢复原始状态)(出库后,移载装置恢复原始状态), ///1=设备联机(正常就绪)(入库后,BOX恢复原始状态)(出库后,移载装置恢复原始状态),
///2=急停,3=故障,4=警告,5=调试 ///2=急停,3=故障,4=警告,5=调试
...@@ -65,11 +65,42 @@ namespace OnlineStore.DeviceLibrary ...@@ -65,11 +65,42 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 提示消息,一般发给服务器后清空(LineBean表示报警提示消息,BoxBean表示出入库失败的原因记录) /// 提示消息,一般发给服务器后清空(LineBean表示报警提示消息,BoxBean表示出入库失败的原因记录)
/// </summary> /// </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 string StoreName { get; set; }
public int StoreID { get; set; } public int StoreID { get; set; }
protected System.Timers.Timer mainTimer; protected System.Timers.Timer mainTimer;
protected System.Timers.Timer serverConnectTimer = new System.Timers.Timer(); protected System.Timers.Timer serverConnectTimer = new System.Timers.Timer();
protected System.Timers.Timer IoCheckTimer = new System.Timers.Timer(); protected System.Timers.Timer IoCheckTimer = new System.Timers.Timer();
...@@ -83,7 +114,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -83,7 +114,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
protected virtual void Init() protected virtual void Init()
{ {
StoreMove = new StoreMoveInfo(StoreName); StoreMove = new StoreMoveInfo(StoreName);
mainTimer = new System.Timers.Timer(); mainTimer = new System.Timers.Timer();
mainTimer.Enabled = false; mainTimer.Enabled = false;
mainTimer.Interval = 300; mainTimer.Interval = 300;
...@@ -104,7 +135,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -104,7 +135,7 @@ namespace OnlineStore.DeviceLibrary
ledCheckTimer.AutoReset = true; ledCheckTimer.AutoReset = true;
ledCheckTimer.Enabled = false; ledCheckTimer.Enabled = false;
//IoCheckTimer.Elapsed += IoCheckTimer_Elapsed; //IoCheckTimer.Elapsed += IoCheckTimer_Elapsed;
} }
/// <summary> /// <summary>
...@@ -179,10 +210,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -179,10 +210,10 @@ namespace OnlineStore.DeviceLibrary
aa = ResourceControl.GetString(ResourceControl.OutMoveExecute, "出库完成"); aa = ResourceControl.GetString(ResourceControl.OutMoveExecute, "出库完成");
break; break;
case StoreStatus.InStoreFaild: case StoreStatus.InStoreFaild:
aa = ResourceControl.GetString(ResourceControl.InStoreFailed, "入库失败") + "(" + WarnMsg + ")"; aa = ResourceControl.GetString(ResourceControl.InStoreFailed, "入库失败") + "(" + WarnObj.WarnMsg + ")";
break; break;
case StoreStatus.OutStoreFaild: case StoreStatus.OutStoreFaild:
aa = ResourceControl.GetString(ResourceControl.OutStoreFailed, "出库失败") + "(" + WarnMsg + ")"; aa = ResourceControl.GetString(ResourceControl.OutStoreFailed, "出库失败") + "(" + WarnObj.WarnMsg + ")";
break; break;
} }
if (!aa.Equals("")) if (!aa.Equals(""))
...@@ -206,7 +237,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -206,7 +237,7 @@ namespace OnlineStore.DeviceLibrary
public object lastDiListLock = ""; public object lastDiListLock = "";
public void addLastDI(string type, IO_VALUE value) public void addLastDI(string type, IO_VALUE value)
{ {
try try
{ {
lock (lastDiListLock) lock (lastDiListLock)
...@@ -223,14 +254,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -223,14 +254,14 @@ namespace OnlineStore.DeviceLibrary
LOGGER.Error(ex.ToString()); LOGGER.Error(ex.ToString());
} }
} }
/// <summary> /// <summary>
/// 运动处理 /// 运动处理
/// </summary> /// </summary>
protected bool isInPro = false; protected bool isInPro = false;
protected virtual void BusyMoveProcess() protected virtual void BusyMoveProcess()
{ {
isInPro = true; isInPro = true;
try try
{ {
...@@ -254,12 +285,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -254,12 +285,12 @@ namespace OnlineStore.DeviceLibrary
break; break;
default: break; default: break;
} }
}catch(Exception ex) } catch (Exception ex)
{ {
LogUtil.error("BusyMoveProcess出错:"+ex.ToString()); LogUtil.error("BusyMoveProcess出错:" + ex.ToString());
} }
isInPro = false; isInPro = false;
} }
protected void SaveAlarmInfo(StoreAlarmType alarmType, string alarmDetial, string alarmMsg, StoreMoveType storeMoveType) protected void SaveAlarmInfo(StoreAlarmType alarmType, string alarmDetial, string alarmMsg, StoreMoveType storeMoveType)
{ {
alarmMsg = alarmMsg.Replace(StoreName, ""); alarmMsg = alarmMsg.Replace(StoreName, "");
...@@ -295,7 +326,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -295,7 +326,7 @@ namespace OnlineStore.DeviceLibrary
//case StoreAlarmType.StellAlarm: //case StoreAlarmType.StellAlarm:
// aType = 2; // aType = 2;
// alarmDetial = "5"; // alarmDetial = "5";
//break; //break;
default: break; default: break;
} }
alarmInfo = new AlarmInfo(StoreID, aType, alarmDetial, alarmMsg, inoutStatus); alarmInfo = new AlarmInfo(StoreID, aType, alarmDetial, alarmMsg, inoutStatus);
...@@ -304,7 +335,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -304,7 +335,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 开始运行 /// 开始运行
/// </summary> /// </summary>
public abstract bool StartRun(); public abstract bool StartRun();
/// <summary> /// <summary>
/// 停止运行 /// 停止运行
/// </summary> /// </summary>
...@@ -318,12 +349,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -318,12 +349,12 @@ namespace OnlineStore.DeviceLibrary
/// 重置(夹料装置状态不变) /// 重置(夹料装置状态不变)
/// </summary> /// </summary>
public abstract void Reset(); public abstract void Reset();
/// <summary> /// <summary>
/// 停止所有运动 /// 停止所有运动
/// </summary> /// </summary>
public abstract void StopMove( bool IsCloseAxis); public abstract void StopMove(bool IsCloseAxis);
/// <summary> /// <summary>
/// 重置处理 /// 重置处理
/// </summary> /// </summary>
...@@ -340,8 +371,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -340,8 +371,8 @@ namespace OnlineStore.DeviceLibrary
{ {
moveAxis.TargetPosition = 0; moveAxis.TargetPosition = 0;
LogUtil.debug(LOGGER, moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回"); LogUtil.debug(LOGGER, moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回");
StoreMove.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true)); StoreMove.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true));
ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed); ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed);
} }
/// <summary> /// <summary>
...@@ -362,20 +393,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -362,20 +393,20 @@ namespace OnlineStore.DeviceLibrary
msg = ""; msg = "";
string deviceName = moveAxis.DeviceName; string deviceName = moveAxis.DeviceName;
int axisNo = moveAxis.GetAxisValue(); int axisNo = moveAxis.GetAxisValue();
bool isOk = ACServerManager.GetBusyStatus(deviceName, axisNo).Equals(0); bool isOk = ACServerManager.GetBusyStatus(deviceName, axisNo).Equals(0);
int outCount = ACServerManager.GetActualtPosition(deviceName, axisNo); int outCount = ACServerManager.GetActualtPosition(deviceName, axisNo);
int errorCount = Math.Abs(outCount - targetPosition); int errorCount = Math.Abs(outCount - targetPosition);
if (isOk) if (isOk)
{ {
if (errorCount > moveAxis.CanErrorCountMax) if (errorCount > moveAxis.CanErrorCountMax)
{ {
//判断是否需要重新运动 //判断是否需要重新运动
if (StoreMove.CanWhileCount > 0) if (StoreMove.CanWhileCount > 0)
{ {
LogUtil.error(LOGGER, moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount + LogUtil.error(LOGGER, moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount +
"],误差过大,重新开始运动,剩余[" + StoreMove.CanWhileCount + "]次"); "],误差过大,重新开始运动,剩余[" + StoreMove.CanWhileCount + "]次");
ACServerManager.SuddenStop(moveAxis.DeviceName,moveAxis.GetAxisValue()); ACServerManager.SuddenStop(moveAxis.DeviceName, moveAxis.GetAxisValue());
Thread.Sleep(2000); Thread.Sleep(2000);
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed); ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
StoreMove.CanWhileCount--; StoreMove.CanWhileCount--;
...@@ -383,9 +414,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -383,9 +414,10 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount // msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount+ "],误差过大,需要报警";
+ "],误差过大,需要报警"; SetWarnMsgAndLog(ResourceControl.AxisMoveAlarm, StoreMove.MoveStep + "", moveAxis.GetNameStr(), targetPosition + "", outCount + "");
LogUtil.error(LOGGER, msg); msg = WarnObj.WarnMsg;
// LogUtil.error(LOGGER, msg);
return false; return false;
} }
...@@ -424,13 +456,31 @@ namespace OnlineStore.DeviceLibrary ...@@ -424,13 +456,31 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警"; // msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
LogUtil.error(LOGGER, msg); SetWarnMsgAndLog(ResourceControl.AxisHomeMoveAlarm, StoreMove.MoveStep + "", moveAxis.GetNameStr(), outCount + "");
} msg = WarnObj.WarnMsg;
// LogUtil.error(LOGGER, msg);
}
} }
return false; 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!