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;
using CoreFS.CA06;
using Core.Mes.Client.Comm.Control;
using Core.Mes.Client.Comm.Tool;
using Infragistics.Win.UltraWinGrid;
using com.steering.mes.mcp.entity;
using Core.Mes.Client.Comm.Server;
using Core.StlMes.Client.Mcp.Control;
namespace Core.StlMes.Client.Mcp.Treatment
{
public partial class HttOfficeDirect : FrmBase
{
UltraGridRow uge = null;
string gx = "";
public HttOfficeDirect()
{
InitializeComponent();
}
public HttOfficeDirect(OpeBase ob, UltraGridRow ugr,string GX)
{
InitializeComponent();
this.ob = ob;
uge = ugr;
gx = GX;
}
//public override void ToolBar_Click(object sender, string ToolbarKey)
//{
// switch (ToolbarKey)
// {
// case "doQuery":
// get_PurUoms();
// break;
// case "doAdd":
// add_PurUoms();
// break;
// //case "doModify":
// // upd_PurUoms();
// // break;
// case "doDelete":
// del_PurUoms();
// break;
// case "Close":
// this.Close();
// break;
// }
//}
///
/// 查询
///
///
public void Query()
{
string startTim = "";
string endTim = "";
string heatid = "";
string judgeno = "";
if (chkTim.Checked)
{
if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
{
MessageUtil.ShowTips("选择时间区间错误,请重新选择!");
return;
}
else
{
startTim = this.StartTime.Value.ToString("yyyy-MM-dd 00:00:00");
endTim = this.EndTime.Value.ToString("yyyy-MM-dd 23:59:59");
}
}
if (!string.IsNullOrEmpty(planid.Text.Trim()))
{
heatid = planid.Text.ToString().Trim();
}
if(!string.IsNullOrEmpty(judgeNo.Text.Trim()))
{
judgeno = judgeNo.Text.ToString().Trim();
}
DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttOfficeDirect.doQuery", new object[] { startTim,endTim, heatid, judgeno }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
if(dt.Rows.Count<=0)
{
dataTable2.Clear();
}
}
///
/// 增加废品原因
/////
/////
//public void Add()
//{
// string heatno = "";
// string lotno = "";
// string pline = "";
// string process = "";
// string officed = "";
// if (txtheatno.Text != "" && txtheatno.Text != null)
// {
// heatno = txtheatno.Text;
// }
// else
// {
// MessageUtil.ShowTips("请输入炉号!");
// return;
// }
// if (txtlotno.Text != "" && txtlotno.Text != null)
// {
// lotno = txtlotno.Text;
// }
// else
// {
// MessageUtil.ShowTips("请输入批号!");
// return;
// }
// if (txtpline.Text != "" && txtpline.Text != null)
// {
// pline = txtpline.Text;
// }
// else
// {
// MessageUtil.ShowTips("请输入生产产线!");
// return;
// }
// if (txtprocess.Text != "" && txtprocess.Text != null)
// {
// process = txtprocess.Text;
// }
// else
// {
// MessageUtil.ShowTips("请输入工序!");
// return;
// }
// if (txtdirect.Text != "" && txtdirect.Text != null)
// {
// officed = txtdirect.Text;
// }
// else
// {
// MessageUtil.ShowTips("请输入离线去向!");
// return;
// }
// CoreClientParam ccp = new CoreClientParam();
// ccp.ServerName = "com.steering.mes.mcp.Mch.FrmReason";
// ccp.MethodName = "addOfficeD";
// ccp.ServerParams = new Object[] { heatno, lotno, pline, process, officed };
// ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
// if (ccp.ReturnCode != -1)
// {
// MessageUtil.ShowTips(ccp.ReturnInfo);
// if (ccp.ReturnInfo.Equals("新增成功!"))
// {
// Query();
// }
// }
// //ConfigureClassCommon.doActiveSelRow(ultraGrid1, "UomCode", UomsEntity.UomCode);//激活当前行
//}
///////
/////// 修改离线去向
///////
///////
//public void upd_PurUoms()
//{
// UltraGridRow urg = ultraGrid1.ActiveRow;
// FrmMchPersonentity result = new FrmMchPersonentity();
// result.Name = urg.Cells["NAME"].Value.ToString();
// result.PlineCode = txt_pline.Text;
// result.ProBc = txt_banci.Text;
// CoreClientParam ccp = new CoreClientParam();
// ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMchPerson";
// ccp.MethodName = "updatePerson";
// ccp.ServerParams = new Object[] { result, txtheatno.Text };
// ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
// if (ccp.ReturnCode != -1)
// {
// MessageUtil.ShowTips(ccp.ReturnInfo);
// if (ccp.ReturnInfo.Equals("修改成功!"))
// {
// get_PurUoms();
// }
// }
//}
private void FrmReason_Load(object sender, EventArgs e)
{
if (uge == null)
{
return;
}
else
{
init();
}
//产线
//DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMchPerson.doQuerypline", null, this.ob);//如果是“”里面添加的是条件
//pline.DataSource = dt;
//pline.DisplayMember = "PLINE_NAME";
//pline.ValueMember = "PLINE_CODE";
//YdmBaseClass.SetComboItemHeight(pline);
//txt_pline.DataSource = dt;
//txt_pline.DisplayMember = "PLINE_NAME";
//txt_pline.ValueMember = "PLINE_CODE";
//YdmBaseClass.SetComboItemHeight(txt_pline);
}
//界面初始化
private void init()
{
try
{
this.Cursor = Cursors.WaitCursor;
String heatplanno = uge.Cells["HEAT_PLAN_NO"].Value.ToString();
String lotno = uge.Cells["BATCH_NO"].Value.ToString();
String plinename = uge.Cells["PLINE_NAME"].Value.ToString();
}
catch (Exception ex)
{
MessageUtil.ShowTips("加载数据失败:" + ex.Message);
}
finally
{
this.Cursor = Cursors.Default;
}
}
/////
///// 删除废品原因
/////
/////
public void Delete()
{
if (ultraGrid1.ActiveRow != null)
{
UltraGridRow urg = ultraGrid1.ActiveRow;
if (urg != null)
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.mcp.Mch.FrmReason";
ccp.MethodName = "deletePerson";
ccp.ServerParams = new Object[] { urg.Cells["FAIL_REASON"].Value.ToString() };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("删除成功!"))
{
Query();
}
}
}
else
{
MessageUtil.ShowTips("请选择一条数据");
return;
}
}
}
private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
{
switch (e.Tool.Key.ToString())
{
case "Query":
Query();
break;
//case "Add":
// Add();
// break;
//case "Delete":
// Delete();
// break;
case "Close":
this.Close();
break;
}
}
private void ultraGrid4_AfterRowActivate(object sender, EventArgs e)
{
string heatno = "";
string plinCode = "";
UltraGridRow urg = ultraGrid4.ActiveRow;
if(urg!=null)
{
heatno = urg.Cells["HEAT_PLAN_NO"].Value.ToString();
plinCode = urg.Cells["PLINE_CODE"].Value.ToString();
DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttOfficeDirect.queryOfficeD", new object[] { heatno,plinCode }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
}
}
}
}