| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732 |
- 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<ComBaseSplineEntity> splines = (List<ComBaseSplineEntity>)_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<string> list = new List<string>();
- 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<string> list2 = new List<string>();
- 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<UltraGridColumn>().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;
- }
- }
- }
- }
|