using Core.Mes.Client.Comm.Control;
using Core.Mes.Client.Comm.Server;
using Core.Mes.Client.Comm.Tool;
using Core.StlMes.Client.Mcp.Control;
using CoreFS.CA06;
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.Mcp.Treatment.Report
{
public partial class FrmHttProcessQurey : FrmBase
{
private string plineCode = "";
private string manageNmae = ""; //科室名称
private string stationCode = "600201";//工序点代码
private string[] plineCodes = new string[] { };
public FrmHttProcessQurey()
{
InitializeComponent();
this.IsLoadUserView = true;
}
private void FrmProcessQurey_Load(object sender, EventArgs e)
{
//DateTime now = DateTime.Now;
//DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
//DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
//StartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
//EndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
StartTime.Value = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 21:00"));
EndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 20:59"));
manageNmae = UserInfo.GetDepartment();
//plineCode = YdmBaseClass.GetPCode(manageNmae, this.ob);//获取 用户 对应的产线
plineCodes= comm.InitDropPlineCodePower("F", txt_PlinCode, this.ValidDataPurviewIds, this.ob);
txt_PlinCode.SelectedIndex = 0;
}
public override void ToolBar_Click(object sender, string ToolbarKey)
{
//base.ToolBar_Click(sender, ToolbarKey);
switch (ToolbarKey)
{
case "Query":
DoQuery();
break;
case "Export":
GridHelper.ulGridToExcel(ultraGrid1, "热处理进程数据统计");
break;
case "Close":
this.Close();
break;
}
}
///
/// 查询
///
///
private void DoQuery()
{
string judgeNo = "";
string batchNo = "";
string orderNo = "";
if (!CheckQuery()) return;
string staTime = "";
string endTime = "";
if (chkTim.Checked)
{
staTime = StartTime.Value.ToString();
endTime = EndTime.Value.ToString();
}
if (chkLotNo.Checked)
{
batchNo = this.txtLotNo.Text.Trim();
}
if (chkJugeHeatNo.Checked)
{
judgeNo = this.txtJugeNo.Text.Trim();
}
if (chkOrder.Checked)
{
orderNo = this.txtOrder.Text.Trim();
}
ArrayList list = new ArrayList();
list.Add(staTime);
list.Add(endTime);
list.Add(judgeNo);
list.Add(batchNo);
list.Add(orderNo);
list.Add(uceStatus.SelectedIndex == -1 ? "" : uceStatus.SelectedItem.DataValue.ToString2());
DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmRCLPerformance.doQueryPort", new object[] { list, plineCode == "" ? plineCodes : new string[] { plineCode }, stationCode }, ob);
GridHelper.CopyDataToDatatable(ref dt1, ref dataTable1, true);
}
private void chkTim_CheckedChanged(object sender, EventArgs e)
{
if (chkTim.Checked) { StartTime.Enabled = true; EndTime.Enabled = true; } else { StartTime.Enabled = false; EndTime.Enabled = false; }
if (chkJugeHeatNo.Checked) { txtJugeNo.Enabled = true; } else { txtJugeNo.Enabled = false; }
if (chkLotNo.Checked) { txtLotNo.Enabled = true; } else { txtLotNo.Enabled = false; }
if (chkOrder.Checked) { txtOrder.Enabled = true; }
else
{
txtOrder.Enabled = false;
}
}
///
/// 数据验证
///
///
private bool CheckQuery()
{
if (DataTimeUtil.JudgeTime(DateTime.Parse(StartTime.Value.ToString()), DateTime.Parse(EndTime.Value.ToString())) == 0)
{
MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
return false;
}
if (this.chkJugeHeatNo.Checked && string.IsNullOrEmpty(this.txtJugeNo.Text.Trim()))
{
MessageUtil.ShowWarning("请输入炉号!");
return false;
}
if (this.chkLotNo.Checked && string.IsNullOrEmpty(this.txtLotNo.Text.Trim()))
{
MessageUtil.ShowWarning("请输入批号!");
return false;
}
if (this.chkOrder.Checked && string.IsNullOrEmpty(this.txtOrder.Text.Trim()))
{
MessageUtil.ShowWarning("请输入合同号!");
return false;
}
return true;
}
private void txt_PlinCode_TextChanged(object sender, EventArgs e)
{
plineCode = txt_PlinCode.SelectedItem.DataValue.ToString();
}
private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{
if (int.Parse(e.Row.Cells["FLAG1"].Value.ToString3()) > 0)
{
e.Row.Appearance.BackColor = lbColor1.BackColor;
}
else if (int.Parse(e.Row.Cells["FLAG"].Value.ToString3())>0)
{
e.Row.Appearance.BackColor = lbColor2.BackColor;
}
}
}
}