|
|
using Mesnac.Action.Base;
|
|
|
using Mesnac.Action.ChemicalWeighing.Report.ProductionReport;
|
|
|
using Mesnac.Codd.Session;
|
|
|
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.GelDoser
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 糊化机报表明细查询事件
|
|
|
/// </summary>
|
|
|
public class SelectRowAction : ChemicalWeighingAction, IAction
|
|
|
{
|
|
|
private Control _clientGridControl = null; //多维表控件
|
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
{
|
|
|
base.RunIni(runtime); //必须要调用的
|
|
|
|
|
|
ICSharpCode.Core.LoggingService<SelectAction>.Debug("糊化机报表-明细查询...");
|
|
|
|
|
|
//获取报表数据
|
|
|
DbMCControl _dgvGelDoser = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Report_GelDoser").FirstOrDefault();
|
|
|
if (_dgvGelDoser == null || !(_dgvGelDoser.BaseControl is DataGridView))
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService<SelectPlanAction>.Warn("{生产报表} 缺少糊化机报表DataGridView控件...");
|
|
|
runtime.IsReturn = false;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
DataGridView _GelDoserGridView = _dgvGelDoser.BaseControl as DataGridView;
|
|
|
|
|
|
this._clientGridControl = GetAllControls().Where(x => x.Name.Contains("MultiColHeaderDgv")).FirstOrDefault();
|
|
|
|
|
|
if (_clientGridControl == null)
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService<SelectPlanAction>.Warn("{生产报表} 缺少缺少称量名细MultiColHeaderDgv控件...");
|
|
|
runtime.IsReturn = false;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
Mesnac.Controls.Default.MultiColHeaderDgv clientGrid = (this._clientGridControl as Mesnac.Controls.Default.MultiColHeaderDgv);
|
|
|
|
|
|
#region 明细控件格式化
|
|
|
|
|
|
clientGrid.myColHeaderTreeView = null;
|
|
|
clientGrid.DataSource = null;
|
|
|
clientGrid.iNodeLevels = 0;
|
|
|
clientGrid.ColLists.Clear();
|
|
|
clientGrid.ColumnHeadersHeight = 23;
|
|
|
clientGrid.ScrollBars = ScrollBars.Both;
|
|
|
clientGrid.AllowUserToAddRows = false;
|
|
|
clientGrid.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
clientGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
|
|
clientGrid.ColumnHeadersDefaultCellStyle.Font = new System.Drawing.Font("宋体", 12);
|
|
|
clientGrid.DefaultCellStyle.Font = new System.Drawing.Font("宋体", 10);
|
|
|
clientGrid.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
#endregion
|
|
|
|
|
|
//获取选中行的ReportId,关联获取明细数据并赋值给明细控件
|
|
|
if (_GelDoserGridView.SelectedRows.Count == 1)
|
|
|
{
|
|
|
string lR_planID = _GelDoserGridView.SelectedRows[0].Cells["reportId"].Value as string;
|
|
|
|
|
|
//获取数据链接
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
if (dbHelper == null)
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService<ExportAction>.Error("获取本地数据连接失败...");
|
|
|
return;
|
|
|
}
|
|
|
dbHelper.ClearParameter();
|
|
|
|
|
|
//获取明细数据
|
|
|
StringBuilder sqlStr = new StringBuilder(@"select t2.Name as 设备编号,t1.mix as Mix,t1. mixBatch as 批次,t1.mixStep as 步号,t1.actCode as 动作,
|
|
|
t1.mixTime as 时间,t1.mixTemp as 温度,t1.mixSpeed as 速度,t1.recordTime as 记录时间
|
|
|
from Report_GelDoser_Detail t1
|
|
|
left join Device t2 on t1.eqNo = t2.Id
|
|
|
where t1.reportId = @reportId");
|
|
|
dbHelper.CommandText = sqlStr.ToString();
|
|
|
dbHelper.CommandType = System.Data.CommandType.Text;
|
|
|
dbHelper.AddParameter("@reportId", lR_planID);
|
|
|
DataTable table = dbHelper.ToDataTable();
|
|
|
|
|
|
clientGrid.DataSource = table;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|