Commit a5ff6dbd LN

出入库过程中进出轴报警,调用disablePos库位

1 个父辈 26b4e537
...@@ -668,26 +668,48 @@ namespace OnlineStore.DeviceLibrary ...@@ -668,26 +668,48 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, StoreName + ",停止运行,总运行时间:" + span.ToString()); LogUtil.info(LOGGER, StoreName + ",停止运行,总运行时间:" + span.ToString());
} }
private DateTime lastDisTime = DateTime.Now;
public override void Alarm(StoreAlarmType alarmType, string alarmDetial, string alarmMsg, StoreMoveType storeMoveType) private string LastPosId = "";
public override void Alarm(StoreAlarmType nalarmType, string alarmDetial, string alarmMsg, StoreMoveType storeMoveType)
{ {
SaveAlarmInfo(alarmType, alarmDetial, alarmMsg, storeMoveType); SaveAlarmInfo(nalarmType, alarmDetial, alarmMsg, storeMoveType);
autoNext = false; autoNext = false;
if (this.alarmType.Equals(alarmType) && alarmType != StoreAlarmType.SuddenStop && alarmType != StoreAlarmType.NoAirCheck) if (this.alarmType.Equals(nalarmType) && nalarmType != StoreAlarmType.SuddenStop && nalarmType != StoreAlarmType.NoAirCheck)
{ {
return; return;
} }
LogUtil.error(LOGGER, StoreName + " 报警,报警类型:" + alarmType); LogUtil.error(LOGGER, StoreName + " 报警,报警类型:" + nalarmType);
this.alarmType = alarmType; this.alarmType = nalarmType;
if (alarmType.Equals(StoreAlarmType.AxisAlarm) | alarmType.Equals(StoreAlarmType.AxisMoveError)) if (nalarmType.Equals(StoreAlarmType.AxisAlarm) | nalarmType.Equals(StoreAlarmType.AxisMoveError))
{ {
if (StoreMove.MoveType.Equals(StoreMoveType.InStore) || StoreMove.MoveType.Equals(StoreMoveType.OutStore))
//只有第一次报警才处理库位号
{
if (alarmDetial.Equals(LineAlarm.InOutAxisAlarm.ToString()) && StoreMove.MoveParam != null && StoreMove.MoveParam.PosInfo != null)
{
string posId = StoreMove.MoveParam.PosInfo.PosId;
TimeSpan span = DateTime.Now - lastDisTime;
if (lastPosId.Equals(posId) && span.TotalSeconds < 8)
{
//同一个库位8秒内不重复发
}
else
{
lastDisTime = DateTime.Now;
LastPosId = posId;
LogUtil.info(StoreName + " [" + StoreMove.MoveType + "][" + StoreMove.MoveStep + "]" + StoreMove.MoveParam.PosInfo.ToStr() + " 过程中进出轴报警,记录库位号[" + posId + "],调用disablePos");
Task.Factory.StartNew(delegate () { StoreManager.disablePos(posId); });
}
}
}
LogUtil.error(LOGGER, StoreName + "轴报警,关闭刹车,停止运动,关闭轴,打开报警灯"); LogUtil.error(LOGGER, StoreName + "轴报警,关闭刹车,停止运动,关闭轴,打开报警灯");
IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
StopMove(true); StopMove(true);
} }
else if (alarmType == StoreAlarmType.SuddenStop) else if (nalarmType == StoreAlarmType.SuddenStop)
{ {
isInSuddenDown = true; isInSuddenDown = true;
LogUtil.error(LOGGER, StoreName + "收到急停信号,关闭刹车,停止运动,关闭轴,打开报警灯 "); LogUtil.error(LOGGER, StoreName + "收到急停信号,关闭刹车,停止运动,关闭轴,打开报警灯 ");
...@@ -696,7 +718,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -696,7 +718,7 @@ namespace OnlineStore.DeviceLibrary
StopMove(true); StopMove(true);
storeStatus = StoreStatus.SuddenStop; storeStatus = StoreStatus.SuddenStop;
} }
else if (alarmType.Equals(StoreAlarmType.NoAirCheck)) else if (nalarmType.Equals(StoreAlarmType.NoAirCheck))
{ {
isNoAirCheck = true; isNoAirCheck = true;
LogUtil.error(LOGGER, StoreName + " 未检测到气压信号 ,打开刹车,停止运动,关闭轴,打开报警灯 "); LogUtil.error(LOGGER, StoreName + " 未检测到气压信号 ,打开刹车,停止运动,关闭轴,打开报警灯 ");
......
...@@ -255,6 +255,44 @@ namespace OnlineStore.DeviceLibrary ...@@ -255,6 +255,44 @@ namespace OnlineStore.DeviceLibrary
return msg; return msg;
} }
// 料仓进出轴报警时,屏蔽正在执行的库位: /rest/api/qisda/device/disablePos //参数: posName: 库位编号
// 返回:{ "code":0,"msg":"ok","data":""} code: 0为正常,其他为异常,msg: 消息,data:
private static string Addr_disablePos = "/rest/api/qisda/device/disablePos";
public static string disablePos(string posName)
{
string msg = "";
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("posName", posName);
string server = GetAddr(Addr_cancelPutInTask, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
LogUtil.info("disablePos " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
ResultData data = JsonHelper.DeserializeJsonToObject<ResultData>(resultStr);
if (data == null)
{
return msg = " disablePos【 " + posName + "】 没有收到服务器反馈";
}
else if (data.code.Equals(0).Equals(false))
{
return msg = " disablePos【 " + posName + "】 :" + data.msg;
}
return "";
}
catch (Exception ex)
{
LogUtil.error(" disablePos error :" + ex.ToString());
}
return msg;
}
} }
public class ResultData public class ResultData
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!