UIF052021.cs 17 KB

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