年份月份转日期错误修复

parent 52f3aa57
......@@ -74,31 +74,6 @@
Post请求地址
</summary>
</member>
<member name="P:Performance.DtoModels.AprAmount.PersonnelNumber">
<summary>
人员工号
</summary>
</member>
<member name="P:Performance.DtoModels.AprAmount.DoctorName">
<summary>
医生姓名
</summary>
</member>
<member name="P:Performance.DtoModels.AprAmount.PerforType">
<summary>
</summary>
</member>
<member name="P:Performance.DtoModels.AprAmount.Amount">
<summary>
金额
</summary>
</member>
<member name="P:Performance.DtoModels.AprAmount.Remark">
<summary>
备注
</summary>
</member>
<member name="M:Performance.DtoModels.CustomValidator.IsMobile(System.String)">
<summary>
判断输入的字符串是否是一个合法的手机号
......
......@@ -2,6 +2,7 @@
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using OfficeOpenXml;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using OfficeOpenXml.Style;
using Performance.DtoModels;
using Performance.EntityModels;
......@@ -205,9 +206,9 @@ public ApiResponse BatchCallIn(int allotId, int hospitalId, SaveCollectData requ
var newAttendanceVacatione = JsonHelper.Deserialize<List<per_attendance>>(jsons);
var oldCallinAttendance = perforPerAttendanceRepository.GetEntities(t => t.AllotId == allotId && t.HospitalId == hospitalId);
var per_allot = perforPerallotRepository.GetEntities(t => t.ID == allotId && t.HospitalId == hospitalId).FirstOrDefault();
var allot = perforPerallotRepository.GetEntities(t => t.ID == allotId && t.HospitalId == hospitalId).FirstOrDefault();
if (per_allot == null) return new ApiResponse(ResponseType.Error, "无绩效数据");
if (allot == null) return new ApiResponse(ResponseType.Error, "无绩效数据");
var cofaccounting = cofaccountingRepository.GetEntities(ca => ca.AllotId == allotId);
......@@ -236,7 +237,9 @@ public ApiResponse BatchCallIn(int allotId, int hospitalId, SaveCollectData requ
{ "错误原因", "“关键信息缺失”请补全或删除" },
});
}
DateTime dt = new DateTime(per_allot.Year, per_allot.Month, 1).AddMonths(1);
if (allot.Month >= 1 && allot.Month <= 12)
{
DateTime dt = new DateTime(allot.Year, allot.Month, 1).AddMonths(1);
if (newAttendanceVacatione[i].CallInDate > dt)
{
error.Add(new Dictionary<string, string>
......@@ -251,6 +254,7 @@ public ApiResponse BatchCallIn(int allotId, int hospitalId, SaveCollectData requ
{ "错误原因", $"调入时间不在当前绩效月份范围内,已超出{SplitEveryDay(dt.AddDays(-1),newAttendanceVacatione[i].CallInDate.Value).Count-1}天"},
});
}
}
if (newAttendanceVacatione[i].CallInUnitType != cofaccounting.FirstOrDefault(t => t.AccountingUnit == newAttendanceVacatione[i].CallInAccountingUnit)?.UnitType)
{
......@@ -496,7 +500,7 @@ public ApiResponse AttendanceBatch(int allotId, int hospitalId, SaveCollectData
var per_employee = perforPeremployeeRepository.GetEntities(t => t.AllotId == allotId && t.HospitalId == hospitalId);
List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
var per_allot = perforPerallotRepository.GetEntities(t => t.ID == allotId && t.HospitalId == hospitalId).FirstOrDefault();
var allot = perforPerallotRepository.GetEntities(t => t.ID == allotId && t.HospitalId == hospitalId).FirstOrDefault();
for (int i = 0; i < newAttendanceVacatione.Count; i++)
{
......@@ -563,10 +567,11 @@ public ApiResponse AttendanceBatch(int allotId, int hospitalId, SaveCollectData
{ "来源", "“粘贴数据”与“历史数据”比对" },
{ "错误原因", $"原名“{oldEmp.PersonnelName}”,工号相同但姓名不同,请删除“历史数据”中该员工" },
});
}
DateTime dt = new DateTime(per_allot.Year, per_allot.Month, 1).AddMonths(1);
if (allot.Month >= 1 && allot.Month <= 12)
{
DateTime dt = new DateTime(allot.Year, allot.Month, 1).AddMonths(1);
if (newAttendanceVacatione[i].BegDate >= dt && newAttendanceVacatione[i].EndDate > dt)
{
error.Add(new Dictionary<string, string>
......@@ -581,6 +586,7 @@ public ApiResponse AttendanceBatch(int allotId, int hospitalId, SaveCollectData
{ "错误原因", $"考勤时间不在该绩效月份内,已超出{SplitEveryDay(dt.AddDays(-1),newAttendanceVacatione[i].EndDate.Value).Count-1}天" },
});
}
}
if (newAttendanceVacatione[i].BegDate > newAttendanceVacatione[i].EndDate)
{
error.Add(new Dictionary<string, string>
......@@ -779,7 +785,7 @@ private List<DateTime> SplitEveryDay(DateTime begin, DateTime end)
public string ExcelDownload(List<Dictionary<string, object>> rows, string name, int allotId, List<ExcelDownloadHeads> headList)
{
var perAllot = perforPerallotRepository.GetEntity(t => t.ID == allotId);
string title = $"{ perAllot.Year}{perAllot.Month}{name}";
string title = $"{perAllot.Year}{perAllot.Month}{name}";
var data = new List<Dictionary<string, object>>();
foreach (var obj in rows)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment