Commit f18c2fa9 LN

放行料架需要阻挡下降2秒

1 个父辈 b52de064
此文件类型无法预览
...@@ -230,11 +230,6 @@ ...@@ -230,11 +230,6 @@
</summary> </summary>
<param name="s"></param> <param name="s"></param>
</member> </member>
<member name="E:Asa.Client2.GetRFID">
<summary>
服务端发送的RFID
</summary>
</member>
<member name="E:Asa.Client2.Arrive"> <member name="E:Asa.Client2.Arrive">
<summary> <summary>
小车到达,仅包装料仓 小车到达,仅包装料仓
...@@ -385,12 +380,12 @@ ...@@ -385,12 +380,12 @@
</member> </member>
<member name="F:Asa.ClientAction.MayEnter"> <member name="F:Asa.ClientAction.MayEnter">
<summary> <summary>
可以进入料架(包装料仓) 可以进入料架,Arrive事件使用,让小车开始对接
</summary> </summary>
</member> </member>
<member name="F:Asa.ClientAction.MayLeave"> <member name="F:Asa.ClientAction.MayLeave">
<summary> <summary>
可以出去料架(包装料仓) 可以出去料架,Arrive事件使用,让小车开始对接
</summary> </summary>
</member> </member>
<member name="F:Asa.ClientAction.NeedEnter"> <member name="F:Asa.ClientAction.NeedEnter">
...@@ -415,12 +410,12 @@ ...@@ -415,12 +410,12 @@
</member> </member>
<member name="F:Asa.ClientAction.Arrive"> <member name="F:Asa.ClientAction.Arrive">
<summary> <summary>
小车到达 小车到达,到达包装料仓门口,等待开门
</summary> </summary>
</member> </member>
<member name="F:Asa.ClientAction.Ready"> <member name="F:Asa.ClientAction.Ready">
<summary> <summary>
小车已准备 小车已准备,已对接上流水线
</summary> </summary>
</member> </member>
<member name="T:Asa.ClientLevel"> <member name="T:Asa.ClientLevel">
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
<Compile Include="acVmiLine\VMILineBean.cs" /> <Compile Include="acVmiLine\VMILineBean.cs" />
<Compile Include="acVmiLine\VMILineBean_Partial.cs" /> <Compile Include="acVmiLine\VMILineBean_Partial.cs" />
<Compile Include="acVmiLine\RobotManager.cs" /> <Compile Include="acVmiLine\RobotManager.cs" />
<Compile Include="acVmiLine\WaitUtil.cs" />
<Compile Include="agvClient\AgvClient.cs" /> <Compile Include="agvClient\AgvClient.cs" />
<Compile Include="bean\StoreMoveInfo.cs" /> <Compile Include="bean\StoreMoveInfo.cs" />
<Compile Include="IO\AIOBOX\AIOBOXManager.cs" /> <Compile Include="IO\AIOBOX\AIOBOXManager.cs" />
......
 
using Asa;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
...@@ -255,7 +256,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -255,7 +256,7 @@ namespace OnlineStore.DeviceLibrary
private Stopwatch ol_noshelfWatch = new Stopwatch(); private Stopwatch ol_noshelfWatch = new Stopwatch();
private DateTime ol_lastSendShelfTime = DateTime.Now; private DateTime ol_lastSendShelfTime = DateTime.Now;
private int StopDownMS = 600; private int StopDownMS = 1500;
/// <summary> /// <summary>
/// 出料线体定时处理 /// 出料线体定时处理
/// </summary> /// </summary>
...@@ -288,7 +289,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -288,7 +289,7 @@ namespace OnlineStore.DeviceLibrary
AgvClient.NeedEnter(Config.OutL_AgvName, ""); AgvClient.NeedEnter(Config.OutL_AgvName, "");
}else }else
{ {
AgvClient.ConnotEnter(Config.OutL_AgvName, ""); AgvClient.SetToNone(Config.OutL_AgvName, "");
} }
} }
private DateTime il_lastCallAgvTime = DateTime.Now.AddMinutes(-5); private DateTime il_lastCallAgvTime = DateTime.Now.AddMinutes(-5);
...@@ -302,15 +303,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -302,15 +303,15 @@ namespace OnlineStore.DeviceLibrary
//出口有料架,需要通知agv取走料架 //出口有料架,需要通知agv取走料架
//每次叫小车时间间隔3分钟? //每次叫小车时间间隔3分钟?
//出口信号需要持续1秒钟 //出口信号需要持续1秒钟
if (IOManager.IOValue(IO_Type.InL_OutStopCheck).Equals(IO_VALUE.HIGH) && span.TotalSeconds > 180) if (IOManager.IOValue(IO_Type.InL_OutStopCheck).Equals(IO_VALUE.HIGH) && span.TotalSeconds > 60)
{ {
if (LineManager.checkWatch(il_outstopCheckWarch, 1000)) if (LineManager.checkWatch(il_outstopCheckWarch, 1000))
{ {
il_lastCallAgvTime = DateTime.Now; il_lastCallAgvTime = DateTime.Now;
//StopIOMove(IO_Type.InL_OutStopDown, StopDownMS); //StopIOMove(IO_Type.InL_OutStopDown, StopDownMS);
LogUtil.info(" 入库线体出口有料架"+ LastOutShelfId + ",呼叫agv小车[" + Config.InL_AgvName + "] [NeedLeave] "); LogUtil.info(" 入库线体出口有料架" + LastOutShelfId + ",呼叫agv小车[" + Config.InL_AgvName + "] [NeedLeave] ");
AgvClient.NeedLeave(Config.InL_AgvName,LastOutShelfId); AgvClient.NeedLeave(Config.InL_AgvName, LastOutShelfId);
} }
} }
else if (span.TotalMilliseconds > StopDownMS) else if (span.TotalMilliseconds > StopDownMS)
...@@ -321,6 +322,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -321,6 +322,12 @@ namespace OnlineStore.DeviceLibrary
IOManager.IOMove(IO_Type.InL_OutStopDown, IO_VALUE.LOW); IOManager.IOMove(IO_Type.InL_OutStopDown, IO_VALUE.LOW);
} }
} }
//如果是出口无料架,NeedLeave状态,改为None
if (IOManager.IOValue(IO_Type.InL_OutStopCheck).Equals(IO_VALUE.LOW) && AgvClient.GetAction(Config.InL_AgvName).Equals(ClientAction.NeedLeave))
{
LogUtil.info(" 入库线体出口无料架 ,更改[" + Config.InL_AgvName + "] 状态[None] ");
AgvClient.SetStatus(Config.InL_AgvName, "", ClientAction.None);
}
} }
private void LedProcess() private void LedProcess()
......
...@@ -83,7 +83,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -83,7 +83,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
public void StopIOMove(string ioType, int ms = 600) public void StopIOMove(string ioType, int ms = 1000)
{ {
Task.Factory.StartNew(delegate Task.Factory.StartNew(delegate
{ {
......
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class WaitUtil
{
public delegate bool IsOk();
/// <summary>
/// 使用异步委托检测超时,防止isOk方法不返回结果导致卡死的问题
/// </summary>
/// <param name="waitName"></param>
/// <param name="timeout"></param>
/// <param name="isOk"></param>
public static bool Wait(int timeout, IsOk isOk, string waitName = "")
{
DateTime startTime = System.DateTime.Now;
TimeSpan timoutSpan = TimeSpan.FromMilliseconds(timeout);
TimeSpan waitSpan = TimeSpan.FromMilliseconds(0);
int sleepTime = 10;
while (true)
{
TimeSpan remainTimes = timoutSpan.Subtract(waitSpan);
if (remainTimes.TotalMilliseconds < 0)
{
//已经超时
throw new TimeoutException(waitName + "超时");
}
try
{
IAsyncResult re = isOk.BeginInvoke(null, null);
var waitResult = re.AsyncWaitHandle.WaitOne(remainTimes);
if (waitResult)
{
bool okResult = isOk.EndInvoke(re);
if (okResult)
{
return true;
}
}
}
catch (Exception ex)
{
LogUtil.error("同步等待出现异常:", ex);
}
Thread.Sleep(sleepTime);
waitSpan = System.DateTime.Now.Subtract(startTime);
}
}
}
}
...@@ -72,21 +72,29 @@ namespace OnlineStore.DeviceLibrary ...@@ -72,21 +72,29 @@ namespace OnlineStore.DeviceLibrary
UpdateAction(id, Asa.ClientAction.Ready); UpdateAction(id, Asa.ClientAction.Ready);
if (id.Equals(LineManager.Config.OutL_AgvName)) if (id.Equals(LineManager.Config.OutL_AgvName))
{ {
// MayEnter("C2");
if (IOManager.IOValue(IO_Type.OutL_InCheck).Equals(IO_VALUE.LOW)) if (IOManager.IOValue(IO_Type.OutL_InCheck).Equals(IO_VALUE.LOW))
{ {
SetStatus(id, "", ClientAction.MayEnter);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] 调用 MayEnter ");
Task.Factory.StartNew(delegate Task.Factory.StartNew(delegate
{ {
SetStatus(id, "", ClientAction.MayEnter);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] 调用 MayEnter ,等待OutL_InCheck");
WaitUtil.Wait(60000, delegate
{
return IOManager.IOValue(IO_Type.OutL_InCheck).Equals(IO_VALUE.HIGH);
}, "等待OutL_InCheck=HIGH");
if (IOManager.IOValue(IO_Type.OutL_InCheck).Equals(IO_VALUE.HIGH))
{
//两秒后改为离开状态 //两秒后改为离开状态
Thread.Sleep(5000); Thread.Sleep(2000);
SetStatus(id, "", ClientAction.FinishEnter); SetStatus(id, "", ClientAction.FinishEnter);
Thread.Sleep(2000); Thread.Sleep(2000);
SetStatus(id, "", ClientAction.None); SetStatus(id, "", ClientAction.None);
}
else
{
LogUtil.error("AgvClient_Ready [" + id + "] [" + data.ToData() + "] 调用 MayEnter ,等待OutL_InCheck超时");
}
}); });
} }
} }
...@@ -95,16 +103,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -95,16 +103,16 @@ namespace OnlineStore.DeviceLibrary
{ {
if (IOManager.IOValue(IO_Type.InL_OutStopCheck).Equals(IO_VALUE.HIGH)) if (IOManager.IOValue(IO_Type.InL_OutStopCheck).Equals(IO_VALUE.HIGH))
{ {
LineManager.VMILine.StopIOMove(IO_Type.InL_OutStopDown); LineManager.VMILine.StopIOMove(IO_Type.InL_OutStopDown, 2000);
//agvClient.MayLeave(id); //agvClient.MayLeave(id);
SetStatus(id, "", ClientAction.MayLeave); SetStatus(id, "", ClientAction.MayLeave);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] ,下降 InL_OutStopDown 600ms,调用 MayLeave "); LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] ,下降 InL_OutStopDown ,调用 MayLeave ");
Task.Factory.StartNew(delegate Task.Factory.StartNew(delegate
{ {
//两秒后改为离开状态 //两秒后改为离开状态
Thread.Sleep(5000); Thread.Sleep(2000);
SetStatus(id, "", ClientAction.FinishEnter); SetStatus(id, "", ClientAction.FinishLeave);
Thread.Sleep(2000); Thread.Sleep(2000);
...@@ -118,8 +126,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -118,8 +126,9 @@ namespace OnlineStore.DeviceLibrary
UpdateAction(id, Asa.ClientAction.Arrive); UpdateAction(id, Asa.ClientAction.Arrive);
RFIDData data = new RFIDData(content); RFIDData data = new RFIDData(content);
LogUtil.info("收到 AgvClient_Arrive [" + id + "] [" + data.ToData() + "] "); LogUtil.info("收到 AgvClient_Arrive [" + id + "] [" + data.ToData() + "] ");
} }
public static bool ConnotEnter(string id,string shelfId) public static bool SetToNone(string id, string shelfId = "")
{ {
ClientAction currA = GetAction(id); ClientAction currA = GetAction(id);
if (currA.Equals(ClientAction.None) || currA.Equals(ClientAction.FinishLeave) || currA.Equals(ClientAction.FinishEnter) || currA.Equals(ClientAction.NeedLeave) || currA.Equals(ClientAction.NeedEnter)) if (currA.Equals(ClientAction.None) || currA.Equals(ClientAction.FinishLeave) || currA.Equals(ClientAction.FinishEnter) || currA.Equals(ClientAction.NeedLeave) || currA.Equals(ClientAction.NeedEnter))
......

\ No newline at end of file \ No newline at end of file
ready是对接上流水线,arrive是在流水线附近等开门,所有节点都会发这两个事件,环形线和vmi只记录arrive的日志
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!