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 Core.StlMes.Client.Mcp.Mch.Entity;
using com.steering.mes.mcp.entity;
using Core.Mes.Client.Comm.Server;
using Core.StlMes.Client.Mcp.Control;
namespace Core.StlMes.Client.Mcp.Mch.MchResult
{
public partial class FrmOfficeD : FrmBase
{
UltraGridRow uge = null;
string gx = "";
public FrmOfficeD()
{
InitializeComponent();
}
public FrmOfficeD(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()
{
DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmOfficeD.doQuery", new object[] { textheatNo.Text.Trim(), textPline.Text.Trim() }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
}
///
/// 增加离线去向
/////
/////
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.FrmOfficeD";
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 FrmOfficeD_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["LAST_BATCH_NO"].Value.ToString();
String plinename = uge.Cells["PLINE_NAME"].Value.ToString();
txtheatno.Value = heatplanno.Trim().ToString();
txtlotno.Value = lotno.Trim().ToString();
txtprocess.Value = gx.Trim().ToString();
txtpline.Value = plinename.Trim().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.FrmOfficeD";
ccp.MethodName = "deletePerson";
ccp.ServerParams = new Object[] { urg.Cells["OFFICE_D"].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;
}
}
}
}