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
804116dd
Commit
804116dd
authored
Jul 28, 2023
by
wyc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
考勤上报保存或者提交审核时,判断其他科室是否有冲突的考勤
parent
1b6f6799
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
3 deletions
+30
-3
performance/Performance.Services/AttendanceService.cs
+30
-3
No files found.
performance/Performance.Services/AttendanceService.cs
View file @
804116dd
...
...
@@ -1569,13 +1569,16 @@ public ApiResponse DeptSave(int allotId, List<AttendanceDept> datas, string unit
var
cofaccounting
=
cofaccountingRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
allotId
);
var
employees
=
perforPeremployeeRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
allotId
);
var
attendances
=
_attendanceDeptRepository
.
GetEntities
((
w
)
=>
w
.
AllotId
==
allotId
&&
unitTypes
.
Contains
(
w
.
UnitType
)
&&
accountingUnit
.
Equals
(
w
.
AccountingUnit
))
??
new
List
<
per_attendance_dept
>();
var
perAttendanceDepts
=
_attendanceDeptRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allotId
)
??
new
List
<
per_attendance_dept
>();
var
attendances
=
perAttendanceDepts
?.
Where
((
w
)
=>
w
.
AllotId
==
allotId
&&
unitTypes
.
Contains
(
w
.
UnitType
)
&&
accountingUnit
.
Equals
(
w
.
AccountingUnit
)).
ToList
();
var
stateCount
=
attendances
.
GroupBy
(
w
=>
w
.
State
).
Select
(
w
=>
new
{
w
.
Key
,
StateCount
=
w
.
Count
()
}).
ToList
();
if
(
attendances
.
Count
()
>
0
&&
attendances
.
Count
()
==
attendances
.
Count
(
w
=>
w
.
State
==
(
int
)
Attendance
.
Report
.
通过
))
throw
new
PerformanceException
(
"当前考勤已审核通过,无法提交!"
);
//查询是否在其他科室的考勤记录
var
data_Numbers
=
datas
.
Select
(
w
=>
w
.
PersonnelNumber
).
ToList
();
var
attendanceDepts
=
perAttendanceDepts
?.
Where
(
w
=>
w
.
AllotId
==
allotId
&&
data_Numbers
.
Contains
(
w
.
PersonnelNumber
)
&&
unitType
!=
w
.
UnitType
&&
accountingUnit
!=
w
.
AccountingUnit
).
ToList
();
List
<
per_attendance_dept
>
newAttendanceDepts
=
new
List
<
per_attendance_dept
>();
List
<
per_attendance_dept
>
updAttendanceDepts
=
new
List
<
per_attendance_dept
>();
List
<
int
>
validAttendanceId
=
new
List
<
int
>();
...
...
@@ -1692,6 +1695,29 @@ public ApiResponse DeptSave(int allotId, List<AttendanceDept> datas, string unit
}
}
foreach
(
var
attendanceDept
in
attendanceDepts
)
{
if
(
row
.
PersonnelNumber
.
Equals
(
attendanceDept
.
PersonnelNumber
))
{
for
(
int
i
=
1
;
i
<=
31
;
i
++)
{
var
attendanceDeptValue
=
(
object
)
typeof
(
per_attendance_dept
).
GetProperty
(
"Day"
+
i
.
ToString
(
"D2"
))?.
GetValue
(
attendanceDept
);
var
dataValue
=
(
object
)
typeof
(
AttendanceDept
).
GetProperty
(
"Day"
+
i
.
ToString
(
"D2"
))?.
GetValue
(
row
);
if
(!
string
.
IsNullOrEmpty
(
attendanceDeptValue
?.
ToString
())
&&
!
string
.
IsNullOrEmpty
(
dataValue
?.
ToString
()))
{
error
.
Add
(
new
Dictionary
<
string
,
string
>
{
{
"行号"
,
$"第
{
item
.
ind
+
1
}
行"
},
{
"工号"
,
attendanceDept
.
PersonnelNumber
??
""
},
{
"姓名"
,
attendanceDept
.
PersonnelName
??
""
},
{
"人员系数"
,
attendanceDept
.
PermanentStaff
?.
ToString
()
??
""
},
{
"考勤类型"
,
""
},
{
"错误原因"
,
$"
{
i
.
ToString
(
"D2"
)}
号存在考勤记录,所在科室为:
{
attendanceDept
.
AccountingUnit
}
,请核实后重新填写"
},
});
}
}
}
}
var
accounting
=
cofaccounting
.
FirstOrDefault
(
p
=>
p
.
UnitType
==
unitType
&&
p
.
AccountingUnit
==
accountingUnit
);
var
attendance
=
attendances
.
FirstOrDefault
(
w
=>
w
.
PersonnelNumber
==
row
.
PersonnelNumber
&&
w
.
UnitType
==
unitType
.
ToString
()
&&
w
.
AccountingUnit
==
accountingUnit
);
...
...
@@ -1783,6 +1809,7 @@ public ApiResponse DeptSave(int allotId, List<AttendanceDept> datas, string unit
validAttendanceId
.
Add
(
attendance
.
Id
);
}
}
if
(
error
.
Count
>
0
)
return
new
ApiResponse
(
ResponseType
.
WarningTable
,
"验证不通过,当前操作已拒绝"
,
error
);
...
...
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