|
|
@@ -51,6 +51,7 @@ class WorkOrderProcessLogService
|
|
|
$params['type'] = '2';
|
|
|
$log = WorkOrderProcessLog::query()->create($params);
|
|
|
$log->workOrder()->update(['work_order_status' => '3']);
|
|
|
+ $this->syncOrderIssueIndemnity($log);
|
|
|
$log->loadMissing('creator');
|
|
|
return $log;
|
|
|
}
|
|
|
@@ -76,7 +77,26 @@ class WorkOrderProcessLogService
|
|
|
$params['type'] = 1;
|
|
|
if ($params['is_indemnity'] == 2) $params['indemnity'] = 0;
|
|
|
$log = WorkOrderProcessLog::query()->create($params);
|
|
|
+ $this->syncOrderIssueIndemnity($log);
|
|
|
$log->loadMissing('creator');
|
|
|
return $log;
|
|
|
}
|
|
|
+
|
|
|
+ public function syncOrderIssueIndemnity($log)
|
|
|
+ {
|
|
|
+ if ($log->is_indemnity == '否') return;
|
|
|
+ $orderIssue = $log->workOrder->orderIssue;
|
|
|
+ if ($log->isBaoShiLog()) {
|
|
|
+ if ($log->indemnitor == '宝时'){
|
|
|
+ if ($orderIssue->baoshi_indemnity_money) return ;
|
|
|
+ $orderIssue->update(['baoshi_indemnity_money'=>$log->indemnity]);
|
|
|
+ } else if ($log->indemnitor == '承运商'){
|
|
|
+ if ($orderIssue->logistic_indemnity_money) return ;
|
|
|
+ $orderIssue->update(['logistic_indemnity_money'=>$log->indemnity]);
|
|
|
+ }
|
|
|
+ } else if ($log->isLogisticLog()){
|
|
|
+ if ($orderIssue->logistic_indemnity_money) return ;
|
|
|
+ $orderIssue->update(['logistic_indemnity_money'=>$log->indemnity]);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|