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.Qingquan.Technology { public partial class FrmRecipeFinder : Form { private int _type = 0; //类型,0:为根据网络类型检索配方,1为强制本机检索 /// /// 配方查询放大器构造方法 /// /// 查询器类型,0:为根据网络类型检索配方,1为强制本机检索 public FrmRecipeFinder(int type) { InitializeComponent(); this._type = type; } private void FrmRecipeFinder_Load(object sender, EventArgs e) { //FeedingAction action = new FeedingAction(); //List 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 初始化界面 /// /// 初始化界面元素 /// 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 初始化数据 /// /// 初始化数据 /// public void InitData() { FeedingAction action = new FeedingAction(); List 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; } } }