Task Changes And ReportRepository bug fixed

This commit is contained in:
SamSys
2024-10-05 19:27:04 +03:30
parent e226bed5ed
commit d0f69ea27c
80 changed files with 6136 additions and 4326 deletions

View File

@@ -92,7 +92,7 @@ public class ReportRepository : IReportRepository
#endregion
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId) && e.AccountIdList.Count > 0);
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId) && e.AccountIdList.Count > 0).AsSplitQuery();
var workshopsList = workshops.Select(x => new ActiveWorkshops
{
@@ -114,12 +114,12 @@ public class ReportRepository : IReportRepository
CheckoutLeftIds = _context.InstitutionContractSet.Any(c => c.ContractingPartyId == x.ContractingPartId && c.ContractStartGr <= currentMonthStart && c.ContractEndGr >= currentMonthEnd) ? x.CheckoutLeftIds : new List<long>(),
#endregion
});
}).AsSplitQuery();
//var wCount = workshops.Count();
//var partyId = workshops.Select(x => x.ContractingPartId).ToList();
Console.WriteLine("Ripo query 1 >>>>>: " + watch.Elapsed);
var res = workshopsList.ToList();
var res = workshopsList.AsEnumerable();
watch.Restart();
var result = res.Select(x => new ActiveWorkshops
{
@@ -162,7 +162,7 @@ public class ReportRepository : IReportRepository
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd))
: 0,
});
}).AsEnumerable();
Console.WriteLine("Ripo query 2 >>>>>: " + watch.Elapsed);
var contractAccountResult = result.Select(x => new ActiveWorkshops()
@@ -182,7 +182,7 @@ public class ReportRepository : IReportRepository
IsActiveString = x.IsActiveString,
WorkshopFullName = x.WorkshopFullName,
}).Where(x => x.AccountId != 0).ToList();
}).Where(x => x.AccountId != 0 && x.ContractLeftWorkCount > 0).ToList();
var checkoutAccountResult = result.Select(x => new ActiveWorkshops()
{
Id = x.Id,
@@ -201,7 +201,7 @@ public class ReportRepository : IReportRepository
IsActiveString = x.IsActiveString,
WorkshopFullName = x.WorkshopFullName,
}).Where(x => x.AccountId != 0).ToList();
}).Where(x => x.AccountId != 0 && x.CheckoutLeftWorkCount > 0).ToList();
watch.Restart();
//قرارداد هایی که باید اسجاد می شد
var contractToBe = contractAccountResult.Sum(x => x.ContractLeftWorkCount);
@@ -226,7 +226,7 @@ public class ReportRepository : IReportRepository
AccountId = x.Key,
AccountFullName = _accountContext.Accounts.FirstOrDefault(a=>a.id == x.Key)!.Fullname,
ContractDonePercent = (x.Sum(c => c.ContrctDoneCount) * 100) / x.Sum(c => c.ContractLeftWorkCount),
ContractDonePercent = (x.Sum(c => c.ContrctDoneCount) * 100) / (x.Sum(c => c.ContractLeftWorkCount)),
ContractSignPercent = x.Sum(c => c.ContrctDoneCount) > 0 ? (x.Sum(c => c.ContrctSignDoneCount) * 100) / (x.Sum(c => c.ContrctDoneCount)) : 0,
@@ -354,7 +354,7 @@ public class ReportRepository : IReportRepository
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
.Where(a => a.AccountIdList.Contains(accountId));
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
var workshopsList = workshops.Select(x => new ActiveWorkshops
{
@@ -488,7 +488,7 @@ public class ReportRepository : IReportRepository
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
.Where(a => a.AccountIdList.Contains(accountId));
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
var workshopsList = workshops.Select(x => new ActiveWorkshops
{
Id = x.Id,
@@ -628,7 +628,7 @@ public class ReportRepository : IReportRepository
#endregion
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
.Where(a => a.AccountIdList.Contains(accountId));
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
var workshopsList = workshops.Select(x => new ActiveWorkshops
{
Id = x.Id,
@@ -761,7 +761,7 @@ public class ReportRepository : IReportRepository
#endregion
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
.Where(a => a.AccountIdList.Contains(accountId));
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
var workshopsList = workshops.Select(x => new ActiveWorkshops
{
Id = x.Id,
@@ -1087,7 +1087,7 @@ public class ReportRepository : IReportRepository
(l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd)).Select(l => l.EmployeeId).ToList(),
#endregion
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
.Where(a => a.AccountIdList.Contains(accountId));
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
var workshopsList = workshops.Select(x => new ActiveWorkshops
{
Id = x.Id,
@@ -1221,7 +1221,7 @@ public class ReportRepository : IReportRepository
#endregion
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
.Where(a => a.AccountIdList.Contains(accountId));
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
var workshopsList = workshops.Select(x => new ActiveWorkshops
{
Id = x.Id,
@@ -1363,7 +1363,7 @@ public class ReportRepository : IReportRepository
#endregion
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
.Where(a => a.AccountIdList.Contains(accountId));
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
var workshopsList = workshops.Select(x => new ActiveWorkshops
{
Id = x.Id,
@@ -1493,7 +1493,7 @@ public class ReportRepository : IReportRepository
#endregion
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
.Where(a => a.AccountIdList.Contains(accountId));
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
var workshopsList = workshops.Select(x => new ActiveWorkshops
{
Id = x.Id,