ComStandPay.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986
  1. using CoreFS.CA06;
  2. using Infragistics.Win.UltraWinEditors;
  3. using Infragistics.Win.UltraWinGrid;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Windows.Forms;
  7. namespace Core.StlMes.Client.Qcm
  8. {
  9. class ComStandPay
  10. {
  11. private delegate void ToolBarClickDelegate(object obj, string key);
  12. private FrmChemStandard _frmChemStand = null;
  13. private FrmMaterialStandard _frmMaterialStand = null;
  14. private FrmTolerancesStandard _frmTolerancesStand = null;
  15. private FrmComMSCStdDetection _frmComMSCStdDetection = null;
  16. private FrmWaterPressureStand _frmProductWater = null;
  17. private FrmComMSCStdProcess _frmComMSCStdProcess = null;
  18. private Panel _tabChemStand = null;
  19. private Panel _tabMaterialStand = null;
  20. private Panel _tabTolerancesStand = null;
  21. private Panel _tabComMSCStdDetection = null;
  22. private Panel _tabProductWater = null;
  23. private Panel _tabComMSCStdProcess = null;
  24. private CheckBox _ckbDeleteFilter = null;
  25. private UltraGrid _parentUltraGrid = null;
  26. private string _customInfo = "";
  27. private OpeBase _ob = null;
  28. private Dictionary<string, UltraGrid> _gridDic = new Dictionary<string, UltraGrid>();
  29. private Dictionary<string, UltraCheckEditor> _checkBoxDic = new Dictionary<string, UltraCheckEditor>();
  30. private Dictionary<string, FrmBase> _mscFrmDic = new Dictionary<string, FrmBase>();
  31. public event RowEventHandler AfterRowInsert;
  32. public Panel TabChemStand
  33. {
  34. get
  35. {
  36. return _tabChemStand;
  37. }
  38. set
  39. {
  40. _tabChemStand = value;
  41. }
  42. }
  43. public Panel TabComMSCStdDetection
  44. {
  45. get
  46. {
  47. return _tabComMSCStdDetection;
  48. }
  49. set
  50. {
  51. _tabComMSCStdDetection = value;
  52. }
  53. }
  54. public Panel TabMaterialStand
  55. {
  56. get
  57. {
  58. return _tabMaterialStand;
  59. }
  60. set
  61. {
  62. _tabMaterialStand = value;
  63. }
  64. }
  65. public Panel TabProductWater
  66. {
  67. get
  68. {
  69. return _tabProductWater;
  70. }
  71. set
  72. {
  73. _tabProductWater = value;
  74. }
  75. }
  76. public Panel TabTolerancesStand
  77. {
  78. get
  79. {
  80. return _tabTolerancesStand;
  81. }
  82. set
  83. {
  84. _tabTolerancesStand = value;
  85. }
  86. }
  87. public Panel TabComMSCStdProcess
  88. {
  89. get { return _tabComMSCStdProcess; }
  90. set { _tabComMSCStdProcess = value; }
  91. }
  92. public CheckBox CkbDeleteFilter
  93. {
  94. get
  95. {
  96. return _ckbDeleteFilter;
  97. }
  98. set
  99. {
  100. _ckbDeleteFilter = value;
  101. }
  102. }
  103. public UltraGrid ParentUltraGrid
  104. {
  105. get
  106. {
  107. return _parentUltraGrid;
  108. }
  109. set
  110. {
  111. _parentUltraGrid = value;
  112. }
  113. }
  114. public string CustomInfo
  115. {
  116. get { return _customInfo; }
  117. set { _customInfo = value; }
  118. }
  119. public ComStandPay(string customInfo, OpeBase ob)
  120. {
  121. _customInfo = customInfo;
  122. _ob = ob;
  123. }
  124. public void Load()
  125. {
  126. if (_customInfo == "")
  127. {
  128. SaveStandPay("1", "ChemStand", new string[] { "ultraGrid1", "ultraCheckValid" });
  129. //SaveStandPay("2", "ChemStand", new string[] { "ultraGrid1", "ultraCheckValid" });
  130. //SaveStandPay("3", "ChemStand", new string[] { "ultraGrid1", "ultraCheckValid" });
  131. LoadStandPay("1", "ChemStand");
  132. SaveStandPay("1", "ComMSCStdDetection", new string[] { "ultraGrid1", "ultraCheckValid" });
  133. //SaveStandPay("2", "ComMSCStdDetection", new string[] { "ultraGrid1", "ultraCheckValid" });
  134. //SaveStandPay("3", "ComMSCStdDetection", new string[] { "ultraGrid1", "ultraCheckValid" });
  135. LoadStandPay("1", "ComMSCStdDetection");
  136. SaveStandPay("1", "MaterialStand", new string[] { "ultraGrid1", "ultraCheckEditor2" });
  137. //SaveStandPay("2", "MaterialStand", new string[] { "ultraGrid1", "ultraCheckEditor2" });
  138. //SaveStandPay("3", "MaterialStand", new string[] { "ultraGrid1", "ultraCheckEditor2" });
  139. LoadStandPay("1", "MaterialStand");
  140. SaveStandPay("1", "ProductWater", new string[] { "ultraGrid1", "ultraCheckValid" });
  141. //SaveStandPay("2", "ProductWater", new string[] { "ultraGrid1", "ultraCheckValid" });
  142. //SaveStandPay("3", "ProductWater", new string[] { "ultraGrid1", "ultraCheckValid" });
  143. LoadStandPay("1", "ProductWater");
  144. SaveStandPay("1", "TolerancesStand", new string[] { "ultraGrid1", "chkValid" });
  145. //SaveStandPay("2", "TolerancesStand", new string[] { "ultraGrid1", "chkValid" });
  146. //SaveStandPay("3", "TolerancesStand", new string[] { "ultraGrid1", "chkValid" });
  147. LoadStandPay("1", "TolerancesStand");
  148. SaveStandPay("1", "ComMSCStdProcess", new string[] { "ultraGrid1", "ultraCheckValid" });
  149. LoadStandPay("1", "ComMSCStdProcess");
  150. }
  151. else
  152. {
  153. SaveStandPay(_customInfo, "ChemStand", new string[] { "ultraGrid1", "ultraCheckValid" });
  154. LoadStandPay(_customInfo, "ChemStand");
  155. SaveStandPay(_customInfo, "ComMSCStdDetection", new string[] { "ultraGrid1", "ultraCheckValid" });
  156. LoadStandPay(_customInfo, "ComMSCStdDetection");
  157. SaveStandPay(_customInfo, "MaterialStand", new string[] { "ultraGrid1", "ultraCheckEditor2" });
  158. LoadStandPay(_customInfo, "MaterialStand");
  159. SaveStandPay(_customInfo, "ProductWater", new string[] { "ultraGrid1", "ultraCheckValid" });
  160. LoadStandPay(_customInfo, "ProductWater");
  161. SaveStandPay(_customInfo, "TolerancesStand", new string[] { "ultraGrid1", "chkValid" });
  162. LoadStandPay(_customInfo, "TolerancesStand");
  163. SaveStandPay(_customInfo, "ComMSCStdProcess", new string[] { "ultraGrid1", "ultraCheckValid" });
  164. LoadStandPay(_customInfo, "ComMSCStdProcess");
  165. }
  166. }
  167. private FrmBase CreateStandPay(string custmInfo, string standPayKey)
  168. {
  169. FrmBase mscFrm = null;
  170. switch (standPayKey)
  171. {
  172. case "ChemStand":
  173. mscFrm = new FrmChemStandard();
  174. _mscFrmDic.Add(standPayKey + custmInfo, mscFrm);
  175. return mscFrm;
  176. case "ComMSCStdDetection":
  177. mscFrm = new FrmComMSCStdDetection();
  178. _mscFrmDic.Add(standPayKey + custmInfo, mscFrm);
  179. return mscFrm;
  180. case "MaterialStand":
  181. mscFrm = new FrmMaterialStandard();
  182. _mscFrmDic.Add(standPayKey + custmInfo, mscFrm);
  183. return mscFrm;
  184. case "ProductWater":
  185. mscFrm = new FrmWaterPressureStand();
  186. _mscFrmDic.Add(standPayKey + custmInfo, mscFrm);
  187. return mscFrm;
  188. case "TolerancesStand":
  189. mscFrm = new FrmTolerancesStandard();
  190. _mscFrmDic.Add(standPayKey + custmInfo, mscFrm);
  191. return mscFrm;
  192. case "ComMSCStdProcess":
  193. mscFrm = new FrmComMSCStdProcess();
  194. _mscFrmDic.Add(standPayKey + custmInfo, mscFrm);
  195. return mscFrm;
  196. default:
  197. return null;
  198. }
  199. }
  200. private Panel GetTabControl(string standPayKey)
  201. {
  202. switch (standPayKey)
  203. {
  204. case "ChemStand":
  205. return _tabChemStand;
  206. case "ComMSCStdDetection":
  207. return _tabComMSCStdDetection;
  208. case "MaterialStand":
  209. return _tabMaterialStand;
  210. case "ProductWater":
  211. return _tabProductWater;
  212. case "TolerancesStand":
  213. return _tabTolerancesStand;
  214. case "ComMSCStdProcess":
  215. return _tabComMSCStdProcess;
  216. default:
  217. return null;
  218. }
  219. }
  220. public void LoadStandPay(string customInfo, string standPayKey)
  221. {
  222. Panel ultraTabPageControl = GetTabControl(standPayKey);
  223. ultraTabPageControl.Controls.Clear();
  224. ultraTabPageControl.Controls.Add(_gridDic[standPayKey + customInfo]);
  225. ultraTabPageControl.Controls.Add(_checkBoxDic[standPayKey + customInfo]);
  226. ultraTabPageControl.Tag = customInfo;
  227. switch (standPayKey)
  228. {
  229. case "ChemStand":
  230. _frmChemStand = (FrmChemStandard)_mscFrmDic[standPayKey + customInfo];
  231. break;
  232. case "ComMSCStdDetection":
  233. _frmComMSCStdDetection = (FrmComMSCStdDetection)_mscFrmDic[standPayKey + customInfo];
  234. break;
  235. case "MaterialStand":
  236. _frmMaterialStand = (FrmMaterialStandard)_mscFrmDic[standPayKey + customInfo];
  237. break;
  238. case "ProductWater":
  239. _frmProductWater = (FrmWaterPressureStand)_mscFrmDic[standPayKey + customInfo];
  240. break;
  241. case "TolerancesStand":
  242. _frmTolerancesStand = (FrmTolerancesStandard)_mscFrmDic[standPayKey + customInfo];
  243. break;
  244. case "ComMSCStdProcess":
  245. _frmComMSCStdProcess = (FrmComMSCStdProcess)_mscFrmDic[standPayKey + customInfo];
  246. break;
  247. }
  248. }
  249. public void SaveStandPay(string customInfo, string standPayKey, string[] strControls)
  250. {
  251. FrmBase frm = CreateStandPay(customInfo, standPayKey);
  252. //直接调用onload
  253. if (frm is FrmChemStandard)
  254. {
  255. ((FrmChemStandard)frm).PopupLoad(customInfo, _ob);
  256. }
  257. else if (frm is FrmComMSCStdDetection)
  258. {
  259. ((FrmComMSCStdDetection)frm).PopupLoad(customInfo, _ob);
  260. }
  261. else if (frm is FrmMaterialStandard)
  262. {
  263. ((FrmMaterialStandard)frm).PopupLoad(customInfo, _ob);
  264. }
  265. else if (frm is FrmWaterPressureStand)
  266. {
  267. ((FrmWaterPressureStand)frm).PopupLoad(customInfo, _ob);
  268. }
  269. else if (frm is FrmTolerancesStandard)
  270. {
  271. ((FrmTolerancesStandard)frm).PopupLoad(customInfo, _ob);
  272. }
  273. else if (frm is FrmComMSCStdProcess)
  274. {
  275. ((FrmComMSCStdProcess)frm).PopupLoad(customInfo, _ob);
  276. }
  277. foreach (string strGrid in strControls)
  278. {
  279. System.Windows.Forms.Control[] controls = frm.Controls.Find(strGrid, true);
  280. if (controls.Length > 0)
  281. {
  282. //ultraTabPageControl.Controls.Add(controls[0]);
  283. //ultraTabPageControl.Tag = _customInfo;
  284. if (controls[0] is UltraCheckEditor)
  285. {
  286. UltraCheckEditor checkBox = (UltraCheckEditor)controls[0];
  287. _checkBoxDic.Add(standPayKey + customInfo, checkBox);
  288. }
  289. if (controls[0] is UltraGrid)
  290. {
  291. UltraGrid grid = (UltraGrid)controls[0];
  292. _gridDic.Add(standPayKey + customInfo, grid);
  293. ControlStandPayEdit(grid);
  294. grid.BeforeRowInsert += new BeforeRowInsertEventHandler(FrmProPSCMSC2_BeforeRowInsert);
  295. grid.AfterRowInsert += new RowEventHandler(grid_AfterRowInsert);
  296. }
  297. }
  298. }
  299. }
  300. void grid_AfterRowInsert(object sender, RowEventArgs e)
  301. {
  302. if (AfterRowInsert != null)
  303. {
  304. this.AfterRowInsert.Invoke(sender, e);
  305. }
  306. }
  307. private void ControlStandPayEdit(UltraGrid grid)
  308. {
  309. string displayTable = grid.DataMember;
  310. if (grid.DisplayLayout.Bands[displayTable].Columns.Exists("PSC"))
  311. {
  312. grid.DisplayLayout.Bands[displayTable].Columns["PSC"].CellActivation = Activation.ActivateOnly;
  313. grid.DisplayLayout.Bands[displayTable].Columns["PSC"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDown;
  314. }
  315. if (grid.DisplayLayout.Bands[displayTable].Columns.Exists("PSC_DESC"))
  316. {
  317. grid.DisplayLayout.Bands[displayTable].Columns["PSC_DESC"].CellActivation = Activation.ActivateOnly;
  318. grid.DisplayLayout.Bands[displayTable].Columns["PSC_DESC"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDown;
  319. }
  320. if (grid.DisplayLayout.Bands[displayTable].Columns.Exists("MSC"))
  321. {
  322. grid.DisplayLayout.Bands[displayTable].Columns["MSC"].CellActivation = Activation.ActivateOnly;
  323. grid.DisplayLayout.Bands[displayTable].Columns["MSC"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDown;
  324. }
  325. if (grid.DisplayLayout.Bands[displayTable].Columns.Exists("STD_NAME_NK"))
  326. {
  327. grid.DisplayLayout.Bands[displayTable].Columns["STD_NAME_NK"].CellActivation = Activation.ActivateOnly;
  328. grid.DisplayLayout.Bands[displayTable].Columns["STD_NAME_NK"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDown;
  329. }
  330. else if (grid.DisplayLayout.Bands[displayTable].Columns.Exists("STD_NAME"))
  331. {
  332. grid.DisplayLayout.Bands[displayTable].Columns["STD_NAME"].CellActivation = Activation.ActivateOnly;
  333. grid.DisplayLayout.Bands[displayTable].Columns["STD_NAME"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDown;
  334. }
  335. if (grid.DisplayLayout.Bands[displayTable].Columns.Exists("STD_CODE_NK"))
  336. {
  337. grid.DisplayLayout.Bands[displayTable].Columns["STD_CODE_NK"].CellActivation = Activation.ActivateOnly;
  338. grid.DisplayLayout.Bands[displayTable].Columns["STD_CODE_NK"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDown;
  339. }
  340. else if (grid.DisplayLayout.Bands[displayTable].Columns.Exists("STD_CODE"))
  341. {
  342. grid.DisplayLayout.Bands[displayTable].Columns["STD_CODE"].CellActivation = Activation.ActivateOnly;
  343. grid.DisplayLayout.Bands[displayTable].Columns["STD_CODE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDown;
  344. }
  345. }
  346. void FrmProPSCMSC2_BeforeRowInsert(object sender, BeforeRowInsertEventArgs e)
  347. {
  348. if (_parentUltraGrid != null && _parentUltraGrid.ActiveRow == null)
  349. {
  350. e.Cancel = true;
  351. }
  352. }
  353. public void QueryChemStandWithOutFilter()
  354. {
  355. ToolClickChemStand("", "", "Query", false);
  356. }
  357. public void QueryMaterialStandWithOutFilter()
  358. {
  359. ToolClickMaterialStand("", "", "Query", false);
  360. }
  361. public void QueryTolerancesStandWithOutFilter()
  362. {
  363. ToolClickTolerancesStand("", "", "Query", false);
  364. }
  365. public void QueryComMSCStdDetectionWithOutFilter()
  366. {
  367. ToolClickComMSCStdDetection("", "", "Query", false);
  368. }
  369. public void QueryProductWaterWithOutFilter()
  370. {
  371. ToolClickProductWater("", "", "Query", false);
  372. }
  373. public void QueryComMSCStdProcessWithOutFilter()
  374. {
  375. ToolClickComMSCStdProcess("", "", "Query", false);
  376. }
  377. public void QueryChemStand(string alphaNk, string psc)
  378. {
  379. ToolClickChemStand(psc, alphaNk, "Query", true);
  380. }
  381. public void QueryMaterialStand(string alphaNk, string psc)
  382. {
  383. ToolClickMaterialStand(psc, alphaNk, "Query", true);
  384. }
  385. public void QueryTolerancesStand(string alphaNk, string psc)
  386. {
  387. ToolClickTolerancesStand(psc, alphaNk, "Query", true);
  388. }
  389. public void QueryComMSCStdDetection(string alphaNk, string psc)
  390. {
  391. ToolClickComMSCStdDetection(psc, alphaNk, "Query", true);
  392. }
  393. public void QueryProductWater(string alphaNk, string psc)
  394. {
  395. ToolClickProductWater(psc, alphaNk, "Query", true);
  396. }
  397. public void QueryComMSCStdProcess(string alphaNk, string psc)
  398. {
  399. ToolClickComMSCStdProcess(psc, alphaNk, "Query", true);
  400. }
  401. public void SaveChemStand(string alphaNk, string psc)
  402. {
  403. ToolClickChemStand(psc, alphaNk, "Save", true);
  404. }
  405. public void SaveMaterialStand(string alphaNk, string psc)
  406. {
  407. ToolClickMaterialStand(psc, alphaNk, "Save", true);
  408. }
  409. public void SaveTolerancesStand(string alphaNk, string psc)
  410. {
  411. ToolClickTolerancesStand(psc, alphaNk, "Save", true);
  412. }
  413. public void SaveComMSCStdDetection(string alphaNk, string psc)
  414. {
  415. ToolClickComMSCStdDetection(psc, alphaNk, "Save", true);
  416. }
  417. public void SaveProductWater(string alphaNk, string psc)
  418. {
  419. ToolClickProductWater(psc, alphaNk, "Save", true);
  420. }
  421. public void SaveComMSCStdProcess(string alphaNk, string psc)
  422. {
  423. ToolClickComMSCStdProcess(psc, alphaNk, "Save", true);
  424. }
  425. public void DeleteChemStand(string alphaNk, string psc)
  426. {
  427. ToolClickChemStand(psc, alphaNk, "Delete", true);
  428. }
  429. public void DeleteMaterialStand(string alphaNk, string psc)
  430. {
  431. ToolClickMaterialStand(psc, alphaNk, "Delete", true);
  432. }
  433. public void DeleteTolerancesStand(string alphaNk, string psc)
  434. {
  435. ToolClickTolerancesStand(psc, alphaNk, "Delete", true);
  436. }
  437. public void DeleteComMSCStdDetection(string alphaNk, string psc)
  438. {
  439. ToolClickComMSCStdDetection(psc, alphaNk, "Delete", true);
  440. }
  441. public void DeleteProductWater(string alphaNk, string psc)
  442. {
  443. ToolClickProductWater(psc, alphaNk, "Delete", true);
  444. }
  445. public void DeleteComMSCStdProcess(string alphaNk, string psc)
  446. {
  447. ToolClickComMSCStdProcess(psc, alphaNk, "Delete", true);
  448. }
  449. public void ResumeChemStand(string alphaNk, string psc)
  450. {
  451. ToolClickChemStand(psc, alphaNk, "Resume", true);
  452. }
  453. public void ResumeMaterialStand(string alphaNk, string psc)
  454. {
  455. ToolClickMaterialStand(psc, alphaNk, "Resume", true);
  456. }
  457. public void ResumeTolerancesStand(string alphaNk, string psc)
  458. {
  459. ToolClickTolerancesStand(psc, alphaNk, "Resume", true);
  460. }
  461. public void ResumeComMSCStdDetection(string alphaNk, string psc)
  462. {
  463. ToolClickComMSCStdDetection(psc, alphaNk, "Resume", true);
  464. }
  465. public void ResumeProductWater(string alphaNk, string psc)
  466. {
  467. ToolClickProductWater(psc, alphaNk, "Resume", true);
  468. }
  469. public void ResumeComMSCStdProcess(string alphaNk, string psc)
  470. {
  471. ToolClickComMSCStdProcess(psc, alphaNk, "Resume", true);
  472. }
  473. public void RefreshChemStand(string alphaNk, string psc)
  474. {
  475. ToolClickChemStand(psc, alphaNk, "Refresh", true);
  476. }
  477. public void RefreshMaterialStand(string alphaNk, string psc)
  478. {
  479. ToolClickMaterialStand(psc, alphaNk, "Refresh", true);
  480. }
  481. public void RefreshTolerancesStand(string alphaNk, string psc)
  482. {
  483. ToolClickTolerancesStand(psc, alphaNk, "Refresh", true);
  484. }
  485. public void RefreshComMSCStdDetection(string alphaNk, string psc)
  486. {
  487. ToolClickComMSCStdDetection(psc, alphaNk, "Refresh", true);
  488. }
  489. public void RefreshProductWater(string alphaNk, string psc)
  490. {
  491. ToolClickProductWater(psc, alphaNk, "Refresh", true);
  492. }
  493. public void RefreshComMSCStdProcess(string alphaNk, string psc)
  494. {
  495. ToolClickComMSCStdProcess(psc, alphaNk, "Refresh", true);
  496. }
  497. public void CopyChemStand()
  498. {
  499. ToolClickChemStand("", "", "Copy", true);
  500. }
  501. public void CopyMaterialStand()
  502. {
  503. ToolClickMaterialStand("", "", "Copy", true);
  504. }
  505. public void CopyTolerancesStand()
  506. {
  507. ToolClickTolerancesStand("", "", "Copy", true);
  508. }
  509. public void CopyComMSCStdDetection()
  510. {
  511. ToolClickComMSCStdDetection("", "", "Copy", true);
  512. }
  513. public void CopyProductWater()
  514. {
  515. ToolClickProductWater("", "", "Copy", true);
  516. }
  517. public void CopyComMSCStdProcess()
  518. {
  519. ToolClickComMSCStdProcess("", "", "Copy", true);
  520. }
  521. public void PasteChemStand()
  522. {
  523. ToolClickChemStand("", "", "Paste", true);
  524. }
  525. public void PasteMaterialStand()
  526. {
  527. ToolClickMaterialStand("", "", "Paste", true);
  528. }
  529. public void PasteTolerancesStand()
  530. {
  531. ToolClickTolerancesStand("", "", "Paste", true);
  532. }
  533. public void PasteComMSCStdDetection()
  534. {
  535. ToolClickComMSCStdDetection("", "", "Paste", true);
  536. }
  537. public void PasteProductWater()
  538. {
  539. ToolClickProductWater("", "", "Paste", true);
  540. }
  541. public void PasteComMSCStdProcess()
  542. {
  543. ToolClickComMSCStdProcess("", "", "Paste", true);
  544. }
  545. public void GroupMaterialStand(string alphaNk, string psc)
  546. {
  547. ToolClickMaterialStand(psc, alphaNk, "Group", true);
  548. }
  549. public void GroupComMSCStdDetection(string alphaNk, string psc)
  550. {
  551. ToolClickComMSCStdDetection(psc, alphaNk, "Group", true);
  552. }
  553. public void CancelGroupComMSCStdDetection(string alphaNk, string psc)
  554. {
  555. ToolClickComMSCStdDetection(psc, alphaNk, "Cancel", true);
  556. }
  557. public void GroupComMSCStdProcess(string alphaNk, string psc)
  558. {
  559. ToolClickComMSCStdProcess(psc, alphaNk, "Group", true);
  560. }
  561. public void CancelGroupComMSCStdProcess(string alphaNk, string psc)
  562. {
  563. ToolClickComMSCStdProcess(psc, alphaNk, "CancleGroup", true);
  564. }
  565. public void CancelGroupMaterialStand(string alphaNk, string psc)
  566. {
  567. ToolClickMaterialStand(psc, alphaNk, "Cancel", true);
  568. }
  569. private void ToolClickChemStand(string psc, string alphaNk, string toolKey, bool isFilted)
  570. {
  571. try
  572. {
  573. SetStandPayDeleteFilter(_tabChemStand, "ultraCheckValid", _ckbDeleteFilter.Checked);
  574. UpdateStandPayGrid(_tabChemStand, "ultraGrid1", true);
  575. _frmChemStand.StdCode = alphaNk;
  576. _frmChemStand.ToolBar_Click(null, toolKey);
  577. if (isFilted)
  578. {
  579. StandPayRowFilter(_tabChemStand, "ultraGrid1", psc, alphaNk);
  580. }
  581. }
  582. catch (Exception ex)
  583. { string msg = ex.Message; }
  584. finally
  585. {
  586. UpdateStandPayGrid(_tabChemStand, "ultraGrid1", false);
  587. }
  588. }
  589. private void ToolClickMaterialStand(string psc, string alphaNk, string toolKey, bool isFilted)
  590. {
  591. try
  592. {
  593. SetStandPayDeleteFilter(_tabMaterialStand, "ultraCheckEditor2", _ckbDeleteFilter.Checked);
  594. UpdateStandPayGrid(_tabMaterialStand, "ultraGrid1", true);
  595. _frmMaterialStand.StdCode = alphaNk;
  596. _frmMaterialStand.ToolBar_Click(null, toolKey);
  597. if (isFilted)
  598. {
  599. StandPayRowFilter(_tabMaterialStand, "ultraGrid1", psc, alphaNk);
  600. }
  601. }
  602. catch
  603. { }
  604. finally
  605. {
  606. UpdateStandPayGrid(_tabMaterialStand, "ultraGrid1", false);
  607. }
  608. }
  609. private void ToolClickTolerancesStand(string psc, string alphaNk, string toolKey, bool isFilted)
  610. {
  611. try
  612. {
  613. SetStandPayDeleteFilter(_tabTolerancesStand, "chkValid", _ckbDeleteFilter.Checked);
  614. UpdateStandPayGrid(_tabTolerancesStand, "ultraGrid1", true);
  615. _frmTolerancesStand.StdCode = alphaNk;
  616. _frmTolerancesStand.ToolBar_Click(null, toolKey);
  617. if (isFilted)
  618. {
  619. StandPayRowFilter(_tabTolerancesStand, "ultraGrid1", psc, alphaNk);
  620. }
  621. }
  622. catch
  623. { }
  624. finally
  625. {
  626. UpdateStandPayGrid(_tabTolerancesStand, "ultraGrid1", false);
  627. }
  628. }
  629. private void ToolClickComMSCStdDetection(string psc, string alphaNk, string toolKey, bool isFilted)
  630. {
  631. try
  632. {
  633. SetStandPayDeleteFilter(_tabComMSCStdDetection, "ultraCheckValid", _ckbDeleteFilter.Checked);
  634. UpdateStandPayGrid(_tabComMSCStdDetection, "ultraGrid1", true);
  635. _frmComMSCStdDetection.StdCode = alphaNk;
  636. _frmComMSCStdDetection.ToolBar_Click(null, toolKey);
  637. if (isFilted)
  638. {
  639. StandPayRowFilter(_tabComMSCStdDetection, "ultraGrid1", psc, alphaNk);
  640. }
  641. }
  642. catch
  643. { }
  644. finally
  645. {
  646. UpdateStandPayGrid(_tabComMSCStdDetection, "ultraGrid1", false);
  647. }
  648. }
  649. private void ToolClickProductWater(string psc, string alphaNk, string toolKey, bool isFilted)
  650. {
  651. try
  652. {
  653. SetStandPayDeleteFilter(_tabProductWater, "ultraCheckValid", _ckbDeleteFilter.Checked);
  654. UpdateStandPayGrid(_tabProductWater, "ultraGrid1", true);
  655. _frmProductWater.StdCode = alphaNk;
  656. _frmProductWater.ToolBar_Click(null, toolKey);
  657. if (isFilted)
  658. {
  659. StandPayRowFilter(_tabProductWater, "ultraGrid1", psc, alphaNk);
  660. }
  661. }
  662. catch
  663. { }
  664. finally
  665. {
  666. UpdateStandPayGrid(_tabProductWater, "ultraGrid1", false);
  667. }
  668. }
  669. private void ToolClickComMSCStdProcess(string psc, string alphaNk, string toolKey, bool isFilted)
  670. {
  671. try
  672. {
  673. SetStandPayDeleteFilter(_tabComMSCStdProcess, "ultraCheckValid", _ckbDeleteFilter.Checked);
  674. UpdateStandPayGrid(_tabComMSCStdProcess, "ultraGrid1", true);
  675. _frmComMSCStdProcess.StdCode = alphaNk;
  676. _frmComMSCStdProcess.ToolBar_Click(null, toolKey);
  677. if (isFilted)
  678. {
  679. StandPayRowFilter(_tabComMSCStdProcess, "ultraGrid1", psc, alphaNk);
  680. }
  681. }
  682. catch
  683. { }
  684. finally
  685. {
  686. UpdateStandPayGrid(_tabComMSCStdProcess, "ultraGrid1", false);
  687. }
  688. }
  689. private void SetStandPayDeleteFilter(System.Windows.Forms.Control control, string strCheckBox, bool isCheck)
  690. {
  691. if (strCheckBox == "") return;
  692. System.Windows.Forms.Control[] controls = control.Controls.Find(strCheckBox, true);
  693. if (controls.Length > 0 && controls[0] is UltraCheckEditor)
  694. {
  695. ((UltraCheckEditor)controls[0]).Checked = isCheck;
  696. }
  697. }
  698. private void UpdateStandPayGrid(System.Windows.Forms.Control control, string strGrid, bool isBegin)
  699. {
  700. System.Windows.Forms.Control[] controls = control.Controls.Find(strGrid, true);
  701. if (controls.Length > 0 && controls[0] is UltraGrid)
  702. {
  703. if (isBegin)
  704. {
  705. ((UltraGrid)controls[0]).BeginUpdate();
  706. }
  707. else
  708. {
  709. ((UltraGrid)controls[0]).EndUpdate();
  710. }
  711. }
  712. }
  713. public void ExpandChemStandGrid()
  714. {
  715. System.Windows.Forms.Control[] controls = _tabChemStand.Controls.Find("ultraGrid1", true);
  716. if (controls.Length > 0 && controls[0] is UltraGrid)
  717. {
  718. UltraGrid grid = (UltraGrid)controls[0];
  719. if (grid.Rows.Count > 0)
  720. {
  721. grid.Rows[0].ExpandAll();
  722. }
  723. }
  724. }
  725. public void ExpandMaterialStandGrid()
  726. {
  727. System.Windows.Forms.Control[] controls = _tabMaterialStand.Controls.Find("ultraGrid1", true);
  728. if (controls.Length > 0 && controls[0] is UltraGrid)
  729. {
  730. UltraGrid grid = (UltraGrid)controls[0];
  731. if (grid.Rows.Count > 0)
  732. {
  733. grid.Rows[0].ExpandAll();
  734. }
  735. }
  736. }
  737. public void ExpandTolerancesStandGrid()
  738. {
  739. System.Windows.Forms.Control[] controls = _tabTolerancesStand.Controls.Find("ultraGrid1", true);
  740. if (controls.Length > 0 && controls[0] is UltraGrid)
  741. {
  742. UltraGrid grid = (UltraGrid)controls[0];
  743. if (grid.Rows.Count > 0)
  744. {
  745. grid.Rows[0].ExpandAll();
  746. }
  747. }
  748. }
  749. public void ExpandComMSCStdDetectionGrid()
  750. {
  751. System.Windows.Forms.Control[] controls = _tabComMSCStdDetection.Controls.Find("ultraGrid1", true);
  752. if (controls.Length > 0 && controls[0] is UltraGrid)
  753. {
  754. UltraGrid grid = (UltraGrid)controls[0];
  755. if (grid.Rows.Count > 0)
  756. {
  757. grid.Rows[0].ExpandAll();
  758. }
  759. }
  760. }
  761. public void ExpandProductWaterGrid()
  762. {
  763. System.Windows.Forms.Control[] controls = _tabProductWater.Controls.Find("ultraGrid1", true);
  764. if (controls.Length > 0 && controls[0] is UltraGrid)
  765. {
  766. UltraGrid grid = (UltraGrid)controls[0];
  767. if (grid.Rows.Count > 0)
  768. {
  769. grid.Rows[0].ExpandAll();
  770. }
  771. }
  772. }
  773. public void ExpandComMSCStdProcess()
  774. {
  775. System.Windows.Forms.Control[] controls = _tabComMSCStdProcess.Controls.Find("ultraGrid1", true);
  776. if (controls.Length > 0 && controls[0] is UltraGrid)
  777. {
  778. UltraGrid grid = (UltraGrid)controls[0];
  779. if (grid.Rows.Count > 0)
  780. {
  781. grid.Rows[0].ExpandAll();
  782. }
  783. }
  784. }
  785. public void SetChemStandMscCondition(string msc, string codeJg)
  786. {
  787. _frmChemStand.Msc = msc;
  788. _frmChemStand.CodeJg = codeJg;
  789. }
  790. public void SetMaterialStandardCondition(string msc, string codeJg)
  791. {
  792. _frmMaterialStand.Msc = msc;
  793. _frmMaterialStand.CodeJg = codeJg;
  794. }
  795. public void SetComMSCStdDetectionCondition(string msc, string codeJg)
  796. {
  797. _frmComMSCStdDetection.Msc = msc;
  798. _frmComMSCStdDetection.CodeJg = codeJg;
  799. }
  800. public void SetTolerancesStandardCondition(string msc, string codeJg)
  801. {
  802. _frmTolerancesStand.Msc = msc;
  803. _frmTolerancesStand.CodeJg = codeJg;
  804. }
  805. public void SetWaterPressureStandCondition(string msc, string codeJg)
  806. {
  807. _frmProductWater.Msc = msc;
  808. _frmProductWater.CodeJg = codeJg;
  809. }
  810. public void SetComMSCStdProcessCondition(string msc, string codeJg)
  811. {
  812. _frmComMSCStdProcess.Msc = msc;
  813. _frmComMSCStdProcess.CodeJg = codeJg;
  814. }
  815. public void SetIcContidition(string ic, string standPayKey)
  816. {
  817. switch (standPayKey)
  818. {
  819. case "ChemStand":
  820. _frmChemStand.Cic = ic;
  821. break;
  822. case "ComMSCStdDetection":
  823. _frmComMSCStdDetection.Dic = ic;
  824. break;
  825. case "ProductWater":
  826. _frmProductWater.WIC = ic;
  827. break;
  828. case "TolerancesStand":
  829. _frmTolerancesStand.Sic = ic;
  830. break;
  831. case "MaterialStand":
  832. _frmMaterialStand.StrPic = ic;
  833. break;
  834. case "ComMSCStdProcess":
  835. _frmComMSCStdProcess.Gic = ic;
  836. break;
  837. }
  838. }
  839. private void SetMaterialStandCheckBoxChecked()
  840. {
  841. //Control[] controls = _tabMaterialStand.fin
  842. }
  843. private void StandPayRowFilter(System.Windows.Forms.Control control, string strGrid, string psc, string alpha)
  844. {
  845. //if (_parentUltraGrid != null && _parentUltraGrid.ActiveRow == null) return;
  846. //Control[] controls = control.Controls.Find(strGrid, true);
  847. //if (controls.Length > 0)
  848. //{
  849. // DataSet ds = (DataSet)((UltraGrid)controls[0]).DataSource;
  850. // DataTable dt = ds.Tables[((UltraGrid)controls[0]).DataMember];
  851. // if (dt.Columns.Contains("MSC"))
  852. // {
  853. // DataRow[] drs = null;
  854. // if(alpha == "")
  855. // {
  856. // drs = dt.Select("MSC <> '" + psc + "' OR PSC IS NULL");
  857. // }
  858. // else
  859. // {
  860. // //STD_CODE
  861. // if (dt.Columns.Contains("STD_CODE_NK"))
  862. // {
  863. // drs = dt.Select("STD_CODE_NK <> '" + alpha + "' OR STD_CODE_NK IS NULL");
  864. // }
  865. // else
  866. // {
  867. // drs = dt.Select("STD_CODE <> '" + alpha + "' OR STD_CODE IS NULL");
  868. // }
  869. // }
  870. // foreach (DataRow dr in drs)
  871. // {
  872. // dr.Delete();
  873. // }
  874. // dt.AcceptChanges();
  875. // }
  876. //}
  877. }
  878. }
  879. }