|
@@ -44,19 +44,15 @@ namespace WCS.Service.Extensions
|
|
|
}
|
|
|
catch (DoException ex)
|
|
|
{
|
|
|
- InfoLog.INFO_INFO($"[{Entity.CODE}]--{ex.Message}");
|
|
|
+ ex.DoExceptionEX(Entity);
|
|
|
}
|
|
|
catch (WarnException ex)
|
|
|
{
|
|
|
- InfoLog.INFO_WARN($"[{Entity.CODE}]--{ex.Message}");
|
|
|
- LogHelper.AddWCS_EXCEPTION(ex.Message, Entity.CODE, WCS_EXCEPTIONTYPE.无.ToString());
|
|
|
- throw new Exception($"[{Entity.CODE}]--{ex.Message}");
|
|
|
+ ex.WarnExceptionEX(Entity);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- Ltc.Log(ex.GetBaseException().Message);
|
|
|
- InfoLog.INFO_ERROR($"[{Entity.CODE}]--{ex.Message}");
|
|
|
- //LogHelper.AddWCS_EXCEPTION(ex.Message, Entity.CODE, WCS_EXCEPTIONTYPE.无.ToString());
|
|
|
+ ex.ExceptionEx(Entity);
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
@@ -278,20 +274,15 @@ namespace WCS.Service.Extensions
|
|
|
}
|
|
|
catch (DoException ex)
|
|
|
{
|
|
|
- InfoLog.INFO_INFO($"[{Entity.CODE}]--{ex.Message}");
|
|
|
+ ex.DoExceptionEX(Entity);
|
|
|
}
|
|
|
catch (WarnException ex)
|
|
|
{
|
|
|
- Ltc.Log(ex.GetBaseException().Message);
|
|
|
- InfoLog.INFO_WARN($"[{Entity.CODE}]--{ex.Message}");
|
|
|
- LogHelper.AddWCS_EXCEPTION(ex.Message, Entity.CODE, WCS_EXCEPTIONTYPE.无.ToString());
|
|
|
- throw new Exception($"[{Entity.CODE}]--{ex.Message}");
|
|
|
+ ex.WarnExceptionEX(Entity);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- Ltc.Log(ex.GetBaseException().Message);
|
|
|
- InfoLog.INFO_ERROR($"[{Entity.CODE}]--{ex.Message}");
|
|
|
- //LogHelper.AddWCS_EXCEPTION(ex.Message, Entity.CODE, WCS_EXCEPTIONTYPE.无.ToString());
|
|
|
+ ex.ExceptionEx(Entity);
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
@@ -378,20 +369,15 @@ namespace WCS.Service.Extensions
|
|
|
}
|
|
|
catch (DoException ex)
|
|
|
{
|
|
|
- InfoLog.INFO_INFO($"[{Entity.CODE}]--{ex.Message}");
|
|
|
+ ex.DoExceptionEX(Entity);
|
|
|
}
|
|
|
catch (WarnException ex)
|
|
|
{
|
|
|
- Ltc.Log(ex.GetBaseException().Message);
|
|
|
- InfoLog.INFO_WARN($"[{Entity.CODE}]--{ex.Message}");
|
|
|
- LogHelper.AddWCS_EXCEPTION(ex.Message, Entity.CODE, WCS_EXCEPTIONTYPE.无.ToString());
|
|
|
- throw new Exception($"[{Entity.CODE}]--{ex.Message}");
|
|
|
+ ex.WarnExceptionEX(Entity);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- Ltc.Log(ex.GetBaseException().Message);
|
|
|
- InfoLog.INFO_ERROR($"[{Entity.CODE}]--{ex.Message}");
|
|
|
- //LogHelper.AddWCS_EXCEPTION(ex.Message, Entity.CODE, WCS_EXCEPTIONTYPE.无.ToString());
|
|
|
+ ex.ExceptionEx(Entity);
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
@@ -627,20 +613,15 @@ namespace WCS.Service.Extensions
|
|
|
}
|
|
|
catch (DoException ex)
|
|
|
{
|
|
|
- InfoLog.INFO_INFO($"[{Entity.CODE}]--{ex.Message}");
|
|
|
+ ex.DoExceptionEX(Entity);
|
|
|
}
|
|
|
catch (WarnException ex)
|
|
|
{
|
|
|
- Ltc.Log(ex.GetBaseException().Message);
|
|
|
- InfoLog.INFO_WARN($"[{Entity.CODE}]--{ex.Message}");
|
|
|
- LogHelper.AddWCS_EXCEPTION(ex.Message, Entity.CODE, WCS_EXCEPTIONTYPE.无.ToString());
|
|
|
- throw new Exception($"[{Entity.CODE}]--{ex.Message}");
|
|
|
+ ex.WarnExceptionEX(Entity);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- Ltc.Log(ex.GetBaseException().Message);
|
|
|
- InfoLog.INFO_ERROR($"[{Entity.CODE}]--{ex.Message}");
|
|
|
- //LogHelper.AddWCS_EXCEPTION(ex.Message, Entity.CODE, WCS_EXCEPTIONTYPE.无.ToString());
|
|
|
+ ex.ExceptionEx(Entity);
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
@@ -794,6 +775,36 @@ namespace WCS.Service.Extensions
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 异常处理
|
|
|
+ /// </summary>
|
|
|
+ public static class ExceptionEX
|
|
|
+ {
|
|
|
+ public static void DoExceptionEX(this DoException ex, WCS_DEVICE Entity)
|
|
|
+ {
|
|
|
+ InfoLog.INFO_INFO($"[{Entity.CODE}]--{ex.Message}");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void WarnExceptionEX(this WarnException ex, WCS_DEVICE Entity)
|
|
|
+ {
|
|
|
+ InfoLog.INFO_WARN($"[{Entity.CODE}]--{ex.Message}");
|
|
|
+ LogHelper.AddWCS_EXCEPTION(ex.Message, Entity.CODE, WCS_EXCEPTIONTYPE.无.ToString());
|
|
|
+ if (!ex.Message.Contains("触发并发管控")) //排除部分频繁触发的异常上报
|
|
|
+ {
|
|
|
+ Ltc.Log(ex.GetBaseException().Message);
|
|
|
+ };
|
|
|
+ throw new Exception($"[{Entity.CODE}]--{ex.Message}");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void ExceptionEx(this Exception ex, WCS_DEVICE Entity)
|
|
|
+ {
|
|
|
+ InfoLog.INFO_ERROR($"[{Entity.CODE}]--{ex.Message}");
|
|
|
+ //排除部分频繁触发的异常上报
|
|
|
+ if (ex.Message.Contains("Collection was modified; enumeration operation may not execute.")) return;
|
|
|
+ Ltc.Log(ex.GetBaseException().Message);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 堆垛机货叉/工位
|
|
|
/// </summary>
|