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 QMAPP.Entity;
using QMAPP.ServicesAgent;
using QMAPP.FJC.Entity.Produce;
using QMAPP.MD.Entity;
namespace QMAPP.WinForm.Forms.Test
{
public partial class Door_frameForm : Form
{
Product recorder = new Product();//编辑保存实体
public Door_frameForm()
{
InitializeComponent();
}
///
/// 校验料架零件号
///
///
///
private void textBox1_CheckRackCode(object sender, EventArgs e)
{
var rockcode=this.textBox1.Text;
Material material = new Material();
material.MATERIAL_CODE = rockcode;
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
DataResult result;
if (!string.IsNullOrEmpty(rockcode))
{
result = agent.InvokeServiceFunction>("MaterialBLL_Get", material);
if (result.Result==null)
{
lblError.Text = string.Format("{0}料架零件号不存在!", textBox1.Text);
this.lblError.ForeColor = Color.Red;
}
}
}
///
/// 料箱零件号
///
///
///
private void textBox2_CheckCaseMaterialCode(object sender, EventArgs e)
{
var casematerialcode=this.textBox2.Text;
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
//DataResult result;
//if (!string.IsNullOrEmpty(casematerialcode))
//{
// //result = agent.InvokeServiceFunction>(B9BasicService.InjectionRecorderBLL_Insert.ToString(), rockcode);
// if (1 != 1)
// {
// lblError.Text = string.Format("{0}料箱零件号不存在!", textBox2.Text);
// this.lblError.ForeColor = Color.Red;
// }
//}
if (this.textBox2.Text != this.textBox1.Text)
{
lblError.Text = string.Format("{0}料箱零件号和料架零件号不同!", textBox2.Text);
this.lblError.ForeColor = Color.Red;
}
}
///
/// 箱号
///
///
///
private void textBox3_CheckCaseCode(object sender, EventArgs e)
{
var casecode = this.textBox3.Text;
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
Product productinfo = new Product();
if (!string.IsNullOrEmpty(casecode))
{
productinfo.PRODUCTCODE = casecode;
List product = agent.InvokeServiceFunction>(B9BasicService.ProductBLL_GetAllList.ToString(), productinfo);
if (product.Count>0)
{
lblError.Text = string.Format("{0}箱号已存在!", textBox3.Text);
this.lblError.ForeColor = Color.Green;
}
else
{
//不存在则插入
DataResult result = agent.InvokeServiceFunction>(B9BasicService.ProductBLL_Insert.ToString(), productinfo);
if (result.IsSuccess)
{
lblError.Text = string.Format("{0}插入成功!", textBox3.Text);
this.lblError.ForeColor = Color.Green;
}
}
}
}
}
}