UIF0420101.cs 35 KB

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