UIM010212.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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.UIM
  12. {
  13. public partial class UIM010212 : FrmBase
  14. {
  15. private string opTime = "";
  16. private string shift = "";
  17. private string group = "";
  18. private string stockNo = "";
  19. int queryType = 0;
  20. public UIM010212()
  21. {
  22. InitializeComponent();
  23. }
  24. private void UIM010212_Load(object sender, EventArgs e)
  25. {
  26. this.ExportColumnsInit();//初始化导出字段设定
  27. }
  28. /// <summary>
  29. /// 导出时不需要显示的字段
  30. /// </summary>
  31. string[] ExportColumns;
  32. /// <summary>
  33. /// 不需要导出的字段的名字组初始化
  34. /// </summary>
  35. private void ExportColumnsInit()
  36. {
  37. this.ExportColumns = new string[]{
  38. "YARD_ENTRY_DTIME",
  39. "TRNF_DTIME",
  40. "PRODNM_CD",
  41. "CZSJ",
  42. "SHIFT",
  43. "WKGROUP",
  44. "CZR",
  45. "ZPH",
  46. "TOT_DEC_GRD",
  47. "INGR_DEC_GRD",
  48. "MATLQLTY_DEC_GRD",
  49. "SIZE_DEC_RST",
  50. "EXTSHAPE_DEC_GRD",
  51. "WGT_DEC_RST",
  52. "ORD_NO",
  53. "ORD_SEQ",
  54. "DLIV_TP",
  55. "ORDCUST_CD",
  56. "CHARGE_NO",
  57. "OP_TYPE",
  58. "DLIV_DIRNO",
  59. "ORD_DEVLMT_DATE"
  60. };
  61. }
  62. public override void ToolBar_Click(object sender, string ToolbarKey)
  63. {
  64. switch (ToolbarKey)
  65. {
  66. case "Query":
  67. this.label1.Focus();
  68. this.DoQuery();
  69. break;
  70. case "Exit":
  71. this.Close();
  72. break;
  73. case "":
  74. break;
  75. }
  76. }
  77. /// <summary>
  78. /// 查询原料库钢卷出入库记录
  79. /// </summary>
  80. private void DoQuery()
  81. {
  82. try
  83. {
  84. this.dataSet1.Tables[0].Clear();
  85. string startTime = this.dteStartDate.DateTime.ToString("yyyyMMdd");//开始时间 1
  86. opTime = this.dteStartDate.DateTime.ToString("yyyy年MM月dd日");
  87. string endTime = this.dteEndDate.DateTime.ToString("yyyyMMdd");//结束时间 2
  88. string specStlGrd = this.txtSPEC_STL_GRD.Text;//牌号 3
  89. string coilNo = this.txtOLD_SAMPL_NO.Text;//钢卷号 9
  90. queryType = 0;//查询类型 0 入库记录 1 出库记录
  91. string[] queryParams = new string[] { startTime, endTime, specStlGrd, coilNo };
  92. for (int i = 0; i < queryParams.Length; i++)
  93. {
  94. if (queryParams[i] == null)
  95. {
  96. queryParams[i] = "";
  97. }
  98. }
  99. List<string[]> list = new List<String[]>();
  100. list.Add(queryParams);
  101. CoreClientParam ccp = new CoreClientParam();
  102. ccp.ServerName = "UIB.COM.ComDBQuery";
  103. ccp.MethodName = "doSimpleQuery";
  104. System.Collections.ArrayList paramArray = new System.Collections.ArrayList();
  105. paramArray.Add("UIM010211_01.SELECT");
  106. paramArray.Add(startTime);
  107. paramArray.Add(endTime);
  108. paramArray.Add(specStlGrd);
  109. paramArray.Add(coilNo);
  110. ccp.ServerParams = new object[] { paramArray };
  111. ccp.SourceDataTable = this.dataSet1.Tables[0];
  112. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  113. DataRowCollection drs = this.dataSet1.Tables[0].Rows;
  114. int coilCount = 0;
  115. double wgtCount = 0;
  116. int drsSize = drs.Count;
  117. coilCount = drsSize;
  118. for (int i = 0; i < drsSize; i++)
  119. {
  120. double actWgt = 0;
  121. try
  122. {
  123. actWgt = double.Parse(drs[i]["ACT_WGT"].ToString());
  124. }
  125. catch (Exception e)
  126. {
  127. }
  128. wgtCount += actWgt;
  129. }
  130. if (coilCount == 0)
  131. {
  132. this.textBox1.Text = "";
  133. this.textBox2.Text = "";
  134. }
  135. else
  136. {
  137. this.textBox1.Text = coilCount.ToString();
  138. this.textBox2.Text = (wgtCount / 1000).ToString();
  139. }
  140. }
  141. catch (Exception EX)
  142. {
  143. MessageBox.Show(EX.ToString());
  144. }
  145. }
  146. private void button1_Click_1(object sender, EventArgs e)
  147. {
  148. try
  149. {
  150. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  151. {
  152. string fileName = this.saveFileDialog1.FileName;
  153. this.ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  154. System.Diagnostics.Process.Start(fileName);
  155. }
  156. }
  157. catch (Exception ex)
  158. {
  159. MessageBox.Show(ex.ToString());
  160. }
  161. }
  162. }
  163. }