提交代码
This commit is contained in:
@@ -5,7 +5,7 @@ AS
|
||||
|
||||
select distinct C.BaseId,C.ProjectId,case when a.DrawingNo is not null then a.WorkSection else b.WorkSection end as WorkSection,case when a.DrawingNo is not null then a.DrawingNo else b.ChangeNo end as DrawingNo,
|
||||
case when a.DrawingName is not null then a.DrawingName else b.ChangeName end as DrawingName,ba.State,
|
||||
case when a.DrawingNo is not null then ca.ProfessionalName else cb.ProfessionalName end as Major,ba.DrawingId
|
||||
case when a.DrawingNo is not null then ca.ProfessionalName else cb.ProfessionalName end as Major,ba.DrawingId,
|
||||
Part,ProjectContent,Unit,Amount,t.TeamGroupName as WorkTeam,C.WorkTeam as WorkTeamId
|
||||
from QuantityManagement_DayInput C
|
||||
left join QuantityManagement_Base ba on ba.BaseId=C.BaseId
|
||||
@@ -17,7 +17,7 @@ select distinct C.BaseId,C.ProjectId,case when a.DrawingNo is not null then a.Wo
|
||||
union
|
||||
select BaseId,C.ProjectId,case when a.DrawingNo is not null then a.WorkSection else b.WorkSection end as WorkSection,case when a.DrawingNo is not null then a.DrawingNo else b.ChangeNo end as DrawingNo,
|
||||
case when a.DrawingName is not null then a.DrawingName else b.ChangeName end as DrawingName,C.State,
|
||||
case when a.DrawingNo is not null then ca.ProfessionalName else cb.ProfessionalName end as Major,C.DrawingId
|
||||
case when a.DrawingNo is not null then ca.ProfessionalName else cb.ProfessionalName end as Major,C.DrawingId,
|
||||
Part,ProjectContent,Unit,Amount,t.TeamGroupName as WorkTeam,C.WorkTeam as WorkTeamId
|
||||
from QuantityManagement_Base C
|
||||
left join QuantityManagement_Drawing a on a.DrawingId=C.DrawingId
|
||||
@@ -30,3 +30,34 @@ select BaseId,C.ProjectId,case when a.DrawingNo is not null then a.WorkSection e
|
||||
GO
|
||||
|
||||
|
||||
|
||||
ALTER VIEW [dbo].[View_QuantityManagement_WorkTeamStatistics]
|
||||
AS
|
||||
/********工程量整体及分类汇总表********/
|
||||
|
||||
select distinct C.ProjectId+','+(case when a.DrawingNo is not null then a.WorkSection else b.WorkSection end)+','+ProjectContent+','+t.TeamGroupName as Id, C.ProjectId,case when a.DrawingNo is not null then a.WorkSection else b.WorkSection end as WorkSection,ba.State,
|
||||
ProjectContent,Unit,t.TeamGroupName as WorkTeam,C.WorkTeam as WorkTeamId,
|
||||
case when a.DrawingNo is not null then ca.ProfessionalName else cb.ProfessionalName end as Major
|
||||
from QuantityManagement_DayInput C
|
||||
left join QuantityManagement_Base ba on ba.BaseId=C.BaseId
|
||||
left join QuantityManagement_Drawing a on a.DrawingId=ba.DrawingId
|
||||
left join Base_CNProfessional ca on ca.CNProfessionalId=a.Major
|
||||
left join QuantityManagement_Change b on b.ChangeId=ba.DrawingId
|
||||
left join Base_CNProfessional cb on cb.CNProfessionalId=b.Major
|
||||
left join ProjectData_TeamGroup t on t.TeamGroupId=C.WorkTeam
|
||||
union
|
||||
select C.ProjectId+','+(case when a.DrawingNo is not null then a.WorkSection else b.WorkSection end)+','+ProjectContent+','+t.TeamGroupName as Id,C.ProjectId,case when a.DrawingNo is not null then a.WorkSection else b.WorkSection end as WorkSection,C.State,
|
||||
ProjectContent,Unit,t.TeamGroupName as WorkTeam,C.WorkTeam as WorkTeamId,
|
||||
case when a.DrawingNo is not null then ca.ProfessionalName else cb.ProfessionalName end as Major
|
||||
from QuantityManagement_Base C
|
||||
left join QuantityManagement_Drawing a on a.DrawingId=C.DrawingId
|
||||
left join Base_CNProfessional ca on ca.CNProfessionalId=a.Major
|
||||
left join QuantityManagement_Change b on b.ChangeId=C.DrawingId
|
||||
left join Base_CNProfessional cb on cb.CNProfessionalId=b.Major
|
||||
left join ProjectData_TeamGroup t on t.TeamGroupId=C.WorkTeam
|
||||
|
||||
|
||||
|
||||
GO
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user