提交代码

This commit is contained in:
高飞 2025-04-08 14:13:18 +08:00
parent c8d7d0652a
commit 1d7450c522
7 changed files with 135 additions and 3 deletions

View File

@ -0,0 +1,132 @@
ALTER PROC [dbo].[HJGL_sp_rpt_welderPerformance]
@unitcode VARCHAR(50) = NULL,
@steel VARCHAR(50) = NULL,
@WED_ID NVARCHAR(50) = NULL,
@date1 DATETIME = NULL,
@date2 DATETIME = NULL,
@projectId NVARCHAR(500) = NULL,
@installationId NVARCHAR(50)=NULL
AS
/*焊工业绩分析*/
SELECT
NEWID() AS Id,
total.ProjectId,
project.ProjectCode,--
total.Welder,
wld.wed_code,-- 焊工代码
wld.wed_name,--
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(JointNoPassNum1.JointNoPassFilmNum1,0)) AS totalPassfilm, --
ISNULL(JointNoPassNum1.JointNoPassFilmNum1,0) AS repairFilm1, --
ISNULL(RepairJoint2.repairFilm2,0) AS repairFilm2, --
ISNULL(RepairJoint3.repairFilm3,0) AS repairFilm3, --
CAST((CASE (ISNULL(JointNum1.totalfilm,0)- ISNULL(JointNoPassNum1.JointNoPassFilmNum1,0)) WHEN 0 THEN 0
ELSE (CASE(ISNULL(JointNum1.totalfilm,0)) WHEN 0 THEN 0
ELSE 1.0 * (ISNULL(JointNum1.totalfilm,0)- ISNULL(JointNoPassNum1.JointNoPassFilmNum1,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.ProjectId,joint.InstallationId,joint.BSU_ID,joint.Welder
FROM View_JointWelder joint
LEFT JOIN HJGL_BO_WeldReportMain report ON joint.DReportID = report.DReportID
WHERE joint.DReportID IS NOT NULL
AND (report.JOT_WeldDate >= @date1 OR @date1 IS NULL) AND (report.JOT_WeldDate <= @date2 OR @date2 IS NULL)
AND (joint.ste_id=@steel OR @steel IS NULL)
GROUP BY joint.ProjectId,joint.InstallationId,joint.BSU_ID, joint.Welder) AS total
-- , ,
LEFT JOIN (SELECT COUNT(joint.JOT_ID) AS JointNum1, SUM(joint.RT_FilmNum) AS totalfilm,
joint.ProjectId,joint.InstallationId,joint.BSU_ID,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 where JOT_ID=joint.JOT_ID and FilmNum is not null)>0
AND (joint.ste_id=@steel OR @steel IS NULL) AND joint.dreportid IS NOT NULL
AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_BO_QualityRating WHERE JOT_ID=joint.JOT_ID)>= @date1 OR @date1 IS NULL)
AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_BO_QualityRating WHERE JOT_ID=joint.JOT_ID)<= @date2 OR @date2 IS NULL)
GROUP BY joint.ProjectId,joint.InstallationId,joint.BSU_ID, joint.Welder) AS JointNum1
ON JointNum1.ProjectId=total.ProjectId AND JointNum1.InstallationId = total.InstallationId
AND JointNum1.BSU_ID = total.BSU_ID AND JointNum1.Welder = total.Welder
--
LEFT JOIN (SELECT COUNT(distinct joint.JOT_ID) AS JointNoPassNum1,count(rr.RepairItemRecordId) as JointNoPassFilmNum1,
joint.ProjectId,joint.InstallationId,joint.BSU_ID,joint.Welder
FROM dbo.View_JointWelder joint
left join dbo.HJGL_CH_RepairItemRecord rr on rr.JOT_ID=joint.JOT_ID
WHERE joint.PointType='点口' 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.ste_id=@steel OR @steel IS NULL) AND joint.dreportid IS NOT NULL and rr.RepairMark='R1'
AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_CH_RepairItemRecord WHERE JOT_ID=joint.JOT_ID AND RepairMark='R1')>= @date1 OR @date1 IS NULL)
AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_CH_RepairItemRecord WHERE JOT_ID=joint.JOT_ID AND RepairMark='R1')<= @date2 OR @date2 IS NULL)
GROUP BY joint.ProjectId,joint.InstallationId,joint.BSU_ID, joint.Welder) AS JointNoPassNum1
ON JointNoPassNum1.ProjectId=total.ProjectId AND JointNoPassNum1.InstallationId = total.InstallationId
AND JointNoPassNum1.BSU_ID = total.BSU_ID AND JointNoPassNum1.Welder = total.Welder
--,
LEFT JOIN (SELECT COUNT(joint.JOT_ID) AS RepairJoint2, SUM(ISNULL(joint.RT2_RepairFilmNum,0)) AS RepairFilm2,
joint.ProjectId,joint.InstallationId,joint.BSU_ID,joint.Welder
FROM dbo.View_JointWelder joint
WHERE joint.PointType='点口' AND joint.RT2_RepairFilm IS NOT NULL
AND (joint.ste_id=@steel OR @steel IS NULL) AND joint.dreportid IS NOT NULL
AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_CH_RepairItemRecord WHERE JOT_ID=joint.JOT_ID AND RepairMark='R2')>= @date1 OR @date1 IS NULL)
AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_CH_RepairItemRecord WHERE JOT_ID=joint.JOT_ID AND RepairMark='R2')<= @date2 OR @date2 IS NULL)
GROUP BY joint.ProjectId,joint.InstallationId,joint.BSU_ID, joint.Welder) AS RepairJoint2
ON RepairJoint2.ProjectId=total.ProjectId AND RepairJoint2.InstallationId = total.InstallationId
AND RepairJoint2.BSU_ID = total.BSU_ID AND RepairJoint2.Welder = total.Welder
--,
LEFT JOIN (SELECT COUNT(joint.JOT_ID) AS RepairJoint3, SUM(ISNULL(joint.RT3_RepairFilmNum,0)) AS RepairFilm3,
joint.ProjectId,joint.InstallationId,joint.BSU_ID,joint.Welder
FROM dbo.View_JointWelder joint
WHERE joint.PointType='点口' AND joint.RT3_RepairFilm IS NOT NULL
AND (joint.ste_id=@steel OR @steel IS NULL) AND joint.dreportid IS NOT NULL
AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_CH_RepairItemRecord WHERE JOT_ID=joint.JOT_ID AND RepairMark='R3')>= @date1 OR @date1 IS NULL)
AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_CH_RepairItemRecord WHERE JOT_ID=joint.JOT_ID AND RepairMark='R3')<= @date2 OR @date2 IS NULL)
GROUP BY joint.ProjectId,joint.InstallationId,joint.BSU_ID, joint.Welder) AS RepairJoint3
ON RepairJoint3.ProjectId=total.ProjectId AND RepairJoint3.InstallationId = total.InstallationId
AND RepairJoint3.BSU_ID = total.BSU_ID AND RepairJoint3.Welder = total.Welder
LEFT JOIN Base_Project project ON total.ProjectId=project.ProjectId
LEFT JOIN dbo.HJGL_BS_Welder wld ON wld.WED_ID=total.Welder
WHERE
(CHARINDEX(total.ProjectId,@projectId)>0 OR @projectId IS NULL)
AND (total.InstallationId = @installationId OR @installationId IS NULL)
AND (wld.WED_Unit=@unitcode OR @unitcode IS NULL)
AND (total.Welder = @WED_ID OR @WED_ID IS NULL)
GO

Binary file not shown.

View File

@ -2,7 +2,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<UseIISExpress>true</UseIISExpress>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />

View File

@ -50,7 +50,7 @@
<add path="ChartImg.axd" verb="GET,POST,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
<add path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport"/>
</httpHandlers>
<compilation debug="false" targetFramework="4.6.1">
<compilation debug="true" targetFramework="4.6.1">
<assemblies>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>

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>Release|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />