From Master
This commit is contained in:
@@ -45,4 +45,5 @@ public interface ILeftWorkRepository : IRepository<long, LeftWork>
|
||||
#endregion
|
||||
|
||||
Task<LeftWork> GetLastLeftWork(long employeeId, long workshopId);
|
||||
List<LeftWorkViewModel> SearchCreateContract(LeftWorkSearchModel searchModel);
|
||||
}
|
||||
@@ -16,6 +16,9 @@ public interface ILeftWorkApplication
|
||||
EditLeftWork GetDetails(long id);
|
||||
LeftWorkViewModel CheckoutleftWorkCheck(DateTime contractStart, long workshopId, long employeeId);
|
||||
List<LeftWorkViewModel> search(LeftWorkSearchModel searchModel);
|
||||
|
||||
|
||||
List<LeftWorkViewModel> SearchCreateContract(LeftWorkSearchModel searchModel);
|
||||
Task<List<LeftWorkViewModel>> searchAsync(LeftWorkSearchModel searchModel);
|
||||
string StartWork(long employeeId, long workshopId, string leftWork);
|
||||
OperationResult RemoveLeftWork(long id);
|
||||
|
||||
@@ -211,6 +211,14 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
return _leftWorkRepository.search(searchModel);
|
||||
}
|
||||
|
||||
public List<LeftWorkViewModel> SearchCreateContract(LeftWorkSearchModel searchModel)
|
||||
{
|
||||
|
||||
return _leftWorkRepository.SearchCreateContract(searchModel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<List<LeftWorkViewModel>> searchAsync(LeftWorkSearchModel searchModel)
|
||||
{
|
||||
var res = search(searchModel);
|
||||
|
||||
@@ -1150,19 +1150,28 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
var orderedRollcalls = x.OrderBy(y => y.ShiftDate).ToList();
|
||||
|
||||
var rollCallTimeSpanPerDay =
|
||||
new TimeSpan(x.Where(y => y.EndDate != null).Sum(y => (y.ShiftEndWithoutRest - y.StartDate)!.Value.Ticks));
|
||||
new TimeSpan(x.Where(y => y.EndDate != null).Sum(y => y.ShiftEndWithoutRest == null ? (y.EndDate - y.StartDate).Value!.Ticks : (y.ShiftEndWithoutRest - y.StartDate)!.Value.Ticks));
|
||||
var breakTimePerDay = new TimeSpan(x.Sum(r => r.BreakTimeSpan.Ticks));
|
||||
|
||||
var firstRollCall = orderedRollcalls.FirstOrDefault();
|
||||
var secondRollCall = orderedRollcalls.Skip(1).FirstOrDefault();
|
||||
DateTime? secondRCEndDate = null;
|
||||
DateTime? firstRCEndDate = null;
|
||||
|
||||
if (firstRollCall != null)
|
||||
firstRCEndDate = firstRollCall.ShiftEndWithoutRest ?? firstRollCall.EndDate;
|
||||
if (secondRollCall != null)
|
||||
secondRCEndDate = secondRollCall.ShiftEndWithoutRest ?? secondRollCall.EndDate;
|
||||
|
||||
|
||||
|
||||
return new CheckoutDailyRollCallViewModel()
|
||||
{
|
||||
StartDate1 = firstRollCall?.StartDate?.ToString("HH:mm") ?? "",
|
||||
EndDate1 = firstRollCall?.ShiftEndWithoutRest?.ToString("HH:mm") ?? "",
|
||||
EndDate1 =firstRCEndDate?.ToString("HH:mm") ?? "",
|
||||
|
||||
StartDate2 = secondRollCall?.StartDate?.ToString("HH:mm") ?? "",
|
||||
EndDate2 = secondRollCall?.ShiftEndWithoutRest?.ToString("HH:mm") ?? "",
|
||||
EndDate2 = secondRCEndDate?.ToString("HH:mm") ?? "",
|
||||
|
||||
TotalhourseSpan = rollCallTimeSpanPerDay,
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ public class LeftWorkRepository : RepositoryBase<long, LeftWork>, ILeftWorkRepos
|
||||
}
|
||||
|
||||
|
||||
|
||||
_context.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
@@ -649,6 +649,38 @@ public class LeftWorkRepository : RepositoryBase<long, LeftWork>, ILeftWorkRepos
|
||||
return leftWork;
|
||||
}
|
||||
|
||||
public List<LeftWorkViewModel> SearchCreateContract(LeftWorkSearchModel searchModel)
|
||||
{
|
||||
var vipGroup = _context.CustomizeWorkshopEmployeeSettings.Where(x => x.CustomizeWorkshopGroupSettingId == 117)
|
||||
.Select(x => x.EmployeeId).ToList();
|
||||
var query = _context.LeftWorkList.Select(x => new LeftWorkViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
LeftWorkDate = x.LeftWorkDate.ToFarsi(),
|
||||
StartWorkDate = x.StartWorkDate.ToFarsi(),
|
||||
LeftWorkDateGr = x.LeftWorkDate,
|
||||
StartWorkDateGr = x.StartWorkDate,
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
WorkshopName = x.WorkshopName,
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
AddBonusesPay = x.AddBonusesPay,
|
||||
AddYearsPay = x.AddYearsPay,
|
||||
AddLeavePay = x.AddLeavePay,
|
||||
JobId = x.JobId,
|
||||
JobName = _context.Jobs.FirstOrDefault(j => j.id == x.JobId).JobName
|
||||
|
||||
|
||||
}).Where(x=> !vipGroup.Contains(x.EmployeeId));
|
||||
if (searchModel.WorkshopId != 0 && searchModel.EmployeeId != 0)
|
||||
query = query.Where(x => x.WorkshopId == searchModel.WorkshopId && x.EmployeeId == searchModel.EmployeeId);
|
||||
if (searchModel.EmployeeId != 0 && searchModel.WorkshopId == 0)
|
||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||
if (searchModel.WorkshopId != 0 && searchModel.EmployeeId == 0)
|
||||
query = query.Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||
return query.OrderByDescending(x => x.StartWorkDateGr).ToList();
|
||||
}
|
||||
|
||||
private bool HasActiveRollCallStatus(long workshopId, long employeeId)
|
||||
{
|
||||
var now = DateTime.Today;
|
||||
|
||||
@@ -109,7 +109,7 @@ public class AutoExtensionModel : PageModel
|
||||
{
|
||||
WorkshopId = id
|
||||
};
|
||||
var LeftWorkList = _leftWorkApplication.search(LeftWorkSerchModel);
|
||||
var LeftWorkList = _leftWorkApplication.SearchCreateContract(LeftWorkSerchModel);
|
||||
var personnelCodeSearch = new PersonnelCodeSearchModel
|
||||
{
|
||||
WorkshopId = id
|
||||
|
||||
Reference in New Issue
Block a user