fix: sync material tag on report publish
This commit is contained in:
@@ -2150,6 +2150,8 @@ class AppraisalTasksController
|
||||
$verify = $this->createOrUpdateVerifyRecord($report, $now);
|
||||
|
||||
if (($report['report_type'] ?? 'appraisal') === 'appraisal' && (int)($report['order_id'] ?? 0) > 0) {
|
||||
(new MaterialTagService())->syncBoundTagForReport($report, $request);
|
||||
|
||||
Db::name('orders')->where('id', (int)$report['order_id'])->update([
|
||||
'order_status' => 'report_published',
|
||||
'display_status' => '报告已出具',
|
||||
|
||||
@@ -435,8 +435,10 @@ class ReportsController
|
||||
$effectivePublishTime = $report['publish_time'] ?: $now;
|
||||
$isOrderAppraisalReport = ($report['report_type'] ?? 'appraisal') === 'appraisal' && (int)($report['order_id'] ?? 0) > 0;
|
||||
$materialTag = null;
|
||||
$materialTagService = new MaterialTagService();
|
||||
if ($isOrderAppraisalReport) {
|
||||
$materialTag = (new MaterialTagService())->findBoundTagForReport($id);
|
||||
$materialTag = $materialTagService->findBoundTagForReport($id)
|
||||
?: $materialTagService->syncBoundTagForReport($report, $request);
|
||||
if (!$materialTag) {
|
||||
if ($qrInput === '') {
|
||||
Db::rollback();
|
||||
@@ -452,7 +454,7 @@ class ReportsController
|
||||
return api_error('报告未关联鉴定任务,不能绑定吊牌发布', 422);
|
||||
}
|
||||
|
||||
$materialTag = (new MaterialTagService())->bindTagToReportByTask((int)$task['id'], $qrInput, $request);
|
||||
$materialTag = $materialTagService->bindTagToReportByTask((int)$task['id'], $qrInput, $request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -476,6 +478,7 @@ class ReportsController
|
||||
|
||||
if ($isOrderAppraisalReport) {
|
||||
$this->refreshAppraisalSnapshot((int)$report['id'], (int)$report['order_id'], $report['service_provider'], $now);
|
||||
$materialTag = $materialTagService->syncBoundTagForReport($report, $request) ?: $materialTag;
|
||||
}
|
||||
|
||||
$verify = $this->createOrUpdateVerifyRecord($report, $now);
|
||||
|
||||
Reference in New Issue
Block a user