|
|
|
@ -0,0 +1,106 @@
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.FreeDb;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.FreeDb.DBEntity;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjPlanning
|
|
|
|
|
{
|
|
|
|
|
public class TestAction: ChemicalWeighingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
public static event EventHandler OnAdd;
|
|
|
|
|
private DbMCControl _materialGridControl = null; //物料列表控件
|
|
|
|
|
private RuntimeParameter _runtime;
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
base.RunIni(runtime); //必须调用
|
|
|
|
|
this._runtime = runtime;
|
|
|
|
|
|
|
|
|
|
DbMCControl materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "lj_planning").FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
this._materialGridControl = materialGridControl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DataGridView clientGridView = this._materialGridControl.BaseControl as DataGridView;
|
|
|
|
|
|
|
|
|
|
//验证是否选中某物料
|
|
|
|
|
if (clientGridView.SelectedRows.Count != 1)
|
|
|
|
|
{
|
|
|
|
|
//MessageBox.Show("请选择要修改的数据", Mesnac.Basic.LanguageHelper.Caption,
|
|
|
|
|
// MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
//this._runtime.IsReturn = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var dataGridViewRow = clientGridView.SelectedRows[0];
|
|
|
|
|
var id = Convert.ToInt32(dataGridViewRow.Cells["Id"].Value);
|
|
|
|
|
|
|
|
|
|
LjPlanningEntity ljPlanningEntity = FreeSqlUnit.Instance.Select<LjPlanningEntity>().Where(x => x.Id == id).ToOne();
|
|
|
|
|
LjFormulaEntity ljFormulaEntity = FreeSqlUnit.Instance.Select<LjFormulaEntity>().Where(x => x.Id == ljPlanningEntity.FormulaId).ToOne();
|
|
|
|
|
List<LjFormulaDetailEntity> ljFormulaDetailEntity = FreeSqlUnit.Instance.Select<LjFormulaDetailEntity>().Where(x => x.FormulaId == ljFormulaEntity.Id).ToList();
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Delete<LjFormulaDownEntity>().Where(x => x.PlanId == ljPlanningEntity.Id && x.FormulaId == ljFormulaEntity.Id).ExecuteDeleted();
|
|
|
|
|
|
|
|
|
|
LjFormulaDownEntity ljFormulaDownEntity = new LjFormulaDownEntity()
|
|
|
|
|
{
|
|
|
|
|
CbSiloC = ljFormulaEntity.CbSiloC,
|
|
|
|
|
CbSiloH = ljFormulaEntity.CbSiloH,
|
|
|
|
|
CbWeterH = ljFormulaEntity.CbWeterH,
|
|
|
|
|
CreateTime = ljFormulaEntity.CreateTime,
|
|
|
|
|
FormulaId = ljFormulaEntity.Id,
|
|
|
|
|
FormulaName = ljFormulaEntity.FormulaName,
|
|
|
|
|
FormulaNo = ljFormulaEntity.FormulaNo,
|
|
|
|
|
FormulaVersion = ljFormulaEntity.FormulaVersion,
|
|
|
|
|
IsEnable = ljFormulaEntity.IsEnable,
|
|
|
|
|
PlanId = ljPlanningEntity.Id,
|
|
|
|
|
RecipeTypeId = ljFormulaEntity.RecipeTypeId,
|
|
|
|
|
RecipeTypeName = ljFormulaEntity.RecipeTypeName,
|
|
|
|
|
Status = ljFormulaEntity.Status,
|
|
|
|
|
Unit = ljFormulaEntity.Unit,
|
|
|
|
|
UpdateTime = ljFormulaEntity.UpdateTime
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Insert(ljFormulaDownEntity).ExecuteIdentity();
|
|
|
|
|
|
|
|
|
|
List<LjFormulaDetailDownEntity> ljFormulaDetailDownEntity = new List<LjFormulaDetailDownEntity>();
|
|
|
|
|
|
|
|
|
|
LjFormulaDetailDownEntity singleEntity;
|
|
|
|
|
|
|
|
|
|
foreach (LjFormulaDetailEntity Entity in ljFormulaDetailEntity)
|
|
|
|
|
{
|
|
|
|
|
singleEntity = new LjFormulaDetailDownEntity()
|
|
|
|
|
{
|
|
|
|
|
ActionCode = Entity.ActionCode,
|
|
|
|
|
ActionId = Entity.ActionId,
|
|
|
|
|
ActionName = Entity.ActionName,
|
|
|
|
|
BinNo = Entity.BinNo,
|
|
|
|
|
CbCopyC = Entity.CbCopyC,
|
|
|
|
|
CbCopyH = Entity.CbCopyH,
|
|
|
|
|
CpSiloH = Entity.CpSiloH,
|
|
|
|
|
FormulaId = Entity.FormulaId,
|
|
|
|
|
FormulaType = Entity.FormulaType,
|
|
|
|
|
Machine = Entity.Machine,
|
|
|
|
|
MachineType = Entity.MachineType,
|
|
|
|
|
MId = Entity.MId,
|
|
|
|
|
MName = Entity.MName,
|
|
|
|
|
SetTolerance = Entity.SetTolerance,
|
|
|
|
|
SetValue = Entity.SetValue,
|
|
|
|
|
Speed = Entity.Speed,
|
|
|
|
|
StockMaterialId = Entity.StockMaterialId,
|
|
|
|
|
Temp = Entity.Temp,
|
|
|
|
|
TimeInfo = Entity.TimeInfo,
|
|
|
|
|
Tolerance = Entity.Tolerance,
|
|
|
|
|
Weight = Entity.Weight
|
|
|
|
|
};
|
|
|
|
|
ljFormulaDetailDownEntity.Add(singleEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Insert(ljFormulaDetailDownEntity).ExecuteIdentity();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|