fix: [production-order] 생산지시 상세 개선 - 수량을 개소수로 변경, BOM 공정그룹 한글 라벨 매핑
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -168,12 +168,13 @@ public function show(int $orderId): array
|
||||
];
|
||||
|
||||
// WorkOrder 목록 가공 (생산 공정만)
|
||||
$workOrders = $productionWorkOrders->values()->map(function ($wo) {
|
||||
$nodeCount = $order->nodes_count ?? $order->nodes->count();
|
||||
$workOrders = $productionWorkOrders->values()->map(function ($wo) use ($nodeCount) {
|
||||
return [
|
||||
'id' => $wo->id,
|
||||
'work_order_no' => $wo->work_order_no,
|
||||
'process_name' => $wo->process?->process_name ?? '',
|
||||
'quantity' => $wo->items->count(),
|
||||
'quantity' => $nodeCount,
|
||||
'status' => $wo->status,
|
||||
'assignees' => $wo->assignees->map(fn ($a) => $a->user?->name ?? '')->filter()->values()->toArray(),
|
||||
];
|
||||
@@ -234,16 +235,17 @@ private function extractBomProcessGroups($nodes): array
|
||||
continue;
|
||||
}
|
||||
|
||||
$processGroup = $item['process_group'] ?? $item['category_group'] ?? '기타';
|
||||
$processGroupKey = $item['process_group'] ?? $item['category_group'] ?? '기타';
|
||||
$processGroupLabel = $this->mapProcessGroupLabel($processGroupKey);
|
||||
|
||||
if (! isset($groups[$processGroup])) {
|
||||
$groups[$processGroup] = [
|
||||
'process_name' => $processGroup,
|
||||
if (! isset($groups[$processGroupKey])) {
|
||||
$groups[$processGroupKey] = [
|
||||
'process_name' => $processGroupLabel,
|
||||
'items' => [],
|
||||
];
|
||||
}
|
||||
|
||||
$groups[$processGroup]['items'][] = [
|
||||
$groups[$processGroupKey]['items'][] = [
|
||||
'id' => $item['item_id'] ?? null,
|
||||
'item_code' => $item['item_code'] ?? '',
|
||||
'item_name' => $item['item_name'] ?? '',
|
||||
@@ -260,6 +262,22 @@ private function extractBomProcessGroups($nodes): array
|
||||
return array_values($groups);
|
||||
}
|
||||
|
||||
/**
|
||||
* BOM process_group 코드 → 한글 라벨
|
||||
*/
|
||||
private function mapProcessGroupLabel(string $key): string
|
||||
{
|
||||
return match ($key) {
|
||||
'inspection' => '검사비',
|
||||
'material' => '원자재',
|
||||
'motor' => '모터',
|
||||
'controller' => '제어장치',
|
||||
'steel' => '절곡물',
|
||||
'parts' => '부자재',
|
||||
default => $key,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 주문 ID 목록에 대해 작업지시 진행률을 일괄 조회 (단일 쿼리)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user