You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
166 lines
5.7 KiB
166 lines
5.7 KiB
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.WinForm.Common;
|
|
using QMAPP.FJC.Entity.Operation;
|
|
using QMAPP.Entity;
|
|
|
|
namespace QMAPP.WinForm.Forms.Mend
|
|
{
|
|
public partial class ProductCheckValuesFrom : Form
|
|
{
|
|
CheckValueItem searchModel = new CheckValueItem();
|
|
CheckWithMaterial recorder = new CheckWithMaterial();
|
|
ProductCheckAddForm addForm = new ProductCheckAddForm();
|
|
public ProductCheckValuesFrom(ProductCheckAddForm checkcode)
|
|
{
|
|
addForm = checkcode;
|
|
recorder.CHECKITEMCODE = addForm.DGData.SelectedRows[0].Cells["CHECKITEMCODE"].Value.ToString();
|
|
InitializeComponent();
|
|
}
|
|
|
|
#region 窗体加载
|
|
/// <summary>
|
|
/// 窗体加载
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void ProductCheckValuesFrom_Load(object sender, EventArgs e)
|
|
{
|
|
new KeyEvent().SetKeyToTxt(this);
|
|
|
|
#region 绑定下拉列表
|
|
|
|
BasicData basicData = new BasicData();
|
|
|
|
//获取检测值下拉信息
|
|
string checkcode = recorder.CHECKITEMCODE;
|
|
OutReason searchModelType = new OutReason();
|
|
this.comInputValue.DataSource = basicData.GetInputValueList(checkcode, true);
|
|
this.comInputValue.DisplayMember = "INPUTVALUE";
|
|
this.comInputValue.ValueMember = "INPUTVALUE";
|
|
|
|
#endregion
|
|
|
|
#region 加载编辑
|
|
//判断是否为编辑加载编辑数据
|
|
if (string.IsNullOrEmpty(addForm.DGData.SelectedRows[0].Cells["CHECKITEMCODE"].Value.ToString()) == false)
|
|
{
|
|
CheckWithMaterial searchInfo = new CheckWithMaterial();
|
|
//QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
|
|
//searchInfo = agent.InvokeServiceFunction<CheckWithMaterial>("ProductCheckBLL_GetCheckWithMaterial", recorder);
|
|
searchInfo.INPUTTYPE = addForm.DGData.SelectedRows[0].Cells["INPUTTYPE"].Value.ToString();
|
|
//一定是存在的
|
|
this.txtCheckItem.Text = addForm.DGData.SelectedRows[0].Cells["CHECKITEMCODE"].Value.ToString();
|
|
this.txtValueUp.Text = addForm.DGData.SelectedRows[0].Cells["STANDERDVALUE_UPPER"].Value.ToString();
|
|
this.txtValueDown.Text = addForm.DGData.SelectedRows[0].Cells["STANDERDVALUE_DOWN"].Value.ToString();
|
|
if (addForm.DGData.SelectedRows[0].Cells["INPUTVALUE"].Value!=null)
|
|
{
|
|
if (searchInfo.INPUTTYPE == "1")
|
|
{
|
|
this.comInputValue.SelectedValue = addForm.DGData.SelectedRows[0].Cells["INPUTVALUE"].Value.ToString();
|
|
}
|
|
else
|
|
{
|
|
this.txtInputValue.Text = addForm.DGData.SelectedRows[0].Cells["INPUTVALUE"].Value.ToString();
|
|
}
|
|
}
|
|
//下拉为1
|
|
if(searchInfo.INPUTTYPE=="1")
|
|
{
|
|
this.comInputValue.Visible = true;
|
|
this.txtInputValue.Visible=false;
|
|
this.comInputValue.Focus();
|
|
}
|
|
else
|
|
{
|
|
this.txtInputValue.Visible = true;
|
|
this.comInputValue.Visible = false;
|
|
this.txtInputValue.Focus();
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 窗体关闭
|
|
/// <summary>
|
|
/// 点击关闭返回
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void tsbBack_Click(object sender, EventArgs e)
|
|
{
|
|
//this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 点击右上角X关闭窗口
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void SendCodeForm_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
//this.DialogResult = DialogResult.OK;
|
|
e.Cancel = false;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void tsbSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.txtInputValue.Text == string.Empty && this.comInputValue.Text.ToString() == "")
|
|
{
|
|
this.labelError.Text = "请输入检测值!";
|
|
return;
|
|
}
|
|
|
|
//校验输入的值是否正确
|
|
recorder.CHECKITEMCODE=this.txtCheckItem.Text;
|
|
recorder.STANDERDVALUE_UPPER=this.txtValueUp.Text;
|
|
recorder.STANDERDVALUE_DOWN = this.txtValueDown.Text;
|
|
|
|
if (string.IsNullOrEmpty(this.txtInputValue.Text)==false)
|
|
{
|
|
recorder.INPUTVALUE = this.txtInputValue.Text;
|
|
}
|
|
else
|
|
{
|
|
recorder.INPUTVALUE = this.comInputValue.Text;
|
|
}
|
|
|
|
this.UpdateAddGrid(recorder);
|
|
|
|
this.Close();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 更新界面Grid
|
|
/// <summary>
|
|
/// 更新界面Grid
|
|
/// </summary>
|
|
/// <param name="checkcode"></param>
|
|
private void UpdateAddGrid(CheckWithMaterial recorder)
|
|
{
|
|
addForm.UpdateGrid(recorder.CHECKITEMCODE, recorder.INPUTVALUE);
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
}
|
|
|