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 Infragistics.Win.UltraWinGrid; namespace Core.LZMes.Client.UIM.UIM02 { public partial class UIM020050 : FrmBase { private string yardAddr = "";//上料钢卷垛位 private string l_coilNo = "";//冷轧卷号 private int coil_no_index = -1;//冷轧卷在轧制计划的下标位置 public UIM020050() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Save": this.DoSave(); break; case "Exit": this.Close(); break; case "Export": this.DoExport(); break; } } /// /// 查询重卷作业计划 /// private void DoQuery() { this.dataSet1.Tables[0].Clear(); this.dataSet1.Tables["Table2"].Clear(); string COILNO = this.textBox3.Text.Trim().ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM02.UIM020050"; ccp.MethodName = "queryReelPlan"; ccp.ServerParams = new object[] { COILNO }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); DataRowCollection drs = dataSet1.Tables[0].Rows; for (int i = 0; i < drs.Count; i++) { if (drs[i]["STATUS_CD"].ToString().Equals("上鞍座")) { ultraGrid1.Rows[i].Appearance.BackColor = Color.FromArgb(192, 255, 192); } else if (drs[i]["STATUS_CD"].ToString().Equals("吊销钢卷")) { ultraGrid1.Rows[i].Appearance.BackColor = Color.Red; } else if (drs[i]["STATUS_CD"].ToString().Equals("焊接")) { ultraGrid1.Rows[i].Appearance.BackColor = Color.SpringGreen; } else if (drs[i]["STATUS_CD"].ToString().Equals("生产完成")) { ultraGrid1.Rows[i].Appearance.BackColor = Color.Green; } if (drs[i]["EXTSHAPE_DEC_GRD"].ToString().Equals("FA") || drs[i]["EXTSHAPE_DEC_GRD"].ToString() == "") { ultraGrid1.Rows[i].Appearance.BackColor = Color.Yellow; } } CoreClientParam ccpc= new CoreClientParam(); ccpc.ServerName = "UIM.UIM02.UIM020050"; ccpc.MethodName = "queryAddClassInf"; ccpc.SourceDataTable = this.dataSet1.Tables["Table2"]; this.ExecuteQueryToDataTable(ccpc, CoreInvokeType.Internal); this.textBox3.Clear(); } /// /// 重卷上料操作 /// private void DoSave() { if (null == this.ultraDateTimeEditor1.Value) { MessageBox.Show("上料时间为空,请选择相应的上料时间后再进行上料操作!"); return; } string coilNo = this.textBox1.Text.Trim(); if ("".Equals(coilNo)) { MessageBox.Show("上料钢卷为空,请选择相应的原料卷后再进行上料操作!"); return; } if (string.IsNullOrEmpty(l_coilNo)) { MessageBox.Show("重卷计划还未下发,不能进行上料操作!"); return; } CoreClientParam ccp = new CoreClientParam(); System.Data.DataTable dt = new System.Data.DataTable(); ccp.ServerName = "UIM.UIM02.UIM020050"; ccp.MethodName = "isReceivedL2"; ccp.ServerParams = new object[] { coilNo }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); if (dt.Rows.Count <= 0) { CoreClientParam ccp1 = new CoreClientParam(); ccp1.ServerName = "UIM.UIM02.UIM020050"; ccp1.MethodName = "hasCoilOnYardAddr"; ccp1.ServerParams = new Object[] { yardAddr }; ccp1 = this.ExecuteQuery(ccp1, CoreInvokeType.Internal); int count = int.Parse(ccp1.ReturnObject.ToString()); if (count > 0 && DialogResult.No == MessageBox.Show("选择的钢卷堆放位置上方有其他钢卷,是否继续上料?", "提示", MessageBoxButtons.YesNo)) { return; } string trnfRegId = this.UserInfo.GetUserID(); string trnfShift = this.UserInfo.GetUserOrder(); string trnfGroup = this.UserInfo.GetUserGroup(); string trnfDTime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd"); CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "UIM.UIM02.UIM020050"; ccp2.MethodName = "outStockByReel"; ccp2.ServerParams = new Object[] { coilNo, l_coilNo, "T", trnfRegId, trnfShift, trnfGroup, trnfDTime }; this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal); if (0 != ccp2.ReturnCode) { MessageBox.Show("上料失败"); return; } else { MessageBox.Show("上料成功"); } } else { string trnfRegId = this.UserInfo.GetUserID(); string trnfShift = this.UserInfo.GetUserOrder(); string trnfGroup = this.UserInfo.GetUserGroup(); string trnfDTime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd"); CoreClientParam ccp3 = new CoreClientParam(); System.Data.DataTable dt1 = new System.Data.DataTable(); ccp3.ServerName = "UIM.UIM02.UIM020050"; ccp3.MethodName = "insertInformation"; ccp3.ServerParams = new object[] { trnfRegId, trnfShift, trnfGroup, trnfDTime, coilNo }; this.ExecuteNonQuery(ccp3, CoreInvokeType.Internal); if (0 != ccp3.ReturnCode) { MessageBox.Show("插入失败"); return; } else { MessageBox.Show("插入成功"); } } //this.DoPrint(); this.DoQuery(); } /// /// 导出 /// private void DoExport() { try { if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fileName = this.saveFileDialog1.FileName; ultraGridExcelExporter1.Export(ultraGrid1, fileName); System.Diagnostics.Process.Start(fileName); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } private void ultraGrid1_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e) { Infragistics.Win.UltraWinGrid.UltraGrid uGrid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender; int index = uGrid.ActiveRow.Index; string coilNo = uGrid.ActiveRow.Cells["C_COIL_NO"].Text.Trim(); this.textBox1.Text = coilNo; yardAddr = uGrid.ActiveRow.Cells["YARD_ADDR"].Text.Trim(); l_coilNo = uGrid.ActiveRow.Cells["L_COIL_NO"].Text.Trim(); coil_no_index = uGrid.ActiveRow.VisibleIndex; dataSet2.Tables[0].Clear(); DataRow dr = dataSet2.Tables[0].NewRow(); dr["COIL_NO"] = coilNo; dr["COIL_LEN"] = uGrid.ActiveRow.Cells["COIL_LEN"].Text.Trim(); dr["COIL_WGT"] = uGrid.ActiveRow.Cells["COIL_WGT"].Text.Trim(); dr["LEN_DET"] = 1; dr["YARD_ADDR"] = yardAddr; this.textBox2.Text = yardAddr; dataSet2.Tables[0].Rows.Add(dr); } /// /// 酸轧上吊销 /// /// /// private void pictureBox1_Click(object sender, EventArgs e) { if ("".Equals(this.textBox1.Text.Trim())) { MessageBox.Show("请选择需要吊销的钢卷!"); return; } if (0 > this.ultraComboEditor2.SelectedIndex) { MessageBox.Show("请选择吊销类型!"); return; } if (null == this.ultraDateTimeEditor2.Value) { MessageBox.Show("请选择吊销时间!"); return; } if ("".Equals(textBox2.Text.Trim())) { MessageBox.Show("请输入吊销后堆放的位置!"); return; } if (ultraGrid1.Rows[coil_no_index].Cells["STATUS_CD"].Text.ToString().Equals("计划中")) { MessageBox.Show("钢卷还未上料,不能吊销!"); return; } else if (!ultraGrid1.Rows[coil_no_index].Cells["STATUS_CD"].Text.ToString().Equals("上鞍座") && !ultraGrid1.Rows[coil_no_index].Cells["STATUS_CD"].Text.ToString().Equals("预备吊销钢卷")) { MessageBox.Show("钢卷已经生产,不能吊销!"); return; } //钢卷入库 string coilNo = textBox1.Text.Trim(); string yardAddr = textBox2.Text.Trim(); string entryShift = this.UserInfo.GetUserOrder(); string entryGroup = this.UserInfo.GetUserGroup(); string reg_id = this.UserInfo.GetUserID(); string entryDtime = ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd"); MessageBox.Show("请确认退卷信息:钢卷号:" + coilNo); if (MessageBox.Show("您确认要退卷吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { CoreClientParam ccp = new CoreClientParam(); System.Data.DataTable dt = new System.Data.DataTable(); ccp.ServerName = "UIM.UIM02.UIM020050"; ccp.MethodName = "selectCoilYard"; ccp.ServerParams = new object[] { yardAddr }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); if (dt.Rows.Count > 0 && !string.IsNullOrEmpty(dt.Rows[0]["COIL_NO"].ToString())) { MessageBox.Show("该垛位上已有钢卷,请重新输入垛位信息!"); return; } else { CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "UIM.UIM02.UIM020050"; ccp2.MethodName = "saveCoilYard"; ccp2.ServerParams = new object[] { coilNo, yardAddr, entryShift, entryGroup, entryDtime, reg_id, "C" }; this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal); if (0 == ccp2.ReturnCode) { MessageBox.Show("退回成功"); } DoQuery(); } } //修改轧制计划、取消取样标识 } private void ultraComboEditor2_ValueChanged(object sender, EventArgs e) { if (0 == this.ultraComboEditor2.SelectedIndex) { this.ultraComboEditor6.ReadOnly = true; this.ultraComboEditor6.Text = ""; } else { this.ultraComboEditor6.ReadOnly = false; } } private void UIM020050_Load(object sender, EventArgs e) { this.ultraComboEditor2.SelectedIndex = 0; this.ultraComboEditor6.SelectedIndex = 0; this.ultraComboEditor6.Text = ""; this.ultraGrid2.DisplayLayout.ValueLists.Add("List1"); this.ultraGrid2.DisplayLayout.ValueLists["List1"].ValueListItems.Add(1, "合格"); this.ultraGrid2.DisplayLayout.ValueLists["List1"].ValueListItems.Add(2, "不合格"); this.ultraGrid2.DisplayLayout.ValueLists["List1"].DisplayStyle = Infragistics.Win.ValueListDisplayStyle.DisplayText; this.ultraGrid2.DisplayLayout.Bands[0].Columns[3].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; this.ultraGrid2.DisplayLayout.Bands[0].Columns[3].ValueList = this.ultraGrid2.DisplayLayout.ValueLists["List1"]; } private void ultraGrid3_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e) { try { UltraGridRow ugr2 = this.ultraGrid3.ActiveRow; if (ugr2 == null) return; string coilNo = ugr2.Cells["L_COIL_NO"].Text.ToString(); string trnfRegId = this.UserInfo.GetUserID(); string trnfShift = this.UserInfo.GetUserOrder(); string trnfGroup = this.UserInfo.GetUserGroup(); string trnfDTime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd"); CoreClientParam ccpa = new CoreClientParam(); ccpa.ServerName = "UIM.UIM02.UIM020050"; ccpa.MethodName = "insertInformation"; ccpa.ServerParams = new object[] { trnfRegId, trnfShift, trnfGroup, trnfDTime, coilNo }; this.ExecuteNonQuery(ccpa, CoreInvokeType.Internal); if (0 != ccpa.ReturnCode) { MessageBox.Show("添加失败"); return; } else { MessageBox.Show("添加成功"); } }catch(Exception pp){ } this.DoQuery(); } } }