Commit 37cce6d8 LN

入库时检测料门口信号需要持续1秒

1 个父辈 7eb8c719
......@@ -706,15 +706,14 @@ namespace OnlineStore.DeviceLibrary
storeStatus = StoreStatus.SuddenStop;
}
}
private bool InProcess = false;
//private DateTime preProcessTime = DateTime.Now;
private bool InProcess = false;
private bool IsChongfu = false;
private Stopwatch stopwatch = new Stopwatch();
private Stopwatch doorCheckWatch = new Stopwatch();
protected override void timersTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (InProcess)
{
//TimeSpan span = DateTime.Now - preProcessTime;
{
if (stopwatch.Elapsed.TotalMinutes < 1)
{
return;
......@@ -727,6 +726,15 @@ namespace OnlineStore.DeviceLibrary
}
try
{
if (IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH))
{
StoreManager.checkWatch(doorCheckWatch, 1000, false);
}
else
{
doorCheckWatch.Stop();
}
InProcess = true;
//preProcessTime = DateTime.Now;
stopwatch.Restart();
......@@ -960,12 +968,11 @@ namespace OnlineStore.DeviceLibrary
}
}
public void TimerProcess()
{
try
{
DateTime time = DateTime.Now;
{
if (StoreMove.MoveType != StoreMoveType.None)
{
BusyMoveProcess();
......@@ -1013,6 +1020,10 @@ namespace OnlineStore.DeviceLibrary
{
return;
}
if (WarnMsg.Contains("等待料仓门口检测到料盘"))
{
return;
}
//若BOX和移栽都没有在等待Io的过程中则此Io超时异常可能已经处理过
if (StoreMove.IsInWait == false)
......
......@@ -288,7 +288,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public override void StartInStoreMove(InOutParam param)
{
bool isNeedCheckIO = true;
// bool isNeedCheckIO = true;
startInStoreTime = DateTime.Now;
string posId = param != null ? param.PosInfo.PosId : "";
if (storeRunStatus == StoreRunStatus.Runing)
......@@ -307,28 +307,36 @@ namespace OnlineStore.DeviceLibrary
storeRunStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute;
StoreMove.NewMove(StoreMoveType.InStore, param);
if (isNeedCheckIO)
//if (isNeedCheckIO)
//{
//料盘检测
InStoreLog(" 入库:SI_00 入库等待仓门口料盘信号");
StoreMove.NextMoveStep(StoreMoveStep.SI_00_TrayCheck);
StoreMove.TimeOutSeconds = 5;
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(100));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.HIGH));
// StoreMove.WaitList.Add(WaitResultInfo.WaitTime(10000));
// StoreMove.OneWaitCanEndStep = true;
if (IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH))
{
//料盘检测
InStoreLog(" 入库:SI_00 入库等待仓门口料盘信号");
StoreMove.NextMoveStep(StoreMoveStep.SI_00_TrayCheck);
StoreMove.TimeOutSeconds = 5;
// StoreMove.WaitList.Add(WaitResultInfo.WaitTime(5000));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.HIGH));
// StoreMove.OneWaitCanEndStep = true;
doorCheckWatch.Restart();
}
else
{
SI_02_Move(param.MoveP);
doorCheckWatch.Stop();
}
//}
//else
//{
// SI_02_Move(param.MoveP);
//}
}
else
{
LogUtil.error(LOGGER, StoreName + " 启动【" + posId + "】入库出错,当前状态,storeStatus=" + storeRunStatus);
}
}
private void SI_02_Move(LineMoveP moveP)
{
......@@ -368,20 +376,22 @@ namespace OnlineStore.DeviceLibrary
if (StoreMove.MoveStep.Equals(StoreMoveStep.SI_00_TrayCheck))
{
//判断是否有料盘信号
if (IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH))
{
if (IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH)&&StoreManager.checkWatch(doorCheckWatch,1000,false))
{
SI_02_Move(moveP);
}
else
else if(StoreMove.IsTimeOut(10))
{
InStoreLog(" 入库:SI_00 入库等待仓门口料盘信号");
StoreMove.NextMoveStep(StoreMoveStep.SI_00_TrayCheck);
StoreMove.TimeOutSeconds = 5;
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.HIGH));
WarnMsg = StoreName + "入库 等待料仓门口检测到料盘 [" + StoreMove.MoveParam.PosInfo.barcode + "] [" + StoreMove.MoveParam.PosInfo.PosId + "] 超时 [" + Math.Round(StoreMove.StepSpan().TotalSeconds, 1) + "]秒 ";
LogUtil.error(LOGGER, WarnMsg, 100);
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType);
//InStoreLog(" 入库:SI_00 入库等待仓门口料盘信号");
//StoreMove.NextMoveStep(StoreMoveStep.SI_00_TrayCheck);
//StoreMove.TimeOutSeconds = 5;
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.HIGH));
//WarnMsg = StoreName + "入库未检测到料盘[" + StoreMove.MoveParam.PosInfo.barcode + "][" + StoreMove.MoveParam.PosInfo.PosId + "]";
//LogUtil.error(LOGGER, WarnMsg, 100);
//Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType);
//TimeSpan span = DateTime.Now - startInStoreTime;
//string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
......@@ -392,13 +402,15 @@ namespace OnlineStore.DeviceLibrary
//storeStatus = StoreStatus.StoreOnline;
//InOutEndProcess(StoreMoveType.InStore);
}
}
if (StoreMove.MoveStep == StoreMoveStep.SI_01_LocationCylinderDown)
{
SI_02_Move(moveP);
}
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_02_InOutAxisHome)
{
if (IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW))
{
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
CodeMsg = "入库[" + posId + "]叉子去取料前,未检测到进料口有料";
LogUtil.error(CodeMsg);
}
InStoreLog("入库:SI_03 所有轴回到待机点,轴2、轴1 动作到P1,,轴4动作至P3");
StoreMove.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
......@@ -440,6 +452,12 @@ namespace OnlineStore.DeviceLibrary
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_07_DeviceBackFromDoor)
{
if (IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.LOW))
{
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
CodeMsg = "入库[" + posId + "]叉子取料后退后,未检测到料叉有料";
LogUtil.error(CodeMsg);
}
if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0))
{
InStoreLog("入库:SI_09 移动到库位点,旋转轴至P2(库位点),升降轴至P3(库位入库前点) ");
......@@ -640,7 +658,7 @@ namespace OnlineStore.DeviceLibrary
if (IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.LOW))
{
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
CodeMsg = "出库[" + posId + "]叉子从库位退出后,未检测到料有料";
CodeMsg = "出库[" + posId + "]叉子从库位退出后,未检测到料有料";
LogUtil.error(CodeMsg);
}
if (StoreMove.MoveParam.LoadLocationP())
......
......@@ -3,6 +3,7 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Ports;
using System.Linq;
......@@ -17,7 +18,7 @@ namespace OnlineStore.DeviceLibrary
/// 当前出入库的模式
/// </summary>
public static int CurrInOutType = 0;
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static AC_SA_BoxBean Store = null;
public static AC_SA_Config Config = null;
......@@ -100,7 +101,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 获取定位库位信息
/// </summary>
public static string GetLocationPosId(int width)
public static string GetLocationPosId(int width)
{
string config = ConfigAppSettings.GetValue(Setting_Init.Location_PosID_ + width);
return config;
......@@ -200,5 +201,22 @@ namespace OnlineStore.DeviceLibrary
path = path.Substring(0, path.Length - 1);
return path;
}
public static bool checkWatch(Stopwatch watch, int targetMs, bool isStop = false)
{
if (!watch.IsRunning)
{
watch.Restart();
return false;
}
else if (watch.ElapsedMilliseconds >= targetMs)
{
if (isStop)
{
watch.Stop();
}
return true;
}
return false;
}
}
}
......@@ -279,10 +279,10 @@ namespace OnlineStore.DeviceLibrary
/// 入库检测
/// </summary>
SI_00_TrayCheck = 200,
/// <summary>
/// 入库,。定位气缸下降
/// </summary>
SI_01_LocationCylinderDown = 201,
///// <summary>
///// 入库,。定位气缸下降
///// </summary>
//SI_01_TrayCheckAgain = 201,
/// <summary>
/// 入库。。进出轴(叉子)先返回P1
/// </summary>
......
......@@ -47,6 +47,20 @@ namespace OnlineStore.DeviceLibrary
{
get { return moveType; }
}
public TimeSpan StepSpan()
{
TimeSpan span = DateTime.Now - LastSetpTime;
return span;
}
public bool IsTimeOut(int timeOutSeconds = 60)
{
TimeSpan span = DateTime.Now - LastSetpTime;
if (span.TotalSeconds > timeOutSeconds)
{
return true;
}
return false;
}
/// <summary>
///出入库参数
/// </summary>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!