UIF042040.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  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
  12. {
  13. public partial class UIF042040 : FrmBase
  14. {
  15. public UIF042040()
  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 "Save":
  28. this.Save();
  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("UIF042040.Query_RollPlan_Mill");
  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["C_TBF03_SPEC_MILL"]);
  50. tab0.TableName = "C_TBF03_SPEC_MILL";
  51. this.dataSet1.Tables["C_TBF03_SPEC_MILL"].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 Save()
  62. {
  63. try
  64. {
  65. if (!CheckSave())
  66. return;
  67. string ex = "";
  68. Hashtable paramHsmp = new Hashtable();
  69. //操作对象类型:轧辊计划 热轧卷
  70. paramHsmp.Add("i1", this.opt_Type.Value.ToString());
  71. paramHsmp.Add("i2", this.opt_eidt.Value.ToString());
  72. paramHsmp.Add("i3", this.txt_BCoilNO.Text.Trim() + ";" + this.txt_ECoilNO.Text.Trim());
  73. paramHsmp.Add("i4", this.txt_ACoilNO.Text.Trim() + ";" + Common.FixDBManager.CheckNullStr(this.optionBF.Value.ToString()));
  74. paramHsmp.Add("i5", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  75. paramHsmp.Add("o6", ex);
  76. CoreClientParam ccp = new CoreClientParam();
  77. ccp.ServerName = "UIB.COM.ComDBProcedure";
  78. ccp.MethodName = "doXmlProcedure";
  79. ccp.ServerParams = new Object[] { "UIF042040.RollPlan_Edit", paramHsmp };
  80. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  81. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  82. if (err!=null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0])!="1")
  83. {
  84. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  85. }
  86. else
  87. {
  88. MessageBox.Show("执行成功", Common.FixDBManager.MsgCaption);
  89. DoQuery("");
  90. }
  91. }
  92. catch (Exception EX)
  93. {
  94. MessageBox.Show(EX.ToString());
  95. }
  96. }
  97. private bool CheckSave()
  98. {
  99. if (Common.FixDBManager.CheckNullStr(this.opt_Type.Value).Length == 0 |
  100. Common.FixDBManager.CheckNullStr(this.opt_eidt.Value).Length == 0 |
  101. this.txt_BCoilNO.Text.Trim().Length ==0 | this.txt_ECoilNO.Text.Trim().Length==0
  102. )
  103. {
  104. MessageBox.Show("请确认执行条件",Common.FixDBManager.MsgCaption);
  105. return false;
  106. }
  107. if (Common.FixDBManager.CheckNullStr(this.opt_eidt.Value.ToString()) == "移动")
  108. {
  109. if (this.txt_ACoilNO.Text.Trim().Length == 0 |
  110. Common.FixDBManager.CheckNullStr(this.optionBF.Value).Length == 0
  111. )
  112. {
  113. MessageBox.Show("请确认移动的目标和位置", Common.FixDBManager.MsgCaption);
  114. return false;
  115. }
  116. }
  117. return true;
  118. }
  119. #endregion
  120. #region "Rectange"
  121. //设定基料最大高度
  122. private int Max_Height = 81;
  123. //基料卷展示的宽度
  124. private int width = 9;
  125. private int locy = 10;
  126. //宽度X坐标(第一个基料卷)
  127. private int locx1 = 0;
  128. //厚度X坐标(第一个基料卷)
  129. private int locx2 = 0;
  130. //轧制单元X坐标(第一个单元)
  131. private int locx_roll = 0;
  132. //轧制单元Y坐标
  133. private int locy_roll = 81;
  134. //轧制单元高度
  135. private int roll_height = 22;
  136. private string tempCoilNO = "";
  137. //Coil Tip
  138. System.Windows.Forms.ToolTip Coil_Tip = new ToolTip();
  139. //背景颜色配色
  140. Infragistics.Win.Appearance appearance = new Infragistics.Win.Appearance();
  141. private void getRectange()
  142. {
  143. try
  144. {
  145. pal_Rectange.Visible = false;
  146. locx1 = locx2 = locx_roll = 0;
  147. System.Int16 wth;
  148. double thk;
  149. string coilNO;
  150. string rollNO = "";
  151. int rollCoilCnt = 0;
  152. int totalCnt = 0;
  153. this.pal_Rectange.Controls.Clear();
  154. Coil_Tip.RemoveAll();
  155. foreach (DataRow row in this.dataSet1.Tables["C_TBF03_SPEC_MILL"].Rows)
  156. {
  157. wth = Convert.ToInt16(row["C_ORD_WTH"]);
  158. thk = Convert.ToDouble(row["C_ORD_THK"]);
  159. coilNO = Convert.ToString(row["COIL_NO"]);
  160. string tempRollNO = Convert.ToString(row["ROLL_MANA_NO"]);
  161. if (rollNO != "" && rollNO != tempRollNO)
  162. {
  163. getRollRectange(totalCnt, rollCoilCnt, rollNO);
  164. rollCoilCnt = 1;
  165. }
  166. else
  167. {
  168. rollCoilCnt = rollCoilCnt + 1;
  169. totalCnt = totalCnt + 1;
  170. }
  171. rollNO = tempRollNO;
  172. getWidthRectange(row);
  173. getThkRectange(row);
  174. }
  175. getRollRectange(totalCnt, rollCoilCnt, rollNO);
  176. pal_Rectange.Visible = true;
  177. }
  178. catch (System.Exception ex)
  179. {
  180. System.Diagnostics.Debug.WriteLine(ex.ToString());
  181. }
  182. }
  183. private void getRollRectange(int totalCnt,int rollCnt,string rollNO)
  184. {
  185. System.Windows.Forms.Label lab_roll = new Label();
  186. lab_roll.AutoSize = false;
  187. lab_roll.TextAlign = ContentAlignment.MiddleCenter;
  188. lab_roll.BackColor = System.Drawing.Color.White;
  189. lab_roll.BorderStyle = BorderStyle.FixedSingle;
  190. this.pal_Rectange.Controls.Add(lab_roll);
  191. lab_roll.Location = new System.Drawing.Point(locx_roll, locy_roll);
  192. lab_roll.Name = rollNO;
  193. lab_roll.Size = new System.Drawing.Size(rollCnt * width, roll_height);
  194. lab_roll.TabIndex = 1;
  195. lab_roll.Text = rollNO;
  196. lab_roll.DoubleClick += new EventHandler(lab_roll_DoubleClick);
  197. this.locx_roll = this.locx_roll + rollCnt * width;
  198. }
  199. private void getWidthRectange(System.Data.DataRow row)
  200. {
  201. try
  202. {
  203. System.Decimal height = Common.FixDBManager.CheckNullDecimal(row["C_ORD_WTH"]);
  204. string Status_CD = Common.FixDBManager.CheckNullStr(row["STATUS_CD"]);
  205. string Coil_NO = Common.FixDBManager.CheckNullStr(row["COIL_NO"]);
  206. string tip_str = getTipStr(row);
  207. int lab_locy = 0;
  208. int lab_height = 0;
  209. if (height <= 900)
  210. {
  211. lab_height = Convert.ToInt16((height / 900) * 26);
  212. lab_locy = 81 - lab_height;
  213. }
  214. else if (height > 900 & height <= 1100)
  215. {
  216. lab_height = Convert.ToInt16(((height - 900) / 200) * 26) + 26;
  217. lab_locy = 81 - lab_height;
  218. }
  219. else if (height > 1100 & height <= 1400)
  220. {
  221. lab_height = Convert.ToInt16(((height - 1100) / 300) * 26) + 26 + 26;
  222. lab_locy = 81 - lab_height;
  223. }
  224. else
  225. {
  226. lab_height = 81;
  227. lab_locy = 0;
  228. }
  229. System.Windows.Forms.Label lab_width = new Label();
  230. lab_width.AutoSize = false;
  231. lab_width.BorderStyle = BorderStyle.FixedSingle;
  232. lab_width.Text = "";
  233. if (Status_CD == "A")
  234. {
  235. lab_width.BackColor = this.lab_plan.BackColor;
  236. }
  237. else if (Status_CD == "B")
  238. {
  239. lab_width.BackColor = this.lab_Standby.BackColor;
  240. }
  241. else if (Status_CD == "C")
  242. {
  243. lab_width.BackColor = this.lab_P.BackColor;
  244. }
  245. else if (Status_CD == "D")
  246. {
  247. lab_width.BackColor = this.lab_E.BackColor;
  248. }
  249. this.pal_Rectange.Controls.Add(lab_width);
  250. lab_width.Location = new System.Drawing.Point(locx1, lab_locy);
  251. lab_width.Name = Coil_NO;
  252. lab_width.Tag = Coil_NO;
  253. lab_width.Size = new System.Drawing.Size(width, lab_height);
  254. Coil_Tip.SetToolTip(lab_width, tip_str);
  255. this.locx1 = this.locx1 + this.width;
  256. lab_width.DoubleClick += new EventHandler(lab_width_DoubleClick);
  257. }
  258. catch (System.Exception ex)
  259. {
  260. System.Diagnostics.Debug.WriteLine(ex.ToString());
  261. }
  262. }
  263. private void getThkRectange(System.Data.DataRow row)
  264. {
  265. try
  266. {
  267. int lab_locy = locy_roll + roll_height;
  268. System.Double height = Convert.ToDouble(row["C_ORD_THK"]);
  269. string Status_CD = Common.FixDBManager.CheckNullStr(row["STATUS_CD"]);
  270. string Coil_NO = Common.FixDBManager.CheckNullStr(row["COIL_NO"]);
  271. string tip_str = getTipStr(row);
  272. int lab_height = 0;
  273. if (height <= 0.6)
  274. {
  275. lab_height = Convert.ToInt16((height / 0.6) * 26);
  276. }
  277. else if (height > 0.6 & height <= 1.4)
  278. {
  279. lab_height = Convert.ToInt16(((height - 0.6) / 0.8) * 26) + 26;
  280. }
  281. else if (height > 1.4 & height <= 2)
  282. {
  283. lab_height = Convert.ToInt16(((height - 1.4) / 0.6) * 26) + 26 + 26;
  284. }
  285. else
  286. {
  287. lab_height = 81;
  288. }
  289. System.Windows.Forms.Label Clab_height = new Label();
  290. Clab_height.AutoSize = false;
  291. Clab_height.BorderStyle = BorderStyle.FixedSingle;
  292. Clab_height.Text = "";
  293. if (Status_CD == "A")
  294. {
  295. Clab_height.BackColor = this.lab_plan.BackColor;
  296. }
  297. else if (Status_CD == "B")
  298. {
  299. Clab_height.BackColor = this.lab_Standby.BackColor;
  300. }
  301. else if (Status_CD == "C")
  302. {
  303. Clab_height.BackColor = this.lab_P.BackColor;
  304. }
  305. else if (Status_CD == "D")
  306. {
  307. Clab_height.BackColor = this.lab_E.BackColor;
  308. }
  309. this.pal_Rectange.Controls.Add(Clab_height);
  310. Clab_height.Location = new System.Drawing.Point(locx2, lab_locy);
  311. Clab_height.Name = "H" + Coil_NO;
  312. Clab_height.Tag = Coil_NO;
  313. Clab_height.Size = new System.Drawing.Size(width, lab_height);
  314. Coil_Tip.SetToolTip(Clab_height, tip_str);
  315. this.locx2 = this.locx2 + this.width;
  316. Clab_height.DoubleClick += new EventHandler(Clab_height_DoubleClick);
  317. }
  318. catch (System.Exception ex)
  319. {
  320. System.Diagnostics.Debug.WriteLine(ex.ToString());
  321. }
  322. }
  323. private string getTipStr(System.Data.DataRow row)
  324. {
  325. try
  326. {
  327. string tip_str = "热卷号:" + Common.FixDBManager.CheckNullStr(row["COIL_NO"]) + "\n";
  328. tip_str = tip_str + "热卷内径:" + Common.FixDBManager.CheckNullStr(row["COIL_INDIA"]) + "\n";
  329. tip_str = tip_str + "热卷外径:" + Common.FixDBManager.CheckNullStr(row["COIL_OUTDIA"]) + "\n";
  330. tip_str = tip_str + "轧制厚度:" + Common.FixDBManager.CheckNullStr(row["C_ORD_THK"]) + "\n";
  331. tip_str = tip_str + "轧制宽度:" + Common.FixDBManager.CheckNullStr(row["C_ORD_WTH"]) + "\n";
  332. tip_str = tip_str + "轧制单元内顺序:" + Common.FixDBManager.CheckNullStr(row["ROLL_COIL_SEQ"]);
  333. return tip_str;
  334. }
  335. catch (System.Exception ex)
  336. {
  337. System.Diagnostics.Debug.WriteLine(ex.ToString());
  338. return "";
  339. }
  340. }
  341. #endregion
  342. #region "Label Event"
  343. void lab_roll_DoubleClick(object sender, EventArgs e)
  344. {
  345. try
  346. {
  347. this.ugrd_RollPlan.Selected.Rows.Clear();
  348. string RollNO = (sender as System.Windows.Forms.Label).Name;
  349. for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++)
  350. {
  351. if (Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["ROLL_MANA_NO"].Value) == RollNO)
  352. {
  353. this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]);
  354. }
  355. }
  356. this.ugrd_RollPlan.Selected.Rows[0].Activated = true;
  357. }
  358. catch (System.Exception ex)
  359. {
  360. System.Diagnostics.Debug.WriteLine(ex.ToString());
  361. }
  362. }
  363. void lab_width_DoubleClick(object sender, EventArgs e)
  364. {
  365. try
  366. {
  367. this.ugrd_RollPlan.Selected.Rows.Clear();
  368. string CoilNO = (sender as System.Windows.Forms.Label).Tag.ToString();
  369. for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++)
  370. {
  371. if (Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["COIL_NO"].Value) == CoilNO)
  372. {
  373. this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]);
  374. }
  375. }
  376. this.ugrd_RollPlan.Selected.Rows[0].Activated = true;
  377. }
  378. catch (System.Exception ex)
  379. {
  380. System.Diagnostics.Debug.WriteLine(ex.ToString());
  381. }
  382. }
  383. void Clab_height_DoubleClick(object sender, EventArgs e)
  384. {
  385. try
  386. {
  387. this.ugrd_RollPlan.Selected.Rows.Clear();
  388. string CoilNO = (sender as System.Windows.Forms.Label).Tag.ToString();
  389. for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++)
  390. {
  391. if (Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["COIL_NO"].Value) == CoilNO)
  392. {
  393. this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]);
  394. }
  395. }
  396. this.ugrd_RollPlan.Selected.Rows[0].Activated = true;
  397. }
  398. catch (System.Exception ex)
  399. {
  400. System.Diagnostics.Debug.WriteLine(ex.ToString());
  401. }
  402. }
  403. #endregion
  404. #region "Text Event"
  405. private void text_MouseClick(object sender, MouseEventArgs e)
  406. {
  407. System.Windows.Forms.TextBox text = (System.Windows.Forms.TextBox)sender;
  408. text.Text = this.tempCoilNO;
  409. }
  410. #endregion
  411. #region "OptionSet Event"
  412. private void opt_eidt_ValueChanged(object sender, EventArgs e)
  413. {
  414. try
  415. {
  416. if (Common.FixDBManager.CheckNullStr(this.opt_eidt.Value) == "移动")
  417. {
  418. optionBF.Enabled = true;
  419. this.txt_ACoilNO.BackColor = System.Drawing.Color.Yellow;
  420. }
  421. else
  422. {
  423. optionBF.Enabled = false;
  424. this.txt_ACoilNO.BackColor = System.Drawing.SystemColors.Control;
  425. }
  426. }
  427. catch (System.Exception ex)
  428. {
  429. System.Diagnostics.Debug.WriteLine(ex.ToString());
  430. }
  431. }
  432. #endregion
  433. #region "Grid Event"
  434. private void ugrd_RollPlan_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  435. {
  436. try
  437. {
  438. if (e.Row != null)
  439. {
  440. if (Common.FixDBManager.CheckNullStr(this.opt_Type.Value) == "轧辊")
  441. {
  442. if (Common.FixDBManager.CheckNullStr(this.opt_eidt.Value) == "分离")
  443. {
  444. this.tempCoilNO = Common.FixDBManager.CheckNullStr(e.Row.Cells["ROLL_MANA_NO"].Value) + "-" + Common.FixDBManager.CheckNullStr(e.Row.Cells["ROLL_COIL_SEQ"].Value).PadLeft(3,'0');
  445. }
  446. else
  447. {
  448. this.tempCoilNO = Common.FixDBManager.CheckNullStr(e.Row.Cells["ROLL_MANA_NO"].Value);
  449. }
  450. }
  451. else
  452. {
  453. this.tempCoilNO = Common.FixDBManager.CheckNullStr(e.Row.Cells["ROLL_MANA_NO"].Value) + "-" + Common.FixDBManager.CheckNullStr(e.Row.Cells["ROLL_COIL_SEQ"].Value).PadLeft(3, '0'); ;
  454. }
  455. }
  456. }
  457. catch (System.Exception ex)
  458. {
  459. System.Diagnostics.Debug.WriteLine(ex.ToString());
  460. }
  461. }
  462. private void ugrd_RollPlan_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
  463. {
  464. try
  465. {
  466. if (this.ugrd_RollPlan.ActiveRow != null)
  467. {
  468. if (e.Cell.Column.Key == "ORD_NO" | e.Cell.Column.Key == "ORD_SEQ")
  469. {
  470. Core.LZMes.Client.UIB.UIB010301 frm = new Core.LZMes.Client.UIB.UIB010301();
  471. frm.ob = this.ob;
  472. frm.OrderNO = Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.ActiveRow.Cells["ORD_NO"].Value);
  473. frm.OrderSEQ = Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.ActiveRow.Cells["ORD_SEQ"].Value); ;
  474. frm.ShowDialog();
  475. }
  476. }
  477. }
  478. catch (System.Exception ex)
  479. {
  480. System.Diagnostics.Debug.WriteLine(ex.ToString());
  481. }
  482. }
  483. #endregion
  484. #region "Init"
  485. private void UIF042040_Load(object sender, EventArgs e)
  486. {
  487. try
  488. {
  489. foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn col in this.ugrd_RollPlan.DisplayLayout.Bands[0].Columns)
  490. {
  491. Common.FixDBManager.SetCellActivation(col.Key.ToString(), "C_TBF03_SPEC_MILL", this.ugrd_RollPlan, "ACTIVATEONLY");
  492. }
  493. }
  494. catch (System.Exception ex)
  495. {
  496. System.Diagnostics.Debug.WriteLine(ex.ToString());
  497. }
  498. }
  499. #endregion
  500. }
  501. }