UIF061010.cs 34 KB

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