This commit is contained in:
高飞 2025-12-26 11:32:06 +08:00
parent 79948bf676
commit 6e818101b7
3 changed files with 110 additions and 2 deletions

View File

@ -0,0 +1,108 @@
ALTER VIEW [dbo].[View_WelderPerformance]
AS
select v.* from
(SELECT
NEWID() AS Id,
--total.ProjectId,
--project.ProjectCode,--
'' as ProjectCode,
total.Welder,
wld.wed_code,-- 焊工代码
wld.wed_name,--
unit.UnitName as DepartName, --
wld.WED_Sex, --
-------------start
CAST(ISNULL(total.totalSize,0) AS DECIMAL(19,2)) AS totalSize, --
ISNULL(total.totalJoint,0) AS totalJoint, --
ISNULL(JointNum1.JointNum1,0) AS JointNum1, --
ISNULL(JointNum1.JointNum1,0)-ISNULL(JointNoPassNum1.JointNoPassNum1,0) AS JointPassNum1, --
ISNULL(JointNoPassNum1.JointNoPassNum1,0) AS RepairJoint1, --
ISNULL(RepairJoint2.RepairJoint2,0) AS RepairJoint2, --
ISNULL(RepairJoint3.RepairJoint3,0) AS RepairJoint3, --
CAST((CASE ISNULL((ISNULL(JointNum1.JointNum1,0)-ISNULL(JointNoPassNum1.JointNoPassNum1,0)),0) WHEN 0 THEN 0
ELSE (CASE(ISNULL(JointNum1.JointNum1,0)) WHEN 0 THEN 0
ELSE 1.0 * ISNULL((ISNULL(JointNum1.JointNum1,0)-ISNULL(JointNoPassNum1.JointNoPassNum1,0)),0)/(1.0 * JointNum1.JointNum1)
END)END) AS DECIMAL(19,3)) AS JointPassRate , ---
ISNULL(JointNum1.totalfilm,0) AS totalfilm, --
(ISNULL(JointNum1.totalfilm,0)- ISNULL(JointNoPassNum2.JointNoPassFilmNum2,0)) AS totalPassfilm, --
ISNULL(JointNoPassNum2.JointNoPassFilmNum2,0) AS repairFilm1, --
ISNULL(RepairJoint2.repairFilm2,0) AS repairFilm2, --
ISNULL(RepairJoint3.repairFilm3,0) AS repairFilm3, --
CAST((CASE (ISNULL(JointNum1.totalfilm,0)- ISNULL(JointNoPassNum2.JointNoPassFilmNum2,0)) WHEN 0 THEN 0
ELSE (CASE(ISNULL(JointNum1.totalfilm,0)) WHEN 0 THEN 0
ELSE 1.0 * (ISNULL(JointNum1.totalfilm,0)- ISNULL(JointNoPassNum2.JointNoPassFilmNum2,0))/(1.0 * JointNum1.totalfilm)
END) END) AS DECIMAL(19,3)) AS JointFilmPassRate ---
FROM
-- --
(SELECT SUM(joint.JOT_Size) AS totalSize,COUNT(*) AS totalJoint
,joint.Welder
FROM View_JointWelder joint
LEFT JOIN HJGL_BO_WeldReportMain report ON joint.DReportID = report.DReportID
WHERE joint.DReportID IS NOT NULL
GROUP BY joint.Welder) AS total
-- , ,
LEFT JOIN (SELECT COUNT(joint.JOT_ID) AS JointNum1, SUM(joint.RT_FilmNum) AS totalfilm,
joint.Welder
FROM dbo.View_JointWelder joint
WHERE joint.PointType='点口' AND joint.RT_FilmNum IS NOT NULL and joint.RT_FilmNum>0 and (select COUNT(*) from dbo.HJGL_BO_QualityRating a
left join HJGL_CH_TrustItem b on a.CH_TrustItemID=b.CH_TrustItemID
left join HJGL_CH_Trust c on b.CH_TrustID=c.CH_TrustID where a.JOT_ID=joint.JOT_ID and FilmNum is not null and c.CH_NDTMethod='20d2cbca-8b3d-434b-b1c1-181796986fa5')>0
AND joint.dreportid IS NOT NULL
GROUP BY joint.Welder) AS JointNum1
ON JointNum1.Welder = total.Welder
--
LEFT JOIN (SELECT COUNT(distinct joint.JOT_ID) AS JointNoPassNum1,
joint.Welder
FROM dbo.HJGL_CH_RepairItemRecord rr
left join dbo.View_JointWelder joint on rr.JOT_ID=joint.JOT_ID
WHERE joint.PointType='点口' and rr.NDT_ID='20d2cbca-8b3d-434b-b1c1-181796986fa5'
--AND (joint.RT1_RepairFilm IS NOT NULL or (select top 1 CH_TrustItemID from dbo.HJGL_CH_TrustItem ti where ti.JOT_ID=joint.JOT_ID and ti.States='4') is not null)
AND joint.dreportid IS NOT NULL and rr.RepairMark='R1'
GROUP BY joint.Welder) AS JointNoPassNum1
ON JointNoPassNum1.Welder = total.Welder
--
LEFT JOIN (SELECT count(rr.RepairItemRecordId) as JointNoPassFilmNum2,
joint.Welder
FROM dbo.HJGL_CH_RepairItemRecord rr
left join dbo.View_JointWelder joint on rr.JOT_ID=joint.JOT_ID
WHERE joint.PointType='点口' and rr.NDT_ID='20d2cbca-8b3d-434b-b1c1-181796986fa5'
--AND (joint.RT1_RepairFilm IS NOT NULL or (select top 1 CH_TrustItemID from dbo.HJGL_CH_TrustItem ti where ti.JOT_ID=joint.JOT_ID and ti.States='4') is not null)
AND joint.dreportid IS NOT NULL and rr.RepairMark='R1'
GROUP BY joint.Welder) AS JointNoPassNum2
ON JointNoPassNum2.Welder = total.Welder
--,
LEFT JOIN (SELECT COUNT(joint.JOT_ID) AS RepairJoint2, SUM(ISNULL(joint.RT2_RepairFilmNum,0)) AS RepairFilm2,
joint.Welder
FROM dbo.View_JointWelder joint
WHERE joint.PointType='点口' AND joint.RT2_RepairFilm IS NOT NULL
AND joint.dreportid IS NOT NULL
GROUP BY joint.Welder) AS RepairJoint2
ON RepairJoint2.Welder = total.Welder
--,
LEFT JOIN (SELECT COUNT(joint.JOT_ID) AS RepairJoint3, SUM(ISNULL(joint.RT3_RepairFilmNum,0)) AS RepairFilm3,
joint.Welder
FROM dbo.View_JointWelder joint
WHERE joint.PointType='点口' AND joint.RT3_RepairFilm IS NOT NULL
AND joint.dreportid IS NOT NULL
GROUP BY joint.Welder) AS RepairJoint3
ON RepairJoint3.Welder = total.Welder
LEFT JOIN dbo.HJGL_BS_Welder wld ON wld.WED_ID=total.Welder
LEFT JOIN dbo.Base_Unit unit on unit.UnitId=wld.WED_Unit) v
where v.JointFilmPassRate>0 and v.JointFilmPassRate<0.965
GO

View File

@ -14,7 +14,7 @@
<Items>
<f:Grid ID="Grid1" Title="管线焊口信息" ShowHeader="false" EnableCollapse="true" PageSize="20"
BoxFlex="1" ShowBorder="true" AllowPaging="true" IsDatabasePaging="true" runat="server"
EnableColumnLines="true" SortField="JOT_JointNo" SortDirection="ASC" OnSort="Grid1_Sort"
EnableColumnLines="true" SortField="JOTY_Group,Sort1,Sort2,Sort3,Sort4,Sort5" SortDirection="ASC" OnSort="Grid1_Sort"
DataKeyNames="JOT_ID" DataIDField="JOT_ID" OnPageIndexChange="Grid1_PageIndexChange"
AllowFilters="true" OnFilterChange="Grid1_FilterChange" AllowSorting="true">
<Toolbars>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />