add - 湿混机等待时间统计添加数值溢出错误捕捉

dep
wangsr 11 months ago
parent 435d1ea98a
commit 5dba184ec8

@ -149,6 +149,9 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.WetWaitTime
dt.Rows.Add(dr); dt.Rows.Add(dr);
} }
try
{
var edr = dt.NewRow(); var edr = dt.NewRow();
edr[0] = "湿混等待时间总和"; edr[0] = "湿混等待时间总和";
edr[1] = TimeConvert(list.Sum(x => x.MixWaitTime)); edr[1] = TimeConvert(list.Sum(x => x.MixWaitTime));
@ -162,6 +165,12 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.WetWaitTime
edr2[1] = TimeConvert(list.Sum(x => x.MixWaitTime + x.RgvWaitTime)); edr2[1] = TimeConvert(list.Sum(x => x.MixWaitTime + x.RgvWaitTime));
dt.Rows.Add(edr2); dt.Rows.Add(edr2);
} }
catch (OverflowException ex)
{
MessageBox.Show("算术值溢出!请检查数据是否有误");
}
}
/// <summary> /// <summary>
/// 详细数据计算 /// 详细数据计算

@ -10,6 +10,7 @@ using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesnac.Action.ChemicalWeighing.LjReport.WetWaitTime namespace Mesnac.Action.ChemicalWeighing.LjReport.WetWaitTime
{ {
@ -225,6 +226,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.WetWaitTime
dt.Rows.Add(dr); dt.Rows.Add(dr);
} }
try
{
var edr = dt.NewRow(); var edr = dt.NewRow();
edr[0] = "湿混等待时间总和"; edr[0] = "湿混等待时间总和";
edr[1] = TimeConvert(list.Sum(x => x.MixWaitTime)); edr[1] = TimeConvert(list.Sum(x => x.MixWaitTime));
@ -238,6 +241,11 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.WetWaitTime
edr2[1] = TimeConvert(list.Sum(x => x.MixWaitTime + x.RgvWaitTime)); edr2[1] = TimeConvert(list.Sum(x => x.MixWaitTime + x.RgvWaitTime));
dt.Rows.Add(edr2); dt.Rows.Add(edr2);
} }
catch (OverflowException ex)
{
MessageBox.Show("算术值溢出!请检查数据是否有误");
}
}
private string TimeConvert(int t) private string TimeConvert(int t)
{ {

@ -25,12 +25,11 @@
<Property name="DbOptionType">None</Property> <Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property> <Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property> <Property name="MCEnabled">True</Property>
<Property name="AutoGenerateColumns">False</Property>
<Property name="MultiSelect">False</Property> <Property name="MultiSelect">False</Property>
<Property name="Location">348, 12</Property> <Property name="Location">348, 12</Property>
<Property name="Name">MoreData</Property> <Property name="Name">MoreData</Property>
<Property name="Size">530, 622</Property> <Property name="Size">530, 622</Property>
<Property name="TabIndex">7</Property> <Property name="TabIndex">9</Property>
</Object> </Object>
<Object type="System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="GroupBox1" children="Controls"> <Object type="System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="GroupBox1" children="Controls">
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="DataExport" children="Controls"> <Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="DataExport" children="Controls">

Loading…
Cancel
Save