diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GhWuLiaoInitDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GhWuLiaoInitDb.cs index 76798a2..0709f0d 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GhWuLiaoInitDb.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GhWuLiaoInitDb.cs @@ -1,4 +1,6 @@ -using DevExpress.Utils.Extensions; +using DataBlockHelper.DBHelpers; + +using DevExpress.Utils.Extensions; using Mesnac.Action.Base; using Mesnac.Codd.Session; @@ -30,7 +32,11 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo List list; - + + MCButton WhiteWork; + MCButton NightWork; + + public void Run(RuntimeParameter runtime) { base.RunIni(runtime); //必须调用 @@ -45,6 +51,15 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo endTime = control.FirstOrDefault(x => x.Name == "endTime") as MCDateTimePicker; dataGridView.AutoGenerateColumns = true; + + + WhiteWork = control.FirstOrDefault(x => x.Name == "WhiteWork") as MCButton; + NightWork = control.FirstOrDefault(x => x.Name == "NightWork") as MCButton; + + WhiteWork.Click += WhiteWork_Click; + NightWork.Click += WhiteWork_Click; + + startDate.Value = DateTime.Now.AddDays(-1); selectButton.Click += SelectButton_Click; @@ -71,7 +86,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 = GetDefault(); DateTime starttime = startDate.Value.Date.AddHours(startTime.Value.Hour).AddMinutes(startTime.Value.Minute).AddSeconds(startTime.Value.Second); @@ -79,10 +94,42 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo string statValue = starttime.ToString("yyyy-MM-dd HH:mm:ss"); string endValue = endtime.ToString("yyyy-MM-dd HH:mm:ss"); + FillData(statValue, endValue); + + } + + private void WhiteWork_Click(object sender, EventArgs e) + { + DateTime nowTime = DateTime.Now; + DateTime starttime; + DateTime endtime; + + //如果大于当天8点 就展示当天的白班 否则展示上一个白班 + if (nowTime >= DateTime.Now.Date.AddHours(8)) + { + starttime = DateTime.Now.Date.AddHours(7).AddMinutes(30); + endtime = DateTime.Now.Date.AddHours(19).AddMinutes(30); + } + else + { + starttime = DateTime.Now.Date.AddHours(-17).AddMinutes(30); + endtime = DateTime.Now.Date.AddHours(-5).AddMinutes(30); + } + + string statValue = starttime.ToString("yyyy-MM-dd HH:mm:ss"); + string endValue = endtime.ToString("yyyy-MM-dd HH:mm:ss"); + FillData(statValue, endValue); + } + + + + private void FillData(string statValue, string endValue) + { + DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local); list = new List(); - for (int i = 1; i <5; i++) + for (int i = 1; i < 5; i++) { @@ -108,21 +155,21 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo } dt.Rows.Clear(); - - var drTotal=dt.NewRow(); + + var drTotal = dt.NewRow(); drTotal[0] = "总计"; for (int i = 1; i < 5; i++) { DataRow dr = dt.NewRow(); dr[0] = "干混机" + i; - for (int j = 1; j <=15; j++) + for (int j = 1; j <= 15; j++) { - var actValue= list.Where(x=>x.dryNo == i) - .Where(x=>x.matCode==j).Sum(x=>x.actValue); + var actValue = list.Where(x => x.dryNo == i) + .Where(x => x.matCode == j).Sum(x => x.actValue); dr[j] = actValue.ToString("#0.00"); - + } @@ -141,27 +188,25 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo dt.Columns.Remove("玉米粉总量"); - for (int j = 0;j <= 4; j++) + for (int j = 0; j <= 4; j++) { - var dr=dt.Rows[j]; - float total = 0; - for (int i = 1;i <=13;i++) - { + var dr = dt.Rows[j]; + float total = 0; + for (int i = 1; i <= 13; i++) + { total += Convert.ToSingle(dr[i]); - } + } dr[14] = total.ToString("#0.00"); } - + this.dataGridView.AutoGenerateColumns = true; this.dataGridView.DataSource = null; this.dataGridView.DataSource = dt; - - } private DataTable GetDefault() diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/HuYuMiFenInitDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/HuYuMiFenInitDb.cs index d071131..b8e0658 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/HuYuMiFenInitDb.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/HuYuMiFenInitDb.cs @@ -1,4 +1,6 @@ -using DevExpress.DataProcessing; +using DataBlockHelper.DBHelpers; + +using DevExpress.DataProcessing; using DevExpress.Utils.Extensions; using Mesnac.Action.Base; @@ -35,6 +37,9 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo List list; + MCButton WhiteWork; + MCButton NightWork; + List listMore; public void Run(RuntimeParameter runtime) { @@ -57,6 +62,13 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo dataGridView.CellClick += MoreData_Click; + + WhiteWork = control.FirstOrDefault(x => x.Name == "WhiteWork") as MCButton; + NightWork = control.FirstOrDefault(x => x.Name == "NightWork") as MCButton; + + + + dt = new DataTable(); dt.Columns.Add("机台", typeof(string)); dt.Columns.Add("玉米粉总量", typeof(string)); @@ -89,14 +101,49 @@ 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(); - hus.Clear(); + 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); string statValue = starttime.ToString("yyyy-MM-dd HH:mm:ss"); string endValue = endtime.ToString("yyyy-MM-dd HH:mm:ss"); + + FileData(statValue, endValue); + } + + private void WhiteWork_Click(object sender, EventArgs e) + { + DateTime nowTime = DateTime.Now; + + DateTime starttime; + DateTime endtime; + + //如果大于当天8点 就展示当天的白班 否则展示上一个白班 + if (nowTime >= DateTime.Now.Date.AddHours(8)) + { + starttime = DateTime.Now.Date.AddHours(7).AddMinutes(30); + endtime = DateTime.Now.Date.AddHours(19).AddMinutes(30); + } + else + { + starttime = DateTime.Now.Date.AddHours(-17).AddMinutes(30); + endtime = DateTime.Now.Date.AddHours(-5).AddMinutes(30); + } + + string statValue = starttime.ToString("yyyy-MM-dd HH:mm:ss"); + string endValue = endtime.ToString("yyyy-MM-dd HH:mm:ss"); + FileData(statValue, endValue); + } + + + + + private void FileData(string statValue, string endValue) + { + + DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local); + dt.Rows.Clear(); + hus.Clear(); for (int i = 1; i < 9; i++) { @@ -110,9 +157,9 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo dbHelper.CommandType = System.Data.CommandType.Text; DataTable table2 = dbHelper.ToDataTable(); - foreach (DataRow dr in table2.Rows ) + foreach (DataRow dr in table2.Rows) { - HuYuMiFenEntity en=new HuYuMiFenEntity(); + HuYuMiFenEntity en = new HuYuMiFenEntity(); en.Name = "糊化机" + i; en.MName = dr["物料"].ToString(); en.ActValue = Convert.ToSingle(dr["实际重量"]).ToString("#0.00"); @@ -154,11 +201,11 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo { var dow = dt.NewRow(); string name = "糊化机" + i; - var list= hus.Where(x => x.Name ==name); + var list = hus.Where(x => x.Name == name); dow[0] = name; dow[1] = Convert.ToSingle(list.Where(x => x.MName == "玉米粉").Sum(x => Convert.ToSingle(x.ActValue))).ToString("#0.00"); dow[2] = Convert.ToSingle(list.Where(x => x.MName == "木薯粉").Sum(x => Convert.ToSingle(x.ActValue))).ToString("#0.00"); - + dt.Rows.Add(dow); } @@ -170,21 +217,18 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo { a += Convert.ToSingle(dr[1]); b += Convert.ToSingle(dr[2]); - + } var totalDow = dt.NewRow(); totalDow[0] = "总计"; - totalDow[1] = a.ToString("#0.00"); + totalDow[1] = a.ToString("#0.00"); totalDow[2] = b.ToString("#0.00"); - - - dt.Rows.Add (totalDow); - - dataGridView.DataSource = dt; + dt.Rows.Add(totalDow); + dataGridView.DataSource = dt; } private void MoreData_Click(object sender, EventArgs e) diff --git a/Main/MCEdit/Data/MCProject/nodeForm/FormGhWuLiao.xml b/Main/MCEdit/Data/MCProject/nodeForm/FormGhWuLiao.xml index 319464b..c2c9ddd 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/FormGhWuLiao.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/FormGhWuLiao.xml @@ -32,16 +32,83 @@ Fill 0, 0 MCDataGridView1 - 1171, 619 + 1171, 538 12 Fill - 0, 77 + 0, 158 Panel3 - 1171, 619 + 1171, 538 + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + 夜班统计 + 177, 93 + NightWork + 120, 31 + 19 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + 白班统计 + 11, 93 + WhiteWork + 120, 31 + 18 + + + + + Red + DarkGray + + + False + + + + None + True + True + 当前或最近一次班次统计 + 11, 68 + MCLabel1 + 137, 12 + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL @@ -148,13 +215,13 @@ 统计查询 9, 3 GroupBox1 - 868, 64 + 962, 139 11 Top 0, 0 Panel2 - 1171, 77 + 1171, 158 Fill 0, 0 diff --git a/Main/MCEdit/Data/MCProject/nodeForm/FormMuFence.xml b/Main/MCEdit/Data/MCProject/nodeForm/FormMuFence.xml index 0f40177..51bfbff 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/FormMuFence.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/FormMuFence.xml @@ -32,16 +32,83 @@ Fill 0, 0 MCDataGridView1 - 650, 788 + 650, 705 9 Fill - 0, 74 + 0, 157 Panel4 - 650, 788 + 650, 705 + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + 夜班统计 + 177, 97 + NightWork + 120, 31 + 22 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + 白班统计 + 11, 97 + WhiteWork + 120, 31 + 21 + + + + + Red + DarkGray + + + False + + + + None + True + True + 当前或最近一次班次统计 + 11, 72 + MCLabel1 + 137, 12 + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL @@ -148,13 +215,13 @@ 统计查询 3, 3 GroupBox1 - 644, 60 + 644, 148 10 Top 0, 0 Panel3 - 650, 74 + 650, 157