using Core.Mes.Client.Comm.Control;
using Core.Mes.Client.Comm.Server;
using Core.Mes.Client.Comm.Tool;
using Core.StlMes.Client.Mcp.Control.Base;
using Core.StlMes.Client.Mcp.VRP.Entity;
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.Mcp.VRP.Report
{
public partial class FrmStatisticalPub : FrmBase
{
private string _bc = "";
private int days = 0;
///
/// 720线
///
private string effic720 = "";
private string effic1720 = "";
private string effic2720 = "";
///
/// 冷轧
///
private string efficlz = "";
private string effic1lz = "";
private string effic2lz = "";
///
/// 冷拔
///
private string efficlb = "";
private string effic1lb = "";
private string effic2lb = "";
///
/// 镦粗
///
private string efficdc = "";
private string effic1dc = "";
private string effic2dc = "";
private string efficrk = "";
private string effic1rk = "";
private string effic2rk = "";
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)
{
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 720旋扩
//查询当班生产实绩
DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryActual", new object[] { fistday, _bc, "C018" }, 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"))
{
effic720 = "0";
}
else
{
effic720 = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl6.Value.Effic = effic720 + "%";
this.statisticalControl6.UpdateData();
}
else
{
StatisticalClass result = new StatisticalClass();
this.statisticalControl6.Value = result;
}
//查询当天生产实绩
DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryDayActual",
new object[] { fistday, "C018" }, 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"))
{
effic1720 = "0";
}
else
{
effic1720 = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl4.Value.Effic = effic1720 + "%";
this.statisticalControl4.UpdateData();
}
else
{
StatisticalClass result = new StatisticalClass();
this.statisticalControl4.Value = result;
}
//查询当月生产实绩
DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryMonthActual", new object[] { fistMonthD, "C018" }, 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"))
{
effic2720 = "0";
}
else
{
effic2720 = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl5.Value.Effic = effic2720 + "%";
this.statisticalControl5.UpdateData();
}
else
{
StatisticalClass result = new StatisticalClass();
this.statisticalControl5.Value = result;
}
#endregion
#region 冷轧机组
//查询当班生产实绩
DataTable dtlz = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryActual", new object[] { fistday, _bc, "C013" }, this.ob);
if (dtlz != null && dtlz.Rows.Count > 0)
{
//if (!dtlz.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
//{
DataRow row = dtlz.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"))
{
efficlz = "0";
}
else
{
efficlz = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl9.Value.Effic = efficlz + "%";
this.statisticalControl9.UpdateData();
}
else
{
StatisticalClass result = new StatisticalClass();
this.statisticalControl9.Value = result;
}
//查询当天生产实绩
DataTable dt1lz = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryDayActual",
new object[] { fistday, "C013" }, this.ob);
if (dt1lz != null && dt1lz.Rows.Count > 0)
{
//if (!dt1lz.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
//{
DataRow row1 = dt1lz.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 || dt1lz.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
{
effic1lz = "0";
}
else
{
effic1lz = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl7.Value.Effic = effic1lz + "%";
this.statisticalControl7.UpdateData();
//}
//else
//{
// StatisticalClass result = new StatisticalClass();
// this.statisticalControl7.Value = result;
//}
}
else
{
StatisticalClass result = new StatisticalClass();
this.statisticalControl7.Value = result;
}
//查询当月生产实绩
DataTable dt2lz = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryMonthActual", new object[] { fistMonthD, "C013" }, this.ob);
if (dt2lz != null && dt2lz.Rows.Count > 0)
{
//if (!dt2lz.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
//{
DataRow row2 = dt2lz.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 || dt2lz.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
{
effic2lz = "0";
}
else
{
effic2lz = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl8.Value.Effic = effic2lz + "%";
this.statisticalControl8.UpdateData();
}
else
{
StatisticalClass result = new StatisticalClass();
this.statisticalControl8.Value = result;
}
#endregion
#region 冷拔机组
//查询当班生产实绩
DataTable dtlb = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryActual", new object[] { fistday, _bc, "C014" }, this.ob);
if (dtlb != null && dtlb.Rows.Count > 0)
{
//if (!dtlb.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
//{
DataRow row = dtlb.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 || dtlb.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
{
efficlb = "0";
}
else
{
efficlb = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl1.Value.Effic = efficlb + "%";
this.statisticalControl1.UpdateData();
}
else
{
StatisticalClass result = new StatisticalClass();
this.statisticalControl1.Value = result;
}
//查询当天生产实绩
DataTable dt1lb = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryDayActual",
new object[] { fistday, "C014" }, this.ob);
if (dt1lb != null && dt1lb.Rows.Count > 0)
{
//if (!dt1lb.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
//{
DataRow row1 = dt1lb.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 || dt1lb.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
{
effic1lb = "0";
}
else
{
effic1lb = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl3.Value.Effic = effic1lb + "%";
this.statisticalControl3.UpdateData();
}
else
{
StatisticalClass result = new StatisticalClass();
this.statisticalControl3.Value = result;
}
//查询当月生产实绩
DataTable dt2lb = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryMonthActual", new object[] { fistMonthD, "C014" }, this.ob);
if (dt2lb != null && dt2lb.Rows.Count > 0)
{
//if (!dt2lb.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
//{
DataRow row2 = dt2lb.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 || dt2lb.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
{
effic2lb = "0";
}
else
{
effic2lb = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl2.Value.Effic = effic2lb + "%";
this.statisticalControl2.UpdateData();
}
else
{
StatisticalClass result = new StatisticalClass();
this.statisticalControl2.Value = result;
}
#endregion
#region 镦粗
//查询当班生产实绩
DataTable dtdc = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryActual", new object[] { fistday, _bc, "C021" }, this.ob);
if (dtdc != null && dtdc.Rows.Count > 0)
{
//if (!dtdc.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
//{
DataRow row = dtdc.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 || dtdc.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
{
efficdc = "0";
}
else
{
efficdc = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl12.Value.Effic = efficdc + "%";
this.statisticalControl12.UpdateData();
}
else
{
StatisticalClass result = new StatisticalClass();
this.statisticalControl12.Value = result;
}
//查询当天生产实绩
DataTable dt1dc = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryDayActual",
new object[] { fistday, "C021" }, this.ob);
if (dt1dc != null && dt1dc.Rows.Count > 0)
{
//if (!dt1dc.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
//{
DataRow row1 = dt1dc.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 || dt1dc.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
{
effic1dc = "0";
}
else
{
effic1dc = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl10.Value.Effic = effic1dc + "%";
this.statisticalControl10.UpdateData();
}
else
{
StatisticalClass result = new StatisticalClass();
this.statisticalControl10.Value = result;
}
//查询当月生产实绩
DataTable dt2dc = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryMonthActual", new object[] { fistMonthD, "C021" }, this.ob);
if (dt2dc != null && dt2dc.Rows.Count > 0)
{
//if (!dt2dc.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
//{
DataRow row2 = dt2dc.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 || dt2dc.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
{
effic2dc = "0";
}
else
{
effic2dc = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl11.Value.Effic = effic2dc + "%";
this.statisticalControl11.UpdateData();
}
else
{
StatisticalClass result = new StatisticalClass();
this.statisticalControl11.Value = result;
}
#endregion
#region 热扩
//查询当班生产实绩
DataTable dtrk = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryActual", new object[] { fistday, _bc, "C070" }, this.ob);
if (dtrk != null && dtrk.Rows.Count > 0)
{
//if (!dtrk.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
//{
DataRow row = dtrk.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 || dtrk.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
{
efficrk = "0";
}
else
{
efficrk = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl15.Value.Effic = efficrk + "%";
this.statisticalControl15.UpdateData();
}
else
{
StatisticalClass result = new StatisticalClass();
this.statisticalControl15.Value = result;
}
//查询当天生产实绩
DataTable dt1rk = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryDayActual",
new object[] { fistday, "C070" }, this.ob);
if (dt1rk != null && dt1rk.Rows.Count > 0)
{
//if (!dt1rk.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
//{
DataRow row1 = dt1rk.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 || dt1rk.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
{
effic1rk = "0";
}
else
{
effic1rk = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl13.Value.Effic = effic1rk + "%";
this.statisticalControl13.UpdateData();
}
else
{
StatisticalClass result = new StatisticalClass();
this.statisticalControl13.Value = result;
}
//查询当月生产实绩
DataTable dt2rk = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryMonthActual", new object[] { fistMonthD, "C070" }, this.ob);
if (dt2rk != null && dt2rk.Rows.Count > 0)
{
//if (!dt2rk.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
//{
DataRow row2 = dt2rk.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 || dt2rk.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
{
effic2rk = "0";
}
else
{
effic2rk = ((feizi / feimu) * 100).ToString("f2");
}
this.statisticalControl14.Value.Effic = effic2rk + "%";
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=RepVRPScheduClassAll.cpt&__bypagesize__=false&PROBC=" + _bc
+ "&startTim=" + fistday
+ "&C018=" + effic720
+ "&C013=" + efficlz
+ "&C014=" + efficlb
+ "&C021=" + efficdc
+ "&C070=" + efficrk
+ "";
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=RepVRPScheduDayAll.cpt&__bypagesize__=false&startTim=" + fistday
+ "&C018=" + effic1720
+ "&C013=" + effic1lz
+ "&C014=" + effic1lb
+ "&C021=" + effic1dc
+ "&C070=" + effic1rk
+ "";
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 lrktMonthD = "";
//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
+ "&C018=" + effic2720
+ "&C013=" + effic2lz
+ "&C014=" + effic2lb
+ "&C021=" + effic2dc
+ "&C070=" + effic2rk
+ "";
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)
{
DataTable dt=ServerHelper.GetData
("com.steering.mes.mcp.Report.FrmVrpControlLog.doStopQuery", new object[] { date, plinCode }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
doAnalysis();
}
private void doMinutesQuery()
{
string time = dateDayTime.Value.ToString("yyyyMM");
DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.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 冷拔
///
/// 冷拔
///
///
///
private void ultraButton1_Click(object sender, EventArgs e)
{
doStopQuery(dateDayTime.Value.ToString("yyyyMMdd"), "C014");
}
private void ultraButton6_Click(object sender, EventArgs e)
{
FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C014", this.ob);
pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
pro.Text = "生产详细";
pro.ShowDialog();
}
#endregion
#region 720
///
/// 720
///
///
///
private void ultraButton2_Click(object sender, EventArgs e)
{
doStopQuery(dateDayTime.Value.ToString("yyyyMMdd"), "C018");
}
private void ultraButton7_Click(object sender, EventArgs e)
{
FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C018", this.ob);
pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
pro.Text = "生产详细";
pro.ShowDialog();
}
#endregion
#region 冷轧
///
/// lz
///
///
///
private void ultraButton3_Click(object sender, EventArgs e)
{
doStopQuery(dateDayTime.Value.ToString("yyyyMMdd"), "C013");
}
private void ultraButton8_Click(object sender, EventArgs e)
{
FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C013", this.ob);
pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
pro.Text = "生产详细";
pro.ShowDialog();
}
#endregion
#region 镦粗
///
/// dc
///
///
///
private void ultraButton4_Click(object sender, EventArgs e)
{
doStopQuery(dateDayTime.Value.ToString("yyyyMMdd"), "C021");
}
private void ultraButton9_Click(object sender, EventArgs e)
{
FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C021", this.ob);
pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
pro.Text = "生产详细";
pro.ShowDialog();
}
#endregion
#region 热扩
///
///热扩
///
///
///
private void ultraButton5_Click(object sender, EventArgs e)
{
doStopQuery(dateDayTime.Value.ToString("yyyyMMdd2054"), "C070");
}
private void ultraButton10_Click(object sender, EventArgs e)
{
FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C070", 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["LOGS_END"].Value.ToString();
string loagBeg = ugr.Cells["LOGS_BEG"].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;
}
}
}