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; namespace Core.LZMes.Client.UIK { public partial class UIK050050 : FrmBase { public UIK050050() { InitializeComponent(); } private void UIK050050_Load(object sender, EventArgs e) { this.ultraCalendarZ_time.Text = ""; } 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 zgAr = ""; 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.zgNum.Text == "" && this.zgArea.Text == "" && this.ultraCheckEditor1.Checked == false) //{ // MessageBox.Show("请选择查询条件!"); //} //else //{ if (this.ultraCheckEditor1.Checked) { this.zgArea.Clear(); this.zgNum.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK05.UIK050050"; ccp.MethodName = "DoQueryShang"; ccp.ServerParams = new object[] { zgNum, zgAr, flag ,beginTime,endTime}; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; ccp2.ServerName = "UIK.UIK05.UIK050050"; ccp2.MethodName = "DoQueryXia"; ccp2.ServerParams = new object[] { zgNum, zgAr, 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; if (this.zgArea.Text == "" || this.zgNum.Text == "") { if (this.zgNum.Text == "") { zgAr = this.zgArea.Text; beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : ""; endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : ""; this.zgArea.Clear(); this.zgNum.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK05.UIK050050"; ccp.MethodName = "DoQueryShang"; ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; ccp2.ServerName = "UIK.UIK05.UIK050050"; ccp2.MethodName = "DoQueryXia"; ccp2.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime }; ccp2.SourceDataTable = dt2; this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal); this.ultraGrid2.DataSource = dt2; if (dt.Rows.Count <= 0) { MessageBox.Show("该区域的记录不存在!"); } return; } if (this.zgArea.Text == "") { zgNum = this.zgNum.Text; beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : ""; endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : ""; this.zgArea.Clear(); this.zgNum.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK05.UIK050050"; ccp.MethodName = "DoQueryShang"; ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; ccp2.ServerName = "UIK.UIK05.UIK050050"; ccp2.MethodName = "DoQueryXia"; ccp2.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime }; ccp2.SourceDataTable = dt2; this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal); this.ultraGrid2.DataSource = dt2; if (dt.Rows.Count <= 0) { MessageBox.Show("该换辊计划号记录不存在,请查证后查询!"); } return; } } if (this.zgArea.Text == "" && this.zgNum.Text == "") { beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : ""; endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : ""; this.zgArea.Clear(); this.zgNum.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK05.UIK050050"; ccp.MethodName = "DoQueryShang"; ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; ccp2.ServerName = "UIK.UIK05.UIK050050"; ccp2.MethodName = "DoQueryXia"; ccp2.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime }; ccp2.SourceDataTable = dt2; this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal); this.ultraGrid2.DataSource = dt2; if (dt.Rows.Count <= 0) { MessageBox.Show("该区域的记录不存在!"); } return; } else { zgNum = this.zgNum.Text; zgAr = this.zgArea.Text; beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : ""; endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : ""; this.zgArea.Clear(); this.zgNum.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK05.UIK050050"; ccp.MethodName = "DoQueryShang"; ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; ccp2.ServerName = "UIK.UIK05.UIK050050"; ccp2.MethodName = "DoQueryXia"; ccp2.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime }; ccp2.SourceDataTable = dt2; this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal); this.ultraGrid2.DataSource = dt2; 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.zgNum.Enabled = false; this.zgArea.Enabled = false; } if (!this.ultraCheckEditor1.Checked) { this.zgNum.Enabled = true; this.zgArea.Enabled = true; } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } private void DoInsert() { try { if (this.ultraTextStand_id.Text == "" || this.ultraTextReg_id.Text == "") { MessageBox.Show("机架编号和操作人必须填写!"); } else { string sand_id = this.ultraTextStand_id.Text; string roll_Type = this.ultraComboType.Text; string roll_Area = this.ultraComboArea.Text; string reason = this.ultraTextReason.Text; string z_time = this.ultraCalendarZ_time.Text.ToString(); string banci = this.ultraComboBanci.Text; string banbie = this.ultraComboBanbie.Text; string shang_id = this.ultraTextShang_id.Text; string xia_id = this.ultraTextXia_id.Text; string reg_id = this.ultraTextReg_id.Text; string reg_dtime = System.DateTime.Now.ToString(); System.DateTime dtt = System.DateTime.Now; string spec_No = (string.Format("{0:yyyyMMddHHmmss}", dtt)).Substring(8, 6); DataTable dt = new DataTable(); CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "UIK.UIK05.UIK050050"; ccp2.MethodName = "DoSelect"; ccp2.ServerParams = new object[] { reg_dtime }; 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.ultraTextReason.Clear(); this.ultraComboBanci.Clear(); this.ultraComboBanbie.Clear(); this.ultraTextShang_id.Clear(); this.ultraTextXia_id.Clear(); this.ultraTextReg_id.Clear(); this.ultraCalendarZ_time.Text = ""; } else { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIK.UIK05.UIK050050"; ccp.MethodName = "PlanAdd"; ccp.ServerParams = new object[] { spec_No, sand_id, roll_Type, roll_Area, reason,z_time, banci, banbie,shang_id, xia_id, reg_id, reg_dtime }; 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.ultraTextReason.Clear(); this.ultraComboBanci.Clear(); this.ultraComboBanbie.Clear(); this.ultraTextShang_id.Clear(); this.ultraTextXia_id.Clear(); this.ultraTextReg_id.Clear(); this.ultraCalendarZ_time.Text = ""; } } } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } private void DoUpdate() { try { Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr.Cells["SELECT_ITEM"].Text.ToString() == "True") { if (ugr.Cells["MEG_FLAG"].Value.ToString() == "是") { MessageBox.Show("该计划已下发!"); ugr.Cells["SELECT_ITME"].Value = false; } else { string spec_No, sand_Id, roll_Type, roll_Area, roll_Id_up, roll_Id_lo, z_time, reason, banci, banbie,create_time; string uid = "Core.LZMes.Client.UIK.UIK050050"; string reg_dtime = ugr.Cells["REG_DTIME"].Value.ToString(); DataTable dt = new DataTable(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIK.UIK05.UIK050050"; ccp.MethodName = "DoSelect"; ccp.ServerParams = new object[] { reg_dtime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); foreach (DataRow dr in dt.Rows) { spec_No = dr["SPEC_NO"].ToString(); sand_Id = dr["STAND_ID"].ToString(); roll_Type = dr["ROLL_TYPE"].ToString(); roll_Area = dr["ROLL_AREA"].ToString(); roll_Id_up = dr["ROLLID_UP"].ToString(); roll_Id_lo = dr["ROLLID_LO"].ToString(); z_time = dr["MOUNT_TIME"].ToString(); reason = dr["REASON_CODE"].ToString(); banci = dr["SHIFT"].ToString(); banbie = dr["CREW"].ToString(); create_time = dr["REG_DTIME"].ToString(); CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "UIK.UIK05.UIK050050"; ccp2.MethodName = "DoSend"; ccp2.ServerParams = new object[] { spec_No, sand_Id, roll_Type, roll_Area, roll_Id_up, roll_Id_lo, z_time, reason, banci, banbie, create_time, uid }; ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal); if (0 != ccp2.ReturnCode) { MessageBox.Show("下发失败!"); } else { MessageBox.Show("下发成功!"); CoreClientParam ccp3 = new CoreClientParam(); ccp3.ServerName = "UIK.UIK05.UIK050050"; ccp3.MethodName = "DoUpdate"; ccp3.ServerParams = new object[] { reg_dtime }; ccp3 = this.ExecuteNonQuery(ccp3, CoreInvokeType.Internal); if (0 != ccp3.ReturnCode) { MessageBox.Show("下发计划修改失败!"); } else { MessageBox.Show("下发计划已修改成功!"); } } } } } else { MessageBox.Show("请选择下发行!"); } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } private void ultraDateTimeEditor2_ValueChanged(object sender, EventArgs e) { } } }