|
|
@@ -1148,12 +1148,23 @@ class PersonWorkService extends Service
|
|
|
->groupBy('data_id');
|
|
|
|
|
|
// 加载员工/标准班次、日历、请假加班数据 (逻辑同前)
|
|
|
- $empWorkRanges = DB::table('employee_work_range')->whereIn('employee_id', $empIds)->where('top_depart_id', $topDepartId)->get()->groupBy('employee_id');
|
|
|
- $standardWorkRanges = DB::table('work_range_details')->where('top_depart_id', $topDepartId)->where('del_time', 0)->get();
|
|
|
- $allDays = DB::table('calendar_details')->where('month', $monthStart)->where('del_time', 0)->orderBy('time', 'asc')->get();
|
|
|
+ $empWorkRanges = DB::table('employee_work_range')
|
|
|
+ ->whereIn('employee_id', $empIds)
|
|
|
+ ->where('top_depart_id', $topDepartId)
|
|
|
+ ->get()->groupBy('employee_id');
|
|
|
+ $standardWorkRanges = DB::table('work_range_details')->where('top_depart_id', $topDepartId)
|
|
|
+ ->where('del_time', 0)->get();
|
|
|
+ $allDays = DB::table('calendar_details')->where('top_depart_id', $topDepartId)
|
|
|
+ ->where('month', $monthStart)
|
|
|
+ ->where('del_time', 0)
|
|
|
+ ->orderBy('time', 'asc')
|
|
|
+ ->get();
|
|
|
$leaveOverData = DB::table('p_leave_over_order_details as d')->join('p_leave_over_order as m', 'd.main_id', '=', 'm.id')
|
|
|
- ->whereBetween('m.order_time', [$monthStart, $monthEnd])->where('m.del_time', 0)
|
|
|
- ->select('d.*', 'm.order_time', 'm.type as main_type')->get()->groupBy(['employee_id', 'order_time']);
|
|
|
+ ->whereBetween('m.order_time', [$monthStart, $monthEnd])
|
|
|
+ ->where('d.top_depart_id', $topDepartId)
|
|
|
+ ->where('m.del_time', 0)
|
|
|
+ ->select('d.*', 'm.order_time', 'm.type as main_type')
|
|
|
+ ->get()->groupBy(['employee_id', 'order_time']);
|
|
|
|
|
|
// --- 2. 阶段一:计算每个人每天在每个项目上应分配的整数分钟数 ---
|
|
|
$finalAlloc = [];
|