using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using CoreFS.CA06; using System; using System.Data; using System.Linq; using System.Windows.Forms; namespace Core.StlMes.Client.Qcm { public partial class ComBasePhyMinChoice : FrmBase { private string _choicePhyMinCodes; public string ChoicePhyMinCodes { get { return _choicePhyMinCodes; } set { _choicePhyMinCodes = value; } } private string _choicePhyMinNames; public string ChoicePhyMinNames { get { return _choicePhyMinNames; } set { _choicePhyMinNames = value; } } //查询条件 private string _phyMinCodes = ""; public ComBasePhyMinChoice(string phyMinCodes, OpeBase ob) { InitializeComponent(); this.ob = ob; _phyMinCodes = phyMinCodes; } private void Query(string phyMinCodes) { ultraGrid1.BeginUpdate(); DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreMaterialItemMng.getPhyMinInfo", new object[] { }, ob); string[] phyMinCodeArray = phyMinCodes.Split(';'); foreach (DataRow row in dt.Rows) { if (phyMinCodeArray.Contains(row["PHY_CODE_MIN"].ToString())) { row["CHK"] = true; } } dt.DefaultView.Sort = "CHK DESC, PHY_NAME_MIN ASC"; GridHelper.CopyDataToDatatable(dt.DefaultView.ToTable(), this.dataTable1, true); ultraGrid1.EndUpdate(); ultraGrid1.UpdateData(); } private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { e.Cell.Row.Update(); } private void ultraButton1_Click(object sender, EventArgs e) { ultraGrid1.UpdateData(); var rows = ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True"); var codeRows = rows.Select(a => a.GetValue("PHY_CODE_MIN")); _choicePhyMinCodes = string.Join(";", codeRows); var nameRows = rows.Select(a => a.GetValue("PHY_NAME_MIN")); _choicePhyMinNames = string.Join(";", nameRows); this.DialogResult = System.Windows.Forms.DialogResult.OK; } private void ultraButton2_Click(object sender, EventArgs e) { this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } private void ComBaseStdChoice_Load(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; Query(_phyMinCodes); } finally { this.Cursor = Cursors.Default; } } } }