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 Core.StlMes.Client.ZGMil.ResultConrtrol;
using Core.StlMes.Client.ZGMil.Signature;
using CoreFS.CA06;
using Infragistics.Win.UltraWinGrid;
using System;
using System.Collections;
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 FrmMilDateWaitingDecision : FrmBase
{
private string departm = "";
private string plineCode = "";
public FrmMilDateWaitingDecision()
{
InitializeComponent();
this.IsLoadUserView = true;
}
///
/// 重写基类方法
///
///
///
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "Query":
doQuery();
break;
case "Save":
doSave();
break;
case "Export":
ExportData();
break;
case "Close":
this.Close();
break;
}
}
private void doSave()
{
ultraGrid1.UpdateData();
ArrayList parm = new ArrayList();
IQueryable uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
if (uGrid.Count() == 0)
{
MessageUtil.ShowTips("请选择要保存的数据!");
return;
}
foreach (UltraGridRow uRow in uGrid)
{
ArrayList list = new ArrayList();
list.Add(uRow.Cells["WAITING_DECISION_MEMO"].Value.ToString());
list.Add(uRow.Cells["AGAIN_MEMO"].Value.ToString());
list.Add(uRow.Cells["IS_VISIBLE"].Value.ToString());
list.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
list.Add(uRow.Cells["PRO_PLAN_ID"].Value.ToString());
list.Add(uRow.Cells["GX_PLAN_NO"].Value.ToString());
parm.Add(list);
}
int count = ServerHelper.SetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.saveMilDateWaitingDecision", new object[] { parm }, this.ob);
MessageUtil.ShowTips("保存成功!");
doQuery();
}
///
/// 查询
///
private void doQuery()
{
string date = "";
string endDate = "";
string JudgeStoveNo = "";
string LotNo = "";
string ContractNo = "";
string plineCode = "";
string VALIDFLAG = "";
string IsVisible = "";
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();
}
}
if (chkPlineCode.Checked)
{
plineCode = cobPlineCode.Value.ToString();
}
if (chkVALIDFLAG.Checked)
{
VALIDFLAG = cobVALIDFLAG.Value.ToString();
}
if (chkIsVisible.Checked)
{
IsVisible = cobIsVisible.Value.ToString();
}
WaitingForm2 wf = new WaitingForm2("正在加载,请稍候....");
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getFrmMilDateWaitingDecision", new Object[] { date, endDate, JudgeStoveNo, LotNo, ContractNo, plineCode, VALIDFLAG, IsVisible }, this.ob);
GridHelper.CopyDataToDatatable(dt, this.dataTable2, true);
GridHelper.RefreshAndAutoSize(this.ultraGrid1);
wf.Close();
}
///
/// 查询条件
///
///
///
private void chkDate_CheckedChanged(object sender, EventArgs e)
{
if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
if (chkDate.Checked) { cmbEndDate.Enabled = true; } else { cmbEndDate.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; }
if (chkPlineCode.Checked) { cobPlineCode.Enabled = true; } else { cobPlineCode.Enabled = false; }
if (chkVALIDFLAG.Checked) { cobVALIDFLAG.Enabled = true; } else { cobVALIDFLAG.Enabled = false; }
if (chkIsVisible.Checked) { cobIsVisible.Enabled = true; } else { cobIsVisible.Enabled = false; }
}
private void FrmMilDateWaitingDecision_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);//获取 用户 对应的产线
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 23:59:59"));
//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);
}
///
/// 导出
///
private void ExportData()
{
GridHelper.ulGridToExcel(ultraGrid1, "轧管生产按炉跟踪判定情况");
}
}
}