UIM010231.cs 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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 UIM010231 : FrmBase
  13. {
  14. public UIM010231()
  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.UIM010231_1";
  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.PaleGoldenrod;
  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. double coilWgtSum1 = 0; int count1 = 0;
  95. double coilWgtSum2 = 0; int count2 = 0;
  96. double coilWgtSum3 = 0; int count3 = 0;
  97. double coilWgtSum4 = 0; int count4 = 0;
  98. double coilWgtSum5 = 0; int count5 = 0;
  99. double coilWgtSum6 = 0; int count6 = 0;
  100. double coilWgtSum7 = 0; int count7 = 0;
  101. double coilWgtSum8 = 0; int count8 = 0;
  102. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  103. {
  104. double actWgt1 = 0;
  105. try
  106. {
  107. // Color color = Color.SandyBrown;
  108. string status = ugr.Cells["CUR_PROG_CD"].Value.ToString().Trim();
  109. if ("发货指示待机".Equals(status))
  110. {
  111. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  112. coilWgtSum1 += actWgt1;
  113. count1++;
  114. }
  115. else if ("运送待机".Equals(status))
  116. {
  117. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  118. coilWgtSum2 += actWgt1;
  119. count2++;
  120. }
  121. else if ("连退成品充当待机".Equals(status))
  122. {
  123. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  124. coilWgtSum3 += actWgt1;
  125. count3++;
  126. }
  127. else if ("二级库存".Equals(status))
  128. {
  129. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  130. coilWgtSum4 += actWgt1;
  131. count4++;
  132. }
  133. else if ("重卷作业待机".Equals(status))
  134. {
  135. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  136. coilWgtSum5 += actWgt1;
  137. count5++;
  138. }
  139. else if ("综合判定待机".Equals(status))
  140. {
  141. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  142. coilWgtSum6 += actWgt1;
  143. count6++;
  144. }
  145. else if ("重卷指示待机".Equals(status))
  146. {
  147. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  148. coilWgtSum7 += actWgt1;
  149. count7++;
  150. }
  151. else if ("包装作业待机".Equals(status))
  152. {
  153. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  154. coilWgtSum8 += actWgt1;
  155. count8++;
  156. }
  157. }
  158. catch (Exception e)
  159. {
  160. }
  161. }
  162. this.textBox1.Text = coilCount.ToString();
  163. this.textBox2.Text = (coilWgtSum / 1000).ToString();
  164. this.textBox10.Text = count1.ToString();
  165. this.textBox12.Text = (coilWgtSum1 / 1000).ToString();
  166. this.textBox14.Text = count2.ToString();
  167. this.textBox13.Text = (coilWgtSum2 / 1000).ToString();
  168. this.textBox18.Text = count4.ToString();
  169. this.textBox17.Text = (coilWgtSum4 / 1000).ToString();
  170. this.textBox16.Text = count3.ToString();
  171. this.textBox15.Text = (coilWgtSum3 / 1000).ToString();
  172. this.textBox22.Text = count5.ToString();
  173. this.textBox21.Text = (coilWgtSum5 / 1000).ToString();
  174. this.textBox20.Text = count6.ToString();
  175. this.textBox19.Text = (coilWgtSum6 / 1000).ToString();
  176. this.textBox24.Text = count7.ToString();
  177. this.textBox23.Text = (coilWgtSum7 / 1000).ToString();
  178. this.textBox26.Text = count8.ToString();
  179. this.textBox25.Text = (coilWgtSum8 / 1000).ToString();
  180. }
  181. catch (Exception EX)
  182. {
  183. MessageBox.Show(EX.ToString());
  184. }
  185. }
  186. private void UIM010230_Load(object sender, EventArgs e)
  187. {
  188. this.ultraDateTimeEditor1.Value = "";
  189. this.ultraDateTimeEditor2.Value = "";
  190. this.ultraDateTimeEditor3.Value = "";
  191. this.ultraDateTimeEditor4.Value = "";
  192. }
  193. private void DoExport()
  194. {
  195. try
  196. {
  197. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  198. {
  199. string fileName = this.saveFileDialog1.FileName;
  200. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  201. System.Diagnostics.Process.Start(fileName);
  202. }
  203. }
  204. catch (Exception EX)
  205. {
  206. MessageBox.Show(EX.ToString());
  207. }
  208. }
  209. }
  210. }