UIM010160.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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 UIM010160 : FrmBase
  13. {
  14. public UIM010160()
  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 ? this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";//入库开始时间
  42. string endTime = this.ultraDateTimeEditor2.Value != null ? this.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 ? this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") : "";//交货期
  54. string progCd = -1 == this.ultraComboEditor2.SelectedIndex ? "" : this.ultraComboEditor2.Value.ToString();//进程状态
  55. string smpSendTime = this.ultraDateTimeEditor4.Value != null ? this.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.UIM010160";
  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. try
  75. {
  76. Color color = Color.SandyBrown;
  77. string status = ugr.Cells["TOT_DEC_GRD"].Value.ToString().Trim();
  78. if ("合格".Equals(status))
  79. {
  80. color = Color.White;
  81. }
  82. else if ("不合格".Equals(status))
  83. {
  84. color = Color.FromArgb(255, 128, 128);
  85. }
  86. ugr.Appearance.BackColor = color;
  87. actWgt = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  88. }
  89. catch (Exception e)
  90. {
  91. }
  92. coilWgtSum += actWgt;
  93. }
  94. this.textBox1.Text = coilCount.ToString();
  95. this.textBox2.Text = (coilWgtSum / 1000).ToString();
  96. double coilWgtSum1 = 0; int count1 = 0;
  97. double coilWgtSum2 = 0; int count2 = 0;
  98. double coilWgtSum3 = 0; int count3 = 0;
  99. double coilWgtSum4 = 0; int count4 = 0;
  100. double coilWgtSum5 = 0; int count5 = 0;
  101. double coilWgtSum6 = 0; int count6 = 0;
  102. double coilWgtSum7 = 0; int count7 = 0;
  103. double coilWgtSum8 = 0; int count8 = 0;
  104. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  105. {
  106. double actWgt1 = 0;
  107. try
  108. {
  109. // Color color = Color.SandyBrown;
  110. string status = ugr.Cells["CUR_PROG_CD"].Value.ToString().Trim();
  111. if ("发货指示待机".Equals(status))
  112. {
  113. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  114. coilWgtSum1 += actWgt1;
  115. count1++;
  116. }
  117. else if ("运送待机".Equals(status))
  118. {
  119. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  120. coilWgtSum2 += actWgt1;
  121. count2++;
  122. }
  123. else if ("酸轧成品充当待机".Equals(status))
  124. {
  125. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  126. coilWgtSum3 += actWgt1;
  127. count3++;
  128. }
  129. else if ("二级库存".Equals(status))
  130. {
  131. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  132. coilWgtSum4 += actWgt1;
  133. count4++;
  134. }
  135. else if ("连退作业待机".Equals(status))
  136. {
  137. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  138. coilWgtSum5 += actWgt1;
  139. count5++;
  140. }
  141. else if ("连退作业指示待机".Equals(status))
  142. {
  143. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  144. coilWgtSum6 += actWgt1;
  145. count6++;
  146. }
  147. else if ("包装作业待机".Equals(status))
  148. {
  149. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  150. coilWgtSum7 += actWgt1;
  151. count7++;
  152. }
  153. }
  154. catch (Exception e)
  155. {
  156. }
  157. }
  158. this.textBox10.Text = count1.ToString();
  159. this.textBox12.Text = (coilWgtSum1 / 1000).ToString();
  160. this.textBox14.Text = count2.ToString();
  161. this.textBox13.Text = (coilWgtSum2 / 1000).ToString();
  162. this.textBox18.Text = count4.ToString();
  163. this.textBox17.Text = (coilWgtSum4 / 1000).ToString();
  164. this.textBox16.Text = count3.ToString();
  165. this.textBox15.Text = (coilWgtSum3 / 1000).ToString();
  166. this.textBox22.Text = count5.ToString();
  167. this.textBox21.Text = (coilWgtSum5 / 1000).ToString();
  168. this.textBox20.Text = count6.ToString();
  169. this.textBox19.Text = (coilWgtSum6 / 1000).ToString();
  170. this.textBox26.Text = count7.ToString();
  171. this.textBox25.Text = (coilWgtSum7 / 1000).ToString();
  172. }
  173. catch (Exception EX)
  174. {
  175. MessageBox.Show(EX.ToString());
  176. }
  177. }
  178. private void UIM010160_Load(object sender, EventArgs e)
  179. {
  180. this.ultraDateTimeEditor1.Value = "";
  181. this.ultraDateTimeEditor2.Value = "";
  182. this.ultraDateTimeEditor3.Value = "";
  183. this.ultraDateTimeEditor4.Value = "";
  184. }
  185. private void DoExport()
  186. {
  187. try
  188. {
  189. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  190. {
  191. string fileName = this.saveFileDialog1.FileName;
  192. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  193. System.Diagnostics.Process.Start(fileName);
  194. }
  195. }
  196. catch (Exception EX)
  197. {
  198. MessageBox.Show(EX.ToString());
  199. }
  200. }
  201. }
  202. }