|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.Entity;
|
|
|
|
|
using Mesnac.Codd.Session;
|
|
|
|
|
using Mesnac.Controls.Base;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.Report.SolventReport
|
|
|
|
|
{
|
|
|
|
|
public class SelectPlanTotalAction : ChemicalWeighingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private RuntimeParameter _runtime;
|
|
|
|
|
private IBaseControl _equipCode = null; //机台号
|
|
|
|
|
private IBaseControl _version = null; //版本
|
|
|
|
|
private IBaseControl _startdate = null; //开始日期
|
|
|
|
|
private IBaseControl _enddate = null; //结束日期
|
|
|
|
|
private IBaseControl _starttime = null; //开始时间
|
|
|
|
|
private IBaseControl _endtime = null; //结束时间
|
|
|
|
|
//private IBaseControl _recipeName = null; //配方名
|
|
|
|
|
string _recipeName = string.Empty;
|
|
|
|
|
//private IBaseControl _shiftName = null; //班次
|
|
|
|
|
string _shiftName = string.Empty;
|
|
|
|
|
private DbMCControl _dgvXlPlan = null; //生产计划
|
|
|
|
|
private DbMCControl _dgvLRPlan = null; //生产计划
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
base.RunIni(runtime);
|
|
|
|
|
this._runtime = runtime;
|
|
|
|
|
|
|
|
|
|
this._dgvXlPlan = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "RT_plan").FirstOrDefault();
|
|
|
|
|
if (_dgvXlPlan == null || !(_dgvXlPlan.BaseControl is DataGridView))
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<SelectPlanAction>.Warn("{生产报表} 缺少生产计划DataGridView控件...");
|
|
|
|
|
runtime.IsReturn = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DataGridView lR_planGridView = this._dgvXlPlan.BaseControl as DataGridView;
|
|
|
|
|
if (lR_planGridView.SelectedRows.Count == 1)
|
|
|
|
|
{
|
|
|
|
|
string planID = lR_planGridView.SelectedRows[0].Cells["Plan_Id"].Value as string;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//刷新生产计划DataGridView数据
|
|
|
|
|
this._dgvLRPlan = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Hw_plan").FirstOrDefault();
|
|
|
|
|
if (_dgvLRPlan == null || !(_dgvLRPlan.BaseControl is DataGridView))
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<SelectPlanAction>.Warn("{生产报表-查询} 缺少生产计划DataGridView控件...");
|
|
|
|
|
runtime.IsReturn = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
|
|
dbHelper.ClearParameter();
|
|
|
|
|
string sb = @" select Dosing_Id,Plan_Id, Real_Num,Total_Weight as Total_Weight,Total_Error as Total_Error from Hw_plan where Plan_Id=@Plan_Id ";
|
|
|
|
|
|
|
|
|
|
dbHelper.CommandText = sb.ToString();
|
|
|
|
|
dbHelper.CommandType = System.Data.CommandType.Text;
|
|
|
|
|
dbHelper.AddParameter("@Plan_Id", planID);
|
|
|
|
|
DataTable table = dbHelper.ToDataTable();
|
|
|
|
|
_dgvLRPlan.BaseControl.BindDataSource = null;
|
|
|
|
|
_dgvLRPlan.BaseControl.BindDataSource = table;
|
|
|
|
|
}
|
|
|
|
|
ExportAction.OnRefresh -= Process_Event;
|
|
|
|
|
ExportAction.OnRefresh += Process_Event;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 事件处理方法
|
|
|
|
|
|
|
|
|
|
private void Process_Event(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (sender is RuntimeParameter)
|
|
|
|
|
{
|
|
|
|
|
this.Run(sender as RuntimeParameter);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.Run(this._runtime);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|