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