旧版报表、仓库
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.
 
 
 
 
 

97 lines
5.7 KiB

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using Dapper;
namespace Warehouse.DAL.ProductionPlanCheck
{
public class ProductionPlanCheckDal
{
static DbUtility dbhelp = new DbUtility(System.Configuration.ConfigurationManager.ConnectionStrings["mesConn"].ToString(), DbProviderType.SqlServer);
#region 白班月份计划表
public DataTable DayProductionPlanDT(dynamic DayProductionPlan)
{
return dbhelp.ExecuteDataTable(DayProductionPlanSql(DayProductionPlan), null);
}
public string DayProductionPlanSql(dynamic DayProductionPlan)
{
string strWhere = string.Empty;
string sql = @"insert into [wh].[dbo].[ProductionPlan] values ('" + DayProductionPlan[0] + "','" + DayProductionPlan[1] + "','" + DayProductionPlan[2] + "','"
+ DayProductionPlan[3] + "','" + DayProductionPlan[4] + "','" + DayProductionPlan[5] + "','" + DayProductionPlan[6] + "','" + DayProductionPlan[7] + "','"
+ DayProductionPlan[8] + "','" + DayProductionPlan[9] + "','" + DayProductionPlan[10] + "','" + DayProductionPlan[11] + "','" + DayProductionPlan[12] + "','"
+ DayProductionPlan[13] + "','" + DayProductionPlan[14] + "','" + DayProductionPlan[15] + "','" + DayProductionPlan[16] + "','" + DayProductionPlan[17] + "','"
+ DayProductionPlan[18] + "','" + DayProductionPlan[19] + "','" + DayProductionPlan[20] + "','" + DayProductionPlan[21] + "','" + DayProductionPlan[22] + "','"
+ DayProductionPlan[23] + "','" + DayProductionPlan[24] + "','" + DayProductionPlan[25] + "','" + DayProductionPlan[26] + "','" + DayProductionPlan[27] + "','"
+ DayProductionPlan[28] + "','" + DayProductionPlan[29] + "','" + DayProductionPlan[30] + "','" + DayProductionPlan[31] + "','" + DayProductionPlan[32] + "','"
+ DayProductionPlan[33] + "','" + DayProductionPlan[34] + "','" + DayProductionPlan[35] + "','" + DayProductionPlan[36] + "')";
return sql;
}
#endregion
#region 晚班月份计划表
public DataTable NightProductionPlanDT(dynamic NightProductionPlan)
{
return dbhelp.ExecuteDataTable(DayProductionPlanSql(NightProductionPlan), null);
}
public string NightProductionPlanSql(dynamic NightProductionPlan)
{
string strWhere = string.Empty;
string sql = @"insert into [wh].[dbo].[ProductionPlan] values ('" + NightProductionPlan[0] + "','" + NightProductionPlan[1] + "','" + NightProductionPlan[2] + "','"
+ NightProductionPlan[3] + "','" + NightProductionPlan[4] + "','" + NightProductionPlan[5] + "','" + NightProductionPlan[6] + "','" + NightProductionPlan[7] + "','"
+ NightProductionPlan[8] + "','" + NightProductionPlan[9] + "','" + NightProductionPlan[10] + "','" + NightProductionPlan[11] + "','" + NightProductionPlan[12] + "','"
+ NightProductionPlan[13] + "','" + NightProductionPlan[14] + "','" + NightProductionPlan[15] + "','" + NightProductionPlan[16] + "','" + NightProductionPlan[17] + "','"
+ NightProductionPlan[18] + "','" + NightProductionPlan[19] + "','" + NightProductionPlan[20] + "','" + NightProductionPlan[21] + "','" + NightProductionPlan[22] + "','"
+ NightProductionPlan[23] + "','" + NightProductionPlan[24] + "','" + NightProductionPlan[25] + "','" + NightProductionPlan[26] + "','" + NightProductionPlan[27] + "','"
+ NightProductionPlan[28] + "','" + NightProductionPlan[29] + "','" + NightProductionPlan[30] + "','" + NightProductionPlan[31] + "','" + NightProductionPlan[32] + "','"
+ NightProductionPlan[33] + "','" + NightProductionPlan[34] + "','" + NightProductionPlan[35] + "','" + NightProductionPlan[36] + "')";
return sql;
}
#endregion
#region 白班月份计划
public DataTable SearchDayMonthPlanDT(string DayWorkshop, string Dayyear, string Daymonth)
{
return dbhelp.ExecuteDataTable(SearchDayMonthPlanSql(DayWorkshop, Dayyear, Daymonth), null);
}
public string SearchDayMonthPlanSql(string DayWorkshop, string Dayyear, string Daymonth)
{
string strWhere = string.Empty;
//string sql = @"select * from wh.dbo.ProductionPlan where year = '"+Year+@"' and month = '"+Month+"月'";
string sql = @"select s.*
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 = '" + Dayyear + @"' and s.month = '" + Daymonth + "' and s.workshop = '" + DayWorkshop+"'";
return sql;
}
#endregion
#region 晚班月份计划
public DataTable SearchNightMonthPlanDT(string NightWorkshop, string Nightyear, string Nightmonth)
{
return dbhelp.ExecuteDataTable(SearchNightMonthPlanSql(NightWorkshop,Nightyear,Nightmonth), null);
}
public string SearchNightMonthPlanSql(string NightWorkshop, string Nightyear, string Nightmonth)
{
string strWhere = string.Empty;
//string sql = @"select * from wh.dbo.ProductionPlan where year = '"+Year+@"' and month = '"+Month+"月'";
string sql = @"select s.*
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 = 'night' and s.year = '" + Nightyear + @"' and s.month = '" + Nightmonth + "' and s.workshop = '" + NightWorkshop+"'";
return sql;
}
#endregion
}
}