修改五环质量月报周报加载速度

This commit is contained in:
潘鸿锋 2024-05-07 12:39:09 +08:00
parent 735279fa00
commit 95cd7d1f2a
5 changed files with 72 additions and 20 deletions

View File

@ -0,0 +1,34 @@
--
CREATE NONCLUSTERED INDEX [QualityAudit_PersonQuality_LimitDate_Index]
ON [dbo].[QualityAudit_PersonQuality] ([LimitDate])
INCLUDE ([PersonId])
GO
CREATE NONCLUSTERED INDEX [Bo_Sheng_TrainPerson_ProjectId_DeleteTag_Index]
ON [dbo].[Bo_Sheng_TrainPerson] ([ProjectId],[DeleteTag])
INCLUDE ([ID],[DeleteUser],[DeleteDate],[EmpName],[IdentifyId],[Photo],[Station],[Category],[CategoryName],[RecordId],[SignName],[DepartId],[DepartName],[SignInDate],[SignInType],[TrainPeriod],[State],[TotalScore],[PassScore],[Score],[IsPass],[GroupNo],[ExamNo],[ExamCount],[DeviceNo],[OwnerDepartId],[UploadTime],[Answers],[CreateDate],[CreateUser],[OperDate],[OperUser])
GO
CREATE NONCLUSTERED INDEX [License_LicenseManager_ProjectId_Index]
ON [dbo].[License_LicenseManager] ([ProjectId])
INCLUDE ([LicenseManagerId],[LicenseTypeId],[LicenseManagerCode],[LicenseManageName],[UnitId],[LicenseManageContents],[CompileMan],[CompileDate],[States],[WorkAreaId],[StartDate],[EndDate],[ApplicantMan],[WorkStates],[IsHighRisk])
GO
CREATE NONCLUSTERED INDEX [GJSX_ProjectId_Index]
ON [dbo].[GJSX] ([ProjectId])
GO
CREATE NONCLUSTERED INDEX [WBS_BreakdownProject_ProjectId_IsSelected_Class_Index]
ON [dbo].[WBS_BreakdownProject] ([ProjectId],[IsSelected],[Class])
GO
CREATE NONCLUSTERED INDEX [ProcessControl_InspectionManagement_ProjectId_IsOnceQualified_Index]
ON [dbo].[ProcessControl_InspectionManagement] ([ProjectId],[IsOnceQualified])
INCLUDE ([InspectionId])
Go
CREATE NONCLUSTERED INDEX [Hazard_HazardSelectedItem_ProjectId_Index]
ON [dbo].[Hazard_HazardSelectedItem] ([ProjectId])
INCLUDE ([HazardLevel])
GO

View File

@ -1542,19 +1542,28 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
// orderby y.UnitCode // orderby y.UnitCode
// select new { x.UnitId, y.UnitName }; // select new { x.UnitId, y.UnitName };
units = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList(); units = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList();
var cqmsDetail = from c in db.View_CQMS_InspectionManagementDetail
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
from u in unitJoin.DefaultIfEmpty()
select new
{
c.CheckDate,
c.ProjectId,
u.UnitId,
u.UnitName,
c.IsOnceQualified
};
foreach (var item in units) foreach (var item in units)
{ {
var query = from c in db.View_CQMS_InspectionManagementDetail var query = from x in cqmsDetail
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitId == item.UnitId
from u in unitJoin.DefaultIfEmpty()
where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
select new select new
{ {
c.CheckDate, x.CheckDate,
c.ProjectId, x.ProjectId,
u.UnitId, x.UnitId,
u.UnitName, x.UnitName,
c.IsOnceQualified x.IsOnceQualified
}; };
var AllList = query.ToList(); var AllList = query.ToList();
var monethCount = query var monethCount = query

View File

@ -1546,19 +1546,28 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
// orderby y.UnitCode // orderby y.UnitCode
// select new { x.UnitId, y.UnitName }; // select new { x.UnitId, y.UnitName };
units = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList(); units = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList();
var cqmsDetail = from c in db.View_CQMS_InspectionManagementDetail
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
from u in unitJoin.DefaultIfEmpty()
select new
{
c.CheckDate,
c.ProjectId,
u.UnitId,
u.UnitName,
c.IsOnceQualified
};
foreach (var item in units) foreach (var item in units)
{ {
var query = from c in db.View_CQMS_InspectionManagementDetail var query = from x in cqmsDetail
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitId == item.UnitId
from u in unitJoin.DefaultIfEmpty()
where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
select new select new
{ {
c.CheckDate, x.CheckDate,
c.ProjectId, x.ProjectId,
u.UnitId, x.UnitId,
u.UnitName, x.UnitName,
c.IsOnceQualified x.IsOnceQualified
}; };
var AllList = query.ToList(); var AllList = query.ToList();
var monethCount = query var monethCount = query

View File

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

View File

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