054d96ac24ee37d315d65788e11d84110bd538d1.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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 UIM010232 : FrmBase
  13. {
  14. public UIM010232()
  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. if (this.checkBox1.Checked)
  63. {
  64. CoreClientParam ccp1 = new CoreClientParam();
  65. ccp1.ServerName = "UIM.UIM010232";
  66. ccp1.MethodName = "queryYardListfjh";
  67. ccp1.ServerParams = new object[] { list };
  68. ccp1.SourceDataTable = this.dataSet1.Tables[0];
  69. this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal);
  70. }
  71. else
  72. {
  73. CoreClientParam ccp = new CoreClientParam();
  74. ccp.ServerName = "UIM.UIM010232";
  75. ccp.MethodName = "queryYardList";
  76. ccp.ServerParams = new object[] { list };
  77. ccp.SourceDataTable = this.dataSet1.Tables[0];
  78. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  79. }
  80. //统计钢卷数量,钢卷总重量
  81. int coilCount = (int)dataSet1.Tables[0].Compute("count(OLD_SAMPL_NO)", "");
  82. double coilWgtSum = 0;
  83. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  84. {
  85. double actWgt = 0;
  86. try
  87. {
  88. Color color = Color.PaleGoldenrod;
  89. string status = ugr.Cells["TOT_DEC_GRD"].Value.ToString().Trim();
  90. if ("合格".Equals(status))
  91. {
  92. color = Color.White;
  93. }
  94. else if ("不合格".Equals(status))
  95. {
  96. color = Color.FromArgb(255, 128, 128);
  97. }
  98. string fhzt = ugr.Cells["CUR_PROG_CD"].Value.ToString().Trim();
  99. string curloc = ugr.Cells["CUR_LOAD_LOC"].Value.ToString().Trim();
  100. int asd = string.Compare(curloc.Substring(curloc.Length - 2, 2), "76");
  101. string packlv = ugr.Cells["PACKAGE_LEVEL"].Value.ToString().Trim();
  102. if (("发货指示待机".Equals(fhzt) || "运送待机".Equals(fhzt)) && packlv.Length > 0 && asd == -1 && "4".Equals(curloc.Substring(0,1)))
  103. {
  104. color = Color.Yellow;
  105. }
  106. ugr.Appearance.BackColor = color;
  107. actWgt = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  108. }
  109. catch (Exception e)
  110. {
  111. }
  112. coilWgtSum += actWgt;
  113. }
  114. double coilWgtSum1 = 0; int count1 = 0;
  115. double coilWgtSum2 = 0; int count2 = 0;
  116. double coilWgtSum3 = 0; int count3 = 0;
  117. double coilWgtSum4 = 0; int count4 = 0;
  118. double coilWgtSum5 = 0; int count5 = 0;
  119. double coilWgtSum6 = 0; int count6 = 0;
  120. double coilWgtSum7 = 0; int count7 = 0;
  121. double coilWgtSum8 = 0; int count8 = 0;
  122. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  123. {
  124. double actWgt1 = 0;
  125. try
  126. {
  127. // Color color = Color.SandyBrown;
  128. string status = ugr.Cells["CUR_PROG_CD"].Value.ToString().Trim();
  129. if ("发货指示待机".Equals(status))
  130. {
  131. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  132. coilWgtSum1 += actWgt1;
  133. count1++;
  134. }
  135. else if ("运送待机".Equals(status))
  136. {
  137. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  138. coilWgtSum2 += actWgt1;
  139. count2++;
  140. }
  141. else if ("连退成品充当待机".Equals(status))
  142. {
  143. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  144. coilWgtSum3 += actWgt1;
  145. count3++;
  146. }
  147. else if ("二级库存".Equals(status))
  148. {
  149. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  150. coilWgtSum4 += actWgt1;
  151. count4++;
  152. }
  153. else if ("重卷作业待机".Equals(status))
  154. {
  155. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  156. coilWgtSum5 += actWgt1;
  157. count5++;
  158. }
  159. else if ("综合判定待机".Equals(status))
  160. {
  161. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  162. coilWgtSum6 += actWgt1;
  163. count6++;
  164. }
  165. else if ("重卷指示待机".Equals(status))
  166. {
  167. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  168. coilWgtSum7 += actWgt1;
  169. count7++;
  170. }
  171. else if ("包装作业待机".Equals(status))
  172. {
  173. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  174. coilWgtSum8 += actWgt1;
  175. count8++;
  176. }
  177. }
  178. catch (Exception e)
  179. {
  180. }
  181. }
  182. this.textBox1.Text = coilCount.ToString();
  183. this.textBox2.Text = (coilWgtSum / 1000).ToString();
  184. this.textBox10.Text = count1.ToString();
  185. this.textBox12.Text = (coilWgtSum1 / 1000).ToString();
  186. this.textBox14.Text = count2.ToString();
  187. this.textBox13.Text = (coilWgtSum2 / 1000).ToString();
  188. this.textBox18.Text = count4.ToString();
  189. this.textBox17.Text = (coilWgtSum4 / 1000).ToString();
  190. this.textBox16.Text = count3.ToString();
  191. this.textBox15.Text = (coilWgtSum3 / 1000).ToString();
  192. this.textBox22.Text = count5.ToString();
  193. this.textBox21.Text = (coilWgtSum5 / 1000).ToString();
  194. this.textBox20.Text = count6.ToString();
  195. this.textBox19.Text = (coilWgtSum6 / 1000).ToString();
  196. this.textBox24.Text = count8.ToString();
  197. this.textBox23.Text = (coilWgtSum8 / 1000).ToString();
  198. this.textBox26.Text = count7.ToString();
  199. this.textBox25.Text = (coilWgtSum7 / 1000).ToString();
  200. }
  201. catch (Exception EX)
  202. {
  203. MessageBox.Show(EX.ToString());
  204. }
  205. }
  206. private void UIM010232_Load(object sender, EventArgs e)
  207. {
  208. this.ultraDateTimeEditor1.Value = "";
  209. this.ultraDateTimeEditor2.Value = "";
  210. this.ultraDateTimeEditor3.Value = "";
  211. this.ultraDateTimeEditor4.Value = "";
  212. }
  213. private void DoExport()
  214. {
  215. try
  216. {
  217. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  218. {
  219. string fileName = this.saveFileDialog1.FileName;
  220. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  221. System.Diagnostics.Process.Start(fileName);
  222. }
  223. }
  224. catch (Exception EX)
  225. {
  226. MessageBox.Show(EX.ToString());
  227. }
  228. }
  229. }
  230. }