liugc 11 месяцев назад
Родитель
Сommit
311939c906

+ 1 - 0
app/adminapi/logic/works/ServiceWorkLogic.php

@@ -903,6 +903,7 @@ class ServiceWorkLogic extends BaseLogic
                 throw new \Exception('无配件审核');
             }else{
                 $serviceWorkInfo = ServiceWork::find($spare->service_work_id);
+                Log::info( '配件审核结算'.json_encode([$serviceWorkInfo['work_pay_status']]));
                 if((int)$serviceWorkInfo['work_pay_status'] !== 3){
                     throw new \Exception('该工单非待结算状态');
                 }

+ 4 - 2
app/common/model/works/ServiceWork.php

@@ -57,9 +57,11 @@ class ServiceWork extends BaseModel
 
         $is_settlement = false;
         if($model->user_confirm_status == 5 and $model->work_status == 7 and $model->work_pay_status==1) {
-            $isOneselfSpare = ServiceWorkSpare::where("service_work_id", $model->id)->where('spare_part_id', 0)->count('id');
-            if ($isOneselfSpare) {
+            $isOneselfSpare = ServiceWorkSpare::where("service_work_id", $model->id)->where('spare_part_id', 0)->count();
+            Log::info('自己配件数量:'.json_encode(['service_work_id'=>$model->id,'isOneselfSpare'=>$isOneselfSpare]));
+            if ($isOneselfSpare > 0) {
                 $count = ServiceWorkSpare::where("service_work_id",$model->id)->whereIn('status', [0,2])->count();
+                Log::info('自己配件数量:'.json_encode(['service_work_id'=>$model->id,'count'=>$count]));
                 // 结算待审
                 if($count>0){
                     $model->work_pay_status = 3;