diff --git a/Company.Domain/RollCallAgg/DomainService/IRollCallDomainService.cs b/Company.Domain/RollCallAgg/DomainService/IRollCallDomainService.cs index 6b6846e6..b4b6cfe4 100644 --- a/Company.Domain/RollCallAgg/DomainService/IRollCallDomainService.cs +++ b/Company.Domain/RollCallAgg/DomainService/IRollCallDomainService.cs @@ -209,7 +209,8 @@ public class RollCallDomainService : IRollCallDomainService var shiftDetails = GetEmployeeShiftDetails(employeeId, workshopId); - List rollCalls = GetRollCallsInShiftDate(rollCall.ShiftDate,employeeId, workshopId).GetAwaiter().GetResult(); + List rollCalls = GetRollCallsInShiftDate(rollCall.ShiftDate, employeeId, workshopId).GetAwaiter().GetResult(); + var deletedRollCall = rollCalls.FirstOrDefault(x => x.id == rollCall.id); rollCalls.Remove(deletedRollCall); @@ -255,7 +256,7 @@ public class RollCallDomainService : IRollCallDomainService var lateEntryRollCall = rollCallsInShift.OrderBy(x => x.StartDate).FirstOrDefault(x => x.StartDate > employeeShift.start); - + var previousShift = employeeShifts.OrderByDescending(x => x.start) .FirstOrDefault(x => x.end < employeeShift.start); @@ -298,6 +299,8 @@ public class RollCallDomainService : IRollCallDomainService var lateExitRollCall = rollCallsInShift.OrderBy(x => x.EndDate).FirstOrDefault(x => x.EndDate > employeeShift.end); + + // تعجیل در خروج - زود رفتن var nextShift = employeeShifts.OrderBy(x => x.start) .FirstOrDefault(x => x.start > employeeShift.end); @@ -371,8 +374,7 @@ public class RollCallDomainService : IRollCallDomainService var lateEntryRollCallRotating = rollCallsInRotatingShift.OrderBy(x => x.StartDate).FirstOrDefault(x => x.StartDate > shift.start); - - + if (earlyEntryRollCallRotating != null) { @@ -403,6 +405,7 @@ public class RollCallDomainService : IRollCallDomainService var lateExitRollCallRotating = rollCallsInRotatingShift.OrderBy(x => x.EndDate).FirstOrDefault(x => x.EndDate > shift.end); + if (earlyExitRollCallRotating != null && (rollCallsInRotatingShift.Any(x => x.StartDate < rotatingShiftEnd && x.StartDate > earlyExitRollCallRotating.EndDate) == false)) @@ -434,7 +437,7 @@ public class RollCallDomainService : IRollCallDomainService _rollCallRepository.SaveChanges(); } - private async Task> GetRollCallsInShiftDate(DateTime rollCallShiftDate,long employeeId,long workshopId) + private async Task> GetRollCallsInShiftDate(DateTime rollCallShiftDate, long employeeId, long workshopId) { return await _rollCallRepository.GetRollCallsInShiftDate(rollCallShiftDate, employeeId, workshopId); } diff --git a/Company.Domain/RollCallAgg/RollCall.cs b/Company.Domain/RollCallAgg/RollCall.cs index 4865c05b..0da53d46 100644 --- a/Company.Domain/RollCallAgg/RollCall.cs +++ b/Company.Domain/RollCallAgg/RollCall.cs @@ -515,8 +515,21 @@ namespace Company.Domain.RollCallAgg FridayWorkTimeSpan = CalculateFridayWorkDuration(StartDate.Value, EndDate.Value); } + + /// + /// جیزه + /// + public void ClearTimeDiff() + { + LateExitDuration = TimeSpan.Zero; + EarlyExitDuration = TimeSpan.Zero; + LateEntryDuration = TimeSpan.Zero; + EarlyEntryDuration = TimeSpan.Zero; + + } } + public enum RollCallModifyType { None, diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml b/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml index 59293939..500e7638 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml +++ b/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml @@ -13,19 +13,19 @@ *@ -
+@* -
+ *@
-
+@* -
+ *@ @if (ViewData["message"] != null) diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs b/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs index 8e228ac6..24fd76b3 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs +++ b/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs @@ -58,7 +58,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk public IActionResult OnPostShiftDateNew() { var startRollCall = new DateTime(2025, 2, 19); - var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall).ToList(); + var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall && x.EmployeeId == 41253).ToList(); var r1 = rollCalls.Take(3000).ToList(); Console.ForegroundColor = ConsoleColor.DarkRed; @@ -70,20 +70,20 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk return Page(); } - public IActionResult OnPostShiftDateNew2() - { - var startRollCall = new DateTime(2025, 2, 19); - var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall).ToList(); + //public IActionResult OnPostShiftDateNew2() + //{ + // var startRollCall = new DateTime(2025, 2, 19); + // var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall).ToList(); - var r2 = rollCalls.Skip(3000).ToList(); + // var r2 = rollCalls.Skip(3000).ToList(); - Console.ForegroundColor = ConsoleColor.Yellow; - Console.WriteLine("endStep 2 ============"); - SetRollCall2(r2); + // Console.ForegroundColor = ConsoleColor.Yellow; + // Console.WriteLine("endStep 2 ============"); + // SetRollCall2(r2); - ViewData["message"] = "تومام دو"; - return Page(); - } + // ViewData["message"] = "تومام دو"; + // return Page(); + //} @@ -193,6 +193,8 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk var stepSetTDRollCal = 1; foreach (var endedRollCall in endedRollCalls2) { + endedRollCall.ClearTimeDiff(); + _context.SaveChanges(); endedRollCall.SetEndDateTime(endedRollCall.EndDate.Value, _rollCallDomainService); Console.WriteLine($"{stepSetTDRollCal} - {countSetTDRollCall} ended Set Time Differences{endedRollCall.id}"); stepSetTDRollCal += 1;