using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.PlnSaleOrd.BaseMethod; using Core.StlMes.Client.PlnSaleOrd.炼钢计划.entity; using CoreFS.CA06; using Infragistics.Win; using Infragistics.Win.UltraWinEditors; using Infragistics.Win.UltraWinGrid; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using ColumnStyle = Infragistics.Win.UltraWinGrid.ColumnStyle; namespace Core.StlMes.Client.PlnSaleOrd.炼钢计划 { public partial class FrmSteelProcessCard : FrmBase { private string carftNo; private OpeBase ob; private string cic; private string furnaceNo; private string plineCodeA; private string plineNameA; private string gradCode; private string gradName; private string planRoute;//作业路线 private string plineCodeB; private int count = 0; public bool Falg = false; UltraComboEditor uceCic = new UltraComboEditor(); UltraComboEditor uceCicAll = new UltraComboEditor(); UltraComboEditor ucePro = new UltraComboEditor();//品名 UltraComboEditor uceItem = new UltraComboEditor();//合金物料码 UltraCombo uceCcm = new UltraCombo(); UltraComboEditor uceWd = new UltraComboEditor(); private string flag; private string gxPlanSeq; public FrmSteelProcessCard(string _carftNo, OpeBase _ob, ArrayList _list,string _flag) { carftNo = _carftNo; ob = _ob; flag = _flag; if (_list != null) { string[] arrString = (string[])_list.ToArray(typeof(string)); cic = arrString[0].ToString(); furnaceNo = arrString[1].ToString(); plineCodeA = arrString[2].ToString(); plineNameA = arrString[3].ToString(); gradCode = arrString[4].ToString(); gradName = arrString[5].ToString(); planRoute = arrString[6].ToString(); plineCodeB = arrString[7].ToString(); gxPlanSeq = arrString[8].ToString(); } InitializeComponent(); } private void FrmSteelProcessCard_Load(object sender, EventArgs e) { Controls.Add(uceCcm); uceCcm.Visible = false; Controls.Add(uceItem); uceItem.Visible = false; Controls.Add(uceWd); uceWd.Visible = false; //设置列头名称 EntityHelper.ShowGridCaption(ultraGridLgM.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGridLgCic.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGridLgTarCic.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGridLgCcm.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGridLhTem.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGridhJ.DisplayLayout.Bands[0]); //PlanComm.setGridActivation(ultraGridLgM.DisplayLayout.Bands[0], "CHC"); //PlanComm.setGridActivation(ultraGridLgCic.DisplayLayout.Bands[0], "CHC"); //PlanComm.setGridActivation(ultraGridLgTarCic.DisplayLayout.Bands[0], "CHC"); //PlanComm.setGridActivation(ultraGridLgCcm.DisplayLayout.Bands[0], "CHC"); //PlanComm.setGridActivation(ultraGridLhTem.DisplayLayout.Bands[0], "CHC"); SteelHelper.InitPline(comAPline, "A", this.ob); SteelHelper.InitGrade(comGrade, this.ob); chenCode(); SteelHelper.InitComboEditor(ucePro, "com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryProduName", "PRODUCCODE", ob, true); SteelHelper.BindColumn(ucePro, "Produccode", this.Controls, this.ultraGridLgM, 0); queryCraftType(); queryComBaseCcm(cic); QueryM(); QueryComMscChemCode(); } /// /// 查询基础CIC /// private void QueryComMscChemCode() { DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComMscChemCode", new object[] { cic.Split(',') }, ob); GridHelper.CopyDataToDatatable(dt, dataTable1, true); } /// /// 绑定元素下拉 /// private void chenCode() { DataTable dt1 = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryChenName", new object[] { "", "" }, ob); Controls.Add(uceCic); uceCic.Visible = false; uceCic.DropDownListWidth = -1; uceCic.DropDownStyle = DropDownStyle.DropDownList; uceCic.DataSource = dt1.AsEnumerable().Where(p => (p["CHEM_TYPE"] is DBNull ? "" : p["CHEM_TYPE"].ToString()) == "A").CopyToDataTable(); uceCic.DisplayMember = "CHEM_NAME"; uceCic.ValueMember = "CHEM_CODE"; Controls.Add(uceCicAll); uceCicAll.Visible = false; uceCicAll.DropDownListWidth = -1; uceCicAll.DropDownStyle = DropDownStyle.DropDownList; uceCicAll.DataSource = dt1; uceCicAll.DisplayMember = "CHEM_NAME"; uceCicAll.ValueMember = "CHEM_CODE"; ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["ChemCode"].EditorComponent = uceCic; ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["ChemCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ultraGridLgCic.DisplayLayout.Bands[0].Columns["ChemCode"].EditorComponent = uceCicAll; ultraGridLgCic.DisplayLayout.Bands[0].Columns["ChemCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleCode"].EditorComponent = uceCicAll; ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepCode"].EditorComponent = uceCicAll; ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; SteelHelper.SetComboItemHeight(uceCic); DataTable dt2 = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.BaseHelper.initPlinePowerA", new object[] { }, ob); UltraComboEditor uce2 = new UltraComboEditor(); Controls.Add(uce2); uce2.Visible = false; uce2.DropDownListWidth = -1; uce2.DropDownStyle = DropDownStyle.DropDownList; uce2.DataSource = dt2; uce2.DisplayMember = "PLINE_NAME"; uce2.ValueMember = "PLINE_CODE"; ultraGridLgM.DisplayLayout.Bands[0].Columns["PlineCode"].EditorComponent = uce2; ultraGridLgM.DisplayLayout.Bands[0].Columns["PlineCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; //下限符号 UltraComboEditor uceMinFh = new UltraComboEditor(); ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StdminSign"].EditorComponent = uceMinFh; ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StdminSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ultraGridLgCic.DisplayLayout.Bands[0].Columns["StdminSign"].EditorComponent = uceMinFh; ultraGridLgCic.DisplayLayout.Bands[0].Columns["StdminSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleMinSign"].EditorComponent = uceMinFh; ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleMinSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepMinSign"].EditorComponent = uceMinFh; ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepMinSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StdminSign"].ValueList = GetMinSignList(); ultraGridLgCic.DisplayLayout.Bands[0].Columns["StdminSign"].ValueList = GetMinSignList(); ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleMinSign"].ValueList = GetMinSignList(); ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepMinSign"].ValueList = GetMinSignList(); SteelHelper.SetComboItemHeight(uceMinFh); //上限符号 UltraComboEditor uceMaxFh = new UltraComboEditor(); ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StdmaxSign"].EditorComponent = uceMaxFh; ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StdmaxSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ultraGridLgCic.DisplayLayout.Bands[0].Columns["StdmaxSign"].EditorComponent = uceMaxFh; ultraGridLgCic.DisplayLayout.Bands[0].Columns["StdmaxSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleMaxSign"].EditorComponent = uceMaxFh; ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleMaxSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepMaxSign"].EditorComponent = uceMaxFh; ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepMaxSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StdmaxSign"].ValueList = GetMaxSignList(); ultraGridLgCic.DisplayLayout.Bands[0].Columns["StdmaxSign"].ValueList = GetMaxSignList(); ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleMaxSign"].ValueList = GetMaxSignList(); ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepMaxSign"].ValueList = GetMaxSignList(); SteelHelper.SetComboItemHeight(uceMaxFh); //CCM工序点 UltraComboEditor uceStatGx = new UltraComboEditor(); ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StationCode"].EditorComponent = uceStatGx; ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StationCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ValueList vlistSteelGx = new ValueList(); vlistSteelGx.ValueListItems.Insert(0, "", ""); vlistSteelGx.ValueListItems.Insert(1, "EAF", "EAF"); vlistSteelGx.ValueListItems.Insert(2, "LF", "LF"); vlistSteelGx.ValueListItems.Insert(3, "VD", "VD"); vlistSteelGx.ValueListItems.Insert(4, "RH", "RH"); vlistSteelGx.ValueListItems.Insert(5, "CCM", "CCM"); ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StationCode"].ValueList = vlistSteelGx; SteelHelper.SetComboItemHeight(uceStatGx); //温度工序点 UltraComboEditor uceStatGxWd = new UltraComboEditor(); ultraGridLhTem.DisplayLayout.Bands[0].Columns["StationCode"].EditorComponent = uceStatGxWd; ultraGridLhTem.DisplayLayout.Bands[0].Columns["StationCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ValueList vlistSteelGxWd = new ValueList(); ; vlistSteelGxWd.ValueListItems.Insert(0, "", ""); vlistSteelGxWd.ValueListItems.Insert(1, "EAF", "EAF"); vlistSteelGxWd.ValueListItems.Insert(2, "LF", "LF"); vlistSteelGxWd.ValueListItems.Insert(3, "VD", "VD"); vlistSteelGxWd.ValueListItems.Insert(4, "RH", "RH"); vlistSteelGxWd.ValueListItems.Insert(5, "CCM", "CCM"); ultraGridLhTem.DisplayLayout.Bands[0].Columns["StationCode"].ValueList = vlistSteelGxWd; SteelHelper.SetComboItemHeight(uceStatGxWd); } private static ValueList GetMaxSignList() { ValueList vlistSteelMax = new ValueList(); ; vlistSteelMax.ValueListItems.Insert(0, "=", "="); vlistSteelMax.ValueListItems.Insert(1, "<", "<"); vlistSteelMax.ValueListItems.Insert(2, "<=", "<="); vlistSteelMax.ValueListItems.Insert(3, "", ""); return vlistSteelMax; } private ValueList GetMinSignList() { ValueList vlistSteelMin = new ValueList(); ; vlistSteelMin.ValueListItems.Insert(0, "=", "="); vlistSteelMin.ValueListItems.Insert(1, ">", ">"); vlistSteelMin.ValueListItems.Insert(2, ">=", ">="); vlistSteelMin.ValueListItems.Insert(3, "", ""); return vlistSteelMin; } /// /// 绑定工艺卡类型下拉 /// private void queryCraftType() { UltraComboEditor uceType = new UltraComboEditor(); ultraGridLgM.DisplayLayout.Bands[0].Columns["CraftType"].EditorComponent = uceType; ultraGridLgM.DisplayLayout.Bands[0].Columns["CraftType"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ValueList vlistSteel = new ValueList(); ; vlistSteel.ValueListItems.Insert(0, "A", "标准卡"); vlistSteel.ValueListItems.Insert(1, "B", "联络卡"); ultraGridLgM.DisplayLayout.Bands[0].Columns["CraftType"].ValueList = vlistSteel; SteelHelper.SetComboItemHeight(uceType); } /// /// 获取水表 /// private void queryComBaseCcm(string wasetcic) { DataTable dtCcm = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseCcm", new object[] { plineCodeB, gradCode, wasetcic }, ob); //uceCcm.DropDownListWidth = -1; //uceCcm.DropDownStyle = DropDownStyle.DropDownList; uceCcm.DataSource = dtCcm; uceCcm.ValueMember = "CCM_CODE"; //uceCcm.DisplayMember = "CCM_CODE"; ultraGridLgCcm.DisplayLayout.Bands[0].Columns["CcmCode"].EditorComponent = uceCcm; //ultraGridLgCcm.DisplayLayout.Bands[0].Columns["CcmCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; uceWd.DataSource = dtCcm; uceWd.ValueMember = "液相线温度"; uceWd.DisplayMember = "液相线温度"; ultraGridLhTem.DisplayLayout.Bands[0].Columns["TepVal"].EditorComponent = uceWd; SteelHelper.SetComboItemHeight(uceWd); DataTable dthj = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryItemCode", new object[] { "" }, ob); Object[] obj = new Object[] { "", "" }; DataRow dr = dthj.NewRow(); dr.ItemArray = obj; dthj.Rows.InsertAt(dr, 0); uceItem.DataSource = dthj; uceItem.ValueMember = "ITEM_CODE"; uceItem.DisplayMember = "ITEM_NAME"; SteelHelper.SetComboItemHeight(uceItem); ultraGridhJ.DisplayLayout.Bands[0].Columns["ItemCode"].EditorComponent = uceItem; } private void craftNo() { DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryCraftNo", new object[] { }, ob); comCraftNo.DataSource = dt; comCraftNo.ValueMember = "CRAFT_NO"; comCraftNo.DisplayMember = "CRAFT_NO"; } private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "Query": //查询 QueryLgM(); break; case "Add": //保存 doSaveUpdate("0"); break; case "Update": //修改 doSaveUpdate("1"); break; case "Delete": //删除 doDelete(); break; case "Confirm": //确认 doConfirm(); break; case "Calculate": //计算 doCalculate(0); break; case "Close": this.Close(); break; } } private DataSourceList listCic; private DataSourceList listTarCic; private DataSourceList listCcm; private DataSourceList listTem; private DataSourceList listHj; #region 查询 /// /// 查询工艺主表 /// private void QueryLgM() { count = 0; string carftNo1 = ""; string plineCode = ""; string gradCode = ""; if (chcCraftNo.Checked) { if (comCraftNo.Text.Equals("")) { MessageUtil.ShowTips("请选择工艺卡号!"); return; } else { carftNo1 = comCraftNo.Text.ToString(); } } if (chcAPline.Checked) { if (comAPline.Text.Equals("")) { MessageUtil.ShowTips("请选择电炉产线!"); return; } else { plineCode = comAPline.Value.ToString(); } } if (chcGrade.Checked) { if (comGrade.Text.Equals("")) { MessageUtil.ShowTips("请选择钢种!"); return; } else { gradCode = comGrade.Value.ToString(); } } List listSource = EntityHelper.GetData ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgM", new object[] { "", carftNo1, plineCode, gradCode, planRoute, flag == "0" || flag == "2" }, ob); CraftLg2MEntityBindingSource.DataSource = listSource; UltraGridRow ugr = ultraGridLgM.ActiveRow; if (ugr == null) { CraftLg2TarCicEntityBindingSource.Clear(); CraftLg2CcmEntityBindingSource.Clear(); CraftLg2TemperatureEntitySource.Clear(); if (cic.Split(',').Length > 1) { } else { queryOrdDesigStdCic(); } } } private void QueryM() { List listSource = EntityHelper.GetData ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgM", new object[] { cic.Split(','), carftNo, plineCodeA, gradCode, planRoute, flag == "0" || flag == "2" }, ob); CraftLg2MEntityBindingSource.DataSource = listSource; UltraGridRow ugr = ultraGridLgM.ActiveRow; if (ugr == null) { ultraTabControl1.Enabled = false; CraftLg2TarCicEntityBindingSource.Clear(); CraftLg2CcmEntityBindingSource.Clear(); CraftLg2TemperatureEntitySource.Clear(); CraftLg2AlloyEntityBindingSource.Clear(); //if (flag.Equals("1")) //{ // ultraExpandableGroupBox2.Visible = false; // if (cic.Split(',').Length > 1) // { // queryOrdDesigJJCic(); // } // else // { // queryOrdDesigStdCic(); // } //} //else //{ //ultraExpandableGroupBox2.Visible = true; queryOrdDesigCic(""); //} } foreach (UltraGridRow row in ultraGridLgM.Rows) { if (carftNo.Equals(row.Cells["CraftNo"].Text.ToString())) { row.Cells["CHC"].Value = true; } } } /// /// 查询工艺评审Cic /// private void queryOrdDesigStdCic() { listCic = EntityHelper.GetData ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryOrdDesigStdCic", new object[] { cic, furnaceNo, gxPlanSeq, flag }, ob); listCic.AcceptChanges(); CraftLg2CicEntityBindingSource.DataSource = listCic; foreach (UltraGridRow urg in ultraGridLgCic.Rows) { urg.Cells["CHC"].Value = true; } } /// /// 查询交集CIC /// private void gqueryOrdDesigJJCic() { listCic = EntityHelper.GetData ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryOrdDesigJJCic", new object[] { cic, furnaceNo }, ob); listCic.AcceptChanges(); CraftLg2CicEntityBindingSource.DataSource = listCic; foreach (UltraGridRow urg in ultraGridLgCic.Rows) { urg.Cells["CHC"].Value = true; } } DataTable dtCicAll = new DataTable(); /// /// 查询CIC(工艺评审和交集) /// private void queryOrdDesigCic(string cicg) { dtCicAll = ServerHelper.GetData( "com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryOrdDesigCic", new object[] { cic, furnaceNo, gxPlanSeq,flag }, ob); DataTable dt = SteelHelper.GetDistinctTable(dtCicAll, "CIC"); GridHelper.CopyDataToDatatable(dt, dataTable2, true); foreach (UltraGridRow ugr in ultraGrid2.Rows) { if (ugr.Cells["CIC"].Value.ToString().Equals(cicg)) { ugr.Activate(); } } } /// /// 查询工艺成分信息 /// private void QueryLgCic(string cicGid) { listCic = EntityHelper.GetData ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgCic", new object[] { cicGid }, ob); listCic.AcceptChanges(); CraftLg2CicEntityBindingSource.DataSource = listCic; foreach (UltraGridRow urg in ultraGridLgCic.Rows) { urg.Cells["CHC"].Value = true; } } /// /// 查询目标工艺成分信息 /// private void QueryLgTarCic(string tarCicGid) { listTarCic = EntityHelper.GetData ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgTarCic", new object[] { tarCicGid }, ob); listTarCic.AcceptChanges(); CraftLg2TarCicEntityBindingSource.DataSource = listTarCic; foreach (UltraGridRow urg in ultraGridLgTarCic.Rows) { urg.Cells["CHC"].Value = true; } } /// /// 查询CCM信息 /// private void QueryLgCcm(string ccmGid) { listCcm = EntityHelper.GetData ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgCcm", new object[] { ccmGid }, ob); listCcm.AcceptChanges(); CraftLg2CcmEntityBindingSource.DataSource = listCcm; foreach (UltraGridRow urg in ultraGridLgCcm.Rows) { urg.Cells["CHC"].Value = true; } } /// /// 查询温度信息 /// private void QueryLgtTem(string tepGid) { listTem = EntityHelper.GetData ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgtTem", new object[] { tepGid }, ob); listTem.AcceptChanges(); CraftLg2TemperatureEntitySource.DataSource = listTem; foreach (UltraGridRow urg in ultraGridLhTem.Rows) { urg.Cells["CHC"].Value = true; if (urg.Cells["StationCode"].Text.Equals("EAF")) { urg.Cells["TepVal1Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128); urg.Cells["TepVal1Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128); urg.Cells["TepVal2Min"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal2Max"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal1Min"].Activation = Activation.AllowEdit; urg.Cells["TepVal1Max"].Activation = Activation.AllowEdit; urg.Cells["TepVal1Min"].IgnoreRowColActivation = true; urg.Cells["TepVal1Max"].IgnoreRowColActivation = true; urg.Cells["TepVal2Min"].Activation = Activation.ActivateOnly; urg.Cells["TepVal2Max"].Activation = Activation.ActivateOnly; urg.Cells["TepVal"].Activation = Activation.ActivateOnly; } else if (urg.Cells["StationCode"].Text.Equals("CCM")) { urg.Cells["TepVal1Min"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal1Max"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal2Min"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal2Max"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal"].Appearance.BackColor = Color.FromArgb(255, 255, 128); urg.Cells["TepVal1Min"].Activation = Activation.ActivateOnly; urg.Cells["TepVal1Max"].Activation = Activation.ActivateOnly; urg.Cells["TepVal2Min"].Activation = Activation.ActivateOnly; urg.Cells["TepVal2Max"].Activation = Activation.ActivateOnly; urg.Cells["TepVal"].Activation = Activation.AllowEdit; urg.Cells["TepVal"].IgnoreRowColActivation = true; } else { urg.Cells["TepVal1Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128); urg.Cells["TepVal1Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128); urg.Cells["TepVal2Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128); urg.Cells["TepVal2Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128); urg.Cells["TepVal"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal1Min"].Activation = Activation.AllowEdit; urg.Cells["TepVal1Max"].Activation = Activation.AllowEdit; urg.Cells["TepVal2Min"].Activation = Activation.AllowEdit; urg.Cells["TepVal2Max"].Activation = Activation.AllowEdit; urg.Cells["TepVal1Min"].IgnoreRowColActivation = true; urg.Cells["TepVal1Max"].IgnoreRowColActivation = true; urg.Cells["TepVal2Min"].IgnoreRowColActivation = true; urg.Cells["TepVal2Max"].IgnoreRowColActivation = true; urg.Cells["TepVal"].Activation = Activation.ActivateOnly; } } } private void QueryLgHj(string alloyGid) { listHj = EntityHelper.GetData ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgtHj", new object[] { alloyGid}, ob); listHj.AcceptChanges(); CraftLg2AlloyEntityBindingSource.DataSource = listHj; foreach (UltraGridRow urg in ultraGridhJ.Rows) { urg.Cells["CHC"].Value = true; } } #endregion /// /// 保存 /// ultraExpandableGroupBox2 private void doSaveUpdate(string isFlag) { #region 条件 ultraGridLgM.UpdateData(); ultraGridLgCic.UpdateData(); ultraGridLgTarCic.UpdateData(); ultraGridLgCcm.UpdateData(); ultraGridLhTem.UpdateData(); UltraGridRow row = ultraGrid2.ActiveRow; if (row == null) { //MessageUtil.ShowTips("未找到成分索引码!!"); return; } ArrayList listLgM = new ArrayList(); IQueryable ugLgM = ultraGridLgM.Rows.AsQueryable().Where("CHC = 'True'"); if (ugLgM == null || ugLgM.Count() == 0) { MessageUtil.ShowTips("未勾选炼钢工艺主信息!"); return; } else { foreach (UltraGridRow rowLgM in ugLgM) { listLgM.Add((CraftLg2MEntity)rowLgM.ListObject); } } ArrayList listTarCic = new ArrayList(); IQueryable ugTarCic = ultraGridLgTarCic.Rows.AsQueryable().Where("CHC = 'True'"); if (ugTarCic == null || ugTarCic.Count() == 0) { MessageUtil.ShowTips("未勾选目标工艺成分信息!"); return; } else { foreach (UltraGridRow rowTarCic in ugTarCic) { listTarCic.Add((CraftLg2TarCicEntity)rowTarCic.ListObject); } } ArrayList listLgCic = new ArrayList(); IQueryable ugLgCic = ultraGridLgCic.Rows.AsQueryable(); // if (ugLgCic == null || ugLgCic.Count() == 0) // { // MessageUtil.ShowTips("未勾选工艺成分信息!"); // return; // } // else // List usedCode = new List(); foreach (UltraGridRow rowLgCic in ugLgCic) { CraftLg2CicEntity CraftLg2CicEntity = rowLgCic.ListObject as CraftLg2CicEntity; if (usedCode.Contains(CraftLg2CicEntity.ChemCode)) { MessageUtil.ShowTips("工艺成分信息有重复元素!"); return; } usedCode.Add(CraftLg2CicEntity.ChemCode); if (CraftLg2CicEntity != null) { if (CraftLg2CicEntity.ChemCode.Trim() == "") { MessageUtil.ShowTips("请选择工艺成分信息的元素!"); return; } } listLgCic.Add((CraftLg2CicEntity)rowLgCic.ListObject); } //} ArrayList listLgCcm = new ArrayList(); IQueryable ugLgCcm = ultraGridLgCcm.Rows.AsQueryable().Where("CHC = 'True'"); if (ugLgCcm == null || ugLgCcm.Count() == 0) { //MessageUtil.ShowTips("未勾选CCM工艺信息!"); //return; } else { foreach (UltraGridRow rowLgCcm in ugLgCcm) { //if (rowLgCcm.Cells[""].Text.ToString()) listLgCcm.Add((CraftLg2CcmEntity)rowLgCcm.ListObject); } } ArrayList listLgTem = new ArrayList(); IQueryable ugLgTem = ultraGridLhTem.Rows.AsQueryable().Where("CHC = 'True'"); if (ugLgTem == null || ugLgTem.Count() == 0) { MessageUtil.ShowTips("未勾选温度参数信息!"); return; } else { foreach (UltraGridRow rowLgTem in ugLgTem) { listLgTem.Add((CraftLg2TemperatureEntity)rowLgTem.ListObject); } } ArrayList listLgHj = new ArrayList(); IQueryable ugLgHj = ultraGridhJ.Rows.AsQueryable().Where("CHC = 'True'"); if (ugLgHj == null || ugLgHj.Count() == 0) { MessageUtil.ShowTips("未勾选合金配置信息!"); return; } else { foreach (UltraGridRow rowLgHj in ugLgHj) { listLgHj.Add((CraftLg2AlloyEntity)rowLgHj.ListObject); } } ArrayList jsonListM = new ArrayList(); ArrayList jsonListCic = new ArrayList(); ArrayList jsonListTarCic = new ArrayList(); ArrayList jsonListCcm = new ArrayList(); ArrayList jsonListTem = new ArrayList(); ArrayList jsonListHj = new ArrayList(); if (isFlag.Equals("0")) { #region 新增 foreach (CraftLg2MEntity entityM in listLgM) { if (string.IsNullOrEmpty(entityM.PlineCode)) { MessageUtil.ShowTips("请选择电炉产线!"); return; } if (string.IsNullOrEmpty(entityM.CraftRoute)) { MessageUtil.ShowTips("请选择工艺路径!"); return; } if (entityM.CraftType.Equals("")) { MessageUtil.ShowTips("请选择工艺卡类型!"); return; } if (entityM.GradeNo.Equals("")) { MessageUtil.ShowTips("请输入钢质代码!"); return; } if (entityM.Produccode.Equals("")) { MessageUtil.ShowTips("请选择品名!"); return; } if (entityM.CraftType.Equals("标准卡")) { entityM.CraftType = "A"; } else if (entityM.CraftType.Equals("联络卡")) { entityM.CraftType = "B"; } if (flag.Equals("1")) { if (ultraGrid2.ActiveRow != null) { entityM.Cic= ultraGrid2.ActiveRow.Cells["CIC"].Text; } else entityM.Cic = cic; } else { entityM.Cic = row.Cells["CIC"].Text.ToString(); } jsonListM.Add(JSONFormat.Format(entityM)); } foreach (CraftLg2CicEntity entityCic in listLgCic) { jsonListCic.Add(JSONFormat.Format(entityCic)); } foreach (CraftLg2TarCicEntity entityTar in listTarCic) { if (entityTar.StationCode.Equals("")) { MessageUtil.ShowTips("请选择目标成分工序点!"); return; } if (entityTar.ChemCode.Equals("")) { MessageUtil.ShowTips("请选择目标成分化学元素!"); return; } jsonListTarCic.Add(JSONFormat.Format(entityTar)); } foreach (CraftLg2CcmEntity entityCcm in listLgCcm) { if (entityCcm.CcmCode.Equals("")) { MessageUtil.ShowTips("请选择CCM水表编码!"); return; } jsonListCcm.Add(JSONFormat.Format(entityCcm)); } string stationC = ""; foreach (CraftLg2TemperatureEntity entityTem in listLgTem) { if (entityTem.StationCode.Equals("")) { MessageUtil.ShowTips("请选择温度工序点!"); return; } //stationC = entityTem.StationCode; //foreach (CraftLg2TemperatureEntity entity in listLgTem) //{ // if (entity.StationCode.Equals(stationC)) // { // MessageUtil.ShowTips("相同的工序点在同一个工艺卡下只能选一个!"); // return; // } //} jsonListTem.Add(JSONFormat.Format(entityTem)); } string itemcode = ""; foreach (CraftLg2AlloyEntity entityHj in listLgHj) { if (entityHj.ItemCode.Equals("")) { MessageUtil.ShowTips("物料不能为空!"); return; } if (entityHj.InputAmount == 0 || entityHj.InputAmount==null) { MessageUtil.ShowTips("方案配置量不能为零或为空!"); return; } //itemcode = entityHj.ItemCode; //foreach (CraftLg2AlloyEntity entity in listLgHj) //{ if(entity.ItemCode.Equals("")){ //} jsonListHj.Add(JSONFormat.Format(entityHj)); } #endregion } else { #region 修改 foreach (CraftLg2MEntity entityM in listLgM) { if (entityM.CraftType.Equals("标准卡")) { entityM.CraftType = "A"; } else { entityM.CraftType = "B"; } jsonListM.Add(JSONFormat.Format(entityM)); } foreach (CraftLg2CicEntity entityCic in listLgCic) { jsonListCic.Add(JSONFormat.Format(entityCic)); } foreach (CraftLg2TarCicEntity entityTar in listTarCic) { if (entityTar.TarCicGid.Equals("")) { MessageUtil.ShowTips("修改时不能新增目标成分行!"); return; } jsonListTarCic.Add(JSONFormat.Format(entityTar)); } foreach (CraftLg2CcmEntity entityCcm in listLgCcm) { if (entityCcm.CcmGid.Equals("")) { MessageUtil.ShowTips("修改时不能新增CCM行!"); return; } jsonListCcm.Add(JSONFormat.Format(entityCcm)); } string stationC = ""; foreach (CraftLg2TemperatureEntity entityTem in listLgTem) { if (entityTem.TepGid.Equals("")) { MessageUtil.ShowTips("修改时不能新增温度行!"); return; } //stationC = entityTem.StationCode; //foreach (CraftLg2TemperatureEntity entity in listLgTem) //{ // if (entity.StationCode.Equals(stationC)) // { // MessageUtil.ShowTips("相同的工序点在同一个工艺卡下只能选一个!"); // return; // } //} jsonListTem.Add(JSONFormat.Format(entityTem)); } foreach (CraftLg2AlloyEntity entityHj in listLgHj) { if (entityHj.AlloyGid.Equals("")) { MessageUtil.ShowTips("修改时不能新增合金配置行!"); return; } jsonListHj.Add(JSONFormat.Format(entityHj)); } #endregion } #endregion if (MessageUtil.ShowYesNoAndQuestion(isFlag.Equals("0") ? "是否新增?" : "是否修改?") == DialogResult.No) { return; } PlanComm.WaitFromOpen(this.Cursor); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard"; ccp.MethodName = "doSaveUpdate"; ccp.ServerParams = new object[] { jsonListM, jsonListCic, jsonListTarCic, jsonListCcm, jsonListTem, this.UserInfo.GetUserName(), isFlag, gradCode, jsonListHj }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); PlanComm.WaitFromColse(this.Cursor); if (ccp.ReturnCode == -1) return; MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("新增成功!") || ccp.ReturnInfo.Equals("修改成功!")) { QueryM(); } } /// /// 删除 /// private void doDelete() { ultraGridLgM.UpdateData(); ArrayList listLgM = new ArrayList(); IQueryable ugLgM = ultraGridLgM.Rows.AsQueryable().Where("CHC = 'True'"); if (ugLgM == null || ugLgM.Count() == 0) { MessageUtil.ShowTips("未勾选炼钢工艺主信息!"); return; } else { foreach (UltraGridRow rowLgM in ugLgM) { listLgM.Add((CraftLg2MEntity)rowLgM.ListObject); } } ArrayList jsonListM = new ArrayList(); foreach (CraftLg2MEntity entityM in listLgM) { jsonListM.Add(JSONFormat.Format(entityM)); } if (MessageUtil.ShowYesNoAndQuestion("是否删除?") == DialogResult.No) { return; } PlanComm.WaitFromOpen(this.Cursor); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard"; ccp.MethodName = "doDelete"; ccp.ServerParams = new object[] { jsonListM, furnaceNo, gxPlanSeq, flag }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); PlanComm.WaitFromColse(this.Cursor); if (ccp.ReturnCode == -1) return; if (ccp.ReturnInfo.Equals("删除成功!")) { QueryM(); } } /// /// 确认 /// private void doConfirm() { if (flag == "2") { Falg = true; this.Close(); return; } UltraGridRow row = ultraGridLgM.ActiveRow; if (row == null) return; ultraGridLgM.UpdateData(); ArrayList listLgM = new ArrayList(); IQueryable ugLgM = ultraGridLgM.Rows.AsQueryable().Where("CHC = 'True'"); if (ugLgM == null || ugLgM.Count() == 0) { MessageUtil.ShowTips("未勾选炼钢工艺主信息!"); return; } if (ugLgM.Count() > 1) { MessageUtil.ShowTips("请选择炼钢工艺卡号!"); return; } string craftNo = row.Cells["CraftNo"].Text.ToString(); if (craftNo.Equals("")) { MessageUtil.ShowTips("您选择炼钢工艺卡号未生成,请先保存!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否确认?") == DialogResult.No) { return; } PlanComm.WaitFromOpen(this.Cursor); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard"; ccp.MethodName = "doConfirm"; ccp.ServerParams = new object[] { craftNo, furnaceNo, flag, gxPlanSeq }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); PlanComm.WaitFromColse(this.Cursor); if (ccp.ReturnCode == -1) return; if (ccp.ReturnInfo.Equals("确认成功!")) { Falg = true; this.Close(); } } /// /// 计算 /// private void doCalculate(int temperature) { int count = 0; foreach (UltraGridRow urg in ultraGridLgM.Rows) { if (Convert.ToBoolean(urg.Cells["CHC"].Text) == true) { count++; } } if (count == 0) { MessageUtil.ShowTips("请先勾选工艺卡主信息!"); return; } if (count > 1) { MessageUtil.ShowTips("请勾选一个工艺卡主信息!"); return; } #region 计算液相温度,目标成分EAF C出钢,P出钢 if (temperature == 0) { double Ctemp = 0;//碳温度 double Sitemp = 0;//硅温度 double Mntemp = 0;//锰温度 double Crtemp = 0; double Motemp = 0; double Nitemp = 0; double Cutemp = 0; double Titemp = 0; string Csteel = ""; string Psteel = ""; UltraGridRow urgT = ultraGridLgTarCic.ActiveRow; List list = new List(); foreach (UltraGridRow urg in ultraGridLgCic.Rows) { CraftLg2TarCicEntity CraftLg2TarCicEntity = new entity.CraftLg2TarCicEntity(); double min = 0; if (!urg.Cells["Stdmin"].Text.ToString().Equals("")) { min = double.Parse(urg.Cells["Stdmin"].Text.ToString()); } double max = 0; if (!urg.Cells["Stdmax"].Text.ToString().Equals("")) { max = double.Parse(urg.Cells["Stdmax"].Text.ToString()); } if (urg.Cells["ChemName"].Text.ToString().Equals("C")) { Ctemp = (max + min) / 2; if (min >= 0.20) { Csteel = (min - 0.10).ToString(); } else if (0.10 <= min && min < 0.15) { Csteel = "0.07"; } else if (0.15 <= min && min < 0.20) { Csteel = "0.09"; } else if (min < 0.1) { Csteel = "0.06"; } CraftLg2TarCicEntity.StationCode = "EAF"; CraftLg2TarCicEntity.ChemCode = "C001"; CraftLg2TarCicEntity.ChemName = "C"; CraftLg2TarCicEntity.Stdmax = Csteel; CraftLg2TarCicEntity.StdmaxSign = "<="; list.Add(CraftLg2TarCicEntity); } if (urg.Cells["ChemName"].Text.ToString().Equals("P")) { if (max >= 0.015) { Psteel = (max - 0.005).ToString(); } else if (0.10 <= max && max < 0.015) { Psteel = "0.007"; } else if (max < 0.010) { Psteel = "0.006"; } CraftLg2TarCicEntity.StationCode = "EAF"; CraftLg2TarCicEntity.ChemCode = "C004"; CraftLg2TarCicEntity.ChemName = "P"; CraftLg2TarCicEntity.Stdmax = Psteel; CraftLg2TarCicEntity.StdmaxSign = "<="; list.Add(CraftLg2TarCicEntity); } if (urg.Cells["ChemName"].Text.ToString().Equals("Si")) { Sitemp = (max + min) / 2; } if (urg.Cells["ChemName"].Text.ToString().Equals("Mn")) { Mntemp = (max + min) / 2; } if (urg.Cells["ChemName"].Text.ToString().Equals("Cr")) { if (min != 0) { Mntemp = (max + min) / 2; } } if (urg.Cells["ChemName"].Text.ToString().Equals("Mo")) { if (min != 0) { Motemp = (max + min) / 2; } } if (urg.Cells["ChemName"].Text.ToString().Equals("Ni")) { if (min != 0) { Nitemp = (max + min) / 2; } } if (urg.Cells["ChemName"].Text.ToString().Equals("Cu")) { if (min != 0) { Cutemp = (max + min) / 2; } } if (urg.Cells["ChemName"].Text.ToString().Equals("Ti")) { if (min != 0) { Titemp = (max + min) / 2; } } } CraftLg2TarCicEntityBindingSource.DataSource = list; foreach (UltraGridRow urg in ultraGridLgTarCic.Rows) { urg.Cells["CHC"].Value = true; } temperature = (int)Math.Ceiling(1536 - (88 * Ctemp + 8 * Sitemp + 5 * Mntemp + 1.5 * Crtemp + 5 * Cutemp + 4 * Nitemp + 2 * Motemp + 18 * Titemp + 3)); } UltraGridRow urgM = ultraGridLgM.ActiveRow; List listtep = new List(); CraftLg2TemperatureEntity EntityTep = new entity.CraftLg2TemperatureEntity(); CraftLg2TemperatureEntity EntityTep3 = new entity.CraftLg2TemperatureEntity(); EntityTep3.StationCode = "EAF"; EntityTep3.TepVal1Min = "1630"; EntityTep3.TepVal1Max = "1690"; listtep.Add(EntityTep3); if (string.IsNullOrEmpty(urgM.Cells["PlineCode"].Text) || string.IsNullOrEmpty(urgM.Cells["CraftRoute"].Text)) { MessageUtil.ShowTips("请选择产线和工艺路径!"); return; } if (urgM.Cells["PlineCode"].Text.ToString().Equals("C001"))//一炼钢 { if (urgM.Cells["CraftRoute"].Text.ToString().Contains("V") || urgM.Cells["CraftRoute"].Text.ToString().Contains("R")) { //LF int minLF1 = 120; int maxLF1 = 140; int minLF2 = 100; int maxLF2 = 120; DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "LF" }, ob); if (dt.Rows.Count > 0) { minLF1 = int.Parse(dt.Rows[0]["DEVIATION_NO1"].ToString()); maxLF1 = int.Parse(dt.Rows[0]["DEVIATION_UN1"].ToString()); minLF2 = int.Parse(dt.Rows[0]["DEVIATION_NO2"].ToString()); maxLF2 = int.Parse(dt.Rows[0]["DEVIATION_NU2"].ToString()); } EntityTep.StationCode = "LF"; EntityTep.TepVal1Min = (temperature + minLF1).ToString(); EntityTep.TepVal1Max = (temperature + maxLF1).ToString(); EntityTep.TepVal2Min = (temperature + minLF2).ToString(); EntityTep.TepVal2Max = (temperature + maxLF2).ToString(); EntityTep.TepVal = ""; listtep.Add(EntityTep); //VD int minVD1 = 70; int maxVD1 = 95; int minVD2 = 50; int maxVD2 = 70; DataTable dt1 = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "VD" }, ob); if (dt.Rows.Count > 0) { minVD1 = int.Parse(dt1.Rows[0]["DEVIATION_NO1"].ToString()); maxVD1 = int.Parse(dt1.Rows[0]["DEVIATION_UN1"].ToString()); minVD2 = int.Parse(dt1.Rows[0]["DEVIATION_NO2"].ToString()); maxVD2 = int.Parse(dt1.Rows[0]["DEVIATION_NU2"].ToString()); } CraftLg2TemperatureEntity EntityTep1 = new entity.CraftLg2TemperatureEntity(); //CraftLg2TemperatureEntity EntityTepClone = EntityTep.Clone(); EntityTep1.StationCode = "VD"; EntityTep1.TepVal1Min = (temperature + minVD1).ToString(); EntityTep1.TepVal1Max = (temperature + maxVD1).ToString(); EntityTep1.TepVal2Min = (temperature + minVD2).ToString(); EntityTep1.TepVal2Max = (temperature + maxVD2).ToString(); EntityTep1.TepVal = ""; listtep.Add(EntityTep1); } else {//LF int minLF1 = 70; int maxLF1 = 95; int minLF2 = 50; int maxLF2 = 70; DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "LF" }, ob); if (dt.Rows.Count > 0) { minLF1 = int.Parse(dt.Rows[0]["DEVIATION_NO1"].ToString()); maxLF1 = int.Parse(dt.Rows[0]["DEVIATION_UN1"].ToString()); minLF2 = int.Parse(dt.Rows[0]["DEVIATION_NO2"].ToString()); maxLF2 = int.Parse(dt.Rows[0]["DEVIATION_NU2"].ToString()); } EntityTep.StationCode = "LF"; EntityTep.TepVal1Min = (temperature + minLF1).ToString(); EntityTep.TepVal1Max = (temperature + maxLF1).ToString(); EntityTep.TepVal2Min = (temperature + minLF2).ToString(); EntityTep.TepVal2Max = (temperature + maxLF2).ToString(); EntityTep.TepVal = ""; listtep.Add(EntityTep); } } else if (urgM.Cells["PlineCode"].Text.ToString().Equals("C003"))//二炼钢 { if (urgM.Cells["CraftRoute"].Text.ToString().Contains("V") || urgM.Cells["CraftRoute"].Text.ToString().Contains("R")) { //LF int minLF1 = 130; int maxLF1 = 150; int minLF2 = 110; int maxLF2 = 130; DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "LF" }, ob); if (dt.Rows.Count > 0) { minLF1 = int.Parse(dt.Rows[0]["DEVIATION_NO1"].ToString()); maxLF1 = int.Parse(dt.Rows[0]["DEVIATION_UN1"].ToString()); minLF2 = int.Parse(dt.Rows[0]["DEVIATION_NO2"].ToString()); maxLF2 = int.Parse(dt.Rows[0]["DEVIATION_NU2"].ToString()); } EntityTep.StationCode = "LF"; EntityTep.TepVal1Min = (temperature + minLF1).ToString(); EntityTep.TepVal1Max = (temperature + maxLF1).ToString(); EntityTep.TepVal2Min = (temperature + minLF2).ToString(); EntityTep.TepVal2Max = (temperature + maxLF2).ToString(); EntityTep.TepVal = ""; listtep.Add(EntityTep); //VD int minVD1 = 70; int maxVD1 = 95; int minVD2 = 60; int maxVD2 = 80; DataTable dt1 = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "VD" }, ob); if (dt.Rows.Count > 0) { minVD1 = int.Parse(dt1.Rows[0]["DEVIATION_NO1"].ToString()); maxVD1 = int.Parse(dt1.Rows[0]["DEVIATION_UN1"].ToString()); minVD2 = int.Parse(dt1.Rows[0]["DEVIATION_NO2"].ToString()); maxVD2 = int.Parse(dt1.Rows[0]["DEVIATION_NU2"].ToString()); } CraftLg2TemperatureEntity EntityTep1 = new entity.CraftLg2TemperatureEntity(); EntityTep1.StationCode = "VD"; EntityTep1.TepVal1Min = (temperature + minVD1).ToString(); EntityTep1.TepVal1Max = (temperature + maxVD1).ToString(); EntityTep1.TepVal2Min = (temperature + minVD2).ToString(); EntityTep1.TepVal2Max = (temperature + maxVD2).ToString(); EntityTep1.TepVal = ""; listtep.Add(EntityTep1); } else { //LF int minLF1 = 70; int maxLF1 = 95; int minLF2 = 60; int maxLF2 = 80; DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "LF" }, ob); if (dt.Rows.Count > 0) { minLF1 = int.Parse(dt.Rows[0]["DEVIATION_NO1"].ToString()); maxLF1 = int.Parse(dt.Rows[0]["DEVIATION_UN1"].ToString()); minLF2 = int.Parse(dt.Rows[0]["DEVIATION_NO2"].ToString()); maxLF2 = int.Parse(dt.Rows[0]["DEVIATION_NU2"].ToString()); } EntityTep.StationCode = "LF"; EntityTep.TepVal1Min = (temperature + minLF1).ToString(); EntityTep.TepVal1Max = (temperature + maxLF1).ToString(); EntityTep.TepVal2Min = (temperature + minLF2).ToString(); EntityTep.TepVal2Max = (temperature + maxLF2).ToString(); EntityTep.TepVal = ""; listtep.Add(EntityTep); } } else if (urgM.Cells["PlineCode"].Text.ToString().Equals("C006"))//三炼钢 { if (urgM.Cells["CraftRoute"].Text.ToString().Contains("V") || urgM.Cells["CraftRoute"].Text.ToString().Contains("R")) { //LF int minLF1 = 130; int maxLF1 = 150; int minLF2 = 110; int maxLF2 = 130; DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "LF" }, ob); if (dt.Rows.Count > 0) { minLF1 = int.Parse(dt.Rows[0]["DEVIATION_NO1"].ToString()); maxLF1 = int.Parse(dt.Rows[0]["DEVIATION_UN1"].ToString()); minLF2 = int.Parse(dt.Rows[0]["DEVIATION_NO2"].ToString()); maxLF2 = int.Parse(dt.Rows[0]["DEVIATION_NU2"].ToString()); } EntityTep.StationCode = "LF"; EntityTep.TepVal1Min = (temperature + minLF1).ToString(); EntityTep.TepVal1Max = (temperature + maxLF1).ToString(); EntityTep.TepVal2Min = (temperature + minLF2).ToString(); EntityTep.TepVal2Max = (temperature + maxLF2).ToString(); EntityTep.TepVal = ""; listtep.Add(EntityTep); //VD int minRH1 = 75; int maxRH1 = 95; int minRH2 = 60; int maxRH2 = 80; DataTable dt1 = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "RH" }, ob); if (dt.Rows.Count > 0) { minRH1 = int.Parse(dt1.Rows[0]["DEVIATION_NO1"].ToString()); maxRH1 = int.Parse(dt1.Rows[0]["DEVIATION_UN1"].ToString()); minRH2 = int.Parse(dt1.Rows[0]["DEVIATION_NO2"].ToString()); maxRH2 = int.Parse(dt1.Rows[0]["DEVIATION_NU2"].ToString()); } CraftLg2TemperatureEntity EntityTep1 = new entity.CraftLg2TemperatureEntity(); EntityTep1.StationCode = "RH"; EntityTep1.TepVal1Min = (temperature + minRH1).ToString(); EntityTep1.TepVal1Max = (temperature + maxRH1).ToString(); EntityTep1.TepVal2Min = (temperature + minRH2).ToString(); EntityTep1.TepVal2Max = (temperature + maxRH2).ToString(); EntityTep1.TepVal = ""; listtep.Add(EntityTep1); } else {//LF int minLF1 = 75; int maxLF1 = 95; int minLF2 = 60; int maxLF2 = 80; DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "LF" }, ob); if (dt.Rows.Count > 0) { minLF1 = int.Parse(dt.Rows[0]["DEVIATION_NO1"].ToString()); maxLF1 = int.Parse(dt.Rows[0]["DEVIATION_UN1"].ToString()); minLF2 = int.Parse(dt.Rows[0]["DEVIATION_NO2"].ToString()); maxLF2 = int.Parse(dt.Rows[0]["DEVIATION_NU2"].ToString()); } EntityTep.StationCode = "LF"; EntityTep.TepVal1Min = (temperature + minLF1).ToString(); EntityTep.TepVal1Max = (temperature + maxLF1).ToString(); EntityTep.TepVal2Min = (temperature + minLF2).ToString(); EntityTep.TepVal2Max = (temperature + maxLF2).ToString(); EntityTep.TepVal = ""; listtep.Add(EntityTep); } } CraftLg2TemperatureEntity EntityTep2 = new entity.CraftLg2TemperatureEntity(); EntityTep2.StationCode = "CCM"; EntityTep2.TepVal = temperature.ToString(); listtep.Add(EntityTep2); CraftLg2TemperatureEntitySource.DataSource = listtep; foreach (UltraGridRow urg in ultraGridLhTem.Rows) { urg.Cells["CHC"].Value = true; if (urg.Cells["StationCode"].Text.Equals("EAF")) { urg.Cells["TepVal1Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128); urg.Cells["TepVal1Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128); urg.Cells["TepVal2Min"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal2Max"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal1Min"].Activation = Activation.AllowEdit; urg.Cells["TepVal1Max"].Activation = Activation.AllowEdit; urg.Cells["TepVal1Min"].IgnoreRowColActivation = true; urg.Cells["TepVal1Max"].IgnoreRowColActivation = true; urg.Cells["TepVal2Min"].Activation = Activation.ActivateOnly; urg.Cells["TepVal2Max"].Activation = Activation.ActivateOnly; urg.Cells["TepVal"].Activation= Activation.ActivateOnly; } else if (urg.Cells["StationCode"].Text.Equals("CCM")) { urg.Cells["TepVal1Min"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal1Max"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal2Min"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal2Max"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal"].Appearance.BackColor = Color.FromArgb(255, 255, 128); urg.Cells["TepVal1Min"].Activation = Activation.ActivateOnly; urg.Cells["TepVal1Max"].Activation = Activation.ActivateOnly; urg.Cells["TepVal2Min"].Activation = Activation.ActivateOnly; urg.Cells["TepVal2Max"].Activation = Activation.ActivateOnly; urg.Cells["TepVal"].Activation = Activation.AllowEdit; urg.Cells["TepVal"].IgnoreRowColActivation = true; } else { urg.Cells["TepVal1Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128); urg.Cells["TepVal1Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128); urg.Cells["TepVal2Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128); urg.Cells["TepVal2Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128); urg.Cells["TepVal"].Appearance.BackColor = Color.Transparent; urg.Cells["TepVal1Min"].Activation = Activation.AllowEdit; urg.Cells["TepVal1Max"].Activation = Activation.AllowEdit; urg.Cells["TepVal2Min"].Activation = Activation.AllowEdit; urg.Cells["TepVal2Max"].Activation = Activation.AllowEdit; urg.Cells["TepVal1Min"].IgnoreRowColActivation = true; urg.Cells["TepVal1Max"].IgnoreRowColActivation = true; urg.Cells["TepVal2Min"].IgnoreRowColActivation = true; urg.Cells["TepVal2Max"].IgnoreRowColActivation = true; urg.Cells["TepVal"].Activation = Activation.ActivateOnly; } } #endregion } private void chcCraftNo_CheckedChanged(object sender, EventArgs e) { if (chcCraftNo.Checked) { comCraftNo.Enabled = true; } else { comCraftNo.Enabled = false; } if (chcAPline.Checked) { comAPline.Enabled = true; } else { comAPline.Enabled = false; } if (chcGrade.Checked) { comGrade.Enabled = true; } else { comGrade.Enabled = false; } } #region 事件 private void ultraGridLgTarCic_CellChange(object sender, CellEventArgs e) { int count = 0; foreach (UltraGridRow urg in ultraGridLgM.Rows) { if (Convert.ToBoolean(urg.Cells["CHC"].Text) == true) { count++; } } if (count == 0) { MessageUtil.ShowTips("请先勾选工艺卡主信息!"); return; } if (count >1) { MessageUtil.ShowTips("请勾选一个工艺卡主信息!"); return; } UltraGridRow row = ultraGridLgTarCic.ActiveRow; if (row == null) return; ultraGridLgTarCic.UpdateData(); #region 获取C,P上限 string Csteel = ""; string Psteel = ""; foreach (UltraGridRow urg in ultraGridLgCic.Rows) { CraftLg2TarCicEntity CraftLg2TarCicEntity = new entity.CraftLg2TarCicEntity(); double min = 0; if (!urg.Cells["Stdmin"].Text.ToString().Equals("")) { min = double.Parse(urg.Cells["Stdmin"].Text.ToString()); } double max = 0; if (!urg.Cells["Stdmax"].Text.ToString().Equals("")) { max = double.Parse(urg.Cells["Stdmax"].Text.ToString()); } if (urg.Cells["ChemName"].Text.ToString().Equals("C")) { if (min >= 0.20) { Csteel = (min - 0.10).ToString(); } else if (0.10 <= min && min < 0.15) { Csteel = "0.07"; } else if (0.15 <= min && min < 0.20) { Csteel = "0.09"; } else if (min < 0.1) { Csteel = "0.06"; } } if (urg.Cells["ChemName"].Text.ToString().Equals("P")) { if (max >= 0.015) { Psteel = (max - 0.005).ToString(); } else if (0.10 <= max && max < 0.015) { Psteel = "0.007"; } else if (max < 0.010) { Psteel = "0.006"; } } } #endregion if (e.Cell.Column.Key.Equals("ChemCode")) { e.Cell.Row.Cells["ChemCode"].Value = e.Cell.Value; e.Cell.Row.Cells["ChemName"].Value = e.Cell.Text; if (e.Cell.Row.Cells["StationCode"].Text.ToString().Equals("EAF")) { if (e.Cell.Row.Cells["ChemName"].Text.ToString().Equals("C")) { e.Cell.Row.Cells["Stdmax"].Value = Csteel; e.Cell.Row.Cells["StdmaxSign"].Value = "<="; } else if (e.Cell.Row.Cells["ChemName"].Text.ToString().Equals("C")) { e.Cell.Row.Cells["Stdmax"].Value = Psteel; e.Cell.Row.Cells["StdmaxSign"].Value = "<="; } } } listTarCic.Change((CraftLg2TarCicEntity)e.Cell.Row.ListObject); } /// /// 工艺主信息新增事件 /// /// /// private void ultraGridLgM_AfterRowInsert(object sender, RowEventArgs e) { UltraGridRow row = ultraGridLgM.ActiveRow; ultraGridLgM.UpdateData(); ////查询最大工艺卡号 //DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryMaxCraftNo", new object[] { gradCode }, ob); DataTable dt1 = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryStdCic", new object[] { cic }, ob); //if (dt.Rows.Count > 0) //{ // row.Cells["CraftNo"].Value = dt.Rows[0]["CRAFT_NO"].ToString(); //} if (dt1.Rows.Count > 0) { row.Cells["StdCodeNk"].Value = dt1.Rows[0]["STD_CODE"].ToString(); row.Cells["StdNameNk"].Value = dt1.Rows[0]["STD_NAME"].ToString(); row.Cells["StdVersion"].Value = dt1.Rows[0]["STD_VERSION"].ToString(); if (dt1.Rows[0]["STD_NAME"].ToString().Contains("NSYK") || cic.Contains(",")) { row.Cells["CraftType"].Value = "B"; } else { row.Cells["CraftType"].Value = "A"; } } //查询品名 DataTable dt2 = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryProdu", new object[] { furnaceNo ,flag}, ob); if (dt2.Rows.Count> 0) { row.Cells["Produccode"].Value = dt2.Rows[0]["PRODUCCODE"].ToString(); row.Cells["Producname"].Value = dt2.Rows[0]["PRODUCNAME"].ToString(); } row.Cells["GradeCode"].Value = gradCode; row.Cells["GradeName"].Value = gradName; row.Cells["PlineCode"].Value = plineCodeA; row.Cells["PlineName"].Value = plineNameA; row.Cells["CraftRoute"].Value = planRoute; //row.Cells["Cic"].Value = row.Cells["CIC"].Text.ToString(); row.Cells["MarkMan"].Value = this.UserInfo.GetUserName(); if (flag == "2") { UltraComboEditor ucePath = new UltraComboEditor(); e.Row.Cells["CraftRoute"].EditorComponent = ucePath; e.Row.Cells["CraftRoute"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; e.Row.Cells["CraftRoute"].IgnoreRowColActivation = true; ValueList vlistSteel = new ValueList(); ; vlistSteel.ValueListItems.Insert(0, "ELC", "ELC"); vlistSteel.ValueListItems.Insert(1, "ELVC", "ELVC"); vlistSteel.ValueListItems.Insert(2, "ELRC", "ELRC"); vlistSteel.ValueListItems.Insert(3, "ELVI", "ELVI"); vlistSteel.ValueListItems.Insert(4, "RLRI", "RLRI"); e.Row.Cells["CraftRoute"].ValueList = vlistSteel; e.Row.Cells["CraftRoute"].Activation = Activation.AllowEdit; e.Row.Cells["CraftRoute"].Appearance.BackColor = Color.FromArgb(255, 255, 128); e.Row.Cells["PlineCode"].IgnoreRowColActivation = true; e.Row.Cells["PlineCode"].Activation = Activation.AllowEdit; e.Row.Cells["PlineCode"].Appearance.BackColor = Color.FromArgb(255, 255, 128); } } private void ultraGridLgM_AfterRowActivate(object sender, EventArgs e) { UltraGridRow row = ultraGridLgM.ActiveRow; if (row == null) return; if (row.Cells["CicGid"].Text.ToString().Equals("")) { //if (flag.Equals("1")) //{ // ultraExpandableGroupBox2.Visible = false; // if (cic.Split(',').Length > 1) // { // queryOrdDesigJJCic(); // } // else // { // queryOrdDesigStdCic(); // } //} //else //{ ultraExpandableGroupBox2.Expanded = true; queryOrdDesigCic(row.Cells["Cic"].Text.ToString()); //} } else { queryOrdDesigCic(row.Cells["Cic"].Text.ToString()); ultraExpandableGroupBox2.Expanded = false; QueryLgCic(row.Cells["CicGid"].Text.ToString()); } QueryLgTarCic(row.Cells["TarCicGid"].Text.ToString()); QueryLgCcm(row.Cells["CcmGid"].Text.ToString()); QueryLgtTem(row.Cells["TepGid"].Text.ToString()); if (Convert.ToBoolean(row.Cells["CHC"].Text)==true) { ultraTabControl1.Enabled = true; } else { ultraTabControl1.Enabled = false; } //合金配置为空是根据钢种获取 if (row.Cells["AlloyGid"].Text.ToString().Equals("")) { listHj = EntityHelper.GetData ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgtHjGrae", new object[] { gradCode,"" }, ob); listHj.AcceptChanges(); CraftLg2AlloyEntityBindingSource.DataSource = listHj; foreach (UltraGridRow urg in ultraGridhJ.Rows) { urg.Cells["CHC"].Value = true; } } else { QueryLgHj(row.Cells["AlloyGid"].Text.ToString()); } } private void ultraGridLgM_BeforeRowDeactivate(object sender, CancelEventArgs e) { if (listCic.IsChanged) { if (MessageUtil.ShowYesNoAndQuestion("是否放弃成分CIC编辑?") == DialogResult.No) { e.Cancel = true; } } if (listTarCic != null) { if (listTarCic.IsChanged) { if (MessageUtil.ShowYesNoAndQuestion("是否放弃目标成分CIC编辑?") == DialogResult.No) { e.Cancel = true; } } } if (listCcm != null) { if (listCcm.IsChanged) { if (MessageUtil.ShowYesNoAndQuestion("是否放弃CCM编辑?") == DialogResult.No) { e.Cancel = true; } } } if (listTem != null) { if (listTem.IsChanged) { if (MessageUtil.ShowYesNoAndQuestion("是否放弃温度编辑?") == DialogResult.No) { e.Cancel = true; } } } if (listHj != null) { if (listHj.IsChanged) { if (MessageUtil.ShowYesNoAndQuestion("是否放弃合金配置编辑?") == DialogResult.No) { e.Cancel = true; } } } } private void ultraGridLgCic_CellChange(object sender, CellEventArgs e) { int count = 0; /*foreach (UltraGridRow urg in ultraGridLgM.Rows) { if (Convert.ToBoolean(urg.Cells["CHC"].Text) == true) { count++; } } if (count == 0) { MessageUtil.ShowTips("请先勾选工艺卡主信息!"); return; } if (count > 1) { MessageUtil.ShowTips("请勾选一个工艺卡主信息!"); return; }*/ ultraGridLgCic.UpdateData(); if (e.Cell.Column.Key == "ChemCode") { DataTable dt1 = uceCicAll.DataSource as DataTable; if (dt1 != null) { DataRow dr = dt1.AsEnumerable().FirstOrDefault(p => p["CHEM_CODE"] == e.Cell.Value); if (dr != null) { e.Cell.Row.Cells["ChemType"].Value = dr["CHEM_TYPE"] is DBNull ? "" : dr["CHEM_TYPE"]; e.Cell.Row.Cells["ChemFormula"].Value = dr["CHEM_FORMULA"] is DBNull ? "" : dr["CHEM_FORMULA"]; e.Cell.Row.Cells["ChemName"].Value = dr["CHEM_NAME"] is DBNull ? "" : dr["CHEM_NAME"]; } } } UltraGridRow row = ultraGridLgCic.ActiveRow; if (row == null) return; if (listCic!=null) { listCic.Change((CraftLg2CicEntity)e.Cell.Row.ListObject); } //string oldStdMax = row.Cells["Stdmax"].Text.ToString(); //if (e.Cell.Column.Key.Equals("Stdmin")) //{ // string oldStdMin = ""; // foreach (CraftLg2CicEntity entity in listCic) // { // if (entity.ChemName.Equals(e.Cell.Row.Cells["ChemName"].Text.ToString())) // { // oldStdMin = row.Cells["Stdmin"].Text.ToString(); // break; // } // } // string actCountMin = e.Cell.Row.Cells["Stdmin"].Text.ToString(); // if (actCountMin != null && !StringUtil.IsFloat(actCountMin)) // { // MessageUtil.ShowTips("请输入数字类型!"); // row.Cells["Stdmin"].Value = ""; // return; // } // else // { // if (double.Parse(actCountMin) < double.Parse(oldStdMin)) // { // MessageUtil.ShowTips("输入标准下限不能小于原标准下限!"); // row.Cells["Stdmin"].Value = oldStdMin; // return; // } // else // { // row.Cells["Stdmin"].Value = actCountMin; // } // } //} //if (e.Cell.Column.Key.Equals("Stdmax")) //{ // string actCountMax = e.Cell.Row.Cells["Stdmax"].Text.ToString(); // if (actCountMax != null && !StringUtil.IsFloat(actCountMax)) // { // MessageUtil.ShowTips("请输入数字类型!"); // row.Cells["Stdmin"].Value = ""; // return; // } // else // { // if (double.Parse(actCountMax) > double.Parse(oldStdMax)) // { // MessageUtil.ShowTips("输入标准上限不能大于原标准上限!"); // row.Cells["Stdmax"].Value = oldStdMax; // return; // } // else // { // row.Cells["Stdmax"].Value = actCountMax; // } // } //} } private void ultraGridLgCcm_CellChange(object sender, CellEventArgs e) { int count = 0; foreach (UltraGridRow urg in ultraGridLgM.Rows) { if (Convert.ToBoolean(urg.Cells["CHC"].Text) == true) { count++; } } if (count == 0) { MessageUtil.ShowTips("请先勾选工艺卡主信息!"); return; } if (count > 1) { MessageUtil.ShowTips("请勾选一个工艺卡主信息!"); return; } UltraGridRow row = ultraGridLgCcm.ActiveRow; if (row == null) return; ultraGridLgCcm.UpdateData(); string ccmName = ""; if (e.Cell.Column.Key.Equals("CcmCode")) { if (!e.Cell.Row.Cells["CcmCode"].Text.ToString().Equals("")) { DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseCcm", new object[] { plineCodeB, gradCode, cic }, ob); if (dt.Rows.Count> 0) { e.Cell.Row.Cells["Diameter"].Value = dt.Rows[0]["直径"].ToString(); e.Cell.Row.Cells["WaterNo"].Value = dt.Rows[0]["水表号"].ToString(); e.Cell.Row.Cells["CoolingVal"].Value = dt.Rows[0]["冷却强度"].ToString(); } int counntcm = 0; foreach (UltraGridRow rows in ultraGridLgCcm.Rows) { if (ccmName.Equals("")) { ccmName = e.Cell.Row.Cells["CcmCode"].Value.ToString(); } if (ccmName.Equals(rows.Cells["CcmCode"].Text.ToString()) && !ccmName.Equals("")) { counntcm++; } } if (counntcm > 1) { MessageUtil.ShowTips("存在相同水表数据!"); e.Cell.Row.Cells["Diameter"].Value = ""; e.Cell.Row.Cells["WaterNo"].Value = ""; e.Cell.Row.Cells["CoolingVal"].Value = ""; e.Cell.Row.Cells["CcmCode"].Value = ""; return; } } } if (listCcm!=null) { listCcm.Change((CraftLg2CcmEntity)e.Cell.Row.ListObject); } } private void ultraGridLhTem_CellChange(object sender, CellEventArgs e) { int count = 0; foreach (UltraGridRow urg in ultraGridLgM.Rows) { if (Convert.ToBoolean(urg.Cells["CHC"].Text) == true) { count++; } } if (count == 0) { MessageUtil.ShowTips("请先勾选工艺卡主信息!"); return; } if (count >1) { MessageUtil.ShowTips("请勾选一个工艺卡主信息!"); return; } UltraGridRow row = ultraGridLhTem.ActiveRow; if (row == null) return; ultraGridLhTem.UpdateData(); if (e.Cell.Column.Key.Equals("StationCode")) { if (e.Cell.Row.Cells["StationCode"].Text.Equals("EAF")) { e.Cell.Row.Cells["TepVal1Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128); e.Cell.Row.Cells["TepVal1Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128); e.Cell.Row.Cells["TepVal2Min"].Appearance.BackColor = Color.Transparent; e.Cell.Row.Cells["TepVal2Max"].Appearance.BackColor = Color.Transparent; e.Cell.Row.Cells["TepVal"].Appearance.BackColor = Color.Transparent; e.Cell.Row.Cells["TepVal1Min"].Activation = Activation.AllowEdit; e.Cell.Row.Cells["TepVal1Max"].Activation = Activation.AllowEdit; e.Cell.Row.Cells["TepVal1Min"].IgnoreRowColActivation = true; e.Cell.Row.Cells["TepVal1Max"].IgnoreRowColActivation = true; e.Cell.Row.Cells["TepVal2Min"].Activation = Activation.ActivateOnly; e.Cell.Row.Cells["TepVal2Max"].Activation = Activation.ActivateOnly; e.Cell.Row.Cells["TepVal"].Activation = Activation.ActivateOnly; } else if (e.Cell.Row.Cells["StationCode"].Text.Equals("CCM")) { e.Cell.Row.Cells["TepVal1Min"].Appearance.BackColor = Color.Transparent; e.Cell.Row.Cells["TepVal1Max"].Appearance.BackColor = Color.Transparent; e.Cell.Row.Cells["TepVal2Min"].Appearance.BackColor = Color.Transparent; e.Cell.Row.Cells["TepVal2Max"].Appearance.BackColor = Color.Transparent; e.Cell.Row.Cells["TepVal"].Appearance.BackColor = Color.FromArgb(255, 255, 128); e.Cell.Row.Cells["TepVal1Min"].Activation = Activation.ActivateOnly; e.Cell.Row.Cells["TepVal1Max"].Activation = Activation.ActivateOnly; e.Cell.Row.Cells["TepVal2Min"].Activation = Activation.ActivateOnly; e.Cell.Row.Cells["TepVal2Max"].Activation = Activation.ActivateOnly; e.Cell.Row.Cells["TepVal"].Activation = Activation.AllowEdit; e.Cell.Row.Cells["TepVal"].IgnoreRowColActivation = true; } else { e.Cell.Row.Cells["TepVal1Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128); e.Cell.Row.Cells["TepVal1Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128); e.Cell.Row.Cells["TepVal2Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128); e.Cell.Row.Cells["TepVal2Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128); e.Cell.Row.Cells["TepVal"].Appearance.BackColor = Color.Transparent; e.Cell.Row.Cells["TepVal1Min"].Activation = Activation.AllowEdit; e.Cell.Row.Cells["TepVal1Max"].Activation = Activation.AllowEdit; e.Cell.Row.Cells["TepVal2Min"].Activation = Activation.AllowEdit; e.Cell.Row.Cells["TepVal2Max"].Activation = Activation.AllowEdit; e.Cell.Row.Cells["TepVal1Min"].IgnoreRowColActivation = true; e.Cell.Row.Cells["TepVal1Max"].IgnoreRowColActivation = true; e.Cell.Row.Cells["TepVal2Min"].IgnoreRowColActivation = true; e.Cell.Row.Cells["TepVal2Max"].IgnoreRowColActivation = true; e.Cell.Row.Cells["TepVal"].Activation = Activation.ActivateOnly; } int count1 = 0; foreach (UltraGridRow urg in ultraGridLhTem.Rows) { if (e.Cell.Row.Cells["StationCode"].Text.Equals(urg.Cells["StationCode"].Text.ToString())) { count1++; if (count1 > 1) { MessageUtil.ShowTips("一个工艺卡下对应的工序点不能重复!"); e.Cell.Row.Cells["StationCode"].Value = null; return; } } } } //计算温度 if (e.Cell.Column.Key.Equals("TepVal")) { if (e.Cell.Row.Cells["StationCode"].Text.Equals("CCM")) { doCalculate(int.Parse(e.Cell.Row.Cells["TepVal"].Value.ToString())); } } if (listTem != null && listTem.Count!=0) { listTem.Change((CraftLg2TemperatureEntity)e.Cell.Row.ListObject); } } private void ultraGridLgM_CellChange(object sender, CellEventArgs e) { UltraGridRow ugr=ultraGridLgM.ActiveRow; if (ugr == null) return; ultraGridLgM.UpdateData(); if (e.Cell.Column.Key.Equals("Produccode")) { e.Cell.Row.Cells["Produccode"].Value = e.Cell.Value.ToString(); e.Cell.Row.Cells["Producname"].Value = e.Cell.Text; } if (Convert.ToBoolean(e.Cell.Row.Cells["CHC"].Text) == true) { ultraTabControl1.Enabled = true; } else { ultraTabControl1.Enabled = false; } } private void ultraGridhJ_CellChange(object sender, CellEventArgs e) { UltraGridRow row = ultraGridhJ.ActiveRow; if (row == null) return; ultraGridhJ.UpdateData(); if (e.Cell.Column.Key.Equals("ItemCode")) { if (!e.Cell.Row.Cells["ItemCode"].Text.ToString().Equals("")) { e.Cell.Row.Cells["ItemCode"].Value = e.Cell.Value.ToString(); e.Cell.Row.Cells["ItemName"].Value = e.Cell.Text.ToString(); DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgtHjGrae", new object[] { gradCode, e.Cell.Value.ToString() }, ob); if (dt.Rows.Count > 0) { e.Cell.Row.Cells["InputAmount"].Value = dt.Rows[0]["INPUT_AMOUNT"].ToString(); } else { e.Cell.Row.Cells["InputAmount"].Value = "0"; } } int count = 0; foreach (UltraGridRow urg in ultraGridhJ.Rows) { if (e.Cell.Row.Cells["ItemCode"].Value.Equals(urg.Cells["ItemCode"].Value.ToString())) { count++; if (count > 1) { MessageUtil.ShowTips("一个工艺卡下对应的合金物料不能重复!"); e.Cell.Row.Cells["ItemCode"].Value = null; e.Cell.Row.Cells["ItemName"].Value = null; e.Cell.Row.Cells["InputAmount"].Value = null; return; } } } } if (listHj != null) { listHj.Change((CraftLg2AlloyEntity)e.Cell.Row.ListObject); } } #endregion private DataTable _data1; private void ultraGrid2_AfterRowActivate(object sender, EventArgs e) { UltraGridRow row = ultraGrid2.ActiveRow; if (row == null) return; ultraGrid2.UpdateData(); _data1 = SteelHelper.GetNewDataTable(dtCicAll, "CIC='" + row.Cells["CIC"].Text.ToString() + "'", "CHEMCODE ASC"); //_data1 = dataTable2.AsEnumerable().Where(p => p["CIC"] == row.Cells["CIC"].Text.ToString()).ConvertToDataTable(); listCic =SteelHelper.GetModelByDt(_data1); listCic.AcceptChanges(); CraftLg2CicEntityBindingSource.DataSource = listCic; int count=1; foreach (UltraGridRow urg in ultraGridLgCic.Rows) { urg.Cells["CHC"].Value = true; urg.Cells["Xh"].Value = (decimal)count++; } queryComBaseCcm(row.Cells["CIC"].Text.ToString()); //ultraGrid2.Refresh(); //ultraGrid2.Update(); } private void ultraGridLgM_InitializeRow(object sender, InitializeRowEventArgs e) { CraftLg2MEntity CraftLg2MEntity = e.Row.ListObject as CraftLg2MEntity; if (CraftLg2MEntity != null && CraftLg2MEntity.Defaultcraft != "1" && CraftLg2MEntity.Defaultcraft != "默认") { e.Row.Cells["Defaultcraft"].IgnoreRowColActivation = true; e.Row.Cells["Defaultcraft"].EditorComponent = setDefault; } } private void setDefault_EditorButtonClick(object sender, EditorButtonEventArgs e) { string craftNo = ultraGridLgM.ActiveRow.Cells["CraftNo"].Text.ToString(); if (craftNo.Equals("")) { MessageUtil.ShowTips("您选择炼钢工艺卡号未生成,请先保存!"); return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard"; ccp.MethodName = "doSetDefault"; ccp.ServerParams = new object[] { cic, craftNo, plineCodeA, gradCode, planRoute }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) return; MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("设置成功!")) { QueryM(); } } private void ultraGridLgCic_AfterRowInsert(object sender, RowEventArgs e) { e.Row.Cells["Newflag"].Value = "1"; e.Row.Cells["Xh"].Value = (decimal)(e.Row.Index + 1); e.Row.Cells["CicGid"].Value = ultraGridLgM.ActiveRow.Cells["CicGid"].Value; } private void ultraGridLgCic_InitializeRow(object sender, InitializeRowEventArgs e) { if (e.Row.Cells["Newflag"].Value.ToString() == "1") { e.Row.Cells["ChemCode"].Activation = Activation.AllowEdit; e.Row.Cells["ChemCode"].IgnoreRowColActivation = true; e.Row.Cells["ChemCode"].Appearance.BackColor = Color.FromArgb(255, 255, 128); e.Row.Cells["BIscheck"].Activation = Activation.AllowEdit; e.Row.Cells["BIscheck"].IgnoreRowColActivation = true; e.Row.Cells["BIscheck"].Appearance.BackColor = Color.FromArgb(255, 255, 128); e.Row.Cells["BIsjudge"].Activation = Activation.AllowEdit; e.Row.Cells["BIsjudge"].IgnoreRowColActivation = true; e.Row.Cells["BIsjudge"].Appearance.BackColor = Color.FromArgb(255, 255, 128); e.Row.Cells["BIsquote"].Activation = Activation.AllowEdit; e.Row.Cells["BIsquote"].IgnoreRowColActivation = true; e.Row.Cells["BIsquote"].Appearance.BackColor = Color.FromArgb(255, 255, 128); e.Row.Cells["Xh"].Style = ColumnStyle.EditButton; } } private void ultraGridLgCic_ClickCellButton(object sender, CellEventArgs e) { e.Cell.Row.Delete(false); } private void utlCopy_EditorButtonClick(object sender, EditorButtonEventArgs e) { using (FrmSteelProcessSelect FrmSteelProcessSelect = new FrmSteelProcessSelect(ultraGrid2.ActiveRow.Cells[0].Text,ob)) { if (FrmSteelProcessSelect.ShowDialog() == DialogResult.OK) { QueryLgCic(FrmSteelProcessSelect.CraftLg2MEntity.CicGid); } } } private void ultraGrid2_InitializeRow(object sender, InitializeRowEventArgs e) { if (e.Row.Cells[0].Text != "" && !e.Row.Cells[0].Text.Contains(",")) { e.Row.Cells[0].EditorComponent = utlCopy; e.Row.Cells[0].IgnoreRowColActivation = true; } } } }