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 Core.StlMes.Client.YdmPipeManage.Entity; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.YdmPipeManage.Tool; namespace Core.StlMes.Client.YdmPipeManage.Dialog { public partial class FrmMaterialDialog : FrmBase { private string _materialNo; private OpeBase _ob; private SlmBaseMaterialEntity baseEntity = null; private ComPscEntity pscEntity = null; private string _productFlag; public ComPscEntity PscEntity { get { return pscEntity; } set { pscEntity = value; } } public SlmBaseMaterialEntity BaseEntity { get { return baseEntity; } set { baseEntity = value; } } public FrmMaterialDialog(string materialNo,string productFlag, OpeBase ob) { this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; InitializeComponent(); _materialNo = materialNo; _ob = ob; _productFlag = productFlag; } private void FrmMaterialDialog_Load(object sender, EventArgs e) { EntityHelper.ShowGridCaption(UltraGridMaterial.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(UltraGridPsc.DisplayLayout.Bands[0]); BaseMethod.setOtherColumnReadOnly(UltraGridMaterial, new string[] { "Chc" }); BaseMethod.setOtherColumnReadOnly(UltraGridPsc, new string[] { "Chc" }); DoQueryPsc(); } public void DoQueryMaterial(string producCode, string steelCode, string stdstyle) { List listSource = EntityHelper.GetData( "com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getMaterial", new object[] { producCode, steelCode, stdstyle }, _ob); slmBaseMaterialEntityBindingSource.DataSource = listSource; } public void DoQueryMaterial1() { List listSource = EntityHelper.GetData( "com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getMaterial1", new object[] { }, _ob); slmBaseMaterialEntityBindingSource.DataSource = listSource; } private void DoQueryPsc() { //成品盘盈 if (_productFlag == "0") { List listSource = EntityHelper.GetData( "com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getPsc", new object[] { }, _ob); comPscEntityBindingSource.DataSource = listSource; } //半成品 if (_productFlag == "1") { List listSource = EntityHelper.GetData( "com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getPsc", new object[] { }, _ob); comPscEntityBindingSource.DataSource = listSource; } } private void ActiveRow() { if (_materialNo.Length == 0) { return; } foreach (UltraGridRow ugr in UltraGridMaterial.Rows) { if (ugr.Cells[""].Value.ToString().Equals(_materialNo)) { ugr.Activate(); ugr.Appearance.BackColor = Color.GreenYellow; } } } private void button1_Click(object sender, EventArgs e) { UltraGridRow ugrM = UltraGridMaterial.ActiveRow; if (ugrM == null) { MessageUtil.ShowWarning("请选择一组物料信息!"); return; } UltraGridRow ugrP = UltraGridPsc.ActiveRow; if (ugrP == null) { return; } SlmBaseMaterialEntity slmBaseMaterialEntity = (SlmBaseMaterialEntity)ugrM.ListObject; baseEntity = slmBaseMaterialEntity; pscEntity = (ComPscEntity)ugrP.ListObject; this.Close(); } private void button2_Click(object sender, EventArgs e) { baseEntity = null; pscEntity = null; this.Close(); } private void UltraGridPsc_AfterRowActivate(object sender, EventArgs e) { UltraGridRow ugr = UltraGridPsc.ActiveRow; if (ugr == null) { DoQueryMaterial("", "", ""); return; } string producCode = ugr.Cells["Produccode"].Text; string steelCode = ugr.Cells["Steelcode"].Text; string stdStyle = ugr.Cells["StdStyle"].Text; if (_productFlag == "0") { DoQueryMaterial(producCode, steelCode, stdStyle); } if (_productFlag == "1") { DoQueryMaterial1(); } } } }