SGGL_SHJ/DataBase/版本日志/已更新脚本/SGGLDB_V2023-04-04_lpf.sql

46 lines
1.5 KiB
Transact-SQL

insert into Sys_ButtonToMenu values('83D0D6F5-402A-4F6F-9423-37DBB6693164','0CA58EC2-7934-49B3-A2C3-327FAD27C541','生成委托单','5')
/****** Object: View [dbo].[View_HJGL_NoWeldJointFind] Script Date: 2023/4/3 16:14:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER VIEW [dbo].[View_HJGL_NoWeldJointFind]
AS
--未焊焊口查找
SELECT jot.WeldJointId,
jot.WeldJointCode,
(case when charindex('/',jot.WeldJointCode)>0
then RIGHT(jot.WeldJointCode,CHARINDEX('/',REVERSE(jot.WeldJointCode))-1)
else jot.WeldJointCode end) as WeldJointNum,
jot.PipelineId,
jot.WeldingDailyId,
jot.JointAttribute,
jot.Dia,
jot.DNDia,
jot.Size,
jot.Thickness,
jot.Remark,
WeldType.WeldTypeCode,
method.WeldingMethodCode,
rod.ConsumablesCode AS WeldingRodCode,
wire.ConsumablesCode AS WeldingWireCode,
mat1.MaterialCode AS Material1Code ,
mat2.MaterialCode AS Material2Code
FROM dbo.HJGL_WeldJoint jot
LEFT JOIN dbo.HJGL_PreWeldingDaily pre ON pre.WeldJointId = jot.WeldJointId
LEFT JOIN Base_WeldType AS WeldType ON WeldType.WeldTypeId=jot.WeldTypeId
LEFT JOIN Base_WeldingMethod AS method ON method.WeldingMethodId=jot.WeldingMethodId
LEFT JOIN Base_Material AS mat1 ON mat1.MaterialId = jot.Material1Id
LEFT JOIN Base_Material AS mat2 ON mat2.MaterialId = jot.Material2Id
LEFT JOIN Base_Consumables AS wire ON wire.ConsumablesId=jot.WeldingWire
LEFT JOIN Base_Consumables AS rod ON rod.ConsumablesId=jot.WeldingRod
WHERE pre.PreWeldingDailyId IS NULL
and jot.WeldJointId not in (select WeldJointId from HJGL_WeldJoint where IsTwoJoint = 1 and (AuditDate is null or AuditDate=''))
GO