UIM010230.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. namespace Core.LZMes.Client.UIM
  11. {
  12. public partial class UIM010230 : FrmBase
  13. {
  14. public UIM010230()
  15. {
  16. InitializeComponent();
  17. }
  18. public override void ToolBar_Click(object sender, string ToolbarKey)
  19. {
  20. switch (ToolbarKey)
  21. {
  22. case "Query":
  23. this.DoQuery();
  24. break;
  25. case "Export":
  26. this.DoExport();
  27. break;
  28. case "Exit":
  29. this.Close();
  30. break;
  31. }
  32. }
  33. /// <summary>
  34. /// 查询成品库库存数据
  35. /// </summary>
  36. private void DoQuery()
  37. {
  38. try
  39. {
  40. this.dataSet1.Tables[0].Clear();
  41. string startTime = this.ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";//入库开始时间
  42. string endTime = this.ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : "";//入库结束时间
  43. string specStlGrd = this.textBox3.Text;//牌号
  44. string coilWthMin = this.textBox4.Text;//宽度最小值
  45. string coilWthMax = this.textBox5.Text;//宽度最大值
  46. string coilThkMin = this.textBox6.Text;//厚度最小值
  47. string coilThkMax = this.textBox7.Text;//厚度最大值
  48. string curLoadLoc = this.textBox8.Text;//垛位
  49. string coilNo = this.textBox9.Text;//钢卷号
  50. string ordNo = this.textBox11.Text;//订单号
  51. string ordSeq = "";// this.textBox12.Text;//合同号
  52. string ordFl = -1 == this.ultraComboEditor5.SelectedIndex ? "" : this.ultraComboEditor5.Value.ToString();//订单区分
  53. string devlmtDate = this.ultraDateTimeEditor3.Value != null ? ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") : "";//交货期
  54. string progCd = -1 == this.ultraComboEditor2.SelectedIndex ? "" : this.ultraComboEditor2.Value.ToString();//进程状态
  55. string smpSendTime = this.ultraDateTimeEditor4.Value != null ? ultraDateTimeEditor4.DateTime.ToString("yyyyMMdd") : "";//送样时间
  56. string prodnmCd = -1 == this.ultraComboEditor6.SelectedIndex ? "" : this.ultraComboEditor6.Value.ToString();//产品类型
  57. string[] queryParams = new string[] { startTime, endTime, specStlGrd, coilWthMin, coilWthMax,
  58. coilThkMin, coilThkMax, curLoadLoc, coilNo, ordNo, ordSeq, ordFl, devlmtDate, progCd, smpSendTime,
  59. prodnmCd};
  60. List<string[]> list = new List<String[]>();
  61. list.Add(queryParams);
  62. CoreClientParam ccp = new CoreClientParam();
  63. ccp.ServerName = "UIM.UIM010230";
  64. ccp.MethodName = "queryYardList";
  65. ccp.ServerParams = new object[] { list };
  66. ccp.SourceDataTable = this.dataSet1.Tables[0];
  67. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  68. //统计钢卷数量,钢卷总重量
  69. int coilCount = (int)dataSet1.Tables[0].Compute("count(OLD_SAMPL_NO)", "");
  70. double coilWgtSum = 0;
  71. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  72. {
  73. double actWgt = 0;
  74. //string a = ugr.VisibleIndex.ToString();
  75. //MessageBox.Show(a);
  76. try
  77. {
  78. //Color color = Color.SandyBrown;
  79. Color color = Color.PaleGoldenrod;
  80. string status = ugr.Cells["TOT_DEC_GRD"].Value.ToString().Trim();
  81. if ("合格".Equals(status))
  82. {
  83. color = Color.White;
  84. }
  85. else if ("不合格".Equals(status))
  86. {
  87. color = Color.FromArgb(255, 128, 128);
  88. }
  89. ugr.Appearance.BackColor = color;
  90. actWgt = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  91. }
  92. catch (Exception e)
  93. {
  94. }
  95. coilWgtSum += actWgt;
  96. }
  97. double coilWgtSum1 = 0; int count1 = 0;
  98. double coilWgtSum2 = 0; int count2 = 0;
  99. double coilWgtSum3 = 0; int count3 = 0;
  100. double coilWgtSum4 = 0; int count4 = 0;
  101. double coilWgtSum5 = 0; int count5 = 0;
  102. double coilWgtSum6 = 0; int count6 = 0;
  103. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  104. {
  105. double actWgt1 = 0;
  106. try
  107. {
  108. // Color color = Color.SandyBrown;
  109. string status = ugr.Cells["CUR_PROG_CD"].Value.ToString().Trim();
  110. if ("综合判定待机".Equals(status))
  111. {
  112. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  113. coilWgtSum1 += actWgt1;
  114. count1++;
  115. }
  116. else if ("重卷指示待机".Equals(status))
  117. {
  118. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  119. coilWgtSum2 += actWgt1;
  120. count2++;
  121. }
  122. else if ("连退成品充当待机".Equals(status))
  123. {
  124. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  125. coilWgtSum3 += actWgt1;
  126. count3++;
  127. }
  128. else if ("二级库存".Equals(status))
  129. {
  130. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  131. coilWgtSum4 += actWgt1;
  132. count4++;
  133. }
  134. else if ("包装作业待机".Equals(status))
  135. {
  136. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  137. coilWgtSum5 += actWgt1;
  138. count5++;
  139. }
  140. else if ("重卷作业待机".Equals(status))
  141. {
  142. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  143. coilWgtSum6 += actWgt1;
  144. count6++;
  145. }
  146. }
  147. catch (Exception e)
  148. {
  149. }
  150. }
  151. this.textBox1.Text = coilCount.ToString();
  152. this.textBox2.Text = (coilWgtSum / 1000).ToString();
  153. this.textBox10.Text = count1.ToString();
  154. this.textBox12.Text = (coilWgtSum1/1000).ToString();
  155. this.textBox14.Text = count2.ToString();
  156. this.textBox13.Text = (coilWgtSum2 / 1000).ToString();
  157. this.textBox16.Text = count3.ToString();
  158. this.textBox15.Text = (coilWgtSum3 / 1000).ToString();
  159. this.textBox18.Text = count4.ToString();
  160. this.textBox17.Text = (coilWgtSum4 / 1000).ToString();
  161. this.textBox20.Text = count5.ToString();
  162. this.textBox19.Text = (coilWgtSum5 / 1000).ToString();
  163. this.textBox22.Text = count6.ToString();
  164. this.textBox21.Text = (coilWgtSum6 / 1000).ToString();
  165. }
  166. catch (Exception EX)
  167. {
  168. MessageBox.Show(EX.ToString());
  169. }
  170. }
  171. private void UIM010230_Load(object sender, EventArgs e)
  172. {
  173. this.ultraDateTimeEditor1.Value = "";
  174. this.ultraDateTimeEditor2.Value = "";
  175. this.ultraDateTimeEditor3.Value = "";
  176. this.ultraDateTimeEditor4.Value = "";
  177. }
  178. private void DoExport()
  179. {
  180. try
  181. {
  182. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  183. {
  184. string fileName = this.saveFileDialog1.FileName;
  185. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  186. System.Diagnostics.Process.Start(fileName);
  187. }
  188. }
  189. catch (Exception EX)
  190. {
  191. MessageBox.Show(EX.ToString());
  192. }
  193. }
  194. }
  195. }