FrmMilDateStatistics2.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866
  1. using com.steering.mes.zgmil.entity;
  2. using Core.Mes.Client.Comm.Control;
  3. using Core.Mes.Client.Comm.Format;
  4. using Core.Mes.Client.Comm.Server;
  5. using Core.Mes.Client.Comm.Tool;
  6. using Core.StlMes.Client.ZGMil.Common;
  7. using Core.StlMes.Client.ZGMil.Entity;
  8. using CoreFS.CA06;
  9. using Infragistics.Win;
  10. using Infragistics.Win.UltraWinGrid;
  11. using System;
  12. using System.Collections;
  13. using System.Collections.Generic;
  14. using System.ComponentModel;
  15. using System.Data;
  16. using System.Drawing;
  17. using System.Linq;
  18. using System.Text;
  19. using System.Windows.Forms;
  20. namespace Core.StlMes.Client.ZGMil.Report
  21. {
  22. public partial class FrmMilDateStatistics2 : FrmBase
  23. {
  24. private string departm = "";
  25. private string plineCode = "";
  26. private string[] plineCodes = { };
  27. public FrmMilDateStatistics2()
  28. {
  29. InitializeComponent();
  30. this.IsLoadUserView = true;
  31. }
  32. /// <summary>
  33. /// 重写基类方法
  34. /// </summary>
  35. /// <param name="sender"></param>
  36. /// <param name="ToolbarKey"></param>
  37. public override void ToolBar_Click(object sender, string ToolbarKey)
  38. {
  39. switch (ToolbarKey)
  40. {
  41. case "Query":
  42. doQuery();
  43. break;
  44. case"CloseMilPlan":
  45. closeMilPlan();
  46. break;
  47. case "CancelCloseMilPlan":
  48. cancelCloseMilPlan();
  49. break;
  50. case "Refresh":
  51. doRefresh();
  52. break;
  53. case "Print":
  54. doPrint();
  55. break;
  56. case "Export":
  57. ExportData();
  58. break;
  59. case "Close":
  60. this.Close();
  61. break;
  62. }
  63. }
  64. /// <summary>
  65. /// 刷新
  66. /// </summary>
  67. private void doRefresh()
  68. {
  69. this.ultraGrid3.UpdateData();
  70. IQueryable<UltraGridRow> checkMag = this.ultraGrid3.Rows.AsQueryable().Where(" CHK = 'True'");
  71. if (checkMag.Count() == 0)
  72. {
  73. MessageUtil.ShowTips("请选择需要关闭的炉计划信息!");
  74. return;
  75. }
  76. ArrayList parm = new ArrayList();
  77. foreach (UltraGridRow uRow in checkMag)
  78. {
  79. MilProcessesEntity milProsess = (MilProcessesEntity)uRow.ListObject;
  80. string milProcessTity = JSONFormat.Format(milProsess);
  81. parm.Add(milProcessTity);
  82. }
  83. CoreClientParam ccp = new CoreClientParam();
  84. ccp.ServerName = "com.steering.mes.zgmil.report.FrmMilDateStatistics";
  85. ccp.MethodName = "doRefresh";
  86. ccp.ServerParams = new object[] { parm };
  87. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  88. if (ccp.ReturnCode != -1)
  89. {
  90. if (ccp.ReturnInfo.Equals("刷新成功!"))
  91. {
  92. doQuery();
  93. MessageUtil.ShowTips(ccp.ReturnInfo);
  94. }
  95. else
  96. {
  97. MessageUtil.ShowTips(ccp.ReturnInfo);
  98. }
  99. }
  100. }
  101. /// <summary>
  102. /// 关闭炉计划
  103. /// </summary>
  104. private void closeMilPlan()
  105. {
  106. this.ultraGrid3.UpdateData();
  107. IQueryable<UltraGridRow> checkMag = this.ultraGrid3.Rows.AsQueryable().Where(" CHK = 'True'");
  108. if (checkMag.Count() == 0)
  109. {
  110. MessageUtil.ShowTips("请选择需要关闭的炉计划信息!");
  111. return;
  112. }
  113. ArrayList parm = new ArrayList();
  114. foreach(UltraGridRow uRow in checkMag)
  115. {
  116. MilProcessesEntity milProsess = (MilProcessesEntity)uRow.ListObject;
  117. string milProcessTity = JSONFormat.Format(milProsess);
  118. parm.Add(milProcessTity);
  119. }
  120. CoreClientParam ccp = new CoreClientParam();
  121. ccp.ServerName = "com.steering.mes.zgmil.report.FrmMilDateStatistics";
  122. ccp.MethodName = "closeMilPlan";
  123. ccp.ServerParams = new object[] { parm };
  124. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  125. if (ccp.ReturnCode != -1)
  126. {
  127. if (ccp.ReturnInfo.Equals("关闭炉计划成功!"))
  128. {
  129. doQuery();
  130. MessageUtil.ShowTips(ccp.ReturnInfo);
  131. }
  132. else
  133. {
  134. MessageUtil.ShowTips(ccp.ReturnInfo);
  135. }
  136. }
  137. }
  138. /// <summary>
  139. /// 撤销关闭炉计划
  140. /// </summary>
  141. private void cancelCloseMilPlan()
  142. {
  143. this.ultraGrid3.UpdateData();
  144. IQueryable<UltraGridRow> checkMags = this.ultraGrid3.Rows.AsQueryable().Where(" CHK = 'True'");
  145. if (checkMags.Count() == 0)
  146. {
  147. MessageUtil.ShowTips("请选择需要撤销关闭的炉计划信息!");
  148. return;
  149. }
  150. ArrayList parm = new ArrayList();
  151. foreach (UltraGridRow uRow in checkMags)
  152. {
  153. MilProcessesEntity milProsess = (MilProcessesEntity)uRow.ListObject;
  154. string milProcessTity = JSONFormat.Format(milProsess);
  155. parm.Add(milProcessTity);
  156. }
  157. CoreClientParam ccp = new CoreClientParam();
  158. ccp.ServerName = "com.steering.mes.zgmil.report.FrmMilDateStatistics";
  159. ccp.MethodName = "cancelCloseMilPlan";
  160. ccp.ServerParams = new object[] { parm };
  161. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  162. if (ccp.ReturnCode != -1)
  163. {
  164. if (ccp.ReturnInfo.Equals("撤销成功!"))
  165. {
  166. doQuery();
  167. MessageUtil.ShowTips(ccp.ReturnInfo);
  168. }
  169. else
  170. {
  171. MessageUtil.ShowTips(ccp.ReturnInfo);
  172. }
  173. }
  174. }
  175. /// <summary>
  176. /// 进程表数据查询
  177. /// </summary>
  178. private void doQueryMilDateStatisticsBatchSample()
  179. {
  180. string date = "";
  181. string endDate = "";
  182. string JudgeStoveNo = "";
  183. string LotNo = "";
  184. string ContractNo = "";
  185. string PlineCode = "";
  186. int n = 0;
  187. if (chkDate.Checked)
  188. {
  189. if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
  190. {
  191. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  192. return;
  193. }
  194. else
  195. {
  196. date = cmbDate.Value.ToString();
  197. endDate = cmbEndDate.Value.ToString();
  198. }
  199. n += 1;
  200. }
  201. if (chkJudgeStoveNo.Checked)
  202. {
  203. if (uteJudgeStoveNo.Text.Trim() == "")
  204. {
  205. JudgeStoveNo = "";
  206. }
  207. else
  208. {
  209. JudgeStoveNo = uteJudgeStoveNo.Text.Trim().ToString();
  210. }
  211. n += 1;
  212. }
  213. if (chkLotNo.Checked)
  214. {
  215. if (uteLotNo.Text.Trim() == "")
  216. {
  217. LotNo = "";
  218. }
  219. else
  220. {
  221. LotNo = uteLotNo.Text.Trim().ToString();
  222. }
  223. n += 1;
  224. }
  225. if (chkContractNo.Checked)
  226. {
  227. if (uteContractNo.Text.Trim() == "")
  228. {
  229. ContractNo = "";
  230. }
  231. else
  232. {
  233. ContractNo = uteContractNo.Text.Trim().ToString();
  234. }
  235. n += 1;
  236. }
  237. if (chkPlineCode.Checked)
  238. {
  239. if (cobPlineCode.Text.Trim() == "")
  240. {
  241. PlineCode = "";
  242. }
  243. else
  244. {
  245. PlineCode = cobPlineCode.Value.ToString();
  246. }
  247. n += 1;
  248. }
  249. if (n == 0)
  250. {
  251. MessageUtil.ShowTips("请您选择至少一个查询条件,否则会查不到数据!");
  252. return;
  253. }
  254. WaitingForm2 wf = new WaitingForm2("正在加载,请稍候....");
  255. try
  256. {
  257. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getMilDateStatisticsBatchSample", new Object[] { date, endDate, JudgeStoveNo, LotNo, ContractNo, plineCodes, PlineCode }, this.ob);
  258. GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
  259. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  260. //数据处理
  261. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  262. {
  263. //结炉验证:预计产出支 - 热轧剔除支 - 精整剔除支 - 离线支 + 返线支 - 下线【实时】支
  264. int a = Int32.Parse(ugr.Cells["YJZ"].Value.ToString3()) - Int32.Parse(ugr.Cells["undeterminedNum"].Value.ToString3()) - Int32.Parse(ugr.Cells["ScrapNum"].Value.ToString3()) - Int32.Parse(ugr.Cells["LXZ"].Value.ToString3()) + Int32.Parse(ugr.Cells["FXZ"].Value.ToString3()) - Int32.Parse(ugr.Cells["HGZ12"].Value.ToString3());
  265. if (a == 0)
  266. {
  267. ugr.Cells["Verify"].Value = "可结炉";
  268. }
  269. else
  270. {
  271. ugr.Cells["Verify"].Value = "不可结炉";
  272. }
  273. //平衡验证:预计产出支 - 热轧剔除支 - 精整剔除支 - 离线支 + 返线支 - 下线支【结炉】
  274. int b = Int32.Parse(ugr.Cells["YJZ"].Value.ToString3()) - Int32.Parse(ugr.Cells["undeterminedNum"].Value.ToString3()) - Int32.Parse(ugr.Cells["ScrapNum"].Value.ToString3()) - Int32.Parse(ugr.Cells["LXZ"].Value.ToString3()) + Int32.Parse(ugr.Cells["FXZ"].Value.ToString3()) - Int32.Parse(ugr.Cells["XXZ"].Value.ToString3());
  275. //离线待处理支:离线支 - 返线支 - 组炉支 - 委外废品支
  276. int c = Int32.Parse(ugr.Cells["LXZ"].Value.ToString3()) - Int32.Parse(ugr.Cells["FXZ"].Value.ToString3()) - Int32.Parse(ugr.Cells["ZLZ"].Value.ToString3()) - Int32.Parse(ugr.Cells["WWFPZ"].Value.ToString3());
  277. if (Int32.Parse(ugr.Cells["XXZ"].Value.ToString3()) > 0)
  278. {
  279. if (b == 0) { ugr.Cells["PH"].Value = "OK"; }
  280. else
  281. {
  282. if (Int32.Parse(ugr.Cells["LXZ"].Value.ToString3()) == 0)
  283. {
  284. ugr.Cells["PH"].Value = "清线不齐";
  285. }
  286. else
  287. {
  288. if (c != 0)
  289. {
  290. if (b > 0)
  291. {
  292. ugr.Cells["PH"].Value = "清线不齐";
  293. }
  294. else
  295. {
  296. ugr.Cells["PH"].Value = "返线不齐";
  297. }
  298. }
  299. else
  300. {
  301. ugr.Cells["PH"].Value = "清线不齐";
  302. }
  303. }
  304. }
  305. }
  306. else
  307. {
  308. ugr.Cells["PH"].Value = "无";
  309. }
  310. //重量差
  311. ugr.Cells["ZLC"].Value = double.Parse(ugr.Cells["YJD"].Value.ToString3()) - double.Parse(ugr.Cells["XXD"].Value.ToString3());
  312. if (ugr.Cells["PH"].Value.ToString().Contains("线不齐"))
  313. {
  314. ugr.Appearance.BackColor = Color.IndianRed;
  315. }
  316. if (ugr.Cells["NODE_STATUS1"].Value.ToString() != "下线")
  317. {
  318. ugr.Appearance.BackColor = Color.SkyBlue;
  319. }
  320. }
  321. wf.Close();
  322. }
  323. catch
  324. {
  325. }
  326. finally {
  327. wf.Close();
  328. }
  329. }
  330. /// <summary>
  331. /// 静态进程表查询
  332. /// </summary>
  333. private void doQueryMilDateStatisticsBatchSampleNew()
  334. {
  335. string date = "";
  336. string endDate = "";
  337. string JudgeStoveNo = "";
  338. string LotNo = "";
  339. string ContractNo = "";
  340. string PlineCode = "";
  341. int n = 0;
  342. if (chkDate1.Checked)
  343. {
  344. if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate1.Value.ToString()), DateTime.Parse(cmbEndDate1.Value.ToString())) == 0)
  345. {
  346. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  347. return;
  348. }
  349. else
  350. {
  351. date = cmbDate1.Value.ToString();
  352. endDate = cmbEndDate1.Value.ToString();
  353. }
  354. n += 1;
  355. }
  356. if (chkJudgeStoveNo1.Checked)
  357. {
  358. if (uteJudgeStoveNo1.Text.Trim() == "")
  359. {
  360. JudgeStoveNo = "";
  361. }
  362. else
  363. {
  364. JudgeStoveNo = uteJudgeStoveNo1.Text.Trim().ToString();
  365. }
  366. n += 1;
  367. }
  368. if (chkLotNo1.Checked)
  369. {
  370. if (uteLotNo1.Text.Trim() == "")
  371. {
  372. LotNo = "";
  373. }
  374. else
  375. {
  376. LotNo = uteLotNo1.Text.Trim().ToString();
  377. }
  378. n += 1;
  379. }
  380. if (chkContractNo1.Checked)
  381. {
  382. if (uteContractNo1.Text.Trim() == "")
  383. {
  384. ContractNo = "";
  385. }
  386. else
  387. {
  388. ContractNo = uteContractNo1.Text.Trim().ToString();
  389. }
  390. n += 1;
  391. }
  392. if (chkPlineCode2.Checked)
  393. {
  394. if (cobPlineCode2.Text.Trim() == "")
  395. {
  396. PlineCode = "";
  397. }
  398. else
  399. {
  400. PlineCode = cobPlineCode2.Value.ToString();
  401. }
  402. n += 1;
  403. }
  404. if (n == 0)
  405. {
  406. MessageUtil.ShowTips("请您选择至少一个查询条件,否则会查不到数据!");
  407. return;
  408. }
  409. WaitingForm2 wf = new WaitingForm2("正在加载,请稍候....");
  410. try
  411. {
  412. List<MilProcessesEntity> listSource = EntityHelper.GetData<MilProcessesEntity>(
  413. "com.steering.mes.zgmil.report.FrmMilDateStatistics.getMilDateStatisticsBatchSampleNew", new object[] { date, endDate, JudgeStoveNo, LotNo, ContractNo, plineCodes, PlineCode }, this.ob);
  414. MilProcessesEntitybindingSource.DataSource = listSource;
  415. //DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getMilDateStatisticsBatchSample", new Object[] { date, endDate, JudgeStoveNo, LotNo, ContractNo, getPlineCode() }, this.ob);
  416. //GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
  417. //GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  418. //数据处理
  419. foreach (UltraGridRow ugr in ultraGrid3.Rows)
  420. {
  421. //结炉验证:预计产出支 - 热轧剔除支 - 精整剔除支 - 委外废品支 - 离线支 + 返线支 - 下线【实时】支
  422. int a = Int32.Parse(ugr.Cells["Yjz"].Value.ToString3()) - Int32.Parse(ugr.Cells["Undeterminednum"].Value.ToString3()) - Int32.Parse(ugr.Cells["Scrapnum"].Value.ToString3()) - Int32.Parse(ugr.Cells["Wwfpz"].Value.ToString3()) - Int32.Parse(ugr.Cells["Lxz"].Value.ToString3()) + Int32.Parse(ugr.Cells["Fxz"].Value.ToString3()) - Int32.Parse(ugr.Cells["Hgz12"].Value.ToString3());
  423. if (a == 0)
  424. {
  425. ugr.Cells["Verify"].Value = "可结炉";
  426. }
  427. else
  428. {
  429. ugr.Cells["Verify"].Value = "不可结炉";
  430. }
  431. //平衡验证:预计产出支 - 热轧剔除支 - 精整剔除支 - 委外废品支 - 离线支 + 返线支 - 下线支【结炉】
  432. int b = Int32.Parse(ugr.Cells["Yjz"].Value.ToString3()) - Int32.Parse(ugr.Cells["Undeterminednum"].Value.ToString3()) - Int32.Parse(ugr.Cells["Scrapnum"].Value.ToString3()) - Int32.Parse(ugr.Cells["Wwfpz"].Value.ToString3()) - Int32.Parse(ugr.Cells["Lxz"].Value.ToString3()) + Int32.Parse(ugr.Cells["Fxz"].Value.ToString3()) - Int32.Parse(ugr.Cells["Hgz12"].Value.ToString3());
  433. //离线待处理支:离线支 - 返线支 - 组炉支
  434. int c = Int32.Parse(ugr.Cells["Lxz"].Value.ToString3()) - Int32.Parse(ugr.Cells["Fxz"].Value.ToString3()) - Int32.Parse(ugr.Cells["Zlz"].Value.ToString3());
  435. if (Int32.Parse(ugr.Cells["Hgz12"].Value.ToString3()) > 0)
  436. {
  437. if (b == 0) { ugr.Cells["Ph"].Value = "OK"; }
  438. else
  439. {
  440. if (Int32.Parse(ugr.Cells["Lxz"].Value.ToString3()) == 0)
  441. {
  442. ugr.Cells["Ph"].Value = "清线不齐";
  443. }
  444. else
  445. {
  446. if (c != 0)
  447. {
  448. if (b > 0)
  449. {
  450. ugr.Cells["Ph"].Value = "清线不齐";
  451. }
  452. else
  453. {
  454. ugr.Cells["Ph"].Value = "返线不齐";
  455. }
  456. }
  457. else
  458. {
  459. ugr.Cells["Ph"].Value = "清线不齐";
  460. }
  461. }
  462. }
  463. }
  464. else
  465. {
  466. ugr.Cells["Ph"].Value = "无";
  467. }
  468. //重量差
  469. //ugr.Cells["ZLC"].Value = double.Parse(ugr.Cells["YJD"].Value.ToString3()) - double.Parse(ugr.Cells["XXD"].Value.ToString3());
  470. if (ugr.Cells["Ph"].Value.ToString().Contains("线不齐"))
  471. {
  472. ugr.Appearance.BackColor = Color.IndianRed;
  473. }
  474. if (ugr.Cells["NodeStatus1"].Value.ToString() != "下线")
  475. {
  476. ugr.Appearance.BackColor = Color.SkyBlue;
  477. }
  478. }
  479. wf.Close();
  480. }
  481. catch
  482. {
  483. }
  484. finally
  485. {
  486. wf.Close();
  487. }
  488. }
  489. /// <summary>
  490. /// 组炉数据查询
  491. /// </summary>
  492. private void doQueryFurnace()
  493. {
  494. string ZpJudgeStoveNo = "";
  495. string ZpLotNo = "";
  496. string OldJudgeStoveNo = "";
  497. string ph = "";
  498. string date = "";
  499. string endDate = "";
  500. if (ultraCheckEditor2.Checked)
  501. {
  502. if (DataTimeUtil.JudgeTime(DateTime.Parse(dateTimePicker1.Value.ToString()), DateTime.Parse(dateTimePicker2.Value.ToString())) == 0)
  503. {
  504. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  505. return;
  506. }
  507. else
  508. {
  509. date = dateTimePicker1.Value.ToString();
  510. endDate = dateTimePicker2.Value.ToString();
  511. }
  512. }
  513. if (chkZpJudgeStoveNo.Checked)
  514. {
  515. if (uteZpJudgeStoveNo.Text.Trim() == "")
  516. {
  517. ZpJudgeStoveNo = "";
  518. }
  519. else
  520. {
  521. ZpJudgeStoveNo = uteZpJudgeStoveNo.Value.ToString();
  522. }
  523. }
  524. if (chkZpLotNo.Checked)
  525. {
  526. if (uteZpLotNo.Text.Trim() == "")
  527. {
  528. ZpLotNo = "";
  529. }
  530. else
  531. {
  532. ZpLotNo = uteZpLotNo.Value.ToString();
  533. }
  534. }
  535. if (chkOldJudgeStoveNo.Checked)
  536. {
  537. if (uteOldJudgeStoveNo.Text.Trim() == "")
  538. {
  539. OldJudgeStoveNo = "";
  540. }
  541. else
  542. {
  543. OldJudgeStoveNo = uteOldJudgeStoveNo.Value.ToString();
  544. }
  545. }
  546. if (ultraCheckEditor1.Checked)
  547. {
  548. if (ultraComboEditor1.Value.Equals("0"))
  549. {
  550. ph = "OK";
  551. }
  552. else if (ultraComboEditor1.Value.Equals("1"))
  553. {
  554. ph = "清线不齐";
  555. }
  556. }
  557. WaitingForm2 wf = new WaitingForm2("正在加载,请稍候....");
  558. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getMilOfflineGroup", new Object[] { date, endDate, ZpJudgeStoveNo, ZpLotNo, plineCodes, OldJudgeStoveNo, ph }, this.ob);
  559. GridHelper.CopyDataToDatatable(dt, this.dataTable2, true);
  560. GridHelper.RefreshAndAutoSize(this.ultraGrid2);
  561. wf.Close();
  562. }
  563. /// <summary>
  564. /// 查询
  565. /// </summary>
  566. private void doQuery()
  567. {
  568. if (this.ultraTabControl1.Tabs[0].Active)
  569. {
  570. doQueryMilDateStatisticsBatchSample();
  571. }
  572. else if (this.ultraTabControl1.Tabs[1].Active)
  573. {
  574. doQueryFurnace();
  575. }else if(this.ultraTabControl1.Tabs[2].Active)
  576. {
  577. doQueryMilDateStatisticsBatchSampleNew();
  578. }
  579. }
  580. /// <summary>
  581. /// 打印
  582. /// </summary>
  583. private void doPrint()
  584. {
  585. string date = "";
  586. string endDate = "";
  587. string JudgeStoveNo = "";
  588. string LotNo = "";
  589. string ContractNo = "";
  590. if (chkDate.Checked)
  591. {
  592. if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
  593. {
  594. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  595. return;
  596. }
  597. else
  598. {
  599. date = cmbDate.Value.ToString();
  600. endDate = cmbEndDate.Value.ToString();
  601. }
  602. }
  603. if (chkJudgeStoveNo.Checked)
  604. {
  605. if (uteJudgeStoveNo.Text.Trim() == "")
  606. {
  607. JudgeStoveNo = "";
  608. }
  609. else
  610. {
  611. JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
  612. }
  613. }
  614. if (chkLotNo.Checked)
  615. {
  616. if (uteLotNo.Text.Trim() == "")
  617. {
  618. LotNo = "";
  619. }
  620. else
  621. {
  622. LotNo = uteLotNo.Value.ToString();
  623. }
  624. }
  625. if (chkContractNo.Checked)
  626. {
  627. if (uteContractNo.Text.Trim() == "")
  628. {
  629. ContractNo = "";
  630. }
  631. else
  632. {
  633. ContractNo = uteContractNo.Value.ToString();
  634. }
  635. }
  636. doQuery();
  637. string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilDateStatistics.cpt&__bypagesize__=false&LOT_NO=" + LotNo + "&JUDGE_STOVE_NO=" + JudgeStoveNo + "&DATE=" + date + "&DATE2=" + endDate + "&PLINE_CODE=" + plineCode + "&CONTRACT_NO=" + ContractNo;
  638. FrmRepExcel fre = new FrmRepExcel(this.ob, url);
  639. //fre.AutoSize = true;
  640. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  641. fre.Text = "轧管生产数据统计";
  642. fre.ShowDialog();
  643. }
  644. /// <summary>
  645. /// 查询条件
  646. /// </summary>
  647. /// <param name="sender"></param>
  648. /// <param name="e"></param>
  649. private void chkDate_CheckedChanged(object sender, EventArgs e)
  650. {
  651. if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
  652. if (chkDate.Checked) { cmbEndDate.Enabled = true; } else { cmbEndDate.Enabled = false; }
  653. if (chkLotNo.Checked) { uteLotNo.Enabled = true; } else { uteLotNo.Enabled = false; }
  654. if (chkJudgeStoveNo.Checked) { uteJudgeStoveNo.Enabled = true; } else { uteJudgeStoveNo.Enabled = false; }
  655. if (chkContractNo.Checked) { uteContractNo.Enabled = true; } else { uteContractNo.Enabled = false; }
  656. if (chkOldJudgeStoveNo.Checked) { uteOldJudgeStoveNo.Enabled = true; } else { uteOldJudgeStoveNo.Enabled = false; }
  657. if (chkZpJudgeStoveNo.Checked) { uteZpJudgeStoveNo.Enabled = true; } else { uteZpJudgeStoveNo.Enabled = false; }
  658. if (chkZpLotNo.Checked) { uteZpLotNo.Enabled = true; } else { uteZpLotNo.Enabled = false; }
  659. if (ultraCheckEditor1.Checked) { ultraComboEditor1.Enabled = true; } else { ultraComboEditor1.Enabled = false; }
  660. if (ultraCheckEditor2.Checked) { dateTimePicker1.Enabled = true; } else { dateTimePicker1.Enabled = false; }
  661. if (ultraCheckEditor2.Checked) { dateTimePicker2.Enabled = true; } else { dateTimePicker2.Enabled = false; }
  662. if (chkPlineCode.Checked) { cobPlineCode.Enabled = true; } else { cobPlineCode.Enabled = false; }
  663. if (chkPlineCode2.Checked) { cobPlineCode2.Enabled = true; } else { cobPlineCode2.Enabled = false; }
  664. }
  665. private void chkDate1_CheckedChanged(object sender, EventArgs e)
  666. {
  667. this.cmbDate1.Enabled = this.cmbEndDate1.Enabled = chkDate1.Checked;
  668. }
  669. private void FrmMilDateStatistics2_Load(object sender, EventArgs e)
  670. {
  671. EntityHelper.ShowGridCaption<MilProcessesEntity>(ultraGrid3.DisplayLayout.Bands[0]);
  672. cmbDate.Value = DateTime.Parse(DateTime.Today.ToString());
  673. cmbDate1.Value = DateTime.Parse(DateTime.Today.ToString());
  674. NativeMethodNew na = new NativeMethodNew(this.ob);
  675. departm = UserInfo.GetDepartment();
  676. plineCode = na.GetPCode(departm);//获取 用户 对应的产线
  677. plineCodes = BaseMethod.GetPlineCode(ValidDataPurviewIds, ob);
  678. DateTime now = DateTime.Now;
  679. DateTime date = new DateTime(now.Year, now.Month, 1);
  680. cmbDate.Value = DateTime.Parse(date.ToString("yyyy-MM-dd 07:00"));
  681. cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
  682. cmbDate1.Value = DateTime.Parse(date.ToString("yyyy-MM-dd 07:00"));
  683. cmbEndDate1.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
  684. dateTimePicker1.Value = DateTime.Parse(date.ToString("yyyy-MM-dd 07:00"));
  685. dateTimePicker2.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
  686. //加载产线
  687. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getPlineNameZG", new object[] { plineCodes }, ob);
  688. if (dt != null && dt.Rows.Count > 0)
  689. {
  690. cobPlineCode.DataSource = dt;
  691. cobPlineCode.ValueMember = "PLINE_CODE";
  692. cobPlineCode.DisplayMember = "PLINE_NAME";
  693. cobPlineCode2.DataSource = dt;
  694. cobPlineCode2.ValueMember = "PLINE_CODE";
  695. cobPlineCode2.DisplayMember = "PLINE_NAME";
  696. }
  697. }
  698. /// <summary>
  699. /// 导出
  700. /// </summary>
  701. private void ExportData()
  702. {
  703. if (this.ultraTabControl1.Tabs[0].Active)
  704. {
  705. GridHelper.ulGridToExcel(ultraGrid1, "轧管生产数据汇总");
  706. }
  707. else if (this.ultraTabControl1.Tabs[1].Active)
  708. {
  709. GridHelper.ulGridToExcel(ultraGrid2, "组炉数据");
  710. }
  711. else if (this.ultraTabControl1.Tabs[2].Active)
  712. {
  713. GridHelper.ulGridToExcel(ultraGrid3, "轧管生产数据汇总");
  714. }
  715. }
  716. /// <summary>
  717. /// 非250、258、168、460的产线代码都为空
  718. /// </summary>
  719. /// <returns></returns>
  720. private string getPlineCode()
  721. {
  722. if (plineCode.Equals("C008") || plineCode.Equals("C009") || plineCode.Equals("C010") || plineCode.Equals("C017"))
  723. {
  724. return plineCode;
  725. }
  726. else
  727. {
  728. return "";
  729. }
  730. }
  731. private void chkLotNo1_CheckedChanged(object sender, EventArgs e)
  732. {
  733. this.uteLotNo1.Enabled = chkLotNo1.Checked;
  734. }
  735. private void chkJudgeStoveNo1_CheckedChanged(object sender, EventArgs e)
  736. {
  737. this.uteJudgeStoveNo1.Enabled = chkJudgeStoveNo1.Checked;
  738. }
  739. private void chkContractNo1_CheckedChanged(object sender, EventArgs e)
  740. {
  741. this.uteContractNo1.Enabled = chkContractNo1.Checked;
  742. }
  743. private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  744. {
  745. if (toolMenu == null) return;
  746. if (this.ultraTabControl1.Tabs[0].Active)
  747. {
  748. if (toolMenu.Toolbars[0].Tools.Exists("CloseMilPlan"))
  749. {
  750. toolMenu.Toolbars[0].Tools["CloseMilPlan"].InstanceProps.Visible = DefaultableBoolean.False;
  751. }
  752. if (toolMenu.Toolbars[0].Tools.Exists("CancelCloseMilPlan"))
  753. {
  754. toolMenu.Toolbars[0].Tools["CancelCloseMilPlan"].InstanceProps.Visible = DefaultableBoolean.False;
  755. }
  756. if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
  757. {
  758. toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.False;
  759. }
  760. }
  761. else if (this.ultraTabControl1.Tabs[1].Active)
  762. {
  763. if (toolMenu.Toolbars[0].Tools.Exists("CloseMilPlan"))
  764. {
  765. toolMenu.Toolbars[0].Tools["CloseMilPlan"].InstanceProps.Visible = DefaultableBoolean.False;
  766. }
  767. if (toolMenu.Toolbars[0].Tools.Exists("CancelCloseMilPlan"))
  768. {
  769. toolMenu.Toolbars[0].Tools["CancelCloseMilPlan"].InstanceProps.Visible = DefaultableBoolean.False;
  770. }
  771. if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
  772. {
  773. toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.False;
  774. }
  775. }
  776. else
  777. {
  778. if (toolMenu.Toolbars[0].Tools.Exists("CloseMilPlan"))
  779. {
  780. toolMenu.Toolbars[0].Tools["CloseMilPlan"].InstanceProps.Visible = DefaultableBoolean.True;
  781. }
  782. if (toolMenu.Toolbars[0].Tools.Exists("CancelCloseMilPlan"))
  783. {
  784. toolMenu.Toolbars[0].Tools["CancelCloseMilPlan"].InstanceProps.Visible = DefaultableBoolean.True;
  785. }
  786. if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
  787. {
  788. toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.True;
  789. }
  790. }
  791. }
  792. private void FrmMilDateStatistics2_Shown(object sender, EventArgs e)
  793. {
  794. if (toolMenu == null) return;
  795. if (toolMenu.Toolbars[0].Tools.Exists("CloseMilPlan"))
  796. {
  797. toolMenu.Toolbars[0].Tools["CloseMilPlan"].InstanceProps.Visible = DefaultableBoolean.False;
  798. }
  799. if (toolMenu.Toolbars[0].Tools.Exists("CancelCloseMilPlan"))
  800. {
  801. toolMenu.Toolbars[0].Tools["CancelCloseMilPlan"].InstanceProps.Visible = DefaultableBoolean.False;
  802. }
  803. if (toolMenu.Toolbars[0].Tools.Exists("Refresh"))
  804. {
  805. toolMenu.Toolbars[0].Tools["Refresh"].InstanceProps.Visible = DefaultableBoolean.False;
  806. }
  807. }
  808. }
  809. }