810ad4f1d2056d738dbcf496e8e7d4dc0d2a619c.svn-base 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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. using System.Collections;
  11. namespace Core.LZMes.Client.UIM
  12. {
  13. public partial class UIM070010 : FrmBase
  14. {
  15. public UIM070010()
  16. {
  17. InitializeComponent();
  18. }
  19. public override void ToolBar_Click(object sender, string ToolbarKey)
  20. {
  21. switch (ToolbarKey)
  22. {
  23. case "Query":
  24. this.DoQuery();
  25. break;
  26. case "Export":
  27. this.Export();
  28. break;
  29. case "Exportd":
  30. this.Exportd();
  31. break;
  32. case "Save":
  33. this.DoSave();
  34. break;
  35. }
  36. }
  37. /// <summary>
  38. /// 查询原料库库存数据
  39. /// </summary>
  40. private void DoQuery()
  41. {
  42. try
  43. {
  44. this.dataSet1.Tables[0].Clear();
  45. this.dataSet1.Tables[1].Clear();
  46. string startTime = this.ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";//入库开始时间
  47. string endTime = this.ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : "";//入库结束时间
  48. string specStlGrd = this.textBox3.Text.Trim();//牌号
  49. string coilWthMin = this.textBox4.Text.Trim();//宽度最小值
  50. string coilWthMax = this.textBox5.Text.Trim();//宽度最大值
  51. string coilThkMin = this.textBox6.Text.Trim();//厚度最小值
  52. string coilThkMax = this.textBox7.Text.Trim();//厚度最大值
  53. string curLoadLoc = this.textBox8.Text.Trim();//垛位
  54. string coilNo = this.textBox9.Text.Trim();//钢卷号
  55. string ordNo = this.textBox11.Text.Trim();//订单号
  56. string ordSeq = "";// this.textBox12.Text;//合同
  57. string ordFl ="8"; //订单区分,默认为8
  58. if (this.ultraComboEditor5.Text != "")
  59. {
  60. ordFl =this.ultraComboEditor5.Value.ToString();
  61. }
  62. string devlmtDate = this.ultraDateTimeEditor3.Value != null ? ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") : "";//交货期
  63. string progCd = -1 == this.ultraComboEditor2.SelectedIndex ? "" : this.ultraComboEditor2.Value.ToString();//进程状态
  64. string smptime = this.ultraDateTimeEditor4.Value != null ? ultraDateTimeEditor4.DateTime.ToString("yyyyMMdd") : "";//送样时间
  65. string isspm = -1 == this.ultraComboEditor4.SelectedIndex ? "" : this.ultraComboEditor4.Value.ToString();//是否平整
  66. string xsqy = this.textBox10.Text.Trim();//销售区域
  67. string cpcoil = -1 == this.ultraComboEditor6.SelectedIndex ? "" : this.ultraComboEditor6.Value.ToString();//次品区分
  68. string dlivtp = -1 == this.ultraComboEditor1.SelectedIndex ? "" : this.ultraComboEditor1.Value.ToString();//运输方式
  69. string prodline = -1 == this.ultraComboEditor3.SelectedIndex ? "" : this.ultraComboEditor3.Value.ToString();//产线
  70. string ordxz = -1 == this.ultraComboEditor7.SelectedIndex ? "" : this.ultraComboEditor7.Value.ToString();//合同类型性质
  71. string rollmin = this.textBox12.Text.Trim();//轧辊单元最小
  72. string rollmax = this.textBox13.Text.Trim();//单元最大
  73. string[] queryParams = new string[] { startTime, endTime, specStlGrd, coilWthMin, coilWthMax,
  74. coilThkMin, coilThkMax, curLoadLoc, coilNo, ordNo, devlmtDate, progCd,smptime, isspm,xsqy, cpcoil,dlivtp, prodline,ordxz,rollmin,rollmax };
  75. List<string[]> list = new List<String[]>();
  76. list.Add(queryParams);
  77. CoreClientParam ccp = new CoreClientParam();
  78. ccp.ServerName = "UIM.UIM07.UIM070010";
  79. ccp.MethodName = "queryHYardList";
  80. ccp.ServerParams = new object[] { list };
  81. ccp.SourceDataTable = this.dataSet1.Tables[0];
  82. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  83. CoreClientParam ccpc = new CoreClientParam();
  84. ccpc.ServerName = "UIM.UIM07.UIM070010";
  85. ccpc.MethodName = "queryHYardListCount";
  86. ccpc.ServerParams = new object[] { list };
  87. ccpc.SourceDataTable = this.dataSet1.Tables[1];
  88. this.ExecuteQueryToDataTable(ccpc, CoreInvokeType.Internal);
  89. /*
  90. Color color = Color.FromArgb(255, 255, 255);
  91. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  92. {
  93. string status = ugr.Cells["TOT_DEC_GRD"].Value.ToString().Trim();
  94. string befstl = ugr.Cells["BEF_SPEC_STL_GRD"].Value.ToString().Trim();
  95. string stl = ugr.Cells["SPEC_STL_GRD"].Value.ToString().Trim();
  96. if ("合格".Equals(status))
  97. {
  98. color = Color.White;
  99. }
  100. else if ("不合格".Equals(status))
  101. {
  102. color = Color.FromArgb(255, 128, 128);
  103. }
  104. else
  105. {
  106. color = Color.SandyBrown;
  107. }
  108. if (befstl!=stl)
  109. {
  110. color = Color.Gold;
  111. }
  112. ugr.Appearance.BackColor = color;
  113. }
  114. */
  115. //统计钢卷数量,钢卷总重量
  116. int coilCount = (int)dataSet1.Tables[0].Compute("count(OLD_SAMPL_NO)", "");
  117. double coilWgtSum = 0;
  118. foreach (DataRow dr in dataSet1.Tables[0].Rows)
  119. {
  120. double tmpWgt = 0;
  121. try
  122. {
  123. tmpWgt = double.Parse(dr["ACT_WGT"].ToString());
  124. }
  125. catch (Exception e)
  126. {
  127. }
  128. coilWgtSum += tmpWgt;
  129. }
  130. double coilWgtSum1 = 0; int count1 = 0;
  131. double coilWgtSum2 = 0; int count2 = 0;
  132. double coilWgtSum3 = 0; int count3 = 0;
  133. double coilWgtSum4 = 0; int count4 = 0;
  134. double coilWgtSum5 = 0; int count5 = 0;
  135. double coilWgtSum6 = 0; int count6 = 0;
  136. double coilWgtSum7 = 0; int count7 = 0;
  137. foreach(Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  138. {
  139. double actWgt1 = 0;
  140. try
  141. {
  142. string status = ugr.Cells["CUR_PROG_CD"].Value.ToString().Trim();
  143. if ("发货指示待机".Equals(status))
  144. {
  145. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  146. coilWgtSum1 += actWgt1;
  147. count1++;
  148. }
  149. else if ("综合判定待机".Equals(status))
  150. {
  151. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  152. coilWgtSum2 += actWgt1;
  153. count2++;
  154. }
  155. else if ("钢卷充当待机".Equals(status))
  156. {
  157. count3++;
  158. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  159. coilWgtSum3 += actWgt1;
  160. }
  161. else if ("运送待机".Equals(status))
  162. {
  163. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  164. coilWgtSum4 += actWgt1;
  165. count4++;
  166. }
  167. else if ("平整作业待机".Equals(status))
  168. {
  169. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  170. coilWgtSum5 += actWgt1;
  171. count5++;
  172. }
  173. else if ("移送待机".Equals(status))
  174. {
  175. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  176. coilWgtSum6 += actWgt1;
  177. count6++;
  178. }
  179. else if ("平整指示待机".Equals(status))
  180. {
  181. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  182. coilWgtSum7 += actWgt1;
  183. count7++;
  184. }
  185. }
  186. catch (Exception e)
  187. {
  188. }
  189. }
  190. //this.textBox1.Text = coilCount.ToString();
  191. //this.textBox2.Text = (coilWgtSum / 1000).ToString();
  192. //this.textBox14.Text = count1.ToString();
  193. //this.textBox15.Text = (coilWgtSum1 / 1000).ToString();
  194. //this.textBox16.Text = count2.ToString();
  195. //this.textBox17.Text = (coilWgtSum2 / 1000).ToString();
  196. //this.textBox18.Text = count3.ToString();
  197. //this.textBox19.Text = (coilWgtSum3 / 1000).ToString();
  198. //this.textBox20.Text = count4.ToString();
  199. //this.textBox21.Text = (coilWgtSum4 / 1000).ToString();
  200. //this.textBox22.Text = count5.ToString();
  201. //this.textBox23.Text = (coilWgtSum5 / 1000).ToString();
  202. //this.textBox24.Text = count6.ToString();
  203. //this.textBox25.Text = (coilWgtSum6 / 1000).ToString();
  204. //this.textBox26.Text = count7.ToString();
  205. //this.textBox27.Text = (coilWgtSum7 / 1000).ToString();
  206. }
  207. catch (Exception EX)
  208. {
  209. MessageBox.Show(EX.ToString());
  210. }
  211. }
  212. /// <summary>
  213. /// 导出EXCEL
  214. /// </summary>
  215. private void Export()
  216. {
  217. try
  218. {
  219. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  220. {
  221. string fileName = this.saveFileDialog1.FileName;
  222. this.ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  223. System.Diagnostics.Process.Start(fileName);
  224. }
  225. }
  226. catch (Exception ex)
  227. {
  228. MessageBox.Show(ex.ToString());
  229. }
  230. }
  231. /// <summary>
  232. /// 导出EXCEL
  233. /// </summary>
  234. private void Exportd()
  235. {
  236. try
  237. {
  238. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  239. {
  240. string fileName = this.saveFileDialog1.FileName;
  241. this.ultraGridExcelExporter1.Export(ultraGrid2, fileName);
  242. System.Diagnostics.Process.Start(fileName);
  243. }
  244. }
  245. catch (Exception ex)
  246. {
  247. MessageBox.Show(ex.ToString());
  248. }
  249. }
  250. private void UIM070010_Load(object sender, EventArgs e)
  251. {
  252. this.ultraDateTimeEditor1.Value = "" ;
  253. this.ultraDateTimeEditor2.Value = "";
  254. this.ultraDateTimeEditor3.Value = "";
  255. this.ultraDateTimeEditor4.Value = "";
  256. }
  257. private void DoSave()
  258. {
  259. Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
  260. ArrayList list = new ArrayList();
  261. string[] param = null;
  262. CoreClientParam ccp = new CoreClientParam();
  263. rs = this.ultraGrid1.Rows;
  264. for (int i = 0; i < rs.Count; i++)
  265. {
  266. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  267. {
  268. param = new string[2];
  269. param[0] = rs[i].Cells["LZBZ"].Text.ToString().Trim();
  270. param[1] = rs[i].Cells["OLD_SAMPL_NO"].Value.ToString().Trim();
  271. list.Add(param);
  272. }
  273. }
  274. ccp.ServerName = "UIM.UIM070010";
  275. ccp.MethodName = "addLzbz";
  276. ccp.ServerParams = new Object[] { list };
  277. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  278. }
  279. private void ultraGrid1_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  280. {
  281. try
  282. {
  283. if (this.ultraGrid1.ActiveRow != null)
  284. {
  285. string COIL_NO = Convert.ToString(Common.FixDBManager.CheckNullStr(this.ultraGrid1.ActiveRow.Cells["H_COIL_NO"].Value));
  286. UIM010081C frm = new UIM010081C();
  287. frm.ob = this.ob;
  288. frm.Condition = COIL_NO;
  289. frm.ShowDialog();
  290. //Core.LZMes.Client.UIB.UIB010301 frm = new Core.LZMes.Client.UIB.UIB010301();
  291. //frm.ob = this.ob;
  292. //frm.OrderNO = Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.ActiveRow.Cells["ORD_NO"].Value);
  293. //frm.OrderSEQ = Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.ActiveRow.Cells["ORD_SEQ"].Value); ;
  294. //frm.ShowDialog();
  295. }
  296. }
  297. catch (System.Exception ex)
  298. {
  299. System.Diagnostics.Debug.WriteLine(ex.ToString());
  300. }
  301. }
  302. }
  303. }