|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using Mesnac.Controls.Base;
|
|
|
|
|
using Mesnac.Controls.Default;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Mesnac.Codd.Session;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.Feeding.Qingquan.Technology
|
|
|
|
|
{
|
|
|
|
|
public class DeleteRecipe : FeedingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
base.RunIni(runtime);
|
|
|
|
|
//确定要删除此配方吗?删除后配方数据不能恢复!
|
|
|
|
|
if (MessageBox.Show(base.Language(276), base.Language(1), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
DbMCSource dbsource = base.GetAllDbMCSources().FirstOrDefault();
|
|
|
|
|
DbMCControl ObjIDControl = base.GetDbMCControlByKey("[" + dbsource.DesignSource + "].[pmt_recipe].[ObjID]").FirstOrDefault();//zhengc 11.21 21::43
|
|
|
|
|
if (ObjIDControl == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (ObjIDControl.BaseControl.MCValue == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string recipeid = ObjIDControl.BaseControl.MCValue.ToString();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(recipeid))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DbHelper dbHelper = NewDbHelper(dbsource.DesignSource);
|
|
|
|
|
if (dbHelper == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
dbHelper.CommandType = CommandType.Text;
|
|
|
|
|
dbHelper.CommandText = "select mater_name from pmt_recipe where ObjID=" + recipeid;
|
|
|
|
|
object result = dbHelper.ToScalar();
|
|
|
|
|
//zhengc 11.21 21:47
|
|
|
|
|
dbHelper.CommandText = "DELETE FROM dbo.pmt_recipe WHERE ObjID=" + recipeid;
|
|
|
|
|
dbHelper.ExecuteNonQuery();
|
|
|
|
|
//zhengc 11.21 21:47
|
|
|
|
|
dbHelper.CommandText = "DELETE FROM dbo.pmt_mix WHERE RecipeObjID=" + recipeid;
|
|
|
|
|
dbHelper.ExecuteNonQuery();
|
|
|
|
|
//zhengc 11.21 21:47
|
|
|
|
|
dbHelper.CommandText = "DELETE FROM dbo.pmt_weigh WHERE RecipeObjID=" + recipeid;
|
|
|
|
|
dbHelper.ExecuteNonQuery();
|
|
|
|
|
base.DBLog("配方管理", "删除配方", "配方名称:" + result as string);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
runtime.IsReturn = true; //终止执行
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|