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.
55 lines
2.1 KiB
C#
55 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Mesnac.Action.Base;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Mesnac.Action.Feeding.Technology
|
|
{
|
|
/// <summary>
|
|
/// 打开配方管理界面时默认显示当前配方
|
|
/// </summary>
|
|
public class InitCurrentRecipeData : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
|
|
#region 打开配方管理界面时默认显示当前配方
|
|
|
|
DbMCControl recipeSelect = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "[pmt_recipe].[ObjID]").FirstOrDefault();
|
|
if (recipeSelect != null)
|
|
{
|
|
ComboBox cbRecipeSelect = recipeSelect.BaseControl as ComboBox;
|
|
if (cbRecipeSelect != null)
|
|
{
|
|
BasicInfo.RecipeData recipeData = new BasicInfo.RecipeData();
|
|
string recipeId = recipeData.GetCurrentRecipeID();
|
|
if (!String.IsNullOrEmpty(recipeId))
|
|
{
|
|
foreach (object item in cbRecipeSelect.Items)
|
|
{
|
|
System.Data.DataRowView dataRowView = item as System.Data.DataRowView;
|
|
object currValue = dataRowView.Row["ObjID"];
|
|
if (currValue != null && currValue != System.DBNull.Value)
|
|
{
|
|
int currRecipeId = 0;
|
|
if (int.TryParse(currValue.ToString(), out currRecipeId))
|
|
{
|
|
if (currRecipeId.ToString() == recipeId.Trim())
|
|
{
|
|
cbRecipeSelect.SelectedItem = item;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
}
|