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.

125 lines
4.4 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;
using Mesnac.Action.Feeding.BasicInfo;
namespace Mesnac.Action.Feeding.Verification
{
public partial class FrmRecipeResetDialog : Form
{
public FrmRecipeResetDialog()
{
InitializeComponent();
this.InitUI();
this.InitData();
}
#region 初始化界面
public void InitUI()
{
this.Text = LanguageService.Instance.Read(292); //重传配方
this.label1.Text = LanguageService.Instance.Read(293); //当前配方
this.btnOK.Text = LanguageService.Instance.Read(294); //重传
this.btnCancel.Text = LanguageService.Instance.Read(19); //取消
}
#endregion
#region 初始化数据
public void InitData()
{
try
{
RecipeData recipeData = new RecipeData();
RecipeData.RecipeInfo recipeInfo = recipeData.GetCurrentRecipeInfo();
if (recipeInfo != null)
{
this.lblCurrentRecipeName.Text = recipeInfo.RecipeMaterialName;
}
FeedingAction action = new FeedingAction();
string strSql1 = "select ssRemark from SysKeyValue where ssKey = 'RecipeMixing'";
DbHelper dbHelper = action.NewDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
dbHelper.CommandType = CommandType.Text;
dbHelper.ClearParameter();
dbHelper.CommandText = strSql1;
object result = dbHelper.ToScalar();
if (result != null && result != System.DBNull.Value)
{
string strSql2 = result as string;
strSql2 = String.Format(strSql2, recipeInfo.ObjID);
dbHelper.ClearParameter();
dbHelper.CommandText = strSql2;
DataTable tableMixing = dbHelper.ToDataTable();
this.dgvMixing.DataSource = tableMixing;
if (this.dgvMixing.Columns.Contains("步骤"))
{
this.dgvMixing.Columns["步骤"].Width = 54;
}
if (this.dgvMixing.Columns.Contains("时间"))
{
this.dgvMixing.Columns["时间"].Width = 54;
}
if (this.dgvMixing.Columns.Contains("温度"))
{
this.dgvMixing.Columns["温度"].Width = 54;
}
if (this.dgvMixing.Columns.Contains("功率"))
{
this.dgvMixing.Columns["功率"].Width = 54;
}
if (this.dgvMixing.Columns.Contains("能量"))
{
this.dgvMixing.Columns["能量"].Width = 54;
}
if (this.dgvMixing.Columns.Contains("压力"))
{
this.dgvMixing.Columns["压力"].Width = 54;
}
if (this.dgvMixing.Columns.Contains("转速"))
{
this.dgvMixing.Columns["转速"].Width = 54;
}
if (this.dgvMixing.Columns.Contains("条件"))
{
this.dgvMixing.Columns["条件"].Width = 124;
}
if (this.dgvMixing.Columns.Contains("动作"))
{
this.dgvMixing.Columns["动作"].Width = 150;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, LanguageService.Instance.Read(1), MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
#endregion
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;
}
}
}