QcmZcAllChemPhyCtrl.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. using Core.StlMes.Client.Judge.Commons;
  2. using Core.StlMes.Client.Judge.Models;
  3. using CoreFS.CA06;
  4. using Infragistics.Win.UltraWinGrid;
  5. using Infragistics.Win.UltraWinTabControl;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Data;
  9. using System.Windows.Forms;
  10. namespace Core.StlMes.Client.Judge.Controls
  11. {
  12. public partial class QcmZcAllChemPhyCtrl : UserControl
  13. {
  14. private QcmZgJudgeApplyDtlCtrl _applyDtlCtrl;
  15. private QcmZcPassFlowCtrl _zcPassFlowCtrl;
  16. private QcmBcPassFlowCtrl _bcPassFlowCtrl;
  17. public QcmZgChemPhyCtrl ZgChemPhyLgCtrl { get; set; }
  18. public QcmZgChemPhyCtrl ZgChemPhyZgCtrl { get; set; }
  19. public QcmZgChemPhyCtrl ZgChemPhyDbkCtrl { get; set; }
  20. public QcmZgChemPhyCtrl ZgChemPhyRclCtrl { get; set; }
  21. public QcmZgChemPhyCtrl ZgChemPhyJgxCtrl { get; set; }
  22. public QcmZgChemPhyCtrl ZgChemPhyJgCtrl { get; set; }
  23. public QcmZgChemPhyCtrl ZgChemPhyCtrl { get; set; }
  24. private Dal _d;
  25. private UltraGrid _mainGrid = null;
  26. private string _frmFlag;
  27. public QcmZcAllChemPhyCtrl(Control container, OpeBase ob, UltraGrid mainGrid, string processCode, string frmFlag)
  28. {
  29. InitializeComponent();
  30. _d = new Dal(ob);
  31. _mainGrid = mainGrid;
  32. _frmFlag = frmFlag;
  33. ZgChemPhyLgCtrl = new QcmZgChemPhyCtrl(ultraTabPageControl1, ob, false, "zc", "A");
  34. _applyDtlCtrl = new QcmZgJudgeApplyDtlCtrl(ultraTabPageControl6, ob);
  35. _zcPassFlowCtrl = new QcmZcPassFlowCtrl(ultraTabPageControl7, ob);
  36. _bcPassFlowCtrl = new QcmBcPassFlowCtrl(ultraTabPageControl7, ob);
  37. ZgChemPhyZgCtrl = new QcmZgChemPhyCtrl(ultraTabPageControl2, ob, false, "zc", "D");
  38. ZgChemPhyDbkCtrl = new QcmZgChemPhyCtrl(ultraTabPageControl3, ob, false, "zc", "E");
  39. ZgChemPhyRclCtrl = new QcmZgChemPhyCtrl(ultraTabPageControl4, ob, false, "zc", "F");
  40. ZgChemPhyJgxCtrl = new QcmZgChemPhyCtrl(ultraTabPageControl8, ob, false, "zc", "G");
  41. ZgChemPhyJgCtrl = new QcmZgChemPhyCtrl(ultraTabPageControl9, ob, false, "zc", "H");
  42. ZgChemPhyCtrl = new QcmZgChemPhyCtrl(ultraTabPageControl5, ob, false, "bc", processCode);
  43. container.Controls.Add(this);
  44. this.Dock = DockStyle.Fill;
  45. if (frmFlag != "zcPass" && frmFlag != "bcPass")
  46. {
  47. ultraTabControl2.Tabs["flow"].Visible = false;
  48. }
  49. if (_frmFlag == "bcJudge")
  50. {
  51. ZgChemPhyCtrl.BringToFront();
  52. }
  53. if (_frmFlag == "zcPass")
  54. {
  55. _bcPassFlowCtrl.Visible = false;
  56. }
  57. else
  58. {
  59. _zcPassFlowCtrl.Visible = false;
  60. }
  61. }
  62. public void SetChemPhyResultError()
  63. {
  64. if (ZgChemPhyCtrl == null) return;
  65. ZgChemPhyCtrl.JhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  66. foreach (var tab in ZgChemPhyCtrl.UltraTabControl2.Tabs)
  67. {
  68. if (tab.Key == "002001007010")
  69. {
  70. QcmJhyElementsCtrl jhyElementsCtrl = (QcmJhyElementsCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  71. jhyElementsCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  72. }
  73. else if (tab.Key == "002001007020" || tab.Key == "002001007013" || tab.Key == "002001007015" || tab.Key == "002001007014"
  74. || tab.Key == "002001007009")
  75. {
  76. QcmJhyPhyResultCtrl jhyPhyResultCtrl = (QcmJhyPhyResultCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  77. jhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  78. }
  79. }
  80. ZgChemPhyLgCtrl.JhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  81. foreach (var tab in ZgChemPhyLgCtrl.UltraTabControl2.Tabs)
  82. {
  83. if (tab.Key == "002001007010")
  84. {
  85. QcmJhyElementsCtrl jhyElementsCtrl = (QcmJhyElementsCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  86. jhyElementsCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  87. }
  88. else if (tab.Key == "002001007020" || tab.Key == "002001007013" || tab.Key == "002001007015" || tab.Key == "002001007014"
  89. || tab.Key == "002001007009")
  90. {
  91. QcmJhyPhyResultCtrl jhyPhyResultCtrl = (QcmJhyPhyResultCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  92. jhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  93. }
  94. }
  95. ZgChemPhyZgCtrl.JhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  96. foreach (var tab in ZgChemPhyZgCtrl.UltraTabControl2.Tabs)
  97. {
  98. if (tab.Key == "002001007010")
  99. {
  100. QcmJhyElementsCtrl jhyElementsCtrl = (QcmJhyElementsCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  101. jhyElementsCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  102. }
  103. else if (tab.Key == "002001007020" || tab.Key == "002001007013" || tab.Key == "002001007015" || tab.Key == "002001007014"
  104. || tab.Key == "002001007009")
  105. {
  106. QcmJhyPhyResultCtrl jhyPhyResultCtrl = (QcmJhyPhyResultCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  107. jhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  108. }
  109. }
  110. ZgChemPhyDbkCtrl.JhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  111. foreach (var tab in ZgChemPhyDbkCtrl.UltraTabControl2.Tabs)
  112. {
  113. if (tab.Key == "002001007010")
  114. {
  115. QcmJhyElementsCtrl jhyElementsCtrl = (QcmJhyElementsCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  116. jhyElementsCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  117. }
  118. else if (tab.Key == "002001007020" || tab.Key == "002001007013" || tab.Key == "002001007015" || tab.Key == "002001007014"
  119. || tab.Key == "002001007009")
  120. {
  121. QcmJhyPhyResultCtrl jhyPhyResultCtrl = (QcmJhyPhyResultCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  122. jhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  123. }
  124. }
  125. ZgChemPhyRclCtrl.JhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  126. foreach (var tab in ZgChemPhyRclCtrl.UltraTabControl2.Tabs)
  127. {
  128. if (tab.Key == "002001007010")
  129. {
  130. QcmJhyElementsCtrl jhyElementsCtrl = (QcmJhyElementsCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  131. jhyElementsCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  132. }
  133. else if (tab.Key == "002001007020" || tab.Key == "002001007013" || tab.Key == "002001007015" || tab.Key == "002001007014"
  134. || tab.Key == "002001007009")
  135. {
  136. QcmJhyPhyResultCtrl jhyPhyResultCtrl = (QcmJhyPhyResultCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  137. jhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  138. }
  139. }
  140. ZgChemPhyJgxCtrl.JhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  141. foreach (var tab in ZgChemPhyJgxCtrl.UltraTabControl2.Tabs)
  142. {
  143. if (tab.Key == "002001007010")
  144. {
  145. QcmJhyElementsCtrl jhyElementsCtrl = (QcmJhyElementsCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  146. jhyElementsCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  147. }
  148. else if (tab.Key == "002001007020" || tab.Key == "002001007013" || tab.Key == "002001007015" || tab.Key == "002001007014"
  149. || tab.Key == "002001007009")
  150. {
  151. QcmJhyPhyResultCtrl jhyPhyResultCtrl = (QcmJhyPhyResultCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  152. jhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  153. }
  154. }
  155. ZgChemPhyJgCtrl.JhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  156. foreach (var tab in ZgChemPhyJgCtrl.UltraTabControl2.Tabs)
  157. {
  158. if (tab.Key == "002001007010")
  159. {
  160. QcmJhyElementsCtrl jhyElementsCtrl = (QcmJhyElementsCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  161. jhyElementsCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  162. }
  163. else if (tab.Key == "002001007020" || tab.Key == "002001007013" || tab.Key == "002001007015" || tab.Key == "002001007014"
  164. || tab.Key == "002001007009")
  165. {
  166. QcmJhyPhyResultCtrl jhyPhyResultCtrl = (QcmJhyPhyResultCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  167. jhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  168. }
  169. }
  170. }
  171. private DataRow _sti = null;
  172. private Dictionary<string, List<DataRow>> _applyDic = new Dictionary<string, List<DataRow>>();
  173. private DataRow _drZcApply = null;
  174. private string _ordLnPk = "";
  175. public void UltraTabControl2_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  176. {
  177. try
  178. {
  179. this.Cursor = Cursors.WaitCursor;
  180. if (_mainGrid == null || _mainGrid.ActiveRow == null) return;
  181. ClearChemPhyData();
  182. var mainRow = _mainGrid.ActiveRow;
  183. _drZcApply = _d.GetRowByXmlId("QcmZgJugdeApplyDAL.QueryByBatchNo", mainRow.GetValue("jugdeApplyCode"),
  184. mainRow.GetValue("judgeStoveNo"), mainRow.GetValue("batchNo"));
  185. string ordLnPk = "";
  186. if (_drZcApply["ordLnDlyPk"].ToString() != "")
  187. {
  188. ordLnPk = QcmZgChemPhyCtrl.getOrdLnPkByDlyPk(_drZcApply["ordLnDlyPk"].ToString(), _d);
  189. }
  190. DataRow drEndProcess = _d.GetRowByXmlId("JdgCraftOrdDesignMscPlPrc.getEndProcessByOrdLnPk", ordLnPk,
  191. _drZcApply["craftSeq"].ToString(), _drZcApply["indexSeq"].ToString());
  192. if (_frmFlag == "bcJudge" || _frmFlag == "bcPass")
  193. {
  194. if (ordLnPk.StartsWith("BL") && drEndProcess["processCode"].ToString() == _drZcApply["processCode"].ToString())
  195. {
  196. ZgChemPhyCtrl.Visible = false;
  197. ultraTabControl1.Visible = true;
  198. }
  199. else
  200. {
  201. ZgChemPhyCtrl.Visible = true;
  202. ultraTabControl1.Visible = false;
  203. }
  204. }
  205. else
  206. {
  207. ZgChemPhyCtrl.Visible = false;
  208. ultraTabControl1.Visible = true;
  209. }
  210. string applyCode = mainRow.GetValue("jugdeApplyCode");
  211. string judgeStoveNo = mainRow.GetValue("judgeStoveNo");
  212. string batchNo = mainRow.GetValue("batchNo");
  213. string passApplyNo = mainRow.GetValue("passApplyNo");
  214. switch (ultraTabControl2.ActiveTab.Key)
  215. {
  216. case "judge":
  217. if (_drZcApply["ordLnDlyPk"].ToString() == "")
  218. return;
  219. if (ZgChemPhyCtrl.Visible == true)
  220. {
  221. ZgChemPhyCtrl.Query(ZgChemPhyCtrl.GetParm(null, _drZcApply, _drZcApply, "", true));
  222. }
  223. else
  224. {
  225. _ordLnPk = ordLnPk;
  226. _sti = _d.GetRowByXmlId("CraftOrdDesignMscPlSti.getPhyProcess", _ordLnPk, _drZcApply["craftSeq"].ToString(),
  227. _drZcApply["indexSeq"].ToString());
  228. Dictionary<string, DataRow> tmpApplyDic = GetAllJudgeApply(_drZcApply["jugdeApplyCode"].ToString(), _drZcApply["judgeStoveNo"].ToString(), _drZcApply["batchNo"].ToString(),
  229. _drZcApply["processCode"].ToString(), _drZcApply["heatPlanNo"].ToString(), _sti["processCode"].ToString(), null, null, _d);
  230. _applyDic.Clear();
  231. foreach (string key in tmpApplyDic.Keys)
  232. {
  233. List<DataRow> tmpApplys = new List<DataRow>();
  234. tmpApplys.Add(tmpApplyDic[key]);
  235. _applyDic.Add(key, tmpApplys);
  236. }
  237. DataRow drWholeBacklog = _d.GetRowByXmlId("JdgCraftOrdDesignMscPl.getWholeBacklog", ordLnPk,
  238. _drZcApply["craftSeq"].ToString(), _drZcApply["indexSeq"].ToString());
  239. if (drWholeBacklog == null)
  240. {
  241. return;
  242. }
  243. string whole = drWholeBacklog["wholeBacklog"].ToString();
  244. ClearTabTag();
  245. HiddenTab(whole, _applyDic);
  246. //短节
  247. DataTable djBlStoveNo = _d.GetTableByXmlId("JdgPlnZyJgxMC.queryByHeatPlanNoNew", _drZcApply["heatPlanNo"].ToString());
  248. //DataTable jgBlStoveNo = _d.GetTableByXmlId("JdgMchTwistinglyResult.getResultDInfoByBatchNoHeatPlanNo",
  249. // _drZcApply["judgeStoveNo"].ToString(), _drZcApply["batchNo"].ToString(), _drZcApply["heatPlanNo"].ToString());
  250. if (djBlStoveNo.Rows.Count > 0)
  251. {
  252. foreach (DataRow drBlStoveNo in djBlStoveNo.Rows)
  253. {
  254. string blStoveNo = drBlStoveNo["judgeStoveNo"].ToString();
  255. string blBatchNo = drBlStoveNo["batchNo"].ToString();
  256. QueryBLApply(blStoveNo, blBatchNo);
  257. }
  258. }
  259. //if (jgBlStoveNo.Rows.Count > 0)
  260. //{
  261. // foreach (DataRow drBlStoveNo in jgBlStoveNo.Rows)
  262. // {
  263. // string blStoveNo = drBlStoveNo["couplingStoveNo"].ToString();
  264. // string blBatchNo = drBlStoveNo["lotNo"].ToString();
  265. // QueryBLApply(blStoveNo, blBatchNo);
  266. // }
  267. //}
  268. SetTabTag();
  269. //JudgeCraftParam zzbParam = null;
  270. //foreach (List<DataRow> apps in _applyDic.Values)
  271. //{
  272. // foreach (DataRow app in apps)
  273. // {
  274. // if (app["zzbFlag"].ToString() == "1")
  275. // {
  276. // zzbParam = QcmZgChemPhyCtrl.GetCraftParam(app, _drZcApply, null, _d);
  277. // }
  278. // }
  279. //}
  280. QueryZgChemPhy();
  281. }
  282. break;
  283. case "apply":
  284. _applyDtlCtrl.Query(applyCode, judgeStoveNo, batchNo);
  285. break;
  286. case "flow":
  287. if (_frmFlag == "zcPass")
  288. {
  289. _zcPassFlowCtrl.Query(passApplyNo);
  290. }
  291. else
  292. {
  293. _bcPassFlowCtrl.Query(passApplyNo);
  294. }
  295. break;
  296. }
  297. }
  298. finally
  299. {
  300. this.Cursor = Cursors.Default;
  301. }
  302. }
  303. private void QueryBLApply(string blStoveNo, string blBatchNo)
  304. {
  305. DataRow drBlApply = _d.GetRowByXmlId("QcmZgJugdeApplyDAL.QueryBLByBatchNo", blStoveNo, blBatchNo);
  306. if (drBlApply == null) return;
  307. string blOrdLnPk = "";
  308. DataRow drPlnSaleOrd = _d.GetRowByXmlId("JdgPlnSaleOrd.getOrdLnPkByDlyPk", drBlApply["ordLnDlyPk"].ToString());
  309. blOrdLnPk = drPlnSaleOrd["ordLnPk"].ToString();
  310. DataRow drBlSti = _d.GetRowByXmlId("CraftOrdDesignMscPlSti.getPhyProcess", blOrdLnPk, drBlApply["craftSeq"].ToString(),
  311. drBlApply["indexSeq"].ToString());
  312. DataRow blWholeBacklog = _d.GetRowByXmlId("JdgCraftOrdDesignMscPl.getWholeBacklog", blOrdLnPk,
  313. _drZcApply["craftSeq"].ToString(), _drZcApply["indexSeq"].ToString());
  314. if (blWholeBacklog == null) return;
  315. string blWhole = blWholeBacklog["wholeBacklog"].ToString();
  316. Dictionary<string, DataRow> blApplyDic = GetAllJudgeApply(drBlApply["jugdeApplyCode"].ToString(),
  317. drBlApply["judgeStoveNo"].ToString(), drBlApply["batchNo"].ToString(), drBlApply["processCode"].ToString(),
  318. drBlApply["heatPlanNo"].ToString(), drBlSti["processCode"].ToString(), null, null, _d);
  319. foreach (string key in blApplyDic.Keys)
  320. {
  321. if (_applyDic.ContainsKey(key))
  322. {
  323. _applyDic[key].Add(blApplyDic[key]);
  324. }
  325. else
  326. {
  327. List<DataRow> tmpApplys = new List<DataRow>();
  328. tmpApplys.Add(blApplyDic[key]);
  329. _applyDic.Add(key, tmpApplys);
  330. }
  331. }
  332. HiddenTab(blWhole, _applyDic);
  333. }
  334. private void ClearTabTag()
  335. {
  336. ultraTabControl1.Tabs["A"].Tag = null;
  337. ultraTabControl1.Tabs["D"].Tag = null;
  338. ultraTabControl1.Tabs["E"].Tag = null;
  339. ultraTabControl1.Tabs["F"].Tag = null;
  340. ultraTabControl1.Tabs["G"].Tag = null;
  341. ultraTabControl1.Tabs["H"].Tag = null;
  342. }
  343. private bool _isSetTab = false;
  344. public void SetTabTag()
  345. {
  346. try
  347. {
  348. _isSetTab = true;
  349. foreach (UltraTab tab in ultraTabControl1.Tabs)
  350. {
  351. if (tab.Tag == null)
  352. {
  353. tab.Visible = false;
  354. }
  355. else
  356. {
  357. tab.Visible = true;
  358. }
  359. }
  360. }
  361. finally
  362. {
  363. _isSetTab = false;
  364. }
  365. }
  366. private void HiddenTab(string whole, Dictionary<string, List<DataRow>> applyDic)
  367. {
  368. //if (whole != "H")
  369. //{
  370. // ultraTabControl1.Tabs["A"].Tag = "1";
  371. // ultraTabControl1.Tabs["D"].Tag = "1";
  372. //}
  373. ultraTabControl1.Tabs["A"].Tag = "1";
  374. if (whole.Contains("D") || applyDic.ContainsKey("D"))
  375. {
  376. ultraTabControl1.Tabs["D"].Tag = "1";
  377. }
  378. if (whole.Contains("E") || applyDic.ContainsKey("E"))
  379. {
  380. ultraTabControl1.Tabs["E"].Tag = "1";
  381. }
  382. if (whole.Contains("F") || applyDic.ContainsKey("F"))
  383. {
  384. ultraTabControl1.Tabs["F"].Tag = "1";
  385. }
  386. if (whole.Contains("G") || applyDic.ContainsKey("G"))
  387. {
  388. ultraTabControl1.Tabs["G"].Tag = "1";
  389. }
  390. if (whole.Contains("H") || applyDic.ContainsKey("H"))
  391. {
  392. ultraTabControl1.Tabs["H"].Tag = "1";
  393. }
  394. }
  395. public void QueryZgChemPhy()
  396. {
  397. if (ultraTabControl1.ActiveTab == null) return;
  398. if (ZgChemPhyLgCtrl == null) return;
  399. if (_drZcApply == null) return;
  400. if (_mainGrid.ActiveRow == null) return;
  401. if (_applyDic.Count == 0) return;
  402. string passApplyNo = _mainGrid.GetActiveRowValue("passApplyNo");
  403. string key = ultraTabControl1.ActiveTab.Key;
  404. switch (ultraTabControl1.ActiveTab.Key)
  405. {
  406. case "A":
  407. ZgChemPhyLgCtrl.ClearData(true);
  408. if (_applyDic.ContainsKey("D"))
  409. {
  410. ZgChemPhyLgCtrl.QueryLg(_applyDic["D"], _drZcApply, _sti["processCode"].ToString(), "");
  411. }
  412. else
  413. {
  414. if (!_applyDic.ContainsKey(_drZcApply["processCode"].ToString()))
  415. return;
  416. ZgChemPhyLgCtrl.QueryLg(_applyDic[_drZcApply["processCode"].ToString()], _drZcApply, _sti["processCode"].ToString(), "");
  417. }
  418. break;
  419. case "D":
  420. ZgChemPhyZgCtrl.ClearData(true);
  421. if (_applyDic.ContainsKey(key))
  422. {
  423. ZgChemPhyZgCtrl.QueryZc(_applyDic[key], _drZcApply, "");
  424. }
  425. break;
  426. case "E":
  427. ZgChemPhyDbkCtrl.ClearData(true);
  428. if (_applyDic.ContainsKey(key))
  429. {
  430. ZgChemPhyDbkCtrl.QueryZc(_applyDic[key], _drZcApply, "");
  431. }
  432. break;
  433. case "F":
  434. ZgChemPhyRclCtrl.ClearData(true);
  435. if (_applyDic.ContainsKey(key))
  436. {
  437. ZgChemPhyRclCtrl.QueryZc(_applyDic[key], _drZcApply, "");
  438. }
  439. break;
  440. case "G":
  441. ZgChemPhyJgxCtrl.ClearData(true);
  442. if (_applyDic.ContainsKey(key))
  443. {
  444. ZgChemPhyJgxCtrl.QueryZc(_applyDic[key], _drZcApply, "");
  445. }
  446. break;
  447. case "H":
  448. ZgChemPhyJgCtrl.ClearData(true);
  449. if (_applyDic.ContainsKey(key))
  450. {
  451. ZgChemPhyJgCtrl.QueryZc(_applyDic[key], _drZcApply, "");
  452. }
  453. break;
  454. }
  455. }
  456. public QcmZgChemPhyCtrl GetActiveChemPhyCtrl()
  457. {
  458. switch (ultraTabControl1.ActiveTab.Key)
  459. {
  460. case "A":
  461. return ZgChemPhyLgCtrl;
  462. case "D":
  463. return ZgChemPhyZgCtrl;
  464. case "E":
  465. return ZgChemPhyDbkCtrl;
  466. case "F":
  467. return ZgChemPhyRclCtrl;
  468. case "G":
  469. return ZgChemPhyJgxCtrl;
  470. case "H":
  471. return ZgChemPhyJgCtrl;
  472. default:
  473. return null;
  474. }
  475. }
  476. public void ClearChemPhyData()
  477. {
  478. ZgChemPhyLgCtrl.ClearData(true);
  479. ZgChemPhyZgCtrl.ClearData(true);
  480. ZgChemPhyDbkCtrl.ClearData(true);
  481. ZgChemPhyRclCtrl.ClearData(true);
  482. ZgChemPhyJgxCtrl.ClearData(true);
  483. ZgChemPhyJgCtrl.ClearData(true);
  484. ZgChemPhyCtrl.ClearData(true);
  485. _bcPassFlowCtrl.Clear();
  486. _zcPassFlowCtrl.Clear();
  487. }
  488. public void ClearChemPhyParms()
  489. {
  490. ZgChemPhyLgCtrl.ClearParms();
  491. ZgChemPhyZgCtrl.ClearParms();
  492. ZgChemPhyDbkCtrl.ClearParms();
  493. ZgChemPhyRclCtrl.ClearParms();
  494. ZgChemPhyJgxCtrl.ClearParms();
  495. ZgChemPhyJgCtrl.ClearParms();
  496. ZgChemPhyCtrl.ClearParms();
  497. }
  498. private void UltraTabControl1_SelectedTabChanged(object sender, SelectedTabChangedEventArgs e)
  499. {
  500. try
  501. {
  502. if (_isSetTab) return;
  503. this.Cursor = Cursors.WaitCursor;
  504. ClearChemPhyParms();
  505. QueryZgChemPhy();
  506. }
  507. finally
  508. {
  509. this.Cursor = Cursors.Default;
  510. }
  511. }
  512. public static Dictionary<string, DataRow> GetAllJudgeApply(string judgeApplyCode, string judgeStoveNo, string batchNo, string processCode,
  513. string heatPlanNo, string phyProcess, Dictionary<string, DataRow> dic, JudgeCraftParam zzbCp, Dal d)
  514. {
  515. if (dic == null)
  516. {
  517. dic = new Dictionary<string, DataRow>();
  518. }
  519. DataRow drApply = null;
  520. if (judgeApplyCode == "")
  521. {
  522. drApply = d.GetRowByXmlId("QcmZgJugdeApplyDAL.QueryByBatchNo2", judgeStoveNo, batchNo, processCode, heatPlanNo);
  523. }
  524. else
  525. {
  526. drApply = d.GetRowByXmlId("QcmZgJugdeApplyDAL.QueryByBatchNo", judgeApplyCode, judgeStoveNo, batchNo);
  527. }
  528. if (drApply != null)
  529. {
  530. if (zzbCp != null)//合同管转备料管
  531. {
  532. drApply["ordLnDlyPk"] = zzbCp.OrdLnDlyPk;
  533. drApply["craftSeq"] = zzbCp.CraftSeq;
  534. drApply["indexSeq"] = zzbCp.MscPline;
  535. drApply["cic"] = zzbCp.Cic;
  536. DataRow stdMinPic = d.GetRowByXmlId("CraftOrdDesignStdPic.getNkMinPic", zzbCp.OrdLnPk, zzbCp.CraftSeq, zzbCp.MscPline,
  537. drApply["processCode"].ToString());
  538. drApply["pic"] = stdMinPic["pic"].ToString();
  539. }
  540. dic.Add(drApply["processCode"].ToString(), drApply);
  541. if (drApply["ordLnDlyPk"].ToString().StartsWith("ZZB"))
  542. {
  543. //DataRow drChemCnt = d.GetRowByXmlId("CraftOrdDesignStdCic.getChemCnt", ordLnPk, craftSeq, "", mscPline, processCode);
  544. //DataRow drPhyCnt = d.GetRowByXmlId("CraftOrdDesignStdPic.getPhyCnt", ordLnPk, craftSeq, processCode, "", mscPline);
  545. zzbCp = QcmZgChemPhyCtrl.GetCraftParam(drApply, null, d);
  546. }
  547. }
  548. if (drApply != null)
  549. {
  550. if ("6".Equals(drApply["isAllScrap"].ToString()) && !"".Equals(drApply["loadBatchNo"].ToString()))
  551. {
  552. return GetAllJudgeApply("", drApply["loadJudgeStoveNo"].ToString(), drApply["loadBatchNo"].ToString(), "H", getUpperPlanId(drApply["heatPlanNo"].ToString(), processCode, d),
  553. phyProcess, null, zzbCp, d);
  554. }
  555. }
  556. if (processCode.ToCharArray()[0] <= 'D')
  557. {
  558. return dic;
  559. }
  560. else
  561. {
  562. string loadJudgeStoveNo = "";
  563. string loadBatchNo = "";
  564. string upHeatPlanNo = "";
  565. if (drApply == null)
  566. {
  567. loadJudgeStoveNo = judgeStoveNo;
  568. loadBatchNo = batchNo;
  569. upHeatPlanNo = heatPlanNo;
  570. }
  571. else
  572. {
  573. loadJudgeStoveNo = drApply["loadJudgeStoveNo"].ToString();
  574. loadBatchNo = drApply["loadBatchNo"].ToString();
  575. upHeatPlanNo = getUpperPlanId(drApply["heatPlanNo"].ToString(), processCode, d);
  576. }
  577. char cProcessCode = (char)(processCode.ToCharArray()[0] - 1);
  578. return GetAllJudgeApply("", loadJudgeStoveNo, loadBatchNo, cProcessCode.ToString(), upHeatPlanNo,
  579. phyProcess, dic, zzbCp, d);
  580. }
  581. }
  582. private static string getUpperPlanId(string heatPlanNo, string processCode, Dal d)
  583. {
  584. DataRow drUpper = null;
  585. if (processCode == "D")
  586. {
  587. drUpper = d.GetRowByXmlId("JdgPlnZyZgM.queryUpperByPk", heatPlanNo);
  588. }
  589. else if (processCode == "E")
  590. {
  591. drUpper = d.GetRowByXmlId("JdgPlnZyDbkM.queryUpperByPk", heatPlanNo);
  592. }
  593. else if (processCode == "F")
  594. {
  595. drUpper = d.GetRowByXmlId("JdgPlnZyRclM.queryUpperByPk", heatPlanNo);
  596. }
  597. else if (processCode == "G")
  598. {
  599. drUpper = d.GetRowByXmlId("JdgPlnZyJgxM.queryUpperByPk", heatPlanNo);
  600. }
  601. else if (processCode == "H")
  602. {
  603. drUpper = d.GetRowByXmlId("JdgPlnZyJgM.queryUpperByPk", heatPlanNo);
  604. }
  605. else
  606. {
  607. return heatPlanNo;
  608. }
  609. if (drUpper == null) return "";
  610. if (drUpper["upperProcessCode"].ToString() == processCode)
  611. {
  612. return getUpperPlanId(drUpper["upperHeatplanId"].ToString(), processCode, d);
  613. }
  614. else
  615. {
  616. return drUpper["upperHeatplanId"].ToString();
  617. }
  618. }
  619. }
  620. }