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.
83 lines
2.9 KiB
C#
83 lines
2.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Mesnac.Action.Base;
|
|
using Mesnac.Controls.Base;
|
|
using Mesnac.Controls.Default;
|
|
|
|
namespace Mesnac.Action.Feeding.Technology
|
|
{
|
|
public class EditRecipe : FeedingAction, IAction
|
|
{
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime); //必须调用
|
|
|
|
foreach (IBaseControl control in base.GetAllMCControls())
|
|
{
|
|
if (base.DbOptionTypesIsModify(control))
|
|
{
|
|
control.MCEnabled = true;
|
|
}
|
|
}
|
|
List<MCDataGridView> gridList = GetTControls<MCDataGridView>();
|
|
foreach (MCDataGridView grid in gridList)
|
|
{
|
|
grid.ReadOnly = false;
|
|
if (grid.ContextMenuStrip != null)
|
|
{
|
|
grid.ContextMenuStrip.Enabled = true;
|
|
}
|
|
if (grid.MCKey != null && grid.MCKey.ToLower().StartsWith("PmtWeight.".ToLower()))
|
|
{
|
|
grid.Columns[0].ReadOnly = true;
|
|
grid.Columns[3].ReadOnly = true;
|
|
}
|
|
if (grid.MCKey != null && grid.MCKey.ToLower() == "PmtMixing".ToLower())
|
|
{
|
|
grid.Columns[0].ReadOnly = true;
|
|
}
|
|
}
|
|
|
|
#region 配方修改时间默认取当前时间
|
|
//获取配方修改时间
|
|
//[pmt_recipe].[define_date]
|
|
DbMCControl defineDateControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "[pmt_recipe].[define_date]").FirstOrDefault();
|
|
if (defineDateControl != null)
|
|
{
|
|
if (String.IsNullOrEmpty(defineDateControl.BaseControl.MCValue as string))
|
|
{
|
|
defineDateControl.BaseControl.MCValue = String.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 禁用配方类型
|
|
|
|
DbMCControl recipeTypeControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "[pmt_recipe].[RecipeType]").FirstOrDefault();
|
|
if (recipeTypeControl != null)
|
|
{
|
|
recipeTypeControl.BaseControl.MCEnabled = false;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 禁用配方版本
|
|
|
|
DbMCControl edtCdeControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "[pmt_recipe].[edt_code]").FirstOrDefault();
|
|
if (edtCdeControl != null)
|
|
{
|
|
if (edtCdeControl.BaseControl.MCValue == null || String.IsNullOrEmpty(edtCdeControl.BaseControl.MCValue.ToString()))
|
|
{
|
|
edtCdeControl.BaseControl.MCValue = 1;
|
|
}
|
|
edtCdeControl.BaseControl.MCEnabled = false;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
}
|