UIF071030.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  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. namespace Core.LZMes.Client.UIF.UIF07
  12. {
  13. public partial class UIF071030 : FrmBase
  14. {
  15. public UIF071030()
  16. {
  17. InitializeComponent();
  18. }
  19. #region "TooBar Event"
  20. public override void ToolBar_Click(object sender, string ToolbarKey)
  21. {
  22. switch (ToolbarKey)
  23. {
  24. case "Query":
  25. this.DoQuery("");
  26. break;
  27. case "Delete":
  28. this.DoDelete();
  29. break;
  30. case "Exit":
  31. this.Close();
  32. break;
  33. }
  34. }
  35. private void DoQuery(string Condition)
  36. {
  37. try
  38. {
  39. ArrayList al = new ArrayList();
  40. al.Add("UIF071030.Query_PkgPlan");
  41. this.dataSet1.Tables[0].Clear();
  42. CoreClientParam ccp = new CoreClientParam();
  43. ccp.ServerName = "UIB.COM.ComDBQuery";
  44. ccp.MethodName = "doSimpleQuery";
  45. ccp.ServerParams = new object[] { al };
  46. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  47. if (obj.ReturnInfo.Length == 0)
  48. {
  49. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["L_TBF03_SPEC_PACK"]);
  50. tab0.TableName = "L_TBF03_SPEC_PACK";
  51. this.dataSet1.Tables["L_TBF03_SPEC_PACK"].Merge(tab0);
  52. this.dataSet1.AcceptChanges();
  53. };
  54. getRectange();
  55. }
  56. catch (Exception EX)
  57. {
  58. MessageBox.Show(EX.ToString());
  59. }
  60. }
  61. private void DoDelete()
  62. {
  63. try
  64. {
  65. this.ugrd_RollPlan.UpdateData();
  66. if (this.ugrd_RollPlan.Selected.Rows.Count == 0)
  67. {
  68. MessageBox.Show("请选择您要移除的记录");
  69. return;
  70. }
  71. System.Windows.Forms.DialogResult rt = MessageBox.Show("是否确认删除所选包装单元计划?", Common.FixDBManager.MsgCaption, MessageBoxButtons.YesNo);
  72. if (rt == DialogResult.No)
  73. {
  74. return;
  75. }
  76. string CoilNOS = "";
  77. string pkgNO = "";
  78. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_RollPlan.Selected.Rows)
  79. {
  80. CoilNOS = CoilNOS + Common.FixDBManager.CheckNullStr(row.Cells["COIL_NO"].Value) + ";";
  81. if (pkgNO == "")
  82. {
  83. pkgNO = Common.FixDBManager.CheckNullStr(row.Cells["PKG_NO"].Value);
  84. }
  85. }
  86. CoilNOS = CoilNOS.Substring(0, CoilNOS.Length - 1);
  87. string Ex = "";
  88. Hashtable paramHsmp = new Hashtable();
  89. paramHsmp.Add("i1", pkgNO);
  90. paramHsmp.Add("i2", CoilNOS);
  91. paramHsmp.Add("i3", ugrd_RollPlan.Selected.Rows.Count);
  92. paramHsmp.Add("o4", Ex);
  93. CoreClientParam ccp = new CoreClientParam();
  94. ccp.ServerName = "UIB.COM.ComDBProcedure";
  95. ccp.MethodName = "doXmlProcedure";
  96. ccp.ServerParams = new Object[] { "UIF071030.Del_PkgCoil", paramHsmp };
  97. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  98. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  99. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  100. {
  101. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  102. }
  103. else
  104. {
  105. DoQuery("");
  106. }
  107. }
  108. catch (Exception EX)
  109. {
  110. MessageBox.Show(EX.ToString());
  111. }
  112. }
  113. #endregion
  114. #region "Rectange"
  115. //设定基料最大高度
  116. //private int Max_Height = 81;
  117. //基料卷展示的宽度
  118. private int width = 9;
  119. private int locy = 10;
  120. //宽度X坐标(第一个基料卷)
  121. private int locx1 = 0;
  122. //厚度X坐标(第一个基料卷)
  123. private int locx2 = 0;
  124. //轧制单元X坐标(第一个单元)
  125. private int locx_roll = 0;
  126. //轧制单元Y坐标
  127. private int locy_roll = 81;
  128. //轧制单元高度
  129. private int roll_height = 22;
  130. //Coil Tip
  131. System.Windows.Forms.ToolTip Coil_Tip = new ToolTip();
  132. //背景颜色配色
  133. Infragistics.Win.Appearance appearance = new Infragistics.Win.Appearance();
  134. private void getRectange()
  135. {
  136. try
  137. {
  138. locx1 = locx2 = locx_roll = 0;
  139. System.Int16 wth;
  140. double thk;
  141. string coilNO;
  142. string pkgNo = "";
  143. int rollCoilCnt = 0;
  144. int totalCnt = 0;
  145. this.pal_Rectange.Controls.Clear();
  146. Coil_Tip.RemoveAll();
  147. foreach (DataRow row in this.dataSet1.Tables["L_TBF03_SPEC_PACK"].Rows)
  148. {
  149. wth = Convert.ToInt16(row["COIL_WTH"]);
  150. thk = Convert.ToDouble(row["COIL_THK"]);
  151. coilNO = Convert.ToString(row["COIL_NO"]);
  152. string tempPkgNo = Convert.ToString(row["PKG_NO"]);
  153. if (pkgNo != "" && pkgNo != tempPkgNo)
  154. {
  155. getRollRectange(totalCnt, rollCoilCnt, pkgNo);
  156. rollCoilCnt = 1;
  157. }
  158. else
  159. {
  160. rollCoilCnt += 1;
  161. totalCnt += 1;
  162. }
  163. pkgNo = tempPkgNo;
  164. getWidthRectange(row);
  165. getThkRectange(row);
  166. }
  167. getRollRectange(totalCnt, rollCoilCnt, pkgNo);
  168. }
  169. catch (System.Exception ex)
  170. {
  171. System.Diagnostics.Debug.WriteLine(ex.ToString());
  172. }
  173. }
  174. private void getRollRectange(int totalCnt, int rollCnt, string rollNO)
  175. {
  176. System.Windows.Forms.Label lab_roll = new Label();
  177. lab_roll.AutoSize = false;
  178. lab_roll.TextAlign = ContentAlignment.MiddleCenter;
  179. lab_roll.BackColor = System.Drawing.Color.White;
  180. lab_roll.BorderStyle = BorderStyle.FixedSingle;
  181. this.pal_Rectange.Controls.Add(lab_roll);
  182. lab_roll.Location = new System.Drawing.Point(locx_roll, locy_roll);
  183. lab_roll.Name = rollNO;
  184. lab_roll.Size = new System.Drawing.Size(rollCnt * width, roll_height);
  185. lab_roll.TabIndex = 1;
  186. lab_roll.Text = rollNO;
  187. lab_roll.DoubleClick += new EventHandler(lab_roll_DoubleClick);
  188. this.locx_roll = this.locx_roll + rollCnt * width;
  189. }
  190. private void getWidthRectange(System.Data.DataRow row)
  191. {
  192. try
  193. {
  194. System.Decimal height = Common.FixDBManager.CheckNullDecimal(row["COIL_WTH"]);
  195. string Status_CD = Common.FixDBManager.CheckNullStr(row["STATUS_CD"]);
  196. string Coil_NO = Common.FixDBManager.CheckNullStr(row["COIL_NO"]);
  197. string tip_str = getTipStr(row);
  198. int lab_locy = 0;
  199. int lab_height = 0;
  200. if (height <= 900)
  201. {
  202. lab_height = Convert.ToInt16((height / 900) * 26);
  203. lab_locy = 81 - lab_height;
  204. }
  205. else if (height > 900 & height <= 1100)
  206. {
  207. lab_height = Convert.ToInt16(((height - 900) / 200) * 26) + 26;
  208. lab_locy = 81 - lab_height;
  209. }
  210. else if (height > 1100 & height <= 1400)
  211. {
  212. lab_height = Convert.ToInt16(((height - 1100) / 300) * 26) + 26 + 26;
  213. lab_locy = 81 - lab_height;
  214. }
  215. else
  216. {
  217. lab_height = 81;
  218. lab_locy = 0;
  219. }
  220. System.Windows.Forms.Label lab_width = new Label();
  221. lab_width.AutoSize = false;
  222. lab_width.BorderStyle = BorderStyle.FixedSingle;
  223. lab_width.Text = "";
  224. if (Status_CD == "A")
  225. {
  226. lab_width.BackColor = this.lab_plan.BackColor;
  227. }
  228. else if (Status_CD == "B")
  229. {
  230. lab_width.BackColor = this.lab_Standby.BackColor;
  231. }
  232. else if (Status_CD == "C")
  233. {
  234. lab_width.BackColor = this.lab_P.BackColor;
  235. }
  236. else if (Status_CD == "D")
  237. {
  238. lab_width.BackColor = this.lab_E.BackColor;
  239. }
  240. this.pal_Rectange.Controls.Add(lab_width);
  241. lab_width.Location = new System.Drawing.Point(locx1, lab_locy);
  242. lab_width.Name = Coil_NO;
  243. lab_width.Tag = Coil_NO;
  244. lab_width.Size = new System.Drawing.Size(width, lab_height);
  245. Coil_Tip.SetToolTip(lab_width, tip_str);
  246. this.locx1 = this.locx1 + this.width;
  247. lab_width.DoubleClick += new EventHandler(lab_width_DoubleClick);
  248. }
  249. catch (System.Exception ex)
  250. {
  251. System.Diagnostics.Debug.WriteLine(ex.ToString());
  252. }
  253. }
  254. private void getThkRectange(System.Data.DataRow row)
  255. {
  256. try
  257. {
  258. int lab_locy = locy_roll + roll_height;
  259. System.Double height = Convert.ToDouble(row["COIL_THK"]);
  260. string Status_CD = Common.FixDBManager.CheckNullStr(row["STATUS_CD"]);
  261. string Coil_NO = Common.FixDBManager.CheckNullStr(row["COIL_NO"]);
  262. string tip_str = getTipStr(row);
  263. int lab_height = 0;
  264. if (height <= 0.6)
  265. {
  266. lab_height = Convert.ToInt16((height / 0.6) * 26);
  267. }
  268. else if (height > 0.6 & height <= 1.4)
  269. {
  270. lab_height = Convert.ToInt16(((height - 0.6) / 0.8) * 26) + 26;
  271. }
  272. else if (height > 1.4 & height <= 2)
  273. {
  274. lab_height = Convert.ToInt16(((height - 1.4) / 0.6) * 26) + 26 + 26;
  275. }
  276. else
  277. {
  278. lab_height = 81;
  279. }
  280. System.Windows.Forms.Label Clab_height = new Label();
  281. Clab_height.AutoSize = false;
  282. Clab_height.BorderStyle = BorderStyle.FixedSingle;
  283. Clab_height.Text = "";
  284. if (Status_CD == "A")
  285. {
  286. Clab_height.BackColor = this.lab_plan.BackColor;
  287. }
  288. else if (Status_CD == "B")
  289. {
  290. Clab_height.BackColor = this.lab_Standby.BackColor;
  291. }
  292. else if (Status_CD == "C")
  293. {
  294. Clab_height.BackColor = this.lab_P.BackColor;
  295. }
  296. else if (Status_CD == "D")
  297. {
  298. Clab_height.BackColor = this.lab_E.BackColor;
  299. }
  300. this.pal_Rectange.Controls.Add(Clab_height);
  301. Clab_height.Location = new System.Drawing.Point(locx2, lab_locy);
  302. Clab_height.Name = "H" + Coil_NO;
  303. Clab_height.Tag = Coil_NO;
  304. Clab_height.Size = new System.Drawing.Size(width, lab_height);
  305. Coil_Tip.SetToolTip(Clab_height, tip_str);
  306. this.locx2 = this.locx2 + this.width;
  307. Clab_height.DoubleClick += new EventHandler(Clab_height_DoubleClick);
  308. }
  309. catch (System.Exception ex)
  310. {
  311. System.Diagnostics.Debug.WriteLine(ex.ToString());
  312. }
  313. }
  314. private string getTipStr(System.Data.DataRow row)
  315. {
  316. try
  317. {
  318. string tip_str = "钢卷号:" + Common.FixDBManager.CheckNullStr(row["COIL_NO"]) + "\n";
  319. tip_str += "钢卷内径:" + Common.FixDBManager.CheckNullStr(row["COIL_INDIA"]) + "\n";
  320. tip_str += "钢卷外径:" + Common.FixDBManager.CheckNullStr(row["COIL_OUTDIA"]) + "\n";
  321. tip_str += "钢卷厚度:" + Common.FixDBManager.CheckNullStr(row["COIL_THK"]) + "\n";
  322. tip_str += "钢卷宽度:" + Common.FixDBManager.CheckNullStr(row["COIL_WTH"]) + "\n";
  323. return tip_str;
  324. }
  325. catch (System.Exception ex)
  326. {
  327. System.Diagnostics.Debug.WriteLine(ex.ToString());
  328. return "";
  329. }
  330. }
  331. #endregion
  332. #region "Label Event"
  333. void lab_roll_DoubleClick(object sender, EventArgs e)
  334. {
  335. try
  336. {
  337. this.ugrd_RollPlan.Selected.Rows.Clear();
  338. string pkgNo = (sender as System.Windows.Forms.Label).Name;
  339. for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++)
  340. {
  341. if (Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["PKG_NO"].Value) == pkgNo)
  342. {
  343. this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]);
  344. }
  345. }
  346. this.ugrd_RollPlan.Selected.Rows[0].Activated = true;
  347. }
  348. catch (System.Exception ex)
  349. {
  350. System.Diagnostics.Debug.WriteLine(ex.ToString());
  351. }
  352. }
  353. void lab_width_DoubleClick(object sender, EventArgs e)
  354. {
  355. try
  356. {
  357. this.ugrd_RollPlan.Selected.Rows.Clear();
  358. string CoilNO = (sender as System.Windows.Forms.Label).Tag.ToString();
  359. for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++)
  360. {
  361. if (Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["COIL_NO"].Value) == CoilNO)
  362. {
  363. this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]);
  364. }
  365. }
  366. this.ugrd_RollPlan.Selected.Rows[0].Activated = true;
  367. }
  368. catch (System.Exception ex)
  369. {
  370. System.Diagnostics.Debug.WriteLine(ex.ToString());
  371. }
  372. }
  373. void Clab_height_DoubleClick(object sender, EventArgs e)
  374. {
  375. try
  376. {
  377. this.ugrd_RollPlan.Selected.Rows.Clear();
  378. string CoilNO = (sender as System.Windows.Forms.Label).Tag.ToString();
  379. for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++)
  380. {
  381. if (Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["COIL_NO"].Value) == CoilNO)
  382. {
  383. this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]);
  384. }
  385. }
  386. this.ugrd_RollPlan.Selected.Rows[0].Activated = true;
  387. }
  388. catch (System.Exception ex)
  389. {
  390. System.Diagnostics.Debug.WriteLine(ex.ToString());
  391. }
  392. }
  393. #endregion
  394. #region "Button Event"
  395. private void btn_Add_Click(object sender, EventArgs e)
  396. {
  397. try
  398. {
  399. this.ugrd_RollPlan.Selected.Rows.Clear();
  400. string CoilNO = txt_CoilNO.Text.Trim().ToUpper();
  401. for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++)
  402. {
  403. if ((Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["COIL_NO"].Value).IndexOf(CoilNO) > -1))
  404. {
  405. this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]);
  406. }
  407. }
  408. if (ugrd_RollPlan.Selected.Rows.Count > 0)
  409. this.ugrd_RollPlan.Selected.Rows[0].Activated = true;
  410. }
  411. catch (System.Exception ex)
  412. {
  413. System.Diagnostics.Debug.WriteLine(ex.ToString());
  414. }
  415. }
  416. #endregion
  417. #region "Grid Event"
  418. private void ugrd_RollPlan_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
  419. {
  420. e.Cell.SelectAll();
  421. }
  422. private void ugrd_RollPlan_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  423. {
  424. try
  425. {
  426. if (this.ugrd_RollPlan.ActiveRow != null)
  427. {
  428. Core.LZMes.Client.UIB.UIB010301 frm = new Core.LZMes.Client.UIB.UIB010301();
  429. frm.ob = this.ob;
  430. frm.OrderNO = Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.ActiveRow.Cells["ORD_NO"].Value);
  431. frm.OrderSEQ = Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.ActiveRow.Cells["ORD_SEQ"].Value); ;
  432. frm.ShowDialog();
  433. }
  434. }
  435. catch (System.Exception ex)
  436. {
  437. System.Diagnostics.Debug.WriteLine(ex.ToString());
  438. }
  439. }
  440. #endregion
  441. private void UIF071030_Load(object sender, EventArgs e)
  442. {
  443. try
  444. {
  445. foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn col in this.ugrd_RollPlan.DisplayLayout.Bands[0].Columns)
  446. {
  447. Common.FixDBManager.SetCellActivation(col.Key.ToString(), "L_TBF03_SPEC_PACK", this.ugrd_RollPlan, "ACTIVATEONLY");
  448. }
  449. }
  450. catch (System.Exception ex)
  451. {
  452. System.Diagnostics.Debug.WriteLine(ex.ToString());
  453. }
  454. }
  455. }
  456. }