ComPlineTimeCtrl.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.Mes.Client.Comm.Control;
  11. using Infragistics.Win.UltraWinGrid;
  12. namespace Core.StlMes.Client.Plan.Order.JGGXPln
  13. {
  14. public partial class ComPlineTimeCtrl : UserControl
  15. {
  16. private ComPlineTimeBLL plineTimeBLL;
  17. /// <summary>
  18. /// 小时能力(t/h)
  19. /// </summary>
  20. double hrCapcty = 0;
  21. /// <summary>
  22. /// 产线代码
  23. /// </summary>
  24. private string plinecode = "";
  25. /// <summary>
  26. /// 产线描述
  27. /// </summary>
  28. private string plinename = "";
  29. public ComPlineTimeCtrl()
  30. {
  31. InitializeComponent();
  32. }
  33. public ComPlineTimeCtrl(System.Windows.Forms.Control container, OpeBase ob)
  34. {
  35. InitializeComponent();
  36. plineTimeBLL = new ComPlineTimeBLL(ob);
  37. container.Container.Add(this);
  38. this.Dock = DockStyle.Fill;
  39. }
  40. public void ComBLL(OpeBase ob)
  41. {
  42. plineTimeBLL = new ComPlineTimeBLL(ob);
  43. }
  44. /// <summary>
  45. /// 查询
  46. /// </summary>
  47. /// <param name="inMaterialNo"></param>
  48. /// <param name="outMaterialNo"></param>
  49. public void Query(string inMaterialNo, string outMaterialNo)
  50. {
  51. DataTable dt = plineTimeBLL.Query(inMaterialNo, outMaterialNo);
  52. GridHelper.CopyDataToDatatable(dt, dataTablePline, true);
  53. PlanComm.setGridActivation(ultraGridPline.DisplayLayout.Bands[0], "CHC");
  54. }
  55. /// <summary>
  56. /// 设置勾选的产线
  57. /// </summary>
  58. public void setPline(string codePl)
  59. {
  60. ultraGridPline.UpdateData();
  61. IQueryable<UltraGridRow> chRow = ultraGridPline.Rows.AsQueryable().Where("PLINE_CODE = '" + codePl + "'");
  62. if (chRow.Count() == 1)
  63. {
  64. UltraGridRow uRow = chRow.First<UltraGridRow>();
  65. uRow.Cells["CHC"].Value = true;
  66. plinecode = uRow.Cells["PLINE_CODE"].Value.ToString();
  67. plinename = uRow.Cells["PLINE_NAME"].Value.ToString();
  68. double.TryParse(uRow.Cells["HR_CAPCTY"].Value.ToString(), out hrCapcty);
  69. }
  70. }
  71. private void ultraGridPline_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  72. {
  73. if (e.Cell.Column.Key.Equals("CHC"))
  74. {
  75. if (Convert.ToBoolean(e.Cell.Row.Cells["CHC"].Text))
  76. {
  77. plinecode = e.Cell.Row.Cells["PLINE_CODE"].Value.ToString();
  78. plinename = e.Cell.Row.Cells["PLINE_NAME"].Value.ToString();
  79. double.TryParse(e.Cell.Row.Cells["HR_CAPCTY"].Value.ToString(), out hrCapcty);
  80. foreach (UltraGridRow uRow in ultraGridPline.Rows)
  81. {
  82. if (uRow != e.Cell.Row)
  83. {
  84. uRow.Cells["CHC"].Value = false;
  85. }
  86. }
  87. }
  88. else
  89. {
  90. e.Cell.Row.Cells["CHC"].Value = true;
  91. }
  92. }
  93. }
  94. /// <summary>
  95. /// 小时能力(t/h)
  96. /// </summary>
  97. public double HrCapcty
  98. {
  99. get { return hrCapcty; }
  100. set { hrCapcty = value; }
  101. }
  102. /// <summary>
  103. /// 产线代码
  104. /// </summary>
  105. public string Plinecode
  106. {
  107. get { return plinecode; }
  108. set { plinecode = value; }
  109. }
  110. /// <summary>
  111. /// 产线描述
  112. /// </summary>
  113. public string Plinename
  114. {
  115. get { return plinename; }
  116. set { plinename = value; }
  117. }
  118. /// <summary>
  119. /// 生产时间
  120. /// </summary>
  121. public System.Windows.Forms.DateTimePicker DateTimeProdu
  122. {
  123. get { return dateTimeProdu; }
  124. set { dateTimeProdu = value; }
  125. }
  126. /// <summary>
  127. /// 获取Grid
  128. /// </summary>
  129. public Infragistics.Win.UltraWinGrid.UltraGrid UltraGridPline
  130. {
  131. get { return ultraGridPline; }
  132. }
  133. }
  134. }