UIM070020.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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 UIM070020 : FrmBase
  14. {
  15. public UIM070020()
  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 "Save":
  30. this.DoSave();
  31. break;
  32. }
  33. }
  34. /// <summary>
  35. /// 查询原料库库存数据
  36. /// </summary>
  37. private void DoQuery()
  38. {
  39. try
  40. {
  41. this.dataSet1.Tables[0].Clear();
  42. string startTime = this.ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "19900101";//入库开始时间
  43. string endTime = this.ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : "";//入库结束时间
  44. string specStlGrd = this.textBox3.Text.Trim();//牌号
  45. string coilWthMin = this.textBox4.Text.Trim();//宽度最小值
  46. string coilWthMax = this.textBox5.Text.Trim();//宽度最大值
  47. string coilThkMin = this.textBox6.Text.Trim();//长度
  48. string coilThkMax = this.textBox7.Text.Trim();//长度
  49. string curLoadLoc = this.textBox8.Text.Trim();//垛位
  50. string coilNo = this.textBox9.Text.Trim();//板坯号
  51. string ordNo = this.textBox11.Text.Trim();//订单号
  52. string ordSeq = "";// this.textBox12.Text;//合同
  53. string ordFl =""; //订单区分,默认为8
  54. if (this.ultraComboEditor5.Text != "")
  55. {
  56. ordFl =this.ultraComboEditor5.Value.ToString();
  57. }
  58. string devlmtDate = this.ultraDateTimeEditor3.Value != null ? ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") : "";//交货期
  59. // string progCd = -1 == this.ultraComboEditor2.SelectedIndex ? "" : this.ultraComboEditor2.Value.ToString();//进程状态
  60. // string smptime = this.ultraDateTimeEditor4.Value != null ? ultraDateTimeEditor4.DateTime.ToString("yyyyMMdd") : "";//送样时间
  61. string isspm = -1 == this.ultraComboEditor4.SelectedIndex ? "" : this.ultraComboEditor4.Value.ToString();//是否平整
  62. string xsqy = this.textBox10.Text.Trim();//销售区域
  63. string cpcoil = -1 == this.ultraComboEditor6.SelectedIndex ? "" : this.ultraComboEditor6.Value.ToString();//次品区分
  64. string dlivtp = -1 == this.ultraComboEditor1.SelectedIndex ? "" : this.ultraComboEditor1.Value.ToString();//运输方式
  65. string prodline = -1 == this.ultraComboEditor3.SelectedIndex ? "" : this.ultraComboEditor3.Value.ToString();//产线
  66. string ordxz = -1 == this.ultraComboEditor7.SelectedIndex ? "" : this.ultraComboEditor7.Value.ToString();//合同类型性质
  67. string inyardkind = -1 == this.ultraComboEditor4.SelectedIndex ? "" : this.ultraComboEditor4.Value.ToString();//入库类型
  68. string slabrt = -1 == this.ultraComboEditor3.SelectedIndex ? "" : this.ultraComboEditor3.Value.ToString();//板坯去向
  69. string ingrkind = -1 == this.ultraComboEditor9.SelectedIndex ? "" : this.ultraComboEditor9.Value.ToString();//成分等级
  70. string iswarm = -1 == this.ultraComboEditor6.SelectedIndex ? "" : this.ultraComboEditor6.Value.ToString();//冷坑
  71. string zhuanlu = -1 == this.ultraComboEditor11.SelectedIndex ? "" : this.ultraComboEditor11.Value.ToString();//转炉
  72. string ccdenvo = -1 == this.ultraComboEditor10.SelectedIndex ? "" : this.ultraComboEditor10.Value.ToString();//铸机
  73. string ThkMin = this.textBox6.Text.Trim();//厚度
  74. string ThkMax = this.textBox7.Text.Trim();//厚度
  75. string[] queryParams = new string[] { coilNo, specStlGrd, curLoadLoc, coilThkMin, coilThkMax,
  76. ordNo, ordFl, inyardkind, slabrt, ingrkind, coilWthMin, coilWthMax, devlmtDate ,dlivtp,iswarm,startTime,endTime ,zhuanlu,ccdenvo ,xsqy ,ThkMin,ThkMax };
  77. this.dataSet1.Clear();
  78. ArrayList al = new ArrayList();
  79. al.Add("UIM070020_01.SELECT");
  80. al.Add(coilNo); al.Add(specStlGrd); al.Add(curLoadLoc); al.Add(coilThkMin); al.Add(coilThkMax); al.Add(ordNo); al.Add(ordFl);
  81. al.Add(inyardkind); al.Add(slabrt); al.Add(ingrkind); al.Add(coilWthMin);
  82. al.Add(coilWthMax); al.Add(devlmtDate); al.Add(dlivtp);
  83. al.Add(iswarm); al.Add(startTime); al.Add(endTime); al.Add(zhuanlu);
  84. al.Add(ccdenvo); al.Add(xsqy); al.Add(ThkMin); al.Add(ThkMax);
  85. CoreClientParam ccp = new CoreClientParam();
  86. ccp.ServerName = "UIB.COM.ComDBQuery";
  87. ccp.MethodName = "doSimpleQuery";
  88. ccp.ServerParams = new object[] { al };
  89. ccp.SourceDataTable = this.dataSet1.Tables[0];
  90. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  91. //统计钢卷数量,钢卷总重量
  92. int coilCount = (int)dataSet1.Tables[0].Compute("count(SLAB_NO)", "");
  93. double coilWgtSum = 0;
  94. double slabWgtSum = 0;
  95. string wgta = "";
  96. string wgtb = "";
  97. foreach (DataRow dr in dataSet1.Tables[0].Rows)
  98. {
  99. double tmpWgt = 0;
  100. double slabWgt = 0;
  101. wgta= dr["WEIGHT_WGT"].ToString() ;
  102. wgtb= dr["SLAB_WGT"].ToString();
  103. if (dr["WEIGHT_WGT"].ToString() == "")
  104. {
  105. wgta = "0";
  106. }
  107. if (dr["SLAB_WGT"].ToString() == "")
  108. {
  109. wgtb = "0";
  110. }
  111. try
  112. {
  113. tmpWgt = double.Parse(wgta);
  114. slabWgt = double.Parse(wgtb);
  115. }
  116. catch (Exception e)
  117. {
  118. }
  119. coilWgtSum += tmpWgt;
  120. slabWgtSum += slabWgt;
  121. }
  122. this.textBox1.Text = coilCount.ToString();
  123. this.textBox2.Text = coilWgtSum.ToString();
  124. this.textBox14.Text = (slabWgtSum/1000).ToString();
  125. /*List<string[]> list = new List<String[]>();
  126. list.Add(queryParams);
  127. CoreClientParam ccp = new CoreClientParam();
  128. ccp.ServerName = "UIM.UIM07.UIM070020";
  129. ccp.MethodName = "queryHYardList";
  130. ccp.ServerParams = new object[] { list };
  131. ccp.SourceDataTable = this.dataSet1.Tables[0];
  132. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);*/
  133. }
  134. catch (Exception EX)
  135. {
  136. MessageBox.Show(EX.ToString());
  137. }
  138. }
  139. /// <summary>
  140. /// 导出EXCEL
  141. /// </summary>
  142. private void Export()
  143. {
  144. try
  145. {
  146. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  147. {
  148. string fileName = this.saveFileDialog1.FileName;
  149. this.ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  150. System.Diagnostics.Process.Start(fileName);
  151. }
  152. }
  153. catch (Exception ex)
  154. {
  155. MessageBox.Show(ex.ToString());
  156. }
  157. }
  158. private void UIM070020_Load(object sender, EventArgs e)
  159. {
  160. this.ultraDateTimeEditor1.Value = "" ;
  161. this.ultraDateTimeEditor2.Value = "";
  162. this.ultraDateTimeEditor3.Value = "";
  163. }
  164. private void DoExport()
  165. {
  166. try
  167. {
  168. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  169. {
  170. string fileName = this.saveFileDialog1.FileName;
  171. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  172. System.Diagnostics.Process.Start(fileName);
  173. }
  174. }
  175. catch (Exception ex)
  176. {
  177. MessageBox.Show(ex.ToString());
  178. }
  179. }
  180. private void DoSave()
  181. {
  182. Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
  183. ArrayList list = new ArrayList();
  184. string[] param = null;
  185. CoreClientParam ccp = new CoreClientParam();
  186. rs = this.ultraGrid1.Rows;
  187. for (int i = 0; i < rs.Count; i++)
  188. {
  189. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  190. {
  191. param = new string[2];
  192. param[0] = rs[i].Cells["LZBZ"].Text.ToString().Trim();
  193. param[1] = rs[i].Cells["OLD_SAMPL_NO"].Value.ToString().Trim();
  194. list.Add(param);
  195. }
  196. }
  197. ccp.ServerName = "UIM.UIM070020";
  198. ccp.MethodName = "addLzbz";
  199. ccp.ServerParams = new Object[] { list };
  200. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  201. }
  202. private void ultraGrid1_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  203. {
  204. try
  205. {
  206. if (this.ultraGrid1.ActiveRow != null)
  207. {
  208. string COIL_NO = Convert.ToString(Common.FixDBManager.CheckNullStr(this.ultraGrid1.ActiveRow.Cells["H_COIL_NO"].Value));
  209. UIM010081C frm = new UIM010081C();
  210. frm.ob = this.ob;
  211. frm.Condition = COIL_NO;
  212. frm.ShowDialog();
  213. //Core.LZMes.Client.UIB.UIB010301 frm = new Core.LZMes.Client.UIB.UIB010301();
  214. //frm.ob = this.ob;
  215. //frm.OrderNO = Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.ActiveRow.Cells["ORD_NO"].Value);
  216. //frm.OrderSEQ = Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.ActiveRow.Cells["ORD_SEQ"].Value); ;
  217. //frm.ShowDialog();
  218. }
  219. }
  220. catch (System.Exception ex)
  221. {
  222. System.Diagnostics.Debug.WriteLine(ex.ToString());
  223. }
  224. }
  225. private void UIM070020_Load_1(object sender, EventArgs e)
  226. {
  227. this.ultraDateTimeEditor3.Value = null;
  228. this.ultraDateTimeEditor1.Value = null;
  229. }
  230. }
  231. }