feat:경동기업 견적/수주 전환 로직 개선
- KyungdongFormulaHandler: 수식 계산 로직 리팩토링 및 확장 - OrderService: 수주 전환 시 BOM 품목 매핑 로직 추가 - QuoteService: 견적 상태 처리 개선 - FormulaEvaluatorService: 디버그 로깅 추가 - Quote 모델: 캐스팅 타입 수정 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
use App\Models\Quote\QuoteItem;
|
||||
use App\Models\Quote\QuoteRevision;
|
||||
use App\Models\Tenants\SiteBriefing;
|
||||
use App\Services\OrderService;
|
||||
use App\Services\Service;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -21,7 +22,8 @@ class QuoteService extends Service
|
||||
{
|
||||
public function __construct(
|
||||
private QuoteNumberService $numberService,
|
||||
private QuoteCalculationService $calculationService
|
||||
private QuoteCalculationService $calculationService,
|
||||
private OrderService $orderService
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -439,7 +441,24 @@ public function update(int $id, array $data): Quote
|
||||
$this->createItems($quote, $data['items'], $tenantId);
|
||||
}
|
||||
|
||||
return $quote->refresh()->load(['items', 'revisions', 'client']);
|
||||
$quote->refresh()->load(['items', 'revisions', 'client']);
|
||||
|
||||
// 연결된 수주가 있으면 동기화
|
||||
if ($quote->order_id) {
|
||||
try {
|
||||
$this->orderService->setContext($tenantId, $userId);
|
||||
$this->orderService->syncFromQuote($quote, $quote->current_revision);
|
||||
} catch (\Exception $e) {
|
||||
// 수주 동기화 실패는 로그만 남기고 견적 수정은 성공 처리
|
||||
Log::warning('Failed to sync order from quote', [
|
||||
'quote_id' => $quote->id,
|
||||
'order_id' => $quote->order_id,
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $quote;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user