FrmStatistical.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.Mcp.Control.Base;
  5. using CoreFS.CA06;
  6. using Infragistics.Win.UltraWinGrid;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.ComponentModel;
  10. using System.Data;
  11. using System.Drawing;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. namespace Core.StlMes.Client.Mcp.Treatment.Report
  16. {
  17. public partial class FrmStatistical : FrmBase
  18. {
  19. private string _plineCode = "";
  20. //private string _startime = "";
  21. //private string _endtime = "";
  22. private string bc = "";
  23. private string bz = "";
  24. private int days = 0;
  25. private string effic = "";
  26. private string effic1 = "";
  27. private string effic2 = "";
  28. public FrmStatistical(string plineCode, OpeBase _ob)
  29. {
  30. InitializeComponent();
  31. _plineCode = plineCode;
  32. //_startime = startime;
  33. //_endtime = endtime;
  34. this.ob = _ob;
  35. }
  36. protected override void OnLoad(EventArgs e)
  37. {
  38. base.OnLoad(e);
  39. this.statisticalControl1.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  40. this.statisticalControl2.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  41. this.statisticalControl3.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  42. }
  43. private void FrmStatistical_Load(object sender, EventArgs e)
  44. {
  45. dateDayTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
  46. bc = this.UserInfo.GetUserOrder();
  47. bz = this.UserInfo.GetUserGroup();
  48. txtBc.Text = this.UserInfo.GetUserOrderText();
  49. txtBz.Text = this.UserInfo.GetUserGroupText();
  50. days = System.Threading.Thread.CurrentThread.CurrentUICulture.Calendar.GetDaysInMonth(DateTime.Now.Year, DateTime.Now.Month);
  51. doOutlibrary();
  52. }
  53. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  54. {
  55. switch (e.Tool.Key)
  56. {
  57. case "Outlibrary"://查询
  58. doOutlibrary();
  59. break;
  60. case "ClassPint"://班报打印
  61. doClassPint();
  62. break;
  63. case "DayPrint"://日报打印
  64. doDayPrint();
  65. break;
  66. case "MonthPrint"://月报打印
  67. doMonthPrint();
  68. break;
  69. case "Close":
  70. this.Close();
  71. break;
  72. default:
  73. break;
  74. }
  75. }
  76. private void doOutlibrary()
  77. {
  78. //月
  79. string fistMonthD = "";
  80. //string lastMonthD = "";
  81. //日
  82. string fistday = "";
  83. //string lastday = "";
  84. //DateTime t = DateTime.Parse(dateDayTime.Value.ToString());
  85. //DateTime t1 = new DateTime(t.Year, t.Month, 1);
  86. fistMonthD =dateDayTime.Value.ToString("yyyyMM");
  87. fistday = dateDayTime.Value.ToString("yyyyMMdd");
  88. //lastday = dateDayTime.Value.ToString("yyyyMMdd");
  89. //查询当班生产实绩
  90. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmHttControlLog.doQueryActual", new object[] { fistday, bc, _plineCode }, this.ob);
  91. if (dt != null && dt.Rows.Count > 0)
  92. {
  93. DataRow row = dt.Rows[0];
  94. this.statisticalControl1.Value.JudgeStoveNo = row["JUDGE_STOVE_NO"].ToString();
  95. this.statisticalControl1.Value.QualifiedNum = row["QUALIFIED_NUM"].ToString();
  96. this.statisticalControl1.Value.QualifiedWt = row["QUALIFIED_WT"].ToString();
  97. this.statisticalControl1.Value.Minutes = row["MINUTES"].ToString();
  98. this.statisticalControl1.Value.AbaMinutes = row["ABSMINUTES"].ToString();
  99. this.statisticalControl1.Value.SumMinutes = row["SUMMINUTES"].ToString();
  100. double feizi = double.Parse(row["YOUMINUTES"].ToString()) - double.Parse(row["SUMMINUTES"].ToString());
  101. double feimu = double.Parse(row["YOUMINUTES"].ToString());
  102. if (feizi <= 0 || row["JUDGE_STOVE_NO"].ToString().Equals("0"))
  103. {
  104. effic = "0";
  105. }
  106. else
  107. {
  108. effic = ((feizi / feimu) * 100).ToString("f2");
  109. }
  110. this.statisticalControl1.Value.Effic = effic+"%";
  111. this.statisticalControl1.UpdateData();
  112. }
  113. else
  114. {
  115. StatisticalClass result = new StatisticalClass();
  116. this.statisticalControl1.Value = result;
  117. }
  118. //查询当天生产实绩
  119. DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmHttControlLog.doQueryDayActual",
  120. new object[] {fistday, _plineCode }, this.ob);
  121. if (dt1 != null && dt1.Rows.Count > 0)
  122. {
  123. //if (!dt1.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  124. //{
  125. DataRow row1 = dt1.Rows[0];
  126. this.statisticalControl2.Value.JudgeStoveNo = row1["JUDGE_STOVE_NO"].ToString();
  127. this.statisticalControl2.Value.QualifiedNum = row1["QUALIFIED_NUM"].ToString();
  128. this.statisticalControl2.Value.QualifiedWt = row1["QUALIFIED_WT"].ToString();
  129. this.statisticalControl2.Value.Minutes = row1["MINUTES"].ToString();
  130. this.statisticalControl2.Value.AbaMinutes = row1["ABSMINUTES"].ToString();
  131. this.statisticalControl2.Value.SumMinutes = row1["SUMMINUTES"].ToString();
  132. double feizi = double.Parse(row1["YOUMINUTES"].ToString()) - double.Parse(row1["SUMMINUTES"].ToString());
  133. double feimu = double.Parse(row1["YOUMINUTES"].ToString());
  134. if (feizi <= 0 || row1["JUDGE_STOVE_NO"].ToString().Equals("0"))
  135. {
  136. effic1 = "0";
  137. }
  138. else
  139. {
  140. effic1 = ((feizi / feimu) * 100).ToString("f2");
  141. }
  142. this.statisticalControl2.Value.Effic = effic1 + "%";
  143. this.statisticalControl2.UpdateData();
  144. //}
  145. //else
  146. //{
  147. // StatisticalClass result = new StatisticalClass();
  148. // this.statisticalControl2.Value = result;
  149. //}
  150. }
  151. else
  152. {
  153. StatisticalClass result = new StatisticalClass();
  154. this.statisticalControl2.Value = result;
  155. }
  156. //查询当月生产实绩
  157. DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmHttControlLog.doQueryMonthActual", new object[] { fistMonthD, _plineCode }, this.ob);
  158. if (dt2 != null && dt2.Rows.Count > 0)
  159. {
  160. //if (!dt2.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  161. //{
  162. DataRow row2 = dt2.Rows[0];
  163. this.statisticalControl3.Value.JudgeStoveNo = row2["JUDGE_STOVE_NO"].ToString();
  164. this.statisticalControl3.Value.QualifiedNum = row2["QUALIFIED_NUM"].ToString();
  165. this.statisticalControl3.Value.QualifiedWt = row2["QUALIFIED_WT"].ToString();
  166. this.statisticalControl3.Value.Minutes = row2["MINUTES"].ToString();
  167. this.statisticalControl3.Value.AbaMinutes = row2["ABSMINUTES"].ToString();
  168. this.statisticalControl3.Value.SumMinutes = row2["SUMMINUTES"].ToString();
  169. double feizi = double.Parse(row2["YOUMINUTES"].ToString()) - double.Parse(row2["SUMMINUTES"].ToString());
  170. double feimu = double.Parse(row2["YOUMINUTES"].ToString());
  171. if (feizi <= 0 || row2["JUDGE_STOVE_NO"].ToString().Equals("0"))
  172. {
  173. effic2 = "0";
  174. }
  175. else
  176. {
  177. effic2 = ((feizi / feimu) * 100).ToString("f2");
  178. }
  179. this.statisticalControl3.Value.Effic = effic2 + "%";
  180. this.statisticalControl3.UpdateData();
  181. //}
  182. //else
  183. //{
  184. // StatisticalClass result = new StatisticalClass();
  185. // this.statisticalControl3.Value = result;
  186. //}
  187. }
  188. else
  189. {
  190. StatisticalClass result = new StatisticalClass();
  191. this.statisticalControl3.Value = result;
  192. }
  193. }
  194. /// <summary>
  195. /// 班报打印
  196. /// </summary>
  197. private void doClassPint()
  198. {
  199. doOutlibrary();
  200. //日
  201. string fistday = "";
  202. //string lastday = "";
  203. fistday = dateDayTime.Value.ToString("yyyyMMdd");
  204. //lastday = dateDayTime.Value.ToString("yyyyMMdd");
  205. string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepScheduClass.cpt&__bypagesize__=false&PROBC=" + bc + "&PLINECODE=" + _plineCode + "&p1=" + effic + "&startTim=" + fistday + "";
  206. FrmRepExcel fre = new FrmRepExcel(this.ob, url);
  207. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  208. fre.Text = "调度班报统计";
  209. fre.ShowDialog();
  210. }
  211. /// <summary>
  212. /// 日报打印
  213. /// </summary>
  214. private void doDayPrint()
  215. {
  216. doOutlibrary();
  217. //日
  218. string fistday = "";
  219. //string lastday = "";
  220. fistday = dateDayTime.Value.ToString("yyyyMMdd");
  221. //lastday = dateDayTime.Value.ToString("yyyyMMdd");
  222. string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepScheduDay.cpt&__bypagesize__=false&PLINECODE=" + _plineCode + "&startTim=" + fistday + "&p1=" + effic1 + "";
  223. FrmRepExcel fre = new FrmRepExcel(this.ob, url);
  224. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  225. fre.Text = "调度日报统计";
  226. fre.ShowDialog();
  227. }
  228. /// <summary>
  229. /// 月报打印
  230. /// </summary>
  231. private void doMonthPrint()
  232. {
  233. doOutlibrary();
  234. //月
  235. string fistMonthD = "";
  236. //string lastMonthD = "";
  237. //DateTime t = DateTime.Parse(dateDayTime.Value.ToString());
  238. //DateTime t1 = new DateTime(t.Year, t.Month, 1);
  239. //lastMonthD = DateTime.Parse(t.ToString("yyyy-MM-dd 21:06")).ToString("yyyyMMdd");
  240. fistMonthD = dateDayTime.Value.ToString("yyyyMM");
  241. string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepScheduMonth.cpt&__bypagesize__=false&PLINECODE=" + _plineCode + "&startTim=" + fistMonthD + "&p1=" + effic2 + "";
  242. FrmRepExcel fre = new FrmRepExcel(this.ob, url);
  243. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  244. fre.Text = "调度月报统计";
  245. fre.ShowDialog();
  246. }
  247. }
  248. }