Commit 3350a450 张东亮

报警添加、异常处理

1 个父辈 d1886a64
......@@ -131,7 +131,7 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(Config, targetPosition, targetSpeed));
Config.TargetPosition = targetPosition;
rtn = AxisManager.instance.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, Config.AddSpeed, Config.DelSpeed);
rtn = AxisManager.instance.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, Config.AddSpeed, Config.DelSpeed);
LogUtil.info($"{this.AxisName} AbsMove To [{targetPosition}] [speed={targetSpeed}][{rtn}]");
}
}
......@@ -148,7 +148,7 @@ namespace OnlineStore.DeviceLibrary
bool isOk = AxisManager.instance.GetBusyStatus(deviceName, axisNo).Equals(0) && AxisManager.instance.GetInPositionSingle(deviceName, axisNo).Equals(1);
int outCount = AxisManager.instance.GetActualtPosition(deviceName, axisNo);
int targetCount = AxisManager.instance.GetTargetPosition(deviceName, axisNo);
int errorCount = Math.Abs(outCount - targetPosition);
int errorCount = Math.Abs(outCount - targetPosition);
if (isOk)
{
string state = AxisManager.instance.GetStatus(deviceName, axisNo);
......@@ -203,6 +203,7 @@ namespace OnlineStore.DeviceLibrary
}
return false;
}
static Dictionary<string, int> axisPrePulse = new Dictionary<string, int>();
public static bool HomeMoveIsEnd(DeviceMoveInfo MoveInfo, ConfigMoveAxis axis, out string msg)
{
msg = "";
......@@ -238,6 +239,18 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(msg);
}
}
//var curPulse = AxisManager.instance.GetActualtPosition(axis.DeviceName, axis.GetAxisValue());
//if (axisPrePulse.ContainsKey(axis.DeviceName))
//{
// if (axisPrePulse[axis.DeviceName] != curPulse)//在运行
// {
// return true;
// }
//}
//else
//{
// axisPrePulse[axis.DeviceName] = curPulse;
//}
return false;
}
......@@ -285,7 +298,7 @@ namespace OnlineStore.DeviceLibrary
/// <param name="high"></param>
/// <param name="canErrorMax"></param>
/// <returns></returns>
public bool WithinRange(int low,int high,int canErrorMax=0)
public bool WithinRange(int low, int high, int canErrorMax = 0)
{
if (canErrorMax <= 0)
{
......@@ -316,7 +329,7 @@ namespace OnlineStore.DeviceLibrary
{
targetSpeed = Config.TargetSpeed * targetSpeed;
}
return AxisManager.instance.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPos, (int)targetSpeed, Config.AddSpeed, Config.DelSpeed);
return AxisManager.instance.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPos, (int)targetSpeed, Config.AddSpeed, Config.DelSpeed);
}
public void SuddenStop()
......@@ -361,7 +374,7 @@ namespace OnlineStore.DeviceLibrary
private bool IsInProcess = false;
private void CheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (IsInProcess ) { return; }
if (IsInProcess) { return; }
try
{
......
......@@ -4,11 +4,13 @@ using OnlineStore.DeviceLibrary.deviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.ModelBinding;
namespace OnlineStore.DeviceLibrary
{
......@@ -224,39 +226,56 @@ namespace OnlineStore.DeviceLibrary
public abstract bool StartOutstore(InOutParam param);
protected abstract void OutstoreProcess();
/// <summary>
/// 设置警告并上报
/// </summary>
/// <param name="msg"></param>
public void SetWarnMsg(string msg = "")
{
if (String.IsNullOrEmpty(msg).Equals(false))
{
if (WarnMsg.Equals(msg))
if (!WarnMsg.Equals(msg))
{
if (msg.StartsWith(Name))
{
LogUtil.error(msg, 801);
LogUtil.error(msg);
}
else
{
LogUtil.error(Name + msg, 801);
LogUtil.error(Name + msg);
}
}
}
else
WarnMsg = msg;
if(!string.IsNullOrEmpty(WarnMsg))
{
if (msg.StartsWith(Name))
{
LogUtil.error(msg);
}
else
Msg.add(WarnMsg, MsgLevel.alarm);
}
}
public void SetCriticalMsg(string msg = "")
{
if (String.IsNullOrEmpty(msg).Equals(false))
{
if (!WarnMsg.Equals(msg))
{
LogUtil.error(Name + msg);
if (msg.StartsWith(Name))
{
LogUtil.error(msg);
}
else
{
LogUtil.error(Name + msg);
}
}
}
}
WarnMsg = msg;
if(!string.IsNullOrEmpty(WarnMsg))
if (!string.IsNullOrEmpty(WarnMsg))
{
Msg.add(WarnMsg, MsgLevel.alarm);
Msg.add(WarnMsg, MsgLevel.critical);
}
}
public string GetRunStr( )
{
string sta = "运行中";
......@@ -401,10 +420,33 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.debug(Name + logInfo);
}
string errormsg = "";
public void LogError(string logInfo)
{
if (string.IsNullOrEmpty(logInfo))
{
return;
}
if (!logInfo.Equals(errormsg))
{
errormsg = logInfo;
LogUtil.error(Name + logInfo);
}
}
public void LogInfo(string logInfo)
{
StepMsg = logInfo;
LogUtil.info(Name + logInfo);
if(string.IsNullOrEmpty(logInfo))
{
return;
}
if(!logInfo.Equals(StepMsg))
{
StepMsg = logInfo;
LogUtil.info(Name + logInfo);
}
}
protected void MoveLog(string msg)
{
......
......@@ -17,7 +17,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 超时时间
/// </summary>
public int TimeOutSeconds = 60;
public int TimeOutSeconds = 120;
public string Name = "";
public bool ShelfNoTray = false;
public DeviceMoveInfo(int storeId,string name)
......
......@@ -82,6 +82,7 @@ namespace OnlineStore.DeviceLibrary
{
if (MoveStop)
{
Msg.add(Name + " 暂停运动中", MsgLevel.critical);
return;
}
if (MoveInfo.MoveType.Equals(MoveType.RHome))
......@@ -201,8 +202,9 @@ namespace OnlineStore.DeviceLibrary
else if (runStatus.Equals(RunStatus.Runing) && alarmType.Equals(AlarmType.None))
{
//设备处于空闲时且无异常,清空异常缓存
if (WarnMsg != "")
SetWarnMsg("");
if (!MoveStop)
if (WarnMsg != "")
SetWarnMsg("");
}
}
catch (Exception ex)
......@@ -491,11 +493,12 @@ namespace OnlineStore.DeviceLibrary
public virtual string GetMoveStr()
{
string msg = "";
msg += "runS: " + runStatus + "\n";
msg += "alarm: " + alarmType + " " + LastAlarmTime.ToLongTimeString() + "\n";
msg += "MoveT:" + MoveInfo.MoveType + "\n";
msg += "MoveS :" + MoveInfo.MoveStep + "\n";
msg += "StepMsg :" + StepMsg + "\n";
msg += "运行状态: " + runStatus + "\n";
msg += "报警: " + alarmType + " " + LastAlarmTime.ToLongTimeString() + "\n";
msg += "类型:" + MoveInfo.MoveType + "\n";
msg += "步骤 :" + MoveInfo.MoveStep + "\n";
msg += "消息 :" + StepMsg + "\n";
msg += "暂停 :" + (MoveStop ? "是" : "否") + "\n";
return msg;
}
......
......@@ -251,9 +251,9 @@ namespace OnlineStore.DeviceLibrary
AgvClient.SetCancelState(AgvClient.CurrCancelState);
LogUtil.info(Name + "复位完成 [" + FormUtil.GetSpanStr(span) + "]");
}
else if (span.TotalSeconds > 120)
else if (span.TotalSeconds > 240)
{
WarnMsg = Name + "[" + MoveInfo.MoveStep + "][" + msg + "]已等待超过2分钟";
WarnMsg = Name + "[" + MoveInfo.MoveStep + "][" + msg + "]已等待超过4分钟";
LogUtil.error(WarnMsg, MoveInfo.ErrorLogType);
Alarm(AlarmType.IoSingleTimeOut);
}
......
......@@ -767,7 +767,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.MoveParam.PosInfo.IsNG = true;
MoveInfo.MoveParam.MoveP = new LineMoveP(Config, MoveInfo.MoveParam.PosInfo.PosId);
MoveInfo.NextMoveStep(StepEnum.SO_14_GetReels_Ready);
// MoveAxisToP1();
// MoveAxisToP1();
PullAxis_UpdownToP1();
UpdownAxisTo_P4_P10();
//BuffAreaOutstoreDoor(true);
......@@ -808,7 +808,8 @@ namespace OnlineStore.DeviceLibrary
int SigLastTime = 7;//5秒
protected override void OnTimerProcess()
{
if (ExecuteOutListProcess())
bool isRunning = runStatus.Equals(RunStatus.Runing);
if (isRunning && ExecuteOutListProcess())
{
LogInfo("优先出库执行");
return;
......@@ -861,7 +862,8 @@ namespace OnlineStore.DeviceLibrary
ClearSpecifiedAlarm("B下出料暂存区有料盘,但信号未亮");
errUnderB = DateTime.Now;
}
if (!runStatus.Equals(RunStatus.Runing))
return;
if (IOValue(IO_Type.FeedingA_Instore_UpperArea_ReelCheck).Equals(IO_VALUE.HIGH) && BufferDataManager.AInStoreInfo != null
&& IOValue(IO_Type.FeedingB_Instore_UpperArea_ReelCheck).Equals(IO_VALUE.HIGH) && BufferDataManager.BInStoreInfo != null
&& (BufferDataManager.AInStoreInfo.PlateW == BufferDataManager.BInStoreInfo.PlateW && BufferDataManager.AInStoreInfo.PlateH == BufferDataManager.BInStoreInfo.PlateH))
......
......@@ -129,7 +129,7 @@ namespace OnlineStore.DeviceLibrary
}
public void ProcessMsg(List<Msg> msg)
{
uploadMsg = string.Join(",", msg.Select(x =>
uploadMsg = string.Join("\r\n", msg.Select(x =>
{
//if (x.msgLevel == MsgLevel.warning || x.msgLevel == MsgLevel.alarm)
{
......@@ -414,7 +414,8 @@ namespace OnlineStore.DeviceLibrary
if (position == null)
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
Msg.add(Name + "未找到库位:【" + inoutParam.PosInfo.ToStr() + "】", MsgLevel.warning);
WarnMsg = Name + "未找到库位:【" + inoutParam.PosInfo.ToStr() + "】";
Msg.add(WarnMsg, MsgLevel.warning);
LogUtil.error(WarnMsg);
continue;
}
......
......@@ -272,15 +272,14 @@ 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;
MoveInfo.NextMoveStep(StepEnum.SI_06_InOutBackToP1FromBuff);
LogInfo($"入库 {MoveInfo.SLog}:移栽X轴到待机点P1,行走机构到待机点P1[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
ignoreCurFork = false;
XAxis_To_P1();
MoveAxisToP1();
break;
......@@ -338,26 +337,27 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SI_08_ToPosition:
if (!CheckReel(true))
{
WarnMsg = $"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查";
Msg.add(WarnMsg, MsgLevel.critical);
SetCriticalMsg($"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查");
return;
}
ignoreCurFork = false;
MoveInfo.NextMoveStep(StepEnum.SI_08_ToPosition1);
ignoreCurFork = false;
LogInfo($"入库 {MoveInfo.SLog}:运行到库位,行走机构到存储库位取放点位P3," +
$"[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
MoveAxisToP3();
ForkCheckWhenRunning();
break;
case StepEnum.SI_08_ToPosition1:
StopForkCheck();
if (!CheckReel(true))
{
WarnMsg = $"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查";
Msg.add(WarnMsg, MsgLevel.critical);
SetCriticalMsg($"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查");
return;
}
ignoreCurFork = false;
MoveInfo.NextMoveStep(StepEnum.SI_09_ToTray);
ignoreCurFork = false;
LogInfo($"入库 {MoveInfo.SLog}:到抽屉提取点,料斗拉取进出轴到抽屉提取点P2/P4[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
PullAxis_Inout_To_P2_P4();
break;
......@@ -396,12 +396,12 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SI_12_MiddleToP3:
if (!CheckReel(true))
{
WarnMsg = $"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查";
Msg.add(WarnMsg, MsgLevel.critical);
SetCriticalMsg($"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查");
return;
}
ignoreCurFork = false;
MoveInfo.NextMoveStep(StepEnum.SI_13_GetReel);
ignoreCurFork = false;
LogInfo($"入库 {MoveInfo.SLog}:进入库位中,移栽升降轴到抽屉取放点P7/P13[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
UpdownAxisToP7_P13();
break;
......@@ -503,11 +503,11 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SI_19_InoutBack:
if (!CheckReel(false))
{
WarnMsg = "检测到料叉上有料盘,请检查";
SetCriticalMsg("检测到料叉上有料盘,请检查");
return;
}
ignoreCurFork = false;
MoveInfo.NextMoveStep(StepEnum.SI_19_InoutBack_1);
ignoreCurFork = false;
MiddleAxis_To_P2();
LogInfo($"入库 {MoveInfo.SLog}:移栽旋转轴到水平点[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
break;
......
......@@ -175,12 +175,12 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SO_13_InoutBack_1:
if (!CheckReel(true))
{
WarnMsg = $"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查";
Msg.add(WarnMsg,MsgLevel.critical);
SetCriticalMsg($"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查");
return;
}
ignoreCurFork = false;
MoveInfo.NextMoveStep(StepEnum.SO_13_InoutBack);
ignoreCurFork = false;
LogInfo($"出库 {MoveInfo.SLog}:抽屉拉取进出轴已到达拍照点,移栽旋转轴到取放料水平点P2[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
MiddleAxis_To_P2();
break;
......@@ -243,28 +243,29 @@ namespace OnlineStore.DeviceLibrary
LogInfo($"出库 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.ToStr()}][{MoveInfo.MoveParam.PosInfoBack.ToStr()}]取料完成,准备送往出料口,抽屉升降轴到P1点,移栽升降轴到下暂存区出库放料高点P4/P10");
break;
case StepEnum.SO_14_GetReels_Ready:
if (!CheckReel(true))
{
WarnMsg = $"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查";
Msg.add(WarnMsg, MsgLevel.critical);
return;
}
ignoreCurFork = false;
//if (!CheckReel(true))
//{
// SetCriticalMsg($"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查");
// return;
//}
MoveInfo.NextMoveStep(StepEnum.SO_14_GetReels_Ready1);
MoveAxisToP1();
ignoreCurFork = false;
LogInfo($"出库 {MoveInfo.SLog}:准备送往出料口。行走机构到待机点P1");
ForkCheckWhenRunning();
break;
case StepEnum.SO_14_GetReels_Ready1:
if (!CheckReel(true))
{
WarnMsg = $"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查";
Msg.add(WarnMsg,MsgLevel.critical);
return;
}
ignoreCurFork = false;
//if (!CheckReel(true))
//{
// SetCriticalMsg($"未检测到{MoveInfo.MoveParam.PosInfo.GetPosSide()}面料叉上的料盘,请检查");
// return;
//}
//已出一边的料,切换到另一边
MoveInfo.NextMoveStep(StepEnum.SO_15_ToBufferArea);
StopForkCheck();
ignoreCurFork = false;
//LogInfo($"出库 {MoveInfo.SLog}:到暂存区出料口," +
// $"行走机构到进出料机构取放点P2[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
break;
......@@ -308,7 +309,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);
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();
......@@ -331,7 +332,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.MoveParam.PosInfo = MoveInfo.MoveParam.PosInfoBack.ToCopy();
MoveInfo.MoveParam.MoveP = new LineMoveP(Config, MoveInfo.MoveParam.PosInfoBack.PosId);
MoveInfo.MoveParam.PosInfoBack = null;
// MoveAxisToP1();
// MoveAxisToP1();
PullAxis_UpdownToP1();
UpdownAxisTo_P4_P10();
}
......
......@@ -28,7 +28,7 @@ namespace OnlineStore.DeviceLibrary
//MoveAxisToP1();
PullAxis_UpdownToP1();
UpdownAxisTo_P4_P10();
// BuffAreaOutstoreDoor(true);
// BuffAreaOutstoreDoor(true);
break;
case StepEnum.SOB_14_GetReels_Ready1:
......@@ -38,14 +38,15 @@ namespace OnlineStore.DeviceLibrary
Msg.add(WarnMsg, MsgLevel.critical);
return;
}
ignoreCurFork = false;
//两侧已有同尺寸的料
MoveInfo.NextMoveStep(StepEnum.SOB_15_ToBufferArea);
ignoreCurFork = false;
LogInfo($"出库 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.barcode}]取料完成,准备送往出料口。行走机构到待机点P1");
MoveAxisToP1();
//PullAxis_UpdownToP1();
// UpdownAxisTo_P4_P10();
// UpdownAxisTo_P4_P10();
BuffAreaOutstoreDoor(true);
ForkCheckWhenRunning();
break;
case StepEnum.SOB_15_ToBufferArea:
if (!BothOutDoorCheck(MoveInfo.MoveParam))
......@@ -56,6 +57,7 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StepEnum.SOB_16_VerifyBufferState);
BuffAreaOutstoreDoor(true);
StopForkCheck();
LogInfo($"出库 {MoveInfo.SLog}:出料口无料盘确认,打开出料防护门,准备放料[barcode={MoveInfo.MoveParam.PosInfo.barcode}][barcode={MoveInfo.MoveParam.PosInfoBack.barcode}]");
}
break;
......@@ -94,11 +96,10 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SOB_19_InOutBackFromBuff:
if (!CheckBothReel(false))
{
WarnMsg = $"两面料叉上还能检测到料盘,请检查";
Msg.add(WarnMsg, MsgLevel.critical);
SetCriticalMsg($"两面料叉上还能检测到料盘,请检查");
return;
}
ignoreCurFork = false;
//出库料盘放置成功,将料盘信息写入对应出料口
if (CheckASide())
{
......@@ -112,6 +113,7 @@ namespace OnlineStore.DeviceLibrary
}
MoveInfo.NextMoveStep(StepEnum.SOB_20_Finish);
BuffAreaOutstoreDoor(false);
ignoreCurFork = false;
LogInfo($"出库 {MoveInfo.SLog}:关闭出料防护门,出库结束");
break;
......
using CodeLibrary;
using log4net.Util;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary.deviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
......@@ -12,11 +13,152 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms.VisualStyles;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
namespace OnlineStore.DeviceLibrary
{
partial class BoxEquip
{
public bool IgnoreFortACheck = false;
public bool ForkAChecking = false;
public bool ForkBChecking = false;
public bool IgnoreForkBCheck = false;
public bool IsStopForkCheck = false;
bool enableForkCehck { get { return ConfigHelper.Config.Get("启用行走中料叉检测", true); } }
public void StopForkCheck()
{
ForkAChecking = false;
ForkBChecking = false;
IsStopForkCheck = true;
IgnoreFortACheck = false;
IgnoreForkBCheck = false;
if (!enableForkCehck) return;
LogUtil.info($"{Name}-停止料叉监控");
}
public void ForkACheck()
{
if (!enableForkCehck) return;
ForkAChecking = true;
IsStopForkCheck = false;
Task.Run(() =>
{
try
{
Task.Delay(200).Wait();
IgnoreFortACheck = false;
DateTime highTime = DateTime.Now;
LogUtil.info($"{Name}-开始料叉{IO_Type.ForkA_Tray_Check}监控");
while (!IsStopForkCheck && !IgnoreFortACheck)
{
if (MoveStop)
{
Task.Delay(50).Wait();
highTime = DateTime.Now;
SetCriticalMsg($"料叉A监控到料盘信号丢失");
continue;
}
bool check = IOValue(IO_Type.ForkA_Tray_Check).Equals(IO_VALUE.HIGH);
if (check)
{
highTime = DateTime.Now;
}
var highinterval = (DateTime.Now - highTime).TotalSeconds;
if (highinterval >= 1)
{
UserPause(true, $"料叉{IO_Type.ForkA_Tray_Check}检测到灭了{highinterval}秒");
Thread.Sleep(500);
MoveAxis.SuddenStop();
LogUtil.error($"料叉{IO_Type.ForkA_Tray_Check}检测到灭了{highinterval}秒,行走机构停止");
}
Task.Delay(50).Wait();
}
LogUtil.info($"{Name}-结束料叉{IO_Type.ForkA_Tray_Check}监控,停止状态={IsStopForkCheck},忽略状态={IgnoreFortACheck}");
}
catch (Exception ex)
{
LogUtil.error("ForkACheck error", ex);
}
});
}
void ForkCheckWhenRunning()
{
if (IOValue(IO_Type.ForkA_Tray_Check).Equals(IO_VALUE.HIGH))
{
ForkACheck();
}
if (IOValue(IO_Type.ForkB_Tray_Check).Equals(IO_VALUE.HIGH))
{
ForkBCheck();
}
}
public void ForkBCheck()
{
if (!enableForkCehck) return;
ForkAChecking = true;
IsStopForkCheck = false;
Task.Run(() =>
{
try
{
Task.Delay(200).Wait();
IgnoreForkBCheck = false;
DateTime highTime = DateTime.Now;
LogUtil.info($"{Name}-开始料叉{IO_Type.ForkB_Tray_Check}监控");
while (!IsStopForkCheck && !IgnoreForkBCheck)
{
if (MoveStop)
{
Task.Delay(50).Wait();
highTime = DateTime.Now;
SetCriticalMsg($"料叉A监控到料盘信号丢失");
continue;
}
bool check = IOValue(IO_Type.ForkB_Tray_Check).Equals(IO_VALUE.HIGH);
if (check)
{
highTime = DateTime.Now;
}
var highinterval = (DateTime.Now - highTime).TotalSeconds;
if (highinterval >= 1)
{
UserPause(true, $"料叉{IO_Type.ForkB_Tray_Check}检测到灭了{highinterval}秒");
Thread.Sleep(500);
MoveAxis.SuddenStop();
LogUtil.error($"料叉{IO_Type.ForkB_Tray_Check}检测到灭了{highinterval}秒,行走机构停止");
}
Task.Delay(50).Wait();
}
LogUtil.info($"{Name}-结束料叉{IO_Type.ForkB_Tray_Check}监控,停止状态={IsStopForkCheck},忽略状态={IgnoreFortACheck}");
}
catch (Exception ex)
{
LogUtil.error("ForkBCheck error", ex);
}
});
}
public void UserPause(bool pause, string msg)
{
if (!enableForkCehck)
{
return;
}
if (pause)
{
LogUtil.info($"{Name}-用户停止:{msg}");
}
else
{
LogUtil.info($"{Name}-用户继续:{msg}");
}
MoveStop = pause;
}
protected override bool CheckWaitResult(DeviceMoveInfo moveInfo, WaitResultInfo wait)
{
return false;
......@@ -595,6 +737,7 @@ namespace OnlineStore.DeviceLibrary
return IOValue(IO_Type.ForkB_Tray_Check).Equals(hasReel ? IO_VALUE.HIGH : IO_VALUE.LOW);
}
}
bool CheckBothReel(bool hasReel)
{
if (ignoreFork)
......
......@@ -75,7 +75,7 @@ namespace OnlineStore.DeviceLibrary
{
if (MoveInfo.MoveType.Equals(MoveType.None))
{
WarnMsg = "";
WarnMsg = "";
if (Robot.MoveInfo.MoveType.Equals(MoveType.Reset) || Robot.MoveInfo.MoveType.Equals(MoveType.RHome))
{
}
......
......@@ -590,7 +590,7 @@ namespace OnlineStore.DeviceLibrary
else if (posInfo.IsNG)
{
InOutParam param = new InOutParam(posInfo.ToCopy());
LogInfo($"{posType}物料{param.PosInfo.ToStr()},准备出库到NG箱");
LogInfo($"{posType}物料{param.PosInfo.ToStr()},准备出库到NG箱");
return StartOutstore(param);
}
}
......@@ -598,7 +598,7 @@ namespace OnlineStore.DeviceLibrary
{
return false;
}
else if(posInfo.IsNG)
else if (posInfo.IsNG)
{
return false;
}
......@@ -627,7 +627,7 @@ namespace OnlineStore.DeviceLibrary
{
InOutParam param = new InOutParam(posInfo.ToCopy());
param.ShelfType = moveBean.ShelfType;
if(StartOutstore(param))
if (StartOutstore(param))
{
LogInfo($"{posType}物料{param.PosInfo.ToStr()},准备出库到料串{param.ShelfType}");
}
......@@ -681,7 +681,7 @@ namespace OnlineStore.DeviceLibrary
{
return false;
}
else if(posInfo.singleOut)
else if (posInfo.singleOut)
{
return false;
}
......@@ -707,7 +707,7 @@ namespace OnlineStore.DeviceLibrary
{
InOutParam param = new InOutParam(posInfo.ToCopy());
param.ShelfType = moveBean.ShelfType;
if(StartOutstore(param))
if (StartOutstore(param))
{
LogInfo($"{posType}物料{param.PosInfo.ToStr()},准备出库到料串{param.ShelfType}");
}
......@@ -989,6 +989,10 @@ namespace OnlineStore.DeviceLibrary
}
if (StoreManager.DisSecurityAccess)
{
if (CurrSecurityAccess.Equals(1))
{
SecurityAccessReset();
}
}
else if (IOValue(IO_Type.Feeding_LDoor_Limit).Equals(IO_VALUE.LOW))
{
......@@ -1000,14 +1004,27 @@ namespace OnlineStore.DeviceLibrary
}
else if (IOValue(IO_Type.SafetyRasterSignal).Equals(IO_VALUE.LOW))
{
SecurityAccessStop("光栅被遮挡");
bool enable = ConfigHelper.Config.Get("启用入料口光栅", false);
if (enable)
SecurityAccessStop("光栅被遮挡");
}
}
else if (CurrSecurityAccess.Equals(1))
{
if (IOValue(IO_Type.SafetyRasterSignal).Equals(IO_VALUE.HIGH))
bool enable = ConfigHelper.Config.Get("启用入料口光栅", false);
if (enable)
{
if (IOValue(IO_Type.SafetyRasterSignal).Equals(IO_VALUE.HIGH))
{
SecurityAccessReset();
}
}
else
{
SecurityAccessReset();
if (IOValue(IO_Type.Feeding_LDoor_Limit).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.Feeding_RDoor_Limit).Equals(IO_VALUE.HIGH))
{
SecurityAccessReset(); ;
}
}
}
......
......@@ -281,7 +281,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsTimeOut(60))
{
MoveTimeOut(MoveInfo, "" + moveBean.Name + "获取料盘高度超时");
SetWarnMsg(Name+" " + moveBean.Name + "获取料盘高度超时");
}
}
else if (MoveInfo.IsStep(StepEnum.II13_GetPosId))
......@@ -305,7 +305,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsTimeOut(15))
{
MoveTimeOut(MoveInfo, "获取库位号超时 " + getPosIdMsg);
SetWarnMsg("获取库位号超时 " + getPosIdMsg);
}
}
......@@ -341,7 +341,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsTimeOut(60))
{
MoveTimeOut(MoveInfo, "A上暂存区物料拿走");
SetWarnMsg("A上暂存区物料拿走");
}
}
else if (MoveInfo.IsStep(StepEnum.II43_InoutToP2))
......@@ -432,7 +432,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsTimeOut(60))
{
MoveTimeOut(MoveInfo, "B上暂存区物料拿走");
SetWarnMsg("B上暂存区物料拿走");
}
}
else if (MoveInfo.IsStep(StepEnum.II63_InoutToP3))
......@@ -473,7 +473,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsTimeOut(20))
{
MoveTimeOut(MoveInfo, "等待" + BatchMove_B.Name + "扫码结束");
SetWarnMsg("等待" + BatchMove_B.Name + "扫码结束");
}
}
else if (MoveInfo.IsStep(StepEnum.II67_MiddleToP1))
......@@ -831,7 +831,7 @@ namespace OnlineStore.DeviceLibrary
{
if (!NoAlarm())
{
LogInfo("报警中,无法开始出库:" + param.PosInfo.ToStr());
LogError("报警中,无法开始出库:" + param.PosInfo.ToStr());
return false;
}
if (AxisInWorkingArea(new int[] { 1, 2, 3, 4 }))
......@@ -1121,7 +1121,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsTimeOut(30))
{
MoveTimeOut(MoveInfo, "等待料串可放料");
SetWarnMsg("等待料串可放料");
}
}
else if (MoveInfo.IsStep(StepEnum.IO23_MiddleToP2))
......
......@@ -170,6 +170,7 @@ namespace OnlineStore.XLRStore
DialogResult result = MessageBox.Show("确定清除A上暂存区物料:" + BufferDataManager.AInStoreInfo.ToStr(), "", MessageBoxButtons.OKCancel);
if (result.Equals(DialogResult.OK))
{
SServerManager.cancelPutInTask(Name, BufferDataManager.AInStoreInfo.barcode);
LogUtil.info(Name + "手动清除A上暂存区物料:" + BufferDataManager.AInStoreInfo.ToStr());
BufferDataManager.AInStoreInfo = null;
}
......@@ -197,6 +198,7 @@ namespace OnlineStore.XLRStore
DialogResult result = MessageBox.Show("确定清除B上暂存区物料:" + BufferDataManager.BInStoreInfo.ToStr(), "", MessageBoxButtons.OKCancel);
if (result.Equals(DialogResult.OK))
{
SServerManager.cancelPutInTask(Name, BufferDataManager.BInStoreInfo.barcode);
LogUtil.info(Name + "手动清除B上暂存区物料:" + BufferDataManager.BInStoreInfo.ToStr());
BufferDataManager.BInStoreInfo = null;
}
......@@ -553,6 +555,34 @@ namespace OnlineStore.XLRStore
{
lbldiancifa.Text = "干燥机电磁阀关闭";
}
if (StoreManager.XLRStore?.boxEquip?.MoveStop??false)
{
设备恢复ToolStripMenuItem.Visible = true;
if (StoreManager.XLRStore?.boxEquip?.ForkAChecking ?? false)
{
忽略行走机构运行期间A侧料叉ToolStripMenuItem.Visible = true;
}
else
{
忽略行走机构运行期间A侧料叉ToolStripMenuItem.Visible = false;
}
if (StoreManager.XLRStore?.boxEquip?.ForkBChecking ?? false)
{
忽略行走机构运行期间B侧料叉ToolStripMenuItem1.Visible = true;
}
else
{
忽略行走机构运行期间B侧料叉ToolStripMenuItem1.Visible = false;
}
}
else
{
设备恢复ToolStripMenuItem.Visible = false;
忽略行走机构运行期间B侧料叉ToolStripMenuItem1.Visible = false;
忽略行走机构运行期间A侧料叉ToolStripMenuItem.Visible = false;
}
}
private void SetMenuS(ToolStripMenuItem toolMenu, bool isEn)
{
......@@ -858,5 +888,21 @@ namespace OnlineStore.XLRStore
{
}
private void 忽略行走机构运行期间A侧料叉ToolStripMenuItem_Click(object sender, EventArgs e)
{
StoreManager.XLRStore.boxEquip.IgnoreFortACheck = true;
}
private void 忽略行走机构运行期间B侧料叉ToolStripMenuItem1_Click(object sender, EventArgs e)
{
StoreManager.XLRStore.boxEquip.IgnoreForkBCheck = true;
}
private void 设备恢复ToolStripMenuItem_Click(object sender, EventArgs e)
{
StoreManager.XLRStore.boxEquip.UserPause(false, "用户点击恢复");
}
}
}
......@@ -168,7 +168,7 @@
this.chbMoveStop.TabIndex = 262;
this.chbMoveStop.Text = "暂停运动";
this.chbMoveStop.UseVisualStyleBackColor = true;
this.chbMoveStop.Click += new System.EventHandler(this.chbMoveStop_CheckedChanged);
this.chbMoveStop.CheckedChanged += new System.EventHandler(this.chbMoveStop_CheckedChanged);
//
// lblName
//
......
......@@ -50,8 +50,7 @@ namespace OnlineStore.XLRStore
else
{
btnReset.Enabled = true;
}
}
text += "\r\n" + moveBean.MoveInfo.MoveType + "_" + moveBean.MoveInfo.MoveStep;
text += "\r\n" + moveBean.CurrShelf?.ToStr();
lblAgvInfo.Text = text;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!