UIF052010.cs 36 KB

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