feat: [shipment] 출하 프로세스 개선 - 수주 품목 기반 변경, 취소→cancelled 상태, 역방향 프로세스, 제품명/오픈사이즈 추가
- 출하 품목을 수주 품목(order_item_id) 기반으로 변경 - 작업 취소 시 출하를 삭제 대신 cancelled 상태로 변경 - 작업 취소 시 역방향 프로세스 구현 (WorkOrderService) - 출하 상세 API에 제품명(product_name) 매핑 추가 - 출하 상세 제품그룹에 오픈사이즈 추가 - shipment_items 테이블에 없는 item_id 컬럼 참조 제거 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -162,7 +162,7 @@ public function show(int $id): Shipment
|
||||
{
|
||||
$tenantId = $this->tenantId();
|
||||
|
||||
return Shipment::query()
|
||||
$shipment = Shipment::query()
|
||||
->where('tenant_id', $tenantId)
|
||||
->with([
|
||||
'items' => function ($query) {
|
||||
@@ -171,11 +171,36 @@ public function show(int $id): Shipment
|
||||
'vehicleDispatches',
|
||||
'order.client',
|
||||
'order.writer',
|
||||
'order.nodes',
|
||||
'workOrder',
|
||||
'creator',
|
||||
'updater',
|
||||
])
|
||||
->findOrFail($id);
|
||||
|
||||
// order_nodes의 product_name을 shipment items에 매핑
|
||||
if ($shipment->order && $shipment->order->nodes) {
|
||||
$nodeMap = [];
|
||||
foreach ($shipment->order->nodes as $node) {
|
||||
$opts = $node->options ?? [];
|
||||
$productName = $opts['product_name'] ?? $node->name;
|
||||
$openW = $opts['open_width'] ?? null;
|
||||
$openH = $opts['open_height'] ?? null;
|
||||
$size = ($openW && $openH) ? "{$openW}×{$openH}" : null;
|
||||
$nodeMap[$node->code] = [
|
||||
'product_name' => $size ? "{$productName} {$size}" : $productName,
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($shipment->items as $item) {
|
||||
// floor_unit (예: 1F/FSS-01) → order_node code (예: 1F-FSS-01)
|
||||
$nodeCode = str_replace('/', '-', $item->floor_unit ?? '');
|
||||
$nodeInfo = $nodeMap[$nodeCode] ?? null;
|
||||
$item->setAttribute('product_name', $nodeInfo['product_name'] ?? null);
|
||||
}
|
||||
}
|
||||
|
||||
return $shipment;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user