diff --git a/Laravel/app/Services/Admin/YeWu/PlanListService.php b/Laravel/app/Services/Admin/YeWu/PlanListService.php index a76cb8e..caee4e3 100644 --- a/Laravel/app/Services/Admin/YeWu/PlanListService.php +++ b/Laravel/app/Services/Admin/YeWu/PlanListService.php @@ -94,7 +94,8 @@ class PlanListService b.department_resources_name, c.roster_detail_id, c.count, - c.used_count + c.used_count, + c.locked_count FROM s_source_roster_detail AS a LEFT JOIN s_department_resources AS b ON a.resources_id = b.id @@ -121,11 +122,14 @@ WHERE $mergedPlan = []; foreach ($plan as $key => $p) { + // 将占位数量加到已用数量中 + $p->used_count = $p->used_count + ($p->locked_count ?? 0); + // 如果 roster_detail_id 已经存在,则合并 count 数量 if (isset($mergedPlan[$p->roster_detail_id])) { // 累加 count 数量到已存在的记录中 $mergedPlan[$p->roster_detail_id]->count += $p->count; - $mergedPlan[$p->roster_detail_id]->used_count += $p->used_count; // 如果需要合并 used_count,也可以加上 + $mergedPlan[$p->roster_detail_id]->used_count += $p->used_count; } else { // 初始化新的合并数据 $mergedPlan[$p->roster_detail_id] = $p; @@ -313,12 +317,14 @@ WHERE ->get(); $planZongCount=0;//合并后的各个渠道总名额 $planZongUsedCount=0;//合并后的各个渠道已预约的名额 + $planZongLockedCount=0;//合并后的各个渠道占位名额 $plan_qudao_tempCount=[];//拆分各个渠道需要占用的名额 $weifenpeiCount=$zhanweiCount;//未分配的名额 foreach ($roster_detail_counts as $roster_detail_count) { $planZongCount+=$roster_detail_count->count; $planZongUsedCount+=$roster_detail_count->used_count; - $keyongCount=$roster_detail_count->count-$roster_detail_count->used_count; + $planZongLockedCount+=($roster_detail_count->locked_count ?? 0); + $keyongCount=$roster_detail_count->count - $roster_detail_count->used_count - ($roster_detail_count->locked_count ?? 0); if($weifenpeiCount-$keyongCount>=0){ $plan_qudao_tempCount[]=$keyongCount; $weifenpeiCount-=$keyongCount; @@ -328,7 +334,7 @@ WHERE } } - if ($planZongCount < ($planZongUsedCount +$zhanweiCount)) return \Yz::echoError1('当前预约时间名额不足'); + if ($planZongCount < ($planZongUsedCount + $planZongLockedCount + $zhanweiCount)) return \Yz::echoError1('当前预约时间名额不足'); //判断某人这些待预约项目里,是否存在互斥 @@ -359,7 +365,9 @@ WHERE $up_plan_count_all_success =true; foreach ($roster_detail_counts as $key => $planCount) { if($plan_qudao_tempCount[$key]==0) continue; - $u = DB::table('s_source_roster_detail_count')->where(['id' => $planCount->id])->whereRaw('count >= (used_count + ?)', [$plan_qudao_tempCount[$key]]) + $u = DB::table('s_source_roster_detail_count') + ->where(['id' => $planCount->id]) + ->whereRaw('count >= (used_count + IFNULL(locked_count, 0) + ?)', [$plan_qudao_tempCount[$key]]) ->increment('used_count',$plan_qudao_tempCount[$key]); if(!$u){ @@ -372,7 +380,7 @@ WHERE foreach ($roster_detail_counts as $key => $planCount) { $cha = DB::table('s_source_roster_detail_count')->where(['id' => $planCount->id])->first(); - if ($cha->count < $cha->used_count) { + if ($cha->count < $cha->used_count + ($cha->locked_count ?? 0)) { DB::rollBack(); return \Yz::echoError1('操作失败1'); } diff --git a/Laravel/routes/api.php b/Laravel/routes/api.php index 14754ed..c9abe16 100644 --- a/Laravel/routes/api.php +++ b/Laravel/routes/api.php @@ -165,8 +165,8 @@ Route::group(['middleware'=>['log']],function () { Route::post('/GetEntrustInfo','App\Http\Controllers\API\Third\PacsController@GetEntrustInfo' ); Route::post('/GetCheckPdf','App\Http\Controllers\API\PdfController@GetCheckPdf' ); - Route::post('/SignInOnPacs','App\Http\Controllers\API\Third\PacsController@PacsSignIn' );//给Pacs用,通知本系统到检(场景,不经过报到机直接人工窗口) - Route::post('/CancelSignInOnPacs','App\Http\Controllers\API\Third\PacsController@PacsCancelSignIn' );//给Pacs用,通知本系统取消到检(场景,不经过报到机直接人工窗口) + Route::post('/SignInOnPacs','App\Http\Controllers\API\Third\PacsController@SignInOnPacs' );//给Pacs用,通知本系统到检(场景,不经过报到机直接人工窗口) + Route::post('/CancelSignInOnPacs','App\Http\Controllers\API\Third\PacsController@CancelSignInOnPacs' );//给Pacs用,通知本系统取消到检(场景,不经过报到机直接人工窗口) }); diff --git a/YiJi-admin/src/api/api.js b/YiJi-admin/src/api/api.js index 700e388..6143a45 100644 --- a/YiJi-admin/src/api/api.js +++ b/YiJi-admin/src/api/api.js @@ -386,4 +386,8 @@ export const CreateJianChaShenQingDanPdf = (data = {}) => { //号源统计 export const adminPlanTongJi = (data = {}) => { return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanTongJi', data: data }) +} +//保存占位数量 +export const SaveLockedCount = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/SaveLockedCount', data: data }) } \ No newline at end of file diff --git a/YiJi-admin/src/views/AppointmentMngr/PlanList.vue b/YiJi-admin/src/views/AppointmentMngr/PlanList.vue index c3b0d3e..56ccc14 100644 --- a/YiJi-admin/src/views/AppointmentMngr/PlanList.vue +++ b/YiJi-admin/src/views/AppointmentMngr/PlanList.vue @@ -54,6 +54,7 @@
| @@ -65,7 +66,7 @@ | -{{item.substring(5,10)}} {{getWeekday(item)}} | +{{item.substring(5,10)}} {{getWeekday(item)}} |
|
+
+
@@ -95,7 +101,7 @@
+
- {{item3.jiancheng}}{{item3.used_count}}/{{item3.count}}
+ {{item3.jiancheng}}{{item3.locked_count}}/{{item3.used_count}}/{{item3.count}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+ 剩余可用: {{ item.count - item.used_count }}
+
+
+ 暂无渠道数据
+
+ |