6cd99db4fbc840b218ecaf36252cf77638c9fae0.svn-base 19 KB

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