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.
84 lines
2.3 KiB
84 lines
2.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using Dapper;
|
|
|
|
namespace Warehouse.DAL.SiteCapacityStandCheck
|
|
{
|
|
public class SiteCapacityStandCheckDal
|
|
{
|
|
static DbUtility dbhelp = new DbUtility(System.Configuration.ConfigurationManager.ConnectionStrings["mesConn"].ToString(), DbProviderType.SqlServer);
|
|
|
|
#region 查询线别标准产能
|
|
public DataTable SiteCapacityStandDT(string workshop,string line)
|
|
{
|
|
return dbhelp.ExecuteDataTable(SiteCapacityStandSql(workshop,line), null);
|
|
}
|
|
|
|
public string SiteCapacityStandSql(string workshop, string line)
|
|
{
|
|
|
|
string strWhere = string.Empty;
|
|
if (!string.IsNullOrEmpty(workshop))
|
|
{
|
|
strWhere += "and v.workshop = '" + workshop + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(line))
|
|
{
|
|
strWhere += "and v.line = '" + line + "' ";
|
|
}
|
|
string sql = @"
|
|
if exists(
|
|
select s.[weld]
|
|
,s.[laminate]
|
|
,s.[lamination]
|
|
,s.[laminatedInspection]
|
|
,s.[frame]
|
|
,s.[rinse]
|
|
,s.[ivtest]
|
|
,s.[eltest]
|
|
,s.[complete]
|
|
from ( select v.[weld]
|
|
,v.[laminate]
|
|
,v.[lamination]
|
|
,v.[laminatedInspection]
|
|
,v.[frame]
|
|
,v.[rinse]
|
|
,v.[ivtest]
|
|
,v.[eltest]
|
|
,v.[complete]
|
|
,row_number() over(partition by v.workshop order by v.createtime desc) rw
|
|
from [wh].[dbo].[SiteCapacityStand] v where 1=1 "+strWhere+@" ) s
|
|
where s.rw = '1' )
|
|
begin
|
|
select s.[weld]
|
|
,s.[laminate]
|
|
,s.[lamination]
|
|
,s.[laminatedInspection]
|
|
,s.[frame]
|
|
,s.[rinse]
|
|
,s.[ivtest]
|
|
,s.[eltest]
|
|
,s.[complete]
|
|
from ( select v.[weld]
|
|
,v.[laminate]
|
|
,v.[lamination]
|
|
,v.[laminatedInspection]
|
|
,v.[frame]
|
|
,v.[rinse]
|
|
,v.[ivtest]
|
|
,v.[eltest]
|
|
,v.[complete]
|
|
,row_number() over(partition by v.workshop order by v.createtime desc) rw
|
|
from [wh].[dbo].[SiteCapacityStand] v where 1=1 "+strWhere+@" ) s
|
|
where s.rw = '1'
|
|
end
|
|
else
|
|
select 0 as weld,0 as laminate,0 as lamination,0 as laminatedInspection,0 as frame,0 as rinse,0 as ivtest,0 as eltest,0 as complete ";
|
|
return sql;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|