作业票
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
|
||||
|
||||
|
||||
--作业票定稿补充字段:来源说明
|
||||
IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'License_LicenseManager' AND COLUMN_NAME = 'SourceDes')
|
||||
BEGIN
|
||||
ALTER TABLE License_LicenseManager ADD SourceDes nvarchar(500);
|
||||
END
|
||||
GO
|
||||
|
||||
----作业票定稿补充字段:许可证编号
|
||||
--IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'License_LicenseManager' AND COLUMN_NAME = 'LicenseCodes')
|
||||
--BEGIN
|
||||
-- ALTER TABLE License_LicenseManager ADD LicenseCodes nvarchar(50);
|
||||
--END
|
||||
--GO
|
||||
|
||||
|
||||
|
||||
|
||||
ALTER VIEW [dbo].[View_License_LicenseManager]
|
||||
AS
|
||||
/*现场安全许可证*/
|
||||
SELECT LicenseManager.LicenseManagerId,
|
||||
LicenseManager.ProjectId,
|
||||
LicenseManager.LicenseTypeId,
|
||||
LicenseManager.LicenseManagerCode,
|
||||
LicenseManager.LicenseManageName,
|
||||
LicenseManager.UnitId,
|
||||
LicenseManager.LicenseManageContents,
|
||||
LicenseManager.CompileMan,
|
||||
LicenseManager.CompileDate,
|
||||
LicenseManager.States,
|
||||
Project.ProjectCode,
|
||||
Project.ProjectName,
|
||||
LicenseType.LicenseTypeName,
|
||||
Unit.UnitName,
|
||||
UnitType.UnitTypeId,
|
||||
UnitType.UnitTypeName,
|
||||
Users.UserName,
|
||||
LicenseManager.WorkAreaId,
|
||||
--WorkArea.WorkAreaName,
|
||||
LicenseManager.StartDate,
|
||||
LicenseManager.EndDate,
|
||||
LicenseManager.ApplicantMan,
|
||||
LicenseManager.IsHighRisk,
|
||||
LicenseManager.WorkStates,
|
||||
LicenseManager.IsUpdate,
|
||||
LicenseManager.SourceDes,
|
||||
case LicenseManager.WorkStates when '1' then '待开工'
|
||||
when '2' then '作业中'
|
||||
when '3' then '已关闭'
|
||||
when '-1' then '已取消'
|
||||
else '' end as WorkStatesStr,
|
||||
WorkAreaName = STUFF(( SELECT ',' + UnitWorkName FROM WBS_UnitWork
|
||||
where PATINDEX('%,' + RTRIM(WBS_UnitWork.UnitWorkId) + ',%',',' + LicenseManager.WorkAreaId + ',')>0
|
||||
ORDER BY PATINDEX('%,' + RTRIM(LicenseManager.WorkAreaId) + ',%',',' + LicenseManager.WorkAreaId + ',')
|
||||
FOR XML PATH('')), 1, 1,'')
|
||||
FROM dbo.License_LicenseManager AS LicenseManager
|
||||
LEFT JOIN dbo.Base_Project AS Project ON Project.ProjectId = LicenseManager.ProjectId
|
||||
LEFT JOIN dbo.Base_LicenseType AS LicenseType ON LicenseType.LicenseTypeId = LicenseManager.LicenseTypeId
|
||||
LEFT JOIN dbo.Base_Unit AS Unit ON Unit.UnitId = LicenseManager.UnitId
|
||||
LEFT JOIN dbo.Sys_User AS Users ON Users.UserId = LicenseManager.CompileMan
|
||||
LEFT JOIN dbo.WBS_UnitWork AS WorkArea ON WorkArea.UnitWorkId = LicenseManager.WorkAreaId
|
||||
LEFT JOIN dbo.Base_UnitType as UnitType ON UnitType.UnitTypeId=Unit.UnitTypeId
|
||||
|
||||
|
||||
|
||||
GO
|
||||
|
||||
|
||||
Reference in New Issue
Block a user