using com.steering.pss.sale.order.model; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.SaleOrder; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; using System.Windows.Forms; namespace Core.StlMes.Client.Qcm { public partial class frmComBaseAskRStation : FrmBase { private string askItemNo = ""; public frmComBaseAskRStation() { InitializeComponent(); EntityHelper.ShowGridCaption(ultraGridStation.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid1AddAsk.DisplayLayout.Bands[0]); setColumnNoEdit(); } /// /// 重写基类toolBar方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": Query(); break; case "Save": Save(); break; case "Close": this.Close(); break; } } private void Query() { List listSource = EntityHelper.GetData( "com.steering.pss.qcm.CoreComBaseAskRStation.getAddAsk", new object[] { }, this.ob); slmBaseAddAskEntityBindingSource.DataSource = listSource; foreach (UltraGridRow ugrAdd in ultraGrid1AddAsk.Rows) { if (ugrAdd.Cells["AskItemNo"].Value.ToString().Equals(askItemNo)) { ugrAdd.Activate(); } } askItemNo = ""; } private void Save() { ultraGrid1AddAsk.UpdateData(); ultraGridStation.UpdateData(); UltraGridRow ugr = ultraGrid1AddAsk.ActiveRow; SlmBaseAddAskEntity addAskEntity = (SlmBaseAddAskEntity)ugr.ListObject; if (ugr == null) { MessageUtil.ShowWarning("请选择附加要求分项!"); return; } IQueryable checkedRows = ultraGridStation.Rows.AsQueryable().Where(" CHC = 'True'"); ArrayList list = new ArrayList(); foreach (UltraGridRow ugrCheck in checkedRows) { ComBaseStationEntity baseStationEntity = (ComBaseStationEntity)ugrCheck.ListObject; ComBaseAskRStationEntity askRelationEntity = new ComBaseAskRStationEntity(); askRelationEntity.AskItemNo = addAskEntity.AskItemNo; askRelationEntity.AskItemDesc = addAskEntity.AskItemDesc; askRelationEntity.ProcessCdoe = baseStationEntity.ProcessCode; askRelationEntity.ProcessDesc = baseStationEntity.ProcessDesc; askRelationEntity.ProcessDescC = baseStationEntity.ProcessDescC; askRelationEntity.ProcessCdoeC = baseStationEntity.ProcessCodeC; askRelationEntity.StationCode = baseStationEntity.StationCode; askRelationEntity.StationDesc = baseStationEntity.StationDesc; askRelationEntity.CreateName = UserInfo.GetUserName(); list.Add(askRelationEntity); } if (MessageUtil.ShowYesNoAndQuestion("是否保存?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.qcm.CoreComBaseAskRStation"; ccp.MethodName = "saveAddAskRelation"; ccp.ServerParams = new object[] { list, addAskEntity.AskItemNo }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips("保存成功!"); Query(); } askItemNo = addAskEntity.AskItemNo.ToString(); } private void ultraGrid1AddAsk_AfterRowActivate(object sender, EventArgs e) { UltraGridRow ugr = ultraGrid1AddAsk.ActiveRow; if (ugr != null) { String itemNo = ugr.Cells["AskItemNo"].Value.ToString(); List listSource = EntityHelper.GetData( "com.steering.pss.qcm.CoreComBaseAskRStation.getAddAskRelation", new object[] { itemNo }, this.ob); comBaseStationEntityBindingSource.DataSource = listSource; if (ultraGridStation.Rows.Count > 0) { ultraGridStation.Rows[0].Activate(); } } } private void setColumnNoEdit() { foreach (UltraGridColumn ugc in ultraGridStation.DisplayLayout.Bands[0].Columns) { if (!ugc.Key.Equals("Chc")) { ugc.CellActivation = Activation.ActivateOnly; } } } private void frmComBaseAskRStation_Load(object sender, EventArgs e) { Query(); } } }