UIF052010.cs 35 KB

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