FrmStatisticalPub.cs 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908
  1. 
  2. using Core.Mes.Client.Comm.Control;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.Mcp.Control.Base;
  6. using Core.StlMes.Client.Mcp.VRP.Entity;
  7. using CoreFS.CA06;
  8. using Infragistics.Win;
  9. using Infragistics.Win.UltraWinGrid;
  10. using System;
  11. using System.Collections.Generic;
  12. using System.ComponentModel;
  13. using System.Data;
  14. using System.Drawing;
  15. using System.Linq;
  16. using System.Text;
  17. using System.Windows.Forms;
  18. namespace Core.StlMes.Client.Mcp.VRP.Report
  19. {
  20. public partial class FrmStatisticalPub : FrmBase
  21. {
  22. private string _bc = "";
  23. private int days = 0;
  24. /// <summary>
  25. /// 720线
  26. /// </summary>
  27. private string effic720 = "";
  28. private string effic1720 = "";
  29. private string effic2720 = "";
  30. /// <summary>
  31. /// 冷轧
  32. /// </summary>
  33. private string efficlz = "";
  34. private string effic1lz = "";
  35. private string effic2lz = "";
  36. /// <summary>
  37. /// 冷拔
  38. /// </summary>
  39. private string efficlb = "";
  40. private string effic1lb = "";
  41. private string effic2lb = "";
  42. /// <summary>
  43. /// 镦粗
  44. /// </summary>
  45. private string efficdc = "";
  46. private string effic1dc = "";
  47. private string effic2dc = "";
  48. private string efficrk = "";
  49. private string effic1rk = "";
  50. private string effic2rk = "";
  51. public FrmStatisticalPub()
  52. {
  53. InitializeComponent();
  54. }
  55. protected override void OnLoad(EventArgs e)
  56. {
  57. base.OnLoad(e);
  58. this.statisticalControl1.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  59. this.statisticalControl2.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  60. this.statisticalControl3.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  61. this.statisticalControl4.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  62. this.statisticalControl5.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  63. this.statisticalControl6.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  64. this.statisticalControl7.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  65. this.statisticalControl8.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  66. this.statisticalControl9.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  67. this.statisticalControl10.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  68. this.statisticalControl11.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  69. this.statisticalControl12.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  70. this.statisticalControl13.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  71. this.statisticalControl14.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  72. this.statisticalControl15.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  73. }
  74. private void FrmStatisticalPub_Load(object sender, EventArgs e)
  75. {
  76. cmbBc.Value = this.UserInfo.GetUserOrder();
  77. //cmbBz.Value = this.UserInfo.GetUserGroup();
  78. dateDayTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
  79. days = System.Threading.Thread.CurrentThread.CurrentUICulture.Calendar.GetDaysInMonth(DateTime.Now.Year, DateTime.Now.Month);
  80. DataTable dt = dataTable1;
  81. dt.Columns.Add(new DataColumn("Month") { Caption = "停机汇总" });
  82. TubeRoll.GridColumnSum(ultraGrid3, new string[] { "Month" });
  83. for (int i = 0; i < days; i++)
  84. {
  85. string key = "DAY" + (i + 1);
  86. string name = (i + 1).ToString();
  87. dt.Columns.Add(new DataColumn(key) { Caption = name });
  88. TubeRoll.GridColumnSum(ultraGrid3, new string[] { key });
  89. }
  90. doOutlibrary();
  91. doMinutesQuery();
  92. }
  93. public override void ToolBar_Click(object sender, string ToolbarKey)
  94. {
  95. switch (ToolbarKey)
  96. {
  97. case "Outlibrary"://查询
  98. doOutlibrary();
  99. break;
  100. case "ClassPint"://班报打印
  101. doClassPint();
  102. break;
  103. case "DayPrint"://日报打印
  104. doDayPrint();
  105. break;
  106. case "MonthPrint"://月报打印
  107. doMonthPrint();
  108. break;
  109. case "Close":
  110. this.Close();
  111. break;
  112. default:
  113. break;
  114. }
  115. }
  116. private void doOutlibrary()
  117. {
  118. //月
  119. string fistMonthD = "";
  120. //日
  121. string fistday = "";
  122. fistMonthD = dateDayTime.Value.ToString("yyyyMM");
  123. fistday = dateDayTime.Value.ToString("yyyyMMdd");
  124. _bc = cmbBc.Value.ToString();
  125. //_bz = cmbBz.Value.ToString();
  126. #region 720旋扩
  127. //查询当班生产实绩
  128. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryActual", new object[] { fistday, _bc, "C018" }, this.ob);
  129. if (dt != null && dt.Rows.Count > 0)
  130. {
  131. //if (!dt.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  132. //{
  133. DataRow row = dt.Rows[0];
  134. this.statisticalControl6.Value.JudgeStoveNo = row["JUDGE_STOVE_NO"].ToString();
  135. this.statisticalControl6.Value.QualifiedNum = row["QUALIFIED_NUM"].ToString();
  136. this.statisticalControl6.Value.QualifiedWt = row["QUALIFIED_WT"].ToString();
  137. this.statisticalControl6.Value.Minutes = row["MINUTES"].ToString();
  138. this.statisticalControl6.Value.AbaMinutes = row["ABSMINUTES"].ToString();
  139. this.statisticalControl6.Value.SumMinutes = row["SUMMINUTES"].ToString();
  140. double feizi = double.Parse(row["YOUMINUTES"].ToString()) - double.Parse(row["SUMMINUTES"].ToString());
  141. double feimu = double.Parse(row["YOUMINUTES"].ToString());
  142. if (feizi <= 0 || dt.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  143. {
  144. effic720 = "0";
  145. }
  146. else
  147. {
  148. effic720 = ((feizi / feimu) * 100).ToString("f2");
  149. }
  150. this.statisticalControl6.Value.Effic = effic720 + "%";
  151. this.statisticalControl6.UpdateData();
  152. }
  153. else
  154. {
  155. StatisticalClass result = new StatisticalClass();
  156. this.statisticalControl6.Value = result;
  157. }
  158. //查询当天生产实绩
  159. DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryDayActual",
  160. new object[] { fistday, "C018" }, this.ob);
  161. if (dt1 != null && dt1.Rows.Count > 0)
  162. {
  163. //if (!dt1.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  164. //{
  165. DataRow row1 = dt1.Rows[0];
  166. this.statisticalControl4.Value.JudgeStoveNo = row1["JUDGE_STOVE_NO"].ToString();
  167. this.statisticalControl4.Value.QualifiedNum = row1["QUALIFIED_NUM"].ToString();
  168. this.statisticalControl4.Value.QualifiedWt = row1["QUALIFIED_WT"].ToString();
  169. this.statisticalControl4.Value.Minutes = row1["MINUTES"].ToString();
  170. this.statisticalControl4.Value.AbaMinutes = row1["ABSMINUTES"].ToString();
  171. this.statisticalControl4.Value.SumMinutes = row1["SUMMINUTES"].ToString();
  172. double feizi = double.Parse(row1["YOUMINUTES"].ToString()) - double.Parse(row1["SUMMINUTES"].ToString());
  173. double feimu = double.Parse(row1["YOUMINUTES"].ToString());
  174. if (feizi <= 0 || dt1.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  175. {
  176. effic1720 = "0";
  177. }
  178. else
  179. {
  180. effic1720 = ((feizi / feimu) * 100).ToString("f2");
  181. }
  182. this.statisticalControl4.Value.Effic = effic1720 + "%";
  183. this.statisticalControl4.UpdateData();
  184. }
  185. else
  186. {
  187. StatisticalClass result = new StatisticalClass();
  188. this.statisticalControl4.Value = result;
  189. }
  190. //查询当月生产实绩
  191. DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryMonthActual", new object[] { fistMonthD, "C018" }, this.ob);
  192. if (dt2 != null && dt2.Rows.Count > 0)
  193. {
  194. //if (!dt2.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  195. //{
  196. DataRow row2 = dt2.Rows[0];
  197. this.statisticalControl5.Value.JudgeStoveNo = row2["JUDGE_STOVE_NO"].ToString();
  198. this.statisticalControl5.Value.QualifiedNum = row2["QUALIFIED_NUM"].ToString();
  199. this.statisticalControl5.Value.QualifiedWt = row2["QUALIFIED_WT"].ToString();
  200. this.statisticalControl5.Value.Minutes = row2["MINUTES"].ToString();
  201. this.statisticalControl5.Value.AbaMinutes = row2["ABSMINUTES"].ToString();
  202. this.statisticalControl5.Value.SumMinutes = row2["SUMMINUTES"].ToString();
  203. double feizi = double.Parse(row2["YOUMINUTES"].ToString()) - double.Parse(row2["SUMMINUTES"].ToString());
  204. double feimu = double.Parse(row2["YOUMINUTES"].ToString());
  205. if (feizi <= 0 || dt2.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  206. {
  207. effic2720 = "0";
  208. }
  209. else
  210. {
  211. effic2720 = ((feizi / feimu) * 100).ToString("f2");
  212. }
  213. this.statisticalControl5.Value.Effic = effic2720 + "%";
  214. this.statisticalControl5.UpdateData();
  215. }
  216. else
  217. {
  218. StatisticalClass result = new StatisticalClass();
  219. this.statisticalControl5.Value = result;
  220. }
  221. #endregion
  222. #region 冷轧机组
  223. //查询当班生产实绩
  224. DataTable dtlz = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryActual", new object[] { fistday, _bc, "C013" }, this.ob);
  225. if (dtlz != null && dtlz.Rows.Count > 0)
  226. {
  227. //if (!dtlz.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  228. //{
  229. DataRow row = dtlz.Rows[0];
  230. this.statisticalControl9.Value.JudgeStoveNo = row["JUDGE_STOVE_NO"].ToString();
  231. this.statisticalControl9.Value.QualifiedNum = row["QUALIFIED_NUM"].ToString();
  232. this.statisticalControl9.Value.QualifiedWt = row["QUALIFIED_WT"].ToString();
  233. this.statisticalControl9.Value.Minutes = row["MINUTES"].ToString();
  234. this.statisticalControl9.Value.AbaMinutes = row["ABSMINUTES"].ToString();
  235. this.statisticalControl9.Value.SumMinutes = row["SUMMINUTES"].ToString();
  236. double feizi = double.Parse(row["YOUMINUTES"].ToString()) - double.Parse(row["SUMMINUTES"].ToString());
  237. double feimu = double.Parse(row["YOUMINUTES"].ToString());
  238. if (feizi <= 0 || dt.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  239. {
  240. efficlz = "0";
  241. }
  242. else
  243. {
  244. efficlz = ((feizi / feimu) * 100).ToString("f2");
  245. }
  246. this.statisticalControl9.Value.Effic = efficlz + "%";
  247. this.statisticalControl9.UpdateData();
  248. }
  249. else
  250. {
  251. StatisticalClass result = new StatisticalClass();
  252. this.statisticalControl9.Value = result;
  253. }
  254. //查询当天生产实绩
  255. DataTable dt1lz = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryDayActual",
  256. new object[] { fistday, "C013" }, this.ob);
  257. if (dt1lz != null && dt1lz.Rows.Count > 0)
  258. {
  259. //if (!dt1lz.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  260. //{
  261. DataRow row1 = dt1lz.Rows[0];
  262. this.statisticalControl7.Value.JudgeStoveNo = row1["JUDGE_STOVE_NO"].ToString();
  263. this.statisticalControl7.Value.QualifiedNum = row1["QUALIFIED_NUM"].ToString();
  264. this.statisticalControl7.Value.QualifiedWt = row1["QUALIFIED_WT"].ToString();
  265. this.statisticalControl7.Value.Minutes = row1["MINUTES"].ToString();
  266. this.statisticalControl7.Value.AbaMinutes = row1["ABSMINUTES"].ToString();
  267. this.statisticalControl7.Value.SumMinutes = row1["SUMMINUTES"].ToString();
  268. double feizi = double.Parse(row1["YOUMINUTES"].ToString()) - double.Parse(row1["SUMMINUTES"].ToString());
  269. double feimu = double.Parse(row1["YOUMINUTES"].ToString());
  270. if (feizi <= 0 || dt1lz.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  271. {
  272. effic1lz = "0";
  273. }
  274. else
  275. {
  276. effic1lz = ((feizi / feimu) * 100).ToString("f2");
  277. }
  278. this.statisticalControl7.Value.Effic = effic1lz + "%";
  279. this.statisticalControl7.UpdateData();
  280. //}
  281. //else
  282. //{
  283. // StatisticalClass result = new StatisticalClass();
  284. // this.statisticalControl7.Value = result;
  285. //}
  286. }
  287. else
  288. {
  289. StatisticalClass result = new StatisticalClass();
  290. this.statisticalControl7.Value = result;
  291. }
  292. //查询当月生产实绩
  293. DataTable dt2lz = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryMonthActual", new object[] { fistMonthD, "C013" }, this.ob);
  294. if (dt2lz != null && dt2lz.Rows.Count > 0)
  295. {
  296. //if (!dt2lz.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  297. //{
  298. DataRow row2 = dt2lz.Rows[0];
  299. this.statisticalControl8.Value.JudgeStoveNo = row2["JUDGE_STOVE_NO"].ToString();
  300. this.statisticalControl8.Value.QualifiedNum = row2["QUALIFIED_NUM"].ToString();
  301. this.statisticalControl8.Value.QualifiedWt = row2["QUALIFIED_WT"].ToString();
  302. this.statisticalControl8.Value.Minutes = row2["MINUTES"].ToString();
  303. this.statisticalControl8.Value.AbaMinutes = row2["ABSMINUTES"].ToString();
  304. this.statisticalControl8.Value.SumMinutes = row2["SUMMINUTES"].ToString();
  305. double feizi = double.Parse(row2["YOUMINUTES"].ToString()) - double.Parse(row2["SUMMINUTES"].ToString());
  306. double feimu = double.Parse(row2["YOUMINUTES"].ToString());
  307. if (feizi <= 0 || dt2lz.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  308. {
  309. effic2lz = "0";
  310. }
  311. else
  312. {
  313. effic2lz = ((feizi / feimu) * 100).ToString("f2");
  314. }
  315. this.statisticalControl8.Value.Effic = effic2lz + "%";
  316. this.statisticalControl8.UpdateData();
  317. }
  318. else
  319. {
  320. StatisticalClass result = new StatisticalClass();
  321. this.statisticalControl8.Value = result;
  322. }
  323. #endregion
  324. #region 冷拔机组
  325. //查询当班生产实绩
  326. DataTable dtlb = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryActual", new object[] { fistday, _bc, "C014" }, this.ob);
  327. if (dtlb != null && dtlb.Rows.Count > 0)
  328. {
  329. //if (!dtlb.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  330. //{
  331. DataRow row = dtlb.Rows[0];
  332. this.statisticalControl1.Value.JudgeStoveNo = row["JUDGE_STOVE_NO"].ToString();
  333. this.statisticalControl1.Value.QualifiedNum = row["QUALIFIED_NUM"].ToString();
  334. this.statisticalControl1.Value.QualifiedWt = row["QUALIFIED_WT"].ToString();
  335. this.statisticalControl1.Value.Minutes = row["MINUTES"].ToString();
  336. this.statisticalControl1.Value.AbaMinutes = row["ABSMINUTES"].ToString();
  337. this.statisticalControl1.Value.SumMinutes = row["SUMMINUTES"].ToString();
  338. double feizi = double.Parse(row["YOUMINUTES"].ToString()) - double.Parse(row["SUMMINUTES"].ToString());
  339. double feimu = double.Parse(row["YOUMINUTES"].ToString());
  340. if (feizi <= 0 || dtlb.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  341. {
  342. efficlb = "0";
  343. }
  344. else
  345. {
  346. efficlb = ((feizi / feimu) * 100).ToString("f2");
  347. }
  348. this.statisticalControl1.Value.Effic = efficlb + "%";
  349. this.statisticalControl1.UpdateData();
  350. }
  351. else
  352. {
  353. StatisticalClass result = new StatisticalClass();
  354. this.statisticalControl1.Value = result;
  355. }
  356. //查询当天生产实绩
  357. DataTable dt1lb = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryDayActual",
  358. new object[] { fistday, "C014" }, this.ob);
  359. if (dt1lb != null && dt1lb.Rows.Count > 0)
  360. {
  361. //if (!dt1lb.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  362. //{
  363. DataRow row1 = dt1lb.Rows[0];
  364. this.statisticalControl3.Value.JudgeStoveNo = row1["JUDGE_STOVE_NO"].ToString();
  365. this.statisticalControl3.Value.QualifiedNum = row1["QUALIFIED_NUM"].ToString();
  366. this.statisticalControl3.Value.QualifiedWt = row1["QUALIFIED_WT"].ToString();
  367. this.statisticalControl3.Value.Minutes = row1["MINUTES"].ToString();
  368. this.statisticalControl3.Value.AbaMinutes = row1["ABSMINUTES"].ToString();
  369. this.statisticalControl3.Value.SumMinutes = row1["SUMMINUTES"].ToString();
  370. double feizi = double.Parse(row1["YOUMINUTES"].ToString()) - double.Parse(row1["SUMMINUTES"].ToString());
  371. double feimu = double.Parse(row1["YOUMINUTES"].ToString());
  372. if (feizi <= 0 || dt1lb.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  373. {
  374. effic1lb = "0";
  375. }
  376. else
  377. {
  378. effic1lb = ((feizi / feimu) * 100).ToString("f2");
  379. }
  380. this.statisticalControl3.Value.Effic = effic1lb + "%";
  381. this.statisticalControl3.UpdateData();
  382. }
  383. else
  384. {
  385. StatisticalClass result = new StatisticalClass();
  386. this.statisticalControl3.Value = result;
  387. }
  388. //查询当月生产实绩
  389. DataTable dt2lb = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryMonthActual", new object[] { fistMonthD, "C014" }, this.ob);
  390. if (dt2lb != null && dt2lb.Rows.Count > 0)
  391. {
  392. //if (!dt2lb.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  393. //{
  394. DataRow row2 = dt2lb.Rows[0];
  395. this.statisticalControl2.Value.JudgeStoveNo = row2["JUDGE_STOVE_NO"].ToString();
  396. this.statisticalControl2.Value.QualifiedNum = row2["QUALIFIED_NUM"].ToString();
  397. this.statisticalControl2.Value.QualifiedWt = row2["QUALIFIED_WT"].ToString();
  398. this.statisticalControl2.Value.Minutes = row2["MINUTES"].ToString();
  399. this.statisticalControl2.Value.AbaMinutes = row2["ABSMINUTES"].ToString();
  400. this.statisticalControl2.Value.SumMinutes = row2["SUMMINUTES"].ToString();
  401. double feizi = double.Parse(row2["YOUMINUTES"].ToString()) - double.Parse(row2["SUMMINUTES"].ToString());
  402. double feimu = double.Parse(row2["YOUMINUTES"].ToString());
  403. if (feizi <= 0 || dt2lb.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  404. {
  405. effic2lb = "0";
  406. }
  407. else
  408. {
  409. effic2lb = ((feizi / feimu) * 100).ToString("f2");
  410. }
  411. this.statisticalControl2.Value.Effic = effic2lb + "%";
  412. this.statisticalControl2.UpdateData();
  413. }
  414. else
  415. {
  416. StatisticalClass result = new StatisticalClass();
  417. this.statisticalControl2.Value = result;
  418. }
  419. #endregion
  420. #region 镦粗
  421. //查询当班生产实绩
  422. DataTable dtdc = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryActual", new object[] { fistday, _bc, "C021" }, this.ob);
  423. if (dtdc != null && dtdc.Rows.Count > 0)
  424. {
  425. //if (!dtdc.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  426. //{
  427. DataRow row = dtdc.Rows[0];
  428. this.statisticalControl12.Value.JudgeStoveNo = row["JUDGE_STOVE_NO"].ToString();
  429. this.statisticalControl12.Value.QualifiedNum = row["QUALIFIED_NUM"].ToString();
  430. this.statisticalControl12.Value.QualifiedWt = row["QUALIFIED_WT"].ToString();
  431. this.statisticalControl12.Value.Minutes = row["MINUTES"].ToString();
  432. this.statisticalControl12.Value.AbaMinutes = row["ABSMINUTES"].ToString();
  433. this.statisticalControl12.Value.SumMinutes = row["SUMMINUTES"].ToString();
  434. double feizi = double.Parse(row["YOUMINUTES"].ToString()) - double.Parse(row["SUMMINUTES"].ToString());
  435. double feimu = double.Parse(row["YOUMINUTES"].ToString());
  436. if (feizi <= 0 || dtdc.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  437. {
  438. efficdc = "0";
  439. }
  440. else
  441. {
  442. efficdc = ((feizi / feimu) * 100).ToString("f2");
  443. }
  444. this.statisticalControl12.Value.Effic = efficdc + "%";
  445. this.statisticalControl12.UpdateData();
  446. }
  447. else
  448. {
  449. StatisticalClass result = new StatisticalClass();
  450. this.statisticalControl12.Value = result;
  451. }
  452. //查询当天生产实绩
  453. DataTable dt1dc = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryDayActual",
  454. new object[] { fistday, "C021" }, this.ob);
  455. if (dt1dc != null && dt1dc.Rows.Count > 0)
  456. {
  457. //if (!dt1dc.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  458. //{
  459. DataRow row1 = dt1dc.Rows[0];
  460. this.statisticalControl10.Value.JudgeStoveNo = row1["JUDGE_STOVE_NO"].ToString();
  461. this.statisticalControl10.Value.QualifiedNum = row1["QUALIFIED_NUM"].ToString();
  462. this.statisticalControl10.Value.QualifiedWt = row1["QUALIFIED_WT"].ToString();
  463. this.statisticalControl10.Value.Minutes = row1["MINUTES"].ToString();
  464. this.statisticalControl10.Value.AbaMinutes = row1["ABSMINUTES"].ToString();
  465. this.statisticalControl10.Value.SumMinutes = row1["SUMMINUTES"].ToString();
  466. double feizi = double.Parse(row1["YOUMINUTES"].ToString()) - double.Parse(row1["SUMMINUTES"].ToString());
  467. double feimu = double.Parse(row1["YOUMINUTES"].ToString());
  468. if (feizi <= 0 || dt1dc.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  469. {
  470. effic1dc = "0";
  471. }
  472. else
  473. {
  474. effic1dc = ((feizi / feimu) * 100).ToString("f2");
  475. }
  476. this.statisticalControl10.Value.Effic = effic1dc + "%";
  477. this.statisticalControl10.UpdateData();
  478. }
  479. else
  480. {
  481. StatisticalClass result = new StatisticalClass();
  482. this.statisticalControl10.Value = result;
  483. }
  484. //查询当月生产实绩
  485. DataTable dt2dc = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryMonthActual", new object[] { fistMonthD, "C021" }, this.ob);
  486. if (dt2dc != null && dt2dc.Rows.Count > 0)
  487. {
  488. //if (!dt2dc.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  489. //{
  490. DataRow row2 = dt2dc.Rows[0];
  491. this.statisticalControl11.Value.JudgeStoveNo = row2["JUDGE_STOVE_NO"].ToString();
  492. this.statisticalControl11.Value.QualifiedNum = row2["QUALIFIED_NUM"].ToString();
  493. this.statisticalControl11.Value.QualifiedWt = row2["QUALIFIED_WT"].ToString();
  494. this.statisticalControl11.Value.Minutes = row2["MINUTES"].ToString();
  495. this.statisticalControl11.Value.AbaMinutes = row2["ABSMINUTES"].ToString();
  496. this.statisticalControl11.Value.SumMinutes = row2["SUMMINUTES"].ToString();
  497. double feizi = double.Parse(row2["YOUMINUTES"].ToString()) - double.Parse(row2["SUMMINUTES"].ToString());
  498. double feimu = double.Parse(row2["YOUMINUTES"].ToString());
  499. if (feizi <= 0 || dt2dc.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  500. {
  501. effic2dc = "0";
  502. }
  503. else
  504. {
  505. effic2dc = ((feizi / feimu) * 100).ToString("f2");
  506. }
  507. this.statisticalControl11.Value.Effic = effic2dc + "%";
  508. this.statisticalControl11.UpdateData();
  509. }
  510. else
  511. {
  512. StatisticalClass result = new StatisticalClass();
  513. this.statisticalControl11.Value = result;
  514. }
  515. #endregion
  516. #region 热扩
  517. //查询当班生产实绩
  518. DataTable dtrk = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryActual", new object[] { fistday, _bc, "C070" }, this.ob);
  519. if (dtrk != null && dtrk.Rows.Count > 0)
  520. {
  521. //if (!dtrk.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  522. //{
  523. DataRow row = dtrk.Rows[0];
  524. this.statisticalControl15.Value.JudgeStoveNo = row["JUDGE_STOVE_NO"].ToString();
  525. this.statisticalControl15.Value.QualifiedNum = row["QUALIFIED_NUM"].ToString();
  526. this.statisticalControl15.Value.QualifiedWt = row["QUALIFIED_WT"].ToString();
  527. this.statisticalControl15.Value.Minutes = row["MINUTES"].ToString();
  528. this.statisticalControl15.Value.AbaMinutes = row["ABSMINUTES"].ToString();
  529. this.statisticalControl15.Value.SumMinutes = row["SUMMINUTES"].ToString();
  530. double feizi = double.Parse(row["YOUMINUTES"].ToString()) - double.Parse(row["SUMMINUTES"].ToString());
  531. double feimu = double.Parse(row["YOUMINUTES"].ToString());
  532. if (feizi <= 0 || dtrk.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  533. {
  534. efficrk = "0";
  535. }
  536. else
  537. {
  538. efficrk = ((feizi / feimu) * 100).ToString("f2");
  539. }
  540. this.statisticalControl15.Value.Effic = efficrk + "%";
  541. this.statisticalControl15.UpdateData();
  542. }
  543. else
  544. {
  545. StatisticalClass result = new StatisticalClass();
  546. this.statisticalControl15.Value = result;
  547. }
  548. //查询当天生产实绩
  549. DataTable dt1rk = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryDayActual",
  550. new object[] { fistday, "C070" }, this.ob);
  551. if (dt1rk != null && dt1rk.Rows.Count > 0)
  552. {
  553. //if (!dt1rk.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  554. //{
  555. DataRow row1 = dt1rk.Rows[0];
  556. this.statisticalControl13.Value.JudgeStoveNo = row1["JUDGE_STOVE_NO"].ToString();
  557. this.statisticalControl13.Value.QualifiedNum = row1["QUALIFIED_NUM"].ToString();
  558. this.statisticalControl13.Value.QualifiedWt = row1["QUALIFIED_WT"].ToString();
  559. this.statisticalControl13.Value.Minutes = row1["MINUTES"].ToString();
  560. this.statisticalControl13.Value.AbaMinutes = row1["ABSMINUTES"].ToString();
  561. this.statisticalControl13.Value.SumMinutes = row1["SUMMINUTES"].ToString();
  562. double feizi = double.Parse(row1["YOUMINUTES"].ToString()) - double.Parse(row1["SUMMINUTES"].ToString());
  563. double feimu = double.Parse(row1["YOUMINUTES"].ToString());
  564. if (feizi <= 0 || dt1rk.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  565. {
  566. effic1rk = "0";
  567. }
  568. else
  569. {
  570. effic1rk = ((feizi / feimu) * 100).ToString("f2");
  571. }
  572. this.statisticalControl13.Value.Effic = effic1rk + "%";
  573. this.statisticalControl13.UpdateData();
  574. }
  575. else
  576. {
  577. StatisticalClass result = new StatisticalClass();
  578. this.statisticalControl13.Value = result;
  579. }
  580. //查询当月生产实绩
  581. DataTable dt2rk = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doQueryMonthActual", new object[] { fistMonthD, "C070" }, this.ob);
  582. if (dt2rk != null && dt2rk.Rows.Count > 0)
  583. {
  584. //if (!dt2rk.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  585. //{
  586. DataRow row2 = dt2rk.Rows[0];
  587. this.statisticalControl14.Value.JudgeStoveNo = row2["JUDGE_STOVE_NO"].ToString();
  588. this.statisticalControl14.Value.QualifiedNum = row2["QUALIFIED_NUM"].ToString();
  589. this.statisticalControl14.Value.QualifiedWt = row2["QUALIFIED_WT"].ToString();
  590. this.statisticalControl14.Value.Minutes = row2["MINUTES"].ToString();
  591. this.statisticalControl14.Value.AbaMinutes = row2["ABSMINUTES"].ToString();
  592. this.statisticalControl14.Value.SumMinutes = row2["SUMMINUTES"].ToString();
  593. double feizi = double.Parse(row2["YOUMINUTES"].ToString()) - double.Parse(row2["SUMMINUTES"].ToString());
  594. double feimu = double.Parse(row2["YOUMINUTES"].ToString());
  595. if (feizi <= 0 || dt2rk.Rows[0]["JUDGE_STOVE_NO"].ToString().Equals("0"))
  596. {
  597. effic2rk = "0";
  598. }
  599. else
  600. {
  601. effic2rk = ((feizi / feimu) * 100).ToString("f2");
  602. }
  603. this.statisticalControl14.Value.Effic = effic2rk + "%";
  604. this.statisticalControl14.UpdateData();
  605. }
  606. else
  607. {
  608. StatisticalClass result = new StatisticalClass();
  609. this.statisticalControl14.Value = result;
  610. }
  611. #endregion
  612. doMinutesQuery();
  613. }
  614. /// <summary>
  615. /// 班报打印
  616. /// </summary>
  617. private void doClassPint()
  618. {
  619. doOutlibrary();
  620. //日
  621. string fistday = "";
  622. //string lastday = "";
  623. fistday = dateDayTime.Value.ToString("yyyyMMdd");
  624. //lastday = dateDayTime.Value.ToString("yyyyMMdd");
  625. //if (_bc.Equals("3"))
  626. //{
  627. // fistday = fistday + "18";
  628. // lastday = lastday + "10";
  629. //}
  630. //if (_bc.Equals("1"))
  631. //{
  632. // fistday = lastday + "00";
  633. // lastday = lastday + "18";
  634. //}
  635. //if (_bc.Equals("2"))
  636. //{
  637. // fistday = lastday + "12";
  638. // lastday = lastday + "23";
  639. //}
  640. string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepVRPScheduClassAll.cpt&__bypagesize__=false&PROBC=" + _bc
  641. + "&startTim=" + fistday
  642. + "&C018=" + effic720
  643. + "&C013=" + efficlz
  644. + "&C014=" + efficlb
  645. + "&C021=" + efficdc
  646. + "&C070=" + efficrk
  647. + "";
  648. FrmRepExcel fre = new FrmRepExcel(this.ob, url);
  649. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  650. fre.Text = "调度班报统计";
  651. fre.ShowDialog();
  652. }
  653. /// <summary>
  654. /// 日报打印
  655. /// </summary>
  656. private void doDayPrint()
  657. {
  658. doOutlibrary();
  659. //日
  660. string fistday = "";
  661. //string lastday = "";
  662. fistday = dateDayTime.Value.ToString("yyyyMMdd");
  663. //lastday = dateDayTime.Value.ToString("yyyyMMdd");
  664. string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepVRPScheduDayAll.cpt&__bypagesize__=false&startTim=" + fistday
  665. + "&C018=" + effic1720
  666. + "&C013=" + effic1lz
  667. + "&C014=" + effic1lb
  668. + "&C021=" + effic1dc
  669. + "&C070=" + effic1rk
  670. + "";
  671. FrmRepExcel fre = new FrmRepExcel(this.ob, url);
  672. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  673. fre.Text = "调度日报统计";
  674. fre.ShowDialog();
  675. }
  676. /// <summary>
  677. /// 月报打印
  678. /// </summary>
  679. private void doMonthPrint()
  680. {
  681. doOutlibrary();
  682. //月
  683. string fistMonthD = "";
  684. //string lrktMonthD = "";
  685. //DateTime t = DateTime.Parse(dateDayTime.Value.ToString());
  686. //DateTime t1 = new DateTime(t.Year, t.Month, 1);
  687. //lastMonthD = DateTime.Parse(t.ToString("yyyy-MM-dd 21:06")).ToString("yyyyMMdd");
  688. fistMonthD = dateDayTime.Value.ToString("yyyyMM");
  689. string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepScheduMonthAll.cpt&__bypagesize__=false&startTim=" + fistMonthD
  690. + "&C018=" + effic2720
  691. + "&C013=" + effic2lz
  692. + "&C014=" + effic2lb
  693. + "&C021=" + effic2dc
  694. + "&C070=" + effic2rk
  695. + "";
  696. FrmRepExcel fre = new FrmRepExcel(this.ob, url);
  697. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  698. fre.Text = "调度月报统计";
  699. fre.ShowDialog();
  700. }
  701. private void doStopQuery(string date, string plinCode)
  702. {
  703. DataTable dt=ServerHelper.GetData
  704. ("com.steering.mes.mcp.Report.FrmVrpControlLog.doStopQuery", new object[] { date, plinCode }, this.ob);
  705. GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
  706. doAnalysis();
  707. }
  708. private void doMinutesQuery()
  709. {
  710. string time = dateDayTime.Value.ToString("yyyyMM");
  711. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmVrpControlLog.doMinutesQuery", new object[] { time, days.ToString() }, this.ob);
  712. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  713. //foreach (UltraGridColumn column in ultraGrid3.DisplayLayout.Bands[0].Columns)
  714. // column.Width = 50;
  715. foreach (UltraGridRow urg in ultraGrid3.Rows)
  716. {
  717. double MonthCount = 0;
  718. foreach (UltraGridColumn column in ultraGrid3.DisplayLayout.Bands[0].Columns)
  719. {
  720. column.Width = 50;
  721. column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
  722. column.CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;
  723. if (column.Key.Contains("DAY"))
  724. {
  725. urg.Cells[column.Key].Value = (double.Parse(urg.Cells[column.Key].Value.ToString()) / 60).ToString("f2");
  726. if (double.Parse(urg.Cells[column.Key].Value.ToString()) >= 4.0 && double.Parse(urg.Cells[column.Key].Value.ToString()) < 12.0)
  727. {
  728. urg.Cells[column.Key].Appearance.BackColor = Color.Yellow;
  729. }
  730. else if (double.Parse(urg.Cells[column.Key].Value.ToString()) >= 12.0 && double.Parse(urg.Cells[column.Key].Value.ToString()) < 24.0)
  731. {
  732. urg.Cells[column.Key].Appearance.BackColor = Color.Orange;
  733. }
  734. else if (double.Parse(urg.Cells[column.Key].Value.ToString()) >= 24.0)
  735. {
  736. urg.Cells[column.Key].Appearance.BackColor = Color.Red;
  737. }
  738. MonthCount += double.Parse(urg.Cells[column.Key].Value.ToString());
  739. }
  740. }
  741. urg.Cells["Month"].Value = MonthCount;
  742. }
  743. }
  744. #region 冷拔
  745. /// <summary>
  746. /// 冷拔
  747. /// </summary>
  748. /// <param name="sender"></param>
  749. /// <param name="e"></param>
  750. private void ultraButton1_Click(object sender, EventArgs e)
  751. {
  752. doStopQuery(dateDayTime.Value.ToString("yyyyMMdd"), "C014");
  753. }
  754. private void ultraButton6_Click(object sender, EventArgs e)
  755. {
  756. FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C014", this.ob);
  757. pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  758. pro.Text = "生产详细";
  759. pro.ShowDialog();
  760. }
  761. #endregion
  762. #region 720
  763. /// <summary>
  764. /// 720
  765. /// </summary>
  766. /// <param name="sender"></param>
  767. /// <param name="e"></param>
  768. private void ultraButton2_Click(object sender, EventArgs e)
  769. {
  770. doStopQuery(dateDayTime.Value.ToString("yyyyMMdd"), "C018");
  771. }
  772. private void ultraButton7_Click(object sender, EventArgs e)
  773. {
  774. FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C018", this.ob);
  775. pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  776. pro.Text = "生产详细";
  777. pro.ShowDialog();
  778. }
  779. #endregion
  780. #region 冷轧
  781. /// <summary>
  782. /// lz
  783. /// </summary>
  784. /// <param name="sender"></param>
  785. /// <param name="e"></param>
  786. private void ultraButton3_Click(object sender, EventArgs e)
  787. {
  788. doStopQuery(dateDayTime.Value.ToString("yyyyMMdd"), "C013");
  789. }
  790. private void ultraButton8_Click(object sender, EventArgs e)
  791. {
  792. FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C013", this.ob);
  793. pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  794. pro.Text = "生产详细";
  795. pro.ShowDialog();
  796. }
  797. #endregion
  798. #region 镦粗
  799. /// <summary>
  800. /// dc
  801. /// </summary>
  802. /// <param name="sender"></param>
  803. /// <param name="e"></param>
  804. private void ultraButton4_Click(object sender, EventArgs e)
  805. {
  806. doStopQuery(dateDayTime.Value.ToString("yyyyMMdd"), "C021");
  807. }
  808. private void ultraButton9_Click(object sender, EventArgs e)
  809. {
  810. FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C021", this.ob);
  811. pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  812. pro.Text = "生产详细";
  813. pro.ShowDialog();
  814. }
  815. #endregion
  816. #region 热扩
  817. /// <summary>
  818. ///热扩
  819. /// </summary>
  820. /// <param name="sender"></param>
  821. /// <param name="e"></param>
  822. private void ultraButton5_Click(object sender, EventArgs e)
  823. {
  824. doStopQuery(dateDayTime.Value.ToString("yyyyMMdd2054"), "C070");
  825. }
  826. private void ultraButton10_Click(object sender, EventArgs e)
  827. {
  828. FrmProductionDetails pro = new FrmProductionDetails(dateDayTime.Value.ToString("yyyyMMdd"), "C070", this.ob);
  829. pro.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  830. pro.Text = "生产详细";
  831. pro.ShowDialog();
  832. }
  833. #endregion
  834. /// <summary>
  835. ///停机时间差
  836. /// </summary>
  837. private void doAnalysis()
  838. {
  839. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  840. {
  841. string loagEnd = ugr.Cells["LOGS_END"].Value.ToString();
  842. string loagBeg = ugr.Cells["LOGS_BEG"].Value.ToString();
  843. TimeSpan timeSpan = DateTime.Parse(loagEnd) - DateTime.Parse(loagBeg);
  844. ugr.Cells["TimeDiff"].Value = timeSpan.TotalMinutes.ToString();
  845. }
  846. }
  847. private string DateDiff(DateTime DateTime1, DateTime DateTime2)
  848. {
  849. string dateDiff = null;
  850. try
  851. {
  852. TimeSpan ts1 = new TimeSpan(DateTime1.Ticks);
  853. TimeSpan ts2 = new TimeSpan(DateTime2.Ticks);
  854. TimeSpan ts = ts1.Subtract(ts2).Duration();
  855. dateDiff = ts.Minutes.ToString();
  856. }
  857. catch
  858. {
  859. }
  860. return dateDiff;
  861. }
  862. }
  863. }