FrmJGMatNoReport.cs 6.9 KB

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