chnage GetContractAndIncluded
This commit is contained in:
@@ -1,6 +1,94 @@
|
||||
namespace CompanyManagment.App.Contracts.Checkout.Dto;
|
||||
using CompanyManagment.App.Contracts.Contract;
|
||||
using CompanyManagment.App.Contracts.EmployeeComputeOptions;
|
||||
using CompanyManagment.App.Contracts.WorkingHoursTemp;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Checkout.Dto;
|
||||
|
||||
public class GetContractAndIncludesDataToCreateDto
|
||||
{
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// آی دی کارگاه
|
||||
/// </summary>
|
||||
public long WorkshopId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// کد بایگانی کارگاه
|
||||
/// </summary>
|
||||
public string ArchiveCode { get; set; }
|
||||
|
||||
|
||||
|
||||
public List<ContractIncludedData> ContractIncludedData { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class ContractIncludedData
|
||||
{
|
||||
/// <summary>
|
||||
/// شماره قرارداد
|
||||
/// </summary>
|
||||
public string ContractNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آی دی پرسنل
|
||||
/// </summary>
|
||||
public long EmployeeId { get; set; }
|
||||
/// <summary>
|
||||
/// نام کامل پرسنل
|
||||
/// </summary>
|
||||
public string EmployeeFullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام پدر
|
||||
/// </summary>
|
||||
public string FathersName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کد ملی
|
||||
/// </summary>
|
||||
public string NationalCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ تولد
|
||||
/// </summary>
|
||||
public string DateOfBirth { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// کد پرسنلس
|
||||
/// </summary>
|
||||
public string PersonnelCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت تاهل
|
||||
/// </summary>
|
||||
|
||||
public string MaritalStatus { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ساعت کاری پرسنل
|
||||
/// </summary>
|
||||
public CreateWorkingHoursTemp WorkingHours { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// اطلاعات جداسازی تاریخ فیش
|
||||
/// </summary>
|
||||
public ContractSeparationViewModel Saparation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تنظیمات فنی پرسنل
|
||||
/// </summary>
|
||||
public EmployeeComputeOptionsViewModel EmployeeOption { get; set; }
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public interface ICheckoutApplication
|
||||
/// <param name="year"></param>
|
||||
/// <param name="month"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> CreateCheckoutApi(List<long> ids, string year, string month, long workshopId);
|
||||
Task<OperationResult<GetContractAndIncludesDataToCreateDto>> CreateCheckoutApi(List<long> ids, string year, string month, long workshopId);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -19,4 +19,6 @@ public class ContractSeparationViewModel
|
||||
public string ConsumableItems { get; set; }
|
||||
public bool checker { get; set; }
|
||||
public bool HasLeft { get; set; }
|
||||
|
||||
public long EmployeeId { get; set; }
|
||||
}
|
||||
@@ -799,7 +799,7 @@ public class CheckoutApplication : ICheckoutApplication
|
||||
}
|
||||
|
||||
|
||||
public async Task<OperationResult> CreateCheckoutApi(List<long> ids, string year, string month, long workshopId)
|
||||
public async Task<OperationResult<GetContractAndIncludesDataToCreateDto>> CreateCheckoutApi(List<long> ids, string year, string month, long workshopId)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
@@ -808,27 +808,27 @@ public class CheckoutApplication : ICheckoutApplication
|
||||
|
||||
#region Validation
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(year) && string.IsNullOrWhiteSpace(month))
|
||||
return op.Failed("ماه را انتخاب کنید");
|
||||
if (string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
||||
return op.Failed("سال را انتخاب کنید");
|
||||
//if (!string.IsNullOrWhiteSpace(year) && string.IsNullOrWhiteSpace(month))
|
||||
// return op.Failed("ماه را انتخاب کنید");
|
||||
//if (string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
||||
// return op.Failed("سال را انتخاب کنید");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(year) && string.IsNullOrWhiteSpace(month))
|
||||
{
|
||||
year = "0";
|
||||
month = "0";
|
||||
//if (string.IsNullOrWhiteSpace(year) && string.IsNullOrWhiteSpace(month))
|
||||
//{
|
||||
// year = "0";
|
||||
// month = "0";
|
||||
|
||||
var today = DateTime.Now;
|
||||
var FaToday = today.ToFarsi();
|
||||
var convertedYear = FaToday.Substring(0, 4);
|
||||
var convertedMonth = FaToday.Substring(5, 2);
|
||||
// var today = DateTime.Now;
|
||||
// var FaToday = today.ToFarsi();
|
||||
// var convertedYear = FaToday.Substring(0, 4);
|
||||
// var convertedMonth = FaToday.Substring(5, 2);
|
||||
|
||||
year = convertedYear;
|
||||
month = convertedMonth;
|
||||
}
|
||||
// year = convertedYear;
|
||||
// month = convertedMonth;
|
||||
//}
|
||||
|
||||
if (ids.Count == 0)
|
||||
return op.Failed("هیچ موردی انتخاب نشده اشت");
|
||||
//if (ids.Count == 0)
|
||||
// return op.Failed("هیچ موردی انتخاب نشده اشت");
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -841,7 +841,7 @@ public class CheckoutApplication : ICheckoutApplication
|
||||
|
||||
var getContcatsData = await
|
||||
_checkoutRepository.GetContractsAndIncludeDataDataToCreateCheckout(ids, month, workshopId);
|
||||
return op.Succcedded();
|
||||
return getContcatsData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -2922,6 +2922,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
|
||||
var result = new CreateWorkingHoursTemp
|
||||
{
|
||||
EmployeeId = getContracts.First(x=>x.id == workingHours.ContractId).EmployeeId,
|
||||
WorknigHoursId = workingHours.id,
|
||||
ShiftWork = "4",
|
||||
ShiftWorkTemp = "1",
|
||||
@@ -3271,6 +3272,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
var result = new CreateWorkingHoursTemp
|
||||
{
|
||||
EmployeeId = getContracts.First(x => x.id == workingHours.ContractId).EmployeeId,
|
||||
WorknigHoursId = workingHours.id,
|
||||
ShiftWork = workingHours.ShiftWork,
|
||||
ShiftWorkTemp = "4",
|
||||
@@ -3880,6 +3882,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
var result = new CreateWorkingHoursTemp
|
||||
{
|
||||
EmployeeId = getContracts.First(x => x.id == workingHours.ContractId).EmployeeId,
|
||||
WorknigHoursId = workingHours.id,
|
||||
ShiftWork = workingHours.ShiftWork,
|
||||
ShiftWorkTemp = "5",
|
||||
@@ -3930,7 +3933,8 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
separation.Add(new ContractSeparationViewModel()
|
||||
{
|
||||
checker = false
|
||||
checker = false,
|
||||
EmployeeId = item.EmployeeId
|
||||
});
|
||||
|
||||
}
|
||||
@@ -4001,6 +4005,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
ContractStartGr = startDate,
|
||||
ContractEndGr = endDate,
|
||||
checker = true,
|
||||
EmployeeId = item.EmployeeId
|
||||
});
|
||||
|
||||
}
|
||||
@@ -4008,7 +4013,8 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
separation.Add(new ContractSeparationViewModel()
|
||||
{
|
||||
checker = false
|
||||
checker = false,
|
||||
EmployeeId = item.EmployeeId
|
||||
});
|
||||
|
||||
}
|
||||
@@ -4092,6 +4098,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
ContractStartGr = startDate,
|
||||
ContractEndGr = endDate,
|
||||
checker = true,
|
||||
EmployeeId = item.EmployeeId
|
||||
});
|
||||
|
||||
}
|
||||
@@ -4099,7 +4106,8 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
separation.Add(new ContractSeparationViewModel()
|
||||
{
|
||||
checker = false
|
||||
checker = false,
|
||||
EmployeeId = item.EmployeeId
|
||||
});
|
||||
|
||||
}
|
||||
@@ -4109,7 +4117,8 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
|
||||
separation.Add(new ContractSeparationViewModel()
|
||||
{
|
||||
checker = false
|
||||
checker = false,
|
||||
EmployeeId = item.EmployeeId
|
||||
});
|
||||
|
||||
}
|
||||
@@ -4176,6 +4185,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
ContractEndGr = endDate,
|
||||
checker = true,
|
||||
LeftWorkDate = new DateTime(2121, 3, 21),
|
||||
EmployeeId = item.EmployeeId
|
||||
});
|
||||
|
||||
|
||||
@@ -4184,7 +4194,8 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
separation.Add(new ContractSeparationViewModel()
|
||||
{
|
||||
checker = false
|
||||
checker = false,
|
||||
EmployeeId = item.EmployeeId
|
||||
});
|
||||
|
||||
}
|
||||
@@ -4193,7 +4204,8 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
{
|
||||
separation.Add(new ContractSeparationViewModel()
|
||||
{
|
||||
checker = false
|
||||
checker = false,
|
||||
EmployeeId = item.EmployeeId
|
||||
});
|
||||
|
||||
}
|
||||
@@ -4219,17 +4231,81 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
ComputeOptions = x.ComputeOptions,
|
||||
YearsOptions = x.YearsOptions,
|
||||
BonusesOptions = x.BonusesOptions,
|
||||
|
||||
}).AsNoTracking().ToListAsync();
|
||||
|
||||
#endregion
|
||||
|
||||
var optionTime = optionTimer.Elapsed;
|
||||
optionTimer.Stop();
|
||||
|
||||
|
||||
var toListTimer = new Stopwatch();
|
||||
toListTimer.Start();
|
||||
var incloudedData = getContracts.Select(x =>
|
||||
{
|
||||
return new ContractIncludedData
|
||||
{
|
||||
ContractNo = x.ContractNo,
|
||||
|
||||
|
||||
|
||||
//اطلاعات هویتی پرسنل
|
||||
#region EmployeeData
|
||||
EmployeeId = x.EmployeeId,
|
||||
EmployeeFullName = x.Employee.FullName,
|
||||
FathersName = x.Employee.FatherName,
|
||||
NationalCode = x.Employee.NationalCode,
|
||||
DateOfBirth = x.Employee.DateOfBirth.ToFarsi(),
|
||||
PersonnelCode = $"{x.PersonnelCode}",
|
||||
MaritalStatus = x.Employee.MaritalStatus,
|
||||
#endregion
|
||||
|
||||
//ساعت کاری پرسنل
|
||||
#region WorkingHours
|
||||
WorkingHours = workingHoursList.FirstOrDefault(wh => wh.EmployeeId == x.EmployeeId),
|
||||
#endregion
|
||||
|
||||
//اطلاعات جداسازی تاریخ فیش از قرارداد
|
||||
#region Saparation
|
||||
Saparation = separation.FirstOrDefault(sep => sep.EmployeeId == x.EmployeeId),
|
||||
#endregion
|
||||
|
||||
//تنظیمات فنی پرسنل
|
||||
#region EmployeeOption
|
||||
|
||||
EmployeeOption = employeeOptions.FirstOrDefault(option=> option.EmployeeId == x.EmployeeId)
|
||||
|
||||
#endregion
|
||||
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
var finalResult = new GetContractAndIncludesDataToCreateDto()
|
||||
{
|
||||
//اطلاعات کارگاه
|
||||
#region WorkshopData
|
||||
|
||||
WorkshopId = workshop.id,
|
||||
ArchiveCode = workshop.ArchiveCode,
|
||||
WorkshopName = workshop.WorkshopName,
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
ContractIncludedData = incloudedData,
|
||||
};
|
||||
|
||||
var tolistTime = toListTimer.Elapsed;
|
||||
Console.WriteLine("GetContracts - employeeIds - workshop: " + GetContractsTime);
|
||||
Console.WriteLine("workingHours " + workingHoursTime);
|
||||
Console.WriteLine("leftWork " + leftWorkTime);
|
||||
Console.WriteLine("Separation " + SeparationTime);
|
||||
Console.WriteLine("EmployeeOptions : " + optionTimer.Elapsed);
|
||||
Console.WriteLine("===================== sum : " + (GetContractsTime + workingHoursTime + leftWorkTime + SeparationTime + optionTimer.Elapsed) + "===================");
|
||||
return op.Succcedded(new GetContractAndIncludesDataToCreateDto());
|
||||
Console.WriteLine("EmployeeOptions : " + optionTime);
|
||||
Console.WriteLine("TolistTime : " + tolistTime);
|
||||
Console.WriteLine("===================== sum : " + (GetContractsTime + workingHoursTime + leftWorkTime + SeparationTime + optionTime + tolistTime) + "===================");
|
||||
|
||||
|
||||
return op.Succcedded(finalResult);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.App.Contracts.Workshop.DTOs;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NuGet.Packaging.Signing;
|
||||
using NuGet.Protocol;
|
||||
using ServiceHost.BaseControllers;
|
||||
using WorkFlow.Application.Contracts.WorkFlow;
|
||||
|
||||
@@ -122,6 +123,8 @@ public class CheckoutController : AdminBaseController
|
||||
#region testCreate
|
||||
|
||||
var ids = result.Data.Where(x => x.CreateCheckoutStatus == CreateCheckoutStatus.ReadyToCreate).Select(x => x.Id).ToList();
|
||||
|
||||
Console.WriteLine(ids.ToJson());
|
||||
var test = await _checkoutApplication.CreateCheckoutApi(ids, year, month,workshopId);
|
||||
|
||||
#endregion
|
||||
@@ -129,6 +132,41 @@ public class CheckoutController : AdminBaseController
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<OperationResult<GetContractAndIncludesDataToCreateDto>> CreateCheckout()
|
||||
{
|
||||
var ids = new
|
||||
List<long>()
|
||||
{
|
||||
283652, 290314, 290315, 290316, 290317, 290318, 290319, 290320, 290321, 290322, 290323, 290324, 290325,
|
||||
290326, 290327, 290328, 290329, 290330, 290331, 290332, 290333, 290334, 290335, 290336, 290337, 290338,
|
||||
290339, 290340, 290341, 290342, 290343, 290344, 290345, 290346, 290347, 290348, 290349, 290350, 290351,
|
||||
290352, 290353, 290354, 290355, 290356, 290357, 290358, 290359, 290360, 290361, 290362, 290363, 290364,
|
||||
290365, 290366, 290367, 290368, 290369, 290370, 290371, 290372, 290373, 290374, 290375, 290376, 290377,
|
||||
290378, 290379, 290380, 290381, 290382, 290383, 290384, 290385, 290386, 290387, 290388, 290389, 290390,
|
||||
290391, 290392, 290393, 290394, 290395, 290396, 290397, 290398, 290399, 290400, 290401, 290402, 290403,
|
||||
290404, 290405, 290406, 290407, 290408, 290409, 290410, 290411, 290412, 290413, 290414, 290415, 290416,
|
||||
290417, 290418, 290419, 290420, 290421, 290422, 290423, 290424, 290425, 290426, 290427, 290428, 290429,
|
||||
290430, 290431, 290432, 290433, 290434, 290435, 290436, 290437, 290438, 290439, 290440, 290441, 290442,
|
||||
290443, 290444, 290445, 290446, 290447, 290448, 290449, 290450, 290451, 290452, 290453, 290454, 290455,
|
||||
290456, 290457, 290458, 290459, 290460, 290461, 290462, 290463, 290464, 290465, 290466, 290467, 290468,
|
||||
290469, 290470, 290471, 290472, 290473, 290474, 290475, 290476, 290477, 290478, 290479, 290480, 290481,
|
||||
290482, 290483, 290484, 290485, 290486, 290487, 290488, 290489, 290490, 290491, 290492, 290493, 290494,
|
||||
290495, 290496, 290497, 290498, 290499, 290500, 290501, 290502, 290503, 290504, 290505, 290506, 290507,
|
||||
290508, 290509, 290510, 290511, 290512, 290513, 290514, 290515, 290516, 290517, 290518, 290519, 290520,
|
||||
290521, 290522, 290523, 290524, 290525, 290526, 290527, 290528, 290529, 290530, 290531, 290532, 290533,
|
||||
290534, 290535, 290536, 290537, 290538, 290539, 290540, 290541, 290542, 290543, 290544, 290545, 290546,
|
||||
290547, 290548, 290549, 290550, 290551, 290552, 290553, 290554, 290555, 290556, 290557, 290558, 290559,
|
||||
290560, 290561, 290562, 290563, 290564, 290565, 290566, 290567, 290568, 290569, 290570, 290571, 290572,
|
||||
290573, 290574, 290575, 290576, 290577, 290578, 290579, 290580, 290581, 290582, 290583, 290584, 290585,
|
||||
290586, 290587, 290588
|
||||
};
|
||||
|
||||
|
||||
var test = await _checkoutApplication.CreateCheckoutApi(ids, "1404", "10", 499);
|
||||
return test;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user