using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp.Mch.Entity; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using System; using System.Collections; 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.Mch.MchResult { public partial class FrmMchBale : FrmBase { private string[] plineCode = null; public FrmMchBale() { InitializeComponent(); } private void chkHeatNo2_CheckedChanged(object sender, EventArgs e) { this.txtHeatNo2.Enabled = this.chkHeatNo2.Checked; } private void chkOrderNo_CheckedChanged(object sender, EventArgs e) { this.txtOrderNo.Enabled = this.chkOrderNo.Checked; } private void FrmMchBale_Load(object sender, EventArgs e) { //DateTime now = DateTime.Now; //DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天 //DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天 //this.StartTime2.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00"); //this.EndTime2.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59"); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid2.DisplayLayout.Bands[0]); plineCode = comm.GetPlineCode(this.ValidDataPurviewIds, "G", this.CustomInfo, ob); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "DoQuery": QueryRtdMeasurePosdata(); break; case "updateBale": updateBale(); break; case "DoPrint": PrintResult(); break; case "Close": this.Close(); break; } } /// /// 查询 /// private void QueryRtdMeasurePosdata() { string orderNo = ""; string jugeNo = ""; string startTim = ""; string endTim = ""; if (this.chkHeatNo2.Checked && this.txtHeatNo2.Text.Trim() != "") { jugeNo = this.txtHeatNo2.Text.Trim(); } if (this.chkOrderNo.Checked && this.txtOrderNo.Text.Trim() != "") { orderNo = this.txtOrderNo.Text.Trim(); } if (chkTim2.Checked) { if (DateTime.Parse(StartTime2.Value.ToString()) > DateTime.Parse(EndTime2.Value.ToString())) { MessageUtil.ShowTips("选择的前面时间不能大于后面的时间!"); return; } else { startTim = this.StartTime2.Value.ToString("yyyy-MM-dd HH:mm:ss"); endTim = this.EndTime2.Value.ToString("yyyy-MM-dd HH:mm:ss"); } } List listSource = EntityHelper.GetData( "com.steering.mes.mcp.Mch.FrmMeasureResult.QueryZgJugdeApply", new object[] { jugeNo, startTim, endTim, orderNo, plineCode }, this.ob); bindingSource1.DataSource = listSource; GridHelper.RefreshAndAutoSize(ultraGrid1); } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { UltraGridRow uRow = this.ultraGrid1.ActiveRow; List listSource = EntityHelper.GetData( "com.steering.mes.mcp.Mch.FrmMeasureResult.QueryBaleRecord", new object[] { uRow.Cells["JudgeStoveNo"].Value.ToString(), uRow.Cells["BatchNo"].Value.ToString(), uRow.Cells["PlineCode"].Value.ToString(), uRow.Cells["ProOrderNo"].Value.ToString() }, this.ob); bindingSource2.DataSource = listSource; } /// /// 打捆 /// private void updateBale() { this.ultraGrid1.UpdateData(); this.ultraGrid2.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("请选择需要调整的炉信息!"); return; } ArrayList listAll = new ArrayList(); if (ultraGrid2.Rows.Count > 0) { foreach (UltraGridRow ugr in ultraGrid2.Rows) { if (Double.Parse(ugr.Cells["BaleNo"].Value.ToString3()) < 0) { MessageUtil.ShowTips("请输入正确的数字!"); return; } ArrayList list = new ArrayList(); list.Add(ugr.Cells["BaleNo"].Value.ToString()); list.Add(ugr.Cells["KeyId"].Value.ToString()); listAll.Add(list); } } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMeasureResult"; ccp.MethodName = "updateBale"; ccp.ServerParams = new object[] { listAll }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("打捆成功!")) { QueryRtdMeasurePosdata(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 打捆标签 /// private void PrintResult() { this.ultraGrid2.UpdateData(); UltraGridRow uRow = this.ultraGrid2.ActiveRow; String JudgeStoveNo = uRow.Cells["JudgeStoveNo"].Value.ToString(); String BatchNo = uRow.Cells["BatchNo"].Value.ToString(); String PlineCode = uRow.Cells["PlineCode"].Value.ToString(); String ProOrderNo = uRow.Cells["ProOrderNo"].Value.ToString(); String BaleNo = uRow.Cells["BaleNo"].Value.ToString(); string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMchBale.cpt&JUDGE_STOVE_NO=" + JudgeStoveNo + "&BATCH_NO=" + BatchNo + "&PLINE_CODE=" + PlineCode + "&PRO_ORDER_NO=" + ProOrderNo + "&BALE_NO=" + BaleNo; FrmRepExcel fre = new FrmRepExcel(ob, strurl); fre.AutoSize = true; fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fre.WindowState = FormWindowState.Maximized; fre.Show(); } } }