using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Qcm.Control; using Core.StlMes.Client.Qcm.model; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using Newtonsoft.Json; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Drawing; using System.Linq; using System.Windows.Forms; namespace Core.StlMes.Client.Qcm { public partial class FrmPhySample : FrmBase { private string ordLnPk = ""; private string dimater = "1"; private string height = "1"; private string mscPline = ""; private string processCode = ""; //理化弹窗 public FrmPhySample(OpeBase ob, DataTable dt, string ordLnPk, string customInfo) { InitializeComponent(); this.IsLoadUserView = true; this._ob = ob; this.ordLnPk = ordLnPk; //DataRow drComBaseStd = GetComBaseStdByPk(dt.Rows[0]["STD_CODE"].ToString()); //if (drComBaseStd != null) //{ // foreach (DataRow dr in dt.Rows) // { // dr["STD_NAME"] = drComBaseStd["STD_NAME"]; // } //} this.dt = dt; this.CustomInfo = customInfo; if (ordLnPk == "" || ordLnPk == "abc") { ultraToolbarsManager1.Tools["设定试样码"].SharedProps.Visible = false; } //显示转换的理化冲击 DataTable dtConvertPhy = ServerHelper.GetData("com.steering.pss.qcm.CorePhySample.getConvertPhy", new object[] { ordLnPk }, _ob); if (dtConvertPhy.Rows.Count > 0) { ultraGroupBox4.Visible = true; GridHelper.CopyDataToDatatable(dtConvertPhy, this.dataTable3, true); } } //评审弹窗 public FrmPhySample(OpeBase ob, string objKey, string ordLnPk, string designKey, string errMsg) { InitializeComponent(); ultraStatusBar1.Visible = true; ultraStatusBar1.Panels["ExMsg"].Text = errMsg; ultraToolbarsManager1.Tools["确认"].SharedProps.Visible = true; ultraTabControl1.Tabs[0].Visible = false; this.IsLoadUserView = true; this._ob = ob; this.ordLnPk = ordLnPk; string[] objKeys = objKey.Split(','); string pic = objKeys[0]; string speclFlg = objKeys[1]; if (objKeys.Length >= 6) { this.dimater = objKeys[2]; this.height = objKeys[3]; this.mscPline = objKeys[4]; this.processCode = objKeys[5]; } if (speclFlg == "0" || speclFlg == "1") { this.CustomInfo = "1"; } else if (speclFlg == "2") { this.CustomInfo = "2"; } this.dt = GetPicData(pic, designKey, mscPline, processCode); } public FrmPhySample(OpeBase ob1) { this.Ob = ob1; } private OpeBase _ob; public OpeBase Ob { get { return _ob; } set { _ob = value; } } private DataTable dt; public DataTable Dt { get { return dt; } set { dt = value; } } FrmBaseSample fbs = new FrmBaseSample(); private ComBaseSplineCtrl _splineCtrl; private ComBaseSplineCCtrl _splineCCtrl; private void FrmPhySample_Load(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; _splineCtrl = new ComBaseSplineCtrl(ultraGroupBox2, _ob); _splineCtrl.Flag = "试样关系"; _splineCtrl.UltraTextEditor1.ButtonsRight.Clear(); _splineCtrl.UltraGrid1.DisplayLayout.Bands[0].Override.AllowAddNew = AllowAddNew.No; GridHelper.HidenColumns(_splineCtrl.UltraGrid1.DisplayLayout.Bands[0], "Chk"); ClearGridColor(_splineCtrl.UltraGrid1); GridHelper.HidenColumns(_splineCtrl.UltraGrid1.DisplayLayout.Bands[0], "Chk"); _splineCtrl.UltraGrid1.AfterRowActivate += _splineCtrl_AfterRowActivate; _splineCCtrl = new ComBaseSplineCCtrl(ultraGroupBox3, _ob); _splineCCtrl.UltraGrid1.DisplayLayout.Bands[0].Override.AllowAddNew = AllowAddNew.No; ClearGridColor(_splineCCtrl.UltraGrid1); GridHelper.HidenColumns(_splineCCtrl.UltraGrid1.DisplayLayout.Bands[0], "Chk"); InitGrid1(dt); ultraGrid1.UpdateData(); ultraGrid2.UpdateData(); } finally { this.Cursor = Cursors.Default; } } private DataTable GetPicData(string pic, string designKey, string mscPline, string processCode) { DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CorePhySample.GetPicData", new object[] { pic, designKey, mscPline, processCode }, _ob); return dt; } private void ClearGridColor(UltraGrid grid) { foreach (UltraGridColumn column in grid.DisplayLayout.Bands[0].Columns) { column.CellAppearance.BackColor = grid.DisplayLayout.Bands[0].Columns["VALIDFLAG"].CellAppearance.BackColor; } } private void InitGrid1(DataTable dt) { string pic = ""; ultraGrid1.BeginUpdate(); GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true); if (dt.Rows.Count > 0) { pic = dt.Rows[0]["PIC"].ToString(); DataTable dtStdTest = ServerHelper.GetData("com.steering.pss.qcm.CorePhySample.GetStdTest", new object[] { pic }, Ob); foreach (DataRow row in dataTable1.Rows) { foreach (DataRow dr in dtStdTest.Rows) { if (ultraTabControl1.SelectedTab.Index == 0) { if (dr["PHY_CODE_MIN"].ToString() == row["PHY_CODE_MIN"].ToString() && dr["ITEM_CODE_F"].ToString() == row["ITEM_CODE_F"].ToString() && dr["ITEM_CODE_W"].ToString() == row["ITEM_CODE_W"].ToString() && dr["ITEM_CODE_C"].ToString() == row["ITEM_CODE_C"].ToString()) { row["STD_CODE_TEST"] = dr["STD_CODE_TEST"]; row["STD_NAME_TEST"] = dr["STD_NAME_TEST"]; } } else { if (dr["PHY_CODE_MIN"].ToString() == row["PHY_CODE_MIN"].ToString() && dr["ITEM_CODE_F"].ToString() == row["ITEM_CODE_F"].ToString() && dr["ITEM_CODE_C"].ToString() == row["ITEM_CODE_C"].ToString()) { row["STD_CODE_TEST"] = dr["STD_CODE_TEST"]; row["STD_NAME_TEST"] = dr["STD_NAME_TEST"]; } } } if (row["STD_CODE_TEST"].ToString() == "") { foreach (DataRow dr in dtStdTest.Rows) { if (dr["PHY_CODE_MIN"].ToString() == row["PHY_CODE_MIN"].ToString()) { row["STD_CODE_TEST"] = dr["STD_CODE_TEST"]; row["STD_NAME_TEST"] = dr["STD_NAME_TEST"]; } } } } } ultraGrid1.EndUpdate(); } public void QueryPhyDown() { //string phycode, string stdCode string phyCode = ultraGrid1.ActiveRow.GetValue("PHY_CODE_MIN"); string stdCode = ultraGrid1.ActiveRow.GetValue("STD_CODE"); string stdCodeTest = ultraGrid1.ActiveRow.GetValue("STD_CODE_TEST"); string produccode = ultraGrid1.ActiveRow.GetValue("PRODUCCODE"); string steelcode = ultraGrid1.ActiveRow.GetValue("STEELCODE"); ultraGrid2.BeginUpdate(); DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CorePhySample.Query", new Object[] { phyCode, stdCode, steelcode, produccode }, this._ob); GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable2, true); SetCHK(); ultraGrid2.EndUpdate(); ultraGrid2.UpdateData(); _splineCtrl.UltraGrid1.BeginUpdate(); string phyCodeMin = ultraGrid1.ActiveRow.Cells["PHY_CODE_MIN"].Value.ToString(); string pic = ultraGrid1.ActiveRow.Cells["PIC"].Value.ToString(); string itemCodeC = ultraGrid1.GetActiveRowValue("ITEM_CODE_C"); string itemCodeF = ultraGrid1.GetActiveRowValue("ITEM_CODE_F"); string itemCodeW = ultraGrid1.GetActiveRowValue("ITEM_CODE_W"); _splineCCtrl.ClearDataSource(); _splineCtrl.Query2(phyCodeMin, itemCodeF, itemCodeC, ordLnPk, itemCodeW); List splines = (List)_splineCtrl.ComBaseSplineEntityBindingSource.DataSource; foreach (var spline in splines) { if (spline.StdCodeS == "" || spline.StdCodeS.Split(';').Contains(stdCodeTest)) { spline.Sort = "1"; } } var sortSplines = splines.OrderByDescending(a => a.Sort).ThenBy(a => a.Eic); _splineCtrl.ComBaseSplineEntityBindingSource.DataSource = sortSplines.ToList(); //DataTable dtSpline = ServerHelper.GetData("com.steering.pss.qcm.CorePhySample.QuerySpline", // new object[] { phyCodeMin, itemCodeF, itemCodeC, stdCodeTest, ordLnPk, dimater, height}, _ob); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.qcm.CorePhySample"; ccp.MethodName = "QuerySpline"; ccp.ServerParams = new object[] { phyCodeMin, itemCodeF, itemCodeC, stdCodeTest, ordLnPk, dimater, height }; ccp = _ob.ExecuteQuery(ccp, CoreInvokeType.Internal); ArrayList eics = (ArrayList)ccp.ReturnObject; DataTable dtSetEic = ServerHelper.GetData("com.steering.pss.qcm.CorePhySample.querySetEic", new object[] { ordLnPk, phyCodeMin, itemCodeF, itemCodeC, itemCodeW }, _ob); foreach (var row in _splineCtrl.UltraGrid1.Rows) { row.Cells["Chk2"].Activation = Activation.ActivateOnly; if (eics.Contains(row.GetValue("Eic"))) { row.SetValue("Chk2", "True"); row.SetValue("Chk3", "False"); } else { row.Cells["Chk3"].Activation = Activation.ActivateOnly; row.Cells["Chk3"].Value = DBNull.Value; } if (dtSetEic.Select("SET_EIC = '" + row.GetValue("Eic") + "'").Length > 0) { row.SetValue("Chk3", "True"); } if (row.GetValue("StdCodeS") == "" || row.GetValue("StdCodeS").Split(';').Contains(stdCodeTest)) { row.Appearance.BackColor = Color.FromArgb(255, 250, 205); } else { row.Appearance.BackColor = Color.FromArgb(211, 211, 211); } } _splineCtrl.UltraGrid1.EndUpdate(); _splineCtrl.UltraGrid1.UpdateData(); } private void SetCHK() { UltraGridRow ugr = this.ultraGrid1.ActiveRow; string phycode = ugr.Cells["PHY_CODE_MIN"].Value.ToString(); string itemCodeC = ugr.Cells["ITEM_CODE_C"].Value.ToString(); string itemCodeF = ugr.Cells["ITEM_CODE_F"].Value.ToString(); string itemCodeW = ugr.Cells["ITEM_CODE_W"].Value.ToString(); string pic = ugr.Cells["PIC"].Value.ToString(); string sic = ""; DataTable dt1 = ServerHelper.GetData("com.steering.pss.qcm.CorePhySample.GetSIC", new Object[] { phycode, itemCodeC, itemCodeF, itemCodeW, pic }, this._ob); if (dt1 != null && dt1.Rows.Count > 0) { sic = dt1.Rows[0][0].ToString(); } foreach (UltraGridRow row in this.ultraGrid2.Rows) { int cnt = dt1.Select("SIC = '" + row.Cells["SIC"].Value.ToString() + "'").Length; if (cnt > 0) { row.Cells["CHK"].Value = true; } if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("有效")) { row.Appearance.ForeColor = Color.Red; } else { row.Appearance.ForeColor = Color.Black; } } } private void doLink() //关联函数 { UltraGridRow ugr = ultraGrid1.ActiveRow; this.ultraGrid2.UpdateData(); int ischeck = 0; foreach (UltraGridRow row in ultraGrid2.Rows) { if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE") { ischeck += 1; } } if (ischeck == 0) { MessageBox.Show("请选择取样要求进行关联!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (ultraGrid1.ActiveRow.GetValue("STD_CODE_TEST") == "") { MessageUtil.ShowWarning("请选择试验标准!"); ultraGrid1.ActiveRow.SetCellActive("STD_NAME_TEST"); return; } if (MessageBox.Show("是否确认关联?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } List list = new List(); string sic = ""; string phyCodeMin = ""; string itemCodeF = ""; string itemCodeC = ""; string itemCodeW = ""; foreach (UltraGridRow row in ultraGrid2.Rows) { if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE") { ComMscPhySampleEntity phySampleEntity = new ComMscPhySampleEntity(); phySampleEntity.Pic = ugr.GetValue("PIC"); phySampleEntity.PhyCodeMin = ugr.GetValue("PHY_CODE_MIN"); phySampleEntity.PhyNameMin = ugr.GetValue("PHY_NAME_MIN"); phySampleEntity.Sic = row.GetValue("SIC"); sic = row.GetValue("SIC"); phyCodeMin = ugr.GetValue("PHY_CODE_MIN"); itemCodeF = ugr.GetValue("ITEM_CODE_F"); itemCodeC = ugr.GetValue("ITEM_CODE_C"); itemCodeW = ugr.GetValue("ITEM_CODE_W"); phySampleEntity.CreateName = this.UserInfo.GetUserName(); phySampleEntity.Memo = row.GetValue("MEMO"); phySampleEntity.StdCodeTest = ugr.GetValue("STD_CODE_TEST"); phySampleEntity.StdNameTest = ugr.GetValue("STD_NAME_TEST"); phySampleEntity.ItemCodeC = ugr.GetValue("ITEM_CODE_C"); phySampleEntity.ItemCodeF = ugr.GetValue("ITEM_CODE_F"); phySampleEntity.ItemCodeW = ugr.GetValue("ITEM_CODE_W"); phySampleEntity.ItemNameC = ugr.GetValue("ITEM_NAME_C"); phySampleEntity.ItemNameF = ugr.GetValue("ITEM_NAME_F"); phySampleEntity.ItemNameW = ugr.GetValue("ITEM_NAME_W"); phySampleEntity.SampleKey = phySampleEntity.PhyCodeMin; if (phySampleEntity.SampleKey == "") { phySampleEntity.SampleKey = phySampleEntity.ItemCodeF; } else { if (phySampleEntity.ItemCodeF != "") phySampleEntity.SampleKey = phySampleEntity.SampleKey + "_" + phySampleEntity.ItemCodeF; } if (phySampleEntity.SampleKey == "") { phySampleEntity.SampleKey = phySampleEntity.ItemCodeW; } else { if (phySampleEntity.ItemCodeW != "") phySampleEntity.SampleKey = phySampleEntity.SampleKey + "_" + phySampleEntity.ItemCodeW; } if (phySampleEntity.SampleKey == "") { phySampleEntity.SampleKey = phySampleEntity.ItemCodeC; } else { if (phySampleEntity.ItemCodeC != "") phySampleEntity.SampleKey = phySampleEntity.SampleKey + "_" + phySampleEntity.ItemCodeC; } phySampleEntity.SampleKeyDesc = phySampleEntity.PhyNameMin; if (phySampleEntity.SampleKeyDesc == "") { phySampleEntity.SampleKeyDesc = phySampleEntity.ItemNameF; } else { if (phySampleEntity.ItemNameF != "") phySampleEntity.SampleKeyDesc = phySampleEntity.SampleKeyDesc + "_" + phySampleEntity.ItemNameF; } if (phySampleEntity.SampleKeyDesc == "") { phySampleEntity.SampleKeyDesc = phySampleEntity.ItemNameW; } else { if (phySampleEntity.ItemNameW != "") phySampleEntity.SampleKeyDesc = phySampleEntity.SampleKeyDesc + "_" + phySampleEntity.ItemNameW; } if (phySampleEntity.SampleKeyDesc == "") { phySampleEntity.SampleKeyDesc = phySampleEntity.ItemNameC; } else { if (phySampleEntity.ItemNameC != "") phySampleEntity.SampleKeyDesc = phySampleEntity.SampleKeyDesc + "_" + phySampleEntity.ItemNameC; } if (phySampleEntity.SampleKey == "")//为空时等于下划线, 数据库不能为空 { phySampleEntity.SampleKey = "_"; } list.Add(JsonConvert.SerializeObject(phySampleEntity)); } } List list2 = new List(); var rows = _splineCtrl.UltraGrid1.Rows.AsQueryable().Where(a => a.GetValue("Chk2") == "True"); foreach (var row in rows) { ComMscPhySpline2Entity splineEntity = new ComMscPhySpline2Entity(); splineEntity.CreateName = this.UserInfo.GetUserName(); splineEntity.StdCodeTest = ugr.GetValue("STD_CODE_TEST"); splineEntity.StdNameTest = ugr.GetValue("STD_NAME_TEST"); splineEntity.PhyCodeMin = ugr.GetValue("PHY_CODE_MIN"); splineEntity.PhyNameMin = ugr.GetValue("PHY_NAME_MIN"); splineEntity.Eic = row.GetValue("Eic"); splineEntity.Memo = row.GetValue("Memo"); splineEntity.ItemCodeC = ugr.GetValue("ITEM_CODE_C"); splineEntity.ItemCodeF = ugr.GetValue("ITEM_CODE_F"); splineEntity.ItemCodeW = ugr.GetValue("ITEM_CODE_W"); splineEntity.ItemNameC = ugr.GetValue("ITEM_NAME_C"); splineEntity.ItemNameF = ugr.GetValue("ITEM_NAME_F"); splineEntity.ItemNameW = ugr.GetValue("ITEM_NAME_W"); splineEntity.SampleKey = splineEntity.ItemCodeF; if (splineEntity.SampleKey == "") { splineEntity.SampleKey = splineEntity.ItemCodeW; } else { if (splineEntity.ItemCodeW != "") splineEntity.SampleKey = splineEntity.SampleKey + "_" + splineEntity.ItemCodeW; } if (splineEntity.SampleKey == "") { splineEntity.SampleKey = splineEntity.ItemCodeC; } else { if (splineEntity.ItemCodeC != "") splineEntity.SampleKey = splineEntity.SampleKey + "_" + splineEntity.ItemCodeC; } splineEntity.SampleKeyDesc = splineEntity.ItemNameF; if (splineEntity.SampleKeyDesc == "") { splineEntity.SampleKeyDesc = splineEntity.ItemNameW; } else { if (splineEntity.ItemNameW != "") splineEntity.SampleKeyDesc = splineEntity.SampleKeyDesc + "_" + splineEntity.ItemNameW; } if (splineEntity.SampleKeyDesc == "") { splineEntity.SampleKeyDesc = splineEntity.ItemNameC; } else { if (splineEntity.ItemNameC != "") splineEntity.SampleKeyDesc = splineEntity.SampleKeyDesc + "_" + splineEntity.ItemNameC; } if (splineEntity.SampleKey == "")//为空时等于下划线, 数据库不能为空 { splineEntity.SampleKey = "_"; } list2.Add(JsonConvert.SerializeObject(splineEntity)); } string[] eics = _splineCtrl.UltraGrid1.Rows.Select(a => a.GetValue("EIC")).ToArray(); int count = ServerHelper.SetData("com.steering.pss.qcm.CorePhySample.Link", new Object[] { list, list2, ugr.GetValue("PIC"), ugr.GetValue("PHY_CODE_MIN"), ugr.GetValue("ITEM_CODE_F"), ugr.GetValue("ITEM_CODE_C"), ugr.GetValue("ITEM_CODE_W"), ugr.GetValue("STD_CODE_TEST"), eics}, this.Ob); if (count > 0) { MessageUtil.ShowTips("关联成功!"); InitGrid1(dt); var pRow = ultraGrid1.Rows.Where(a => a.GetValue("PHY_CODE_MIN") == phyCodeMin && a.GetValue("ITEM_CODE_F") == itemCodeF && a.GetValue("ITEM_CODE_C") == itemCodeC && a.GetValue("ITEM_CODE_W") == itemCodeW).FirstOrDefault(); if (pRow != null) { pRow.Activate(); } var row = ultraGrid2.Rows.Where(a => a.GetValue("SIC") == sic).FirstOrDefault(); if (row != null) { row.Activate(); } } } private void SetEic() { var row = ultraGrid1.ActiveRow; if (row == null) return; if (MessageUtil.ShowYesNoAndQuestion("是否确认设定试样码?") == System.Windows.Forms.DialogResult.No) { return; } string setEic = ""; var rowSetEic = _splineCtrl.UltraGrid1.Rows.Where(a => a.GetValue("Chk3") == "True").FirstOrDefault(); if (rowSetEic != null) { setEic = rowSetEic.GetValue("Eic"); } ServerHelper.SetData("com.steering.pss.qcm.CorePhySample.setEic", new object[]{ ordLnPk, row.GetValue("PHY_CODE_MIN"), row.GetValue("ITEM_CODE_F"), row.GetValue("ITEM_CODE_C"), row.GetValue("ITEM_CODE_W"), setEic}, Ob); MessageUtil.ShowTips("设定成功!"); } private DataRow GetComBaseStdByPk(string stdCode) { DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreProductManage.getBaseStdByPk", new object[] { stdCode }, Ob); if (dt.Rows.Count > 0) { return dt.Rows[0]; } else { return null; } } private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { if (e.Tool.Key == "ButtonTool1") //关联 { doLink(); } else if (e.Tool.Key == "ButtonTool3") //关闭 { this.Close(); } else if (e.Tool.Key == "取样要求维护") { UltraGridRow ugr = this.ultraGrid1.ActiveRow; try { this.Cursor = Cursors.WaitCursor; FrmBaseSample fbs = new FrmBaseSample(); fbs.Ob = this._ob; //ob对象 fbs.CustomInfo = this.CustomInfo; fbs.Phycode = ugr.Cells["PHY_CODE_MIN"].Value.ToString(); //取样码 fbs.Phydesc = ugr.Cells["PHY_NAME_MIN"].Value.ToString(); //取样码描述 fbs.Stdcode = ugr.Cells["STD_CODE"].Value.ToString(); //标准代码 fbs.Stddesc = ugr.Cells["STD_NAME"].Value.ToString(); //标准名称 fbs.Load += new EventHandler((a, b) => { this.Cursor = Cursors.Default; }); fbs.ShowDialog(); QueryPhyDown(); } finally { this.Cursor = Cursors.Default; } } else if (e.Tool.Key == "试样要求维护") { DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CorePhySample.getSplineUnit", new object[] { }, Ob); if (dt.Rows.Count > 0 && dt.Rows[0]["DEPARTID"].ToString() != UserInfo.GetDeptid() && UserInfo.GetUserID() != "admin") { MessageUtil.ShowWarning("只有" + dt.Rows[0]["DEPARTNAME"].ToString() + "的成员才有权限维护!"); return; } string phyNameMin = this.ultraGrid1.ActiveRow.Cells["PHY_NAME_MIN"].Value.ToString(); ComBaseSplineFrm splineFrm = new ComBaseSplineFrm(Ob, phyNameMin, "FrmPhySamplePopup"); splineFrm.ShowDialog(); QueryPhyDown(); } else if (e.Tool.Key == "确认") { this.DialogResult = System.Windows.Forms.DialogResult.OK; } else if (e.Tool.Key == "设定试样码") { //DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CorePhySample.getSplineUnit", // new object[] { }, Ob); //if (dt.Rows.Count > 0 && dt.Rows[0]["DEPARTID"].ToString() != UserInfo.GetDeptid() && UserInfo.GetUserID() != "admin") //{ // MessageUtil.ShowWarning("只有" + dt.Rows[0]["DEPARTNAME"].ToString() + "的成员才有权限维护!"); // return; //} SetEic(); } } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; var ugr = ultraGrid1.ActiveRow; if (ugr != null) { QueryPhyDown(); } } finally { this.Cursor = Cursors.Default; } // var rows = _splineCtrl.UltraGrid1.Rows.AsQueryable().Where(a=>a.GetValue(""));; //foreach() } private void _splineCtrl_AfterRowActivate(object sender, EventArgs e) { var splineUgr = _splineCtrl.UltraGrid1.ActiveRow; var phyUgr = ultraGrid1.ActiveRow; _splineCCtrl.Query2(splineUgr.GetValue("Eic")); } private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { if (ultraTabControl1.SelectedTab.Text == "试样要求") { MessageUtil.ShowWarning("只有在维护取样要求时,才能选择试验标准!"); return; } this.Cursor = Cursors.WaitCursor; string phyCodeMin = ultraGrid1.ActiveRow.GetValue("PHY_CODE_MIN"); DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CorePhySample.QueryStdRTest", new object[] { phyCodeMin }, Ob); dt.Columns["STD_NAME_TEST"].Caption = "试验标准"; dt.Columns["MEMO"].Caption = "备注"; BaseInfoPopup baseInfoPopup = new BaseInfoPopup(dt, "STD_NAME_TEST", "STD_CODE_TEST"); baseInfoPopup.LabelTextBox1.Caption = "试验标准"; baseInfoPopup.Shown += new EventHandler((a, b) => { var actRow = baseInfoPopup.UltraGrid1.Rows.AsQueryable().Where( c => c.GetValue("STD_CODE_TEST") == ultraGrid1.ActiveRow.GetValue("STD_CODE_TEST")).FirstOrDefault(); if (actRow != null) { actRow.Activate(); } }); this.Cursor = Cursors.Default; if (baseInfoPopup.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ultraGrid1.ActiveRow.SetValue("STD_NAME_TEST", baseInfoPopup.ChoicedRow.GetValue("STD_NAME_TEST")); ultraGrid1.ActiveRow.SetValue("STD_CODE_TEST", baseInfoPopup.ChoicedRow.GetValue("STD_CODE_TEST")); ultraGrid1_AfterRowActivate(null, null); } } private void ultraGrid2_CellChange(object sender, CellEventArgs e) { ultraGrid2.UpdateData(); } private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e) { var colums = ultraGrid1.DisplayLayout.Bands[0].Columns.Cast().Where( a => a.Key == "STD_NAME" || a.Key == "PRODUCNAME" || a.Key == "STEELNAME" || a.Key == "USE_DESC" || a.Key == "ITEM_NAME_W"); if (e.Tab.Text == "试样要求") { foreach (var colum in colums) { colum.Hidden = true; } ultraToolbarsManager1.Tools["ButtonTool1"].SharedProps.Visible = false; ultraToolbarsManager1.Tools["取样要求维护"].SharedProps.Visible = false; ultraToolbarsManager1.Tools["试样要求维护"].SharedProps.Visible = true; ultraToolbarsManager1.Tools["设定试样码"].SharedProps.Visible = true; } else { foreach (var colum in colums) { colum.Hidden = false; } ultraToolbarsManager1.Tools["ButtonTool1"].SharedProps.Visible = true; ultraToolbarsManager1.Tools["取样要求维护"].SharedProps.Visible = true; ultraToolbarsManager1.Tools["试样要求维护"].SharedProps.Visible = false; ultraToolbarsManager1.Tools["设定试样码"].SharedProps.Visible = false; } } } }