FrmBcControlLog.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.ZGMil.Entity;
  5. using Core.StlMes.Client.ZGMil.ResultConrtrol;
  6. using Core.StlMes.Client.ZGMil.Signature;
  7. using CoreFS.CA06;
  8. using Infragistics.Win;
  9. using Infragistics.Win.UltraWinGrid;
  10. using System;
  11. using System.Collections;
  12. using System.Collections.Generic;
  13. using System.ComponentModel;
  14. using System.Data;
  15. using System.Drawing;
  16. using System.Linq;
  17. using System.Text;
  18. using System.Windows.Forms;
  19. namespace Core.StlMes.Client.ZGMil.Report
  20. {
  21. public partial class FrmBcControlLog : FrmBase
  22. {
  23. private string departm = "";
  24. private string plineCode = "";
  25. private string Process = "";//参数
  26. private DataTable _dtPline = null;
  27. private string[] arrId;//数据权限
  28. public FrmBcControlLog()
  29. {
  30. InitializeComponent();
  31. this.IsLoadUserView = true;
  32. }
  33. private void FrmBcControlLog_Load(object sender, EventArgs e)
  34. {
  35. NativeMethodNew na = new NativeMethodNew(this.ob);
  36. departm = UserInfo.GetDepartment();
  37. //plineCode = na.GetPCode(departm);//获取 用户 对应的产线
  38. arrId = this.ValidDataPurviewIds;//获取数据权限
  39. Process = this.CustomInfo.ToString();//参数
  40. _dtPline = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.JudgeBaseInfo", new object[] { Process }, ob);
  41. //_dtPline.AcceptChanges();
  42. string strPlineNames = string.Join(",", _dtPline.Rows.Cast<DataRow>().Select(a => a["plineName"].ToString()).ToArray());
  43. string strPineCodes = string.Join(",", _dtPline.Rows.Cast<DataRow>().Select(a => a["plineCode"].ToString()).ToArray());
  44. ultraPlineCode.Text = strPlineNames;
  45. ultraPlineCode.Tag = strPineCodes;
  46. DateTime now = DateTime.Now;
  47. DateTime date = new DateTime(now.Year,now.Month,1);
  48. dateBAL_YEAR_MONTH.Text = now.ToString("yyyy年MM月");
  49. }
  50. /// <summary>
  51. /// 重写基类方法
  52. /// </summary>
  53. /// <param name="sender"></param>
  54. /// <param name="ToolbarKey"></param>
  55. public override void ToolBar_Click(object sender, string ToolbarKey)
  56. {
  57. switch (ToolbarKey)
  58. {
  59. case "DoQuery":
  60. doQuery2();
  61. break;
  62. case "Update":
  63. updateHrCapcty();
  64. break;
  65. case "Close":
  66. this.Close();
  67. break;
  68. }
  69. }
  70. /// <summary>
  71. /// 回报小时能力
  72. /// </summary>
  73. private void updateHrCapcty()
  74. {
  75. ArrayList listAll = new ArrayList();
  76. if (ultraGrid2.Rows.Count > 0)
  77. {
  78. foreach (UltraGridRow ugr in ultraGrid2.Rows)
  79. {
  80. ArrayList list = new ArrayList();
  81. list.Add(ugr.Cells["XSJZ"].Value.ToString());
  82. list.Add(ugr.Cells["QUALIFIED_NUM"].Value.ToString());
  83. list.Add(ugr.Cells["INWL_ID"].Value.ToString());
  84. list.Add(ugr.Cells["OUTWL_ID"].Value.ToString());
  85. list.Add(ugr.Cells["PLINE_CODE"].Value.ToString());
  86. listAll.Add(list);
  87. }
  88. }
  89. CoreClientParam ccp = new CoreClientParam();
  90. ccp.ServerName = "com.steering.mes.zgmil.report.FrmMilDateStatistics";
  91. ccp.MethodName = "updateBcControlLog";
  92. ccp.ServerParams = new object[] { listAll, Process };
  93. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  94. MessageUtil.ShowTips(ccp.ReturnInfo);
  95. }
  96. /// <summary>
  97. /// 调 度 统 计(小时能力)查询
  98. /// </summary>
  99. private void doQuery2()
  100. {
  101. string time = "";
  102. if (ckBAL_YEAR_MONTH.Checked)
  103. {
  104. if (dateBAL_YEAR_MONTH.Text.Trim() == "")
  105. {
  106. time = "";
  107. }
  108. else
  109. {
  110. time = dateBAL_YEAR_MONTH.Value.ToString("yyyyMM");
  111. }
  112. }
  113. if (ckPlineCode.Checked)
  114. {
  115. plineCode = ultraPlineCode.Tag.ToString().Replace(",", "', '");
  116. }
  117. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getBcControlLog", new Object[] { time, plineCode, Process }, this.ob);
  118. GridHelper.CopyDataToDatatable(dt, this.dataTable2, true);
  119. GridHelper.RefreshAndAutoSize(this.ultraGrid2);
  120. }
  121. private void chkDate_CheckedChanged(object sender, EventArgs e)
  122. {
  123. if (ckBAL_YEAR_MONTH.Checked) { dateBAL_YEAR_MONTH.Enabled = true; } else { dateBAL_YEAR_MONTH.Enabled = false; }
  124. if (ckPlineCode.Checked) { ultraPlineCode.Enabled = true; } else { ultraPlineCode.Enabled = false; }
  125. //if (ultraCheckEditor2.Checked) { ultraComboEditor1.Enabled = true; } else { ultraComboEditor1.Enabled = false; }
  126. }
  127. private void ultraPlineCode_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  128. {
  129. ChoicePlineFrm frm = new ChoicePlineFrm(_dtPline, ultraPlineCode.Tag.ToString2(), this.ob);
  130. if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  131. {
  132. ultraPlineCode.Text = frm.ChoicePlineName;
  133. ultraPlineCode.Tag = frm.ChoicePlineCode;
  134. }
  135. }
  136. }
  137. }