fea0c142dc376c107d845043eed04f299640076e.svn-base 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  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. using Infragistics.Win.UltraWinGrid;
  12. namespace Core.LZMes.Client.UIN
  13. {
  14. public partial class UIN060410 : FrmBase
  15. {
  16. public UIN060410()
  17. {
  18. InitializeComponent();
  19. }
  20. /// <summary>
  21. /// 初始化
  22. /// </summary>
  23. #region "Init"
  24. #endregion
  25. /// <summary>
  26. /// 操作方法 查询
  27. /// </summary>
  28. private void DoQuery()
  29. {
  30. try
  31. {
  32. this.dataSet1.Tables[0].Clear();
  33. string calNO = Convert.ToString(Common.FixDBManager.CheckNullStr(this.textOrdNO.Text));
  34. string DelToDateFrom = Convert.ToString(Common.FixDBManager.CheckNullStr(this.DelToDateFrom.DateTime.ToString("yyyyMMdd"))) + textBox1.Text.Substring(0,2);
  35. string DelToDateTo = Convert.ToString(Common.FixDBManager.CheckNullStr(this.DelToDateTo.DateTime.ToString("yyyyMMdd")))+textBox2.Text.Substring(0,2);
  36. CoreClientParam ccp = new CoreClientParam();
  37. ccp.ServerName = "UIB.COM.ComDBQuery";
  38. ccp.MethodName = "doSimpleQuery";
  39. ArrayList paramArray = new ArrayList();
  40. paramArray.Add("UIN060410_01.Select");
  41. paramArray.Add(DelToDateFrom);
  42. paramArray.Add(DelToDateTo);
  43. paramArray.Add(calNO);
  44. ccp.ServerParams = new object[] { paramArray };
  45. ccp.SourceDataTable = this.dataSet1.Tables[0];
  46. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  47. System.Diagnostics.Debug.WriteLine(this.dataSet1.Tables[0].ToString());
  48. for (int a = 0; a < this.ultraGrid1.Rows.Count; a++)
  49. {
  50. string zl = Convert.ToString(Common.FixDBManager.CheckNullStr(this.ultraGrid1.Rows[a].Cells["ACT_WGT"].Text.ToString()));
  51. if (zl == "") zl = "0";
  52. // double b = double.Parse(this.ultraGrid1.Rows[a].Cells["COIL_WGT"].Text.ToString());
  53. double b = double.Parse(zl);
  54. string c = this.ultraGrid1.Rows[a].Cells["OLD_SAMPL_NO"].Text.ToString();
  55. double h = double.Parse(this.ultraGrid1.Rows[a].Cells["ENT_COIL_WGT"].Value.ToString());
  56. for (int d = a + 1; d <= this.ultraGrid1.Rows.Count - 1; d++)
  57. {
  58. string zl2 = Convert.ToString(Common.FixDBManager.CheckNullStr(this.ultraGrid1.Rows[d].Cells["ACT_WGT"].Text.ToString()));
  59. if (zl2 == "") zl2 = "0";
  60. // double e = double.Parse(this.ultraGrid1.Rows[d].Cells["COIL_WGT"].Text.ToString());
  61. double e = double.Parse(zl2);
  62. string f = this.ultraGrid1.Rows[d].Cells["OLD_SAMPL_NO"].Text.ToString();
  63. if (f.Substring(0, 12) == c.Substring(0, 12))
  64. {
  65. b = b + e;
  66. a = d;
  67. }
  68. else break;
  69. }
  70. double g = b / h * 100;
  71. this.ultraGrid1.Rows[a].Cells["CHENGCAILV"].Value = g.ToString("f2");
  72. }
  73. double sumwgt=0;
  74. double sumwgt1 = 0;
  75. int count1=0;
  76. for (int a = 0; a < this.ultraGrid1.Rows.Count; a++)
  77. {
  78. string zl = Convert.ToString(Common.FixDBManager.CheckNullStr(this.ultraGrid1.Rows[a].Cells["ACT_WGT"].Text.ToString()));
  79. string bp = Convert.ToString(Common.FixDBManager.CheckNullStr(this.ultraGrid1.Rows[a].Cells["ENT_COIL_WGT"].Text.ToString()));
  80. if (zl == "") zl = "0";
  81. double b = double.Parse(zl);
  82. sumwgt += b;
  83. if (bp == "") bp = "0";
  84. double z = double.Parse(bp);
  85. sumwgt1 += z;
  86. count1++;
  87. }
  88. this.textBox10.Text = count1.ToString();
  89. this.textBox12.Text = sumwgt.ToString();
  90. double ccl = sumwgt / sumwgt1;
  91. this.textBox3.Text = Math.Round(ccl * 100, 2).ToString();
  92. }
  93. catch (Exception EX)
  94. {
  95. MessageBox.Show(EX.ToString());
  96. }
  97. }
  98. /// <summary>
  99. /// 操作方法 保存班次组信息
  100. /// </summary>
  101. private void DoSave()
  102. {
  103. try
  104. {
  105. string strQueryFlag = "Y";
  106. this.ultraGrid1.UpdateData();
  107. DataRow[] selectedRows = dataSet1.Tables[0].Select("CHK ='True'");
  108. for (int i = 0; i < selectedRows.Length; i++)
  109. {
  110. string regid = this.UserInfo.GetUserID();
  111. string regshift = this.UserInfo.GetUserOrder();
  112. string reggroup = this.UserInfo.GetUserGroup();
  113. string coilno = Convert.ToString(Common.FixDBManager.CheckNullStr(selectedRows[i]["OLD_SAMPL_NO"]));
  114. string cutEdgeYN = Convert.ToString(Common.FixDBManager.CheckNullStr(selectedRows[i]["CUT_EDGE_YN"]));
  115. string millDtime = Convert.ToString(Common.FixDBManager.CheckNullStr(selectedRows[i]["MILL_DTIME"]));
  116. string isHead = Convert.ToString(Common.FixDBManager.CheckNullStr(selectedRows[i]["ISHEAD"]));
  117. if (millDtime.Length != 14)//长度
  118. {
  119. strQueryFlag = "N";
  120. MessageBox.Show("警告,钢卷" + coilno + "录入的日期长度" + millDtime + "错误,禁止保存", "提示");
  121. return;
  122. }
  123. if (Convert.ToInt16(millDtime.Substring(4, 2)) > 12) //月
  124. {
  125. strQueryFlag = "N";
  126. MessageBox.Show("警告,钢卷" + coilno + "录入的日期【月】" + millDtime + "错误,禁止保存", "提示");
  127. return;
  128. }
  129. if (Convert.ToInt16(millDtime.Substring(6, 2)) > 31) //日
  130. {
  131. strQueryFlag = "N";
  132. MessageBox.Show("警告,钢卷" + coilno + "录入的日期【日】" + millDtime + "错误,禁止保存", "提示");
  133. return;
  134. }
  135. if (Convert.ToInt16(millDtime.Substring(8, 2)) > 24) //小时
  136. {
  137. strQueryFlag = "N";
  138. MessageBox.Show("警告,钢卷" + coilno + "录入的日期【时】" + millDtime + "错误,禁止保存", "提示");
  139. return;
  140. }
  141. if (Convert.ToInt16(millDtime.Substring(10, 2)) > 59)//分
  142. {
  143. strQueryFlag = "N";
  144. MessageBox.Show("警告,钢卷" + coilno + "录入的日期【分】" + millDtime + "错误,禁止保存", "提示");
  145. return;
  146. }
  147. if (Convert.ToInt16(millDtime.Substring(12, 2)) > 59)//秒
  148. {
  149. strQueryFlag = "N";
  150. MessageBox.Show("警告,钢卷" + coilno + "录入的日期【秒】" + millDtime + "错误,禁止保存", "提示");
  151. return;
  152. }
  153. CoreClientParam ccp = new CoreClientParam();
  154. ccp.ServerName = "UIB.COM.ComDBSave";
  155. ccp.MethodName = "doXmlSave";
  156. ArrayList paramArray = new ArrayList();
  157. paramArray.Add("UIN060410_shift.Update");
  158. paramArray.Add(regid);
  159. paramArray.Add(regshift);
  160. paramArray.Add(reggroup);
  161. paramArray.Add(cutEdgeYN);
  162. paramArray.Add(isHead);
  163. paramArray.Add(millDtime);
  164. paramArray.Add(coilno);
  165. ccp.ServerParams = new object[] { paramArray };
  166. ccp.SourceDataTable = this.dataSet1.Tables[0];
  167. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  168. }
  169. if (strQueryFlag == "Y")
  170. {
  171. this.DoQuery();
  172. }
  173. }
  174. catch (Exception ex)
  175. {
  176. System.Diagnostics.Debug.WriteLine(ex.ToString());
  177. }
  178. }
  179. private void DoExport()
  180. {
  181. try
  182. {
  183. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  184. {
  185. string fileName = this.saveFileDialog1.FileName;
  186. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  187. //System.Diagnostics.Process.Start(fileName);
  188. }
  189. }
  190. catch (Exception EX)
  191. {
  192. MessageBox.Show(EX.ToString());
  193. }
  194. }
  195. /// <summary>
  196. /// 事件方法:
  197. /// </summary>
  198. /// <param name="sender"></param>
  199. /// <param name="e"></param>
  200. #region "EVENT 事件"
  201. private void UIN060120_Load(object sender, EventArgs e)
  202. {
  203. }
  204. public override void ToolBar_Click(object sender, string ToolbarKey)
  205. {
  206. switch (ToolbarKey)
  207. {
  208. case "Query":
  209. this.DoQuery();
  210. break;
  211. case "Save":
  212. //this.DoSave();
  213. break;
  214. case "Export":
  215. this.DoExport();
  216. break;
  217. case "Exit":
  218. this.Close();
  219. break;
  220. }
  221. }
  222. private void ComboCalNO_ValueChanged(object sender, EventArgs e)
  223. {
  224. this.DoQuery();
  225. }
  226. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  227. {
  228. try
  229. {
  230. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Rows)
  231. {
  232. ugr.Cells["CHK"].Value = this.checkBox1.Checked;
  233. ugr.Update();
  234. }
  235. }
  236. catch (Exception ex)
  237. {
  238. System.Diagnostics.Debug.WriteLine(ex.ToString());
  239. }
  240. }
  241. #endregion
  242. private void ultraGrid1_AfterRowFilterChanged(object sender, Infragistics.Win.UltraWinGrid.AfterRowFilterChangedEventArgs e)
  243. {
  244. double c=0;
  245. double bp = 0;
  246. foreach (UltraGridRow ugr in this.ultraGrid1.Rows.Where(p => p.IsFilteredOut == false).ToList())
  247. {
  248. string zl = Convert.ToString(Common.FixDBManager.CheckNullStr(ugr.Cells["ACT_WGT"].Text.ToString()));//ENT_COIL_WGT
  249. string bpzl = Convert.ToString(Common.FixDBManager.CheckNullStr(ugr.Cells["ENT_COIL_WGT"].Text.ToString()));//ENT_COIL_WGT
  250. if (zl == "") zl = "0";
  251. double b = double.Parse(zl);
  252. c = c + b;
  253. if (bpzl == "") bpzl = "0";
  254. double bpp = double.Parse(bpzl);
  255. bp = bp + bpp;
  256. }
  257. double ccl = c / bp;
  258. this.textBox3.Text = Math.Round(ccl*100, 2).ToString();
  259. }
  260. }
  261. }