FrmStatisticalPub.cs 42 KB

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