FrmStandarNSub.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using CoreFS.CA06;
  5. using CoreFS.SA06;
  6. using Infragistics.Win.UltraWinGrid;
  7. using Infragistics.Win.UltraWinTabControl;
  8. using Infragistics.Win.UltraWinToolbars;
  9. using System;
  10. using System.Collections;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Windows.Forms;
  14. namespace Core.StlMes.Client.Qcm
  15. {
  16. public partial class FrmStandarNSub : FrmBase
  17. {
  18. private FrmStandardN _frmStandarN = new FrmStandardN();
  19. private UltraGrid _gridCic = null;
  20. private UltraGrid _gridPic = null;
  21. private UltraGrid _gridSic = null;
  22. private UltraGrid _gridDic = null;
  23. private UltraGrid _gridWic = null;
  24. private UltraGrid _gridGic = null;
  25. private string _strCurrentTab = "CIC";
  26. //保存最终的索引
  27. private Dictionary<string, string> _dic = new Dictionary<string, string>();
  28. private bool _isCellChange = false;
  29. //保存临时选择的索引
  30. private List<string> _strCics = new List<string>();
  31. public List<string> StrCics
  32. {
  33. get { return _strCics; }
  34. set { _strCics = value; }
  35. }
  36. private List<string> _strPics = new List<string>();
  37. public List<string> StrPics
  38. {
  39. get { return _strPics; }
  40. set { _strPics = value; }
  41. }
  42. private List<string> _strSics = new List<string>();
  43. public List<string> StrSics
  44. {
  45. get { return _strSics; }
  46. set { _strSics = value; }
  47. }
  48. private List<string> _strDics = new List<string>();
  49. public List<string> StrDics
  50. {
  51. get { return _strDics; }
  52. set { _strDics = value; }
  53. }
  54. private List<string> _strWics = new List<string>();
  55. public List<string> StrWics
  56. {
  57. get { return _strWics; }
  58. set { _strWics = value; }
  59. }
  60. private List<string> _strGics = new List<string>();
  61. public List<string> StrGics
  62. {
  63. get { return _strGics; }
  64. set { _strGics = value; }
  65. }
  66. private ArrayList _gradeList;
  67. private string _processCode;
  68. private string _processName;
  69. private string _msc = "";
  70. public string Msc
  71. {
  72. get { return _msc; }
  73. set { _msc = value; }
  74. }
  75. private string _mscPline = "";
  76. public string MscPline
  77. {
  78. get { return _mscPline; }
  79. set { _mscPline = value; }
  80. }
  81. private string _steelcodeNk = "";
  82. public string SteelcodeNk
  83. {
  84. get { return _steelcodeNk; }
  85. set { _steelcodeNk = value; }
  86. }
  87. private string _steelnameNk = "";
  88. public string SteelnameNk
  89. {
  90. get { return _steelnameNk; }
  91. set { _steelnameNk = value; }
  92. }
  93. public FrmStandarNSub(string processCode, string processName, ArrayList gradeList, ArrayList gradeNames, string producCode,
  94. string producName, string msc, string mscPline, string steelcodeNk, string steelnameNk, string psc, OpeBase ob)
  95. {
  96. InitializeComponent();
  97. ExceptionHelper.RegistException();
  98. _frmStandarN.ProcessCode = processCode;
  99. _frmStandarN.ProductCode = producCode;
  100. _frmStandarN.ProducName = producName;
  101. _frmStandarN.SteelCodes = gradeList;
  102. _frmStandarN.SteelNames = gradeNames;
  103. _frmStandarN.Msc = msc;
  104. _frmStandarN.MscPline = mscPline;
  105. _frmStandarN.SteelcodeNk = steelcodeNk;
  106. _frmStandarN.SteelnameNk = steelnameNk;
  107. _frmStandarN.Psc = psc;
  108. this._msc = msc;
  109. this._mscPline = mscPline;
  110. _gradeList = gradeList;
  111. _processCode = processCode;
  112. _processName = processName;
  113. _steelcodeNk = steelcodeNk;
  114. _steelnameNk = steelnameNk;
  115. this.ob = ob;
  116. }
  117. private void FrmStandarNSub_Load(object sender, EventArgs e)
  118. {
  119. try
  120. {
  121. this.Cursor = Cursors.WaitCursor;
  122. LoadStandPay();
  123. RegistEvent();
  124. _frmStandarN.ToolBar_Click(null, "doQuery");
  125. }
  126. finally
  127. {
  128. this.Cursor = Cursors.Default;
  129. }
  130. }
  131. private void ComboFilter()
  132. {
  133. _gridCic.DisplayLayout.Bands[0].Columns["STD_CODE_NK"].Header.Caption = "工序标准名称";
  134. string strGrade = "''";
  135. foreach (string str in _gradeList)
  136. {
  137. strGrade += ", '" + str + "'";
  138. }
  139. if (_strCurrentTab == "CIC")
  140. {
  141. //UltraComboEditor comboEditor = (UltraComboEditor)_gridCic.DisplayLayout.Bands[0].Columns["GRADECODE"].EditorComponent;
  142. //DataTable dt = (DataTable)comboEditor.DataSource;
  143. //dt.DefaultView.RowFilter = "GRADECODE IN (" + strGrade + ")";
  144. //UltraComboEditor comboEditor6 = (UltraComboEditor)_gridCic.DisplayLayout.Bands[0].Columns["PROCESS_CODE"].EditorComponent;
  145. //DataTable dt6 = (DataTable)comboEditor6.DataSource;
  146. //dt6.DefaultView.RowFilter = "PROCESS_CODE = '" + _processCode + "'";
  147. }
  148. else if (_strCurrentTab == "PIC")
  149. {
  150. //UltraComboEditor comboEditor2 = (UltraComboEditor)_gridPic.DisplayLayout.Bands[0].Columns["PROCESS_DESC"].EditorComponent;
  151. //DataTable dt2 = (DataTable)comboEditor2.DataSource;
  152. //dt2.DefaultView.RowFilter = "ID = '"+ _processCode +"'";
  153. //UltraComboEditor comboEditor = (UltraComboEditor)_gridPic.DisplayLayout.Bands[0].Columns["GRADECODE"].EditorComponent;
  154. //DataTable dt = (DataTable)comboEditor.DataSource;
  155. //dt.DefaultView.RowFilter = "GRADECODE IN (" + strGrade + ")";
  156. }
  157. else if (_strCurrentTab == "SIC")
  158. {
  159. //UltraComboEditor comboEditor3 = (UltraComboEditor)_gridSic.DisplayLayout.Bands[0].Columns["PROCESS_CODE"].EditorComponent;
  160. //DataTable dt3 = (DataTable)comboEditor3.DataSource;
  161. //dt3.DefaultView.RowFilter = "PROCESS_CODE = '" + _processCode + "'";
  162. }
  163. else if (_strCurrentTab == "DIC")
  164. {
  165. //UltraComboEditor comboEditor4 = (UltraComboEditor)_gridDic.DisplayLayout.Bands[0].Columns["PROCESS_CODE"].EditorComponent;
  166. //DataTable dt4 = (DataTable)comboEditor4.DataSource;
  167. //dt4.DefaultView.RowFilter = "PROCESS_CODE = '" + _processCode + "'";
  168. }
  169. else if (_strCurrentTab == "WIC")
  170. {
  171. //UltraComboEditor comboEditor5 = (UltraComboEditor)_gridWic.DisplayLayout.Bands[0].Columns["PROCESS_DESC"].EditorComponent;
  172. //DataTable dt5 = (DataTable)comboEditor5.DataSource;
  173. //dt5.DefaultView.RowFilter = "ID = '" + _processCode + "'";
  174. }
  175. //G表示加工工序,加工标准只能是加工工序
  176. //if (_processCode == "G")
  177. //{
  178. // UltraComboEditor comboEditor7 = (UltraComboEditor)_gridGic.DisplayLayout.Bands[0].Columns["PROCESS_CDOE"].EditorComponent;
  179. // DataTable dt7 = (DataTable)comboEditor7.DataSource;
  180. // dt7.DefaultView.RowFilter = "PROCESS_CODE = '" + _processCode + "'";
  181. //}
  182. }
  183. private void RegistEvent()
  184. {
  185. _frmStandarN.UltraTabControl1.SelectedTabChanged += new SelectedTabChangedEventHandler(TabControlChangeEvent);
  186. _gridCic = _frmStandarN.CtrlMscChem.Grid;
  187. _gridPic = _frmStandarN.CtrlMscMaterial.Grid;
  188. _gridDic = _frmStandarN.CtrlMscDetection.Grid;
  189. _gridSic = _frmStandarN.CtrlMscTolerances.Grid;
  190. _gridWic = _frmStandarN.CtrlMscProductWater.Grid;
  191. _gridGic = _frmStandarN.CtrlMscStdProcess.Grid;
  192. _gridCic.CellChange += new CellEventHandler(GridCellChangeEvent);
  193. _gridCic.AfterRowInsert += new RowEventHandler(grid_AfterRowInsert);
  194. _gridCic.BeforeRowInsert += new BeforeRowInsertEventHandler(grid_BeforeRowInsert);
  195. _gridPic.CellChange += new CellEventHandler(GridCellChangeEvent);
  196. _gridPic.AfterRowInsert += new RowEventHandler(grid_AfterRowInsert);
  197. _gridPic.BeforeRowInsert += new BeforeRowInsertEventHandler(grid_BeforeRowInsert);
  198. _gridDic.CellChange += new CellEventHandler(GridCellChangeEvent);
  199. _gridDic.AfterRowInsert += new RowEventHandler(grid_AfterRowInsert);
  200. _gridDic.BeforeRowInsert += new BeforeRowInsertEventHandler(grid_BeforeRowInsert);
  201. _gridSic.CellChange += new CellEventHandler(GridCellChangeEvent);
  202. _gridSic.AfterRowInsert += new RowEventHandler(grid_AfterRowInsert);
  203. _gridSic.BeforeRowInsert += new BeforeRowInsertEventHandler(grid_BeforeRowInsert);
  204. _gridWic.CellChange += new CellEventHandler(GridCellChangeEvent);
  205. _gridWic.AfterRowInsert += new RowEventHandler(grid_AfterRowInsert);
  206. _gridWic.BeforeRowInsert += new BeforeRowInsertEventHandler(grid_BeforeRowInsert);
  207. _gridGic.CellChange += new CellEventHandler(GridCellChangeEvent);
  208. _gridGic.AfterRowInsert += new RowEventHandler(grid_AfterRowInsert);
  209. _gridGic.BeforeRowInsert += new BeforeRowInsertEventHandler(grid_BeforeRowInsert);
  210. _frmStandarN.UltraToolbarsManager1.ToolClick += new ToolClickEventHandler(FrmStandarNSub_ToolClick);
  211. _frmStandarN.AfterRowActivate += new EventHandler(_frmStandarN_AfterRowActivate);
  212. }
  213. private void grid_BeforeRowInsert(object sender, BeforeRowInsertEventArgs e)
  214. {
  215. if (e.ParentRow != null) return;
  216. if (_strCurrentTab == "GIC")
  217. {
  218. if (_processCode != "G")
  219. {
  220. MessageUtil.ShowWarning("只有加工工序,才能维护内控加工标准!");
  221. e.Cancel = true;
  222. }
  223. }
  224. }
  225. private void grid_AfterRowInsert(object sender, RowEventArgs e)
  226. {
  227. //if (e.Row.HasParent()) return;
  228. //if (_strCurrentTab == "CIC")
  229. //{
  230. // e.Row.Cells["PROCESS_CODE"].Value = _processCode;
  231. //}
  232. //else if (_strCurrentTab == "PIC")
  233. //{
  234. // e.Row.Cells["PROCESS_DESC"].Value = _processCode;
  235. //}
  236. //else if (_strCurrentTab == "SIC")
  237. //{
  238. // e.Row.Cells["PROCESS_CODE"].Value = _processCode;
  239. //}
  240. //else if (_strCurrentTab == "DIC")
  241. //{
  242. // e.Row.Cells["PROCESS_CODE"].Value = _processCode;
  243. //}
  244. //else if(_strCurrentTab == "WIC")
  245. //{
  246. // e.Row.Cells["PROCESS_DESC"].Value = _processCode;
  247. //}
  248. //else if(_strCurrentTab == "GIC")
  249. //{
  250. // e.Row.Cells["PROCESS_CDOE"].Value = _processCode;
  251. //}
  252. }
  253. private void LoadStandPay()
  254. {
  255. panel2.Controls.Add(_frmStandarN.SplitContainer1);
  256. panel2.Controls.Add(_frmStandarN.UltraPanel1);
  257. _frmStandarN.PopupLoad("2", ob); //直接调用onload
  258. //_frmStandarN.SplitContainer1.BringToFront();
  259. }
  260. private void _frmStandarN_AfterRowActivate(object sender, EventArgs e)
  261. {
  262. if (_strCurrentTab == "CIC")
  263. {
  264. //SetGridRowSelect(_gridCic, "CIC", _strCics);
  265. }
  266. else if (_strCurrentTab == "PIC")
  267. {
  268. //SetGridRowSelect(_gridPic, "PIC", _strPics);
  269. }
  270. else if (_strCurrentTab == "SIC")
  271. {
  272. //SetGridRowSelect(_gridSic, "SIC", _strSics);
  273. }
  274. else if (_strCurrentTab == "DIC")
  275. {
  276. //SetGridRowSelect(_gridDic, "DIC", _strDics);
  277. }
  278. else if (_strCurrentTab == "WIC")
  279. {
  280. //SetGridRowSelect(_gridWic, "WIC", _strWics);
  281. }
  282. else if (_strCurrentTab == "GIC")
  283. {
  284. //SetGridRowSelect(_gridGic, "GIC", _strGics);
  285. }
  286. if (_frmStandarN.UltraTabControl1.Tabs["1"].Visible == false)
  287. {
  288. _strCics.Clear();
  289. }
  290. else if (_frmStandarN.UltraTabControl1.Tabs["2"].Visible == false)
  291. {
  292. _strPics.Clear();
  293. }
  294. else if (_frmStandarN.UltraTabControl1.Tabs["3"].Visible == false)
  295. {
  296. _strSics.Clear();
  297. }
  298. else if (_frmStandarN.UltraTabControl1.Tabs["4"].Visible == false)
  299. {
  300. _strDics.Clear();
  301. }
  302. else if (_frmStandarN.UltraTabControl1.Tabs["5"].Visible == false)
  303. {
  304. _strWics.Clear();
  305. }
  306. else if (_frmStandarN.UltraTabControl1.Tabs["6"].Visible == false)
  307. {
  308. _strGics.Clear();
  309. }
  310. ComboFilter();
  311. }
  312. //private void grid_InitializeRow(object sender, InitializeRowEventArgs e)
  313. //{
  314. // if (_isCellChange == false)
  315. // {
  316. // SetGridRowSelect(e, "CIC", _strCics);
  317. // }
  318. //}
  319. private void GridCellChangeEvent(object sender, CellEventArgs e)
  320. {
  321. _isCellChange = true;
  322. try
  323. {
  324. UltraGrid grid = (UltraGrid)sender;
  325. string tableName = grid.DataMember;
  326. if (e.Cell.Column.Key == "CHC" && e.Cell.Row.Cells["CREATE_TIME"].Value.ToString() != "")
  327. {
  328. grid.UpdateData();
  329. if (grid.DisplayLayout.Bands[tableName].Columns.Exists("CIC"))
  330. {
  331. string strIC = e.Cell.Row.Cells["CIC"].Value.ToString();
  332. if (e.Cell.Value.ToString() == "True" && _strCics.Contains(strIC) == false)
  333. {
  334. _strCics.Add(strIC);
  335. }
  336. else
  337. {
  338. _strCics.Remove(strIC);
  339. }
  340. }
  341. else if (grid.DisplayLayout.Bands[tableName].Columns.Exists("DIC"))
  342. {
  343. string strIC = e.Cell.Row.Cells["DIC"].Value.ToString();
  344. if (e.Cell.Value.ToString() == "True" && _strCics.Contains(strIC) == false)
  345. {
  346. _strDics.Add(strIC);
  347. }
  348. else
  349. {
  350. _strDics.Remove(strIC);
  351. }
  352. }
  353. else if (grid.DisplayLayout.Bands[tableName].Columns.Exists("PIC"))
  354. {
  355. string strIC = e.Cell.Row.Cells["PIC"].Value.ToString();
  356. if (e.Cell.Value.ToString() == "True" && _strCics.Contains(strIC) == false)
  357. {
  358. _strPics.Add(strIC);
  359. }
  360. else
  361. {
  362. _strPics.Remove(strIC);
  363. }
  364. }
  365. else if (grid.DisplayLayout.Bands[tableName].Columns.Exists("SIC"))
  366. {
  367. string strIC = e.Cell.Row.Cells["SIC"].Value.ToString();
  368. if (e.Cell.Value.ToString() == "True" && _strCics.Contains(strIC) == false)
  369. {
  370. _strSics.Add(strIC);
  371. }
  372. else
  373. {
  374. _strSics.Remove(strIC);
  375. }
  376. }
  377. else if (grid.DisplayLayout.Bands[tableName].Columns.Exists("WIC"))
  378. {
  379. string strIC = e.Cell.Row.Cells["WIC"].Value.ToString();
  380. if (e.Cell.Value.ToString() == "True" && _strCics.Contains(strIC) == false)
  381. {
  382. _strWics.Add(strIC);
  383. }
  384. else
  385. {
  386. _strWics.Remove(strIC);
  387. }
  388. }
  389. else if (grid.DisplayLayout.Bands[tableName].Columns.Exists("GIC"))
  390. {
  391. string strIC = e.Cell.Row.Cells["GIC"].Value.ToString();
  392. if (e.Cell.Value.ToString() == "True" && _strGics.Contains(strIC) == false)
  393. {
  394. _strGics.Add(strIC);
  395. }
  396. else
  397. {
  398. _strGics.Remove(strIC);
  399. }
  400. }
  401. grid.UpdateData();
  402. }
  403. }
  404. finally
  405. {
  406. _isCellChange = false;
  407. }
  408. }
  409. private void TabControlChangeEvent(object sender, SelectedTabChangedEventArgs e)
  410. {
  411. //this.Cursor = Cursors.WaitCursor;
  412. UltraTabControl tab = (UltraTabControl)sender;
  413. if (tab.Name == "ultraTabControl1")
  414. {
  415. switch (e.Tab.Key)
  416. {
  417. case "1":
  418. _strCurrentTab = "CIC";
  419. //SetGridRowSelect(_gridCic, "CIC", _strCics);
  420. ComboFilter();
  421. break;
  422. case "2":
  423. _strCurrentTab = "PIC";
  424. //SetGridRowSelect(_gridPic, "PIC", _strPics);
  425. ComboFilter();
  426. break;
  427. case "3":
  428. _strCurrentTab = "SIC";
  429. //SetGridRowSelect(_gridSic, "SIC", _strSics);
  430. ComboFilter();
  431. break;
  432. case "4":
  433. _strCurrentTab = "DIC";
  434. //SetGridRowSelect(_gridDic, "DIC", _strDics);
  435. ComboFilter();
  436. break;
  437. case "5":
  438. _strCurrentTab = "WIC";
  439. //SetGridRowSelect(_gridWic, "WIC", _strWics);
  440. ComboFilter();
  441. break;
  442. case "6":
  443. _strCurrentTab = "GIC";
  444. //SetGridRowSelect(_gridGic, "GIC", _strGics);
  445. ComboFilter();
  446. break;
  447. }
  448. }
  449. //this.Cursor = Cursors.Default;
  450. }
  451. void FrmStandarNSub_ToolClick(object sender, ToolClickEventArgs e)
  452. {
  453. if (_strCurrentTab == "CIC")
  454. {
  455. //SetGridRowSelect(_gridCic, "CIC", _strCics);
  456. }
  457. else if (_strCurrentTab == "PIC")
  458. {
  459. //SetGridRowSelect(_gridPic, "PIC", _strPics);
  460. }
  461. else if (_strCurrentTab == "SIC")
  462. {
  463. //SetGridRowSelect(_gridSic, "SIC", _strSics);
  464. }
  465. else if (_strCurrentTab == "DIC")
  466. {
  467. //SetGridRowSelect(_gridDic, "DIC", _strDics);
  468. }
  469. else if (_strCurrentTab == "WIC")
  470. {
  471. //SetGridRowSelect(_gridWic, "WIC", _strWics);
  472. }
  473. }
  474. private void SetGridRowSelect(UltraGrid grid, string strIcKey, List<string> strIcs)
  475. {
  476. foreach (string strIc in strIcs)
  477. {
  478. UltraGridRow[] rows = GridHelper.GetRowsWithKey(grid, new string[] { strIcKey }, new string[] { strIc });
  479. if (rows.Length > 0)
  480. {
  481. rows[0].Cells["CHC"].Value = true;
  482. if (strIcKey == "CIC")
  483. {
  484. _frmStandarN.CtrlMscChem._frmChemStd.ultraGrid1_CellChange(null, new CellEventArgs(rows[0].Cells["CHC"]));
  485. }
  486. else if (strIcKey == "PIC")
  487. {
  488. _frmStandarN.CtrlMscMaterial._frmMaterialStd.ultraGrid1_CellChange(null, new CellEventArgs(rows[0].Cells["CHC"]));
  489. }
  490. else if (strIcKey == "SIC")
  491. {
  492. _frmStandarN.CtrlMscTolerances._frmTolerancesStd.ultraGrid1_CellChange(null, new CellEventArgs(rows[0].Cells["CHC"]));
  493. }
  494. else if (strIcKey == "DIC")
  495. {
  496. _frmStandarN.CtrlMscDetection._frmDetectionStd.ultraGrid1_CellChange(null, new CellEventArgs(rows[0].Cells["CHC"]));
  497. }
  498. else if (strIcKey == "WIC")
  499. {
  500. _frmStandarN.CtrlMscProductWater._frmWaterStd.ultraGrid1_CellChange(null, new CellEventArgs(rows[0].Cells["CHC"]));
  501. }
  502. else if (strIcKey == "GIC")
  503. {
  504. _frmStandarN.CtrlMscStdProcess._frmProcessStd.ultraGrid1_CellChange(null, new CellEventArgs(rows[0].Cells["CHC"]));
  505. }
  506. grid.UpdateData();
  507. }
  508. }
  509. //if (Row.Cells.Exists("CIC"))
  510. //{
  511. // if (_strIcs.Contains(e.Row.Cells["CIC"].Value.ToString()))
  512. // {
  513. // e.Row.Cells["CHC"].Value = true;
  514. // }
  515. // else
  516. // {
  517. // e.Row.Cells["CHC"].Value = false;
  518. // }
  519. //}
  520. //if (e.Row.Cells.Exists("PIC"))
  521. //{
  522. // if (_strIcs.Contains(e.Row.Cells["PIC"].Value.ToString()))
  523. // {
  524. // e.Row.Cells["CHC"].Value = true;
  525. // }
  526. // else
  527. // {
  528. // e.Row.Cells["CHC"].Value = false;
  529. // }
  530. //}
  531. //if (e.Row.Cells.Exists("SIC"))
  532. //{
  533. // if (_strIcs.Contains(e.Row.Cells["SIC"].Value.ToString()))
  534. // {
  535. // e.Row.Cells["CHC"].Value = true;
  536. // }
  537. // else
  538. // {
  539. // e.Row.Cells["CHC"].Value = false;
  540. // }
  541. //}
  542. //if (e.Row.Cells.Exists("DIC"))
  543. //{
  544. // if (_strIcs.Contains(e.Row.Cells["DIC"].Value.ToString()))
  545. // {
  546. // e.Row.Cells["CHC"].Value = true;
  547. // }
  548. // else
  549. // {
  550. // e.Row.Cells["CHC"].Value = false;
  551. // }
  552. //}
  553. //if (e.Row.Cells.Exists("WIC"))
  554. //{
  555. // if (_strIcs.Contains(e.Row.Cells["WIC"].Value.ToString()))
  556. // {
  557. // e.Row.Cells["CHC"].Value = true;
  558. // }
  559. // else
  560. // {
  561. // e.Row.Cells["CHC"].Value = false;
  562. // }
  563. //}
  564. }
  565. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  566. {
  567. switch (e.Tool.Key)
  568. {
  569. case "查询":
  570. _frmStandarN.ToolBar_Click(null, "doQuery");
  571. break;
  572. case "保存":
  573. _frmStandarN.ToolBar_Click(null, "doSave");
  574. ComboFilter();
  575. break;
  576. case "作废":
  577. _frmStandarN.ToolBar_Click(null, "doDelete");
  578. break;
  579. case "恢复":
  580. _frmStandarN.ToolBar_Click(null, "doResume");
  581. break;
  582. case "刷新":
  583. _frmStandarN.ToolBar_Click(null, "Refresh");
  584. ComboFilter();
  585. break;
  586. case "工艺参数":
  587. MSCCraft();
  588. break;
  589. case "复制交付标准":
  590. CopyStandPay();
  591. break;
  592. }
  593. }
  594. public static int GetSameGradeCnt(string gradeCode, string stdCodeNk, OpeBase ob)
  595. {
  596. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreInnerMSCRGRD2.getSameGradeCnt",
  597. new object[] { gradeCode, stdCodeNk }, ob);
  598. return Convert.ToInt32(dt.Rows[0]["CNT"].ToString());
  599. }
  600. private void CopyStandPay()
  601. {
  602. string stdCodeNk = _frmStandarN.ultraGrid1.ActiveRow.GetValue("STD_CODE");
  603. string stdNameNk = _frmStandarN.ultraGrid1.ActiveRow.GetValue("STD_NAME");
  604. DataRow stdRow = GetStdByPk(stdCodeNk);
  605. if (stdRow["ACCEPT_BID"].ToString() == "1" && UserInfo.GetDeptid() != stdRow["UNIT_CODE"].ToString()
  606. && UserInfo.GetUserID() != "admin")
  607. {
  608. MessageUtil.ShowWarning(string.Format("该内控标准已纳标,只有{0}的成员才能操作!", stdRow["UNIT_DESC"].ToString()));
  609. return;
  610. }
  611. string gradeCode = "";
  612. string gradeName = "";
  613. //if (_frmStandarN.UltraTabControl1.Tabs["1"].Visible)//只有存在成分才判断
  614. //{
  615. // ChoiceGradePopup gradePopup = new ChoiceGradePopup(_msc, _mscPline, ob);
  616. // if (gradePopup.ShowDialog() != System.Windows.Forms.DialogResult.OK)
  617. // {
  618. // return;
  619. // }
  620. // gradeCode = gradePopup.GradeCode;
  621. // gradeName = gradePopup.GradeName;
  622. // if (GetSameGradeCnt(gradeCode, stdCodeNk, ob) >= 9)
  623. // {
  624. // MessageUtil.ShowWarning("钢种:" + gradeName + "之下已经维护了9条(或超过9条)成分内控,无法继续新增!");
  625. // return;
  626. // }
  627. //}
  628. if (MessageUtil.ShowYesNoAndQuestion("是否确认复制交付标准?") == System.Windows.Forms.DialogResult.No)
  629. {
  630. return;
  631. }
  632. ServerHelper.SetData("com.steering.pss.qcm.CoreInnerMSCRGRD2.copyStandPay",
  633. new object[] { _msc, _mscPline, stdCodeNk, stdNameNk, _processCode,
  634. _processName, gradeCode, gradeName, CoreUserInfo.UserInfo.GetUserName()}, ob);
  635. MessageUtil.ShowTips("复制成功!");
  636. _frmStandarN.ultraGrid1_AfterRowActivate(null, null);
  637. //_frmStandarN.ultraGrid1
  638. }
  639. private DataRow GetStdByPk(string stdCode)
  640. {
  641. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreInnerMSCRGRD2.getStdByPk",
  642. new object[] { stdCode }, ob);
  643. return dt.Rows[0];
  644. }
  645. private void MSCCraft()
  646. {
  647. if (_msc == "" && _mscPline == "")
  648. {
  649. MessageUtil.ShowWarning("请先新增制程,然后再维护工艺参数!");
  650. return;
  651. }
  652. PopupMscCraft mscCraft = new PopupMscCraft(_msc, _mscPline, _processCode, ob);
  653. mscCraft.Show();
  654. }
  655. private void btnOk_Click(object sender, EventArgs e)
  656. {
  657. if (isSameStd() == true)
  658. {
  659. MessageUtil.ShowWarning("不能在多个标准下选择索引码!");
  660. return;
  661. }
  662. if (!_frmStandarN.UltraTabControl1.Tabs["1"].Visible)
  663. {
  664. _strCics.Clear();
  665. }
  666. if (!_frmStandarN.UltraTabControl1.Tabs["2"].Visible)
  667. {
  668. _strPics.Clear();
  669. }
  670. if (!_frmStandarN.UltraTabControl1.Tabs["3"].Visible)
  671. {
  672. _strDics.Clear();
  673. }
  674. if (!_frmStandarN.UltraTabControl1.Tabs["4"].Visible)
  675. {
  676. _strSics.Clear();
  677. }
  678. if (!_frmStandarN.UltraTabControl1.Tabs["5"].Visible)
  679. {
  680. _strWics.Clear();
  681. }
  682. if (!_frmStandarN.UltraTabControl1.Tabs["6"].Visible)
  683. {
  684. _strGics.Clear();
  685. }
  686. foreach (UltraGridRow row in _gridCic.Rows)
  687. {
  688. if (row.GetValue("CHC") == "False") continue;
  689. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreChemStandard.getMscCicByCic",
  690. new object[] { row.GetValue("CIC") }, ob);
  691. if (!dt.Rows[0]["PROCESS_CODE"].ToString().Contains(_processCode))
  692. {
  693. MessageUtil.ShowWarning("只能关联适用工序包含" + _processName + "的成分内控!");
  694. return;
  695. }
  696. if (!_strCics.Contains(row.GetValue("CIC"))) _strCics.Add(row.GetValue("CIC"));
  697. }
  698. foreach (UltraGridRow row in _gridPic.Rows)
  699. {
  700. if (row.GetValue("CHC") == "False") continue;
  701. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ComMaterial.getComPicByPic",
  702. new object[] { row.GetValue("PIC") }, ob);
  703. if (!dt.Rows[0]["PROCESS_CDOE"].ToString().Contains(_processCode))
  704. {
  705. MessageUtil.ShowWarning("只能关联适用工序包含" + _processName + "的理化内控!");
  706. return;
  707. }
  708. if (!_strPics.Contains(row.GetValue("PIC"))) _strPics.Add(row.GetValue("PIC"));
  709. }
  710. foreach (UltraGridRow row in _gridDic.Rows)
  711. {
  712. if (row.GetValue("CHC") == "False") continue;
  713. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreDetection.getComDicByDic",
  714. new object[] { row.GetValue("DIC") }, ob);
  715. if (!dt.Rows[0]["PROCESS_CODE"].ToString().Contains(_processCode))
  716. {
  717. MessageUtil.ShowWarning("只能关联适用工序包含" + _processName + "的探伤内控!");
  718. return;
  719. }
  720. if (!_strDics.Contains(row.GetValue("DIC"))) _strDics.Add(row.GetValue("DIC"));
  721. }
  722. foreach (UltraGridRow row in _gridSic.Rows)
  723. {
  724. if (row.GetValue("CHC") == "False") continue;
  725. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreTolerances.getComSicBySic",
  726. new object[] { row.GetValue("SIC") }, ob);
  727. if (!dt.Rows[0]["PROCESS_CODE"].ToString().Contains(_processCode))
  728. {
  729. MessageUtil.ShowWarning("只能关联适用工序包含" + _processName + "的公差内控!");
  730. return;
  731. }
  732. if (!_strSics.Contains(row.GetValue("SIC"))) _strSics.Add(row.GetValue("SIC"));
  733. }
  734. foreach (UltraGridRow row in _gridWic.Rows)
  735. {
  736. if (row.GetValue("CHC") == "False") continue;
  737. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreWaterStand.getComWicByWic",
  738. new object[] { row.GetValue("WIC") }, ob);
  739. if (!dt.Rows[0]["PROCESS_CDOE"].ToString().Contains(_processCode))
  740. {
  741. MessageUtil.ShowWarning("只能关联适用工序包含" + _processName + "的水压内控!");
  742. return;
  743. }
  744. if (!_strWics.Contains(row.GetValue("WIC"))) _strWics.Add(row.GetValue("WIC"));
  745. }
  746. foreach (UltraGridRow row in _gridGic.Rows)
  747. {
  748. if (row.GetValue("CHC") == "False") continue;
  749. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreComMscStdProcess.getComGicByGic",
  750. new object[] { row.GetValue("GIC") }, ob);
  751. if (!dt.Rows[0]["PROCESS_CDOE"].ToString().Contains(_processCode))
  752. {
  753. MessageUtil.ShowWarning("只能关联适用工序包含" + _processName + "的加工内控!");
  754. return;
  755. }
  756. if (!_strGics.Contains(row.GetValue("GIC"))) _strGics.Add(row.GetValue("GIC"));
  757. }
  758. string cics = GetICsFromList(_strCics);
  759. string pics = GetICsFromList(_strPics);
  760. string sics = GetICsFromList(_strSics);
  761. string dics = GetICsFromList(_strDics);
  762. string wics = GetICsFromList(_strWics);
  763. string gics = GetICsFromList(_strGics);
  764. ServerHelper.SetData("com.steering.pss.qcm.CoreInnerMSCRGRD2.updateMscProcessNk",
  765. new object[] { _msc, _mscPline, _processCode, cics, pics, sics, dics, wics, gics }, ob);
  766. MessageUtil.ShowTips("保存成功!");
  767. this.DialogResult = DialogResult.OK;
  768. }
  769. private string GetICsFromList(List<string> list)
  770. {
  771. string iCs = "";
  772. foreach (string str in list)
  773. {
  774. iCs += iCs == "" ? str : ("," + str);
  775. }
  776. return iCs;
  777. }
  778. private bool isSameStd()
  779. {
  780. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreInnerMSCRGRD2.queryStdNkCnt",
  781. new object[] { _strCics, _strPics, _strSics, _strDics, _strWics }, this.ob);
  782. if (dt.Rows[0][0].ToString() == "0" || dt.Rows[0][0].ToString() == "1")
  783. {
  784. return false;
  785. }
  786. else
  787. {
  788. return true;
  789. }
  790. }
  791. private void btnCancel_Click(object sender, EventArgs e)
  792. {
  793. this.DialogResult = DialogResult.Cancel;
  794. }
  795. }
  796. }