using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using CoreFS.CA06;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Core.StlMes.Client.ZGMil.Entity;
using Core.StlMes.Client.ZGMil.Signature;
using Core.Mes.Client.Comm.Server;
using Core.Mes.Client.Comm.Control;
using System.Collections;
using Core.Mes.Client.Comm.Tool;
using Core.StlMes.Client.ZGMil.ResultConrtrol;
using Infragistics.Win.UltraWinGrid;
using Core.StlMes.Client.ZGMil.Common;
namespace Core.StlMes.Client.ZGMil.Report
{
///
/// 在线外观检验质量原始记录
///
public partial class FrmMilQualityEvaluationFeiPing : FrmBase
{
private string departm = "";
private string plineCode = "";
private string[] plineCodes = { };
private string heatNo = "";
public FrmMilQualityEvaluationFeiPing()
{
InitializeComponent();
this.IsLoadUserView = true;
}
private void FrmMilQualityEvaluationFeiPing_Load(object sender, EventArgs e)
{
NativeMethodNew na = new NativeMethodNew(this.ob);
departm = UserInfo.GetDepartment();
plineCode = na.GetPCode(departm);//获取 用户 对应的产线
plineCodes = BaseMethod.GetPlineCode(ValidDataPurviewIds, ob);
cmbEndDate.Value = DateTime.Parse(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 20:59:59"));
cmbDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 21:00:00"));
TubeRoll.SetComboItemHeight(cmbBc);
TubeRoll.SetComboItemHeight(cmbBz);
}
///
/// 重写基类方法
///
///
///
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "Query":
doQuery();
break;
case "Export":
doExport();
break;
case "DoPrint":
doPrint();
break;
case "Close":
this.Close();
break;
}
}
///
/// 导出
///
private void doPrint()
{
GridHelper.ulGridToExcel(ultraGrid1, "在线外观检验废品明细");
}
private void chkDate_CheckedChanged(object sender, EventArgs e)
{
if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
if (chkBc.Checked) { cmbBc.Enabled = true; } else { cmbBc.Enabled = false; }
if (chkBz.Checked) { cmbBz.Enabled = true; } else { cmbBz.Enabled = false; }
if (chkJudgeStoveNo.Checked) { uteJudgeStoveNo.Enabled = true; } else { uteJudgeStoveNo.Enabled = false; }
}
///
/// 查询
///
private void doQuery()
{
ArrayList list = new ArrayList();
string date = "";
string endDate = "";
string bc = "";
string bz = "";
string JudgeStoveNo = "";
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 (chkBz.Checked)
{
if (cmbBz.Text.Trim() == "")
{
//MessageUtil.ShowTips("班组不能为空!");
//return;
bz = "";
}
else
{
bz = cmbBz.Value.ToString();
}
}
if (chkBc.Checked)
{
if (cmbBc.Text.Trim() == "")
{
//MessageUtil.ShowTips("班次不能为空!");
//return;
bc = "";
}
else
{
bc = cmbBc.Value.ToString();
}
}
if (chkJudgeStoveNo.Checked)
{
if (uteJudgeStoveNo.Text.Trim() == "")
{
//MessageUtil.ShowTips("班次不能为空!");
//return;
JudgeStoveNo = "";
}
else
{
JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
}
}
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilQualityEvaluation.queryMinResultFeiPing", new Object[] { date, endDate, bc, bz, plineCodes, JudgeStoveNo }, this.ob);
GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
GridHelper.RefreshAndAutoSize(this.ultraGrid1);
}
///
/// 打印
///
private void doExport()
{
string date = "";
string endDate = "";
string bc = "";
string bz = "";
//if (!chkDate.Checked)
//{
// MessageUtil.ShowTips("请选择生产日期!");
// return;
//}
if (!chkBz.Checked)
{
MessageUtil.ShowTips("请选择班组!");
return;
}
if (!chkBc.Checked)
{
MessageUtil.ShowTips("请选择班次!");
return;
}
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 (heatNo == null)
{
MessageUtil.ShowTips("请选择炉号!");
return;
}
if (chkBz.Checked)
{
if (cmbBz.Text.Trim() == "")
{
//MessageUtil.ShowTips("班组不能为空!");
//return;
bz = "";
}
else
{
bz = cmbBz.Value.ToString();
}
}
if (chkBc.Checked)
{
if (cmbBc.Text.Trim() == "")
{
//MessageUtil.ShowTips("班次不能为空!");
//return;
bc = "";
}
else
{
bc = cmbBc.Value.ToString();
}
}
//doQuery();
ColUserName colU = new ColUserName();
colU.Ob = this.ob;
colU.PlineCode = plineCode;
colU.ColGroup = bz;
colU.ColOrder = bc;
colU.StationId = "9";
if (plineCode.Equals("C017"))
{
colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation460.cpt&format=pdf&__bypagesize__=false&JUDGE_STOVE_NO=" + heatNo;
}
else if (plineCode.Equals("C010"))
{
colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation168.cpt&format=pdf&__bypagesize__=false&JUDGE_STOVE_NO=" + heatNo;
}
else if (plineCode.Equals("C009"))
{
colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation258.cpt&format=pdf&__bypagesize__=false&JUDGE_STOVE_NO=" + heatNo;
//colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepTechOrderLineCraft.cpt&format=pdf&__bypagesize__=false&format=pdf&__embed__=true&desgin_key=8a4d6fd1109a46f892ed9882d91a5935";
}
else if (plineCode.Equals("C008"))
{
colU.Url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation250.cpt&format=pdf&__bypagesize__=false&JUDGE_STOVE_NO=" + heatNo;
}
colU.StartTim = date;
colU.EndTim = endDate;
colU.StrText = "在线外观检验质量原始记录报表";
colU.Flag = "0";
colU.ShowDialog();
//string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilFeedSawResult.cpt&__bypagesize__=false&SHIFT=" + bc + "&GROUP=" + bz + "&DATE=" + date + "&DATE2=" + endDate + "&PLINECODE=" + plineCode;
//FrmRepExcel fre = new FrmRepExcel(this.ob,url);
////fre.AutoSize = true;
//fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
//fre.Text = "上料锯切报表";
//fre.ShowDialog();
}
/////
///// 查询上料管号队列
/////
//public void GetFeedRack()
//{
// UltraGridRow ugr = ultraGrid1.ActiveRow;
// if (ugr != null)
// {
// string JudgeStoveNo = "";
// JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
// DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.report.SurfaceInspectionResult.getSurfaceRackSeq", new object[] { JudgeStoveNo, "1" }, this.ob);
// dtMatSeq_3.Clear();
// GridHelper.CopyDataToDatatable(ref dt1, ref dtMatSeq_3, true);
// }
// ChangeGridColor();
//}
///
/// 获取指定炉号的缺陷项
///
//private void getDefectData()
//{
// UltraGridRow ugr = ultraGrid1.ActiveRow;
// if (ugr != null)
// {
// string jugeNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
// DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilQualityEvaluation.getDefectData", new object[] { jugeNo }, this.ob);
// this.dtDefectS.Clear();
// GridHelper.CopyDataToDatatable(ref ds, ref this.dtDefectS, true);
// }
//}
///
/// 查询抽检管记录
///
///
//private void SizeCheckQuery()
//{
// UltraGridRow ugr = ultraGrid1.ActiveRow;
// if (ugr != null)
// {
// string jugeNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
// DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilQualityEvaluation.sizeCheckQuery", new object[] { jugeNo }, this.ob);
// this.dtSize.Clear();
// GridHelper.CopyDataToDatatable(ref dt, ref this.dtSize, true);
// }
//}
private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
{
if (this.dataTable1.Rows.Count > 0)
{
UltraGridRow ugr = ultraGrid1.ActiveRow;
if (ugr != null)
{
heatNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
}
}
}
}
}