| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.ZGMil.Entity;
- using CoreFS.CA06;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.ZGMil.Report
- {
- public partial class FrmMilStaOutput : FrmBase
- {
- private string departm = "";
- private string plineCode = "";
- private string plineName = "";
- private string date = "";
- private string endDate = "";
- private string yearM = "";
- public FrmMilStaOutput()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- private void FrmMilStaOutput_Load(object sender, EventArgs e)
- {
- dateTimePicker1.Value = DateTime.Parse(DateTime.Today.ToString());
- NativeMethodNew na = new NativeMethodNew(this.ob);
- departm = UserInfo.GetDepartment();
- plineCode = na.GetPCode(departm);//获取 用户 对应的产线
- plineName = getPlineName(plineCode);
- yearM = dateTimePicker1.Value.ToString("yyyy年MM月");
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQuery();
- break;
- case "Export":
- ExportData();
- break;
- case "Print":
- PrintData();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void PrintData()
- {
- DateTime dtTarget = dateTimePicker1.Value;
- DateTime FirstDay = dtTarget.AddDays(-dtTarget.AddMonths(1).Day);
- DateTime LastDay = dtTarget.AddMonths(1).AddDays(-dtTarget.AddMonths(1).Day);
- date = FirstDay.ToString("yyyy-MM-dd 21:00:00");
- endDate = LastDay.ToString("yyyy-MM-dd 21:00:00");
- string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilStaOutput.cpt&op=view&PLINE_CODE=" + getPlineCode() + "&date=" + date + "&endDate=" + endDate;
- FrmRepExcel fre = new FrmRepExcel(ob, strurl);
- fre.AutoSize = true;
- fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fre.WindowState = FormWindowState.Maximized;
- fre.Show();
- }
- private void doQuery()
- {
- if (ultraCheckEditor1.Checked)
- {
- DateTime dtTarget = dateTimePicker1.Value;
- DateTime FirstDay = dtTarget.AddDays(-dtTarget.AddMonths(1).Day);
- DateTime LastDay = dtTarget.AddMonths(1).AddDays(-dtTarget.AddMonths(1).Day);
- date = FirstDay.ToString("yyyy-MM-dd 21:00:00");
- endDate = LastDay.ToString("yyyy-MM-dd 21:00:00");
-
- }
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getMilStaOutput", new Object[] { date, endDate, getPlineCode() }, this.ob);
- GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
- GridHelper.RefreshAndAutoSize(this.ultraGrid1);
- }
- private void ExportData()
- {
- GridHelper.ulGridToExcel(ultraGrid1, "轧管部" + plineName + "产量报表");
- }
- /// <summary>
- /// 非250、258、168、460的产线代码都为空
- /// </summary>
- /// <returns></returns>
- private string getPlineCode()
- {
- if (plineCode.Equals("C008") || plineCode.Equals("C009") || plineCode.Equals("C010") || plineCode.Equals("C017"))
- {
- return plineCode;
- }
- else
- {
- return "";
- }
- }
- /// <summary>
- /// 机组
- /// </summary>
- /// <param name="plineCode"></param>
- /// <returns></returns>
- private string getPlineName(string plineCode)
- {
-
- if (plineCode.Equals("C008"))
- {
- return "250机组";
- }
- else if(plineCode.Equals("C009"))
- {
- return "258机组";
- }else if(plineCode.Equals("C010"))
- {
- return "168机组";
- }else if(plineCode.Equals("C017"))
- {
- return "460机组";
- }else
- {
- return "";
- }
- }
- /// <summary>
- /// 查询条件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void chkDate_CheckedChanged(object sender, EventArgs e)
- {
- if (ultraCheckEditor1.Checked) { dateTimePicker1.Enabled = true; } else { dateTimePicker1.Enabled = false; }
- }
- }
- }
|