Toumam changed

This commit is contained in:
SamSys
2025-03-16 22:42:47 +03:30
parent 330a663bd1
commit 961720e896
4 changed files with 39 additions and 21 deletions

View File

@@ -209,7 +209,8 @@ public class RollCallDomainService : IRollCallDomainService
var shiftDetails = GetEmployeeShiftDetails(employeeId, workshopId);
List<RollCall> rollCalls = GetRollCallsInShiftDate(rollCall.ShiftDate,employeeId, workshopId).GetAwaiter().GetResult();
List<RollCall> 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<List<RollCall>> GetRollCallsInShiftDate(DateTime rollCallShiftDate,long employeeId,long workshopId)
private async Task<List<RollCall>> GetRollCallsInShiftDate(DateTime rollCallShiftDate, long employeeId, long workshopId)
{
return await _rollCallRepository.GetRollCallsInShiftDate(rollCallShiftDate, employeeId, workshopId);
}

View File

@@ -515,8 +515,21 @@ namespace Company.Domain.RollCallAgg
FridayWorkTimeSpan = CalculateFridayWorkDuration(StartDate.Value, EndDate.Value);
}
/// <summary>
/// جیزه
/// </summary>
public void ClearTimeDiff()
{
LateExitDuration = TimeSpan.Zero;
EarlyExitDuration = TimeSpan.Zero;
LateEntryDuration = TimeSpan.Zero;
EarlyEntryDuration = TimeSpan.Zero;
}
}
public enum RollCallModifyType
{
None,

View File

@@ -13,19 +13,19 @@
<button type="submit">Upload</button>
</form> *@
<form asp-page-handler="ShiftDate" id="8" method="post">
@* <form asp-page-handler="ShiftDate" id="8" method="post">
<button type="submit">افزودن شیفت دیت</button>
</form>
</form> *@
<form asp-page-handler="ShiftDateNew" id="9" method="post">
<button type="submit">ست شیفت 1 </button>
</form>
<form asp-page-handler="ShiftDateNew2" id="10" method="post">
@* <form asp-page-handler="ShiftDateNew2" id="10" method="post">
<button type="submit">ست شیفت 2 </button>
</form>
</form> *@
@if (ViewData["message"] != null)

View File

@@ -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;