Commit 5787d30b by wyc

'考勤下发' 新增\修改调动记录 条件

parent 4d617ba9
......@@ -365,6 +365,10 @@ public ApiResponse AttendanceAdd(int allotId, AttendanceData request)
var allot = perforPerallotRepository.GetEntity(w => w.ID == allotId);
if (allot == null)
throw new PerformanceException("当前绩效记录不存在");
var cofaccounting = cofaccountingRepository.GetEntities(ca => ca.AllotId == allotId);
if (!cofaccounting.Any(t => t.AccountingUnit == request.CallInAccountingUnit && t.UnitType == request.CallInUnitType))
throw new PerformanceException("当前“核算组别与核算单元”无法对应,请检查后重试!");
var data = mapper.Map<per_attendance>(request);
data.AllotId = allotId;
data.HospitalId = allot.HospitalId;
......@@ -382,8 +386,8 @@ public ApiResponse AttendanceAdd(int allotId, AttendanceData request)
{
data.CallInDate = new DateTime(allot.Year, allot.Month, 1);
}
perforPerAttendanceRepository.Add(data);
return new ApiResponse(ResponseType.OK);
}
......@@ -394,6 +398,11 @@ public ApiResponse AttendanceUpdate(int allotId, AttendanceUpdateData request)
throw new PerformanceException("当前绩效记录不存在");
var data = perforPerAttendanceRepository.GetEntity(w => w.Id == request.AttendanceId && w.AllotId == allotId);
if (data == null) throw new PerformanceException("当前调动记录不存在");
var cofaccounting = cofaccountingRepository.GetEntities(ca => ca.AllotId == allotId);
if (!cofaccounting.Any(t => t.AccountingUnit == request.CallInAccountingUnit && t.UnitType == request.CallInUnitType))
throw new PerformanceException("当前“核算组别与核算单元”无法对应,请检查后重试!");
data.PermanentStaff = request.PermanentStaff;
data.CallInUnitType = request.CallInUnitType;
data.CallInAccountingUnit = request.CallInAccountingUnit;
......
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