Commit 37cce6d8 LN

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

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