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 Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Control; using Infragistics.Win.UltraWinGrid; using Infragistics.Win; using com.steering.mes.zgmil.entity; using System.Collections; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.ZGMil.Entity; using Core.StlMes.Client.ZGMil.Signature; using Core.Mes.Client.Comm.Format; using Core.StlMes.Client.ZGMil.Common; namespace Core.StlMes.Client.ZGMil.Popup { public partial class FrmTryRollingMaterial : FrmBase { private UltraGridRow ActUgr = null; private string ActContractNo = ""; private UltraGridRow ActUgr1 = null; private string ActJudgeStoveNo = ""; private string ActID = ""; private string proPlanId = null;//轧管订单编号 private string gxPlanNo = null;//工序排产序号 private string _UserName = ""; private string _Shift = ""; private string _Group = ""; private string _PlineCode = ""; private string[] _arr ; private string[] _pCode; FeedRowPlan Feedplan = new FeedRowPlan(); private OpeBase _ob; public FrmTryRollingMaterial(string Shift, string Group, string User, OpeBase ob, string PlineCode, string[] arr, string[] pCode) { InitializeComponent(); _Shift = Shift; _Group = Group; _UserName = User; _arr = arr; _pCode = pCode; _ob = ob; _PlineCode = PlineCode; BackSlabQuery(); BlacPlanQuery(); } /// /// 页面加载事件 /// /// /// protected override void OnLoad(EventArgs e) { base.OnLoad(e); ultraGrid_GHDL.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; chkNodeQuery.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; ultraGrid2.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; //EntityHelper.ShowGridCaption(ultraGrid_GHDL.DisplayLayout.Bands[0]); //DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmHotCheck.getContractNo", new object[] { _PlineCode }, this._ob); //cmbContrack.DataSource = dt; //cmbContrack.ValueMember = "contract_no"; //cmbContrack.DisplayMember = "contract_no"; //TubeRoll.SetComboItemHeight(cmbContrack); if (_PlineCode.Equals("C072")) { ultraLabel2.Visible = false; txtZPJudgeNo.Visible = false; ultraLabel1.Visible = false; txtZPPipeSize.Visible = false; } } /// /// 待组试轧料查询按钮 /// /// /// private void btnQuery_Click(object sender, EventArgs e) { if (chkContractNo.Checked) { if (string.IsNullOrEmpty(txtContractNo.Text)) { MessageBox.Show("请输入需查询的合同号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } BackSlabQuery(); } /// /// 已组回炉坯查询按钮 /// /// /// private void ultraButton2_Click(object sender, EventArgs e) { if (chkContractNo1.Checked) { if (string.IsNullOrEmpty(txtContractNo1.Text)) { MessageBox.Show("请输入需查询的合同号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (this.chkJudgeNo1.Checked) { if (string.IsNullOrEmpty(this.txtJudgeStoveNo.Text)) { MessageBox.Show("请输入需查询的炉号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (this.chkLotNo1.Checked) { if (string.IsNullOrEmpty(this.txtLotNo.Text)) { MessageBox.Show("请输入需查询的批号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } BlacPlanQuery(); } /// /// 初始化控件 /// private void InitCol() { if (chkContractNo.Checked) { txtContractNo.Enabled = true; } else { txtContractNo.Enabled = false; } if (chkSteelName.Checked) { txtSteelName.Enabled = true; } else { txtSteelName.Enabled = false; } if (chkLength.Checked) { txtLength.Enabled = true; } else { txtLength.Enabled = false; } if (chkSection.Checked) { txtSection.Enabled = true; } else { txtSection.Enabled = false; } if (chkLotNo1.Checked) { txtLotNo.Enabled = true; } else { txtLotNo.Enabled = false; } if (chkJudgeNo1.Checked) { txtJudgeStoveNo.Enabled = true; } else { txtJudgeStoveNo.Enabled = false; } if (chkContractNo1.Checked) { txtContractNo1.Enabled = true; } else { txtContractNo1.Enabled = false; } if (chkDate.Checked ) { this.udtDate.Enabled = true; } else { this.udtDate.Enabled = false; } } /// /// Grid记录更改颜色 /// private void ChangeGridColor() { foreach (UltraGridRow ugr in ultraGrid2.Rows) { if (ugr.Cells["STATUS"].Value.ToString() != "00") { ugr.Appearance.BackColor = Color.YellowGreen; } } } /// /// 试轧料查询 /// private void BackSlabQuery() { string Key1 = ""; string Key2 = ""; string Key3 = ""; string Key4 = ""; // string ContractNo = ""; string Length = ""; string SteelName = ""; string Section = ""; string date = ""; string JudgeNo = ""; UltraGridRow ugr = this.chkNodeQuery.ActiveRow; if (ugr != null) { Key1 = ugr.Cells["GRADENAME"].Value.ToString(); Key2 = ugr.Cells["ACT_LEN"].Value.ToString(); Key3 = ugr.Cells["DIMATER"].Value.ToString(); Key4 = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); } if (chkDate.Checked == true) { date = DateTime.Parse(this.udtDate.Value.ToString()).ToString("yyyyMMdd"); } if (chkSteelName.Checked == true) { SteelName = this.txtSteelName.Text; } if (chkLength.Checked == true) { Length = this.txtLength.Text; } if (chkSection.Checked == true) { Section = this.txtSection.Text; } if (chkJudgeNo.Checked) { JudgeNo = this.txtJudgeNo.Text; } dtContratNo.Clear(); dataTable1.Clear(); DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmTryRollingMaterial.getRollingMaterial", new object[] { SteelName, Length, Section, _PlineCode, date, JudgeNo, UserInfo.GetDeptid() }, this._ob); GridHelper.CopyDataToDatatable(ref dt, ref dtContratNo, true); if (dt.Rows.Count > 0) { if (ugr != null) { foreach (UltraGridRow ugr1 in chkNodeQuery.Rows) { if (ugr1.Cells["GRADENAME"].Value.ToString() == Key1 && ugr1.Cells["ACT_LEN"].Value.ToString() == Key2 && ugr1.Cells["DIMATER"].Value.ToString() == Key3 && ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == Key4) { ugr1.Activated = true; } } } } } /// /// 已组试轧料计划查询 /// private void BlacPlanQuery() { string PrimaKey = ""; string JudgeStoveNo = ""; string LotNo = ""; string ContractNo = ""; string Flag = "0"; UltraGridRow ugr = this.ultraGrid2.ActiveRow; if (ugr != null) { PrimaKey = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString(); } if (chkLotNo1.Checked == true) { LotNo = this.txtLotNo.Text; } else { LotNo = ""; } if (chkJudgeNo1.Checked == true) { JudgeStoveNo = this.txtJudgeStoveNo.Text; } else { JudgeStoveNo = ""; } if (chkContractNo1.Checked == true) { ContractNo = this.txtContractNo1.Text; } else { ContractNo = ""; } if (chkIsStart.Checked == true) { Flag = "1"; } else { Flag = "0"; } dtBackPlan.Clear(); dataTable2.Clear(); DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmTryRollingMaterial.getBackSlabPlan", new object[] { JudgeStoveNo, _PlineCode }, this._ob); GridHelper.CopyDataToDatatable(ref dt, ref dtBackPlan, true); if (dt.Rows.Count > 0) { if (ugr != null) { foreach (UltraGridRow ugr1 in ultraGrid2.Rows) { if (ugr1.Cells["JUDGE_STOVE_NO"].Value.ToString() == PrimaKey) { ugr1.Activated = true; } } } } ChangeGridColor(); } /// /// 合同、计划激活行单击事件 /// /// /// private void chkNodeQuery_AfterRowActivate(object sender, EventArgs e) { if (chkNodeQuery.ActiveRow == null) { return; } else { ActUgr = chkNodeQuery.ActiveRow; //ActContractNo = ActUgr.Cells["CONTRACT_NO"].Value.ToString(); string Length = ActUgr.Cells["ACT_LEN"].Value.ToString(); string GradeName = ActUgr.Cells["GRADENAME"].Value.ToString(); string Section = ActUgr.Cells["DIMATER"].Value.ToString(); string JudgeNo = ActUgr.Cells["JUDGE_STOVE_NO"].Value.ToString(); dataTable1.Clear(); ugbColClear(); DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmTryRollingMaterial.getRollingMaterialDetail", new object[] { GradeName, Length, Section, _PlineCode, JudgeNo }, this._ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable3, true); // List listSource = EntityHelper.GetData( //"com.steering.mes.zgmil.coup.FrmTryRollingMaterial.getRollingMaterialDetail", new object[] { GradeName, Length, Section, _PlineCode }, this._ob); // matGpMEntityBindingSource.DataSource = listSource; // GridHelper.RefreshAndAutoSize(this.ultraGrid_GHDL); } } /// /// 已组炉计划激活行单击事件 /// /// /// private void ultraGrid2_AfterRowActivate(object sender, EventArgs e) { if (ultraGrid2.ActiveRow == null) { return; } ActUgr1 = ultraGrid2.ActiveRow; ActJudgeStoveNo = ActUgr1.Cells["JUDGE_STOVE_NO"].Value.ToString(); proPlanId = ActUgr1.Cells["PRO_PLAN_ID"].Value.ToString(); gxPlanNo = ActUgr1.Cells["GX_PLAN_NO"].Value.ToString(); ActID = ActUgr1.Cells["ID"].Value.ToString(); dataTable2.Clear(); DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmTryRollingMaterial.getBackSlabForJudgeStoveNo", new object[] { ActJudgeStoveNo ,_PlineCode }, this._ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true); } private void chkContractNo_CheckedChanged(object sender, EventArgs e) { if (chkContractNo.Checked){ txtContractNo.Enabled = true;}else{ txtContractNo.Enabled = false;} if (chkLotNo1.Checked) { txtLotNo.Enabled = true; } else { txtLotNo.Enabled = false; } if (chkJudgeNo1.Checked) { txtJudgeStoveNo.Enabled = true; } else { txtJudgeStoveNo.Enabled = false; } if (chkContractNo1.Checked) { txtContractNo1.Enabled = true; } else { txtContractNo1.Enabled = false; } if (chkSteelName.Checked) { txtSteelName.Enabled = true; } else { txtSteelName.Enabled = false; } if (chkLength.Checked) { txtLength.Enabled = true; } else { txtLength.Enabled = false; } if (chkSection.Checked) { txtSection.Enabled = true; } else { txtSection.Enabled = false; } if (chkDate.Checked) { udtDate.Enabled = true; } else { udtDate.Enabled = false; } if (chkJudgeNo.Checked) { txtJudgeNo.Enabled = true; } else { txtJudgeNo.Enabled = false; } } /// /// 组炉回退 /// /// /// private void ultraButton1_Click(object sender, EventArgs e) { if (ultraGrid2.ActiveRow == null) { return; } if (ultraGrid2.ActiveRow.Cells["STATUS"].Value.ToString() != "00") { MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(this.ActJudgeStoveNo) + "】已开始轧制,不能回退", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + BaseMethod.getJudgeStoveNo(this.ActJudgeStoveNo) + "】回退?") == DialogResult.No) { return; } ArrayList para = new ArrayList(); ArrayList parm2 = new ArrayList(); if (ultraGrid1.Rows.Count > 0) { foreach (UltraGridRow ugr in ultraGrid1.Rows) { ArrayList list = new ArrayList(); list.Add(ugr.Cells["STOVE_NO"].Value.ToString()); //炼钢炉号 list.Add(ugr.Cells["JUDGE_STOVE_NO"].Value.ToString()); //轧管炉号 list.Add(ugr.Cells["FEED_NUM"].Value.ToString()); list.Add(ugr.Cells["DB_NUM"].Value.ToString()); list.Add(ugr.Cells["FEED_LENGTH"].Value.ToString()); para.Add(list); } } parm2.Add(ActJudgeStoveNo); parm2.Add(_PlineCode); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FrmTryRollingMaterial"; ccp.MethodName = "BackFurSlab"; ccp.ServerParams = new object[] { para, parm2 }; ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnInfo == "回退成功。") { MessageUtil.ShowTips("回退成功。"); BlacPlanQuery(); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } /// /// 试轧料组炉 /// /// /// private void btnZP_Click(object sender, EventArgs e) { if (chkNodeQuery.ActiveRow == null) { return; } string jugeNo = ""; if (_PlineCode.Equals("C072")) { //炉号 jugeNo = ServerHelper.GetData("com.steering.mes.signature.FrmDownlineManage.doQueryZpJudgeStoveNo", new Object[] { "E" }, this._ob).Rows[0][0].ToString(); } else { jugeNo = this.txtZPJudgeNo.Text.Trim(); } txtZPJudgeNo.Text = jugeNo; if (string.IsNullOrEmpty(txtZPJudgeNo.Text)) { MessageBox.Show("请输入试轧料组炉炉号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!_PlineCode.Equals("C072")) { if (txtZPJudgeNo.Text.Trim().Length != 6) { MessageBox.Show("请输入6位组炉炉号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } //查询该炉号是否已经存在 DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmHotCheck.IsUsedJudgeStoveNo", new object[] { txtZPJudgeNo.Text + "-01" }, this._ob); if (dt.Rows.Count > 0) { MessageBox.Show("炉号【" + txtZPJudgeNo.Text + "】已存在,请更换组炉炉号!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ultraGrid_GHDL.UpdateData(); IQueryable urows = ultraGrid_GHDL.Rows.AsQueryable().Where("CHK = 'True'"); int MatNum = urows.Count(); if (MatNum == 0) { MessageBox.Show("请选择需要组炉的坯料!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ArrayList parm = new ArrayList(); ArrayList parm1 = new ArrayList(); foreach (UltraGridRow uRow in urows) { //MatGpMEntity matGpM = (MatGpMEntity)uRow.ListObject; //string matGpMTity = JSONFormat.Format(matGpM); //parm.Add(matGpMTity); ArrayList parmM = new ArrayList(); parmM.Add(uRow.Cells["STOVE_NO"].Value.ToString()); parmM.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString()); parmM.Add(uRow.Cells["GRADENAME"].Value.ToString()); parmM.Add(uRow.Cells["STD_NAME"].Value.ToString()); parmM.Add(uRow.Cells["PLINE_NAME"].Value.ToString()); //生产产线 parmM.Add(uRow.Cells["DIMATER"].Value.ToString()); //直径 parmM.Add(uRow.Cells["ACT_LEN"].Value.ToString()); //坯料长度 parmM.Add(uRow.Cells["FIX_NUM"].Value.ToString()); //倍尺数 parmM.Add(uRow.Cells["FIX_LEN"].Value.ToString()); //单倍长度 parmM.Add(uRow.Cells["ACT_COUNT"].Value.ToString()); //支数 parmM.Add(uRow.Cells["ACT_WEIGHT"].Value.ToString()); //重量 parmM.Add(uRow.Cells["DB_WEIGHT"].Value.ToString()); //坯料量 parmM.Add(uRow.Cells["JUDGE_RESULT_CODE"].Value.ToString()); //综合判定代码 parmM.Add(uRow.Cells["JUDGE_RESULT_NAME"].Value.ToString()); //综合判定 parmM.Add(uRow.Cells["GPTYPE"].Value.ToString()); //管坯类型 parmM.Add(uRow.Cells["STORAGE_NO"].Value.ToString()); //仓库代码 parmM.Add(uRow.Cells["STORAGE_NAME"].Value.ToString()); //仓库 parmM.Add(uRow.Cells["JUGDE_APPLY_CODE"].Value.ToString()); //申请判定单号 parm.Add(parmM); } UltraGridRow ugr = chkNodeQuery.ActiveRow; parm1.Add(txtZPJudgeNo.Text + "-01"); parm1.Add(_PlineCode); parm1.Add(_Shift); parm1.Add(_Group); parm1.Add(_UserName); parm1.Add(MatNum.ToString()); parm1.Add(ugr.Cells["GRADENAME"].Value.ToString()); parm1.Add(ugr.Cells["DIMATER"].Value.ToString()); parm1.Add(ugr.Cells["FIX_LEN"].Value.ToString()); parm1.Add(ugr.Cells["ACT_LEN"].Value.ToString()); parm1.Add(ugr.Cells["FIX_NUM"].Value.ToString()); parm1.Add(ugr.Cells["ACT_WEIGHT"].Value.ToString()); parm1.Add(txtZPPipeSize.Text.Trim().ToString()); Feedplan.ResultNo = txtZPJudgeNo.Text + "-01" + _PlineCode; Feedplan.LotNo = "试轧料"; Feedplan.JudgeStoveNo = txtZPJudgeNo.Text + "-01"; Feedplan.StoveNo = ""; Feedplan.PlineCode = _PlineCode; Feedplan.ProPlanId = ""; Feedplan.GxPlanNo = ""; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.zgmil.coup.FrmTryRollingMaterial"; ccp.MethodName = "zpTryRollingMaterial"; ccp.ServerParams = new object[] { parm, parm1, _arr, Feedplan }; ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("组炉成功!")) { BackSlabQuery(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e) { BackSlabQuery(); BlacPlanQuery(); } private void FrmBackSlab_Load(object sender, EventArgs e) { } /// /// ugbColr的Clear()方法 /// private void ugbColClear() { //txtZPLotNo.Text = ""; txtZPJudgeNo.Text = ""; //cmbContrack.Text = ""; //cmbRollLength.Text = ""; //ckrContrack.Checked = false; //ckrRollLength.Checked = false; } private void ultraGrid_GHDL_CellChange(object sender, CellEventArgs e) { e.Cell.Row.Update(); if (ultraGrid_GHDL.Rows.Count > 0) { foreach (UltraGridRow uRow in ultraGrid_GHDL.Rows) { uRow.Cells["ACT_WEIGHT"].Value = int.Parse(uRow.Cells["ACT_COUNT"].Value.ToString()) * double.Parse(uRow.Cells["DB_WEIGHT"].Value.ToString3()); } } } private void txtSteelName_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { BackSlabQuery(); } } private void txtJudgeStoveNo_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { BlacPlanQuery(); } } } }