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 Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.PlnSaleOrd.BaseMethod; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using Core.StlMes.Client.PlnSaleOrd.炼钢计划; using Core.StlMes.Client.PlnSaleOrd.炼钢计划.entity; using Core.Mes.Client.Comm.Control; namespace Core.StlMes.Client.PlnSaleOrd { public partial class FrmBaseMaterialAPl : FrmBase { private string _inMaterialNo = ""; private string _outMaterialNo = ""; private string _inMaterialDesc = ""; private string _outMaterialDesc = ""; private string _plineCode = ""; //public FrmBaseMaterialAPl() //{ // InitializeComponent(); //} public FrmBaseMaterialAPl() { this.ob = ob; InitializeComponent(); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; } private void FrmBaseMaterialBPl_Load(object sender, EventArgs e) { EntityHelper.ShowGridCaption(ultraGridZz.DisplayLayout.Bands[0]); BaseHelper.setColumnBackColor(ultraGridZz, new string[] { "HrCapcty", "PrdRate", "DisableFl", "PlineCode", "PlineLevel" }); BaseHelper.InitCellPosition(ultraGridZz, new string[] { "HrCapcty", "PrdRate", "DisableFl", "PlineLevel" }); //InitMaterial(); SteelHelper.InitPline(comEfPlin, "A", this.ob); SteelHelper.InitGrade(comGrade, this.ob); Query(); } private void InitMaterial() { DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmBasematerialAPl.getBaseMaterialB", new object[] { _inMaterialNo, _outMaterialNo }, this.ob); if (dt != null && dt.Rows.Count > 0) { _inMaterialDesc = dt.Rows[0]["IN_MATERIAL_DESC"].ToString(); _outMaterialDesc = dt.Rows[0]["OUT_MATERIAL_DESC"].ToString(); } } public void Query() { string grade = ""; string plineCode = ""; if (chkEfPlin.Checked && comEfPlin.Value != null) { plineCode = comEfPlin.Value.ToString(); } if (plineCode == null) { MessageUtil.ShowWarning("请选择电炉产线!"); return; } if (chcGrade.Checked && comGrade.Value != null) { grade = comGrade.Value.ToString(); } if (grade == null) { MessageUtil.ShowWarning("请选择产出物料!"); return; } List materialAPlEntityList = EntityHelper.GetData( "com.steering.pss.plnsaleord.steelMarkingPlan.FrmBasematerialAPl.getBaseMaterialAPl", new object[] { plineCode, grade }, ob); slmBaseMaterialAPlEntityBindingSource.DataSource = materialAPlEntityList; GridHelper.RefreshAndAutoSize(ultraGridZz); if (!_plineCode.Equals("")) { IQueryable chcRows = ultraGridZz.Rows.AsQueryable().Where(a => a.GetValue("PlineCode") == _plineCode); if (chcRows != null && chcRows.Count() != 0) { chcRows.First().Activate(); chcRows.First().Cells["CHC"].Value = true; } } } private void update() { try { ultraGridZz.UpdateData(); IQueryable chcRows = ultraGridZz.Rows.AsQueryable().Where(a => a.GetValue("CHC") == "True"); if (chcRows == null || chcRows.Count() == 0) { MessageUtil.ShowTips("请选择记录!"); return; } ArrayList param = new ArrayList(); foreach (UltraGridRow ugr in chcRows) { SlmBaseMaterialAPlEntity entity = (SlmBaseMaterialAPlEntity)ugr.ListObject; entity.UpdateName = UserInfo.GetUserName(); string jsonStr = JSONFormat.Format(entity); param.Add(jsonStr); } if (MessageUtil.ShowYesNoAndQuestion("是否修改记录?") == DialogResult.No) { return; } ServerHelper.SetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmBasematerialAPl.updateBaseMaterialAPl", new object[] { param }, this.ob); Query(); MessageUtil.ShowTips("修改成功!"); } catch (Exception e) { MessageUtil.ShowTips(e.Message + " 数据异常,请重新操作!"); } } private void ultraGridZg_InitializeRow(object sender, InitializeRowEventArgs e) { BaseHelper.ControlCellEdit(e.Row); } private void chc_CheckedChanged(object sender, EventArgs e) { if (chcGrade.Checked) { comGrade.Enabled = true; } else { comGrade.Enabled = false; } if (chkEfPlin.Checked) { comEfPlin.Enabled = true; } else { comEfPlin.Enabled = false; } } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": Query(); break; case "Update": update(); break; case "Close": this.Close(); break; default: break; } } private void ultraGridZz_CellChange(object sender, CellEventArgs e) { } } }