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
93cf0e94
Commit
93cf0e94
authored
Apr 09, 2024
by
wyc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
考勤上报(把保存时重复考勤的限制,改成了提交时才检查重复)
parent
845144e9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
30 deletions
+55
-30
performance/Performance.Services/AttendanceService.cs
+55
-30
No files found.
performance/Performance.Services/AttendanceService.cs
View file @
93cf0e94
...
@@ -1626,13 +1626,13 @@ public ApiResponse DeptSave(int allotId, List<AttendanceDept> datas, string unit
...
@@ -1626,13 +1626,13 @@ public ApiResponse DeptSave(int allotId, List<AttendanceDept> datas, string unit
var
employees
=
perforPeremployeeRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
allotId
);
var
employees
=
perforPeremployeeRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
allotId
);
var
perAttendanceDepts
=
_attendanceDeptRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allotId
)
??
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
attendances
=
perAttendanceDepts
?.
Where
((
w
)
=>
unitTypes
.
Contains
(
w
.
UnitType
)
&&
accountingUnit
.
Equals
(
w
.
AccountingUnit
)).
ToList
();
if
(
attendances
.
Count
>
0
&&
attendances
.
Count
==
attendances
.
Count
(
w
=>
w
.
State
==
(
int
)
Attendance
.
Report
.
通过
))
if
(
attendances
.
Count
>
0
&&
attendances
.
Count
==
attendances
.
Count
(
w
=>
w
.
State
==
(
int
)
Attendance
.
Report
.
通过
))
throw
new
PerformanceException
(
"当前考勤已审核通过,无法提交!"
);
throw
new
PerformanceException
(
"当前考勤已审核通过,无法提交!"
);
//查询是否在其他科室的考勤记录
//查询是否在其他科室的考勤记录
var
data_Numbers
=
datas
.
Select
(
w
=>
w
.
PersonnelNumber
).
ToList
();
//
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
();
//var attendanceDepts = perAttendanceDepts?.Where(w =>
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
>
newAttendanceDepts
=
new
List
<
per_attendance_dept
>();
List
<
per_attendance_dept
>
updAttendanceDepts
=
new
List
<
per_attendance_dept
>();
List
<
per_attendance_dept
>
updAttendanceDepts
=
new
List
<
per_attendance_dept
>();
...
@@ -1747,27 +1747,27 @@ public ApiResponse DeptSave(int allotId, List<AttendanceDept> datas, string unit
...
@@ -1747,27 +1747,27 @@ public ApiResponse DeptSave(int allotId, List<AttendanceDept> datas, string unit
});
});
}
}
foreach
(
var
attendanceDept
in
attendanceDepts
.
Where
(
a
=>
row
.
PersonnelNumber
.
Equals
(
a
.
PersonnelNumber
)))
//
foreach (var attendanceDept in attendanceDepts.Where(a => row.PersonnelNumber.Equals(a.PersonnelNumber)))
{
//
{
for
(
int
day
=
1
;
day
<=
31
;
day
++)
//
for (int day = 1; day <= 31; day++)
{
//
{
string
dayPropertyName
=
$"Day
{
day
:
00
}
"
;
//
string dayPropertyName = $"Day{day:00}";
var
attendanceDeptValue
=
typeof
(
per_attendance_dept
).
GetProperty
(
dayPropertyName
)?.
GetValue
(
attendanceDept
);
//
var attendanceDeptValue = typeof(per_attendance_dept).GetProperty(dayPropertyName)?.GetValue(attendanceDept);
var
dataValue
=
typeof
(
AttendanceDept
).
GetProperty
(
dayPropertyName
)?.
GetValue
(
row
);
//
var dataValue = typeof(AttendanceDept).GetProperty(dayPropertyName)?.GetValue(row);
if
(!
string
.
IsNullOrEmpty
(
attendanceDeptValue
?.
ToString
())
&&
!
string
.
IsNullOrEmpty
(
dataValue
?.
ToString
()))
//
if (!string.IsNullOrEmpty(attendanceDeptValue?.ToString()) && !string.IsNullOrEmpty(dataValue?.ToString()))
{
//
{
error
.
Add
(
new
Dictionary
<
string
,
string
>
//
error.Add(new Dictionary<string, string>
{
//
{
{
"行号"
,
$"第
{
item
.
ind
+
1
}
行"
},
//
{ "行号", $"第{item.ind + 1}行" },
{
"工号"
,
attendanceDept
.
PersonnelNumber
??
""
},
//
{ "工号", attendanceDept.PersonnelNumber ?? "" },
{
"姓名"
,
attendanceDept
.
PersonnelName
??
""
},
//
{ "姓名", attendanceDept.PersonnelName ?? "" },
{
"人员系数"
,
attendanceDept
.
PermanentStaff
?.
ToString
()
??
""
},
//
{ "人员系数", attendanceDept.PermanentStaff?.ToString() ?? "" },
{
"考勤类型"
,
""
},
//
{ "考勤类型", "" },
{
"错误原因"
,
$"
{
day
}
号存在考勤记录,所在科室为:
{
attendanceDept
.
AccountingUnit
}
,请核实后重新填写"
},
//
{ "错误原因", $"{day}号存在考勤记录,所在科室为:{attendanceDept.AccountingUnit},请核实后重新填写"},
});
//
});
}
//
}
}
//
}
}
//
}
var
accounting
=
cofaccounting
.
Find
(
p
=>
p
.
UnitType
==
unitType
&&
p
.
AccountingUnit
==
accountingUnit
);
var
accounting
=
cofaccounting
.
Find
(
p
=>
p
.
UnitType
==
unitType
&&
p
.
AccountingUnit
==
accountingUnit
);
var
attendance
=
attendances
.
Find
(
w
=>
w
.
PersonnelNumber
==
row
.
PersonnelNumber
&&
w
.
UnitType
==
unitType
.
ToString
()
&&
w
.
AccountingUnit
==
accountingUnit
);
var
attendance
=
attendances
.
Find
(
w
=>
w
.
PersonnelNumber
==
row
.
PersonnelNumber
&&
w
.
UnitType
==
unitType
.
ToString
()
&&
w
.
AccountingUnit
==
accountingUnit
);
...
@@ -1969,10 +1969,15 @@ public ApiResponse DeptSubmit(int allotId, string unitType, int userid, string u
...
@@ -1969,10 +1969,15 @@ public ApiResponse DeptSubmit(int allotId, string unitType, int userid, string u
string
queryAccountingUnit
=
userInfo
.
User
.
Department
;
string
queryAccountingUnit
=
userInfo
.
User
.
Department
;
if
(!
queryUnitTypes
.
Contains
(
unitType
))
throw
new
PerformanceException
(
"当前用户角色与“核算组别”不匹配"
);
if
(!
queryUnitTypes
.
Contains
(
unitType
))
throw
new
PerformanceException
(
"当前用户角色与“核算组别”不匹配"
);
var
attendances
=
_attendanceDeptRepository
.
GetEntities
((
w
)
=>
w
.
AllotId
==
allotId
&&
queryUnitTypes
.
Contains
(
w
.
UnitType
)
&&
queryAccountingUnit
.
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
)
=>
queryUnitTypes
.
Contains
(
w
.
UnitType
)
&&
queryAccountingUnit
.
Equals
(
w
.
AccountingUnit
)).
ToList
();
if
(!
attendances
.
Any
())
return
new
ApiResponse
(
ResponseType
.
OK
,
"暂无数据,无需提交!"
);
if
(!
attendances
.
Any
())
return
new
ApiResponse
(
ResponseType
.
OK
,
"暂无数据,无需提交!"
);
int
[]
states
=
{
(
int
)
Attendance
.
Report
.
通过
,
(
int
)
Attendance
.
Report
.
提交
};
//查询是否在其他科室的考勤记录
var
data_Numbers
=
attendances
.
Select
(
w
=>
w
.
PersonnelNumber
).
ToList
();
var
attendanceDepts
=
perAttendanceDepts
?.
Where
(
w
=>
data_Numbers
.
Contains
(
w
.
PersonnelNumber
)
&&
unitType
!=
w
.
UnitType
&&
queryAccountingUnit
!=
w
.
AccountingUnit
&&
w
.
State
.
Equals
(
states
)).
ToList
();
var
cofaccounting
=
cofaccountingRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
allotId
);
var
employees
=
perforPeremployeeRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
allotId
);
var
employees
=
perforPeremployeeRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
allotId
);
var
types
=
perfoPperAttendanceTypeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allotId
)
??
new
List
<
per_attendance_type
>();
var
types
=
perfoPperAttendanceTypeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allotId
)
??
new
List
<
per_attendance_type
>();
...
@@ -1980,7 +1985,7 @@ public ApiResponse DeptSubmit(int allotId, string unitType, int userid, string u
...
@@ -1980,7 +1985,7 @@ public ApiResponse DeptSubmit(int allotId, string unitType, int userid, string u
foreach
(
var
item
in
attendances
.
Select
((
row
,
ind
)
=>
(
row
,
ind
)))
foreach
(
var
item
in
attendances
.
Select
((
row
,
ind
)
=>
(
row
,
ind
)))
{
{
var
row
=
item
.
row
;
var
row
=
item
.
row
;
if
(
string
.
IsNullOrEmpty
(
row
.
PersonnelNumber
)
||
string
.
IsNullOrEmpty
(
row
.
PersonnelNumber
)
)
if
(
string
.
IsNullOrEmpty
(
row
.
PersonnelNumber
))
{
{
error
.
Add
(
new
Dictionary
<
string
,
string
>
error
.
Add
(
new
Dictionary
<
string
,
string
>
{
{
...
@@ -2102,13 +2107,33 @@ public ApiResponse DeptSubmit(int allotId, string unitType, int userid, string u
...
@@ -2102,13 +2107,33 @@ public ApiResponse DeptSubmit(int allotId, string unitType, int userid, string u
continue
;
continue
;
}
}
foreach
(
var
attendanceDept
in
attendanceDepts
.
Where
(
a
=>
row
.
PersonnelNumber
.
Equals
(
a
.
PersonnelNumber
)))
{
for
(
int
day
=
1
;
day
<=
31
;
day
++)
{
string
dayPropertyName
=
$"Day
{
day
:
00
}
"
;
var
attendanceDeptValue
=
typeof
(
per_attendance_dept
).
GetProperty
(
dayPropertyName
)?.
GetValue
(
attendanceDept
);
var
dataValue
=
typeof
(
AttendanceDept
).
GetProperty
(
dayPropertyName
)?.
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
()
??
""
},
{
"考勤类型"
,
""
},
{
"错误原因"
,
$"
{
day
}
号已提交考勤记录,所在科室为:
{
attendanceDept
.
AccountingUnit
}
,请勿重复提交"
},
});
}
}
}
}
}
if
(
error
.
Count
>
0
)
if
(
error
.
Count
>
0
)
return
new
ApiResponse
(
ResponseType
.
WarningTable
,
"验证不通过,当前操作已拒绝"
,
error
);
return
new
ApiResponse
(
ResponseType
.
WarningTable
,
"验证不通过,当前操作已拒绝"
,
error
);
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
.
通过
))
if
(
attendances
.
Count
()
>
0
&&
attendances
.
Count
()
==
attendances
.
Count
(
w
=>
w
.
State
==
(
int
)
Attendance
.
Report
.
通过
))
throw
new
PerformanceException
(
"当前考勤已审核通过,无法提交!"
);
throw
new
PerformanceException
(
"当前考勤已审核通过,无法提交!"
);
var
submitTime
=
DateTime
.
Now
;
var
submitTime
=
DateTime
.
Now
;
...
...
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