UIF0420101.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Common;
  11. using System.Collections;
  12. using Core.LZMes.Client.UIE;
  13. namespace Core.LZMes.Client.UIF
  14. {
  15. /// <summary>
  16. /// 酸轧生产管制主界面:轧批指定
  17. /// </summary>
  18. public partial class UIF0420101 : CoreFS.CA06.FrmBase
  19. {
  20. public UIF0420101()
  21. {
  22. InitializeComponent();
  23. }
  24. #region "Button Event"
  25. /// <summary>
  26. /// 轧制单元计划:酸轧基料卷选择
  27. /// </summary>
  28. /// <param name="sender"></param>
  29. /// <param name="e"></param>
  30. private void btn_Add_Click(object sender, EventArgs e)
  31. {
  32. try
  33. {
  34. this.ugrd_HCoilInfo.UpdateData();
  35. System.Data.DataRow[] rows = this.dataSet1.Tables["TAB_HCOILINFO"].Select("FLAG='TRUE'");
  36. if (rows.Length == 0)
  37. {
  38. MessageBox.Show("您还未选择基料卷,请选择");
  39. return;
  40. }
  41. string CoilNOS = "";
  42. string ex = "";
  43. for (int i = 0; i < this.ugrd_HCoilInfo.Rows.Count; i++)
  44. {
  45. if (Common.FixDBManager.CheckNullStr(ugrd_HCoilInfo.Rows[i].Cells["FLAG"].Value).ToUpper() == "TRUE")
  46. {
  47. CoilNOS = CoilNOS + ugrd_HCoilInfo.Rows[i].Cells["COIL_NO"].Value.ToString() + ";";
  48. }
  49. }
  50. CoilNOS = CoilNOS.Substring(0, CoilNOS.Length - 1);
  51. Hashtable paramHsmp = new Hashtable();
  52. paramHsmp.Add("i1", CoilNOS);
  53. paramHsmp.Add("i2", rows.Length.ToString());
  54. paramHsmp.Add("i3", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  55. paramHsmp.Add("o4", ex);
  56. CoreClientParam ccp = new CoreClientParam();
  57. ccp.ServerName = "UIB.COM.ComDBProcedure";
  58. ccp.MethodName = "doXmlProcedure";
  59. ccp.ServerParams = new Object[] { "UIF042010.Add_RollPlan_List", paramHsmp };
  60. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  61. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  62. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  63. {
  64. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  65. }
  66. else
  67. {
  68. Get_RollPlan_List();
  69. Get_RollPlan_Info();
  70. for (int i = rows.Length - 1; i >= 0; i--)
  71. {
  72. this.dataSet1.Tables["TAB_HCOILINFO"].Rows.Remove(rows[i]);
  73. }
  74. this.dataSet1.Tables["TAB_HCOILINFO"].AcceptChanges();
  75. }
  76. }
  77. catch (System.Exception ex)
  78. {
  79. System.Diagnostics.Debug.WriteLine(ex.ToString());
  80. }
  81. }
  82. /// <summary>
  83. /// 轧制单元计划:删除已制定的计划
  84. /// </summary>
  85. /// <param name="sender"></param>
  86. /// <param name="e"></param>
  87. private void btn_Del_Click(object sender, EventArgs e)
  88. {
  89. try
  90. {
  91. if (this.ugrd_RollPlan.Selected.Rows.Count == 0)
  92. {
  93. MessageBox.Show("请选择您要移除的记录");
  94. return;
  95. }
  96. string RollNO = this.ugrd_RollInfo.Rows[0].Cells[1].Value.ToString();
  97. string CoilNOS = "";
  98. string Condition = "";
  99. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_RollPlan.Selected.Rows)
  100. {
  101. CoilNOS = CoilNOS + Common.FixDBManager.CheckNullStr(row.Cells["COIL_NO"].Value) + ";";
  102. Condition = Condition + "'" + Common.FixDBManager.CheckNullStr(row.Cells["COIL_NO"].Value) + "',";
  103. }
  104. CoilNOS = CoilNOS.Substring(0, CoilNOS.Length - 1);
  105. Condition = Condition.Substring(0, Condition.Length - 1);
  106. Condition = " AND A.COIL_NO IN(" + Condition + ") ";
  107. Hashtable paramHsmp = new Hashtable();
  108. paramHsmp.Add("i1", RollNO);
  109. paramHsmp.Add("i2", CoilNOS);
  110. paramHsmp.Add("i3", this.ugrd_RollPlan.Selected.Rows.Count.ToString());
  111. CoreClientParam ccp = new CoreClientParam();
  112. ccp.ServerName = "UIB.COM.ComDBProcedure";
  113. ccp.MethodName = "doXmlProcedure";
  114. ccp.ServerParams = new Object[] { "UIF042010.Del_RollPlan_List", paramHsmp };
  115. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  116. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  117. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  118. {
  119. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  120. }
  121. else
  122. {
  123. Get_RollPlan_List();
  124. Get_RollPlan_Info();
  125. Query(Condition);
  126. }
  127. }
  128. catch (System.Exception ex)
  129. {
  130. System.Diagnostics.Debug.WriteLine(ex.ToString());
  131. }
  132. }
  133. /// <summary>
  134. /// 轧制单位内基料卷顺序前移
  135. /// </summary>
  136. /// <param name="sender"></param>
  137. /// <param name="e"></param>
  138. private void btn_UP_Click(object sender, EventArgs e)
  139. {
  140. try
  141. {
  142. if (this.ugrd_RollPlan.Selected.Rows.Count == 0)
  143. {
  144. MessageBox.Show("请确定您要前移的基料卷");
  145. return;
  146. }
  147. string ex = "";
  148. string Index_ = "";
  149. string RollNO = this.ugrd_RollInfo.Rows[0].Cells[1].Value.ToString();
  150. System.Collections.ArrayList HCoil_ary = new ArrayList();
  151. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_RollPlan.Selected.Rows)
  152. {
  153. Index_ = Index_ + Common.FixDBManager.CheckNullStr(row.Cells["INDX_"].Value) + ";";
  154. HCoil_ary.Add(row.Cells["COIL_NO"].Value);
  155. }
  156. Index_ = Index_.Substring(0, Index_.Length - 1);
  157. string[] Indexs_ = Index_.Split(';');
  158. if (Check_Index_Order(Indexs_))
  159. {
  160. Hashtable paramHsmp = new Hashtable();
  161. paramHsmp.Add("i1", RollNO);
  162. paramHsmp.Add("i2", this.ugrd_RollPlan.Selected.Rows.Count.ToString());
  163. paramHsmp.Add("i3", Get_Index_Min(Indexs_));
  164. paramHsmp.Add("i4", Get_Index_Max(Indexs_));
  165. paramHsmp.Add("i5", "-1");
  166. paramHsmp.Add("o6", ex);
  167. CoreClientParam ccp = new CoreClientParam();
  168. ccp.ServerName = "UIB.COM.ComDBProcedure";
  169. ccp.MethodName = "doXmlProcedure";
  170. ccp.ServerParams = new Object[] { "UIF042010.Adj_RollPlan_List", paramHsmp };
  171. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  172. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  173. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  174. {
  175. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  176. }
  177. else
  178. {
  179. Get_RollPlan_List();
  180. Get_RollPlan_Info();
  181. ReSet_SelectRow(HCoil_ary);
  182. }
  183. }
  184. }
  185. catch (System.Exception ex)
  186. {
  187. System.Diagnostics.Debug.WriteLine(ex.ToString());
  188. }
  189. }
  190. /// <summary>
  191. /// 轧制单元内基料卷顺序后移
  192. /// </summary>
  193. /// <param name="sender"></param>
  194. /// <param name="e"></param>
  195. private void btn_Down_Click(object sender, EventArgs e)
  196. {
  197. try
  198. {
  199. if (this.ugrd_RollPlan.Selected.Rows.Count == 0)
  200. {
  201. MessageBox.Show("请确定您要前移的基料卷");
  202. return;
  203. }
  204. string ex = "";
  205. string Index_ = "";
  206. string RollNO = this.ugrd_RollInfo.Rows[0].Cells[1].Value.ToString();
  207. System.Collections.ArrayList HCoil_ary = new ArrayList();
  208. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_RollPlan.Selected.Rows)
  209. {
  210. Index_ = Index_ + Common.FixDBManager.CheckNullStr(row.Cells["INDX_"].Value) + ";";
  211. HCoil_ary.Add(row.Cells["COIL_NO"].Value);
  212. }
  213. Index_ = Index_.Substring(0, Index_.Length - 1);
  214. string[] Indexs_ = Index_.Split(';');
  215. if (Check_Index_Order(Indexs_))
  216. {
  217. Hashtable paramHsmp = new Hashtable();
  218. paramHsmp.Add("i1", RollNO);
  219. paramHsmp.Add("i2", this.ugrd_RollPlan.Selected.Rows.Count.ToString());
  220. paramHsmp.Add("i3", Get_Index_Min(Indexs_));
  221. paramHsmp.Add("i4", Get_Index_Max(Indexs_));
  222. paramHsmp.Add("i5", "1");
  223. paramHsmp.Add("o6", ex);
  224. CoreClientParam ccp = new CoreClientParam();
  225. ccp.ServerName = "UIB.COM.ComDBProcedure";
  226. ccp.MethodName = "doXmlProcedure";
  227. ccp.ServerParams = new Object[] { "UIF042010.Adj_RollPlan_List", paramHsmp };
  228. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  229. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  230. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  231. {
  232. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  233. }
  234. else
  235. {
  236. Get_RollPlan_List();
  237. Get_RollPlan_Info();
  238. ReSet_SelectRow(HCoil_ary);
  239. }
  240. }
  241. }
  242. catch (System.Exception ex)
  243. {
  244. System.Diagnostics.Debug.WriteLine(ex.ToString());
  245. }
  246. }
  247. /// <summary>
  248. /// 并卷
  249. /// </summary>
  250. /// <param name="sender"></param>
  251. /// <param name="e"></param>
  252. private void btn_Merge_Click(object sender, EventArgs e)
  253. {
  254. try
  255. {
  256. if (this.ugrd_RollPlan.Selected.Rows.Count == 0)
  257. {
  258. MessageBox.Show("请确定您要并卷的基料卷");
  259. return;
  260. }
  261. string Index_ = "";
  262. string HCoilNOS = "";
  263. string ex = "";
  264. string RollNO = this.ugrd_RollInfo.Rows[0].Cells[1].Value.ToString();
  265. System.Collections.ArrayList HCoil_ary = new ArrayList();
  266. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_RollPlan.Selected.Rows)
  267. {
  268. Index_ = Index_ + Common.FixDBManager.CheckNullStr(row.Cells["INDX_"].Value) + ";";
  269. HCoilNOS = HCoilNOS + Common.FixDBManager.CheckNullStr(row.Cells["COIL_NO"].Value) + ";";
  270. HCoil_ary.Add(row.Cells["COIL_NO"].Value);
  271. }
  272. Index_ = Index_.Substring(0, Index_.Length - 1);
  273. string[] Indexs_ = Index_.Split(';');
  274. if (Check_Index_Order(Indexs_))
  275. {
  276. Hashtable paramHsmp = new Hashtable();
  277. paramHsmp.Add("i1", RollNO);
  278. paramHsmp.Add("i2", this.ugrd_RollPlan.Selected.Rows.Count.ToString());
  279. paramHsmp.Add("i3", HCoilNOS);
  280. paramHsmp.Add("o4", ex);
  281. CoreClientParam ccp = new CoreClientParam();
  282. ccp.ServerName = "UIB.COM.ComDBProcedure";
  283. ccp.MethodName = "doXmlProcedure";
  284. ccp.ServerParams = new Object[] { "UIF042010.Mge_RollPlan_HCoil", paramHsmp };
  285. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  286. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  287. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  288. {
  289. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  290. }
  291. else
  292. {
  293. Get_RollPlan_List();
  294. Get_RollPlan_Info();
  295. ReSet_SelectRow(HCoil_ary);
  296. }
  297. }
  298. }
  299. catch (System.Exception ex)
  300. {
  301. System.Diagnostics.Debug.WriteLine(ex.ToString());
  302. }
  303. }
  304. /// <summary>
  305. /// 取消并卷
  306. /// </summary>
  307. /// <param name="sender"></param>
  308. /// <param name="e"></param>
  309. private void btn_Cancel_Click(object sender, EventArgs e)
  310. {
  311. try
  312. {
  313. if (this.ugrd_RollPlan.Selected.Rows.Count == 0)
  314. {
  315. MessageBox.Show("请确定您要并卷的基料卷");
  316. return;
  317. }
  318. string Index_ = "";
  319. string HCoilNOS = "";
  320. string RollNO = this.ugrd_RollInfo.Rows[0].Cells[1].Value.ToString();
  321. System.Collections.ArrayList HCoil_ary = new ArrayList();
  322. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_RollPlan.Selected.Rows)
  323. {
  324. Index_ = Index_ + Common.FixDBManager.CheckNullStr(row.Cells["INDX_"].Value) + ";";
  325. HCoilNOS = HCoilNOS + Common.FixDBManager.CheckNullStr(row.Cells["COIL_NO"].Value) + ";";
  326. HCoil_ary.Add(row.Cells["COIL_NO"].Value);
  327. }
  328. Index_ = Index_.Substring(0, Index_.Length - 1);
  329. string[] Indexs_ = Index_.Split(';');
  330. string ex = "";
  331. if (Check_Index_Order(Indexs_))
  332. {
  333. Hashtable paramHsmp = new Hashtable();
  334. paramHsmp.Add("i1", RollNO);
  335. paramHsmp.Add("i2", this.ugrd_RollPlan.Selected.Rows.Count.ToString());
  336. paramHsmp.Add("i3", HCoilNOS);
  337. paramHsmp.Add("o4", ex);
  338. CoreClientParam ccp = new CoreClientParam();
  339. ccp.ServerName = "UIB.COM.ComDBProcedure";
  340. ccp.MethodName = "doXmlProcedure";
  341. ccp.ServerParams = new Object[] { "UIF042010.CMg_RollPlan_HCoil", paramHsmp };
  342. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  343. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  344. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  345. {
  346. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  347. }
  348. else
  349. {
  350. Get_RollPlan_List();
  351. Get_RollPlan_Info();
  352. ReSet_SelectRow(HCoil_ary);
  353. }
  354. }
  355. }
  356. catch (System.Exception ex)
  357. {
  358. System.Diagnostics.Debug.WriteLine(ex.ToString());
  359. }
  360. }
  361. private bool Check_Index_Order(string[] Index_)
  362. {
  363. try
  364. {
  365. if (Index_.Length < 2)
  366. return true;
  367. int value = 0;
  368. for (int i = 0; i < Index_.Length - 1; i++)
  369. {
  370. value = Common.FixDBManager.CheckNullInt(Index_[i + 1]) - Common.FixDBManager.CheckNullInt(Index_[i]);
  371. if (value > 1)
  372. {
  373. MessageBox.Show("所操作的基料卷的顺序不能跳跃");
  374. return false;
  375. }
  376. }
  377. return true;
  378. }
  379. catch (System.Exception ex)
  380. {
  381. System.Diagnostics.Debug.WriteLine(ex.ToString());
  382. return false;
  383. }
  384. }
  385. private string Get_Index_Min(string[] Index_)
  386. {
  387. string Index_Min = Index_[0];
  388. for (int i = 1; i < Index_.Length; i++)
  389. {
  390. if (Common.FixDBManager.CheckNullInt(Index_Min) > Common.FixDBManager.CheckNullInt(Index_[i]))
  391. {
  392. Index_Min = Index_[i];
  393. }
  394. }
  395. return Index_Min;
  396. }
  397. private string Get_Index_Max(string[] Index_)
  398. {
  399. string Index_Max = Index_[0];
  400. for (int i = 1; i < Index_.Length; i++)
  401. {
  402. if (Common.FixDBManager.CheckNullInt(Index_Max) < Common.FixDBManager.CheckNullInt(Index_[i]))
  403. {
  404. Index_Max = Index_[i];
  405. }
  406. }
  407. return Index_Max;
  408. }
  409. private void ReSet_SelectRow(System.Collections.ArrayList HCoil_ary)
  410. {
  411. try
  412. {
  413. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_RollPlan.Rows)
  414. {
  415. if (HCoil_ary.Contains(row.Cells["COIL_NO"].Value))
  416. {
  417. row.Selected = true;
  418. }
  419. }
  420. }
  421. catch (System.Exception ex)
  422. {
  423. System.Diagnostics.Debug.WriteLine(ex.ToString());
  424. }
  425. }
  426. #endregion
  427. #region "ToolBar Event"
  428. public override void ToolBar_Click(object sender, string ToolbarKey)
  429. {
  430. try
  431. {
  432. switch (ToolbarKey)
  433. {
  434. case "Query":
  435. string Condition = this.uiF042010_CTL1.Condition;
  436. Condition = Condition + " AND A.TOT_DEC_GRD IS NOT NULL ";
  437. this.dataSet1.Tables["TAB_HCOILINFO"].Clear();
  438. Query(Condition);
  439. break;
  440. case "Save":
  441. string RollNO = this.ugrd_RollInfo.Rows[0].Cells[1].Value.ToString();
  442. Save(RollNO);
  443. break;
  444. case "Exit":
  445. this.Close();
  446. break;
  447. }
  448. }
  449. catch (System.Exception ex)
  450. {
  451. System.Diagnostics.Debug.WriteLine(ex.ToString());
  452. }
  453. }
  454. /// <summary>
  455. /// 根据条件得到待选取的冷轧基料卷信息
  456. /// </summary>
  457. private void Query(string Condition)
  458. {
  459. try
  460. {
  461. CoreClientParam ccp = new CoreClientParam();
  462. ccp.ServerName = "UIF.UIF04.UIF042010";
  463. ccp.MethodName = "Query_HCoil_Info";
  464. ccp.ServerParams = new object[] { Condition };
  465. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  466. if (obj.ReturnInfo.Length == 0)
  467. {
  468. System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TAB_HCOILINFO"]);
  469. tab0.TableName = "TAB_HCOILINFO";
  470. this.dataSet1.Tables["TAB_HCOILINFO"].Merge(tab0);
  471. this.dataSet1.AcceptChanges();
  472. }
  473. }
  474. catch (System.Exception ex)
  475. {
  476. System.Diagnostics.Debug.WriteLine(ex.ToString());
  477. }
  478. }
  479. private void Save(string RollNO)
  480. {
  481. try
  482. {
  483. string chk_flag = "";
  484. if (this.CHK_CHEM.Checked)
  485. chk_flag = "1";
  486. else
  487. chk_flag = "0";
  488. if (this.CHK_PHY.Checked)
  489. chk_flag = chk_flag + "1";
  490. else
  491. chk_flag = chk_flag + "0";
  492. chk_flag=chk_flag + "000";
  493. string ex = "";
  494. string chk_ex = "";
  495. Hashtable paramHsmp = new Hashtable();
  496. paramHsmp.Add("i1", RollNO);
  497. paramHsmp.Add("i2", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  498. paramHsmp.Add("i3", chk_flag);
  499. paramHsmp.Add("o4", chk_ex);
  500. paramHsmp.Add("o5", ex);
  501. CoreClientParam ccp = new CoreClientParam();
  502. ccp.ServerName = "UIB.COM.ComDBProcedure";
  503. ccp.MethodName = "doXmlProcedure";
  504. ccp.ServerParams = new Object[] { "UIF042010.AFM_RollPlan", paramHsmp };
  505. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  506. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  507. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  508. {
  509. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  510. if (err.Count > 1 && Common.FixDBManager.CheckNullStr(err[1]) != "1")
  511. {
  512. string[] err_Coil = Common.FixDBManager.CheckNullStr(err[1]).Split('#');
  513. SetDataErrorRow(err_Coil);
  514. }
  515. }
  516. else
  517. {
  518. Get_RollPlan_List();
  519. Get_RollPlan_Info();
  520. }
  521. }
  522. catch (System.Exception ex)
  523. {
  524. System.Diagnostics.Debug.WriteLine(ex.ToString());
  525. }
  526. }
  527. private void SetDataErrorRow(string[] err_Coil)
  528. {
  529. try
  530. {
  531. System.Collections.Hashtable err_hsb = new Hashtable();
  532. foreach (string Coil in err_Coil)
  533. {
  534. if (Coil.Length > 2)
  535. {
  536. string err_no = Coil.Split(':')[0];
  537. string Coil_no = Coil.Split(':')[1];
  538. System.Collections.ArrayList err_list;
  539. if (err_hsb.Contains(Coil_no))
  540. {
  541. err_list = err_hsb[Coil_no] as System.Collections.ArrayList;
  542. err_list.Add(err_no);
  543. err_hsb[Coil_no] = err_list;
  544. }
  545. else
  546. {
  547. err_list = new ArrayList();
  548. err_list.Add(err_no);
  549. err_hsb.Add(Coil_no, err_list);
  550. }
  551. }
  552. }
  553. foreach (System.Data.DataRow row in this.dataSet1.Tables["TAB_ROLLPLAN"].Rows)
  554. {
  555. if (err_hsb.Contains(row["COIL_NO"].ToString()))
  556. {
  557. string err_Info = "";
  558. System.Collections.ArrayList err_lst = err_hsb[row["COIL_NO"].ToString()] as System.Collections.ArrayList;
  559. for (int i = 0; i < err_lst.Count; i++)
  560. {
  561. switch (err_lst[i].ToString())
  562. {
  563. case "10000":
  564. err_Info = err_Info + "基料卷成分不满足要求,不能确认计划" + "\n";
  565. break;
  566. case "01000":
  567. err_Info = err_Info + "基料卷性能不满足要求,不能确认计划" + "\n";
  568. break;
  569. }
  570. }
  571. row.SetColumnError(this.dataSet1.Tables["TAB_ROLLPLAN"].Columns["INDX_"], err_Info);
  572. }
  573. }
  574. }
  575. catch (System.Exception ex)
  576. {
  577. System.Diagnostics.Debug.WriteLine(ex.ToString());
  578. }
  579. }
  580. #endregion
  581. #region"Init"
  582. /// <summary>
  583. /// 窗体初始化事件
  584. /// 用于加载初始化数据
  585. /// </summary>
  586. /// <param name="sender"></param>
  587. /// <param name="e"></param>
  588. private void UIF0420101_Load(object sender, EventArgs e)
  589. {
  590. try
  591. {
  592. System.Windows.Forms.ToolTip tip = new ToolTip();
  593. tip.SetToolTip(this.btn_UP, "上移");
  594. tip.SetToolTip(this.btn_Down, "下移");
  595. tip.SetToolTip(this.btn_Merge, "合并基料卷");
  596. tip.SetToolTip(this.btn_Cancel, "取消基料卷合并");
  597. Get_RollPlan_List();
  598. Get_RollPlan_Info();
  599. Common.FixDBManager.SetGridCheckBox("FLAG", "TAB_HCOILINFO", 25, this.ugrd_HCoilInfo);
  600. string ColumnName = "";
  601. for (int i = 0; i < this.ugrd_HCoilInfo.DisplayLayout.Bands[0].Columns.Count; i++)
  602. {
  603. ColumnName = this.ugrd_HCoilInfo.DisplayLayout.Bands[0].Columns[i].Key;
  604. if (ColumnName == "FLAG")
  605. {
  606. Common.FixDBManager.SetCellActivation(ColumnName, "TAB_HCOILINFO", this.ugrd_HCoilInfo, "ALLOWEDIT");
  607. }
  608. else
  609. {
  610. Common.FixDBManager.SetCellActivation(ColumnName, "TAB_HCOILINFO", this.ugrd_HCoilInfo, "ACTIVATEONLY");
  611. }
  612. }
  613. this.ugrd_RollPlan.DisplayLayout.Override.SupportDataErrorInfo = Infragistics.Win.UltraWinGrid.SupportDataErrorInfo.RowsAndCells;
  614. }
  615. catch (System.Exception ex)
  616. {
  617. System.Diagnostics.Debug.WriteLine(ex.ToString());
  618. }
  619. }
  620. /// <summary>
  621. /// 获取已制定未确认的轧制计划信息
  622. /// </summary>
  623. private void Get_RollPlan_List()
  624. {
  625. try
  626. {
  627. CoreClientParam ccp = new CoreClientParam();
  628. ccp.ServerName = "UIF.UIF04.UIF042010";
  629. ccp.MethodName = "Query_RollPlan_List";
  630. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  631. if (obj.ReturnInfo.Length == 0)
  632. {
  633. this.dataSet1.Tables["TAB_ROLLPLAN"].Clear();
  634. System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TAB_ROLLPLAN"]);
  635. tab0.TableName = "TAB_ROLLPLAN";
  636. this.dataSet1.Tables["TAB_ROLLPLAN"].Merge(tab0);
  637. this.dataSet1.AcceptChanges();
  638. }
  639. }
  640. catch (System.Exception ex)
  641. {
  642. System.Diagnostics.Debug.WriteLine(ex.ToString());
  643. }
  644. }
  645. /// <summary>
  646. /// 获取已制定未确认的轧制计划描述信息
  647. /// </summary>
  648. private void Get_RollPlan_Info()
  649. {
  650. try
  651. {
  652. CoreClientParam ccp = new CoreClientParam();
  653. ccp.ServerName = "UIF.UIF04.UIF042010";
  654. ccp.MethodName = "Query_RollPlan_Info";
  655. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  656. if (obj.ReturnInfo.Length == 0)
  657. {
  658. this.dataSet1.Tables["TAB_ROLLINFO"].Clear();
  659. System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TAB_ROLLINFO"]);
  660. tab0.TableName = "TAB_ROLLINFO";
  661. this.dataSet1.Tables["TAB_ROLLINFO"].Merge(tab0);
  662. this.dataSet1.AcceptChanges();
  663. }
  664. }
  665. catch (System.Exception ex)
  666. {
  667. System.Diagnostics.Debug.WriteLine(ex.ToString());
  668. }
  669. }
  670. #endregion
  671. #region "Grid Event"
  672. private void ugrd_HCoilInfo_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  673. {
  674. try
  675. {
  676. this.ugrd_HCoilInfo.UpdateData();
  677. if (e.Cell.Column.Key == "FLAG")
  678. {
  679. if (e.Cell.Value.ToString().ToUpper() == "TRUE")
  680. {
  681. e.Cell.Row.Appearance.BackColor = System.Drawing.Color.LightSteelBlue;
  682. }
  683. else
  684. {
  685. e.Cell.Row.Appearance.BackColor = System.Drawing.Color.White;
  686. }
  687. }
  688. }
  689. catch (System.Exception ex)
  690. {
  691. System.Diagnostics.Debug.WriteLine(ex.ToString());
  692. }
  693. }
  694. private void ugrd_HCoilInfo_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  695. {
  696. try
  697. {
  698. if (this.ugrd_HCoilInfo.ActiveRow != null)
  699. {
  700. Core.LZMes.Client.UIB.UIB010301 frm = new Core.LZMes.Client.UIB.UIB010301();
  701. frm.ob = this.ob;
  702. frm.OrderNO = Common.FixDBManager.CheckNullStr(this.ugrd_HCoilInfo.ActiveRow.Cells["ORD_NO"].Value);
  703. frm.OrderSEQ = Common.FixDBManager.CheckNullStr(this.ugrd_HCoilInfo.ActiveRow.Cells["ORD_SEQ"].Value); ;
  704. frm.ShowDialog();
  705. }
  706. }
  707. catch (System.Exception ex)
  708. {
  709. System.Diagnostics.Debug.WriteLine(ex.ToString());
  710. }
  711. }
  712. private void ugrd_HCoilInfo_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
  713. {
  714. //try
  715. //{
  716. // if (e.Cell.Column.Key == "ORD_NO" | e.Cell.Column.Key == "ORD_SEQ")
  717. // {
  718. // Core.LZMes.Client.UIB.UIB010301 frm = new Core.LZMes.Client.UIB.UIB010301();
  719. // frm.ob = this.ob;
  720. // frm.OrderNO = Common.FixDBManager.CheckNullStr(this.ugrd_HCoilInfo.ActiveRow.Cells["ORD_NO"].Value);
  721. // frm.OrderSEQ = Common.FixDBManager.CheckNullStr(this.ugrd_HCoilInfo.ActiveRow.Cells["ORD_SEQ"].Value); ;
  722. // frm.ShowDialog();
  723. // }
  724. //}
  725. //catch (System.Exception ex)
  726. //{
  727. // System.Diagnostics.Debug.WriteLine(ex.ToString());
  728. //}
  729. }
  730. #endregion
  731. private void ugrd_HCoilInfo_AfterCellActivate(object sender, EventArgs e)
  732. {
  733. Infragistics.Win.UltraWinGrid.UltraGrid tt = (Infragistics.Win.UltraWinGrid.UltraGrid)sender;
  734. string clickColumnID = Convert.ToString(Common.FixDBManager.CheckNullStr(tt.ActiveCell.Column.Key));
  735. if (!(clickColumnID.Equals("ORD_NO") || clickColumnID.Equals("ORD_SEQ") || clickColumnID.Equals("CUST_CD")))
  736. {
  737. return;
  738. }
  739. string clickNO = Convert.ToString(Common.FixDBManager.CheckNullStr(tt.ActiveRow.Cells["ORD_NO"].Value));
  740. string clickSeq = Convert.ToString(Common.FixDBManager.CheckNullStr(tt.ActiveRow.Cells["ORD_SEQ"].Value));
  741. if (clickNO == null || clickNO == "") return;
  742. if (clickSeq == null || clickSeq == "") return;
  743. if (clickColumnID.Equals("ORD_NO"))
  744. {
  745. Core.LZMes.Client.UIE.UIE041050 frm = new UIE041050();
  746. frm.ob = this.ob;
  747. frm.Condition = clickNO + "|" + clickSeq;
  748. frm.ShowDialog();
  749. }
  750. else if (clickColumnID.Equals("ORD_SEQ"))
  751. {
  752. Core.LZMes.Client.UIE.UIE041080 frm = new UIE041080();
  753. frm.ob = this.ob;
  754. frm.Condition = clickNO + "|" + clickSeq;
  755. frm.ShowDialog();
  756. }
  757. else if (clickColumnID.Equals("CUST_CD"))
  758. {
  759. try
  760. {
  761. if (this.ugrd_HCoilInfo.ActiveRow != null)
  762. {
  763. Core.LZMes.Client.UIB.UIB010301 frm = new Core.LZMes.Client.UIB.UIB010301();
  764. frm.ob = this.ob;
  765. frm.OrderNO = Common.FixDBManager.CheckNullStr(this.ugrd_HCoilInfo.ActiveRow.Cells["ORD_NO"].Value);
  766. frm.OrderSEQ = Common.FixDBManager.CheckNullStr(this.ugrd_HCoilInfo.ActiveRow.Cells["ORD_SEQ"].Value); ;
  767. frm.ShowDialog();
  768. }
  769. }
  770. catch (System.Exception ex)
  771. {
  772. System.Diagnostics.Debug.WriteLine(ex.ToString());
  773. }
  774. }
  775. else
  776. {
  777. return;
  778. }
  779. }
  780. }
  781. }