39e84b7ad2e6250c31d79561132a55b32a0d7ef7.svn-base 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823
  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 UIF052040 : CoreFS.CA06.FrmBase
  15. {
  16. public UIF052040()
  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. /*
  201. string Condition = GetCondition(where);
  202. CoreClientParam ccp = new CoreClientParam();
  203. ccp.ServerName = "UIF.UIF05.UIF052010";
  204. ccp.MethodName = "Query_CAL_Coil";
  205. ccp.ServerParams = new object[] { Condition };
  206. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  207. if (obj.ReturnInfo.Length == 0)
  208. {
  209. System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TAB_CCOILLIST"]);
  210. tab0.TableName = "TAB_CCOILLIST";
  211. this.dataSet1.Tables["TAB_CCOILLIST"].Merge(tab0);
  212. this.dataSet1.AcceptChanges();
  213. }
  214. */
  215. this.dataSet1.Tables[0].Clear();
  216. ArrayList arrayParam = new ArrayList();
  217. arrayParam.Add("UIF052040_01.SELECT");
  218. CoreClientParam ccp = new CoreClientParam();
  219. ccp.ServerName = "UIB.COM.ComDBQuery";
  220. ccp.MethodName = "doSimpleQuery";
  221. ccp.ServerParams = new object[] { arrayParam };
  222. //ccp.SourceDataTable = this.dataSet1.Tables["TAB_CCOILLIST"];
  223. //this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  224. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  225. if (obj.ReturnInfo.Length == 0)
  226. {
  227. System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TAB_CCOILLIST"]);
  228. tab0.TableName = "TAB_CCOILLIST";
  229. this.dataSet1.Tables["TAB_CCOILLIST"].Merge(tab0);
  230. this.dataSet1.AcceptChanges();
  231. }
  232. }
  233. catch (System.Exception ex)
  234. {
  235. System.Diagnostics.Debug.WriteLine(ex.ToString());
  236. }
  237. }
  238. private void Add()
  239. {
  240. try
  241. {
  242. this.ugrd_CoilList.UpdateData();
  243. System.Data.DataRow[] rows = this.dataSet1.Tables["TAB_CCOILLIST"].Select("FLAG='TRUE'");
  244. if (rows.Length == 0)
  245. {
  246. MessageBox.Show("您还未选择酸轧卷,请选择");
  247. return;
  248. }
  249. string CoilNOS = "";
  250. string ex = "";
  251. for (int i = 0; i < this.ugrd_CoilList.Rows.Count; i++)
  252. {
  253. if (Common.FixDBManager.CheckNullStr(ugrd_CoilList.Rows[i].Cells["FLAG"].Value).ToUpper() == "TRUE")
  254. {
  255. CoilNOS = CoilNOS + ugrd_CoilList.Rows[i].Cells["COIL_NO"].Value.ToString() + ";";
  256. }
  257. }
  258. CoilNOS = CoilNOS.Substring(0, CoilNOS.Length - 1);
  259. string paras = "";
  260. if (Common.FixDBManager.CheckNullStr(this.Cmb_Sleeve.Value).Length>0)
  261. paras = Common.FixDBManager.CheckNullStr(this.Cmb_Sleeve.Value);
  262. if (Common.FixDBManager.CheckNullStr(this.Cmb_SPMMode.Value).Length > 0)
  263. paras = paras + ";" + Common.FixDBManager.CheckNullStr(this.Cmb_SPMMode.Value);
  264. else
  265. {
  266. MessageBox.Show("请选择平整模式!");
  267. Cmb_SPMMode.Focus();
  268. return;
  269. }
  270. if (Common.FixDBManager.CheckNullStr(this.Cmb_SPM_WET.Value).Length > 0)
  271. paras = paras + ";" + Common.FixDBManager.CheckNullStr(this.Cmb_SPM_WET.Value);
  272. else
  273. {
  274. MessageBox.Show("请选择湿平标识!");
  275. Cmb_SPM_WET.Focus();
  276. return;
  277. }
  278. if (Common.FixDBManager.CheckNullStr(this.Cmb_Pull.Value).Length > 0)
  279. paras = paras + ";" + Common.FixDBManager.CheckNullStr(this.Cmb_Pull.Value);
  280. else
  281. {
  282. MessageBox.Show("请选择是否拉矫!");
  283. Cmb_Pull.Focus();
  284. return;
  285. }
  286. paras = paras + ";" + this.txt_CALMemo.Text;
  287. string paran = "5";
  288. Hashtable paramHsmp = new Hashtable();
  289. paramHsmp.Add("i1", CoilNOS);
  290. paramHsmp.Add("i2", rows.Length.ToString());
  291. paramHsmp.Add("i3", paras);
  292. paramHsmp.Add("i4", paran);
  293. paramHsmp.Add("o5", ex);
  294. CoreClientParam ccp = new CoreClientParam();
  295. ccp.ServerName = "UIB.COM.ComDBProcedure";
  296. ccp.MethodName = "doXmlProcedure";
  297. ccp.ServerParams = new Object[] { "UIF052010.Add_CalPlan_LT", paramHsmp };
  298. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  299. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  300. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  301. {
  302. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  303. }
  304. else
  305. {
  306. Get_CALPlan_Info();
  307. Get_CALPlan_List();
  308. for (int i = rows.Length - 1; i >= 0; i--)
  309. {
  310. this.dataSet1.Tables["TAB_CCOILLIST"].Rows.Remove(rows[i]);
  311. }
  312. this.dataSet1.Tables["TAB_CCOILLIST"].AcceptChanges();
  313. }
  314. }
  315. catch (System.Exception ex)
  316. {
  317. System.Diagnostics.Debug.WriteLine(ex.ToString());
  318. }
  319. }
  320. private void Delete()
  321. {
  322. try
  323. {
  324. if (this.ugrd_CalList.Selected.Rows.Count == 0)
  325. {
  326. MessageBox.Show("请选择您要移除的记录");
  327. return;
  328. }
  329. string RollNO = this.ugrd_CalList.Rows[0].Cells["CAL_NO"].Value.ToString();
  330. string CoilNOS = "";
  331. string Condition = "";
  332. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_CalList.Selected.Rows)
  333. {
  334. CoilNOS = CoilNOS + Common.FixDBManager.CheckNullStr(row.Cells["C_COIL_NO"].Value) + ";";
  335. Condition = Condition + "'" + Common.FixDBManager.CheckNullStr(row.Cells["C_COIL_NO"].Value) + "',";
  336. }
  337. CoilNOS = CoilNOS.Substring(0, CoilNOS.Length - 1);
  338. Condition = Condition.Substring(0, Condition.Length - 1);
  339. Condition = " AND A.COIL_NO IN(" + Condition + ") ";
  340. Hashtable paramHsmp = new Hashtable();
  341. paramHsmp.Add("i1", RollNO);
  342. paramHsmp.Add("i2", CoilNOS);
  343. paramHsmp.Add("i3", this.ugrd_CalList.Selected.Rows.Count.ToString());
  344. CoreClientParam ccp = new CoreClientParam();
  345. ccp.ServerName = "UIB.COM.ComDBProcedure";
  346. ccp.MethodName = "doXmlProcedure";
  347. ccp.ServerParams = new Object[] { "UIF052010.Del_CalPlan", paramHsmp };
  348. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  349. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  350. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  351. {
  352. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  353. }
  354. else
  355. {
  356. Get_CALPlan_Info();
  357. Get_CALPlan_List();
  358. Query(Condition);
  359. }
  360. }
  361. catch (System.Exception ex)
  362. {
  363. System.Diagnostics.Debug.WriteLine(ex.ToString());
  364. }
  365. }
  366. private void Up()
  367. {
  368. try
  369. {
  370. if (this.ugrd_CalList.Selected.Rows.Count == 0)
  371. {
  372. MessageBox.Show("请确定您要前移的酸轧卷");
  373. return;
  374. }
  375. string ex = "";
  376. string Index_ = "";
  377. string RollNO = this.ugrd_CalList.Rows[0].Cells["CAL_NO"].Value.ToString();
  378. System.Collections.ArrayList HCoil_ary = new ArrayList();
  379. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_CalList.Selected.Rows)
  380. {
  381. Index_ = Index_ + Common.FixDBManager.CheckNullStr(row.Cells["COIL_EDT_SEQ"].Value) + ";";
  382. HCoil_ary.Add(row.Cells["C_COIL_NO"].Value);
  383. }
  384. Index_ = Index_.Substring(0, Index_.Length - 1);
  385. string[] Indexs_ = Index_.Split(';');
  386. if (Check_Index_Order(Indexs_))
  387. {
  388. Hashtable paramHsmp = new Hashtable();
  389. paramHsmp.Add("i1", RollNO);
  390. paramHsmp.Add("i2", this.ugrd_CalList.Selected.Rows.Count.ToString());
  391. paramHsmp.Add("i3", Get_Index_Min(Indexs_));
  392. paramHsmp.Add("i4", Get_Index_Max(Indexs_));
  393. paramHsmp.Add("i5", "-1");
  394. paramHsmp.Add("o6", ex);
  395. CoreClientParam ccp = new CoreClientParam();
  396. ccp.ServerName = "UIB.COM.ComDBProcedure";
  397. ccp.MethodName = "doXmlProcedure";
  398. ccp.ServerParams = new Object[] { "UIF052010.Adj_CalPlan", paramHsmp };
  399. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  400. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  401. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  402. {
  403. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  404. }
  405. else
  406. {
  407. Get_CALPlan_Info();
  408. Get_CALPlan_List();
  409. ReSet_SelectRow(HCoil_ary);
  410. }
  411. }
  412. }
  413. catch (System.Exception ex)
  414. {
  415. System.Diagnostics.Debug.WriteLine(ex.ToString());
  416. }
  417. }
  418. private void Down()
  419. {
  420. try
  421. {
  422. if (this.ugrd_CalList.Selected.Rows.Count == 0)
  423. {
  424. MessageBox.Show("请确定您要前移的酸轧卷");
  425. return;
  426. }
  427. string ex = "";
  428. string Index_ = "";
  429. string RollNO = this.ugrd_CalList.Rows[0].Cells["CAL_NO"].Value.ToString();
  430. System.Collections.ArrayList HCoil_ary = new ArrayList();
  431. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_CalList.Selected.Rows)
  432. {
  433. Index_ = Index_ + Common.FixDBManager.CheckNullStr(row.Cells["COIL_EDT_SEQ"].Value) + ";";
  434. HCoil_ary.Add(row.Cells["C_COIL_NO"].Value);
  435. }
  436. Index_ = Index_.Substring(0, Index_.Length - 1);
  437. string[] Indexs_ = Index_.Split(';');
  438. if (Check_Index_Order(Indexs_))
  439. {
  440. Hashtable paramHsmp = new Hashtable();
  441. paramHsmp.Add("i1", RollNO);
  442. paramHsmp.Add("i2", this.ugrd_CalList.Selected.Rows.Count.ToString());
  443. paramHsmp.Add("i3", Get_Index_Min(Indexs_));
  444. paramHsmp.Add("i4", Get_Index_Max(Indexs_));
  445. paramHsmp.Add("i5", "1");
  446. paramHsmp.Add("o6", ex);
  447. CoreClientParam ccp = new CoreClientParam();
  448. ccp.ServerName = "UIB.COM.ComDBProcedure";
  449. ccp.MethodName = "doXmlProcedure";
  450. ccp.ServerParams = new Object[] { "UIF052010.Adj_CalPlan", paramHsmp };
  451. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  452. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  453. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  454. {
  455. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  456. }
  457. else
  458. {
  459. Get_CALPlan_Info();
  460. Get_CALPlan_List();
  461. ReSet_SelectRow(HCoil_ary);
  462. }
  463. }
  464. }
  465. catch (System.Exception ex)
  466. {
  467. System.Diagnostics.Debug.WriteLine(ex.ToString());
  468. }
  469. }
  470. private void Save()
  471. {
  472. try
  473. {
  474. string chk_flag = "00000";
  475. string RollNO = this.ugrd_CalList.Rows[0].Cells["CAL_NO"].Value.ToString();
  476. //if (this.CHK_CHEM.Checked)
  477. // chk_flag = "1";
  478. //else
  479. // chk_flag = "0";
  480. //if (this.CHK_PHY.Checked)
  481. // chk_flag = chk_flag + "1";
  482. //else
  483. // chk_flag = chk_flag + "0";
  484. //chk_flag=chk_flag + "000";
  485. string ex = "";
  486. string chk_ex = "";
  487. Hashtable paramHsmp = new Hashtable();
  488. paramHsmp.Add("i1", RollNO);
  489. paramHsmp.Add("i2", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  490. paramHsmp.Add("i3", chk_flag);
  491. paramHsmp.Add("o4", chk_ex);
  492. paramHsmp.Add("o5", ex);
  493. CoreClientParam ccp = new CoreClientParam();
  494. ccp.ServerName = "UIB.COM.ComDBProcedure";
  495. ccp.MethodName = "doXmlProcedure";
  496. ccp.ServerParams = new Object[] { "UIF052010.Affirm_CalPlan", paramHsmp };
  497. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  498. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  499. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  500. {
  501. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  502. if (err.Count > 1 && Common.FixDBManager.CheckNullStr(err[1]) != "1")
  503. {
  504. string[] err_Coil = Common.FixDBManager.CheckNullStr(err[1]).Split('#');
  505. SetDataErrorRow(err_Coil);
  506. }
  507. }
  508. else
  509. {
  510. Get_CALPlan_Info();
  511. Get_CALPlan_List();
  512. }
  513. }
  514. catch (System.Exception ex)
  515. {
  516. System.Diagnostics.Debug.WriteLine(ex.ToString());
  517. }
  518. }
  519. private void Merge()
  520. {
  521. try
  522. {
  523. if (this.ugrd_CalList.Selected.Rows.Count == 0)
  524. {
  525. MessageBox.Show("请确定您要并卷的酸轧卷");
  526. return;
  527. }
  528. string Index_ = "";
  529. string HCoilNOS = "";
  530. string ex = "";
  531. string RollNO = this.ugrd_CalList.Rows[0].Cells["CAL_NO"].Value.ToString();
  532. System.Collections.ArrayList HCoil_ary = new ArrayList();
  533. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_CalList.Selected.Rows)
  534. {
  535. Index_ = Index_ + Common.FixDBManager.CheckNullStr(row.Cells["COIL_EDT_SEQ"].Value) + ";";
  536. HCoilNOS = HCoilNOS + Common.FixDBManager.CheckNullStr(row.Cells["C_COIL_NO"].Value) + ";";
  537. HCoil_ary.Add(row.Cells["C_COIL_NO"].Value);
  538. }
  539. Index_ = Index_.Substring(0, Index_.Length - 1);
  540. string[] Indexs_ = Index_.Split(';');
  541. if (Check_Index_Order(Indexs_))
  542. {
  543. Hashtable paramHsmp = new Hashtable();
  544. paramHsmp.Add("i1", RollNO);
  545. paramHsmp.Add("i2", this.ugrd_CalList.Selected.Rows.Count.ToString());
  546. paramHsmp.Add("i3", HCoilNOS);
  547. paramHsmp.Add("o4", ex);
  548. CoreClientParam ccp = new CoreClientParam();
  549. ccp.ServerName = "UIB.COM.ComDBProcedure";
  550. ccp.MethodName = "doXmlProcedure";
  551. ccp.ServerParams = new Object[] { "UIF052010.Merge_CalPlan", paramHsmp };
  552. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  553. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  554. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  555. {
  556. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  557. }
  558. else
  559. {
  560. Get_CALPlan_Info();
  561. Get_CALPlan_List();
  562. ReSet_SelectRow(HCoil_ary);
  563. }
  564. }
  565. }
  566. catch (System.Exception ex)
  567. {
  568. System.Diagnostics.Debug.WriteLine(ex.ToString());
  569. }
  570. }
  571. private void CMerge()
  572. {
  573. try
  574. {
  575. if (this.ugrd_CalList.Selected.Rows.Count == 0)
  576. {
  577. MessageBox.Show("请确定您要并卷的基料卷");
  578. return;
  579. }
  580. string Index_ = "";
  581. string HCoilNOS = "";
  582. string RollNO = this.ugrd_CalList.Rows[0].Cells["CAL_NO"].Value.ToString();
  583. System.Collections.ArrayList HCoil_ary = new ArrayList();
  584. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_CalList.Selected.Rows)
  585. {
  586. Index_ = Index_ + Common.FixDBManager.CheckNullStr(row.Cells["COIL_EDT_SEQ"].Value) + ";";
  587. HCoilNOS = HCoilNOS + Common.FixDBManager.CheckNullStr(row.Cells["C_COIL_NO"].Value) + ";";
  588. HCoil_ary.Add(row.Cells["C_COIL_NO"].Value);
  589. }
  590. Index_ = Index_.Substring(0, Index_.Length - 1);
  591. string[] Indexs_ = Index_.Split(';');
  592. string ex = "";
  593. if (Check_Index_Order(Indexs_))
  594. {
  595. Hashtable paramHsmp = new Hashtable();
  596. paramHsmp.Add("i1", RollNO);
  597. paramHsmp.Add("i2", this.ugrd_CalList.Selected.Rows.Count.ToString());
  598. paramHsmp.Add("i3", HCoilNOS);
  599. paramHsmp.Add("o4", ex);
  600. CoreClientParam ccp = new CoreClientParam();
  601. ccp.ServerName = "UIB.COM.ComDBProcedure";
  602. ccp.MethodName = "doXmlProcedure";
  603. ccp.ServerParams = new Object[] { "UIF052010.CMerge_CalPlan", paramHsmp };
  604. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  605. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  606. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  607. {
  608. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  609. }
  610. else
  611. {
  612. Get_CALPlan_Info();
  613. Get_CALPlan_List();
  614. ReSet_SelectRow(HCoil_ary);
  615. }
  616. }
  617. }
  618. catch (System.Exception ex)
  619. {
  620. System.Diagnostics.Debug.WriteLine(ex.ToString());
  621. }
  622. }
  623. private string GetCondition(string InitCondition)
  624. {
  625. try
  626. {
  627. if (InitCondition.Length > 0)
  628. return InitCondition;
  629. string Condition = "";
  630. string tmp = "";
  631. if (FixDBManager.CheckNullStr(this.Cmb_BM.Text).Length > 0)
  632. {
  633. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.Cmb_BM.CheckedRows)
  634. {
  635. tmp += "'" + row.Cells["SM_CD"].Value.ToString() + "',";
  636. }
  637. tmp = tmp.Substring(0, tmp.Length - 1);
  638. Condition += " AND B.C_EXTSHAPE_REQ IN(" + tmp + ") ";
  639. }
  640. if (FixDBManager.CheckNullStr(this.Cmb_PM.Text).Length > 0)
  641. {
  642. tmp = "";
  643. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.Cmb_PM.CheckedRows)
  644. {
  645. tmp += "'" + row.Cells["SM_CD"].Value.ToString() + "',";
  646. }
  647. tmp = tmp.Substring(0, tmp.Length - 1);
  648. Condition += " AND B.PRODNM_CD IN(" + tmp + ") ";
  649. }
  650. string[] height = txt_Height.Text.Split('~');
  651. string min_height = height[0].Replace(" ", "");
  652. min_height = min_height == "." ? "0" : min_height;
  653. string max_height = height[1].Replace(" ", "");
  654. max_height = max_height == "." ? "99" : max_height;
  655. Condition += " AND B.C_ORD_THK BETWEEN " + min_height + " AND " + max_height;
  656. string[] width = txt_Width.Text.Split('~');
  657. string min_width = width[0].Replace(" ", "").Length == 0 ? "0" : width[0];
  658. string max_width = width[1].Replace(" ", "").Length == 0 ? "1500" : width[1];
  659. Condition += " AND B.C_ORD_WTH BETWEEN " + min_width + " AND " + max_width;
  660. string[] senddate = mtx_SendDate.Text.Split('~');
  661. string min_senddate = senddate[0].Replace(" ", "") == "--" ? "2010-01-01" : senddate[0];
  662. string max_senddate = senddate[1].Replace(" ", "") == "--" ? "2099-01-01" : senddate[1];
  663. Condition += " AND B.DEL_TO_DATE BETWEEN TO_CHAR(TO_DATE('" + min_senddate + "','YYYY-MM-DD'),'YYYYMMDD') "
  664. + " AND TO_CHAR(TO_DATE('" + max_senddate + "','YYYY-MM-DD'),'YYYYMMDD') ";
  665. return Condition;
  666. }
  667. catch (System.Exception ex)
  668. {
  669. System.Diagnostics.Debug.WriteLine(ex.ToString());
  670. return "";
  671. }
  672. }
  673. private bool Check_Index_Order(string[] Index_)
  674. {
  675. try
  676. {
  677. if (Index_.Length < 2)
  678. return true;
  679. int value = 0;
  680. for (int i = 0; i < Index_.Length - 1; i++)
  681. {
  682. value = Common.FixDBManager.CheckNullInt(Index_[i + 1]) - Common.FixDBManager.CheckNullInt(Index_[i]);
  683. if (value > 1)
  684. {
  685. MessageBox.Show("所操作的酸轧卷的顺序不能跳跃");
  686. return false;
  687. }
  688. }
  689. return true;
  690. }
  691. catch (System.Exception ex)
  692. {
  693. System.Diagnostics.Debug.WriteLine(ex.ToString());
  694. return false;
  695. }
  696. }
  697. private string Get_Index_Min(string[] Index_)
  698. {
  699. string Index_Min = Index_[0];
  700. for (int i = 1; i < Index_.Length; i++)
  701. {
  702. if (Common.FixDBManager.CheckNullInt(Index_Min) > Common.FixDBManager.CheckNullInt(Index_[i]))
  703. {
  704. Index_Min = Index_[i];
  705. }
  706. }
  707. return Index_Min;
  708. }
  709. private string Get_Index_Max(string[] Index_)
  710. {
  711. string Index_Max = Index_[0];
  712. for (int i = 1; i < Index_.Length; i++)
  713. {
  714. if (Common.FixDBManager.CheckNullInt(Index_Max) < Common.FixDBManager.CheckNullInt(Index_[i]))
  715. {
  716. Index_Max = Index_[i];
  717. }
  718. }
  719. return Index_Max;
  720. }
  721. private void ReSet_SelectRow(System.Collections.ArrayList HCoil_ary)
  722. {
  723. try
  724. {
  725. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_CalList.Rows)
  726. {
  727. if (HCoil_ary.Contains(row.Cells["C_COIL_NO"].Value))
  728. {
  729. row.Selected = true;
  730. }
  731. }
  732. }
  733. catch (System.Exception ex)
  734. {
  735. System.Diagnostics.Debug.WriteLine(ex.ToString());
  736. }
  737. }
  738. private void SetDataErrorRow(string[] err_Coil)
  739. {
  740. try
  741. {
  742. System.Collections.Hashtable err_hsb = new Hashtable();
  743. foreach (string Coil in err_Coil)
  744. {
  745. if (Coil.Length > 2)
  746. {
  747. string err_no = Coil.Split(':')[0];
  748. string Coil_no = Coil.Split(':')[1];
  749. System.Collections.ArrayList err_list;
  750. if (err_hsb.Contains(Coil_no))
  751. {
  752. err_list = err_hsb[Coil_no] as System.Collections.ArrayList;
  753. err_list.Add(err_no);
  754. err_hsb[Coil_no] = err_list;
  755. }
  756. else
  757. {
  758. err_list = new ArrayList();
  759. err_list.Add(err_no);
  760. err_hsb.Add(Coil_no, err_list);
  761. }
  762. }
  763. }
  764. foreach (System.Data.DataRow row in this.dataSet1.Tables["TAB_CALLIST"].Rows)
  765. {
  766. if (err_hsb.Contains(row["C_COIL_NO"].ToString()))
  767. {
  768. string err_Info = "";
  769. System.Collections.ArrayList err_lst = err_hsb[row["C_COIL_NO"].ToString()] as System.Collections.ArrayList;
  770. for (int i = 0; i < err_lst.Count; i++)
  771. {
  772. switch (err_lst[i].ToString())
  773. {
  774. case "10000":
  775. err_Info = err_Info + "基料卷成分不满足要求,不能确认计划" + "\n";
  776. break;
  777. case "01000":
  778. err_Info = err_Info + "基料卷性能不满足要求,不能确认计划" + "\n";
  779. break;
  780. }
  781. }
  782. row.SetColumnError(this.dataSet1.Tables["TAB_CALLIST"].Columns["COIL_EDT_SEQ"], err_Info);
  783. }
  784. }
  785. }
  786. catch (System.Exception ex)
  787. {
  788. System.Diagnostics.Debug.WriteLine(ex.ToString());
  789. }
  790. }
  791. #endregion
  792. }
  793. }