using com.steering.mes.zgmil.entity; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.ZGMil.Signature; using CoreFS.CA06; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Core.StlMes.Client.ZGMil.Entity { public partial class FrmStatisticalPub : FrmBase { private string _bc = ""; private int days = 0; private string effic250 = ""; private string effic1250 = ""; private string effic2250 = ""; private string effic258 = ""; private string effic1258 = ""; private string effic2258 = ""; private string effic168 = ""; private string effic1168 = ""; private string effic2168 = ""; private string effic460 = ""; private string effic1460 = ""; private string effic2460 = ""; private string efficAs = ""; private string effic1As = ""; private string effic2As = ""; public FrmStatisticalPub() { InitializeComponent(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.statisticalControl1.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; this.statisticalControl2.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; this.statisticalControl3.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; this.statisticalControl4.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; this.statisticalControl5.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; this.statisticalControl6.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; this.statisticalControl7.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; this.statisticalControl8.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; this.statisticalControl9.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; this.statisticalControl10.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; this.statisticalControl11.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; this.statisticalControl12.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; this.statisticalControl13.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; this.statisticalControl14.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; this.statisticalControl15.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; } private void FrmStatisticalPub_Load(object sender, EventArgs e) { EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); cmbBc.Value = this.UserInfo.GetUserOrder(); //cmbBz.Value = this.UserInfo.GetUserGroup(); dateDayTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); days = System.Threading.Thread.CurrentThread.CurrentUICulture.Calendar.GetDaysInMonth(DateTime.Now.Year, DateTime.Now.Month); DataTable dt = dataTable1; dt.Columns.Add(new DataColumn("Month") { Caption = "停机汇总" }); TubeRoll.GridColumnSum(ultraGrid3, new string[] { "Month" }); for (int i = 0; i < days; i++) { string key = "DAY" + (i + 1); string name = (i + 1).ToString(); dt.Columns.Add(new DataColumn(key) { Caption = name }); TubeRoll.GridColumnSum(ultraGrid3, new string[] { key }); } doOutlibrary(); doMinutesQuery(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Outlibrary"://查询 doOutlibrary(); break; case "ClassPint"://班报打印 doClassPint(); break; case "DayPrint"://日报打印 doDayPrint(); break; case "MonthPrint"://月报打印 doMonthPrint(); break; case "Close": this.Close(); break; default: break; } } private void doOutlibrary() { //月 string fistMonthD = ""; //日 string fistday = ""; fistMonthD = dateDayTime.Value.ToString("yyyyMM"); fistday = dateDayTime.Value.ToString("yyyyMMdd"); _bc = cmbBc.Value.ToString(); //_bz = cmbBz.Value.ToString(); #region 250机组 //查询当班生产实绩 DataTable dt = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryActual", new object[] { fistday, _bc, "C008" }, this.ob); if (dt != null && dt.Rows.Count > 0) { //if (!dt.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row = dt.Rows[0]; this.statisticalControl6.Value.JudgeStoveNo = row["JUDGE_STOVE_NO"].ToString(); this.statisticalControl6.Value.QualifiedNum = row["QUALIFIED_NUM"].ToString(); this.statisticalControl6.Value.QualifiedWt = row["QUALIFIED_WT"].ToString(); this.statisticalControl6.Value.Minutes = row["MINUTES"].ToString(); this.statisticalControl6.Value.AbaMinutes = row["ABSMINUTES"].ToString(); this.statisticalControl6.Value.SumMinutes = row["SUMMINUTES"].ToString(); double feizi = double.Parse(row["YOUMINUTES"].ToString()) - double.Parse(row["SUMMINUTES"].ToString()); double feimu = double.Parse(row["YOUMINUTES"].ToString()); if (feizi <= 0 || dt.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { effic250 = "0"; } else { effic250 = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl6.Value.Effic = effic250 + "%"; this.statisticalControl6.UpdateData(); } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl6.Value = result; } //查询当天生产实绩 DataTable dt1 = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryDayActual", new object[] { fistday, "C008" }, this.ob); if (dt1 != null && dt1.Rows.Count > 0) { //if (!dt1.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row1 = dt1.Rows[0]; this.statisticalControl4.Value.JudgeStoveNo = row1["JUDGE_STOVE_NO"].ToString(); this.statisticalControl4.Value.QualifiedNum = row1["QUALIFIED_NUM"].ToString(); this.statisticalControl4.Value.QualifiedWt = row1["QUALIFIED_WT"].ToString(); this.statisticalControl4.Value.Minutes = row1["MINUTES"].ToString(); this.statisticalControl4.Value.AbaMinutes = row1["ABSMINUTES"].ToString(); this.statisticalControl4.Value.SumMinutes = row1["SUMMINUTES"].ToString(); double feizi = double.Parse(row1["YOUMINUTES"].ToString()) - double.Parse(row1["SUMMINUTES"].ToString()); double feimu = double.Parse(row1["YOUMINUTES"].ToString()); if (feizi <= 0 || dt1.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { effic1250 = "0"; } else { effic1250 = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl4.Value.Effic = effic1250 + "%"; this.statisticalControl4.UpdateData(); } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl4.Value = result; } //查询当月生产实绩 DataTable dt2 = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryMonthActual", new object[] { fistMonthD, "C008" }, this.ob); if (dt2 != null && dt2.Rows.Count > 0) { //if (!dt2.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row2 = dt2.Rows[0]; this.statisticalControl5.Value.JudgeStoveNo = row2["JUDGE_STOVE_NO"].ToString(); this.statisticalControl5.Value.QualifiedNum = row2["QUALIFIED_NUM"].ToString(); this.statisticalControl5.Value.QualifiedWt = row2["QUALIFIED_WT"].ToString(); this.statisticalControl5.Value.Minutes = row2["MINUTES"].ToString(); this.statisticalControl5.Value.AbaMinutes = row2["ABSMINUTES"].ToString(); this.statisticalControl5.Value.SumMinutes = row2["SUMMINUTES"].ToString(); double feizi = double.Parse(row2["YOUMINUTES"].ToString()) - double.Parse(row2["SUMMINUTES"].ToString()); double feimu = double.Parse(row2["YOUMINUTES"].ToString()); if (feizi <= 0 || dt2.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { effic2250 = "0"; } else { effic2250 = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl5.Value.Effic = effic2250 + "%"; this.statisticalControl5.UpdateData(); } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl5.Value = result; } #endregion #region 258机组 //查询当班生产实绩 DataTable dt258 = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryActual", new object[] { fistday, _bc, "C009" }, this.ob); if (dt258 != null && dt258.Rows.Count > 0) { //if (!dt258.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row = dt258.Rows[0]; this.statisticalControl9.Value.JudgeStoveNo = row["JUDGE_STOVE_NO"].ToString(); this.statisticalControl9.Value.QualifiedNum = row["QUALIFIED_NUM"].ToString(); this.statisticalControl9.Value.QualifiedWt = row["QUALIFIED_WT"].ToString(); this.statisticalControl9.Value.Minutes = row["MINUTES"].ToString(); this.statisticalControl9.Value.AbaMinutes = row["ABSMINUTES"].ToString(); this.statisticalControl9.Value.SumMinutes = row["SUMMINUTES"].ToString(); double feizi = double.Parse(row["YOUMINUTES"].ToString()) - double.Parse(row["SUMMINUTES"].ToString()); double feimu = double.Parse(row["YOUMINUTES"].ToString()); if (feizi <= 0 || dt.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { effic258 = "0"; } else { effic258 = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl9.Value.Effic = effic258 + "%"; this.statisticalControl9.UpdateData(); } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl9.Value = result; } //查询当天生产实绩 DataTable dt1258 = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryDayActual", new object[] { fistday, "C009" }, this.ob); if (dt1258 != null && dt1258.Rows.Count > 0) { //if (!dt1258.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row1 = dt1258.Rows[0]; this.statisticalControl7.Value.JudgeStoveNo = row1["JUDGE_STOVE_NO"].ToString(); this.statisticalControl7.Value.QualifiedNum = row1["QUALIFIED_NUM"].ToString(); this.statisticalControl7.Value.QualifiedWt = row1["QUALIFIED_WT"].ToString(); this.statisticalControl7.Value.Minutes = row1["MINUTES"].ToString(); this.statisticalControl7.Value.AbaMinutes = row1["ABSMINUTES"].ToString(); this.statisticalControl7.Value.SumMinutes = row1["SUMMINUTES"].ToString(); double feizi = double.Parse(row1["YOUMINUTES"].ToString()) - double.Parse(row1["SUMMINUTES"].ToString()); double feimu = double.Parse(row1["YOUMINUTES"].ToString()); if (feizi <= 0 || dt1258.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { effic1258 = "0"; } else { effic1258 = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl7.Value.Effic = effic1258 + "%"; this.statisticalControl7.UpdateData(); //} //else //{ // StatisticalClass result = new StatisticalClass(); // this.statisticalControl7.Value = result; //} } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl7.Value = result; } //查询当月生产实绩 DataTable dt2258 = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryMonthActual", new object[] { fistMonthD, "C009" }, this.ob); if (dt2258 != null && dt2258.Rows.Count > 0) { //if (!dt2258.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row2 = dt2258.Rows[0]; this.statisticalControl8.Value.JudgeStoveNo = row2["JUDGE_STOVE_NO"].ToString(); this.statisticalControl8.Value.QualifiedNum = row2["QUALIFIED_NUM"].ToString(); this.statisticalControl8.Value.QualifiedWt = row2["QUALIFIED_WT"].ToString(); this.statisticalControl8.Value.Minutes = row2["MINUTES"].ToString(); this.statisticalControl8.Value.AbaMinutes = row2["ABSMINUTES"].ToString(); this.statisticalControl8.Value.SumMinutes = row2["SUMMINUTES"].ToString(); double feizi = double.Parse(row2["YOUMINUTES"].ToString()) - double.Parse(row2["SUMMINUTES"].ToString()); double feimu = double.Parse(row2["YOUMINUTES"].ToString()); if (feizi <= 0 || dt2258.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { effic2258 = "0"; } else { effic2258 = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl8.Value.Effic = effic2258 + "%"; this.statisticalControl8.UpdateData(); } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl8.Value = result; } #endregion #region 168机组 //查询当班生产实绩 DataTable dt168 = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryActual", new object[] { fistday, _bc, "C010" }, this.ob); if (dt168 != null && dt168.Rows.Count > 0) { //if (!dt168.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row = dt168.Rows[0]; this.statisticalControl1.Value.JudgeStoveNo = row["JUDGE_STOVE_NO"].ToString(); this.statisticalControl1.Value.QualifiedNum = row["QUALIFIED_NUM"].ToString(); this.statisticalControl1.Value.QualifiedWt = row["QUALIFIED_WT"].ToString(); this.statisticalControl1.Value.Minutes = row["MINUTES"].ToString(); this.statisticalControl1.Value.AbaMinutes = row["ABSMINUTES"].ToString(); this.statisticalControl1.Value.SumMinutes = row["SUMMINUTES"].ToString(); double feizi = double.Parse(row["YOUMINUTES"].ToString()) - double.Parse(row["SUMMINUTES"].ToString()); double feimu = double.Parse(row["YOUMINUTES"].ToString()); if (feizi <= 0 || dt168.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { effic168 = "0"; } else { effic168 = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl1.Value.Effic = effic168 + "%"; this.statisticalControl1.UpdateData(); } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl1.Value = result; } //查询当天生产实绩 DataTable dt1168 = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryDayActual", new object[] { fistday, "C010" }, this.ob); if (dt1168 != null && dt1168.Rows.Count > 0) { //if (!dt1168.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row1 = dt1168.Rows[0]; this.statisticalControl3.Value.JudgeStoveNo = row1["JUDGE_STOVE_NO"].ToString(); this.statisticalControl3.Value.QualifiedNum = row1["QUALIFIED_NUM"].ToString(); this.statisticalControl3.Value.QualifiedWt = row1["QUALIFIED_WT"].ToString(); this.statisticalControl3.Value.Minutes = row1["MINUTES"].ToString(); this.statisticalControl3.Value.AbaMinutes = row1["ABSMINUTES"].ToString(); this.statisticalControl3.Value.SumMinutes = row1["SUMMINUTES"].ToString(); double feizi = double.Parse(row1["YOUMINUTES"].ToString()) - double.Parse(row1["SUMMINUTES"].ToString()); double feimu = double.Parse(row1["YOUMINUTES"].ToString()); if (feizi <= 0 || dt1168.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { effic1168 = "0"; } else { effic1168 = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl3.Value.Effic = effic1168 + "%"; this.statisticalControl3.UpdateData(); } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl3.Value = result; } //查询当月生产实绩 DataTable dt2168 = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryMonthActual", new object[] { fistMonthD, "C010" }, this.ob); if (dt2168 != null && dt2168.Rows.Count > 0) { //if (!dt2168.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row2 = dt2168.Rows[0]; this.statisticalControl2.Value.JudgeStoveNo = row2["JUDGE_STOVE_NO"].ToString(); this.statisticalControl2.Value.QualifiedNum = row2["QUALIFIED_NUM"].ToString(); this.statisticalControl2.Value.QualifiedWt = row2["QUALIFIED_WT"].ToString(); this.statisticalControl2.Value.Minutes = row2["MINUTES"].ToString(); this.statisticalControl2.Value.AbaMinutes = row2["ABSMINUTES"].ToString(); this.statisticalControl2.Value.SumMinutes = row2["SUMMINUTES"].ToString(); double feizi = double.Parse(row2["YOUMINUTES"].ToString()) - double.Parse(row2["SUMMINUTES"].ToString()); double feimu = double.Parse(row2["YOUMINUTES"].ToString()); if (feizi <= 0 || dt2168.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { effic2168 = "0"; } else { effic2168 = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl2.Value.Effic = effic2168 + "%"; this.statisticalControl2.UpdateData(); } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl2.Value = result; } #endregion #region 460机组 //查询当班生产实绩 DataTable dt460 = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryActual", new object[] { fistday, _bc, "C017" }, this.ob); if (dt460 != null && dt460.Rows.Count > 0) { //if (!dt460.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row = dt460.Rows[0]; this.statisticalControl12.Value.JudgeStoveNo = row["JUDGE_STOVE_NO"].ToString(); this.statisticalControl12.Value.QualifiedNum = row["QUALIFIED_NUM"].ToString(); this.statisticalControl12.Value.QualifiedWt = row["QUALIFIED_WT"].ToString(); this.statisticalControl12.Value.Minutes = row["MINUTES"].ToString(); this.statisticalControl12.Value.AbaMinutes = row["ABSMINUTES"].ToString(); this.statisticalControl12.Value.SumMinutes = row["SUMMINUTES"].ToString(); double feizi = double.Parse(row["YOUMINUTES"].ToString()) - double.Parse(row["SUMMINUTES"].ToString()); double feimu = double.Parse(row["YOUMINUTES"].ToString()); if (feizi <= 0 || dt460.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { effic460 = "0"; } else { effic460 = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl12.Value.Effic = effic460 + "%"; this.statisticalControl12.UpdateData(); } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl12.Value = result; } //查询当天生产实绩 DataTable dt1460 = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryDayActual", new object[] { fistday, "C017" }, this.ob); if (dt1460 != null && dt1460.Rows.Count > 0) { //if (!dt1460.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row1 = dt1460.Rows[0]; this.statisticalControl10.Value.JudgeStoveNo = row1["JUDGE_STOVE_NO"].ToString(); this.statisticalControl10.Value.QualifiedNum = row1["QUALIFIED_NUM"].ToString(); this.statisticalControl10.Value.QualifiedWt = row1["QUALIFIED_WT"].ToString(); this.statisticalControl10.Value.Minutes = row1["MINUTES"].ToString(); this.statisticalControl10.Value.AbaMinutes = row1["ABSMINUTES"].ToString(); this.statisticalControl10.Value.SumMinutes = row1["SUMMINUTES"].ToString(); double feizi = double.Parse(row1["YOUMINUTES"].ToString()) - double.Parse(row1["SUMMINUTES"].ToString()); double feimu = double.Parse(row1["YOUMINUTES"].ToString()); if (feizi <= 0 || dt1460.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { effic1460 = "0"; } else { effic1460 = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl10.Value.Effic = effic1460 + "%"; this.statisticalControl10.UpdateData(); } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl10.Value = result; } //查询当月生产实绩 DataTable dt2460 = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryMonthActual", new object[] { fistMonthD, "C017" }, this.ob); if (dt2460 != null && dt2460.Rows.Count > 0) { //if (!dt2460.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row2 = dt2460.Rows[0]; this.statisticalControl11.Value.JudgeStoveNo = row2["JUDGE_STOVE_NO"].ToString(); this.statisticalControl11.Value.QualifiedNum = row2["QUALIFIED_NUM"].ToString(); this.statisticalControl11.Value.QualifiedWt = row2["QUALIFIED_WT"].ToString(); this.statisticalControl11.Value.Minutes = row2["MINUTES"].ToString(); this.statisticalControl11.Value.AbaMinutes = row2["ABSMINUTES"].ToString(); this.statisticalControl11.Value.SumMinutes = row2["SUMMINUTES"].ToString(); double feizi = double.Parse(row2["YOUMINUTES"].ToString()) - double.Parse(row2["SUMMINUTES"].ToString()); double feimu = double.Parse(row2["YOUMINUTES"].ToString()); if (feizi <= 0 || dt2460.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { effic2460 = "0"; } else { effic2460 = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl11.Value.Effic = effic2460 + "%"; this.statisticalControl11.UpdateData(); } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl11.Value = result; } #endregion #region ASSEL机组 //查询当班生产实绩 DataTable dtas = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryActual", new object[] { fistday, _bc, "C072" }, this.ob); if (dtas != null && dtas.Rows.Count > 0) { //if (!dtas.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row = dtas.Rows[0]; this.statisticalControl15.Value.JudgeStoveNo = row["JUDGE_STOVE_NO"].ToString(); this.statisticalControl15.Value.QualifiedNum = row["QUALIFIED_NUM"].ToString(); this.statisticalControl15.Value.QualifiedWt = row["QUALIFIED_WT"].ToString(); this.statisticalControl15.Value.Minutes = row["MINUTES"].ToString(); this.statisticalControl15.Value.AbaMinutes = row["ABSMINUTES"].ToString(); this.statisticalControl15.Value.SumMinutes = row["SUMMINUTES"].ToString(); double feizi = double.Parse(row["YOUMINUTES"].ToString()) - double.Parse(row["SUMMINUTES"].ToString()); double feimu = double.Parse(row["YOUMINUTES"].ToString()); if (feizi <= 0 || dtas.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { efficAs = "0"; } else { efficAs = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl15.Value.Effic = efficAs + "%"; this.statisticalControl15.UpdateData(); } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl15.Value = result; } //查询当天生产实绩 DataTable dt1as = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryDayActual", new object[] { fistday, "C072" }, this.ob); if (dt1as != null && dt1as.Rows.Count > 0) { //if (!dt1as.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row1 = dt1as.Rows[0]; this.statisticalControl13.Value.JudgeStoveNo = row1["JUDGE_STOVE_NO"].ToString(); this.statisticalControl13.Value.QualifiedNum = row1["QUALIFIED_NUM"].ToString(); this.statisticalControl13.Value.QualifiedWt = row1["QUALIFIED_WT"].ToString(); this.statisticalControl13.Value.Minutes = row1["MINUTES"].ToString(); this.statisticalControl13.Value.AbaMinutes = row1["ABSMINUTES"].ToString(); this.statisticalControl13.Value.SumMinutes = row1["SUMMINUTES"].ToString(); double feizi = double.Parse(row1["YOUMINUTES"].ToString()) - double.Parse(row1["SUMMINUTES"].ToString()); double feimu = double.Parse(row1["YOUMINUTES"].ToString()); if (feizi <= 0 || dt1as.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { effic1As = "0"; } else { effic1As = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl13.Value.Effic = effic1As + "%"; this.statisticalControl13.UpdateData(); } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl13.Value = result; } //查询当月生产实绩 DataTable dt2as = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doQueryMonthActual", new object[] { fistMonthD, "C072" }, this.ob); if (dt2as != null && dt2as.Rows.Count > 0) { //if (!dt2as.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) //{ DataRow row2 = dt2as.Rows[0]; this.statisticalControl14.Value.JudgeStoveNo = row2["JUDGE_STOVE_NO"].ToString(); this.statisticalControl14.Value.QualifiedNum = row2["QUALIFIED_NUM"].ToString(); this.statisticalControl14.Value.QualifiedWt = row2["QUALIFIED_WT"].ToString(); this.statisticalControl14.Value.Minutes = row2["MINUTES"].ToString(); this.statisticalControl14.Value.AbaMinutes = row2["ABSMINUTES"].ToString(); this.statisticalControl14.Value.SumMinutes = row2["SUMMINUTES"].ToString(); double feizi = double.Parse(row2["YOUMINUTES"].ToString()) - double.Parse(row2["SUMMINUTES"].ToString()); double feimu = double.Parse(row2["YOUMINUTES"].ToString()); if (feizi <= 0 || dt2as.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0")) { effic2As = "0"; } else { effic2As = ((feizi / feimu) * 100).ToString("f2"); } this.statisticalControl14.Value.Effic = effic2As + "%"; this.statisticalControl14.UpdateData(); } else { StatisticalClass result = new StatisticalClass(); this.statisticalControl14.Value = result; } #endregion doMinutesQuery(); } /// /// 班报打印 /// private void doClassPint() { doOutlibrary(); //日 string fistday = ""; //string lastday = ""; fistday = dateDayTime.Value.ToString("yyyyMMdd"); //lastday = dateDayTime.Value.ToString("yyyyMMdd"); //if (_bc.Equals("3")) //{ // fistday = fistday + "18"; // lastday = lastday + "10"; //} //if (_bc.Equals("1")) //{ // fistday = lastday + "00"; // lastday = lastday + "18"; //} //if (_bc.Equals("2")) //{ // fistday = lastday + "12"; // lastday = lastday + "23"; //} string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepScheduClassAll.cpt&__bypagesize__=false&PROBC=" + _bc + "&p250=" + effic250 + "&startTim=" + fistday + "&p258=" + effic258 + "&p168=" + effic168 + "&p460=" + effic460 + "&pASSEL=" + efficAs + ""; FrmRepExcel fre = new FrmRepExcel(this.ob, url); fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fre.Text = "调度班报统计"; fre.ShowDialog(); } /// /// 日报打印 /// private void doDayPrint() { doOutlibrary(); //日 string fistday = ""; //string lastday = ""; fistday = dateDayTime.Value.ToString("yyyyMMdd"); //lastday = dateDayTime.Value.ToString("yyyyMMdd"); string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepScheduDayAll.cpt&__bypagesize__=false&startTim=" + fistday + "&p250=" + effic1250 + "&p258=" + effic1258 + "&p168=" + effic1168 + "&p460=" + effic1460 + "&pASSEL=" + effic1As + ""; FrmRepExcel fre = new FrmRepExcel(this.ob, url); fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fre.Text = "调度日报统计"; fre.ShowDialog(); } /// /// 月报打印 /// private void doMonthPrint() { doOutlibrary(); //月 string fistMonthD = ""; //string lastMonthD = ""; //DateTime t = DateTime.Parse(dateDayTime.Value.ToString()); //DateTime t1 = new DateTime(t.Year, t.Month, 1); //lastMonthD = DateTime.Parse(t.ToString("yyyy-MM-dd 21:06")).ToString("yyyyMMdd"); fistMonthD = dateDayTime.Value.ToString("yyyyMM"); string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepScheduMonthAll.cpt&__bypagesize__=false&startTim=" + fistMonthD + "&p250=" + effic2250 + "&p258=" + effic2258 + "&p168=" + effic2168 + "&p460=" + effic2460 + "&pASSEL=" + effic2As + ""; FrmRepExcel fre = new FrmRepExcel(this.ob, url); fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fre.Text = "调度月报统计"; fre.ShowDialog(); } private void doStopQuery(string date, string plinCode) { List listSource = EntityHelper.GetData ("com.steering.mes.signature.FrmMilControlLog.doStopQuery", new object[] { date, plinCode }, this.ob); MilControlLogEntity.DataSource = listSource; GridHelper.RefreshAndAutoSize(ultraGrid1); doAnalysis(); } private void doMinutesQuery() { string time = dateDayTime.Value.ToString("yyyyMM"); DataTable dt = ServerHelper.GetData("com.steering.mes.signature.FrmMilControlLog.doMinutesQuery", new object[] { time, days.ToString() }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true); //foreach (UltraGridColumn column in ultraGrid3.DisplayLayout.Bands[0].Columns) // column.Width = 50; foreach (UltraGridRow urg in ultraGrid3.Rows) { double MonthCount = 0; foreach (UltraGridColumn column in ultraGrid3.DisplayLayout.Bands[0].Columns) { column.Width = 50; column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly; column.CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right; if (column.Key.Contains("DAY")) { urg.Cells[column.Key].Value = (double.Parse(urg.Cells[column.Key].Value.ToString()) / 60).ToString("f2"); if (double.Parse(urg.Cells[column.Key].Value.ToString()) >= 4.0 && double.Parse(urg.Cells[column.Key].Value.ToString()) < 12.0) { urg.Cells[column.Key].Appearance.BackColor = Color.Yellow; } else if (double.Parse(urg.Cells[column.Key].Value.ToString()) >= 12.0 && double.Parse(urg.Cells[column.Key].Value.ToString()) < 24.0) { urg.Cells[column.Key].Appearance.BackColor = Color.Orange; } else if (double.Parse(urg.Cells[column.Key].Value.ToString()) >= 24.0) { urg.Cells[column.Key].Appearance.BackColor = Color.Red; } MonthCount += double.Parse(urg.Cells[column.Key].Value.ToString()); } } urg.Cells["Month"].Value = MonthCount; } } #region 168 /// /// 168 /// /// /// private void ultraButton1_Click(object sender, EventArgs e) { doStopQuery(dateDayTime.Value.ToString("yyyyMMdd"), "C010"); } private void ultraButton6_Click(object sender, EventArgs e) { FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C010", this.ob); pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); pro.Text = "生产详细"; pro.ShowDialog(); } #endregion #region 250 /// /// 250 /// /// /// private void ultraButton2_Click(object sender, EventArgs e) { doStopQuery(dateDayTime.Value.ToString("yyyyMMdd"), "C008"); } private void ultraButton7_Click(object sender, EventArgs e) { FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C008", this.ob); pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); pro.Text = "生产详细"; pro.ShowDialog(); } #endregion #region 258 /// /// 258 /// /// /// private void ultraButton3_Click(object sender, EventArgs e) { doStopQuery(dateDayTime.Value.ToString("yyyyMMdd"), "C009"); } private void ultraButton8_Click(object sender, EventArgs e) { FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C009", this.ob); pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); pro.Text = "生产详细"; pro.ShowDialog(); } #endregion #region 460 /// /// 460 /// /// /// private void ultraButton4_Click(object sender, EventArgs e) { doStopQuery(dateDayTime.Value.ToString("yyyyMMdd"), "C017"); } private void ultraButton9_Click(object sender, EventArgs e) { FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C017", this.ob); pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); pro.Text = "生产详细"; pro.ShowDialog(); } #endregion #region ASSEL /// /// ASSEL /// /// /// private void ultraButton5_Click(object sender, EventArgs e) { doStopQuery(dateDayTime.Value.ToString("yyyyMMdd2054"), "C072"); } private void ultraButton10_Click(object sender, EventArgs e) { FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C072", this.ob); pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); pro.Text = "生产详细"; pro.ShowDialog(); } #endregion /// ///停机时间差 /// private void doAnalysis() { foreach (UltraGridRow ugr in ultraGrid1.Rows) { string loagEnd = ugr.Cells["LogsEnd"].Value.ToString(); string loagBeg = ugr.Cells["LogsBeg"].Value.ToString(); TimeSpan timeSpan = DateTime.Parse(loagEnd) - DateTime.Parse(loagBeg); ugr.Cells["TimeDiff"].Value = timeSpan.TotalMinutes.ToString(); } } private string DateDiff(DateTime DateTime1, DateTime DateTime2) { string dateDiff = null; try { TimeSpan ts1 = new TimeSpan(DateTime1.Ticks); TimeSpan ts2 = new TimeSpan(DateTime2.Ticks); TimeSpan ts = ts1.Subtract(ts2).Duration(); dateDiff = ts.Minutes.ToString(); } catch { } return dateDiff; } } }