fix: [작업일지] STOCK 작업지시 bending_info API fallback 추가
WorkOrderService::show()에서 STOCK 작업지시의 options에 bending_info가 없을 때 수주의 bending_lot에서 동적 생성. React 작업일지 모달에서도 정상 표시되도록 수정.
This commit is contained in:
@@ -273,6 +273,24 @@ public function show(int $id)
|
||||
throw new NotFoundHttpException(__('error.not_found'));
|
||||
}
|
||||
|
||||
// STOCK(재고생산) 작업지시: bending_info 없으면 수주의 bending_lot에서 동적 생성
|
||||
if (empty($workOrder->options['bending_info']) && $workOrder->salesOrder) {
|
||||
$orderOptions = $workOrder->salesOrder->options ?? [];
|
||||
$bendingLot = $orderOptions['bending_lot'] ?? null;
|
||||
if ($bendingLot && ($workOrder->salesOrder->order_type_code ?? '') === 'STOCK') {
|
||||
$stockBendingInfo = app(\App\Services\OrderService::class)
|
||||
->buildStockBendingInfoStatic(
|
||||
$bendingLot,
|
||||
(int) ($orderOptions['target_stock_qty'] ?? $workOrder->salesOrder->quantity ?? 1)
|
||||
);
|
||||
if ($stockBendingInfo) {
|
||||
$opts = $workOrder->options ?? [];
|
||||
$opts['bending_info'] = $stockBendingInfo;
|
||||
$workOrder->options = $opts;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $workOrder;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user