| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.ZGMil.Common;
- using Core.StlMes.Client.ZGMil.Entity;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- 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 FrmMilOutputStatistics : FrmBase
- {
- private string departm = "";
- private string plineCode = "";
- private string[] plineCodes = { };
- public FrmMilOutputStatistics()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- /// <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 "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void doQuery()
- {
- string date = "";
- string endDate = "";
- string JudgeStoveNo = "";
- string LotNo = "";
- string ContractNo = "";
- if (chkDate.Checked)
- {
- if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
- {
- MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
- return;
- }
- else
- {
- date = cmbDate.Value.ToString();
- endDate = cmbEndDate.Value.ToString();
- }
- }
- if (chkJudgeStoveNo.Checked)
- {
- if (uteJudgeStoveNo.Text.Trim() == "")
- {
- JudgeStoveNo = "";
- }
- else
- {
- JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
- }
- }
- if (chkLotNo.Checked)
- {
- if (uteLotNo.Text.Trim() == "")
- {
- LotNo = "";
- }
- else
- {
- LotNo = uteLotNo.Value.ToString();
- }
- }
- if (chkContractNo.Checked)
- {
- if (uteContractNo.Text.Trim() == "")
- {
- ContractNo = "";
- }
- else
- {
- ContractNo = uteContractNo.Value.ToString();
- }
- }
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getMilOutputStatistics", new Object[] { date, endDate, JudgeStoveNo, LotNo, plineCodes }, this.ob);
- GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
- GridHelper.RefreshAndAutoSize(this.ultraGrid1);
- ChangeGridColor();
- }
- /// <summary>
- /// 数据不平的颜色红
- /// </summary>
- public void ChangeGridColor()
- { int a = 0;
- foreach(UltraGridRow ugr in ultraGrid1.Rows)
- {
- a = int.Parse(ugr.Cells["YJ"].Value.ToString()) - int.Parse(ugr.Cells["CC"].Value.ToString()) -int.Parse(ugr.Cells["FEI"].Value.ToString()) ;
- if (ugr.Cells["NODE_STATUS1"].Value.ToString() == "入库" && a >0)
- {
- ugr.Appearance.BackColor = Color.Red;
- }
- }
- }
- /// <summary>
- /// 查询条件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void chkDate_CheckedChanged(object sender, EventArgs e)
- {
- if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
- if (chkLotNo.Checked) { uteLotNo.Enabled = true; } else { uteLotNo.Enabled = false; }
- if (chkJudgeStoveNo.Checked) { uteJudgeStoveNo.Enabled = true; } else { uteJudgeStoveNo.Enabled = false; }
- if (chkContractNo.Checked) { uteContractNo.Enabled = true; } else { uteContractNo.Enabled = false; }
- }
- private void FrmMilOutputStatistics_Load(object sender, EventArgs e)
- {
- cmbDate.Value = DateTime.Parse(DateTime.Today.ToString());
- NativeMethodNew na = new NativeMethodNew(this.ob);
- departm = UserInfo.GetDepartment();
- plineCode = na.GetPCode(departm);//获取 用户 对应的产线
- plineCodes = BaseMethod.GetPlineCode(ValidDataPurviewIds, ob);
- DateTime now = DateTime.Now;
- DateTime date = new DateTime(now.Year, now.Month, 1);
- cmbDate.Value = DateTime.Parse(date.ToString("yyyy-MM-dd"));
- cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
- //cmbEndDate.Value = DateTime.Parse(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 06:59:59"));
- //cmbDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 07:00:00"));
- //TubeRoll.SetComboItemHeight(uteLotNo);
- //TubeRoll.SetComboItemHeight(cmbBz);
- }
- /// <summary>
- /// 导出
- /// </summary>
- private void ExportData()
- {
- GridHelper.ulGridToExcel(ultraGrid1, "轧管产出统计");
- }
- /// <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 "";
- }
- }
- }
- }
|