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.Collections; using Core.StlMes.Client.YdmPipeManage.Controls; using Core.Mes.Client.Comm.Tool; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Control; using Infragistics.Win.UltraWinGrid; using Infragistics.Win; using Core.StlMes.Client.YdmPipeManage.Tool; using com.steering.pss.ydm.entity; using Core.StlMes.Client.YdmPipeManage.Dialog; using Core.StlMes.Client.YdmPipeManage.Entity; using Infragistics.Win.UltraWinToolTip; using Core.StlMes.Client.YdmBase; using Core.Mes.Client.Comm.Format; namespace Core.StlMes.Client.YdmPipeManage { public partial class CFrmPipeInventoryIn : FrmBase { public CFrmPipeInventoryIn() { InitializeComponent(); } private void frmPipeInventoryIn_Load(object sender, EventArgs e) { BaseMethod.InitStorage(cmbStorage, CustomInfo, this.ValidDataPurviewIds, this.ob); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); InitDropBox(); //BaseMethod.InitGrade(TxtGrade, this.ob); RegStartTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddMonths(-1); RegEndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1).AddSeconds(-1); //BaseMethod.setOtherColumnReadOnly(ultraGrid1, new string[] { "Chc" }); BaseMethod.InitCellPosition(ultraGrid1, new string[] { "ActWeight", "ActCount", "ActLenMax", "ActLenMin", "ActTheoryWeight", "ActHeight", "ActDimater" }); ultraGrid1.DisplayLayout.Bands[0].Columns["StocktakingRsnName"].Header.Caption = "盘盈原因"; } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": DoQuery(); break; case "Add": DoAdd(); break; case"Delete": deleteData(); break; case "updateYear": updateYear(); break; case "Export": GridHelper.ulGridToExcel(ultraGrid1, "盘盈实绩"); break; case "Close": this.Close(); break; } } /// /// 撤销 /// private void deleteData() { this.ultraGrid1.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) return; OYdmZcStorcktakinglistEntity ydmZcTity = (OYdmZcStorcktakinglistEntity)uRow.ListObject; string ydmZcEntity = JSONFormat.Format(ydmZcTity); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn"; ccp.MethodName = "doDelete"; ccp.ServerParams = new object[] { ydmZcEntity }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("撤销成功!")) { DoQuery(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 调整结转年月 /// private void updateYear() { this.ultraGrid1.UpdateData(); ArrayList list = new ArrayList(); ArrayList parm = new ArrayList(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; string yearMoth = uRow.Cells["balYearMonth"].Text.Substring(0, 4) + uRow.Cells["balYearMonth"].Text.Substring(5, 2); string adjustDoc = uRow.Cells["stocktakingDoc"].Value.ToString(); string heatNo = uRow.Cells["judgeStoveNo"].Value.ToString(); string bacthNo = uRow.Cells["batchNo"].Value.ToString(); string bacthGroupNo = uRow.Cells["batchGroudNo"].Value.ToString(); //string moth = DateTime.Now.AddMonths(1).ToString("yyyyMM"); string moth = DateTime.Parse(uRow.Cells["balYearMonth"].Text).AddMonths(1).ToString("yyyyMM"); string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,ob); //parm.Add(heatNo); //parm.Add(bacthNo); //parm.Add(bacthGroupNo); parm.Add(moth); DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.selectYearMoth", new object[] { parm, arr }, ob); if (int.Parse(ds.Rows[0]["ACOUNT"].ToString()) > 0) { MessageUtil.ShowTips("此炉【" + heatNo + "】已进行结转,不允许调整结转年月!"); return; } string nowYearMoth = DateTime.Now.ToString("yyyyMM"); //if (int.Parse(yearMoth) < int.Parse(nowYearMoth)) //{ // MessageUtil.ShowTips("修改的结转年月不能小于当月!"); // return; //} list.Add(yearMoth); list.Add(yearMoth + "02 12:00:00"); list.Add(adjustDoc); int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.updateYear", new object[] { list }, ob); if (count > 0) { DoQuery(); MessageUtil.ShowTips("修改成功"); } } /// /// 编辑区下拉框绑定 /// private void InitDropBox() { //产线 BaseMethod.InitPline1(TxtPline, this.ob,this.CustomInfo); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.queryMaterialSTyle1", new object[] { }, ob); TxtProductFlag.DataSource = dt; TxtProductFlag.DisplayMember="BASENAME"; TxtProductFlag.ValueMember = "BASECODE"; //产权单位 DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getBelongCode", new object[] { }, ob); TxtBelongCode.DataSource = ds; TxtBelongCode.DisplayMember = "DEPARTNAME"; TxtBelongCode.ValueMember = "DEPARTID"; BaseMethod.InitSourse(TxtSourse, this.ob); TxtSourse.Value = "801305"; BaseMethod.InitReason(TxtReason, this.ob); BaseMethod.InitStorage(TxtStorage, CustomInfo, this.ValidDataPurviewIds, this.ob); BaseMethod.InitJustResult(cmbResult, this.ob); // BaseMethod.InitBelongCode(TxtBelongCode, this.ob); //BaseMethod.InitProcduce(TxtProduc,this.ob);//品名 //BaseMethod.InitGrade(TxtGrade, this.ob);//钢种 //BaseMethod.InitSteel(TxtSteelCode,this.ob);//钢级 //BaseMethod.InitModel(TxtModel, this.ob);//扣型 BaseMethod.InitStdStyle(TxtStdStyle,this.ob);//标准类别 //BaseMethod.InitSpec(TxtSpcName,this.ob);//规格 //BaseMethod.InitMaterial(TxtMaterial,this.ob);//物料码 //BaseMethod.InitStdName(TxtStdName,this.ob);//标准 } /// /// 查询 /// private void DoQuery() { ArrayList param = new ArrayList(); string strBegin = "1900-01-01 00:00:00"; string strEnd = "9900-01-01 00:00:00"; string justStoveNo = ""; string stoveNo = "";//仓库号; string locationNo = "";//料位号 //string[] stoveages = BaseMethod.WarehousePermissions(CustomInfo, this.ValidDataPurviewIds, this.ob); //string[] stoveages = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob); string[] stoveages = BaseMethod.WarehousePermissionsStore(this.ValidDataPurviewIds, ob); if (chkRegTime.Checked) { if (RegStartTime.Value == null || RegEndTime.Value == null) { MessageUtil.ShowWarning("请选择正确的创建时间"); return; } strBegin = RegStartTime.Value.ToString(); strEnd = RegEndTime.Value.ToString(); } if (chkFurnace.Checked) { justStoveNo = txtFurnace.Text.Trim(); } if (chkWarehous.Checked && cmbStorage.Value != null) { stoveNo = cmbStorage.Value.ToString(); } if (chkMaterial.Checked && cmbLocation.Value != null) { locationNo = cmbLocation.Value.ToString(); } param.Add(strBegin); param.Add(strEnd); param.Add(justStoveNo); param.Add(stoveNo); param.Add(locationNo); List listSource = EntityHelper.GetData( "com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getYdmZcStocktakingList1", new object[] { param, stoveages }, this.ob); ydmZcStocktakinglistEntityBindingSource.DataSource = listSource; } /// /// 新增 /// private void DoAdd() { OYdmZcStorcktakinglistEntity entity = GetAddData(); string errMessage = CheckAdd(entity); if (errMessage.Length > 0) { MessageUtil.ShowWarning(errMessage); return; } if (MessageUtil.ShowYesNoAndQuestion("是否新增盘盈信息?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn"; ccp.MethodName = "doAdd1"; ccp.ServerParams = new object[] { entity }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("盘盈成功!")) { DoQuery(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private OYdmZcStorcktakinglistEntity GetAddData() { OYdmZcStorcktakinglistEntity entity = new OYdmZcStorcktakinglistEntity(); entity.StocktakingTypeCode = "800601"; entity.StocktakingTypeName = "盘盈"; entity.StocktakingRsnCode = TxtReason.Value == null ? "" : TxtReason.Value.ToString(); entity.StocktakingRsnName = TxtReason.Text.Trim(); entity.JudgeStoveNo = TxtStoveNo.Text.Trim(); entity.BatchNo = TxtBathNo.Text.Trim(); entity.BatchGroudNo = "001"; entity.MaterialNo = TxtMaterial.Tag == null ? "" : TxtMaterial.Tag.ToString(); entity.MaterialName = TxtMaterial.Text; entity.Produccode = TxtProduc.Tag == null ? "" : TxtProduc.Tag.ToString(); entity.Producname = TxtProduc.Text; entity.StdCode = TxtStdName.Tag == null ? "" : TxtStdName.Tag.ToString(); entity.StdName = TxtStdName.Text; entity.Steelcode = TxtSteelCode.Tag == null ? "" : TxtSteelCode.Tag.ToString(); entity.Steelname = TxtSteelCode.Text; entity.StdStyle = TxtStdStyle.Value == null ? "" : TxtStdStyle.Value.ToString(); entity.StdStyleDesc = TxtStdStyle.Text; entity.SpecCode = TxtSpcName.Tag == null ? "" : TxtSpcName.Tag.ToString(); entity.SpecName = TxtSpcName.Text; entity.ModelCode = TxtModel.Tag == null ? "" : TxtModel.Tag.ToString(); entity.ModelDesc = TxtModel.Text; entity.PlineCode = TxtPline.Value == null ? "" : TxtPline.Value.ToString(); entity.PlineName = TxtPline.Text; entity.ActDimater = TxtDimater.Text; entity.ActHeight = TxtHeight.Text; entity.ActLenMax = TxtMax.Value == null ? "" : TxtMax.Value.ToString(); entity.ActLenMin = TxtMin.Value == null ? "" : TxtMin.Value.ToString(); entity.ActCount = TxtNum.Text.Trim(); entity.ActWeight = TxtActWgt.Value == null ? "" : TxtActWgt.Value.ToString(); entity.ActLen = TxtActLen.Value == null ? "" : TxtActLen.Value.ToString(); //entity.ActTheoryWeight = TxtWgt.Value == null ? "" : TxtWgt.Value.ToString(); entity.BelongCode = TxtBelongCode.Value == null ? "" : TxtBelongCode.Value.ToString(); entity.BelongName = TxtBelongCode.Text; entity.StorageNo = TxtStorage.Value == null ? "" : TxtStorage.Value.ToString(); entity.LocationNo = TxtLocation.Value == null ? "" : TxtLocation.Value.ToString(); entity.CreateName = UserInfo.GetUserName(); entity.Memo = ultraTextEditor1.Text.Trim(); entity.MatOriginCode = TxtSourse.Value == null ? "" : TxtSourse.Value.ToString(); entity.MatOriginName = TxtSourse.Text; entity.MatStatus = TxtMagstatus.Value == null ? "" : TxtMagstatus.Value.ToString(); entity.ProductFlag = TxtProductFlag.Value == null ? "" : TxtProductFlag.Value.ToString(); entity.JudgeResultCode = cmbResult.Value == null ? "" : cmbResult.Value.ToString(); entity.JudgeResult = cmbResult.Text; entity.BalYearMonth = DateTime.Now.ToString("yyyyMM"); entity.SoureCode = TxtPline.Value == null ? "" : TxtPline.Value.ToString(); entity.SoureName = TxtPline.Text; entity.Gradecode = TxtGrade.Tag == null ? "" : TxtGrade.Tag.ToString(); entity.Gradename = TxtGrade.Text; entity.ProOrderNo = txtOrderNo.Text.Trim()+"/"+cmbOrderSeq.Text.Trim(); entity.StoveNo = stoveNo.Text.Trim(); return entity; } //新增时验证必填项 private string CheckAdd(OYdmZcStorcktakinglistEntity entity) { if (entity.MaterialNo.Equals("")) { return "请选择物料信息!"; } if (entity.Produccode.Equals("")) { return "请选择品名信息!"; } if (entity.StdCode.Equals("")) { return "请选择标准信息!"; } if (entity.SpecCode.Equals("")) { return "请选择规格信息!"; } if (entity.ProductFlag.Equals("")) { return "请选择材料类别!"; } if (entity.MatStatus.Equals("")) { return "请选择材料状态!"; } if (entity.ActLenMax.Equals("") || Convert.ToDouble(entity.ActLenMax.ToString()) <= 0) { return "请输入长度上限!"; } if (entity.ActLenMin.Equals("") || Convert.ToDouble(entity.ActLenMin.ToString()) <= 0) { return "请输入长度下限!"; } if (Convert.ToDouble(entity.ActLenMax.ToString()) < Convert.ToDouble(entity.ActLenMin.ToString())) { return "长度上限不能小于长度下限"; } if (entity.MatOriginCode.Equals("")) { return "请选择材料来源!"; } if (entity.ActCount.Equals("") || Convert.ToDouble(entity.ActCount.ToString()) <= 0) { return "请输入支数!"; } if (entity.ActWeight.Equals("") || Convert.ToDouble(entity.ActWeight.ToString()) <= 0) { return "请输入实重!"; } if (entity.BelongCode.Equals("")) { return "请选择产权单位"; } if (entity.StorageNo.Equals("")) { return "请选择仓库号!"; } //if (entity.LocationNo.Equals("")) //{ // return "请选择料位号!"; //} if (entity.StocktakingRsnCode.Equals("")) { return "请选择盘盈原因!"; } if (entity.JudgeStoveNo.Equals("")|| (!StringUtil.IsOnlyLetterAndDigit(entity.JudgeStoveNo.ToString()))) { return "炉号由数字和字母组成!"; } //if (entity.PlineCode.Equals("")) //{ // return "请选择产线!"; //} if (entity.BatchNo.Equals("") || entity.BatchNo.ToString().Length > 5 || entity.BatchNo.ToString().Length < 2 || (!StringUtil.IsOnlyLetterAndDigit(entity.BatchNo.ToString()))) { return "批号由2-5位数字和字母组成!"; } if (entity.JudgeResultCode.Equals("")) { return "请选择判定结果!"; } if(entity.StoveNo.Equals("")) { return "请输入熔炼炉号!"; } return ""; } //--------------2015/08/13 private void chkWarehous_CheckedChanged(object sender, EventArgs e) { if (chkWarehous.Checked) { cmbStorage.Enabled = true; chkMaterial.Enabled = true; if (chkMaterial.Checked) { cmbLocation.Enabled = true; } else { cmbLocation.Enabled = false; } } else { chkMaterial.Checked = false; cmbStorage.Enabled = false; chkMaterial.Enabled = false; cmbLocation.Enabled = false; } } private void cmbStorage_SelectionChanged(object sender, EventArgs e) { if (cmbStorage.Value == null) { cmbLocation.DataSource = null; return; } string storageNo = cmbStorage.Value.ToString(); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getLocationNo", new object[] { storageNo }, this.ob); cmbLocation.DataSource = dt; cmbLocation.DisplayMember = "LOCATION_NO"; cmbLocation.ValueMember = "LOCATION_NO"; } /// /// 验证Checked是否勾选,显示控件可编辑 打勾表示可编辑,不打勾表示不可编辑 /// /// /// private void chk_CheckedChanged(object sender, EventArgs e) { if (chkFurnace.Checked) { txtFurnace.Enabled = true; } else { txtFurnace.Enabled = false; } if (chkMaterial.Checked) { cmbLocation.Enabled = true; } else { cmbLocation.Enabled = false; } } /// /// 物料信息选择 /// /// /// private void button1_Click(object sender, EventArgs e) { //FrmMaterialDialog frmMaterialDialog = new FrmMaterialDialog("","1", this.ob); //frmMaterialDialog.ShowDialog(); //SlmBaseMaterialEntity baseEntity = frmMaterialDialog.BaseEntity; //ComPscEntity pscEntity = frmMaterialDialog.PscEntity; //if (baseEntity == null || pscEntity == null) //{ // return; //} //TxtMaterial.Tag = baseEntity.MaterialNo.ToString(); //TxtMaterial.Text = baseEntity.MaterialDesc.ToString(); //TxtProduc.Tag = baseEntity.Produccode.ToString(); //TxtProduc.Text = baseEntity.Producname.ToString(); //TxtStdName.Tag = pscEntity.StdCode.ToString(); //TxtStdName.Text = pscEntity.StdName.ToString(); //TxtStdStyle.Tag = baseEntity.StdStyle == null ? "" : baseEntity.StdStyle.ToString(); //TxtStdStyle.Text = baseEntity.StdStyleDesc == null ? "" : baseEntity.StdStyleDesc.ToString(); //TxtSpcName.Tag = baseEntity.SpecCode.ToString(); //TxtSpcName.Text = baseEntity.SpecName.ToString(); //TxtModel.Tag = baseEntity.ModelCode == null ? "" : baseEntity.ModelCode.ToString(); //TxtModel.Text = baseEntity.ModelDesc == null ? "" : baseEntity.ModelDesc.ToString(); //TxtDimater.Value = baseEntity.Dimater.ToString(); //TxtHeight.Value = baseEntity.Height.ToString(); //TxtSteelCode.Tag = baseEntity.Steelcode.ToString(); //TxtSteelCode.Text = baseEntity.Steelname.ToString(); } private void TxtProductFlag_SelectionChanged(object sender, EventArgs e) { if (TxtProductFlag.Value == null) { TxtMagstatus.DataSource = null; return; } else { string value = TxtProductFlag.Value.ToString(); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getmagStatus", new object[] { value }, this.ob); BaseMethod.InitComboEditor(TxtMagstatus, dt, "BASENAME", "BASECODE"); } } private void TxtStorage_SelectionChanged(object sender, EventArgs e) { if (TxtStorage.Value == null) { TxtLocation.DataSource = null; return; } string storageNo = TxtStorage.Value.ToString(); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getLocationNo", new object[] { storageNo }, this.ob); TxtLocation.DataSource = dt; TxtLocation.DisplayMember = "LOCATION_NAME"; TxtLocation.ValueMember = "LOCATION_NO"; } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { UltraGridRow ugr = ultraGrid1.ActiveRow; if (ugr == null) { return; } TxtMaterial.Tag = ugr.Cells["MaterialNo"].Text; TxtMaterial.Text = ugr.Cells["MaterialName"].Text; TxtSpcName.Tag = ugr.Cells["SpecCode"].Text; TxtSpcName.Text = ugr.Cells["SpecName"].Text; TxtProduc.Tag = ugr.Cells["Produccode"].Text; TxtProduc.Text = ugr.Cells["Producname"].Text; TxtModel.Tag = ugr.Cells["ModelCode"].Text; TxtModel.Text = ugr.Cells["ModelDesc"].Text; TxtStdName.Tag = ugr.Cells["StdCode"].Text; TxtStdName.Text = ugr.Cells["StdName"].Text; TxtDimater.Value = ugr.Cells["ActDimater"].Text; TxtHeight.Value = ugr.Cells["ActHeight"].Text; TxtStdStyle.Tag = ugr.Cells["StdStyle"].Text; TxtStdStyle.Text = ugr.Cells["StdStyleDesc"].Text; TxtSteelCode.Tag = ugr.Cells["Steelcode"].Text; TxtSteelCode.Text = ugr.Cells["Steelname"].Text; TxtMax.Value = ugr.Cells["ActLenMax"].Text; TxtMin.Value = ugr.Cells["ActLenMin"].Text; TxtNum.Value = ugr.Cells["ActCount"].Text; TxtActWgt.Value = ugr.Cells["ActWeight"].Text; TxtBelongCode.Value = ugr.Cells["BelongCode"].Text; TxtStorage.Value = ugr.Cells["StorageNo"].Text; TxtLocation.Value = ugr.Cells["LocationNo"].Text; TxtReason.Value = ugr.Cells["StocktakingRsnCode"].Text; TxtStoveNo.Value = ugr.Cells["JudgeStoveNo"].Text; TxtPline.Value = ugr.Cells["PlineCode"].Text; TxtBathNo.Value = ugr.Cells["BatchNo"].Text; stoveNo.Text = ugr.Cells["StoveNo"].Text; } private void TxtSourse_ValueChanged(object sender, EventArgs e) { //if (this.TxtSourse.Text != "") //{ // if (this.TxtSourse.Value.ToString() == "801302")//产线 // { // YdmBaseClass.InitComboEditor(TxtPline, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFactoryDetail", "PLINE_CODE", this.ob, false); // } // else if (this.TxtSourse.Value.ToString() == "801301")//外购 // { // YdmBaseClass.InitComboEditor(TxtPline, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getWg", "BASE_CODE", this.ob, false); // } // else if (this.TxtSourse.Value.ToString() == "801303")//倒库 // { // YdmBaseClass.InitComboEditor(TxtPline, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getDk", "BASE_CODE", this.ob, false); // } // else if (this.TxtSourse.Value.ToString() == "801304")//外委 // { // YdmBaseClass.InitComboEditor(TxtPline, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getWw", "BASE_CODE", this.ob, false); // } //} } private void TxtSpcName_SelectionChanged(object sender, EventArgs e) { if(this.TxtSpcName.Text != "") { int len = this.TxtSpcName.Text.IndexOf("x"); if(len>1) { this.TxtDimater.Text = this.TxtSpcName.Text.Substring(0, len); this.TxtHeight.Text = this.TxtSpcName.Text.Substring(len + 1); } } } private void TxtMaterial_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.base.BaseOperations.getProcessMaterial", new object[] { }, ob); dt.Columns["BASENAME"].Caption = "物料名称"; BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "BASENAME", "BASECODE"); baseInfo.Shown += new EventHandler((a, b) => { var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where( c => c.GetValue("BASECODE") == this.TxtMaterial.Tag.ToString2()).FirstOrDefault(); if (actRow != null) actRow.Activate(); }); if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK) { TxtMaterial.Tag = baseInfo.ChoicedRow.GetValue("BASECODE"); TxtMaterial.Text = baseInfo.ChoicedRow.GetValue("BASENAME"); } } private void TxtSpcName_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getSpec", new object[] { }, ob); dt.Columns["BASENAME"].Caption = "规格"; BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "BASENAME", "BASECODE"); baseInfo.Shown += new EventHandler((a, b) => { var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where( c => c.GetValue("BASECODE") == this.TxtSpcName.Tag.ToString2()).FirstOrDefault(); if (actRow != null) actRow.Activate(); }); if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK) { TxtSpcName.Tag = baseInfo.ChoicedRow.GetValue("BASECODE"); TxtSpcName.Text = baseInfo.ChoicedRow.GetValue("BASENAME"); } } private void TxtProduc_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getProcduce", new object[] { }, ob); dt.Columns["BASENAME"].Caption = "品名"; BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "BASENAME", "BASECODE"); baseInfo.Shown += new EventHandler((a, b) => { var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where( c => c.GetValue("BASECODE") == this.TxtProduc.Tag.ToString2()).FirstOrDefault(); if (actRow != null) actRow.Activate(); }); if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK) { TxtProduc.Tag = baseInfo.ChoicedRow.GetValue("BASECODE"); TxtProduc.Text = baseInfo.ChoicedRow.GetValue("BASENAME"); } } private void TxtModel_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getModel", new object[] { }, ob); dt.Columns["BASENAME"].Caption = "扣型"; BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "BASENAME", "BASECODE"); baseInfo.Shown += new EventHandler((a, b) => { var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where( c => c.GetValue("BASECODE") == this.TxtModel.Tag.ToString2()).FirstOrDefault(); if (actRow != null) actRow.Activate(); }); if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK) { TxtModel.Tag = baseInfo.ChoicedRow.GetValue("BASECODE"); TxtModel.Text = baseInfo.ChoicedRow.GetValue("BASENAME"); } } private void TxtStdName_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getStdCode", new object[] { }, ob); dt.Columns["BASENAME"].Caption = "标准名称"; BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "BASENAME", "BASECODE"); baseInfo.Shown += new EventHandler((a, b) => { var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where( c => c.GetValue("BASECODE") == this.TxtStdName.Tag.ToString2()).FirstOrDefault(); if (actRow != null) actRow.Activate(); }); if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK) { TxtStdName.Tag = baseInfo.ChoicedRow.GetValue("BASECODE"); TxtStdName.Text = baseInfo.ChoicedRow.GetValue("BASENAME"); } } private void TxtSteelCode_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getSteel", new object[] { }, ob); dt.Columns["BASENAME"].Caption = "钢级"; BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "BASENAME", "BASECODE"); baseInfo.Shown += new EventHandler((a, b) => { var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where( c => c.GetValue("BASECODE") == this.TxtSteelCode.Tag.ToString2()).FirstOrDefault(); if (actRow != null) actRow.Activate(); }); if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK) { TxtSteelCode.Tag = baseInfo.ChoicedRow.GetValue("BASECODE"); TxtSteelCode.Text = baseInfo.ChoicedRow.GetValue("BASENAME"); } } private void TxtGrade_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getGrade", new object[] { }, ob); dt.Columns["BASENAME"].Caption = "钢种"; BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "BASENAME", "BASECODE"); baseInfo.Shown += new EventHandler((a, b) => { var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where( c => c.GetValue("BASECODE") == this.TxtGrade.Tag.ToString2()).FirstOrDefault(); if (actRow != null) actRow.Activate(); }); if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK) { TxtGrade.Tag = baseInfo.ChoicedRow.GetValue("BASECODE"); TxtGrade.Text = baseInfo.ChoicedRow.GetValue("BASENAME"); } } } }