fix: 견적 V2 자동 견적 산출 UI 오류 수정
- actions.ts: BomBulkResponse 타입, FinishedGoods에 has_bom/bom 필드 추가 - QuoteRegistrationV2.tsx: handleCalculate 응답 처리, DevFill BOM 필터링 - LocationDetailPanel.tsx: bomItemsByTab process_group 기반 매핑 - QuoteSummaryPanel.tsx: detailTotals grouped_items 기반 계산 해결된 문제: 1. 오른쪽 패널 제품 리스트 미표시 2. 개소별 합계(상세소계) 미표시 3. 상세별 합계(그룹) 미표시 4. 예상 견적금액 0원 표시
This commit is contained in:
@@ -796,6 +796,8 @@ export interface FinishedGoods {
|
||||
item_category: string;
|
||||
specification?: string;
|
||||
unit?: string;
|
||||
has_bom?: boolean;
|
||||
bom?: unknown[];
|
||||
}
|
||||
|
||||
export async function getFinishedGoods(category?: string): Promise<{
|
||||
@@ -868,6 +870,8 @@ export async function getFinishedGoods(category?: string): Promise<{
|
||||
item_category: (item.item_category as string) || '',
|
||||
specification: item.specification as string | undefined,
|
||||
unit: item.unit as string | undefined,
|
||||
has_bom: item.has_bom as boolean | undefined,
|
||||
bom: item.bom as unknown[] | undefined,
|
||||
})),
|
||||
};
|
||||
} catch (error) {
|
||||
@@ -896,28 +900,59 @@ export interface BomCalculateItem {
|
||||
}
|
||||
|
||||
export interface BomCalculationResult {
|
||||
success?: boolean;
|
||||
finished_goods: {
|
||||
code: string;
|
||||
name: string;
|
||||
item_category?: string;
|
||||
};
|
||||
variables?: Record<string, unknown>;
|
||||
items: Array<{
|
||||
item_code: string;
|
||||
item_name: string;
|
||||
item_category?: string;
|
||||
specification?: string;
|
||||
unit?: string;
|
||||
quantity: number;
|
||||
quantity_formula?: string;
|
||||
base_price?: number;
|
||||
multiplier?: number;
|
||||
unit_price: number;
|
||||
total_price: number;
|
||||
calculation_note?: string;
|
||||
category_group?: string;
|
||||
process_group?: string;
|
||||
process_group_key?: string;
|
||||
}>;
|
||||
subtotals: Record<string, { name?: string; count?: number; subtotal?: number } | number>;
|
||||
grouped_items?: Record<string, {
|
||||
name: string;
|
||||
items: Array<unknown>;
|
||||
subtotal: number;
|
||||
}>;
|
||||
subtotals: Record<string, { name?: string; count?: number; subtotal?: number; items?: unknown[] } | number>;
|
||||
grand_total: number;
|
||||
}
|
||||
|
||||
// API 서버 응답 구조 (QuoteCalculationService::calculateBomBulk)
|
||||
export interface BomBulkResponse {
|
||||
success: boolean;
|
||||
summary: {
|
||||
total_count: number;
|
||||
success_count: number;
|
||||
fail_count: number;
|
||||
grand_total: number;
|
||||
};
|
||||
items: Array<{
|
||||
index: number;
|
||||
finished_goods_code: string;
|
||||
inputs: Record<string, unknown>;
|
||||
result: BomCalculationResult;
|
||||
}>;
|
||||
}
|
||||
|
||||
export async function calculateBomBulk(items: BomCalculateItem[]): Promise<{
|
||||
success: boolean;
|
||||
data: BomCalculationResult[];
|
||||
data: BomBulkResponse | null;
|
||||
error?: string;
|
||||
__authError?: boolean;
|
||||
}> {
|
||||
@@ -934,7 +969,7 @@ export async function calculateBomBulk(items: BomCalculateItem[]): Promise<{
|
||||
if (error) {
|
||||
return {
|
||||
success: false,
|
||||
data: [],
|
||||
data: null,
|
||||
error: error.message,
|
||||
__authError: error.code === 'UNAUTHORIZED',
|
||||
};
|
||||
@@ -943,7 +978,7 @@ export async function calculateBomBulk(items: BomCalculateItem[]): Promise<{
|
||||
if (!response) {
|
||||
return {
|
||||
success: false,
|
||||
data: [],
|
||||
data: null,
|
||||
error: 'BOM 계산에 실패했습니다.',
|
||||
};
|
||||
}
|
||||
@@ -954,21 +989,21 @@ export async function calculateBomBulk(items: BomCalculateItem[]): Promise<{
|
||||
if (!response.ok || !result.success) {
|
||||
return {
|
||||
success: false,
|
||||
data: [],
|
||||
data: null,
|
||||
error: result.message || 'BOM 계산에 실패했습니다.',
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: result.data || [],
|
||||
data: result.data || null,
|
||||
};
|
||||
} catch (error) {
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[QuoteActions] calculateBomBulk error:', error);
|
||||
return {
|
||||
success: false,
|
||||
data: [],
|
||||
data: null,
|
||||
error: '서버 오류가 발생했습니다.',
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user