| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using CoreFS.SA06;
- using Infragistics.Win.UltraWinGrid;
- using Infragistics.Win.UltraWinTabControl;
- using Infragistics.Win.UltraWinToolbars;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class FrmStandarNSub : FrmBase
- {
- private FrmStandardN _frmStandarN = new FrmStandardN();
- private UltraGrid _gridCic = null;
- private UltraGrid _gridPic = null;
- private UltraGrid _gridSic = null;
- private UltraGrid _gridDic = null;
- private UltraGrid _gridWic = null;
- private UltraGrid _gridGic = null;
- private string _strCurrentTab = "CIC";
- //保存最终的索引
- private Dictionary<string, string> _dic = new Dictionary<string, string>();
- private bool _isCellChange = false;
- //保存临时选择的索引
- private List<string> _strCics = new List<string>();
- public List<string> StrCics
- {
- get { return _strCics; }
- set { _strCics = value; }
- }
- private List<string> _strPics = new List<string>();
- public List<string> StrPics
- {
- get { return _strPics; }
- set { _strPics = value; }
- }
- private List<string> _strSics = new List<string>();
- public List<string> StrSics
- {
- get { return _strSics; }
- set { _strSics = value; }
- }
- private List<string> _strDics = new List<string>();
- public List<string> StrDics
- {
- get { return _strDics; }
- set { _strDics = value; }
- }
- private List<string> _strWics = new List<string>();
- public List<string> StrWics
- {
- get { return _strWics; }
- set { _strWics = value; }
- }
- private List<string> _strGics = new List<string>();
- public List<string> StrGics
- {
- get { return _strGics; }
- set { _strGics = value; }
- }
- private ArrayList _gradeList;
- private string _processCode;
- private string _processName;
- private string _msc = "";
- public string Msc
- {
- get { return _msc; }
- set { _msc = value; }
- }
- private string _mscPline = "";
- public string MscPline
- {
- get { return _mscPline; }
- set { _mscPline = value; }
- }
- private string _steelcodeNk = "";
- public string SteelcodeNk
- {
- get { return _steelcodeNk; }
- set { _steelcodeNk = value; }
- }
- private string _steelnameNk = "";
- public string SteelnameNk
- {
- get { return _steelnameNk; }
- set { _steelnameNk = value; }
- }
- public FrmStandarNSub(string processCode, string processName, ArrayList gradeList, ArrayList gradeNames, string producCode,
- string producName, string msc, string mscPline, string steelcodeNk, string steelnameNk, string psc, OpeBase ob)
- {
- InitializeComponent();
- ExceptionHelper.RegistException();
- _frmStandarN.ProcessCode = processCode;
- _frmStandarN.ProductCode = producCode;
- _frmStandarN.ProducName = producName;
- _frmStandarN.SteelCodes = gradeList;
- _frmStandarN.SteelNames = gradeNames;
- _frmStandarN.Msc = msc;
- _frmStandarN.MscPline = mscPline;
- _frmStandarN.SteelcodeNk = steelcodeNk;
- _frmStandarN.SteelnameNk = steelnameNk;
- _frmStandarN.Psc = psc;
- this._msc = msc;
- this._mscPline = mscPline;
- _gradeList = gradeList;
- _processCode = processCode;
- _processName = processName;
- _steelcodeNk = steelcodeNk;
- _steelnameNk = steelnameNk;
- this.ob = ob;
- }
- private void FrmStandarNSub_Load(object sender, EventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- LoadStandPay();
- RegistEvent();
- _frmStandarN.ToolBar_Click(null, "doQuery");
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void ComboFilter()
- {
- _gridCic.DisplayLayout.Bands[0].Columns["STD_CODE_NK"].Header.Caption = "工序标准名称";
- string strGrade = "''";
- foreach (string str in _gradeList)
- {
- strGrade += ", '" + str + "'";
- }
- if (_strCurrentTab == "CIC")
- {
- //UltraComboEditor comboEditor = (UltraComboEditor)_gridCic.DisplayLayout.Bands[0].Columns["GRADECODE"].EditorComponent;
- //DataTable dt = (DataTable)comboEditor.DataSource;
- //dt.DefaultView.RowFilter = "GRADECODE IN (" + strGrade + ")";
- //UltraComboEditor comboEditor6 = (UltraComboEditor)_gridCic.DisplayLayout.Bands[0].Columns["PROCESS_CODE"].EditorComponent;
- //DataTable dt6 = (DataTable)comboEditor6.DataSource;
- //dt6.DefaultView.RowFilter = "PROCESS_CODE = '" + _processCode + "'";
- }
- else if (_strCurrentTab == "PIC")
- {
- //UltraComboEditor comboEditor2 = (UltraComboEditor)_gridPic.DisplayLayout.Bands[0].Columns["PROCESS_DESC"].EditorComponent;
- //DataTable dt2 = (DataTable)comboEditor2.DataSource;
- //dt2.DefaultView.RowFilter = "ID = '"+ _processCode +"'";
- //UltraComboEditor comboEditor = (UltraComboEditor)_gridPic.DisplayLayout.Bands[0].Columns["GRADECODE"].EditorComponent;
- //DataTable dt = (DataTable)comboEditor.DataSource;
- //dt.DefaultView.RowFilter = "GRADECODE IN (" + strGrade + ")";
- }
- else if (_strCurrentTab == "SIC")
- {
- //UltraComboEditor comboEditor3 = (UltraComboEditor)_gridSic.DisplayLayout.Bands[0].Columns["PROCESS_CODE"].EditorComponent;
- //DataTable dt3 = (DataTable)comboEditor3.DataSource;
- //dt3.DefaultView.RowFilter = "PROCESS_CODE = '" + _processCode + "'";
- }
- else if (_strCurrentTab == "DIC")
- {
- //UltraComboEditor comboEditor4 = (UltraComboEditor)_gridDic.DisplayLayout.Bands[0].Columns["PROCESS_CODE"].EditorComponent;
- //DataTable dt4 = (DataTable)comboEditor4.DataSource;
- //dt4.DefaultView.RowFilter = "PROCESS_CODE = '" + _processCode + "'";
- }
- else if (_strCurrentTab == "WIC")
- {
- //UltraComboEditor comboEditor5 = (UltraComboEditor)_gridWic.DisplayLayout.Bands[0].Columns["PROCESS_DESC"].EditorComponent;
- //DataTable dt5 = (DataTable)comboEditor5.DataSource;
- //dt5.DefaultView.RowFilter = "ID = '" + _processCode + "'";
- }
- //G表示加工工序,加工标准只能是加工工序
- //if (_processCode == "G")
- //{
- // UltraComboEditor comboEditor7 = (UltraComboEditor)_gridGic.DisplayLayout.Bands[0].Columns["PROCESS_CDOE"].EditorComponent;
- // DataTable dt7 = (DataTable)comboEditor7.DataSource;
- // dt7.DefaultView.RowFilter = "PROCESS_CODE = '" + _processCode + "'";
- //}
- }
- private void RegistEvent()
- {
- _frmStandarN.UltraTabControl1.SelectedTabChanged += new SelectedTabChangedEventHandler(TabControlChangeEvent);
- _gridCic = _frmStandarN.CtrlMscChem.Grid;
- _gridPic = _frmStandarN.CtrlMscMaterial.Grid;
- _gridDic = _frmStandarN.CtrlMscDetection.Grid;
- _gridSic = _frmStandarN.CtrlMscTolerances.Grid;
- _gridWic = _frmStandarN.CtrlMscProductWater.Grid;
- _gridGic = _frmStandarN.CtrlMscStdProcess.Grid;
- _gridCic.CellChange += new CellEventHandler(GridCellChangeEvent);
- _gridCic.AfterRowInsert += new RowEventHandler(grid_AfterRowInsert);
- _gridCic.BeforeRowInsert += new BeforeRowInsertEventHandler(grid_BeforeRowInsert);
- _gridPic.CellChange += new CellEventHandler(GridCellChangeEvent);
- _gridPic.AfterRowInsert += new RowEventHandler(grid_AfterRowInsert);
- _gridPic.BeforeRowInsert += new BeforeRowInsertEventHandler(grid_BeforeRowInsert);
- _gridDic.CellChange += new CellEventHandler(GridCellChangeEvent);
- _gridDic.AfterRowInsert += new RowEventHandler(grid_AfterRowInsert);
- _gridDic.BeforeRowInsert += new BeforeRowInsertEventHandler(grid_BeforeRowInsert);
- _gridSic.CellChange += new CellEventHandler(GridCellChangeEvent);
- _gridSic.AfterRowInsert += new RowEventHandler(grid_AfterRowInsert);
- _gridSic.BeforeRowInsert += new BeforeRowInsertEventHandler(grid_BeforeRowInsert);
- _gridWic.CellChange += new CellEventHandler(GridCellChangeEvent);
- _gridWic.AfterRowInsert += new RowEventHandler(grid_AfterRowInsert);
- _gridWic.BeforeRowInsert += new BeforeRowInsertEventHandler(grid_BeforeRowInsert);
- _gridGic.CellChange += new CellEventHandler(GridCellChangeEvent);
- _gridGic.AfterRowInsert += new RowEventHandler(grid_AfterRowInsert);
- _gridGic.BeforeRowInsert += new BeforeRowInsertEventHandler(grid_BeforeRowInsert);
- _frmStandarN.UltraToolbarsManager1.ToolClick += new ToolClickEventHandler(FrmStandarNSub_ToolClick);
- _frmStandarN.AfterRowActivate += new EventHandler(_frmStandarN_AfterRowActivate);
- }
- private void grid_BeforeRowInsert(object sender, BeforeRowInsertEventArgs e)
- {
- if (e.ParentRow != null) return;
- if (_strCurrentTab == "GIC")
- {
- if (_processCode != "G")
- {
- MessageUtil.ShowWarning("只有加工工序,才能维护内控加工标准!");
- e.Cancel = true;
- }
- }
- }
- private void grid_AfterRowInsert(object sender, RowEventArgs e)
- {
- //if (e.Row.HasParent()) return;
- //if (_strCurrentTab == "CIC")
- //{
- // e.Row.Cells["PROCESS_CODE"].Value = _processCode;
- //}
- //else if (_strCurrentTab == "PIC")
- //{
- // e.Row.Cells["PROCESS_DESC"].Value = _processCode;
- //}
- //else if (_strCurrentTab == "SIC")
- //{
- // e.Row.Cells["PROCESS_CODE"].Value = _processCode;
- //}
- //else if (_strCurrentTab == "DIC")
- //{
- // e.Row.Cells["PROCESS_CODE"].Value = _processCode;
- //}
- //else if(_strCurrentTab == "WIC")
- //{
- // e.Row.Cells["PROCESS_DESC"].Value = _processCode;
- //}
- //else if(_strCurrentTab == "GIC")
- //{
- // e.Row.Cells["PROCESS_CDOE"].Value = _processCode;
- //}
- }
- private void LoadStandPay()
- {
- panel2.Controls.Add(_frmStandarN.SplitContainer1);
- panel2.Controls.Add(_frmStandarN.UltraPanel1);
- _frmStandarN.PopupLoad("2", ob); //直接调用onload
- //_frmStandarN.SplitContainer1.BringToFront();
- }
- private void _frmStandarN_AfterRowActivate(object sender, EventArgs e)
- {
- if (_strCurrentTab == "CIC")
- {
- //SetGridRowSelect(_gridCic, "CIC", _strCics);
- }
- else if (_strCurrentTab == "PIC")
- {
- //SetGridRowSelect(_gridPic, "PIC", _strPics);
- }
- else if (_strCurrentTab == "SIC")
- {
- //SetGridRowSelect(_gridSic, "SIC", _strSics);
- }
- else if (_strCurrentTab == "DIC")
- {
- //SetGridRowSelect(_gridDic, "DIC", _strDics);
- }
- else if (_strCurrentTab == "WIC")
- {
- //SetGridRowSelect(_gridWic, "WIC", _strWics);
- }
- else if (_strCurrentTab == "GIC")
- {
- //SetGridRowSelect(_gridGic, "GIC", _strGics);
- }
- if (_frmStandarN.UltraTabControl1.Tabs["1"].Visible == false)
- {
- _strCics.Clear();
- }
- else if (_frmStandarN.UltraTabControl1.Tabs["2"].Visible == false)
- {
- _strPics.Clear();
- }
- else if (_frmStandarN.UltraTabControl1.Tabs["3"].Visible == false)
- {
- _strSics.Clear();
- }
- else if (_frmStandarN.UltraTabControl1.Tabs["4"].Visible == false)
- {
- _strDics.Clear();
- }
- else if (_frmStandarN.UltraTabControl1.Tabs["5"].Visible == false)
- {
- _strWics.Clear();
- }
- else if (_frmStandarN.UltraTabControl1.Tabs["6"].Visible == false)
- {
- _strGics.Clear();
- }
- ComboFilter();
- }
- //private void grid_InitializeRow(object sender, InitializeRowEventArgs e)
- //{
- // if (_isCellChange == false)
- // {
- // SetGridRowSelect(e, "CIC", _strCics);
- // }
- //}
- private void GridCellChangeEvent(object sender, CellEventArgs e)
- {
- _isCellChange = true;
- try
- {
- UltraGrid grid = (UltraGrid)sender;
- string tableName = grid.DataMember;
- if (e.Cell.Column.Key == "CHC" && e.Cell.Row.Cells["CREATE_TIME"].Value.ToString() != "")
- {
- grid.UpdateData();
- if (grid.DisplayLayout.Bands[tableName].Columns.Exists("CIC"))
- {
- string strIC = e.Cell.Row.Cells["CIC"].Value.ToString();
- if (e.Cell.Value.ToString() == "True" && _strCics.Contains(strIC) == false)
- {
- _strCics.Add(strIC);
- }
- else
- {
- _strCics.Remove(strIC);
- }
- }
- else if (grid.DisplayLayout.Bands[tableName].Columns.Exists("DIC"))
- {
- string strIC = e.Cell.Row.Cells["DIC"].Value.ToString();
- if (e.Cell.Value.ToString() == "True" && _strCics.Contains(strIC) == false)
- {
- _strDics.Add(strIC);
- }
- else
- {
- _strDics.Remove(strIC);
- }
- }
- else if (grid.DisplayLayout.Bands[tableName].Columns.Exists("PIC"))
- {
- string strIC = e.Cell.Row.Cells["PIC"].Value.ToString();
- if (e.Cell.Value.ToString() == "True" && _strCics.Contains(strIC) == false)
- {
- _strPics.Add(strIC);
- }
- else
- {
- _strPics.Remove(strIC);
- }
- }
- else if (grid.DisplayLayout.Bands[tableName].Columns.Exists("SIC"))
- {
- string strIC = e.Cell.Row.Cells["SIC"].Value.ToString();
- if (e.Cell.Value.ToString() == "True" && _strCics.Contains(strIC) == false)
- {
- _strSics.Add(strIC);
- }
- else
- {
- _strSics.Remove(strIC);
- }
- }
- else if (grid.DisplayLayout.Bands[tableName].Columns.Exists("WIC"))
- {
- string strIC = e.Cell.Row.Cells["WIC"].Value.ToString();
- if (e.Cell.Value.ToString() == "True" && _strCics.Contains(strIC) == false)
- {
- _strWics.Add(strIC);
- }
- else
- {
- _strWics.Remove(strIC);
- }
- }
- else if (grid.DisplayLayout.Bands[tableName].Columns.Exists("GIC"))
- {
- string strIC = e.Cell.Row.Cells["GIC"].Value.ToString();
- if (e.Cell.Value.ToString() == "True" && _strGics.Contains(strIC) == false)
- {
- _strGics.Add(strIC);
- }
- else
- {
- _strGics.Remove(strIC);
- }
- }
- grid.UpdateData();
- }
- }
- finally
- {
- _isCellChange = false;
- }
- }
- private void TabControlChangeEvent(object sender, SelectedTabChangedEventArgs e)
- {
- //this.Cursor = Cursors.WaitCursor;
- UltraTabControl tab = (UltraTabControl)sender;
- if (tab.Name == "ultraTabControl1")
- {
- switch (e.Tab.Key)
- {
- case "1":
- _strCurrentTab = "CIC";
- //SetGridRowSelect(_gridCic, "CIC", _strCics);
- ComboFilter();
- break;
- case "2":
- _strCurrentTab = "PIC";
- //SetGridRowSelect(_gridPic, "PIC", _strPics);
- ComboFilter();
- break;
- case "3":
- _strCurrentTab = "SIC";
- //SetGridRowSelect(_gridSic, "SIC", _strSics);
- ComboFilter();
- break;
- case "4":
- _strCurrentTab = "DIC";
- //SetGridRowSelect(_gridDic, "DIC", _strDics);
- ComboFilter();
- break;
- case "5":
- _strCurrentTab = "WIC";
- //SetGridRowSelect(_gridWic, "WIC", _strWics);
- ComboFilter();
- break;
- case "6":
- _strCurrentTab = "GIC";
- //SetGridRowSelect(_gridGic, "GIC", _strGics);
- ComboFilter();
- break;
- }
- }
- //this.Cursor = Cursors.Default;
- }
- void FrmStandarNSub_ToolClick(object sender, ToolClickEventArgs e)
- {
- if (_strCurrentTab == "CIC")
- {
- //SetGridRowSelect(_gridCic, "CIC", _strCics);
- }
- else if (_strCurrentTab == "PIC")
- {
- //SetGridRowSelect(_gridPic, "PIC", _strPics);
- }
- else if (_strCurrentTab == "SIC")
- {
- //SetGridRowSelect(_gridSic, "SIC", _strSics);
- }
- else if (_strCurrentTab == "DIC")
- {
- //SetGridRowSelect(_gridDic, "DIC", _strDics);
- }
- else if (_strCurrentTab == "WIC")
- {
- //SetGridRowSelect(_gridWic, "WIC", _strWics);
- }
- }
- private void SetGridRowSelect(UltraGrid grid, string strIcKey, List<string> strIcs)
- {
- foreach (string strIc in strIcs)
- {
- UltraGridRow[] rows = GridHelper.GetRowsWithKey(grid, new string[] { strIcKey }, new string[] { strIc });
- if (rows.Length > 0)
- {
- rows[0].Cells["CHC"].Value = true;
- if (strIcKey == "CIC")
- {
- _frmStandarN.CtrlMscChem._frmChemStd.ultraGrid1_CellChange(null, new CellEventArgs(rows[0].Cells["CHC"]));
- }
- else if (strIcKey == "PIC")
- {
- _frmStandarN.CtrlMscMaterial._frmMaterialStd.ultraGrid1_CellChange(null, new CellEventArgs(rows[0].Cells["CHC"]));
- }
- else if (strIcKey == "SIC")
- {
- _frmStandarN.CtrlMscTolerances._frmTolerancesStd.ultraGrid1_CellChange(null, new CellEventArgs(rows[0].Cells["CHC"]));
- }
- else if (strIcKey == "DIC")
- {
- _frmStandarN.CtrlMscDetection._frmDetectionStd.ultraGrid1_CellChange(null, new CellEventArgs(rows[0].Cells["CHC"]));
- }
- else if (strIcKey == "WIC")
- {
- _frmStandarN.CtrlMscProductWater._frmWaterStd.ultraGrid1_CellChange(null, new CellEventArgs(rows[0].Cells["CHC"]));
- }
- else if (strIcKey == "GIC")
- {
- _frmStandarN.CtrlMscStdProcess._frmProcessStd.ultraGrid1_CellChange(null, new CellEventArgs(rows[0].Cells["CHC"]));
- }
- grid.UpdateData();
- }
- }
- //if (Row.Cells.Exists("CIC"))
- //{
- // if (_strIcs.Contains(e.Row.Cells["CIC"].Value.ToString()))
- // {
- // e.Row.Cells["CHC"].Value = true;
- // }
- // else
- // {
- // e.Row.Cells["CHC"].Value = false;
- // }
- //}
- //if (e.Row.Cells.Exists("PIC"))
- //{
- // if (_strIcs.Contains(e.Row.Cells["PIC"].Value.ToString()))
- // {
- // e.Row.Cells["CHC"].Value = true;
- // }
- // else
- // {
- // e.Row.Cells["CHC"].Value = false;
- // }
- //}
- //if (e.Row.Cells.Exists("SIC"))
- //{
- // if (_strIcs.Contains(e.Row.Cells["SIC"].Value.ToString()))
- // {
- // e.Row.Cells["CHC"].Value = true;
- // }
- // else
- // {
- // e.Row.Cells["CHC"].Value = false;
- // }
- //}
- //if (e.Row.Cells.Exists("DIC"))
- //{
- // if (_strIcs.Contains(e.Row.Cells["DIC"].Value.ToString()))
- // {
- // e.Row.Cells["CHC"].Value = true;
- // }
- // else
- // {
- // e.Row.Cells["CHC"].Value = false;
- // }
- //}
- //if (e.Row.Cells.Exists("WIC"))
- //{
- // if (_strIcs.Contains(e.Row.Cells["WIC"].Value.ToString()))
- // {
- // e.Row.Cells["CHC"].Value = true;
- // }
- // else
- // {
- // e.Row.Cells["CHC"].Value = false;
- // }
- //}
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "查询":
- _frmStandarN.ToolBar_Click(null, "doQuery");
- break;
- case "保存":
- _frmStandarN.ToolBar_Click(null, "doSave");
- ComboFilter();
- break;
- case "作废":
- _frmStandarN.ToolBar_Click(null, "doDelete");
- break;
- case "恢复":
- _frmStandarN.ToolBar_Click(null, "doResume");
- break;
- case "刷新":
- _frmStandarN.ToolBar_Click(null, "Refresh");
- ComboFilter();
- break;
- case "工艺参数":
- MSCCraft();
- break;
- case "复制交付标准":
- CopyStandPay();
- break;
- }
- }
- public static int GetSameGradeCnt(string gradeCode, string stdCodeNk, OpeBase ob)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreInnerMSCRGRD2.getSameGradeCnt",
- new object[] { gradeCode, stdCodeNk }, ob);
- return Convert.ToInt32(dt.Rows[0]["CNT"].ToString());
- }
- private void CopyStandPay()
- {
- string stdCodeNk = _frmStandarN.ultraGrid1.ActiveRow.GetValue("STD_CODE");
- string stdNameNk = _frmStandarN.ultraGrid1.ActiveRow.GetValue("STD_NAME");
- DataRow stdRow = GetStdByPk(stdCodeNk);
- if (stdRow["ACCEPT_BID"].ToString() == "1" && UserInfo.GetDeptid() != stdRow["UNIT_CODE"].ToString()
- && UserInfo.GetUserID() != "admin")
- {
- MessageUtil.ShowWarning(string.Format("该内控标准已纳标,只有{0}的成员才能操作!", stdRow["UNIT_DESC"].ToString()));
- return;
- }
- string gradeCode = "";
- string gradeName = "";
- //if (_frmStandarN.UltraTabControl1.Tabs["1"].Visible)//只有存在成分才判断
- //{
- // ChoiceGradePopup gradePopup = new ChoiceGradePopup(_msc, _mscPline, ob);
- // if (gradePopup.ShowDialog() != System.Windows.Forms.DialogResult.OK)
- // {
- // return;
- // }
- // gradeCode = gradePopup.GradeCode;
- // gradeName = gradePopup.GradeName;
- // if (GetSameGradeCnt(gradeCode, stdCodeNk, ob) >= 9)
- // {
- // MessageUtil.ShowWarning("钢种:" + gradeName + "之下已经维护了9条(或超过9条)成分内控,无法继续新增!");
- // return;
- // }
- //}
- if (MessageUtil.ShowYesNoAndQuestion("是否确认复制交付标准?") == System.Windows.Forms.DialogResult.No)
- {
- return;
- }
- ServerHelper.SetData("com.steering.pss.qcm.CoreInnerMSCRGRD2.copyStandPay",
- new object[] { _msc, _mscPline, stdCodeNk, stdNameNk, _processCode,
- _processName, gradeCode, gradeName, CoreUserInfo.UserInfo.GetUserName()}, ob);
- MessageUtil.ShowTips("复制成功!");
- _frmStandarN.ultraGrid1_AfterRowActivate(null, null);
- //_frmStandarN.ultraGrid1
- }
- private DataRow GetStdByPk(string stdCode)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreInnerMSCRGRD2.getStdByPk",
- new object[] { stdCode }, ob);
- return dt.Rows[0];
- }
- private void MSCCraft()
- {
- if (_msc == "" && _mscPline == "")
- {
- MessageUtil.ShowWarning("请先新增制程,然后再维护工艺参数!");
- return;
- }
- PopupMscCraft mscCraft = new PopupMscCraft(_msc, _mscPline, _processCode, ob);
- mscCraft.Show();
- }
- private void btnOk_Click(object sender, EventArgs e)
- {
- if (isSameStd() == true)
- {
- MessageUtil.ShowWarning("不能在多个标准下选择索引码!");
- return;
- }
- if (!_frmStandarN.UltraTabControl1.Tabs["1"].Visible)
- {
- _strCics.Clear();
- }
- if (!_frmStandarN.UltraTabControl1.Tabs["2"].Visible)
- {
- _strPics.Clear();
- }
- if (!_frmStandarN.UltraTabControl1.Tabs["3"].Visible)
- {
- _strDics.Clear();
- }
- if (!_frmStandarN.UltraTabControl1.Tabs["4"].Visible)
- {
- _strSics.Clear();
- }
- if (!_frmStandarN.UltraTabControl1.Tabs["5"].Visible)
- {
- _strWics.Clear();
- }
- if (!_frmStandarN.UltraTabControl1.Tabs["6"].Visible)
- {
- _strGics.Clear();
- }
- foreach (UltraGridRow row in _gridCic.Rows)
- {
- if (row.GetValue("CHC") == "False") continue;
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreChemStandard.getMscCicByCic",
- new object[] { row.GetValue("CIC") }, ob);
- if (!dt.Rows[0]["PROCESS_CODE"].ToString().Contains(_processCode))
- {
- MessageUtil.ShowWarning("只能关联适用工序包含" + _processName + "的成分内控!");
- return;
- }
- if (!_strCics.Contains(row.GetValue("CIC"))) _strCics.Add(row.GetValue("CIC"));
- }
- foreach (UltraGridRow row in _gridPic.Rows)
- {
- if (row.GetValue("CHC") == "False") continue;
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ComMaterial.getComPicByPic",
- new object[] { row.GetValue("PIC") }, ob);
- if (!dt.Rows[0]["PROCESS_CDOE"].ToString().Contains(_processCode))
- {
- MessageUtil.ShowWarning("只能关联适用工序包含" + _processName + "的理化内控!");
- return;
- }
- if (!_strPics.Contains(row.GetValue("PIC"))) _strPics.Add(row.GetValue("PIC"));
- }
- foreach (UltraGridRow row in _gridDic.Rows)
- {
- if (row.GetValue("CHC") == "False") continue;
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreDetection.getComDicByDic",
- new object[] { row.GetValue("DIC") }, ob);
- if (!dt.Rows[0]["PROCESS_CODE"].ToString().Contains(_processCode))
- {
- MessageUtil.ShowWarning("只能关联适用工序包含" + _processName + "的探伤内控!");
- return;
- }
- if (!_strDics.Contains(row.GetValue("DIC"))) _strDics.Add(row.GetValue("DIC"));
- }
- foreach (UltraGridRow row in _gridSic.Rows)
- {
- if (row.GetValue("CHC") == "False") continue;
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreTolerances.getComSicBySic",
- new object[] { row.GetValue("SIC") }, ob);
- if (!dt.Rows[0]["PROCESS_CODE"].ToString().Contains(_processCode))
- {
- MessageUtil.ShowWarning("只能关联适用工序包含" + _processName + "的公差内控!");
- return;
- }
- if (!_strSics.Contains(row.GetValue("SIC"))) _strSics.Add(row.GetValue("SIC"));
- }
- foreach (UltraGridRow row in _gridWic.Rows)
- {
- if (row.GetValue("CHC") == "False") continue;
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreWaterStand.getComWicByWic",
- new object[] { row.GetValue("WIC") }, ob);
- if (!dt.Rows[0]["PROCESS_CDOE"].ToString().Contains(_processCode))
- {
- MessageUtil.ShowWarning("只能关联适用工序包含" + _processName + "的水压内控!");
- return;
- }
- if (!_strWics.Contains(row.GetValue("WIC"))) _strWics.Add(row.GetValue("WIC"));
- }
- foreach (UltraGridRow row in _gridGic.Rows)
- {
- if (row.GetValue("CHC") == "False") continue;
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreComMscStdProcess.getComGicByGic",
- new object[] { row.GetValue("GIC") }, ob);
- if (!dt.Rows[0]["PROCESS_CDOE"].ToString().Contains(_processCode))
- {
- MessageUtil.ShowWarning("只能关联适用工序包含" + _processName + "的加工内控!");
- return;
- }
- if (!_strGics.Contains(row.GetValue("GIC"))) _strGics.Add(row.GetValue("GIC"));
- }
- string cics = GetICsFromList(_strCics);
- string pics = GetICsFromList(_strPics);
- string sics = GetICsFromList(_strSics);
- string dics = GetICsFromList(_strDics);
- string wics = GetICsFromList(_strWics);
- string gics = GetICsFromList(_strGics);
- ServerHelper.SetData("com.steering.pss.qcm.CoreInnerMSCRGRD2.updateMscProcessNk",
- new object[] { _msc, _mscPline, _processCode, cics, pics, sics, dics, wics, gics }, ob);
- MessageUtil.ShowTips("保存成功!");
- this.DialogResult = DialogResult.OK;
- }
- private string GetICsFromList(List<string> list)
- {
- string iCs = "";
- foreach (string str in list)
- {
- iCs += iCs == "" ? str : ("," + str);
- }
- return iCs;
- }
- private bool isSameStd()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreInnerMSCRGRD2.queryStdNkCnt",
- new object[] { _strCics, _strPics, _strSics, _strDics, _strWics }, this.ob);
- if (dt.Rows[0][0].ToString() == "0" || dt.Rows[0][0].ToString() == "1")
- {
- return false;
- }
- else
- {
- return true;
- }
- }
- private void btnCancel_Click(object sender, EventArgs e)
- {
- this.DialogResult = DialogResult.Cancel;
- }
- }
- }
|