IF EXISTS(SELECT * FROM sysobjects WHERE name = 'V_HWMJCPDZDZB')--单引号里面为视图名称
	DROP VIEW V_HWMJCPDZDZB--视图名称
GO
CREATE VIEW V_HWMJCPDZDZB AS
SELECT 
	t0e.FEntryID 'FID'
	,t0e.FID AS 'FPID'
	,t0e.FCPID
	,t0e.FMJSMZQ AS 'FMJSCZQ'--'模具生产周期'
	,CAST(t0e.FMJQS AS decimal(23,6)) AS 'FMJQS'--'模具腔数'
	,t0e.FBZCL AS 'FBZCN'--'标准产能'
	,t0e.FJTBZ --AS '机台备注'
	,t0e.FMJHH --AS '共模/互换明细'
	,t0e.F_PAEZ_DECIMAL AS 'FCPDZ'--'产品单重'
	,t0e.F_PAEZ_DECIMAL1 AS 'FCCSKZL'--'产出水口重量'
	,t0.FNUMBER
	,t0.FMJID
	,t0.F_PAEZ_TEXT AS 'FMJGGXH'--'模具规格(宽*高*厚 mm）'
	,t0.F_PAEZ_TEXT1 AS 'FMJXS'--'模具穴数'
	,t0.F_PAEZ_COMBO AS 'FMJLX'--'模具类型'
	,t0.FDOCUMENTSTATUS
	,t0.FFORBIDSTATUS
	,t1_l.FNAME AS 'FName'
	,t2_l.FNAME AS 'FProName'
	,t0.FMJID AS FMJMATERIALID
	,t0e.FCPID AS FCPMATERIALID
FROM hw_mjcpdzb t0
	INNER JOIN hw_mjcpdzbs t0e on t0.FID = t0e.FID
	LEFT JOIN T_BD_MATERIAL_L t1_l on t1_l.FMATERIALID = t0.FMJID AND t1_l.FLOCALEID = 2052
	LEFT JOIN T_BD_MATERIAL_L t2_l on t2_l.FMATERIALID = t0e.FCPID AND t2_l.FLOCALEID = 2052
WHERE
	t0.FDOCUMENTSTATUS ='C'
