HJGL_DS/DataBase/版本日志/HJGLDB_DS_2024-07-08_bwj.sql

189 lines
13 KiB
MySQL
Raw Normal View History

2025-03-12 10:04:13 +08:00
insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuModule)
values('4F189F68-D19D-4CAF-9F9C-20614A70A7F6','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ձ<EFBFBD>','HJGL/WeldingReport/NDTReport.aspx',220,'F3B157B7-9BEE-4150-6666-087828F1C51D',3)
go
CREATE PROCEDURE [dbo].[HJGL_sp_rpt_NDTReport]
(
@ProjectId NVARCHAR(50) = null,
@trustDate datetime = null
)
AS
/***************<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ձ<EFBFBD>**********************/
SELECT NDTType.NDT_ID,
NDTType.NDT_Code,
Base_Project.ProjectName AS ProjectName,
ISNULL(need_check_count_gd.need_check_count_gd,0) AS need_check_count_gd,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><EFBFBD>ڣ<EFBFBD>
ISNULL(need_check_count_hd.need_check_count_hd,0) AS need_check_count_hd,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
(ISNULL(need_check_count_gd.need_check_count_gd,0)+ISNULL(need_check_count_hd.need_check_count_hd,0)) AS need_check_count,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼƣ<EFBFBD>
ISNULL(trust_count_current_gd.trust_count_current_gd,0) AS trust_count_current_gd,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ί<EFBFBD>к<EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>̶<EFBFBD><EFBFBD>ڣ<EFBFBD>
ISNULL(trust_count_current_hd.trust_count_current_hd,0) AS trust_count_current_hd,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ί<EFBFBD>к<EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
ISNULL(trust_count_total_gd.trust_count_total_gd,0) AS trust_count_total_gd,--<EFBFBD>ۼ<EFBFBD>ί<EFBFBD>к<EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>̶<EFBFBD><EFBFBD>ڣ<EFBFBD>
ISNULL(trust_count_total_hd.trust_count_total_hd,0) AS trust_count_total_hd, --<EFBFBD>ۼ<EFBFBD>ί<EFBFBD>к<EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
ISNULL(check_count_current_gd.check_count_current_gd,0) AS check_count_current_gd,--<EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>̶<EFBFBD><EFBFBD>ڣ<EFBFBD>
ISNULL(check_count_current_hd.check_count_current_hd,0) AS check_count_current_hd,--<EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
ISNULL(check_count_gd.check_count_gd,0) AS check_count_gd,--<EFBFBD>ۼƼ<EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><EFBFBD>ڣ<EFBFBD>
ISNULL(check_count_hd.check_count_hd,0) AS check_count_hd,--<EFBFBD>ۼƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
(ISNULL(check_count_gd.check_count_gd,0)+ISNULL(check_count_hd.check_count_hd,0)) AS check_count_total, --<EFBFBD>ۼƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ںϼƣ<EFBFBD>
ISNULL(check_count_film.check_count_film,0) AS check_count_film,--<EFBFBD>ۼƼ<EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD>ϼƣ<EFBFBD>
(CASE WHEN ISNULL(need_check_count_gd.need_check_count_gd,0)>0
THEN CONVERT(nvarchar(10),ISNULL(check_count_gd.check_count_gd,0)/ISNULL(need_check_count_gd.need_check_count_gd,0)*100)+'%'
ELSE '0%' END) AS complete_check_gd_rate,--<EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><EFBFBD>ڣ<EFBFBD>
(CASE WHEN ISNULL(need_check_count_hd.need_check_count_hd,0)>0
THEN CONVERT(nvarchar(10),ISNULL(check_count_hd.check_count_hd,0)/ISNULL(need_check_count_hd.need_check_count_hd,0)*100)+'%'
ELSE '0%' END) AS complete_check_hd_rate,--<EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
(CASE WHEN (ISNULL(need_check_count_gd.need_check_count_gd,0)+ISNULL(need_check_count_hd.need_check_count_hd,0))>0
THEN CONVERT(nvarchar(10),(ISNULL(check_count_gd.check_count_gd,0)+ISNULL(check_count_hd.check_count_hd,0))/
(ISNULL(need_check_count_gd.need_check_count_gd,0)+ISNULL(need_check_count_hd.need_check_count_hd,0))*100)+'%' ELSE '0%' END) AS complete_check_total_rate,--<EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼƣ<EFBFBD>
(CASE WHEN (ISNULL(check_count_gd.check_count_gd,0)+ISNULL(check_count_hd.check_count_hd,0))>0
THEN CONVERT(nvarchar(10),((ISNULL(check_count_gd.check_count_gd,0)+ISNULL(check_count_hd.check_count_hd,0))-ISNULL(total_check_noPass_count.total_check_noPass_count,0))/
(ISNULL(check_count_gd.check_count_gd,0)+ISNULL(check_count_hd.check_count_hd,0))*100)+'%' ELSE '0%' END) AS check_one_pass_rate_count,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>κϸ<EFBFBD><EFBFBD>ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
(CASE WHEN ISNULL(check_count_film.check_count_film,0)>0 THEN
CONVERT(nvarchar(10),(ISNULL(check_count_film.check_count_film,0)-ISNULL(check_count_noPass_film.check_count_noPass_film,0))/ISNULL(check_count_film.check_count_film,0)*100)+'%'
ELSE '0%' END) AS check_one_pass_rate_film,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>κϸ<EFBFBD><EFBFBD>ʣ<EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ISNULL(total_check_noPass_count.total_check_noPass_count,0) AS total_check_noPass_count,--<EFBFBD>ۼƼ<EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
ISNULL(check_count_noPass_film.check_count_noPass_film,0) AS check_count_noPass_film,--<EFBFBD>ۼƼ<EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ISNULL(check_count_current_film.check_count_current_film,0) AS check_count_current_film,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>
ISNULL(check_count_total_film.check_count_total_film,0) AS check_count_total_film,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>
ISNULL(check_count_repair_film.check_count_repair_film,0) AS check_count_repair_film --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޣ<EFBFBD>
FROM HJGL_BS_NDTType AS NDTType
LEFT JOIN Base_Project ON Base_Project.ProjectId=@ProjectId
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><EFBFBD>ڣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS need_check_count_gd,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_CH_TrustItem
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
LEFT JOIN HJGL_PW_JointInfo ON HJGL_PW_JointInfo.JOT_ID = HJGL_CH_TrustItem.JOT_ID
WHERE HJGL_CH_TrustItem.States='1' AND HJGL_PW_JointInfo.JOT_JointAttribute='<EFBFBD>̶<EFBFBD>'
AND HJGL_CH_Trust.ProjectId=@ProjectId
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS need_check_count_gd ON need_check_count_gd.CH_NDTMethod = NDTType.NDT_ID
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS need_check_count_hd,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_CH_TrustItem
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
LEFT JOIN HJGL_PW_JointInfo ON HJGL_PW_JointInfo.JOT_ID = HJGL_CH_TrustItem.JOT_ID
WHERE HJGL_CH_TrustItem.States='1' AND HJGL_PW_JointInfo.JOT_JointAttribute='<EFBFBD>'
AND HJGL_CH_Trust.ProjectId=@ProjectId
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS need_check_count_hd ON need_check_count_hd.CH_NDTMethod = NDTType.NDT_ID
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ί<EFBFBD>к<EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>̶<EFBFBD><EFBFBD>ڣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS trust_count_current_gd,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_CH_TrustItem
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
LEFT JOIN HJGL_PW_JointInfo ON HJGL_PW_JointInfo.JOT_ID = HJGL_CH_TrustItem.JOT_ID
WHERE HJGL_PW_JointInfo.JOT_JointAttribute='<EFBFBD>̶<EFBFBD>'
AND HJGL_CH_Trust.ProjectId=@ProjectId AND CONVERT(varchar(10), HJGL_CH_Trust.CH_TrustDate,120)=@trustDate
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS trust_count_current_gd ON trust_count_current_gd.CH_NDTMethod = NDTType.NDT_ID
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ί<EFBFBD>к<EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS trust_count_current_hd,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_CH_TrustItem
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
LEFT JOIN HJGL_PW_JointInfo ON HJGL_PW_JointInfo.JOT_ID = HJGL_CH_TrustItem.JOT_ID
WHERE HJGL_PW_JointInfo.JOT_JointAttribute='<EFBFBD>̶<EFBFBD>'
AND HJGL_CH_Trust.ProjectId=@ProjectId AND CONVERT(varchar(10), HJGL_CH_Trust.CH_TrustDate,120)=@trustDate
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS trust_count_current_hd ON trust_count_current_hd.CH_NDTMethod = NDTType.NDT_ID
--<EFBFBD>ۼ<EFBFBD>ί<EFBFBD>к<EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>̶<EFBFBD><EFBFBD>ڣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS trust_count_total_gd,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_CH_TrustItem
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
LEFT JOIN HJGL_PW_JointInfo ON HJGL_PW_JointInfo.JOT_ID = HJGL_CH_TrustItem.JOT_ID
WHERE HJGL_PW_JointInfo.JOT_JointAttribute='<EFBFBD>̶<EFBFBD>'
AND HJGL_CH_Trust.ProjectId=@ProjectId
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS trust_count_total_gd ON trust_count_total_gd.CH_NDTMethod = NDTType.NDT_ID
--<EFBFBD>ۼ<EFBFBD>ί<EFBFBD>к<EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS trust_count_total_hd,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_CH_TrustItem
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
LEFT JOIN HJGL_PW_JointInfo ON HJGL_PW_JointInfo.JOT_ID = HJGL_CH_TrustItem.JOT_ID
WHERE HJGL_PW_JointInfo.JOT_JointAttribute='<EFBFBD>'
AND HJGL_CH_Trust.ProjectId=@ProjectId
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS trust_count_total_hd ON trust_count_total_hd.CH_NDTMethod = NDTType.NDT_ID
--<EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>̶<EFBFBD><EFBFBD>ڣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS check_count_current_gd,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_CH_TrustItem
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
LEFT JOIN HJGL_PW_JointInfo ON HJGL_PW_JointInfo.JOT_ID = HJGL_CH_TrustItem.JOT_ID
WHERE HJGL_CH_TrustItem.States!='1' AND HJGL_PW_JointInfo.JOT_JointAttribute='<EFBFBD>̶<EFBFBD>'
AND HJGL_CH_Trust.ProjectId=@ProjectId AND CONVERT(varchar(10), HJGL_CH_Trust.CH_TrustDate,120)=@trustDate
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS check_count_current_gd ON check_count_current_gd.CH_NDTMethod = NDTType.NDT_ID
--<EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>̶<EFBFBD><EFBFBD>ڣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS check_count_current_hd,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_CH_TrustItem
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
LEFT JOIN HJGL_PW_JointInfo ON HJGL_PW_JointInfo.JOT_ID = HJGL_CH_TrustItem.JOT_ID
WHERE HJGL_CH_TrustItem.States!='1' AND HJGL_PW_JointInfo.JOT_JointAttribute='<EFBFBD>'
AND HJGL_CH_Trust.ProjectId=@ProjectId AND CONVERT(varchar(10), HJGL_CH_Trust.CH_TrustDate,120)=@trustDate
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS check_count_current_hd ON check_count_current_hd.CH_NDTMethod = NDTType.NDT_ID
--<EFBFBD>ۼƼ<EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><EFBFBD>ڣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS check_count_gd,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_CH_TrustItem
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
LEFT JOIN HJGL_PW_JointInfo ON HJGL_PW_JointInfo.JOT_ID = HJGL_CH_TrustItem.JOT_ID
WHERE HJGL_CH_TrustItem.States!='1' AND HJGL_PW_JointInfo.JOT_JointAttribute='<EFBFBD>̶<EFBFBD>'
AND HJGL_CH_Trust.ProjectId=@ProjectId
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS check_count_gd ON check_count_gd.CH_NDTMethod = NDTType.NDT_ID
--<EFBFBD>ۼƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS check_count_hd,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_CH_TrustItem
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
LEFT JOIN HJGL_PW_JointInfo ON HJGL_PW_JointInfo.JOT_ID = HJGL_CH_TrustItem.JOT_ID
WHERE HJGL_CH_TrustItem.States!='1' AND HJGL_PW_JointInfo.JOT_JointAttribute='<EFBFBD>'
AND HJGL_CH_Trust.ProjectId=@ProjectId
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS check_count_hd ON check_count_hd.CH_NDTMethod = NDTType.NDT_ID
----<EFBFBD>ۼƼ<EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD>ϼƣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS check_count_film,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_BO_QualityRating
LEFT JOIN HJGL_CH_TrustItem ON HJGL_CH_TrustItem.CH_TrustItemID = HJGL_BO_QualityRating.CH_TrustItemID
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
WHERE HJGL_CH_Trust.ProjectId=@ProjectId
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS check_count_film ON check_count_film.CH_NDTMethod = NDTType.NDT_ID
--<EFBFBD>ۼƼ<EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS total_check_noPass_count,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_CH_TrustItem
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
WHERE HJGL_CH_Trust.ProjectId=@ProjectId AND HJGL_CH_TrustItem.States='3'
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS total_check_noPass_count ON total_check_noPass_count.CH_NDTMethod = NDTType.NDT_ID
--<EFBFBD>ۼƼ<EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS check_count_noPass_film,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_BO_QualityRating
LEFT JOIN HJGL_CH_TrustItem ON HJGL_CH_TrustItem.CH_TrustItemID = HJGL_BO_QualityRating.CH_TrustItemID
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
WHERE HJGL_BO_QualityRating.IsPass='<EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>' and HJGL_CH_Trust.ProjectId=@ProjectId
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS check_count_noPass_film ON check_count_noPass_film.CH_NDTMethod = NDTType.NDT_ID
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS check_count_current_film,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_BO_QualityRatingRepair
LEFT JOIN HJGL_CH_RepairItem ON HJGL_CH_RepairItem.CH_RepairItemId = HJGL_BO_QualityRatingRepair.CH_RepairItemId
LEFT JOIN HJGL_CH_Repair ON HJGL_CH_Repair.CH_RepairID = HJGL_CH_RepairItem.CH_RepairID
LEFT JOIN HJGL_CH_TrustItem ON HJGL_CH_TrustItem.CH_TrustItemID = HJGL_CH_Repair.TrustItemID
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
WHERE HJGL_CH_Trust.ProjectId=@ProjectId AND CONVERT(varchar(10),HJGL_CH_Repair.RepairTrustDate,120)=@trustDate
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS check_count_current_film ON check_count_current_film.CH_NDTMethod = NDTType.NDT_ID
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS check_count_total_film,HJGL_CH_Trust.CH_NDTMethod FROM HJGL_BO_QualityRatingRepair
LEFT JOIN HJGL_CH_RepairItem ON HJGL_CH_RepairItem.CH_RepairItemId = HJGL_BO_QualityRatingRepair.CH_RepairItemId
LEFT JOIN HJGL_CH_Repair ON HJGL_CH_Repair.CH_RepairID = HJGL_CH_RepairItem.CH_RepairID
LEFT JOIN HJGL_CH_TrustItem ON HJGL_CH_TrustItem.CH_TrustItemID = HJGL_CH_Repair.TrustItemID
LEFT JOIN HJGL_CH_Trust ON HJGL_CH_Trust.CH_TrustID = HJGL_CH_TrustItem.CH_TrustID
WHERE HJGL_CH_Trust.ProjectId=@ProjectId
GROUP BY HJGL_CH_Trust.CH_NDTMethod) AS check_count_total_film ON check_count_total_film.CH_NDTMethod = NDTType.NDT_ID
----<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޣ<EFBFBD>
LEFT JOIN (SELECT COUNT(*) AS check_count_repair_film,HJGL_CH_Repair.NDT_ID FROM HJGL_BO_QualityRatingRepair
LEFT JOIN HJGL_CH_RepairItem ON HJGL_CH_RepairItem.CH_RepairItemId = HJGL_BO_QualityRatingRepair.CH_RepairItemId
LEFT JOIN HJGL_CH_Repair ON HJGL_CH_Repair.CH_RepairID = HJGL_CH_RepairItem.CH_RepairID
LEFT JOIN HJGL_CH_TrustItem ON HJGL_CH_TrustItem.CH_TrustItemID = HJGL_CH_Repair.TrustItemID
WHERE HJGL_CH_RepairItem.States='4' AND HJGL_CH_Repair.ProjectId=@ProjectId
GROUP BY HJGL_CH_Repair.NDT_ID) AS check_count_repair_film ON check_count_repair_film.NDT_ID = NDTType.NDT_ID
GO