change - 报表时分秒显示

wangsr
wangsr 1 year ago
parent d1c66df369
commit 1cbb7eb74d

@ -129,9 +129,9 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport
for (int i = 0; i < listMore.Count; i++)
{
var dr = MoreDataTable.NewRow();
dr[0] = listMore[i].MixWaitTime;
dr[1] = listMore[i].RgvWaitTime;
dr[2] = listMore[i].MixWaitTime + listMore[i].RgvWaitTime;
dr[0] = TimeConvert(listMore[i].MixWaitTime);
dr[1] = TimeConvert(listMore[i].RgvWaitTime);
dr[2] = TimeConvert(listMore[i].MixWaitTime + listMore[i].RgvWaitTime);
dr[3] = listMore[i].MixReadyStartTime;
dr[4] = listMore[i].RGVLeaveTime;
MoreDataTable.Rows.Add(dr);
@ -201,29 +201,45 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport
var dr = dt.NewRow();
dr[0] = "湿混机" + i;
var MixWaitTime = list.Where(x => x.DeviceNo == i).Sum(x => x.MixWaitTime);
dr[1] = MixWaitTime.ToString();
dr[1] = TimeConvert(MixWaitTime);
var RGVWaitTime = list.Where(x => x.DeviceNo == i).Sum(x => x.RgvWaitTime);
dr[2] = RGVWaitTime.ToString();
dr[2] = TimeConvert(RGVWaitTime);
var totalTime = MixWaitTime + RGVWaitTime;
dr[3] = totalTime.ToString();
dr[3] = TimeConvert(totalTime);
dt.Rows.Add(dr);
}
var edr = dt.NewRow();
edr[0] = "湿混等待时间总和";
edr[1] = list.Sum(x => x.MixWaitTime).ToString();
edr[1] = TimeConvert(list.Sum(x => x.MixWaitTime));
dt.Rows.Add(edr);
var edr1 = dt.NewRow();
edr1[0] = "RGV等待时间总和";
edr1[1] = list.Sum(x => x.RgvWaitTime).ToString();
edr1[1] = TimeConvert(list.Sum(x => x.RgvWaitTime));
dt.Rows.Add(edr1);
var edr2 = dt.NewRow();
edr2[0] = "总等待时间总和";
edr2[1] = list.Sum(x => x.MixWaitTime + x.RgvWaitTime).ToString();
edr2[1] = TimeConvert(list.Sum(x => x.MixWaitTime + x.RgvWaitTime));
dt.Rows.Add(edr2);
dataGridView.DataSource = null;
dataGridView.DataSource = dt;
}
private string TimeConvert(int t)
{
int h = t / 3600;
int m = t / 60;
int s = t % 60;
if (h != 0)
{
return h + "时" + m + "分" + s + "秒";
}
if (m != 0)
{
return m + "分" + s + "秒";
}
return s + "秒";
}
}
}

Loading…
Cancel
Save