Commit 52d7b130 LN

异常捕获修改

1 个父辈 7a440845
此文件类型无法预览
...@@ -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">
......
...@@ -57,10 +57,10 @@ namespace OnlineStore.AssemblyLine ...@@ -57,10 +57,10 @@ namespace OnlineStore.AssemblyLine
//string code = " (X: 380,Y: 148) L00000000000WG9D19055;E20191230 0180;B7H.10618.5B1008082019123004000;R0080820191230E9600"; //string code = " (X: 380,Y: 148) L00000000000WG9D19055;E20191230 0180;B7H.10618.5B1008082019123004000;R0080820191230E9600";
//string r = CodeManager.ReplaceCode(code); //string r = CodeManager.ReplaceCode(code);
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;
// 因为方法三只能是最小化的窗体显示出来,如果隐藏到托盘中则不能把运行的程序显示出来 // 因为方法三只能是最小化的窗体显示出来,如果隐藏到托盘中则不能把运行的程序显示出来
Process currentproc = Process.GetCurrentProcess(); Process currentproc = Process.GetCurrentProcess();
Process[] processcollection = Process.GetProcessesByName(currentproc.ProcessName.Replace(".vshost", string.Empty)); Process[] processcollection = Process.GetProcessesByName(currentproc.ProcessName.Replace(".vshost", string.Empty));
...@@ -104,20 +104,27 @@ namespace OnlineStore.AssemblyLine ...@@ -104,20 +104,27 @@ namespace OnlineStore.AssemblyLine
Application.Run(new FrmLineStore()); 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) 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) 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(上料模块出口) ...@@ -96,12 +96,10 @@ D2(上料模块出口)
//例如: 4D12010124 表示4楼12号料仓第1列第1行架子上的第24个隔板位置 //例如: 4D12010124 表示4楼12号料仓第1列第1行架子上的第24个隔板位置
//4D19050208 表示4楼19号料仓(包装料仓)第5列第2行架子上的第8个隔板位置 //4D19050208 表示4楼19号料仓(包装料仓)第5列第2行架子上的第8个隔板位置
20200213 需要修改:上料机构的RFID改为不扫描模式
启动流水线后,再点击调试模式,阻挡没有下降。
...@@ -67,12 +67,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -67,12 +67,12 @@ namespace OnlineStore.DeviceLibrary
public static void SetStatus(string id, string shelfId = "", ClientAction action = ClientAction.None, ClientLevel level = ClientLevel.Low) public static void SetStatus(string id, string shelfId = "", ClientAction action = ClientAction.None, ClientLevel level = ClientLevel.Low)
{ {
ClientAction currA = GetAction(id); //ClientAction currA = GetAction(id);
//相同状态就设置一次 ////相同状态就设置一次
if (currA.Equals(action)) //if (currA.Equals(action))
{ //{
return; // return;
} //}
agvClient.SetStatus(id, "", shelfId, action, level); agvClient.SetStatus(id, "", shelfId, action, level);
UpdateAction(id, action); UpdateAction(id, action);
} }
...@@ -126,21 +126,31 @@ namespace OnlineStore.DeviceLibrary ...@@ -126,21 +126,31 @@ namespace OnlineStore.DeviceLibrary
return agvClient.IsConn; 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); 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); SetStatus(id, shelfId, ClientAction.NeedEnter);
return true; return true;
} }
return false; return false;
} }
public static bool NeedLeave(string id, string shelfId = "") public static bool NeedLeave(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)) 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); SetStatus(id, shelfId, ClientAction.NeedLeave);
return true; return true;
......
...@@ -266,7 +266,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -266,7 +266,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo("重置完成!"); LogInfo("重置完成!");
if (IOValue(IO_Type.SL_Out_Check).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.SL_Out_Check).Equals(IO_VALUE.HIGH))
{ {
LogInfo("重置完成,出口检测到有料架,调用 AgvClient.NeedLeave"); LogInfo("重置完成,出口检测到有料架,调用 "+Config.AgvOutName+" AgvClient.NeedLeave");
AgvClient.NeedLeave(Config.AgvOutName); AgvClient.NeedLeave(Config.AgvOutName);
} }
MoveEndS(); MoveEndS();
...@@ -655,17 +655,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -655,17 +655,19 @@ namespace OnlineStore.DeviceLibrary
if (WaitIo(IO_Type.SL_Out_Check, IO_VALUE.LOW, 6000)) if (WaitIo(IO_Type.SL_Out_Check, IO_VALUE.LOW, 6000))
{ {
//再转动2000 //再转动2000
Thread.Sleep(2000); Thread.Sleep(3000);
//WaitUtil.Wait(3000, delegate
//{
// return AgvClient.GetAction(Config.AgvOutName).Equals(AGVAction.);
//}, "等待AGV收到料架");
// AgvClient.MayLeave(Config.AgvOutName);
//停止转动 ,阻挡上升 //停止转动 ,阻挡上升
IOMove(IO_Type.SL_OutLine_Run, IO_VALUE.LOW); IOMove(IO_Type.SL_OutLine_Run, IO_VALUE.LOW);
IOMove(IO_Type.SL_Out_StopDown, 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; ProcessShelfOut = false;
LogUtil.info(Name + "料架送入AGV 结束"); LogUtil.info(Name + "料架送入AGV 结束");
} }
else else
{ {
...@@ -710,11 +712,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -710,11 +712,15 @@ namespace OnlineStore.DeviceLibrary
{ {
//等待200毫秒后停止转动 //等待200毫秒后停止转动
Thread.Sleep(2000); Thread.Sleep(3000);
IOMove(IO_Type.SL_Line_Run, IO_VALUE.LOW); IOMove(IO_Type.SL_Line_Run, IO_VALUE.LOW);
//料架可离开 //料架可离开
AgvClient.FinishEnter(Config.AgvInName); AgvClient.FinishEnter(Config.AgvInName);
Task.Factory.StartNew(delegate
{
Thread.Sleep(2000);
AgvClient.SetStatus(Config.AgvInName, "", ClientAction.None);
});
ProcessShelfEnter = false; ProcessShelfEnter = false;
LogUtil.info(Name + "AGV料架进入 结束"); LogUtil.info(Name + "AGV料架进入 结束");
} }
......
using OnlineStore.Common; using Asa;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -399,16 +400,24 @@ namespace OnlineStore.DeviceLibrary ...@@ -399,16 +400,24 @@ namespace OnlineStore.DeviceLibrary
ShelfEnterProcess(); 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小车 //线体出口检测到料架,需要通知AGV小车
AgvClient.NeedLeave(Config.AgvOutName); AgvClient.NeedLeave(Config.AgvOutName);
// SendShelfToAGV(); // SendShelfToAGV();
} }
else
{
AgvClient.SetToNone(Config.AgvOutName);
}
//入口无料架,mayEnter //入口无料架,mayEnter
if (IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.LOW)) 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; return false;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!