You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
4.3 KiB
C#

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 Mesnac.Action.Base;
using Mesnac.Codd.Session;
namespace Mesnac.Action.Feeding.Technology
{
public partial class FrmRecipeFinder : Form
{
private int _type = 0; //类型0:为根据网络类型检索配方1为强制本机检索
/// <summary>
/// 配方查询放大器构造方法
/// </summary>
/// <param name="type">查询器类型0:为根据网络类型检索配方1为强制本机检索</param>
public FrmRecipeFinder(int type)
{
InitializeComponent();
this._type = type;
}
private void FrmRecipeFinder_Load(object sender, EventArgs e)
{
//FeedingAction action = new FeedingAction();
//List<SimplePmtRecipe> lst = null;
//if (this._type == 0)
//{
// if (action.NetType == BaseAction.NetTypes.Net)
// {
// //网络版
// lst = PlanCommon.GetNetRecipeMaterialListPY(action.CurrEquipCode, 1, String.Empty);
// }
// else
// {
// //单机版
// lst = PlanCommon.GetLocalRecipeMaterialListPY(action.CurrEquipCode, 1, String.Empty);
// }
//}
//else if (this._type == 1)
//{
// //强制单机版
// lst = PlanCommon.GetLocalRecipeMaterialListPY(action.CurrEquipCode, 1, String.Empty);
//}
//this.lstRecipe.Items.Clear();
//foreach (SimplePmtRecipe r in lst)
//{
// this.lstRecipe.Items.Add(r);
//}
this.InitUI();
this.InitData();
}
#region 初始化界面
/// <summary>
/// 初始化界面元素
/// </summary>
public void InitUI()
{
this.Text = LanguageService.Instance.Read(296); //配方查询放大器
this.groupBox1.Text = LanguageService.Instance.Read(297); //筛选条件
this.btnOk.Text = LanguageService.Instance.Read(18); //确定
this.btnCancel.Text = LanguageService.Instance.Read(19); //取消
}
#endregion
#region 初始化数据
/// <summary>
/// 初始化数据
/// </summary>
public void InitData()
{
FeedingAction action = new FeedingAction();
List<SimplePmtRecipe> lst = null;
if (this._type == 0)
{
if (action.NetType == BaseAction.NetTypes.Net)
{
//网络版
lst = PlanCommon.GetNetRecipeMaterialListPY(action.CurrEquipCode, 1, this.txtRecipeName.Text.Trim());
}
else
{
//单机版
lst = PlanCommon.GetLocalRecipeMaterialListPY(action.CurrEquipCode, 1, this.txtRecipeName.Text.Trim());
}
}
else
{
//强制单机版
lst = PlanCommon.GetLocalRecipeMaterialListPY(action.CurrEquipCode, 1, this.txtRecipeName.Text.Trim());
}
this.lstRecipe.Items.Clear();
foreach (SimplePmtRecipe r in lst)
{
this.lstRecipe.Items.Add(r);
}
}
#endregion
private void txtRecipeName_TextChanged(object sender, EventArgs e)
{
this.InitData();
}
public SimplePmtRecipe SelectedRecipe
{
get
{
return this.lstRecipe.SelectedItem as SimplePmtRecipe;
}
}
private void btnOk_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
}
private void lstRecipe_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
}
}