|
|
|
|
using System;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
using DevExpress.Data.Extensions;
|
|
|
|
|
using DevExpress.PivotGrid.Criteria;
|
|
|
|
|
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.LjPlanning.Db;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.LjPlanning.Entity;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.LjProportional;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjRecipeData
|
|
|
|
|
{
|
|
|
|
|
public class SelectAction:ChemicalWeighingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
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_Formula").FirstOrDefault(); //获取物料数据控件
|
|
|
|
|
this._materialGridControl = materialGridControl;
|
|
|
|
|
FileControl();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FileControl()
|
|
|
|
|
{
|
|
|
|
|
DataGridView clientGridView = this._materialGridControl.BaseControl as DataGridView;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var s= this._runtime.IsReturn;
|
|
|
|
|
//验证是否选中某物料
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
// Lj_Formula
|
|
|
|
|
|
|
|
|
|
var table= LjFormulaDb.GetDetailTable(id);
|
|
|
|
|
|
|
|
|
|
var dataGridDryer1Table = table.Clone();
|
|
|
|
|
|
|
|
|
|
var dataGridSilo1Table = table.Clone();
|
|
|
|
|
var dataGridSilo2Table = table.Clone();
|
|
|
|
|
var dataGridWater1Table = table.Clone();
|
|
|
|
|
var dataGridWater2Table = table.Clone();
|
|
|
|
|
|
|
|
|
|
var dataGridDryer1ActionTable = table.Clone();
|
|
|
|
|
var dataGridSiloH1Table = table.Clone();
|
|
|
|
|
var dataGridSiloH2Table = table.Clone();
|
|
|
|
|
|
|
|
|
|
var dataGridWeter1Table = table.Clone();
|
|
|
|
|
var dataGridWeter2Table = table.Clone();
|
|
|
|
|
|
|
|
|
|
foreach (DataRow item in table.Rows)
|
|
|
|
|
{
|
|
|
|
|
// var data = detail.Where(x => x.MachineType == "Dry" && x.FormulaType == 1 && x.Machine == "A").ToList();
|
|
|
|
|
|
|
|
|
|
string machineType = item["MachineType"].ToString();
|
|
|
|
|
string formulaType = item["FormulaType"].ToString();
|
|
|
|
|
string machine= item["Machine"].ToString();
|
|
|
|
|
//干混机1 称量配方
|
|
|
|
|
if(machineType=="Dry" && formulaType=="1" && machine == "A")
|
|
|
|
|
{
|
|
|
|
|
var dataRow = item;
|
|
|
|
|
dataGridDryer1Table.ImportRow(dataRow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//湿混机1 称量配方
|
|
|
|
|
if (machineType == "Silo" && formulaType == "1" && machine == "A")
|
|
|
|
|
{
|
|
|
|
|
var dataRow = item;
|
|
|
|
|
dataGridSilo1Table.ImportRow(dataRow);
|
|
|
|
|
}
|
|
|
|
|
// 湿混机1 水 称量配方
|
|
|
|
|
if (machineType == "Silo_Water" && formulaType == "1" && machine == "A")
|
|
|
|
|
{
|
|
|
|
|
var dataRow = item;
|
|
|
|
|
dataGridWater1Table.ImportRow(dataRow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//湿混机2 称量配方
|
|
|
|
|
if (machineType == "Silo" && formulaType == "1" && machine == "B")
|
|
|
|
|
{
|
|
|
|
|
var dataRow = item;
|
|
|
|
|
dataGridSilo2Table.ImportRow(dataRow);
|
|
|
|
|
}
|
|
|
|
|
// 湿混机2 水 称量配方
|
|
|
|
|
if (machineType == "Silo_Water" && formulaType == "1" && machine == "B")
|
|
|
|
|
{
|
|
|
|
|
var dataRow = item;
|
|
|
|
|
dataGridWater2Table.ImportRow(dataRow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//混合配方
|
|
|
|
|
|
|
|
|
|
if (machineType == "Dry" && formulaType == "2" && machine == "A")
|
|
|
|
|
{
|
|
|
|
|
var dataRow = item;
|
|
|
|
|
dataGridDryer1ActionTable.ImportRow(dataRow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//湿混机1
|
|
|
|
|
if (machineType == "Silo" && formulaType == "2" && machine == "A")
|
|
|
|
|
{
|
|
|
|
|
var dataRow = item;
|
|
|
|
|
dataGridSiloH1Table.ImportRow(dataRow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//湿混机2
|
|
|
|
|
if (machineType == "Silo" && formulaType == "2" && machine == "B")
|
|
|
|
|
{
|
|
|
|
|
var dataRow = item;
|
|
|
|
|
dataGridSiloH2Table.ImportRow(dataRow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (machineType == "Weter" && formulaType == "2" && machine == "A")
|
|
|
|
|
{
|
|
|
|
|
var dataRow = item;
|
|
|
|
|
dataGridWeter1Table.ImportRow(dataRow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (machineType == "Weter" && formulaType == "2" && machine == "B")
|
|
|
|
|
{
|
|
|
|
|
var dataRow = item;
|
|
|
|
|
dataGridWeter2Table.ImportRow(dataRow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DbMCControl dataGridDryer1 = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local,
|
|
|
|
|
"dataGridDryer1").FirstOrDefault(); //获取物料数据控件
|
|
|
|
|
|
|
|
|
|
dataGridDryer1.BaseControl.BindDataSource = null;
|
|
|
|
|
dataGridDryer1.BaseControl.BindDataSource = dataGridDryer1Table;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DbMCControl dataGridSilo1 = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local,
|
|
|
|
|
"dataGridSilo1").FirstOrDefault(); //获取物料数据控件
|
|
|
|
|
|
|
|
|
|
dataGridSilo1.BaseControl.BindDataSource = null;
|
|
|
|
|
dataGridSilo1.BaseControl.BindDataSource = dataGridSilo1Table;
|
|
|
|
|
|
|
|
|
|
DbMCControl dataGridWater1 = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local,
|
|
|
|
|
"dataGridWater1").FirstOrDefault(); //获取物料数据控件
|
|
|
|
|
|
|
|
|
|
dataGridWater1.BaseControl.BindDataSource = null;
|
|
|
|
|
dataGridWater1.BaseControl.BindDataSource = dataGridWater1Table;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DbMCControl dataGridSilo2 = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local,
|
|
|
|
|
"dataGridSilo2").FirstOrDefault(); //获取物料数据控件
|
|
|
|
|
|
|
|
|
|
dataGridSilo2.BaseControl.BindDataSource = null;
|
|
|
|
|
dataGridSilo2.BaseControl.BindDataSource = dataGridSilo2Table;
|
|
|
|
|
|
|
|
|
|
DbMCControl dataGridWater2 = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local,
|
|
|
|
|
"dataGridWater2").FirstOrDefault(); //获取物料数据控件
|
|
|
|
|
|
|
|
|
|
dataGridWater2.BaseControl.BindDataSource = null;
|
|
|
|
|
dataGridWater2.BaseControl.BindDataSource = dataGridWater2Table;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//混合配方
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DbMCControl dataGridDryer1Action = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local,
|
|
|
|
|
"dataGridDryer1Action").FirstOrDefault(); //获取物料数据控件
|
|
|
|
|
|
|
|
|
|
dataGridDryer1Action.BaseControl.BindDataSource = null;
|
|
|
|
|
dataGridDryer1Action.BaseControl.BindDataSource = dataGridDryer1ActionTable;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DbMCControl dataGridSiloH1 = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local,
|
|
|
|
|
"dataGridSiloH1").FirstOrDefault(); //获取物料数据控件
|
|
|
|
|
|
|
|
|
|
dataGridSiloH1.BaseControl.BindDataSource = null;
|
|
|
|
|
dataGridSiloH1.BaseControl.BindDataSource = dataGridSiloH1Table;
|
|
|
|
|
|
|
|
|
|
DbMCControl dataGridSiloH2 = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local,
|
|
|
|
|
"dataGridSiloH2").FirstOrDefault(); //获取物料数据控件
|
|
|
|
|
|
|
|
|
|
dataGridSiloH2.BaseControl.BindDataSource = null;
|
|
|
|
|
dataGridSiloH2.BaseControl.BindDataSource = dataGridSiloH2Table;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DbMCControl dataGridWeter1 = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local,
|
|
|
|
|
"dataGridWeter1").FirstOrDefault(); //获取物料数据控件
|
|
|
|
|
|
|
|
|
|
dataGridWeter1.BaseControl.BindDataSource = null;
|
|
|
|
|
dataGridWeter1.BaseControl.BindDataSource = dataGridWeter1Table;
|
|
|
|
|
|
|
|
|
|
DbMCControl dataGridWeter2 = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local,
|
|
|
|
|
"dataGridWeter2").FirstOrDefault(); //获取物料数据控件
|
|
|
|
|
|
|
|
|
|
dataGridWeter2.BaseControl.BindDataSource = null;
|
|
|
|
|
dataGridWeter2.BaseControl.BindDataSource = dataGridWeter2Table;
|
|
|
|
|
|
|
|
|
|
this._runtime.BaseControl.MCEnabled = false;
|
|
|
|
|
|
|
|
|
|
this._runtime.BaseControl.MCEnabled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|