|
|
|
|
@ -1932,7 +1932,7 @@ public function correctUsedCount($rosterId)
|
|
|
|
|
* 测试校正号源:只读计算,不更新数据库
|
|
|
|
|
* 返回当前排班号源占用详情与校正后应占数的对比
|
|
|
|
|
*/
|
|
|
|
|
public function calculateUsedCount($rosterId)
|
|
|
|
|
public function calculateUsedCount($rosterId, $correct = 0)
|
|
|
|
|
{
|
|
|
|
|
if (!$rosterId) {
|
|
|
|
|
return \Yz::echoError1('参数错误:roster_id 不能为空');
|
|
|
|
|
@ -2085,6 +2085,17 @@ public function calculateUsedCount($rosterId)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 校正模式:将计算结果写入数据库
|
|
|
|
|
$corrected = false;
|
|
|
|
|
if ($correct == 1 && $hasDiff) {
|
|
|
|
|
foreach ($channelCalculated as $ch) {
|
|
|
|
|
DB::table('s_source_roster_detail_count')
|
|
|
|
|
->where('id', $ch['id'])
|
|
|
|
|
->update(['used_count' => $ch['calculated_used_count']]);
|
|
|
|
|
}
|
|
|
|
|
$corrected = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
'roster_id' => (int)$rosterId,
|
|
|
|
|
'roster_info' => [
|
|
|
|
|
@ -2101,6 +2112,7 @@ public function calculateUsedCount($rosterId)
|
|
|
|
|
'total_used' => $totalUsed,
|
|
|
|
|
'channels' => $channelCalculated,
|
|
|
|
|
'has_diff' => $hasDiff,
|
|
|
|
|
'corrected' => $corrected,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|