日期:2014-05-17 浏览次数:20675 次
select row_number() over(order by getdate()) sid,
b.project_id, b.storage_sid, b.storage_code, b.storage_name, b.parent_id, b.display_id,
a.mac_sid as mat_sid, a.sa_wzrk_zb_mc as title, a.sa_wzrk_zb_ggxh, a.hd as model, a.sa_wzrk_zb_dw as unitname,a.ghdw,a.kcsl as kcsl,a.dj,a.fcsl,
a.srsl,a.tksl,a.thsl,ISNULL(isnull(a.kcsl,0)*isnull(a.dj,0),0) as zj,ISNULL(isnull(a.srsl,0)*isnull(a.dj,0),0) as srzj,
ISNULL(isnull(a.fcsl,0)*isnull(a.dj,0),0) as fczj,ISNULL(isnull(a.tksl,0)*isnull(a.dj,0),0) as tkzj ,ISNULL(isnull(a.thsl,0)*isnull(a.dj,0),0) as thzj,
isnull(ISNULL(a.srsl,0)*isnull(a.bhsdj,0),0) as bhssrje,isnull(ISNULL(a.fcsl,0)*isnull(a.bhsdj,0),0) as bhsfcje,isnull(ISNULL(a.tksl,0)*isnull(a.bhsdj,0),0) as bhstkje,
isnull(ISNULL(a.thsl,0)*isnull(a.bhsdj,0),0) as bhsthje,isnull(ISNULL(a.kcsl,0)*isnull(a.bhsdj,0),0) as bhskcje,a.bhsdj,a.szc,a.sfzzs
from (
select a.drck_sid, a.mac_sid,sum(a.fcsl) as fcsl,sum(a.srsl) as srsl,sum(a.tksl) as tksl,a.ghdw ,a.sa_wzrk_zb_mc,a.sa_wzrk_zb_ggxh,a.hd,a.sa_wzrk_zb_dw,sum(a.kcsl) kcsl,SUM(a.thsl) as thsl,a.dj,a.bhsdj,a.szc,a.sfzzs from(
--材料入库
select y.drck_sid, x.mac_sid,x.ghdw,x.sa_wzrk_zb_mc,x.sa_wzrk_zb_ggxh,x.hd,x.sa_wzrk_zb_dw,isnull(0,0)as fcsl,isnull(x.rksl,0) as srsl,
isnull(x.rksl,0)as kcsl,isnull(0,0) as tksl,isnull(x.sa_wzrk_zb_dj,0) as dj,isnull(x.hsdj,0) as bhsdj,ISNULL(0,0) as thsl,x.szc,x.sfzzs from
(select b.ghdw,a.pinpai,b.mac_sid,isnull(b.rksl,0) as rksl,b.sa_wzrk_zb_dj,a.m_sid,b