Commit 52d7b130 LN

异常捕获修改

1 个父辈 7a440845
此文件类型无法预览
......@@ -230,11 +230,6 @@
</summary>
<param name="s"></param>
</member>
<member name="E:Asa.Client2.GetRFID">
<summary>
服务端发送的RFID
</summary>
</member>
<member name="E:Asa.Client2.Arrive">
<summary>
小车到达,仅包装料仓
......@@ -385,12 +380,12 @@
</member>
<member name="F:Asa.ClientAction.MayEnter">
<summary>
可以进入料架(包装料仓)
可以进入料架,Arrive事件使用,让小车开始对接
</summary>
</member>
<member name="F:Asa.ClientAction.MayLeave">
<summary>
可以出去料架(包装料仓)
可以出去料架,Arrive事件使用,让小车开始对接
</summary>
</member>
<member name="F:Asa.ClientAction.NeedEnter">
......@@ -415,12 +410,12 @@
</member>
<member name="F:Asa.ClientAction.Arrive">
<summary>
小车到达
小车到达,到达包装料仓门口,等待开门
</summary>
</member>
<member name="F:Asa.ClientAction.Ready">
<summary>
小车已准备
小车已准备,已对接上流水线
</summary>
</member>
<member name="T:Asa.ClientLevel">
......
......@@ -57,10 +57,10 @@ namespace OnlineStore.AssemblyLine
//string code = " (X: 380,Y: 148) L00000000000WG9D19055;E20191230 0180;B7H.10618.5B1008082019123004000;R0080820191230E9600";
//string r = CodeManager.ReplaceCode(code);
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;
// 因为方法三只能是最小化的窗体显示出来,如果隐藏到托盘中则不能把运行的程序显示出来
Process currentproc = Process.GetCurrentProcess();
Process[] processcollection = Process.GetProcessesByName(currentproc.ProcessName.Replace(".vshost", string.Empty));
......@@ -104,20 +104,27 @@ namespace OnlineStore.AssemblyLine
Application.Run(new FrmLineStore());
}
}
private static void CurrentDomain_FirstChanceException(object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e)
{
LogUnhandledException("CurrentDomain_FirstChanceException", e);
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
LogUnhandledException(e.ExceptionObject);
LogUnhandledException("CurrentDomain_UnhandledException",e);
}
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
LogUnhandledException(e.Exception);
LogUnhandledException("Application_ThreadException",e);
}
static void LogUnhandledException(object exceptionobj)
static void LogUnhandledException(string type,Exception exceptionobj)
{
//这里可以进一步地写日志
LOGGER.Error(exceptionobj.ToString());
LOGGER.Error("【"+ type + "】"+exceptionobj.ToString());
MessageBox.Show(exceptionobj.ToString(), type);
}
}
}
......@@ -96,12 +96,10 @@ D2(上料模块出口)
//例如: 4D12010124 表示4楼12号料仓第1列第1行架子上的第24个隔板位置
//4D19050208 表示4楼19号料仓(包装料仓)第5列第2行架子上的第8个隔板位置
20200213 需要修改:上料机构的RFID改为不扫描模式
启动流水线后,再点击调试模式,阻挡没有下降。
......@@ -67,12 +67,12 @@ namespace OnlineStore.DeviceLibrary
public static void SetStatus(string id, string shelfId = "", ClientAction action = ClientAction.None, ClientLevel level = ClientLevel.Low)
{
ClientAction currA = GetAction(id);
//相同状态就设置一次
if (currA.Equals(action))
{
return;
}
//ClientAction currA = GetAction(id);
////相同状态就设置一次
//if (currA.Equals(action))
//{
// return;
//}
agvClient.SetStatus(id, "", shelfId, action, level);
UpdateAction(id, action);
}
......@@ -126,21 +126,31 @@ namespace OnlineStore.DeviceLibrary
return agvClient.IsConn;
}
public static bool NeedEnter(string id, string shelfId)
public static bool SetToNone(string id, string shelfId = "")
{
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))
{
SetStatus(id, shelfId, ClientAction.None);
return true;
}
return false;
}
public static bool NeedEnter(string id, string shelfId = "")
{
ClientAction currA = GetAction(id);
if (currA.Equals(ClientAction.None) || currA.Equals(ClientAction.FinishLeave) || currA.Equals(ClientAction.FinishEnter))
if (currA.Equals(ClientAction.None) || currA.Equals(ClientAction.FinishLeave) || currA.Equals(ClientAction.FinishEnter) || currA.Equals(ClientAction.NeedLeave) || currA.Equals(ClientAction.NeedEnter))
{
SetStatus(id, shelfId, ClientAction.NeedEnter);
return true;
}
return false;
}
public static bool NeedLeave(string id, string shelfId = "")
public static bool NeedLeave(string id, string shelfId="")
{
ClientAction currA = GetAction(id);
if (currA.Equals(ClientAction.None) || currA.Equals(ClientAction.FinishLeave) || currA.Equals(ClientAction.FinishEnter))
if (currA.Equals(ClientAction.None) || currA.Equals(ClientAction.FinishLeave) || currA.Equals(ClientAction.FinishEnter) || currA.Equals(ClientAction.NeedLeave) || currA.Equals(ClientAction.NeedEnter))
{
SetStatus(id, shelfId, ClientAction.NeedLeave);
return true;
......
......@@ -266,7 +266,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo("重置完成!");
if (IOValue(IO_Type.SL_Out_Check).Equals(IO_VALUE.HIGH))
{
LogInfo("重置完成,出口检测到有料架,调用 AgvClient.NeedLeave");
LogInfo("重置完成,出口检测到有料架,调用 "+Config.AgvOutName+" AgvClient.NeedLeave");
AgvClient.NeedLeave(Config.AgvOutName);
}
MoveEndS();
......@@ -603,12 +603,12 @@ namespace OnlineStore.DeviceLibrary
{
string logN = Name + "收到 AgvArrive 事件 [" + nodeId + "] [" + data.ToData() + "] ";
if (nodeId.Equals(Config.AgvInName))
{
{
}
else if (nodeId.Equals(Config.AgvOutName))
{
}
LogUtil.info(logN + ":" + "暂无处理");
LogUtil.info(logN + ":" + "暂无处理");
}
internal void AgvReady(string nodeId, RFIDData data)
......@@ -625,12 +625,12 @@ namespace OnlineStore.DeviceLibrary
}
else if (nodeId.Equals(Config.AgvOutName))
{
{
if (IOValue(IO_Type.SL_Out_Check).Equals(IO_VALUE.LOW))
{
LogUtil.info(logN + " ,未检测到出口有料架,暂不处理");
}
ShelfOutProcess();
}
ShelfOutProcess();
}
}
private bool ProcessShelfEnter = false;
......@@ -653,19 +653,21 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.SL_OutLine_Run, IO_VALUE.HIGH);
if (WaitIo(IO_Type.SL_Out_Check, IO_VALUE.LOW, 6000))
{
{
//再转动2000
Thread.Sleep(2000);
//WaitUtil.Wait(3000, delegate
//{
// return AgvClient.GetAction(Config.AgvOutName).Equals(AGVAction.);
//}, "等待AGV收到料架");
// AgvClient.MayLeave(Config.AgvOutName);
Thread.Sleep(3000);
//停止转动 ,阻挡上升
IOMove(IO_Type.SL_OutLine_Run, IO_VALUE.LOW);
IOMove(IO_Type.SL_Out_StopDown, IO_VALUE.LOW);
AgvClient.SetStatus(Config.AgvOutName,"",ClientAction.FinishLeave);
Task.Factory.StartNew(delegate
{
Thread.Sleep(2000);
AgvClient.SetStatus(Config.AgvOutName, "", ClientAction.None);
});
ProcessShelfOut = false;
LogUtil.info(Name + "料架送入AGV 结束");
}
else
{
......@@ -710,16 +712,20 @@ namespace OnlineStore.DeviceLibrary
{
//等待200毫秒后停止转动
Thread.Sleep(2000);
Thread.Sleep(3000);
IOMove(IO_Type.SL_Line_Run, IO_VALUE.LOW);
//料架可离开
AgvClient.FinishEnter(Config.AgvInName);
Task.Factory.StartNew(delegate
{
Thread.Sleep(2000);
AgvClient.SetStatus(Config.AgvInName, "", ClientAction.None);
});
ProcessShelfEnter = false;
LogUtil.info(Name + "AGV料架进入 结束");
}
else
{
{
LogUtil.info(Name + "AGV料架进入 等待SL_Stop_Check=High超时");
}
......
using OnlineStore.Common;
using Asa;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
......@@ -399,16 +400,24 @@ namespace OnlineStore.DeviceLibrary
ShelfEnterProcess();
}
}
else if (IOValue(IO_Type.SL_Out_Check).Equals(IO_VALUE.HIGH))
if (IOValue(IO_Type.SL_Out_Check).Equals(IO_VALUE.HIGH))
{
//线体出口检测到料架,需要通知AGV小车
AgvClient.NeedLeave(Config.AgvOutName);
// SendShelfToAGV();
}
else
{
AgvClient.SetToNone(Config.AgvOutName);
}
//入口无料架,mayEnter
if (IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.LOW))
{
AgvClient.MayEnter(Config.AgvInName);
AgvClient.NeedEnter(Config.AgvInName);
}
else
{
AgvClient.SetToNone(Config.AgvInName);
}
return false;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!