Commit ff3e2be2 authored by 潘栩锋's avatar 潘栩锋 🚴

修复 warningService.ReasonList 可以为null, 直接读取它会出错

parent 2c1358f2
...@@ -63,23 +63,36 @@ namespace FLY.Thick.Base.UI.OnInit ...@@ -63,23 +63,36 @@ namespace FLY.Thick.Base.UI.OnInit
List<int> errCodes = new List<int> { ERRNOs.Instance.SCAN_ERRNO_OVERCTRL.Code, ERRNOs.Instance.SCAN_ERRNO_OVERTOL.Code }; List<int> errCodes = new List<int> { ERRNOs.Instance.SCAN_ERRNO_OVERCTRL.Code, ERRNOs.Instance.SCAN_ERRNO_OVERTOL.Code };
var record = warningService.ReasonList; var record = warningService.ReasonList;
if (record == null)
{
//什么报警都没有
//不需要提示
if (warningTipId != -1)
{
//需要把之前的报警关闭
FLY.ControlLibrary.Window_WarningTip.Stop(warningTipId);
warningTipId = -1;
}
return;
}
var rs = from r in record where errCodes.Contains(r.ErrCode) select r; var rs = from r in record where errCodes.Contains(r.ErrCode) select r;
if (rs.Count() == 0) if (rs.Count() == 0)
{ {
//不需要提示 //不需要提示
if (warningTipId != -1) if (warningTipId != -1)
{ {
//需要把之前的报警关闭 //需要把之前的报警关闭
FLY.ControlLibrary.Window_WarningTip.Stop(warningTipId); FLY.ControlLibrary.Window_WarningTip.Stop(warningTipId);
warningTipId = -1; warningTipId = -1;
} }
return;
} }
else
{ int errcode = rs.First().ErrCode;
int errcode = rs.First().ErrCode; string msg = rs.First().Description;
string msg = rs.First().Description;
string path = paramDictionary.GetValue<string>(ParamDistItemKeys.WarningTipPath); string path = paramDictionary.GetValue<string>(ParamDistItemKeys.WarningTipPath);
//报警!!!!!!!! //报警!!!!!!!!
//记录打开的报警提示框Id,用于以后关闭 //记录打开的报警提示框Id,用于以后关闭
...@@ -90,7 +103,7 @@ namespace FLY.Thick.Base.UI.OnInit ...@@ -90,7 +103,7 @@ namespace FLY.Thick.Base.UI.OnInit
path, path,
warningService.Reset warningService.Reset
); );
}
}), this, MARKNO_WARNING_RING); }), this, MARKNO_WARNING_RING);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment