|
|
@ -1254,9 +1254,9 @@ ORDER BY 销售车号,物料编码,报工人 |
|
|
) wipb on tmo.socode = wipb.socode |
|
|
) wipb on tmo.socode = wipb.socode |
|
|
|
|
|
|
|
|
select row_number() over (order by a.客户交货期,a.销售车辆号)as 序号, a.* from ( |
|
|
select row_number() over (order by a.客户交货期,a.销售车辆号)as 序号, a.* from ( |
|
|
select distinct tso.socode 销售车辆号,tso.plandate as 客户交货期, isnull(convert(char(4),cus.fname),'') 用户单位, |
|
|
|
|
|
|
|
|
select distinct tso.socode 销售车辆号,convert(varchar(10),tso.plandate,120) as 客户交货期, isnull(convert(char(4),cus.fname),'') 用户单位, |
|
|
inv.invname as 产品名称, |
|
|
inv.invname as 产品名称, |
|
|
concat(cast(cast(tnum.wipnum * 1.0 / tnum.monum as decimal(18,3))* 100 as decimal(18,1)),'%') 进度, |
|
|
|
|
|
|
|
|
concat(cast(cast(tnum.wipnum * 1.0 / tnum.monum as decimal(18,3))* 100 as decimal(18,0)),'%') 进度, |
|
|
(case when tnum.wipnum/tnum.monum =1 then '已完工' when tnum.wipbnum >0 then '开工中' else '未开工' end ) 生产状态 |
|
|
(case when tnum.wipnum/tnum.monum =1 then '已完工' when tnum.wipbnum >0 then '开工中' else '未开工' end ) 生产状态 |
|
|
from |
|
|
from |
|
|
icsso tso |
|
|
icsso tso |
|
|
@ -1279,9 +1279,7 @@ ORDER BY 销售车号,物料编码,报工人 |
|
|
#region 振翔看板产量
|
|
|
#region 振翔看板产量
|
|
|
public DataTable GetOutput() |
|
|
public DataTable GetOutput() |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
string SqlText = ""; |
|
|
string SqlText = ""; |
|
|
|
|
|
|
|
|
SqlText = @" if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#tempNum'))
|
|
|
SqlText = @" if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#tempNum'))
|
|
|
drop table #tempNum |
|
|
drop table #tempNum |
|
|
if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#tempData')) |
|
|
if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#tempData')) |
|
|
@ -1310,14 +1308,14 @@ ORDER BY 销售车号,物料编码,报工人 |
|
|
where moth = CONVERT(CHAR(10),DATEADD(month,-1,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120) )a --此部分为上月数据 |
|
|
where moth = CONVERT(CHAR(10),DATEADD(month,-1,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120) )a --此部分为上月数据 |
|
|
left join ( |
|
|
left join ( |
|
|
select isnull(mpproduct,0) as 前月度生产 from ICSZXBoardPlan |
|
|
select isnull(mpproduct,0) as 前月度生产 from ICSZXBoardPlan |
|
|
where moth = CONVERT(CHAR(10),DATEADD(month,-2,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120) ) b on 1=1 --此部分为前月数据 |
|
|
|
|
|
|
|
|
where moth = CONVERT(CHAR(10),DATEADD(month,0,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120) ) b on 1=1 --此部分为前月数据 |
|
|
left join ( |
|
|
left join ( |
|
|
select count(*) 上月完成 from #tempNum t where t.wipnum = t.monum and t.EndTime between |
|
|
select count(*) 上月完成 from #tempNum t where t.wipnum = t.monum and t.EndTime between |
|
|
CONVERT(CHAR(10),DATEADD(month,-1,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120) |
|
|
CONVERT(CHAR(10),DATEADD(month,-1,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120) |
|
|
and CONVERT(CHAR(10),DATEADD(month,0,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120)) c on 1=1 |
|
|
and CONVERT(CHAR(10),DATEADD(month,0,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120)) c on 1=1 |
|
|
left join ( |
|
|
left join ( |
|
|
select count(*) 前月完成 from #tempNum t where t.wipnum = t.monum and t.EndTime between |
|
|
select count(*) 前月完成 from #tempNum t where t.wipnum = t.monum and t.EndTime between |
|
|
CONVERT(CHAR(10),DATEADD(month,-2,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120) |
|
|
|
|
|
|
|
|
CONVERT(CHAR(10),DATEADD(month,0,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120) |
|
|
and CONVERT(CHAR(10),DATEADD(month,-1,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120)) d on 1=1 |
|
|
and CONVERT(CHAR(10),DATEADD(month,-1,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120)) d on 1=1 |
|
|
left join ( |
|
|
left join ( |
|
|
select count(*) 年度生产 from #tempNum t where t.wipnum = t.monum and t.EndTime >= |
|
|
select count(*) 年度生产 from #tempNum t where t.wipnum = t.monum and t.EndTime >= |
|
|
@ -1334,7 +1332,7 @@ ORDER BY 销售车号,物料编码,报工人 |
|
|
case when isnull(前月完成,0) = 0 then 0 else |
|
|
case when isnull(前月完成,0) = 0 then 0 else |
|
|
convert(decimal(10,2),isnull(前月完成,0))*1.0/isnull(convert(decimal(10,2),case when 前月度生产 = 0 then 1 else 前月度生产 end),1) end 前月比, |
|
|
convert(decimal(10,2),isnull(前月完成,0))*1.0/isnull(convert(decimal(10,2),case when 前月度生产 = 0 then 1 else 前月度生产 end),1) end 前月比, |
|
|
month(DATEADD(month,-1,DATEADD(dd,-DAY(GETDATE())+1,GETDATE()))) 上月, |
|
|
month(DATEADD(month,-1,DATEADD(dd,-DAY(GETDATE())+1,GETDATE()))) 上月, |
|
|
month(DATEADD(month,-2,DATEADD(dd,-DAY(GETDATE())+1,GETDATE()))) 前月 |
|
|
|
|
|
|
|
|
month(DATEADD(month,0,DATEADD(dd,-DAY(GETDATE())+1,GETDATE()))) 前月 |
|
|
from #tempData |
|
|
from #tempData |
|
|
if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#tempNum')) |
|
|
if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#tempNum')) |
|
|
drop table #tempNum |
|
|
drop table #tempNum |
|
|
@ -1460,7 +1458,7 @@ ORDER BY 销售车号,物料编码,报工人 |
|
|
where t.wipnum = t.monum and t.EndTime between |
|
|
where t.wipnum = t.monum and t.EndTime between |
|
|
CONVERT(CHAR(10),DATEADD(month,-6,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120) |
|
|
CONVERT(CHAR(10),DATEADD(month,-6,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120) |
|
|
and CONVERT(CHAR(10),DATEADD(month,-5,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120) |
|
|
and CONVERT(CHAR(10),DATEADD(month,-5,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120) |
|
|
|
|
|
|
|
|
|
|
|
order by Mont |
|
|
if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#tempNum')) |
|
|
if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#tempNum')) |
|
|
drop table #tempNum |
|
|
drop table #tempNum |
|
|
";
|
|
|
";
|
|
|
|