This commit is contained in:
gozareshgir
2026-01-19 13:42:37 +03:30
7 changed files with 182 additions and 70 deletions

View File

@@ -0,0 +1,75 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.Checkout.Dto;
public class RotatingShiftOfCheckoutDto
{
/// <summary>
/// نام پرسنل
/// </summary>
public string FullName { get; set; }
/// <summary>
/// وضعیت نوبتکاری
/// </summary>
public string RotatingShiftStatus { get; set; }
/// <summary>
/// آیا نوبت کاری دارد
/// </summary>
public bool HasRotatingShift { get; set; }
/// <summary>
/// سال و ماه
/// </summary>
public string YearAndMonth { get; set; }
/// <summary>
/// نوع ساعت کاری
/// </summary>
public string TypeOfWorkingHours { get; set; }
/// <summary>
/// لیست نوبت کاری
/// </summary>
public List<RotatingShiftListDto> RotatingShiftList { get; set; }
}
public class RotatingShiftListDto
{
/// <summary>
/// بازه کاری صبح
/// </summary>
public string MorningShiftSpan { get; set; }
/// <summary>
/// بازه کاری عصر
/// </summary>
public string EveningShiftSpan { get; set; }
/// <summary>
/// بازه کاری شب
/// </summary>
public string NightShiftSpan { get; set; }
/// <summary>
/// آیا صبح کاری داشته
/// </summary>
public bool IsMorningShift { get; set; }
/// <summary>
/// آیا عصرکاری داشته
/// </summary>
public bool IsEveningShift { get; set; }
/// <summary>
/// آیا شبکاری داشته
/// </summary>
public bool IsNightShift { get; set; }
/// <summary>
/// تاریخ شیفت
/// </summary>
public string ShiftDate { get; set; }
}

View File

@@ -69,8 +69,20 @@ public interface ICheckoutApplication
#region ForApi
/// <summary>
/// دریافت لیست فیش های حقوقی ادمین
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
Task<PagedResult<CheckoutDto>> GetList(CheckoutSearchModelDto searchModel);
/// <summary>
/// دریافت نوبتکاری
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<RotatingShiftOfCheckoutDto> GetRotatingShiftApi(long id);
#endregion
}

View File

@@ -1,29 +1,34 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
using Company.Domain.CheckoutAgg;
using Company.Domain.CheckoutAgg.ValueObjects;
using Company.Domain.LeftWorkAgg;
using Company.Domain.YearlySalaryAgg;
using Company.Domain.EmployeeAgg;
using Company.Domain.empolyerAgg;
using Company.Domain.LeaveAgg;
using Company.Domain.LeftWorkAgg;
using Company.Domain.RollCallAgg;
using Company.Domain.WorkingHoursTempAgg;
using Company.Domain.WorkshopAgg;
using Company.Domain.YearlySalaryAgg;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.PersonalContractingParty;
using CompanyManagment.App.Contracts.Checkout.Dto;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.HolidayItem;
using CompanyManagment.App.Contracts.Leave;
using CompanyManagment.App.Contracts.MandantoryHours;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
using Company.Domain.EmployeeAgg;
using CompanyManagment.App.Contracts.HolidayItem;
using CompanyManagment.App.Contracts.PersonalContractingParty;
using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.WorkingHoursTemp;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.EFCore.Migrations;
using CompanyManagment.EFCore.Repository;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Company.Domain.LeaveAgg;
using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.Checkout.Dto;
using System.Linq;
using System.Threading.Tasks;
namespace CompanyManagment.Application;
@@ -39,11 +44,14 @@ public class CheckoutApplication : ICheckoutApplication
private readonly IRollCallMandatoryRepository _rollCallMandatoryRepository;
private readonly IRollCallRepository _rollCallRepository;
private readonly IHolidayItemApplication _holidayItemApplication;
private readonly IWorkingHoursTempRepository _workingHoursTempRepository;
private readonly IWorkshopRepository _workshopRepository;
public CheckoutApplication(ICheckoutRepository checkoutRepository, IYearlySalaryRepository yearlySalaryRepository,
public CheckoutApplication(ICheckoutRepository checkoutRepository, IYearlySalaryRepository yearlySalaryRepository,
ILeftWorkRepository leftWorkRepository,
IEmployerRepository employerRepository, IPersonalContractingPartyApp contractingPartyApp, ILeaveApplication leaveApplication, IMandatoryHoursApplication mandatoryHoursApplication, IRollCallMandatoryRepository rollCallMandatoryRepository, IRollCallRepository rollCallRepository, IHolidayItemApplication holidayItemApplication)
IEmployerRepository employerRepository, IPersonalContractingPartyApp contractingPartyApp, ILeaveApplication leaveApplication, IMandatoryHoursApplication mandatoryHoursApplication, IRollCallMandatoryRepository rollCallMandatoryRepository, IRollCallRepository rollCallRepository, IHolidayItemApplication holidayItemApplication, IWorkingHoursTempRepository workingHoursTempRepository, IWorkshopRepository workshopRepository)
{
_checkoutRepository = checkoutRepository;
_yearlySalaryRepository = yearlySalaryRepository;
@@ -55,7 +63,9 @@ public class CheckoutApplication : ICheckoutApplication
_rollCallMandatoryRepository = rollCallMandatoryRepository;
_rollCallRepository = rollCallRepository;
_holidayItemApplication = holidayItemApplication;
}
_workingHoursTempRepository = workingHoursTempRepository;
_workshopRepository = workshopRepository;
}
[SuppressMessage("ReSharper.DPA", "DPA0007: Large number of DB records", MessageId = "count: 241")]
public void Create(CreateCheckout command)
@@ -726,5 +736,47 @@ public class CheckoutApplication : ICheckoutApplication
return await _checkoutRepository.GetList(searchModel);
}
public async Task<RotatingShiftOfCheckoutDto> GetRotatingShiftApi(long id)
{
var result = new ComputingViewModel();
var checkout = GetDetails(id);
var workingHours = _workingHoursTempRepository.GetByContractIdConvertToShiftwork4(checkout.ContractId);
var typeOfWorkingHours = "";
if (checkout.HasRollCall)
{
result = await _rollCallMandatoryRepository.RotatingShiftReport(checkout.WorkshopId, checkout.EmployeeId, checkout.ContractStartGr, checkout.ContractEndGr, workingHours.ShiftWork, true, workingHours, false);
typeOfWorkingHours = "دارای حضورغیاب";
}
else
{
var workshop = _workshopRepository.GetDetails(checkout.WorkshopId);
result = await _rollCallMandatoryRepository.RotatingShiftReport(checkout.WorkshopId, checkout.EmployeeId, checkout.ContractStartGr, checkout.ContractEndGr, workingHours.ShiftWork, false, workingHours, workshop.WorkshopHolidayWorking);
typeOfWorkingHours = "بدون حضورغیاب";
}
var items = result.RotatingResultList.Select(x => new RotatingShiftListDto()
{
MorningShiftSpan = x.MorningString,
EveningShiftSpan = x.EveningString,
NightShiftSpan = x.NightString,
IsMorningShift = x.IsMorningShift,
IsEveningShift = x.IsEveningShift,
IsNightShift = x.IsNightShift,
ShiftDate = x.RotatingDate
}).ToList();
return new RotatingShiftOfCheckoutDto()
{
FullName = checkout.EmployeeFullName,
YearAndMonth = $"{checkout.Month} {checkout.Year}",
HasRotatingShift = result.RotatingStatus != "نوبت کاری ندارد",
RotatingShiftStatus = result.RotatingStatus,
TypeOfWorkingHours = typeOfWorkingHours,
RotatingShiftList = items
};
}
#endregion
}

View File

@@ -1524,7 +1524,8 @@ public class InsuranceListApplication : IInsuranceListApplication
var dateOfBirth = employeeData.DateOfBirthGr.ToFarsi();
var dateOfIssue = employeeData.DateOfIssueGr.ToFarsi();
var leftDate = employeeData.LeftWorkDateGr != null ? employeeData.LeftWorkDateGr.Value.AddDays(-1) : new DateTime();
var workingDays = Tools.GetEmployeeInsuranceWorkingDays(employeeData.StartWorkDateGr, leftDate, startDateGr, endDateGr, employeeData.EmployeeId);
var workingDays = Tools.GetEmployeeInsuranceWorkingDays(employeeData.StartWorkDateGr, leftDate, startDateGr, endDateGr, employeeData.EmployeeId);
var leftWorkFa = workingDays.hasLeftWorkInMonth ? employeeData.LeftWorkDateGr.ToFarsi() : "";
var startWorkFa = employeeData.StartWorkDateGr.ToFarsi();
var workshop = _workShopRepository.GetDetails(workshopId);
@@ -1606,7 +1607,7 @@ public class InsuranceListApplication : IInsuranceListApplication
MaritalStatus = employeeData.MaritalStatus,
StartMonthCurrent = startMonthFa,
WorkingDays = workingDays.countWorkingDays,
WorkingDays = employeeData.WorkingDays,
StartWorkDate = startWorkFa,
StartWorkDateGr = employeeData.StartWorkDateGr,
LeftWorkDate = leftWorkFa,

View File

@@ -2827,48 +2827,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
.Select(x => x.WorkshopId);
//var checkouts =
// _context.CheckoutSet.Include(w => w.CheckoutWarningMessageList).Where(x => workshopAcounts.Contains(x.WorkshopId))
// .Join(_context.Workshops.AsSplitQuery(),
// ch => ch.WorkshopId,
// workshop => workshop.id,
// (ch, workshop) => new { ch, workshop })
// .GroupJoin(_context.EmployeeComputeOptionsSet.AsSplitQuery(),
// x => x.workshop.id,
// option => option.WorkshopId,
// (x, options) => new { x.ch, x.workshop, options })
// .SelectMany(
// x => x.options.DefaultIfEmpty(),
// (x, option) => new { x.ch, x.workshop, option })
// .GroupJoin(_context.WorkshopEmployers.AsSplitQuery().Include(we => we.Employer),
// result => result.workshop.id,
// workshopEmployer => workshopEmployer.WorkshopId,
// (result, workshopEmployer) => new { result.ch, result.workshop, result.option, workshopEmployer })
// .SelectMany(
// y => y.workshopEmployer.DefaultIfEmpty(),
// (y, workshopEmployer) => new { y.option, y.ch, y.workshop, workshopEmployer })
// .Select(res => new
// {
// res.ch,
// res.workshop,
// option = _context.EmployeeComputeOptionsSet.FirstOrDefault(x => x.WorkshopId == res.ch.WorkshopId && x.EmployeeId == res.ch.EmployeeId),
// res.workshopEmployer,
// contractingParty = _context.PersonalContractingParties
// .Include(p => p.Employers)
// .FirstOrDefault(p => p.Employers.Any(e => e.id == res.workshopEmployer.Employer.id))
// });
//var checkoutss =
// _context.CheckoutSet.Include(w => w.CheckoutWarningMessageList).Where(x => workshopAcounts.Contains(x.WorkshopId))
// .Join(_context.Workshops.AsSplitQuery(),
// ch => ch.WorkshopId,
// workshop => workshop.id,
// (ch, workshop) => new { ch, workshop })
// .Select(res => new
// {
// res.ch,
// res.workshop,
// });
var watch = new Stopwatch();
watch.Start();
var checkouts =
@@ -2876,12 +2835,6 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
from workshop in _context.Workshops.Where(x => workshopAccounts.Contains(x.id))
join x in _context.CheckoutSet
on workshop.id equals x.WorkshopId
//.Include(x=>x.CheckoutWarningMessageList)
//join workshop in _context.Workshops
// on ch.WorkshopId equals workshop.id
select new
{
Id = x.id,
@@ -2910,6 +2863,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
.ThenBy(x => x.PersonnelCode).AsNoTracking();
Console.WriteLine("getList======================= : " + watch.Elapsed);
#region SercheModel
if (!string.IsNullOrWhiteSpace(searchModel.ContractNo))

View File

@@ -1604,9 +1604,14 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
bool workshopHolidyWorking)
{
var rollCallList = new List<RollCallViewModel>();
#region Entities
if (string.IsNullOrWhiteSpace(command.ContarctStart) || string.IsNullOrWhiteSpace(command.ContractEnd))
{
command.ContarctStart = command.ContractStartGr.ToFarsi();
command.ContractEnd = command.ContractEndGr.ToFarsi();
}
var sdate = command.ContarctStart.ToEnglishNumber();
var edate = command.ContractEnd.ToEnglishNumber();
var syear = Convert.ToInt32(sdate.Substring(0, 4));

View File

@@ -21,10 +21,23 @@ public class CheckoutController : AdminBaseController
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
[HttpGet("GetList")]
[HttpGet]
public async Task<ActionResult<PagedResult<CheckoutDto>>> GetList(CheckoutSearchModelDto searchModel)
{
return await _checkoutApplication.GetList(searchModel);
}
/// <summary>
/// دریافت نوبت کاری
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("RotatingShift")]
public async Task<RotatingShiftOfCheckoutDto> GetRotatingShift(long id)
{
var result =await _checkoutApplication.GetRotatingShiftApi(id);
return result;
}
}