1
This commit is contained in:
Binary file not shown.
@@ -70,6 +70,22 @@
|
|||||||
{
|
{
|
||||||
"$type": "Bookmark",
|
"$type": "Bookmark",
|
||||||
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
|
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$type": "Bookmark",
|
||||||
|
"Name": "ST:130:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$type": "Bookmark",
|
||||||
|
"Name": "ST:132:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$type": "Bookmark",
|
||||||
|
"Name": "ST:129:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$type": "Bookmark",
|
||||||
|
"Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,14 @@
|
|||||||
{
|
{
|
||||||
"$type": "Bookmark",
|
"$type": "Bookmark",
|
||||||
"Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
"Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$type": "Bookmark",
|
||||||
|
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$type": "Bookmark",
|
||||||
|
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
drop view View_HJGL_InstallData
|
||||||
|
go
|
||||||
|
Create VIEW View_HJGL_InstallData
|
||||||
|
AS
|
||||||
|
WITH PackagingManage AS (SELECT p.PackagingManageId,
|
||||||
|
p.ProjectId,
|
||||||
|
p.PackagingCode,
|
||||||
|
p.TrainNumberId,
|
||||||
|
s.Value as SplitPipelineComponentId
|
||||||
|
FROM HJGL_PackagingManage p
|
||||||
|
CROSS APPLY dbo.SplitString(p.PipelineComponentId, ',', 1) s
|
||||||
|
WHERE p.PipelineComponentId IS NOT NULL
|
||||||
|
AND p.PipelineComponentId != '' -- 添加空字符串检查
|
||||||
|
),
|
||||||
|
TwOutPutData as (select distinct twRelation.PipelineId,
|
||||||
|
outdetail.Id as TwOutputDetailId,
|
||||||
|
twRelation.MaterialCode,
|
||||||
|
master.Id as OutputMasterId
|
||||||
|
from Tw_OutputMaster master
|
||||||
|
join Tw_OutputDetail outdetail on outdetail.OutputMasterId = master.Id
|
||||||
|
join Tw_InOutPlanMaster planmaster on planmaster.Id = master.InOutPlanMasterId
|
||||||
|
join Tw_InOutPlanDetail_Relation twRelation
|
||||||
|
on twRelation.InOutPlanMasterId = planmaster.Id and
|
||||||
|
outdetail.MaterialCode = twRelation.MaterialCode),
|
||||||
|
PrefabricatedData AS (SELECT pipe.PipeLineMatId as Id,
|
||||||
|
line.PipelineCode,
|
||||||
|
pipe.PrefabricatedComponents as Code,
|
||||||
|
'预制组件' as TypeStr,
|
||||||
|
'' as Matdef,
|
||||||
|
CAST(NULL AS DECIMAL(18, 2)) as Number, -- 明确指定数据类型
|
||||||
|
pack.PackagingCode,
|
||||||
|
trainnumber.TrainNumber,
|
||||||
|
line.FlowingSection,
|
||||||
|
line.UnitWorkId,
|
||||||
|
line.ProjectId
|
||||||
|
FROM dbo.HJGL_PipeLineMat pipe
|
||||||
|
INNER JOIN dbo.HJGL_Pipeline line -- 改为INNER JOIN,如果管道必须存在
|
||||||
|
ON pipe.PipelineId = line.PipelineId
|
||||||
|
LEFT JOIN dbo.HJGL_MaterialCodeLib lib
|
||||||
|
ON lib.MaterialCode = pipe.MaterialCode
|
||||||
|
LEFT JOIN HJGL_Pipeline_Component comonent
|
||||||
|
ON comonent.PipelineComponentCode = pipe.PrefabricatedComponents
|
||||||
|
LEFT JOIN PackagingManage pack
|
||||||
|
ON pack.SplitPipelineComponentId = comonent.PipelineComponentId
|
||||||
|
AND pack.ProjectId = line.ProjectId -- 添加项目关联条件
|
||||||
|
LEFT JOIN HJGL_TrainNumberManage trainnumber
|
||||||
|
ON pack.TrainNumberId = trainnumber.Id
|
||||||
|
WHERE line.PipeArea = '1'
|
||||||
|
and (pipe.PrefabricatedComponents != ''
|
||||||
|
AND pipe.PrefabricatedComponents IS NOT NULL)),
|
||||||
|
LooseComponentsData AS (SELECT distinct pipe.PipeLineMatId as Id,
|
||||||
|
line.PipelineCode,
|
||||||
|
pipe.MaterialCode as Code,
|
||||||
|
'预制散件' as TypeStr,
|
||||||
|
lib.MaterialDef as Matdef,
|
||||||
|
cast( packdetail.Number as DECIMAL(18, 2)) as Number,
|
||||||
|
pack.PackagingCode,
|
||||||
|
trainnumber.TrainNumber,
|
||||||
|
line.FlowingSection,
|
||||||
|
line.UnitWorkId,
|
||||||
|
line.ProjectId
|
||||||
|
FROM dbo.HJGL_PipeLineMat pipe
|
||||||
|
INNER JOIN HJGL_Pipeline line -- 改为INNER JOIN
|
||||||
|
ON pipe.PipelineId = line.PipelineId
|
||||||
|
LEFT JOIN dbo.HJGL_MaterialCodeLib lib
|
||||||
|
ON lib.MaterialCode = pipe.MaterialCode
|
||||||
|
LEFT JOIN HJGL_PackagingManageDetail packdetail
|
||||||
|
ON packdetail.MaterialCode = pipe.MaterialCode
|
||||||
|
LEFT JOIN TwOutPutData twOutPutData
|
||||||
|
ON twOutPutData.PipelineId = pipe.PipelineId and
|
||||||
|
twOutPutData.MaterialCode = packdetail.MaterialCode
|
||||||
|
LEFT JOIN HJGL_PackagingManage pack
|
||||||
|
ON packdetail.PackagingManageId = pack.PackagingManageId
|
||||||
|
AND pack.ProjectId = line.ProjectId -- 添加项目关联条件
|
||||||
|
LEFT JOIN HJGL_TrainNumberManage trainnumber
|
||||||
|
ON pack.TrainNumberId = trainnumber.Id
|
||||||
|
where line.PipeArea = '1'
|
||||||
|
and (pipe.PrefabricatedComponents is null or pipe.PrefabricatedComponents = ''))
|
||||||
|
|
||||||
|
-- 合并结果
|
||||||
|
SELECT *
|
||||||
|
FROM PrefabricatedData
|
||||||
|
UNION ALL
|
||||||
|
SELECT *
|
||||||
|
FROM LooseComponentsData
|
||||||
|
|
||||||
|
go
|
||||||
|
alter table dbo.HJGL_PackagingManage
|
||||||
|
add CategoryInt int
|
||||||
|
go
|
||||||
|
|
||||||
|
exec sp_addextendedproperty 'MS_Description', N'包装类别', 'SCHEMA', 'dbo', 'TABLE', 'HJGL_PackagingManage', 'COLUMN',
|
||||||
|
'CategoryInt'
|
||||||
|
go
|
||||||
|
|
||||||
|
drop table Base_MaterialColor
|
||||||
|
CREATE TABLE [dbo].[Base_MaterialColor]
|
||||||
|
(
|
||||||
|
[MaterialColorId] nvarchar(50) NOT NULL DEFAULT (NEWID()) PRIMARY KEY,
|
||||||
|
[UnitId] nvarchar(50),
|
||||||
|
[MaterialId] nvarchar(50),
|
||||||
|
[ColorName] NVARCHAR(50),
|
||||||
|
[ColorCardNo] NVARCHAR(50),
|
||||||
|
[RGB] NVARCHAR(20),
|
||||||
|
[Remark] NVARCHAR(200)
|
||||||
|
);
|
||||||
|
|
||||||
|
go
|
||||||
|
exec sp_addextendedproperty 'MS_Description', N'单位id', 'SCHEMA', 'dbo', 'TABLE', 'Base_MaterialColor', 'COLUMN',
|
||||||
|
'UnitId'
|
||||||
|
go
|
||||||
|
|
||||||
|
exec sp_addextendedproperty 'MS_Description', N'材质id', 'SCHEMA', 'dbo', 'TABLE', 'Base_MaterialColor', 'COLUMN',
|
||||||
|
'MaterialId'
|
||||||
|
go
|
||||||
|
|
||||||
|
|
||||||
|
exec sp_addextendedproperty 'MS_Description', N'颜色名称', 'SCHEMA', 'dbo', 'TABLE', 'Base_MaterialColor', 'COLUMN',
|
||||||
|
'ColorName'
|
||||||
|
go
|
||||||
|
|
||||||
|
exec sp_addextendedproperty 'MS_Description', N'色卡号', 'SCHEMA', 'dbo', 'TABLE', 'Base_MaterialColor', 'COLUMN',
|
||||||
|
'ColorCardNo'
|
||||||
|
go
|
||||||
|
|
||||||
|
exec sp_addextendedproperty 'MS_Description', N'备注', 'SCHEMA', 'dbo', 'TABLE', 'Base_MaterialColor', 'COLUMN',
|
||||||
|
'Remark'
|
||||||
|
go
|
||||||
|
|
||||||
|
alter table dbo.HJGL_PackagingManageDetail
|
||||||
|
add TwOutputDetailId nvarchar(50)
|
||||||
|
go
|
||||||
|
|
||||||
|
exec sp_addextendedproperty 'MS_Description', N'出库明细表主键', 'SCHEMA', 'dbo', 'TABLE', 'HJGL_PackagingManageDetail',
|
||||||
|
'COLUMN', 'TwOutputDetailId'
|
||||||
|
go
|
||||||
Reference in New Issue
Block a user