You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.8 KiB
C#
68 lines
2.8 KiB
C#
using Mesnac.Action.Base;
|
|
using Mesnac.Controls.Base;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Mesnac.Codd.Session;
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjPlanning
|
|
{
|
|
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_planning").FirstOrDefault();
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
dbHelper.ClearParameter();
|
|
|
|
StringBuilder sbSql = new StringBuilder(@" select Id, PlanName, PlanNo, Status, CreateTime, UpdateTime, BegTime, EndTime, NumCar, Unit, Remark, IsEnable, FormulaId, FormulaName,'' as StatusName
|
|
,ClassName from lj_planning where IsEnable=1");
|
|
|
|
List<DbMCControl> mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
|
|
|
|
IBaseControl startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
|
|
if (startdate != null)
|
|
{
|
|
//Append
|
|
sbSql.AppendLine(@" and CreateTime >='" + Convert.ToDateTime(startdate.MCValue).ToString("yyyy-MM-dd") + " 00:00:00.000' ");
|
|
}
|
|
else
|
|
{
|
|
ICSharpCode.Core.LoggingService<SelectAction>.Debug("{榄菊计划报表查询} 缺少key值为startdate的时间查询条件...");
|
|
return;
|
|
}
|
|
|
|
IBaseControl enddate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "enddate").FirstOrDefault().BaseControl;
|
|
if (enddate != null)
|
|
{
|
|
sbSql.AppendLine(@"AND CreateTime <='" + Convert.ToDateTime(enddate.MCValue).ToString("yyyy-MM-dd") + " 23:59:59.999' ");
|
|
}
|
|
else
|
|
{
|
|
ICSharpCode.Core.LoggingService<SelectAction>.Debug("{榄菊计划报表查询} 缺少key值为enddate的时间查询条件...");
|
|
return;
|
|
}
|
|
sbSql.Append(" ORDER BY CreateTime desc");
|
|
|
|
dbHelper.CommandText = sbSql.ToString();
|
|
dbHelper.CommandType = System.Data.CommandType.Text;
|
|
DataTable table = dbHelper.ToDataTable();
|
|
|
|
|
|
|
|
|
|
_materialGridControl.BaseControl.BindDataSource = table;
|
|
|
|
}
|
|
}
|
|
}
|