旧版报表、仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

52 lines
3.2 KiB

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using Dapper;
namespace Warehouse.DAL.YieldFormCheck
{
public class YieldFormCheckDal
{
static DbUtility dbhelp = new DbUtility(System.Configuration.ConfigurationManager.ConnectionStrings["mesConn"].ToString(), DbProviderType.SqlServer);
#region 白板月份计划查询
public DataTable MonthFormInfoDT(string WorkShop,string MonthYear, string MonthMonth)
{
return dbhelp.ExecuteDataTable(MonthFormInfoSql(WorkShop,MonthYear, MonthMonth), null);
}
public string MonthFormInfoSql(string WorkShop,string MonthYear, string MonthMonth)
{
string strWhere = string.Empty;
//string sql = @"select * from wh.dbo.ProductionPlan where year = '"+Year+@"' and month = '"+Month+"月'";
string sql = @"select substring(s.month1,6,len(month1)-charindex('_',month1) ) month1,substring(s.month2,6,len(month2)-charindex('_',month2)) month2,
substring(s.month3,6,len(month3)-charindex('_',month3)) month3,substring(s.month4,6,len(month4)-charindex('_',month4)) month4,
substring(s.month5,6,len(month5)-charindex('_',month5)) month5,substring(s.month6,6,len(month6)-charindex('_',month6)) month6,
substring(s.month7,6,len(month7)-charindex('_',month7)) month7,substring(s.month8,6,len(month8)-charindex('_',month8)) month8,
substring(s.month9,6,len(month9)-charindex('_',month9)) month9,substring(s.month10,6,len(month10)-charindex('_',month10)) month10,
substring(s.month11,6,len(month11)-charindex('_',month11)) month11,substring(s.month12,6,len(month12)-charindex('_',month12)) month12,
substring(s.month13,6,len(month13)-charindex('_',month13)) month13,substring(s.month14,6,len(month14)-charindex('_',month14)) month14,
substring(s.month15,6,len(month15)-charindex('_',month15)) month15,substring(s.month16,6,len(month16)-charindex('_',month16)) month16,
substring(s.month17,6,len(month17)-charindex('_',month17)) month17,substring(s.month18,6,len(month18)-charindex('_',month18)) month18,
substring(s.month19,6,len(month19)-charindex('_',month19)) month19,substring(s.month20,6,len(month20)-charindex('_',month20)) month20,
substring(s.month21,6,len(month21)-charindex('_',month21)) month21,substring(s.month22,6,len(month22)-charindex('_',month22)) month22,
substring(s.month23,6,len(month23)-charindex('_',month23)) month23,substring(s.month24,6,len(month24)-charindex('_',month24)) month24,
substring(s.month25,6,len(month25)-charindex('_',month25)) month25,substring(s.month26,6,len(month26)-charindex('_',month26)) month26,
substring(s.month27,6,len(month27)-charindex('_',month27)) month27,substring(s.month28,6,len(month28)-charindex('_',month28)) month28,
substring(s.month29,6,len(month29)-charindex('_',month29)) month29,substring(s.month30,6,len(month30)-charindex('_',month30)) month30,
substring(s.month31,6,len(month31)-charindex('_',month31)) month31
from (select v.*,row_number() over(partition by v.class order by v.createtime desc) rw
from [wh].[dbo].[ProductionPlan] v) s
where s.rw = '1' and s.class = 'day' and s.year = '" + MonthYear + @"' and s.month = '" + MonthMonth + "' and s.workshop = '" + WorkShop + "'";
return sql;
}
#endregion
}
}