FrmJGMatLiKuReport.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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 Core.Mes.Client.Comm.Server;
  10. using CoreFS.CA06;
  11. using System.Collections;
  12. using Core.Mes.Client.Comm.Control;
  13. using Infragistics.Win.UltraWinGrid;
  14. using Core.Mes.Client.Comm.Tool;
  15. using Core.StlMes.Client.Mcp.Control;
  16. using com.steering.mes.mcp.entity;
  17. namespace Core.StlMes.Client.Mcp.Report
  18. {
  19. public partial class FrmJGMatLiKuReport : FrmBase
  20. {
  21. public FrmJGMatLiKuReport()
  22. {
  23. InitializeComponent();
  24. this.IsLoadUserView = true;
  25. }
  26. private void FrmJGMatLikuReport_Load(object sender, EventArgs e)
  27. {
  28. EntityHelper.ShowGridCaption<CouplingMatButtressEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  29. DateTime t = DateTime.Now;
  30. DateTime t1 = new DateTime(t.Year, t.Month, 1);
  31. RegStartTime.Value = DateTime.Parse(t1.ToString("yyyy-MM-dd 00:00:00"));
  32. RegEndTime.Value = DateTime.Parse(t1.AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd 23:59:59"));
  33. //框号
  34. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmJGMatNoReport.getKepNo", null, this.ob);
  35. cmbMaterial.DataSource = dt;
  36. cmbMaterial.DisplayMember = "KEP_NO";
  37. PipeManageClass.SetComboItemHeight(cmbMaterial);
  38. String[] str = this.ValidDataPurviewIds;
  39. ArrayList arList = new ArrayList();
  40. //获取用户对应科室ID
  41. string User = this.UserInfo.GetDeptid();
  42. string StorageType = "";//根据传递的参数获取仓库类别
  43. string StorageAttr = "";////根据传递的参数获取仓库类型
  44. if (CustomInfo != "")
  45. {
  46. string[] strflg = CustomInfo.ToString().Split(new char[] { ',' });
  47. StorageType = strflg[0];
  48. StorageAttr = strflg[1];
  49. }
  50. DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.common.WarehousePermissions.getStoreNo", new object[] { StorageType, StorageAttr, str }, this.ob);
  51. cmbWarehous.DataSource = dt1;
  52. cmbWarehous.DisplayMember = "STORAGE_NAME";
  53. cmbWarehous.ValueMember = "STORAGE_NO";
  54. PipeManageClass.SetComboItemHeight(cmbWarehous);
  55. }
  56. public override void ToolBar_Click(object sender, string ToolbarKey)
  57. {
  58. switch (ToolbarKey)
  59. {
  60. case "Query":
  61. doQuery();
  62. break;
  63. case "Export":
  64. GridHelper.ulGridToExcel(ultraGrid1, "库存信息");
  65. break;
  66. case "Close":
  67. this.Close();
  68. break;
  69. }
  70. }
  71. /// <summary>
  72. /// 查询
  73. /// </summary>
  74. private void doQuery()
  75. {
  76. if (!CheckQuery()) return;
  77. string strRegStart = "";
  78. string strRegEnd = "";
  79. string strWare = "";//仓库号
  80. //string strMat = "";//框号
  81. string strFurnace = "";//炉号
  82. string strBatch = "";//批号
  83. string strWoid = "";//工单号
  84. ArrayList pram = new ArrayList();
  85. if (chkWarehous.Checked)
  86. {
  87. strWare = cmbWarehous.Value.ToString();
  88. }
  89. //if (chkMaterial.Checked)
  90. //{
  91. // strMat = cmbMaterial.Value.ToString();
  92. //}
  93. if (chkRegTime.Checked)
  94. {
  95. strRegStart = RegStartTime.Value.ToString();
  96. strRegEnd = RegEndTime.Value.ToString();
  97. }
  98. else
  99. {
  100. strRegStart = "1";
  101. }
  102. if (chkFurnace.Checked)
  103. {
  104. strFurnace = txtFurnace.Text.Trim();
  105. }
  106. if (chkBatch.Checked)
  107. {
  108. strBatch = txtBatch.Text.Trim();
  109. }
  110. pram.Add(strWare);
  111. pram.Add("");
  112. pram.Add(strFurnace);
  113. pram.Add(strRegStart);
  114. pram.Add(strRegStart);
  115. pram.Add(strRegStart);
  116. pram.Add(strRegEnd);
  117. pram.Add(strRegEnd);
  118. pram.Add(strBatch);
  119. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmJGMatNoReport.doQueryInfoResult", new object[] { pram }, ob);
  120. //GridHelper.CopyDataToDatatable(dt, this.dateMat, true);
  121. List<CouplingMatButtressEntity> listSource = EntityHelper.GetData<CouplingMatButtressEntity>
  122. ("com.steering.mes.mcp.Report.FrmJGMatNoReport.getQueryCouplingMatLiku", new object[] { pram }, this.ob);
  123. CouplingMatButtEntitybindingSource1.DataSource = listSource;
  124. GridHelper.RefreshAndAutoSize(ultraGrid1);
  125. }
  126. private void chkRegTime_CheckedChanged(object sender, EventArgs e)
  127. {
  128. if (chkBatch.Checked) { txtBatch.Enabled = true; } else { txtBatch.Enabled = false; }
  129. if (chkWarehous.Checked) { cmbWarehous.Enabled = true; } else { cmbWarehous.Enabled = false; }
  130. if (chkMaterial.Checked) { cmbMaterial.Enabled = true; } else { cmbMaterial.Enabled = false; }
  131. if (chkFurnace.Checked) { txtFurnace.Enabled = true; } else { txtFurnace.Enabled = false; }
  132. if (chkRegTime.Checked) { RegStartTime.Enabled = true; RegEndTime.Enabled = true; }
  133. else
  134. {
  135. RegStartTime.Enabled = false; RegEndTime.Enabled = false;
  136. }
  137. }
  138. ///查询时验证必填项
  139. private bool CheckQuery()
  140. {
  141. if (DataTimeUtil.JudgeTime(DateTime.Parse(RegStartTime.Value.ToString()), DateTime.Parse(RegEndTime.Value.ToString())) == 0)
  142. {
  143. MessageUtil.ShowTips("开始时间不能大于结束时间!");
  144. return false;
  145. }
  146. if (chkFurnace.Checked && string.IsNullOrEmpty(txtFurnace.Text.Trim()))
  147. {
  148. MessageBox.Show("请输入炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  149. return false;
  150. }
  151. if (chkBatch.Checked && string.IsNullOrEmpty(txtBatch.Text.Trim()))
  152. {
  153. MessageBox.Show("请输入批号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  154. return false;
  155. }
  156. if (chkWarehous.Checked && string.IsNullOrEmpty(cmbWarehous.Text.Trim()))
  157. {
  158. MessageBox.Show("请选择仓库号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  159. return false;
  160. }
  161. if (chkMaterial.Checked && string.IsNullOrEmpty(cmbMaterial.Text.Trim()))
  162. {
  163. MessageBox.Show("请选择框号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  164. return false;
  165. }
  166. return true;
  167. }
  168. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  169. {
  170. UltraGridRow urg = ultraGrid1.ActiveRow;
  171. if (urg == null) return;
  172. string woid = urg.Cells["WoId"].Text;
  173. string matNo = urg.Cells["MatNo"].Text;
  174. string judgeNo = urg.Cells["JudgeStoveNo"].Text;
  175. }
  176. }
  177. }