eceb273c0e6f7d37565b08d78f80432cf21987d5.svn-base 34 KB

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