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.
41 lines
1.8 KiB
C#
41 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Data;
|
|
using Mesnac.Codd.Session;
|
|
using Mesnac.Action.Base;
|
|
|
|
namespace Mesnac.Action.Intake.Qingquan.Report
|
|
{
|
|
public class ReportCommon
|
|
{
|
|
public static DataTable GetReportDetail(Mesnac.Basic.DataSourceFactory.MCDbType dbType,string startdate, string starttime, string enddate, string endtime, string materName, string equipId, string destBin)
|
|
{
|
|
StringBuilder sqlstr = new StringBuilder();
|
|
sqlstr.AppendLine(@"select * from ppt_FeedingData Where 1=1 ");
|
|
if (startdate != null && enddate != null)
|
|
{
|
|
sqlstr.AppendLine(@"AND Trans_Date>= cast('" + Convert.ToDateTime(startdate).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(starttime).ToShortTimeString() + "' as datetime) AND Trans_Date <= cast('" + Convert.ToDateTime(enddate).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(endtime).ToShortTimeString() + "' as datetime) ");
|
|
}
|
|
sqlstr.AppendLine(@" AND Mater_name = '" + materName + "'");
|
|
sqlstr.AppendLine(@" AND Equip_id = '" + equipId + "'");
|
|
sqlstr.AppendLine(@" AND Dest_bin = '" + destBin + "'");
|
|
//拼接SQL语句END
|
|
DatabaseAction action = new DatabaseAction();
|
|
DbHelper dbHelper;
|
|
dbHelper = action.NewDbHelper(dbType);
|
|
if (dbHelper == null)
|
|
{
|
|
action.LogError("获取数据连接失败...");
|
|
return new DataTable();
|
|
}
|
|
dbHelper.ClearParameter();
|
|
dbHelper.CommandType = CommandType.Text;
|
|
dbHelper.CommandText = sqlstr.ToString();
|
|
DataTable table = dbHelper.ToDataTable();
|
|
return table;
|
|
}
|
|
}
|
|
}
|