From 23d160e4a0a0ab53df8e4859cb4ff10f78e4f55c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=8F=AB=E9=94=84=E5=A4=B4?= Date: Mon, 8 Jan 2024 09:58:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=8A=A5=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Report/DryMixer/SelectRowAction.cs | 25 +++++++++++++ .../Report/GelDoser/SelectRowAction.cs | 35 +++++++++++++++++-- .../Report/WetMixer/SelectRowAction.cs | 32 +++++++++++++++-- .../MCProject/nodeForm/湿混机报表.xml | 2 +- 4 files changed, 88 insertions(+), 6 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/DryMixer/SelectRowAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/DryMixer/SelectRowAction.cs index e3a99db..aa0ee13 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/DryMixer/SelectRowAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/DryMixer/SelectRowAction.cs @@ -125,6 +125,11 @@ namespace Mesnac.Action.ChemicalWeighing.Report.DryMixer DataTable tableB = dbHelper.ToDataTable(); DataTable newTable = GetDefault(); + var dateNow = DateTime.Now; + Dictionary dic = new Dictionary(); + Dictionary Newdic = new Dictionary(); + + foreach (DataRow row in tableB.Rows) { var dr= newTable.NewRow(); @@ -135,9 +140,29 @@ namespace Mesnac.Action.ChemicalWeighing.Report.DryMixer dr["速度"] = row["速度"]; dr["记录时间"] = row["记录时间"]; dr["速度"] = Convert.ToSingle(row["速度"]).ToString("#0.00"); + + dateNow = Convert.ToDateTime(row["记录时间"].ToString()); + dic.Add(Convert.ToInt32(dr["步号"]), Convert.ToInt32(row["时间"])); newTable.Rows.Add(dr); } + for (int i = 1; i < 11; i++) + { + var miao = dic.Where(x => x.Key >= i).Select(x => x.Value).Sum(); + Newdic.Add(i, dateNow.AddSeconds(-miao)); + } + + foreach (System.Data.DataRow row in newTable.Rows) + { + var bu = Convert.ToInt32(row["步号"]); + if (Newdic.ContainsKey(bu)) + { + var dt = Newdic[bu]; + row["记录时间"] = dt.ToString("yyyy-MM-dd HH:mm:ss"); + } + + } + clientGrid2.DataSource = newTable; } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/SelectRowAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/SelectRowAction.cs index 17ac9d6..c299b16 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/SelectRowAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/SelectRowAction.cs @@ -165,12 +165,14 @@ t1.actValue as 实际重量,t1.actToler as 实际公差 $" left join ActionCode t2 on t1.actCode =t2.Code\r\n\r\n " + $" where t2.DeviceUnitId=2 and t1.reportId ='{lR_planID}'\r\n\r\n " + $"" + - $" order by t1.actCode"; + $" order by t1.mixStep"; dbHelper.CommandText = sql.ToString(); dbHelper.CommandType = System.Data.CommandType.Text; DataTable table2 = dbHelper.ToDataTable(); + Dictionary dic = new Dictionary(); + Dictionary Newdic = new Dictionary(); var tableNewB=new DataTable(); tableNewB.Columns.Add("批次", typeof(string)); @@ -180,6 +182,7 @@ t1.actValue as 实际重量,t1.actToler as 实际公差 //tableNewB.Columns.Add("温度", typeof(string)); tableNewB.Columns.Add("速度", typeof(string)); tableNewB.Columns.Add("记录时间", typeof(string)); + var dateNow = DateTime.Now; foreach (System.Data.DataRow row in table2.Rows) { @@ -194,10 +197,38 @@ t1.actValue as 实际重量,t1.actToler as 实际公差 dr["时间"] = ConverToTime(Convert.ToInt32(row["时间"])); //dr["温度"] = row["温度"]; dr["速度"] = row["速度"]; - dr["记录时间"] = row["记录时间"]; + dateNow = Convert.ToDateTime(row["记录时间"].ToString()); tableNewB.Rows.Add(dr); + + dic.Add(Convert.ToInt32(dr["步号"]), Convert.ToInt32(row["时间"])); + } + + + + for (int i = 1; i < 8; i++) + { + var miao = dic.Where(x => x.Key >= i).Select(x => x.Value).Sum(); + Newdic.Add(i, dateNow.AddSeconds(-miao)); + } + + + foreach (System.Data.DataRow row in tableNewB.Rows) + { + var bu = Convert.ToInt32(row["步号"]); + if(Newdic.ContainsKey(bu)) + { + var dt = Newdic[bu]; + row["记录时间"] = dt.ToString("yyyy-MM-dd HH:mm:ss"); + } + + } + + + + + clientGrid2.DataSource = null; clientGrid2.DataSource = tableNewB; diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/WetMixer/SelectRowAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/WetMixer/SelectRowAction.cs index 3f64c94..cf825b0 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/WetMixer/SelectRowAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/WetMixer/SelectRowAction.cs @@ -84,14 +84,17 @@ namespace Mesnac.Action.ChemicalWeighing.Report.WetMixer where t2.DeviceUnitId=3 and t1.reportId = @reportId - order by t1.actCode "); + order by t1.mixStep "); dbHelper.CommandText = sqlStr.ToString(); dbHelper.CommandType = System.Data.CommandType.Text; dbHelper.AddParameter("@reportId", lR_planID); DataTable table = dbHelper.ToDataTable(); + var dateNow = DateTime.Now; + Dictionary dic = new Dictionary(); + Dictionary Newdic = new Dictionary(); - var tableNew=new DataTable(); + var tableNew=new DataTable(); tableNew.Columns.Add("批次", typeof(string)); tableNew.Columns.Add("步号", typeof(string)); tableNew.Columns.Add("动作", typeof(string)); @@ -114,10 +117,33 @@ namespace Mesnac.Action.ChemicalWeighing.Report.WetMixer dr["温度"] = row["温度"]; dr["速度"] = row["速度"]; dr["记录时间"] = row["记录时间"]; + dateNow = Convert.ToDateTime(row["记录时间"].ToString()); + dic.Add(Convert.ToInt32(dr["步号"]), Convert.ToInt32(row["时间"])); tableNew.Rows.Add(dr); + } - + + + + for (int i = 1; i < 3; i++) + { + var miao = dic.Where(x => x.Key >= i).Select(x => x.Value).Sum(); + Newdic.Add(i, dateNow.AddSeconds(-miao)); + } + + foreach (System.Data.DataRow row in tableNew.Rows) + { + var bu = Convert.ToInt32(row["步号"]); + if (Newdic.ContainsKey(bu)) + { + var dt = Newdic[bu]; + row["记录时间"] = dt.ToString("yyyy-MM-dd HH:mm:ss"); + } + + } + + clientGrid.DataSource = tableNew; } diff --git a/Main/MCEdit/Data/MCProject/nodeForm/湿混机报表.xml b/Main/MCEdit/Data/MCProject/nodeForm/湿混机报表.xml index dff54da..775c843 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/湿混机报表.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/湿混机报表.xml @@ -119,7 +119,7 @@ None - True + False True True