修改进度模块

This commit is contained in:
2023-08-30 14:52:34 +08:00
parent 1a38e3c935
commit 991eb07f0b
22 changed files with 862 additions and 95 deletions
@@ -0,0 +1,124 @@
ALTER VIEW [dbo].[View_WBS]
AS
select '1' as Id,'0' as SupId ,'JZ' as Code, '建筑工程' as Name,'ProjectType' as WBSType,null as PlanStartDate,null as PlanEndDate,
ProjectId from dbo.WBS_UnitWork
Union
select '2' as Id,'0' as SupId ,'AZ' as Code, '安装工程' as Name,'ProjectType' as WBSType,null as PlanStartDate,null as PlanEndDate,
ProjectId from dbo.WBS_UnitWork
Union
select UnitWorkId as Id,ProjectType as SupId ,UnitWorkCode as Code, UnitWorkCode+'-'+UnitWorkName as Name,'UnitWork' as WBSType,PlanStartDate, PlanEndDate,
ProjectId from dbo.WBS_UnitWork
Union all
select WorkPackageId as id,UnitWorkId as SupId,WorkPackageCode as Code,WorkPackageCode+'-'+PackageContent as Name,'WorkPackage' as WBSType,PlanStartDate, PlanEndDate,
ProjectId from dbo.WBS_WorkPackage w where IsApprove=1 and SuperWorkPackageId is null
Union all
select WorkPackageId as id,SuperWorkPackageId as SupId,WorkPackageCode as Code, WorkPackageCode+'-'+PackageContent as Name,'WorkPackage' as WBSType,PlanStartDate, PlanEndDate,
ProjectId from dbo.WBS_WorkPackage w where IsApprove=1 and SuperWorkPackageId is not null
GO
alter table WBS_UnitWork add WBSCode nvarchar(50) null
GO
alter table WBS_WorkPackage add WBSCode nvarchar(50) null
GO
alter table WBS_ControlItemAndCycle add WBSCode nvarchar(50) null
GO
ALTER VIEW [dbo].[View_WBS]
AS
select '1' as Id,'0' as SupId ,'JZ' as Code, '建筑工程' as Name,'ProjectType' as WBSType,null as PlanStartDate,null as PlanEndDate,null as WBSCode,
ProjectId from dbo.WBS_UnitWork
Union
select '2' as Id,'0' as SupId ,'AZ' as Code, '安装工程' as Name,'ProjectType' as WBSType,null as PlanStartDate,null as PlanEndDate,null as WBSCode,
ProjectId from dbo.WBS_UnitWork
Union
select UnitWorkId as Id,ProjectType as SupId ,UnitWorkCode as Code, WBSCode+'-'+UnitWorkName as Name,'UnitWork' as WBSType,PlanStartDate, PlanEndDate,WBSCode,
ProjectId from dbo.WBS_UnitWork
Union all
select WorkPackageId as id,UnitWorkId as SupId,WorkPackageCode as Code,WBSCode+'-'+PackageContent as Name,'WorkPackage' as WBSType,PlanStartDate, PlanEndDate,WBSCode,
ProjectId from dbo.WBS_WorkPackage w where IsApprove=1 and SuperWorkPackageId is null
Union all
select WorkPackageId as id,SuperWorkPackageId as SupId,WorkPackageCode as Code, WBSCode+'-'+PackageContent as Name,'WorkPackage' as WBSType,PlanStartDate, PlanEndDate,WBSCode,
ProjectId from dbo.WBS_WorkPackage w where IsApprove=1 and SuperWorkPackageId is not null
GO
update WBS_WorkPackage set PackageCode=(select PackageCode from WBS_WorkPackageInit w where w.WorkPackageCode=InitWorkPackageCode)
GO
alter table [dbo].[WBS_WorkPackageDetail] add PlanValue decimal(18,2) null
alter table [dbo].[WBS_WorkPackageDetail] add ThisValue decimal(18,2) null
alter table [dbo].[WBS_WorkPackageParentDetail] add PlanValue decimal(18,2) null
alter table [dbo].[WBS_WorkPackageParentDetail] add ThisValue decimal(18,2) null
GO
ALTER VIEW [dbo].[View_WBS_WorkPackageDetail]
AS
/********控制项明细********/
SELECT detail.WorkPackageDetailId,
detail.WorkPackageId,
detail.Months,
c.WorkPackageCode,
c.PackageContent,
c.ProjectId,
c.Unit, --单位
c.PlanProjectQuantity, --概算工作量
c.RealProjectQuantity, --实际工程量
CONVERT(FLOAT,(select sum(ISNULL(PlanNum,0)) from WBS_WorkPackageDetail where WorkPackageId=detail.WorkPackageId and Months<=detail.Months)) as TotalPlanNum, --累计计划完成量
CONVERT(FLOAT,(select sum(ISNULL(ThisNum,0)) from WBS_WorkPackageDetail where WorkPackageId=detail.WorkPackageId and Months<=detail.Months)) as TotalThisNum, --累计完成量
CONVERT(FLOAT,(select sum(ISNULL(PlanValue,0)) from WBS_WorkPackageDetail where WorkPackageId=detail.WorkPackageId and Months<=detail.Months)) as TotalPlanValue, --累计概算费用
CONVERT(FLOAT,(select sum(ISNULL(ThisValue,0)) from WBS_WorkPackageDetail where WorkPackageId=detail.WorkPackageId and Months<=detail.Months)) as TotalThisValue, --累计实际费用
CONVERT(FLOAT,ISNULL(detail.PlanNum,0)) as PlanNum, --本月计划完成量
CONVERT(FLOAT,ISNULL(detail.ThisNum,0)) as ThisNum, --本月完成量
CONVERT(FLOAT,ISNULL(detail.PlanValue,0)) as PlanValue, --本月概算费用
CONVERT(FLOAT,ISNULL(detail.ThisValue,0)) as ThisValue --本月实际费用
FROM dbo.WBS_WorkPackageDetail AS detail
LEFT JOIN WBS_WorkPackage AS c ON c.WorkPackageId=detail.WorkPackageId
GO
ALTER VIEW [dbo].[View_WBS_WorkPackageParentDetail]
AS
/********控制项父级明细********/
SELECT detail.WorkPackageParentDetailId,
detail.ParentId,
detail.ProjectId,
detail.Months,
CONVERT(FLOAT,ISNULL(detail.PlanNum,0)) as PlanNum, --本月计划完成量
CONVERT(FLOAT,ISNULL(detail.ThisNum,0)) as ThisNum, --本月实际完成量
CONVERT(FLOAT,ISNULL(detail.PlanValue,0)) as PlanValue, --本月概算费用
CONVERT(FLOAT,ISNULL(detail.ThisValue,0)) as ThisValue, --本月实际费用
CONVERT(FLOAT,(select sum(ISNULL(PlanNum,0)) from WBS_WorkPackageParentDetail
where ParentId=detail.ParentId and Months<=detail.Months)) as TotalPlanNum, --累计计划完成量
CONVERT(FLOAT,(select sum(ISNULL(ThisNum,0)) from WBS_WorkPackageParentDetail
where ParentId=detail.ParentId and Months<=detail.Months)) as TotalThisNum, --累计完成量
CONVERT(FLOAT,(select sum(ISNULL(PlanValue,0)) from WBS_WorkPackageParentDetail
where ParentId=detail.ParentId and Months<=detail.Months)) as TotalPlanValue, --累计概算费用
CONVERT(FLOAT,(select sum(ISNULL(ThisValue,0)) from WBS_WorkPackageParentDetail
where ParentId=detail.ParentId and Months<=detail.Months)) as TotalThisValue --累计实际费用
FROM dbo.WBS_WorkPackageParentDetail AS detail
GO