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; using CoreFS.CA06; using System.Collections; using Infragistics.Win.UltraWinGrid; namespace Core.LZMes.Client.UIK { public partial class UIK050030 : FrmBase { public UIK050030() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query"://查询 this.DoQuery(); break; case "Insert"://添加换下轧辊实绩 this.DoInsert(); break; case "Update"://下发换下轧辊实绩 this.DoUpdate(); break; } } private void DoQuery() { try { string zgNum = ""; string beginTime = ""; string endTime = ""; bool flag = false; CoreClientParam ccp = new CoreClientParam(); CoreClientParam ccp2 = new CoreClientParam(); DataTable dt = new DataTable(); DataTable dt2 = new DataTable(); //if (this.ultraTextzgNum.Text == "" && this.ultraCheckEditor1.Checked == false) //{ // MessageBox.Show("请选择查询条件!"); //} //else //{ if (this.ultraCheckEditor1.Checked) { this.ultraTextzgNum.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK05.UIK050030"; ccp.MethodName = "DoQueryShang"; ccp.ServerParams = new object[] { zgNum, flag ,beginTime,endTime}; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; //ccp2.ServerName = "UIK.UIK05.UIK050030"; //ccp2.MethodName = "DoQueryXia"; //ccp2.ServerParams = new object[] { zgNum, flag,beginTime,endTime }; //ccp2.SourceDataTable = dt2; //this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal); //this.ultraGrid2.DataSource = dt2; if (dt.Rows.Count <= 0) { MessageBox.Show("暂无记录!"); } return; } else { flag = true; zgNum = this.ultraTextzgNum.Text; beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : ""; endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : ""; this.ultraTextzgNum.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK05.UIK050030"; //ccp.MethodName = "DoQueryShang"; if (zgNum != "") { ccp.MethodName = "DoQueryShang"; } else { ccp.MethodName = "DoQueryShang1"; } ccp.ServerParams = new object[] { zgNum, flag, beginTime, endTime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; if (dt.Rows.Count <= 0) { MessageBox.Show("该换辊计划号,请查证后查询!"); } return; } } // } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e) { try { if (this.ultraCheckEditor1.Checked) { this.ultraTextzgNum.Enabled = false; } if (!this.ultraCheckEditor1.Checked) { this.ultraTextzgNum.Enabled = true; } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } private void DoInsert() { try { if (this.ultraTextStand_id.Text == "") { MessageBox.Show("机架号必须填写!"); } else { // string spec_No = this.ultraTextSpec_no.Text; string sand_Id = this.ultraTextStand_id.Text; //机架编号 string roll_Type = this.ultraComboType.Text;//轧辊类型 string roll_Area = this.ultraComboArea.Text; //轧辊区域 string roll_Id_up = this.ultraTextShangID.Text;//上编号 string roll_Id_lo = this.ultraTextXiaBian.Text;//下编号 //string reg_id = this.ultraTextReg_id.Text; string z_time = System.DateTime.Now.ToString();//时间 //string z_time = DateTime.Now.ToString(); string reason = this.ultraComboEditor1.SelectedIndex.ToString();//原因 string s_chang = this.ultraTextEditor1.Text;//轧制长度 string s_liang = this.ultraTextEditor2.Text;//轧制量 string create_time = this.ultraCalendarDis_time.Text.ToString(); System.DateTime dtt = System.DateTime.Now; string spec_No = (string.Format("{0:yyyyMMddHHmmss}", dtt)).Substring(8,6); string number = spec_No; DataTable dt = new DataTable(); CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "UIK.UIK05.UIK050030"; ccp2.MethodName = "DoSelect"; ccp2.ServerParams = new object[] { create_time }; ccp2.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal); if (dt.Rows.Count > 0) { MessageBox.Show("该换辊计划号已存在,请查证后填写!"); this.ultraTextStand_id.Clear(); this.ultraComboType.Clear(); this.ultraComboArea.Clear(); this.ultraTextShangID.Clear(); this.ultraTextXiaBian.Clear(); //this.ultraTextReg_id.Clear(); this.ultraComboEditor1.Clear(); this.ultraTextEditor2.Clear(); this.ultraTextEditor1.Clear(); } else { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIK.UIK05.UIK050030"; ccp.MethodName = "PlanAdd"; ccp.ServerParams = new object[] { spec_No, sand_Id, roll_Type, roll_Area, roll_Id_up, roll_Id_lo, z_time, reason, s_chang, s_liang,create_time }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); //if (0 != ccp.ReturnCode) return; if (0 != ccp.ReturnCode) { MessageBox.Show("添加失败"); } else { MessageBox.Show("添加成功"); this.ultraTextStand_id.Clear(); this.ultraComboType.Clear(); this.ultraComboArea.Clear(); this.ultraTextShangID.Clear(); this.ultraTextXiaBian.Clear(); this.ultraComboEditor1.Clear(); this.ultraTextEditor2.Clear(); this.ultraTextEditor1.Clear(); } } } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } private void DoUpdate1() { try { //Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["SELECT_ITME"].Text.ToString() == "True") { //foreach (UltraGridRow ugr in this.ultraGrid1.Rows) //{ string number = ugr.Cells["SPEC_NO"].Value.ToString(); string create_time = ugr.Cells["REG_DTIME"].Value.ToString(); string reason = ugr.Cells["REASON_CODE"].Text.Trim().ToString(); // string roll_weight=ugr CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "UIK.UIK05.UIK050030"; ccp2.MethodName = "DoUpdate"; //ccp2.ServerParams = new object[] { spec_No, sand_Id, roll_Type, roll_Area, roll_Id_up, roll_Id_lo, z_time, reason, banci, banbie, s_chang, s_liang, s_shi, x_chang, x_liang, x_shi, create_time, uid }; ccp2.ServerParams = new object[] { reason,number, create_time }; ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal); if (0 != ccp2.ReturnCode) { MessageBox.Show("保存失败!"); } else { MessageBox.Show("保存成功!"); } // } //} } else { continue; } } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } private void UIK050030_Load(object sender, EventArgs e) { this.ultraCalendarDis_time1.Text = ""; } private void ultraGrid1_DoubleClickRow(object sender, DoubleClickRowEventArgs e) { Infragistics.Win.UltraWinGrid.UltraGrid uGrid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender; ultraTextStand_id.Text = uGrid.ActiveRow.Cells["STAND_ID"].Text; ultraComboType.Text = uGrid.ActiveRow.Cells["ROLL_TYPE"].Text; ultraTextShangID.Text = uGrid.ActiveRow.Cells["ROLLID_UP"].Text; ultraTextEditor2.Text = uGrid.ActiveRow.Cells["ROLLED_WEIGHT_UP"].Text; ultraComboEditor1.Text = uGrid.ActiveRow.Cells["REASON_CODE"].Text; ultraTextXiaBian.Text = uGrid.ActiveRow.Cells["ROLLID_LO"].Text; ultraTextEditor1.Text = uGrid.ActiveRow.Cells["ROLLED_LENGTH_UP"].Text; ultraTextReg_id.Text = uGrid.ActiveRow.Cells["SPEC_NO"].Text; ultraCalendarDis_time.Text = uGrid.ActiveRow.Cells["REG_DTIME"].Text; } private void DoUpdate() { try { string number = this.ultraTextReg_id.Text.Trim(); string iddown = this.ultraTextXiaBian.Text.Trim(); string idup = this.ultraTextShangID.Text.Trim(); string reason = this.ultraComboEditor1.Text.Trim(); string zhazhiliang = this.ultraTextEditor2.Text.Trim(); string zhazhicd= this.ultraTextEditor1.Text.Trim(); string timexg = this.ultraCalendarDis_time.Text.Trim(); string namerg = this.UserInfo.GetUserName(); CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "UIK.UIK05.UIK050030"; ccp2.MethodName = "DoUpdate"; //ccp2.ServerParams = new object[] { spec_No, sand_Id, roll_Type, roll_Area, roll_Id_up, roll_Id_lo, z_time, reason, banci, banbie, s_chang, s_liang, s_shi, x_chang, x_liang, x_shi, create_time, uid }; ccp2.ServerParams = new object[] { reason, zhazhiliang, zhazhicd, timexg,number, iddown, idup,namerg }; ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal); if (0 != ccp2.ReturnCode) { MessageBox.Show("保存失败!"); } else { MessageBox.Show("保存成功!"); } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } } }