| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424 |
- 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.IO;
- using System.Collections;
- namespace Core.LZMes.Client.UIM.UIM02
- {
- public partial class UIM020030:FrmBase
- {
- private string yardAddr = "";//上料钢卷垛位
- private string l_coilNo = "";//冷轧卷号
- private int coil_no_index = -1;//冷轧卷在轧制计划的下标位置
- public UIM020030()
- {
- 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;
- }
- }
- /// <summary>
- /// 查询连退作业计划
- /// </summary>
- private void DoQuery()
- {
- this.dataSet1.Tables[0].Clear();
- this.dataSet3.Tables[0].Clear();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIM.UIM02.UIM020030";
- ccp.MethodName = "queryCalPlan";
- 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;
- }
- else if (drs[i]["STATUS_CD"].ToString().Equals("预备吊销钢卷"))
- {
- ultraGrid1.Rows[i].Appearance.BackColor = Color.Pink;
- }
- }
- CoreClientParam ccp3 = new CoreClientParam();
- ccp3.ServerName = "UIM.UIM02.UIM020030";
- ccp3.MethodName = "queryAddClassInf";
- ccp3.SourceDataTable = this.dataSet3.Tables[0];
- this.ExecuteQueryToDataTable(ccp3, CoreInvokeType.Internal);
- }
-
- /// <summary>
- /// 连退上料操作
- /// </summary>
- private void DoSave()
- {
- if (null == this.ultraDateTimeEditor1.Value)
- {
- MessageBox.Show("上料时间为空,请选择相应的上料时间后再进行上料操作!");
- return;
- }
- string calNo = textBox1.Text.Trim();
- string coilNo = this.textBox3.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.UIM020030";
- ccp.MethodName = "isReceivedL2";
- ccp.ServerParams = new object[] { calNo,coilNo };
- ccp.SourceDataTable = dt;
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- if (dt.Rows.Count <= 0)
- {
- CoreClientParam ccp1 = new CoreClientParam();
- ccp1.ServerName = "UIM.UIM02.UIM020030";
- 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.UIM020030";
- ccp2.MethodName = "outStockByCal";
- ccp2.ServerParams = new Object[] { calNo, 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.UIM020030";
- 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();
- }
- /// <summary>
- /// 导出
- /// </summary>
- 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;
- if (index > 0)
- {
- string statusCd = uGrid.Rows[index - 1].Cells["STATUS_CD"].Text.Trim();
- if ("计划中".Equals(statusCd))
- {
- MessageBox.Show("必须按照连退计划顺序上料,请确认后重新选择!");
- return;
- }
- }
- string coilNo = uGrid.ActiveRow.Cells["C_COIL_NO"].Text.Trim();
- this.textBox3.Text = coilNo;
- string calNo = uGrid.ActiveRow.Cells["CAL_SEQ"].Text.Trim().Substring(0, uGrid.ActiveRow.Cells["CAL_SEQ"].Text.Trim().IndexOf('-'));
- textBox1.Text = calNo;
- 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);
- }
- /// <summary>
- /// 酸轧上吊销
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void pictureBox1_Click(object sender, EventArgs e)
- {
- if ("".Equals(this.textBox3.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 = textBox3.Text.Trim();
- string yardAddr = textBox2.Text.Trim();
- string calNo = textBox1.Text.Trim();
- try
- {
- string stock = yardAddr.Substring(0, 1);
- yardAddr = yardAddr.Substring(2);
- string row = yardAddr.Substring(0, yardAddr.IndexOf('-') - 1);
- if (row.Length < 2)
- {
- row = "0" + row;
- }
- string fl = yardAddr.Substring(yardAddr.IndexOf('-') - 1,1);
- string col = yardAddr.Substring(yardAddr.IndexOf('-')+1);
- if (col.Length < 2)
- {
- col = "0" + col;
- }
- yardAddr = stock + "-" + row + fl + "-" + col;
- }
- catch (Exception ex)
- {
- MessageBox.Show("垛位输入错误,请重新输入!");
- textBox2.Focus();
- return;
- }
- 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.UIM020030";
- 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.UIM020030";
- ccp2.MethodName = "saveCoilYard";
- ccp2.ServerParams = new object[] { calNo, coilNo, yardAddr, entryShift, entryGroup, entryDtime, reg_id, "C" };
- this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
- if (0 == ccp2.ReturnCode)
- {
- MessageBox.Show("退回成功");
- DoQuery();
- }
- }
- }
- //修改轧制计划、取消取样标识
- }
- private void UIM020030_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 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 ultraGrid3_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- if (e.Cell.Column.Key == "SELECT_ITEM" && Convert.ToBoolean(e.Cell.Text))
- {
- if (MessageBox.Show("是否确认添加班组信息?","提示",MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- string coilNo = e.Cell.Row.Cells["C_COIL_NO"].Text;
- /*for循环控制单选*/
- int i = this.ultraGrid3.Rows.Count;
- for (int j = 0; j < i; j++)
- {
- if (this.ultraGrid3.Rows[j].Cells["C_COIL_NO"].Text != coilNo)
- {
- this.ultraGrid3.Rows[j].Cells["SELECT_ITEM"].Value = false;
- }
- }
- 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.UIM020030";
- 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("插入成功");
- }
- }
- DoQuery();
- }
- }
- }
- }
|