From 0fc57852753f1188623b7cc2719f45eaa73277b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=8F=AB=E9=94=84=E5=A4=B4?= Date: Wed, 10 Jan 2024 09:33:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9C=A8=E8=96=AF=E7=B2=89=E6=80=BB?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LjReport/DayWhiteEmbryo/GhWuLiaoInitDb.cs | 70 +++++++++++-------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GhWuLiaoInitDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GhWuLiaoInitDb.cs index ba445c1..46e22b3 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GhWuLiaoInitDb.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GhWuLiaoInitDb.cs @@ -49,25 +49,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo - dt = new DataTable(); - dt.Columns.Add("机台", typeof(string)); + - dt.Columns.Add("小料1总量", typeof(string)); - dt.Columns.Add("小料2总量", typeof(string)); - dt.Columns.Add("木粉总量", typeof(string)); - dt.Columns.Add("炭酸钙总量", typeof(string)); - dt.Columns.Add("木薯粉总量", typeof(string)); - dt.Columns.Add("玉米粉总量", typeof(string)); - - dt.Columns.Add("炭粉1总量", typeof(string)); - dt.Columns.Add("炭粉2总量", typeof(string)); - dt.Columns.Add("炭粉3总量", typeof(string)); - dt.Columns.Add("炭粉4总量", typeof(string)); - dt.Columns.Add("炭粉5总量", typeof(string)); - dt.Columns.Add("炭粉6总量", typeof(string)); - dt.Columns.Add("炭粉7总量", typeof(string)); - dt.Columns.Add("炭粉8总量", typeof(string)); - dt.Columns.Add("回收总量", typeof(string)); @@ -87,7 +70,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo private void SelectButton_Click(object sender, EventArgs e) { DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local); - dt.Rows.Clear(); + dt = GetDefault(); DateTime starttime = startDate.Value.Date.AddHours(startTime.Value.Hour).AddMinutes(startTime.Value.Minute).AddSeconds(startTime.Value.Second); DateTime endtime = endDate.Value.Date.AddHours(endTime.Value.Hour).AddMinutes(endTime.Value.Minute).AddSeconds(endTime.Value.Second); @@ -99,12 +82,14 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo for (int i = 1; i <5; i++) { - string sql = $"select t1.batch ,t1.matCode,\r\n " + - $" t1.actValue, t1.actToler\r\n " + - $" from Report_DryDos_Detail t1\r\n" + - $"where eqNo='{i}' and recordTime>'{statValue}' and recordTime<='{endValue}'"; + string sql = "select t2.dryNo, eqNo, t1.batch ,t1.matCode,\r\n " + + " t1.actValue, t1.actToler, t1.recordTime\r\n " + + " from Report_DryDos_Detail t1\r\n " + + " left join Report_Dry t2 on t1.reportId= t2.reportId\r\nwhere " + + $"t2.dryNo='{i}' and t1.recordTime>'{statValue}' and t1.recordTime<='{endValue}'\r\n\r\norder by t1.matCode"; + dbHelper.CommandText = sql.ToString(); dbHelper.CommandType = CommandType.Text; DataTable table2 = dbHelper.ToDataTable(); @@ -112,7 +97,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo foreach (DataRow dr in table2.Rows) { GhWuLiaoIniEntity entity = new GhWuLiaoIniEntity(); - entity.eqNo = i; + entity.dryNo = i; entity.matCode = Convert.ToInt32(dr["matCode"].ToString()); entity.actValue = Convert.ToSingle(dr["actValue"].ToString()); list.Add(entity); @@ -130,13 +115,12 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo dr[0] = "干混机" + i; for (int j = 1; j <=15; j++) { - var actValue= list.Where(x=>x.eqNo==i) + var actValue= list.Where(x=>x.dryNo == i) .Where(x=>x.matCode==j).Sum(x=>x.actValue); dr[j] = actValue.ToString("#0.00"); - - + } @@ -151,6 +135,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo dt.Rows.Add(drTotal); + dt.Columns.Remove("木薯粉总量"); + dt.Columns.Remove("玉米粉总量"); this.dataGridView.AutoGenerateColumns = true; this.dataGridView.DataSource = null; @@ -159,11 +145,37 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo } + + private DataTable GetDefault() + { + dt = new DataTable(); + dt.Columns.Add("机台", typeof(string)); + + dt.Columns.Add("小料1总量", typeof(string)); + dt.Columns.Add("小料2总量", typeof(string)); + dt.Columns.Add("木粉总量", typeof(string)); + dt.Columns.Add("炭酸钙总量", typeof(string)); + + dt.Columns.Add("木薯粉总量", typeof(string)); + dt.Columns.Add("玉米粉总量", typeof(string)); + + dt.Columns.Add("炭粉1总量", typeof(string)); + dt.Columns.Add("炭粉2总量", typeof(string)); + dt.Columns.Add("炭粉3总量", typeof(string)); + dt.Columns.Add("炭粉4总量", typeof(string)); + dt.Columns.Add("炭粉5总量", typeof(string)); + dt.Columns.Add("炭粉6总量", typeof(string)); + dt.Columns.Add("炭粉7总量", typeof(string)); + dt.Columns.Add("炭粉8总量", typeof(string)); + dt.Columns.Add("回收总量", typeof(string)); + + return dt; + } } public class GhWuLiaoIniEntity { - public int eqNo { get; set; } + public int dryNo { get; set; } /// /// 物料编码 @@ -175,4 +187,6 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo } + + } From 43c24074d8750aacf253e311f73b8296ce4c6ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=8F=AB=E9=94=84=E5=A4=B4?= Date: Wed, 10 Jan 2024 09:58:42 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=B9=B2=E6=B7=B7?= =?UTF-8?q?=E6=9C=BAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LjReport/DayWhiteEmbryo/GhWuLiaoInitDb.cs | 2 +- .../Report/DryMixer/SelectRowAction.cs | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GhWuLiaoInitDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GhWuLiaoInitDb.cs index 46e22b3..c961a1a 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GhWuLiaoInitDb.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GhWuLiaoInitDb.cs @@ -49,8 +49,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo - + SelectButton_Click(new object(),new EventArgs()); diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/DryMixer/SelectRowAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/DryMixer/SelectRowAction.cs index d5151ac..dd234bf 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/DryMixer/SelectRowAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/DryMixer/SelectRowAction.cs @@ -102,19 +102,28 @@ namespace Mesnac.Action.ChemicalWeighing.Report.DryMixer dbHelper.AddParameter("@reportId", lR_planID); DataTable table = dbHelper.ToDataTable(); - string bathNo = ""; + string bathNo = "0"; foreach (DataRow row in table.Rows) { - string a= row["批次号"].ToString().Trim(); + string a = row["批次号"].ToString().Trim(); if (a != "0") { - bathNo = a; + bathNo=a; break; } - else + } + + + + + foreach (DataRow row in table.Rows) + { + string a= row["批次号"].ToString().Trim(); + if (a == "0") { row["批次号"] = bathNo; } + row["实际重量"]= Convert.ToSingle(row["实际重量"]).ToString("#0.00"); row["实际公差"] = Convert.ToSingle(row["实际公差"]).ToString("#0.00"); From 4a8e833157577464f03b5e794488915ea48183ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=8F=AB=E9=94=84=E5=A4=B4?= Date: Wed, 10 Jan 2024 10:01:36 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Report/GelDoser/SelectRowAction.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/SelectRowAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/SelectRowAction.cs index 2c210ae..5c600c0 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/SelectRowAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/SelectRowAction.cs @@ -109,16 +109,22 @@ t1.actValue as 实际重量,t1.actToler as 实际公差 dbHelper.AddParameter("@reportId", lR_planID); DataTable table = dbHelper.ToDataTable(); - string bathNo = ""; + string bathNo = "0"; - foreach (DataRow item in table.Rows) + foreach (DataRow row in table.Rows) { - string a = item["批次号"].ToString().Trim(); + string a = row["批次号"].ToString().Trim(); if (a != "0") { - bathNo = a; + bathNo = a; break; } - else + } + + + foreach (DataRow item in table.Rows) + { + string a = item["批次号"].ToString().Trim(); + if (a == "0") { item["批次号"] = bathNo; }