Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
6f643fea
Commit
6f643fea
authored
Dec 07, 2023
by
wyc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
考勤上报(加载默认考勤类型)加载上月(加载上报内容赋默认值)
parent
835ebb17
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
207 additions
and
86 deletions
+207
-86
performance/Performance.Api/Controllers/AttendanceController.cs
+15
-2
performance/Performance.Api/wwwroot/Performance.Api.xml
+6
-1
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+16
-6
performance/Performance.DtoModels/Enum.cs
+6
-1
performance/Performance.EntityModels/Entity/per_attendance_dept.cs
+1
-1
performance/Performance.EntityModels/Entity/per_attendance_type.cs
+5
-1
performance/Performance.EntityModels/Other/view_attendance.cs
+6
-6
performance/Performance.Repository/PerforReportRepository .cs
+17
-1
performance/Performance.Services/AttendanceService.cs
+75
-32
performance/Performance.Services/ConfigService.cs
+1
-1
performance/Performance.Services/CopyService.cs
+59
-34
No files found.
performance/Performance.Api/Controllers/AttendanceController.cs
View file @
6f643fea
...
...
@@ -2,6 +2,7 @@
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Security.Claims
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.StaticFiles
;
...
...
@@ -21,7 +22,7 @@ namespace Performance.Api.Controllers
public
class
AttendanceController
:
ControllerBase
{
private
readonly
AttendanceService
_attendanceService
;
private
ClaimService
claim
;
private
readonly
ClaimService
claim
;
public
AttendanceController
(
AttendanceService
attendanceService
,
ClaimService
claim
)
...
...
@@ -179,6 +180,19 @@ public ApiResponse DeleteAttendanceType(int id)
// 删除前需要验证当前类型是否被使用,如果被使用则禁止删除
return
_attendanceService
.
DeleteAttendanceType
(
id
);
}
/// <summary>
/// 加载默认考勤类型
/// </summary>
/// <returns></returns>
[
HttpPost
(
"Type/Replenishment"
)]
public
ApiResponse
AttendanceReplenishment
([
FromQuery
]
int
allotId
)
{
var
userid
=
claim
.
GetUserId
();
return
_attendanceService
.
GetAttendanceReplenishment
(
allotId
,
userid
);
}
#
endregion
#
region
考勤记录
...
...
@@ -660,7 +674,6 @@ public ApiResponse DeptSave(int allotId, string unitType, [FromBody] List<Attend
/// <param name="unitType">核算组别</param>
/// <param name="accountingUnit">核算单元</param>
/// <param name="searchTxet">工号/姓名</param>
/// <param name="datas"></param>
/// <returns></returns>
[
HttpPost
]
[
Route
(
"dept/compute"
)]
...
...
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
6f643fea
...
...
@@ -611,6 +611,12 @@
<param
name=
"id"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.AttendanceReplenishment(System.Int32)"
>
<summary>
加载默认考勤类型
</summary>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.GetAttendanceVacationHandsonTable(System.Int32)"
>
<summary>
返回HandsonTable格式考勤记录
...
...
@@ -787,7 +793,6 @@
<param
name=
"unitType"
>
核算组别
</param>
<param
name=
"accountingUnit"
>
核算单元
</param>
<param
name=
"searchTxet"
>
工号/姓名
</param>
<param
name=
"datas"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AttendanceController.DownloadDeptCompute(System.Int32,System.String,System.String,System.String)"
>
...
...
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
6f643fea
...
...
@@ -4953,7 +4953,7 @@
</member>
<member
name=
"P:Performance.EntityModels.im_accountbasic.Drg"
>
<summary>
DRG绩效
DRG绩效
</summary>
</member>
<member
name=
"T:Performance.EntityModels.im_data"
>
...
...
@@ -6293,7 +6293,7 @@
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept.State"
>
<summary>
状态(未提交 =
0,提交 = 1,通过 = 2,驳回 = 3)
状态(未提交 =
1,提交 =2,通过 = 3,驳回 = 4)
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_dept.SubmitUser"
>
...
...
@@ -6503,7 +6503,12 @@
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_type.IsDeduction"
>
<summary>
是否核减出勤 1 核减 2 不核减
是否核减出勤 0 不核减 1 核减
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Entity.per_attendance_type.IsDefault"
>
<summary>
是否默认值 0 非默认 1 默认
</summary>
</member>
<member
name=
"T:Performance.EntityModels.per_apr_amount"
>
...
...
@@ -9128,7 +9133,7 @@
</member>
<member
name=
"P:Performance.EntityModels.res_account.Drg"
>
<summary>
DRG绩效
DRG绩效
</summary>
</member>
<member
name=
"T:Performance.EntityModels.res_baiscnorm"
>
...
...
@@ -9553,7 +9558,7 @@
</member>
<member
name=
"P:Performance.EntityModels.res_specialunit.Drg"
>
<summary>
DRG绩效
DRG绩效
</summary>
</member>
<member
name=
"T:Performance.EntityModels.sys_extract"
>
...
...
@@ -10448,7 +10453,12 @@
</member>
<member
name=
"P:Performance.EntityModels.Other.AttendanceType.IsDeduction"
>
<summary>
是否核减出勤 1 核减 2 不核减
是否核减出勤 0 不核减 1 核减
</summary>
</member>
<member
name=
"P:Performance.EntityModels.Other.AttendanceType.IsDefault"
>
<summary>
是否默认值 0 非默认 1 默认
</summary>
</member>
<member
name=
"P:Performance.EntityModels.HisData.HisDepartment"
>
...
...
performance/Performance.DtoModels/Enum.cs
View file @
6f643fea
...
...
@@ -123,8 +123,13 @@ public enum Type
}
public
enum
Deduction
{
核减
=
1
,
不核减
=
0
,
核减
=
1
,
}
public
enum
Default
{
非默认
=
0
,
默认
=
1
,
}
public
enum
State
{
...
...
performance/Performance.EntityModels/Entity/per_attendance_dept.cs
View file @
6f643fea
...
...
@@ -54,7 +54,7 @@ public class per_attendance_dept
public
string
AccountingUnit
{
get
;
set
;
}
/// <summary>
/// 状态(未提交 =
0,提交 = 1,通过 = 2,驳回 = 3)
/// 状态(未提交 =
1,提交 =2,通过 = 3,驳回 = 4)
/// </summary>
public
int
State
{
get
;
set
;
}
...
...
performance/Performance.EntityModels/Entity/per_attendance_type.cs
View file @
6f643fea
...
...
@@ -12,8 +12,12 @@ public class per_attendance_type
public
int
AllotId
{
get
;
set
;
}
//绩效Id
public
string
AttendanceName
{
get
;
set
;
}
//考勤类型名称
/// <summary>
/// 是否核减出勤
1 核减 2 不
核减
/// 是否核减出勤
0 不核减 1
核减
/// </summary>
public
int
IsDeduction
{
get
;
set
;
}
/// <summary>
/// 是否默认值 0 非默认 1 默认
/// </summary>
public
int
IsDefault
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Other/view_attendance.cs
View file @
6f643fea
...
...
@@ -78,12 +78,12 @@ public class AttendanceType
/// </summary>
public
string
AttendanceName
{
get
;
set
;
}
/// <summary>
/// 是否核减出勤
1 核减 2 不
核减
/// 是否核减出勤
0 不核减 1
核减
/// </summary>
public
string
IsDeduction
{
get
;
set
;
}
public
int
IsDeduction
{
get
;
set
;
}
/// <summary>
/// 是否默认值 0 非默认 1 默认
/// </summary>
public
int
IsDefault
{
get
;
set
;
}
}
}
performance/Performance.Repository/PerforReportRepository .cs
View file @
6f643fea
...
...
@@ -389,7 +389,23 @@ public List<PerReport> NurseAvg(ReportRequest request)
/// <returns></returns>
public
List
<
EmployeeReservedDto
>
GetEmployeeReserved
(
ReservedRequest
request
)
{
string
view
=
request
.
Source
==
1
?
"view_allot_result_report_emp"
:
request
.
Source
==
2
?
"view_allot_result_report_issue_source"
:
request
.
Source
==
3
?
"view_allot_result_report"
:
""
;
string
view
=
""
;
switch
(
request
.
Source
)
{
case
1
:
view
=
"view_allot_result_report_emp"
;
break
;
case
2
:
view
=
"view_allot_result_report_issue_source"
;
break
;
case
3
:
view
=
"view_allot_result_report"
;
break
;
default
:
break
;
}
string
sql
=
$"SELECT * FROM
{
view
}
WHERE HospitalID=@HospitalID AND Year=@Year"
;
return
DapperQuery
<
EmployeeReservedDto
>(
sql
,
new
{
HospitalID
=
request
.
HospitalId
,
Year
=
request
.
Year
},
commandTimeout
:
60
*
10
)?.
ToList
();
...
...
performance/Performance.Services/AttendanceService.cs
View file @
6f643fea
...
...
@@ -39,8 +39,7 @@ public class AttendanceService : IAutoInjection
private
readonly
PerforCofaccountingRepository
cofaccountingRepository
;
private
readonly
PerforPerAttendanceDeptRepository
_attendanceDeptRepository
;
private
readonly
PerforPerAttendanceDeptReportRepository
_perforPerAttendanceDeptReportRepository
;
private
readonly
RoleService
roleService
;
private
readonly
UserService
userService
;
private
readonly
PerforPerAttendanceDeptRepository
_perforPerAttendanceDeptRepository
;
public
AttendanceService
(
IMapper
mapper
,
ILogger
<
AttendanceService
>
logger
,
...
...
@@ -56,8 +55,7 @@ public class AttendanceService : IAutoInjection
PerforCofaccountingRepository
cofaccountingRepository
,
PerforPerAttendanceDeptRepository
attendanceDeptRepository
,
PerforPerAttendanceDeptReportRepository
perforPerAttendanceDeptReportRepository
,
RoleService
roleService
,
UserService
userService
PerforPerAttendanceDeptRepository
perforPerAttendanceDeptRepository
)
{
this
.
mapper
=
mapper
;
...
...
@@ -74,8 +72,7 @@ UserService userService
this
.
cofaccountingRepository
=
cofaccountingRepository
;
_attendanceDeptRepository
=
attendanceDeptRepository
;
_perforPerAttendanceDeptReportRepository
=
perforPerAttendanceDeptReportRepository
;
this
.
roleService
=
roleService
;
this
.
userService
=
userService
;
_perforPerAttendanceDeptRepository
=
perforPerAttendanceDeptRepository
;
}
#
region
初始考勤页面
...
...
@@ -508,28 +505,38 @@ public ApiResponse AttendanceClearAll(int allotId)
public
ApiResponse
<
List
<
per_attendance_type
>>
GetAttendanceType
(
int
allotId
)
{
var
result
=
perfoPperAttendanceTypeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allotId
).
ToList
();
if
(
result
!=
null
)
return
new
ApiResponse
<
List
<
per_attendance_type
>>(
ResponseType
.
OK
,
result
);
else
{
return
new
ApiResponse
<
List
<
per_attendance_type
>>(
ResponseType
.
Fail
);
}
return
new
ApiResponse
<
List
<
per_attendance_type
>>(
ResponseType
.
OK
,
result
);
}
/// <summary>
/// 新增或修改考勤类型
/// </summary>
/// <param name="allotId"></param>
/// <param name="attendanceType"></param>
/// <returns></returns>
/// <exception cref="PerformanceException"></exception>
public
ApiResponse
<
AttendanceType
>
InsertAttendanceType
(
int
allotId
,
AttendanceType
attendanceType
)
{
var
allot
=
perforPerallotRepository
.
GetEntity
(
w
=>
w
.
ID
==
allotId
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"当前绩效记录不存在"
);
var
allot
=
perforPerallotRepository
.
GetEntity
(
w
=>
w
.
ID
==
allotId
)
??
throw
new
PerformanceException
(
"当前绩效记录不存在"
);
if
(
attendanceType
.
IsDefault
==
(
int
)
Attendance
.
Default
.
默认
)
{
var
attTypeDefault
=
perfoPperAttendanceTypeRepository
.
GetEntities
().
Find
(
f
=>
f
.
AllotId
==
allotId
&&
f
.
IsDefault
==
(
int
)
Attendance
.
Default
.
默认
);
if
(
attTypeDefault
!=
null
)
{
attTypeDefault
.
IsDefault
=
(
int
)
Attendance
.
Default
.
非默认
;
perfoPperAttendanceTypeRepository
.
Update
(
attTypeDefault
);
}
}
var
any
=
perfoPperAttendanceTypeRepository
.
GetEntities
().
FirstOrDefault
(
t
=>
t
.
Id
==
attendanceType
.
Id
);
if
(
any
!=
null
)
if
(
attendanceType
.
Id
>
0
)
{
any
.
AttendanceName
=
attendanceType
.
AttendanceName
;
any
.
IsDeduction
=
Convert
.
ToInt32
(
attendanceType
.
IsDeduction
)
;
if
(
perfoPperAttendanceTypeRepository
.
Update
(
any
))
return
new
ApiResponse
<
AttendanceType
>(
ResponseType
.
OK
,
"修改成功"
)
;
else
return
new
ApiResponse
<
AttendanceType
>(
ResponseType
.
Fail
,
"修改失败"
)
;
var
per_Attendance_Type
=
perfoPperAttendanceTypeRepository
.
GetEntities
().
Find
(
f
=>
f
.
Id
==
attendanceType
.
Id
)
;
per_Attendance_Type
.
AttendanceName
=
attendanceType
.
AttendanceName
;
per_Attendance_Type
.
IsDeduction
=
attendanceType
.
IsDeduction
;
per_Attendance_Type
.
IsDefault
=
attendanceType
.
IsDefault
;
if
(
perfoPperAttendanceTypeRepository
.
Update
(
per_Attendance_Type
))
return
new
ApiResponse
<
AttendanceType
>(
ResponseType
.
OK
,
"修改成功"
);
else
return
new
ApiResponse
<
AttendanceType
>(
ResponseType
.
Fail
,
"修改失败"
);
}
else
{
...
...
@@ -538,29 +545,65 @@ public ApiResponse<AttendanceType> InsertAttendanceType(int allotId, AttendanceT
AllotId
=
allotId
,
HospitalId
=
allot
.
HospitalId
,
AttendanceName
=
attendanceType
.
AttendanceName
,
IsDeduction
=
Convert
.
ToInt32
(
attendanceType
.
IsDeduction
)
IsDeduction
=
attendanceType
.
IsDeduction
,
IsDefault
=
attendanceType
.
IsDefault
};
if
(
perfoPperAttendanceTypeRepository
.
Add
(
per_Attendance_Type
))
return
new
ApiResponse
<
AttendanceType
>(
ResponseType
.
OK
,
"添加成功"
);
if
(
perfoPperAttendanceTypeRepository
.
Add
(
per_Attendance_Type
))
return
new
ApiResponse
<
AttendanceType
>(
ResponseType
.
OK
,
"添加成功"
);
else
return
new
ApiResponse
<
AttendanceType
>(
ResponseType
.
Fail
,
"添加失败"
);
}
}
public
ApiResponse
DeleteAttendanceType
(
int
id
)
{
var
any
=
perfoPperAttendanceTypeRepository
.
GetEntity
(
t
=>
t
.
Id
==
id
);
if
(
any
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"没有该数据"
);
var
any
=
perfoPperAttendanceTypeRepository
.
GetEntity
(
t
=>
t
.
Id
==
id
)
??
throw
new
PerformanceException
(
"未找到该类型,请刷新后重试!!!"
);
var
use
=
perfoPperAttendanceVacationeRepository
.
GetEntity
(
t
=>
t
.
TypeId
==
any
.
Id
);
if
(
use
!=
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"该类型正在使用!"
);
if
(
use
!=
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"该类型正在使用!"
);
if
(
any
!=
null
&&
use
==
null
)
return
perfoPperAttendanceTypeRepository
.
DeleteFromQuery
(
t
=>
t
.
Id
==
id
)
>
0
?
new
ApiResponse
(
ResponseType
.
OK
,
"删除成功"
)
:
new
ApiResponse
(
ResponseType
.
Fail
,
"删除失败"
);
}
/// <summary>
/// 加载默认考勤类型
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
/// <exception cref="PerformanceException"></exception>
public
ApiResponse
GetAttendanceReplenishment
(
int
allotId
,
int
userid
)
{
var
allot
=
perforPerallotRepository
.
GetEntity
(
w
=>
w
.
ID
==
allotId
)
??
throw
new
PerformanceException
(
"当前绩效记录不存在"
);
var
typeDefault
=
perfoPperAttendanceTypeRepository
.
GetEntities
().
Find
(
f
=>
f
.
AllotId
==
allotId
&&
f
.
IsDefault
==
(
int
)
Attendance
.
Default
.
默认
)
??
throw
new
PerformanceException
(
"未设置默认类型"
);
//查询全部考勤上报内容
var
attendanceDepts
=
_perforPerAttendanceDeptRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
//当角色对应时过滤
var
userInfo
=
_userRepository
.
GetUser
(
userid
);
if
(
userInfo
?.
User
==
null
)
throw
new
NotImplementedException
(
"当前用户不存在"
);
if
(
userInfo
?.
URole
==
null
)
throw
new
NotImplementedException
(
"当前用户暂未分配角色"
);
var
unitTypes
=
UnitTypeUtil
.
GetMaps
(
userInfo
?.
URole
.
Type
??
0
);
if
(
unitTypes
?.
Any
()
==
true
)
attendanceDepts
=
attendanceDepts
.
Where
(
w
=>
w
.
AccountingUnit
==
userInfo
.
User
.
Department
&&
UnitTypeUtil
.
Is
(
w
.
UnitType
,
unitTypes
)).
ToList
();
foreach
(
var
item
in
attendanceDepts
)
{
if
(
perfoPperAttendanceTypeRepository
.
DeleteFromQuery
(
t
=>
t
.
Id
==
id
)
>
0
)
return
new
ApiResponse
(
ResponseType
.
OK
,
"删除成功"
);
else
return
new
ApiResponse
(
ResponseType
.
Fail
,
"删除失败"
);
for
(
int
i
=
1
;
i
<=
31
;
i
++)
{
int
?
dayValue
=
(
int
?)
typeof
(
per_attendance_dept
).
GetProperty
(
$"Day
{
i
:
D2
}
"
)?.
GetValue
(
item
);
if
(
dayValue
==
null
)
{
typeof
(
per_attendance_dept
).
GetProperty
(
$"Day
{
i
:
D2
}
"
)?.
SetValue
(
item
,
typeDefault
.
Id
);
}
}
}
else
return
new
ApiResponse
(
ResponseType
.
Fail
,
"删除失败"
);
_perforPerAttendanceDeptRepository
.
UpdateRange
(
attendanceDepts
.
ToArray
());
return
new
ApiResponse
(
ResponseType
.
OK
,
"加载成功"
);
}
#
endregion
#
region
考勤记录
...
...
performance/Performance.Services/ConfigService.cs
View file @
6f643fea
...
...
@@ -767,7 +767,7 @@ public void NewCopy(CopyRequest request)
{
"deptTypes"
,
(
allot
,
prevAllotId
)
=>
_copyService
.
Copy_DeptTypes
(
allot
,
prevAllotId
,
delHistotyData
:
true
)
},
{
"agains"
,
(
allot
,
prevAllotId
)
=>
_copyService
.
Copy_Agains
(
allot
,
prevAllotId
,
delHistotyData
:
true
)
},
{
"accountings"
,
(
allot
,
prevAllotId
)
=>
_copyService
.
Copy_Accountings
(
allot
,
prevAllotId
,
delHistotyData
:
true
)
},
{
"attendanceType"
,
(
allot
,
prevAllotId
)
=>
_copyService
.
Copy_AttendanceType
(
allot
,
prevAllotId
,
delHistotyData
:
true
)
},
{
"attendanceType"
,
(
allot
,
prevAllotId
)
=>
_copyService
.
Copy_AttendanceType
(
allot
,
prevAllotId
)
},
{
"assessType"
,
(
allot
,
prevAllotId
)
=>
_copyService
.
Copy_AssessType
(
allot
,
prevAllotId
,
delHistotyData
:
true
)
},
{
"department"
,
(
allot
,
prevAllotId
)
=>
_copyService
.
Copy_DeptDic
(
allot
,
prevAllotId
,
delHistotyData
:
true
)
},
{
"deptdetail"
,
(
allot
,
prevAllotId
)
=>
_copyService
.
Copy_Deptdetail
(
allot
,
prevAllotId
,
delHistotyData
:
true
)
},
...
...
performance/Performance.Services/CopyService.cs
View file @
6f643fea
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
AngleSharp.Dom.Events
;
using
Microsoft.CodeAnalysis.CSharp.Syntax
;
using
Microsoft.Extensions.Logging
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
...
...
@@ -308,54 +311,76 @@ public void Copy_Empdetail(per_allot allot, int prevAllotId, bool delHistotyData
}
}
}
public
void
Copy_AttendanceType
(
per_allot
allot
,
int
prevAllotId
,
bool
delHistotyData
=
false
)
/// <summary>
/// 加载上月(考勤类型 --- 考勤上报详情)
/// </summary>
/// <param name="allot">当前绩效</param>
/// <param name="prevAllotId">上月绩效Id</param>
public
void
Copy_AttendanceType
(
per_allot
allot
,
int
prevAllotId
)
{
var
flag
=
delHistotyData
;
_logger
.
LogInformation
(
$"copy attendanceType"
);
var
UpdateattendanceTypes
=
_pperAttendanceTypeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
if
(
delHistotyData
&&
UpdateattendanceTypes
!=
null
&&
UpdateattendanceTypes
.
Any
())
UpdateattendanceTypes
.
ForEach
(
t
=>
t
.
AllotId
=
0
);
flag
=
_pperAttendanceTypeRepository
.
UpdateRange
(
UpdateattendanceTypes
.
ToArray
());
var
attendanceTypes
=
_pperAttendanceTypeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
if
(
flag
||
attendanceTypes
==
null
||
!
attendanceTypes
.
Any
())
var
attendanceTypes
=
_pperAttendanceTypeRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
prevAllotId
||
g
.
AllotId
==
allot
.
ID
)
??
new
List
<
per_attendance_type
>();
//查询上月有没有类型,没有就跳过
var
prevAttTypes
=
attendanceTypes
.
Where
(
w
=>
w
.
AllotId
==
prevAllotId
).
ToList
();
if
(
prevAttTypes
.
Any
())
{
attendanceTypes
=
_pperAttendanceTypeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
prevAllotId
)
??
_pperAttendanceTypeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
-
1
);
if
(
attendanceTypes
!=
null
&&
attendanceTypes
.
Any
())
// 删除当月的考勤类型
var
delAttTypes
=
attendanceTypes
.
Where
(
w
=>
w
.
AllotId
==
allot
.
ID
).
ToList
();
if
(
delAttTypes
.
Any
())
{
var
newAttendanceTypes
=
attendanceTypes
.
Select
(
t
=>
new
per_attendance_type
{
AllotId
=
allot
.
ID
,
AttendanceName
=
t
.
AttendanceName
,
HospitalId
=
t
.
HospitalId
,
IsDeduction
=
t
.
IsDeduction
});
_pperAttendanceTypeRepository
.
AddRange
(
newAttendanceTypes
.
ToArray
());
_pperAttendanceTypeRepository
.
RemoveRange
(
delAttTypes
.
ToArray
());
}
}
var
attendanceDepts
=
_perforPerAttendanceDeptRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
var
attendanceTypess
=
_pperAttendanceTypeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
||
t
.
AllotId
==
0
);
foreach
(
var
item
in
attendanceDepts
)
{
for
(
int
i
=
1
;
i
<=
31
;
i
++)
//插入上月的考勤类型
var
newAttTypes
=
prevAttTypes
.
Select
(
t
=>
new
per_attendance_type
{
AllotId
=
allot
.
ID
,
AttendanceName
=
t
.
AttendanceName
,
HospitalId
=
t
.
HospitalId
,
IsDeduction
=
t
.
IsDeduction
,
IsDefault
=
t
.
IsDefault
,
}).
ToList
();
var
successfulType
=
_pperAttendanceTypeRepository
.
AddRange
(
newAttTypes
.
ToArray
());
if
(
successfulType
)
{
int
?
dayValue
=
(
int
?)
typeof
(
per_attendance_dept
).
GetProperty
(
"Day"
+
i
.
ToString
(
"D2"
))?.
GetValue
(
item
);
if
(
dayValue
!=
null
&&
dayValue
>
0
)
var
attendanceDepts
=
_perforPerAttendanceDeptRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
prevAllotId
||
t
.
AllotId
==
allot
.
ID
)
??
new
List
<
per_attendance_dept
>();
var
prevAttDepts
=
attendanceDepts
.
Where
(
w
=>
w
.
AllotId
==
prevAllotId
).
ToList
();
if
(
prevAttDepts
.
Any
())
{
string
attendanceName
=
attendanceTypess
.
FirstOrDefault
(
t
=>
t
.
Id
==
dayValue
)?.
AttendanceName
;
if
(!
string
.
IsNullOrEmpty
(
attendanceName
))
// 删除当月的考勤上报
var
delAttDepts
=
attendanceDepts
.
Where
(
w
=>
w
.
AllotId
==
allot
.
ID
).
ToList
();
if
(
delAttDepts
.
Any
())
{
_perforPerAttendanceDeptRepository
.
RemoveRange
(
delAttDepts
.
ToArray
());
}
var
newAttDepts
=
prevAttDepts
.
Select
(
t
=>
new
per_attendance_dept
{
HospitalId
=
t
.
HospitalId
,
AllotId
=
allot
.
ID
,
PersonnelName
=
t
.
PersonnelName
,
PersonnelNumber
=
t
.
PersonnelNumber
,
PermanentStaff
=
t
.
PermanentStaff
,
Code
=
t
.
Code
,
UnitType
=
t
.
UnitType
,
AccountingUnit
=
t
.
AccountingUnit
,
State
=
(
int
)
Attendance
.
Report
.
未提交
}).
ToList
();
//查询默认考勤类型
var
typeDefault
=
newAttTypes
.
Find
(
f
=>
f
.
IsDefault
==
(
int
)
Attendance
.
Default
.
默认
);
if
(
typeDefault
!=
null
)
{
int
?
attendanceId
=
attendanceTypess
.
FirstOrDefault
(
w
=>
w
.
AttendanceName
==
attendanceName
&&
w
.
AllotId
==
allot
.
ID
)?.
Id
;
if
(
attendanceId
!=
null
)
foreach
(
var
item
in
newAttDepts
)
{
typeof
(
per_attendance_dept
).
GetProperty
(
"Day"
+
i
.
ToString
(
"D2"
))?.
SetValue
(
item
,
attendanceId
);
for
(
int
i
=
1
;
i
<=
31
;
i
++)
{
typeof
(
per_attendance_dept
).
GetProperty
(
$"Day
{
i
:
d2
}
"
)?.
SetValue
(
item
,
typeDefault
.
Id
);
}
}
}
_perforPerAttendanceDeptRepository
.
AddRange
(
newAttDepts
.
ToArray
());
}
}
}
flag
=
_perforPerAttendanceDeptRepository
.
UpdateRange
(
attendanceDepts
.
ToArray
());
if
(
flag
)
{
attendanceTypess
=
attendanceTypess
.
Where
(
t
=>
t
.
AllotId
==
0
).
ToList
();
_pperAttendanceTypeRepository
.
RemoveRange
(
attendanceTypess
.
ToArray
());
}
}
public
void
Copy_AssessType
(
per_allot
allot
,
int
prevAllotId
,
bool
delHistotyData
=
false
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment