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
2bc83756
Commit
2bc83756
authored
May 06, 2024
by
wyc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
考勤上报和加载上月(bug修复)
parent
200beeee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
14 deletions
+37
-14
performance/Performance.Services/AttendanceService.cs
+4
-6
performance/Performance.Services/CopyService.cs
+33
-8
No files found.
performance/Performance.Services/AttendanceService.cs
View file @
2bc83756
...
...
@@ -2429,7 +2429,7 @@ public void DeptReportRefresh(per_allot allot, int state, List<per_attendance_de
attendances
??=
new
List
<
per_attendance_dept
>();
var
types
=
perfoPperAttendanceTypeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
)
??
new
List
<
per_attendance_type
>();
Func
<
int
?,
string
>
getAattendanceType
=
(
typeId
)
=>
typeId
>
0
?
types
.
FirstOrDefault
(
w
=>
w
.
Id
==
typeId
)?.
AttendanceName
??
"考勤类型缺失"
:
""
;
List
<
AttendanceDeptMore
>
datas
=
attendances
.
Select
(
w
=>
new
AttendanceDeptMore
List
<
AttendanceDeptMore
>
datas
=
attendances
.
Where
(
w
=>
w
.
State
==
state
).
Select
(
w
=>
new
AttendanceDeptMore
{
AllotId
=
allot
.
ID
,
Code
=
w
.
Code
,
...
...
@@ -2498,14 +2498,12 @@ public void DeptReportRefresh(per_allot allot, int state, List<per_attendance_de
CreateTime
=
DateTime
.
Now
,
};
});
var
unitTypes
=
attendances
.
Select
(
w
=>
w
.
UnitType
).
Distinct
().
ToList
();
var
accountingUnits
=
attendances
.
Select
(
w
=>
w
.
AccountingUnit
).
Distinct
().
ToList
();
var
oldEntities
=
_perforPerAttendanceDeptReportRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allot
.
ID
&&
unitTypes
.
Contains
(
w
.
UnitType
)
&&
accountingUnits
.
Contains
(
w
.
AccountingUnit
));
if
(
oldEntities
?.
Any
()
==
true
)
var
oldEntities
=
_perforPerAttendanceDeptReportRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allot
.
ID
).
ToList
();
if
(
oldEntities
.
Any
())
{
_perforPerAttendanceDeptReportRepository
.
RemoveRange
(
oldEntities
.
ToArray
());
}
if
(
state
==
(
int
)
Attendance
.
Report
.
通过
&&
newEntities
?.
Any
()
==
true
)
if
(
state
==
(
int
)
Attendance
.
Report
.
通过
&&
newEntities
.
Any
()
)
{
_perforPerAttendanceDeptReportRepository
.
AddRange
(
newEntities
.
ToArray
());
}
...
...
performance/Performance.Services/CopyService.cs
View file @
2bc83756
...
...
@@ -2,11 +2,13 @@
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.EntityModels.Entity
;
using
Performance.EntityModels.Other
;
using
Performance.Repository
;
using
Performance.Repository.Repository
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Reflection
;
namespace
Performance.Services
{
...
...
@@ -325,11 +327,12 @@ public void Copy_AttendanceType(per_allot allot, int prevAllotId)
var
prevAttTypes
=
attendanceTypes
.
Where
(
w
=>
w
.
AllotId
==
prevAllotId
).
ToList
();
if
(!
prevAttTypes
.
Any
())
return
;
//
删除当月的考勤类型
var
del
AttTypes
=
attendanceTypes
.
Where
(
w
=>
w
.
AllotId
==
allot
.
ID
).
ToList
();
if
(
del
AttTypes
.
Any
())
//
修改当月的考勤类型,加载上月完成在删除
var
updata
AttTypes
=
attendanceTypes
.
Where
(
w
=>
w
.
AllotId
==
allot
.
ID
).
ToList
();
if
(
updata
AttTypes
.
Any
())
{
_pperAttendanceTypeRepository
.
RemoveRange
(
delAttTypes
.
ToArray
());
updataAttTypes
.
ForEach
(
w
=>
w
.
AllotId
=
0
);
_pperAttendanceTypeRepository
.
UpdateRange
(
updataAttTypes
.
ToArray
());
}
//插入上月的考勤类型
var
newAttTypes
=
prevAttTypes
.
Select
(
t
=>
new
per_attendance_type
...
...
@@ -349,12 +352,32 @@ public void Copy_AttendanceType(per_allot allot, int prevAllotId)
var
prevPerEmployee
=
_perforPeremployeeRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
prevAllotId
);
if
(!
prevPerEmployee
.
Any
())
return
;
// 删除当月的考勤上报
var
delAttDepts
=
_perforPerAttendanceDeptRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allot
.
ID
).
ToList
();
if
(
delAttDepts
.
Any
())
var
attendance_Types
=
_pperAttendanceTypeRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
0
).
ToList
();
// 修改当月的考勤上报
var
updataAttDepts
=
_perforPerAttendanceDeptRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allot
.
ID
).
ToList
();
if
(
updataAttDepts
.
Any
())
{
_perforPerAttendanceDeptRepository
.
RemoveRange
(
delAttDepts
.
ToArray
());
foreach
(
var
att
in
updataAttDepts
)
{
for
(
int
day
=
1
;
day
<=
31
;
day
++)
{
string
dayPropertyName
=
$"Day
{
day
:
00
}
"
;
PropertyInfo
dayProperty
=
typeof
(
per_attendance_dept
).
GetProperty
(
dayPropertyName
);
if
(
dayProperty
!=
null
)
{
int
?
dayValue
=
(
int
?)
dayProperty
.
GetValue
(
att
);
var
oldDayPropertyName
=
attendance_Types
.
FirstOrDefault
(
w
=>
w
.
Id
==
dayValue
)?.
AttendanceName
??
"考勤类型缺失"
;
var
newDayPropertyName
=
newAttTypes
.
FirstOrDefault
(
w
=>
w
.
AttendanceName
==
oldDayPropertyName
)?.
Id
;
if
(
newDayPropertyName
!=
null
)
{
dayProperty
.
SetValue
(
att
,
newDayPropertyName
);
}
}
}
}
_perforPerAttendanceDeptRepository
.
UpdateRange
(
updataAttDepts
.
ToArray
());
}
//查询默认考勤类型
var
typeDefault
=
newAttTypes
.
Find
(
f
=>
f
.
IsDefault
==
(
int
)
Attendance
.
Default
.
默认
);
var
cofaccounting
=
_cofaccountingRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
prevAllotId
);
...
...
@@ -387,7 +410,9 @@ public void Copy_AttendanceType(per_allot allot, int prevAllotId)
}).
ToList
();
_perforPerAttendanceDeptRepository
.
AddRange
(
newAttDepts
.
ToArray
());
_pperAttendanceTypeRepository
.
RemoveRange
(
attendance_Types
.
ToArray
());
}
}
/// <summary>
/// 加载上月绩效考核
...
...
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