fix: 조인트바 자동 계산 추가 (레거시 5130 공식 적용)

- KyungdongFormulaHandler: joint_bar_qty 미전달 시 자동 계산
  공식: (2 + floor((제작가로 - 500) / 1000)) × 셔터수량
- OrderService.extractSlatInfoFromBom(): 동일 폴백 추가
- OrderService.createWorkOrders(): slat_info.joint_bar 0일 때 width 기반 계산
- CURRENT_WORKS.md 업데이트

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 22:35:43 +09:00
parent 1429f22f11
commit 2fedc3a712
3 changed files with 73 additions and 1 deletions

View File

@@ -1162,10 +1162,17 @@ public function createProductionOrder(int $orderId, array $data)
$slatInfo = $this->extractSlatInfoFromBom($nodeOptions['bom_result']);
}
// slat_info의 joint_bar가 0이면 레거시 공식으로 자동 계산
$woWidth = $nodeOptions['width'] ?? $nodeOptions['open_width'] ?? null;
if ($slatInfo && ($slatInfo['joint_bar'] ?? 0) <= 0 && $woWidth > 0) {
$qty = (int) $orderItem->quantity;
$slatInfo['joint_bar'] = (2 + (int) floor(((float) $woWidth - 500) / 1000)) * $qty;
}
$woItemOptions = array_filter([
'floor' => $orderItem->floor_code,
'code' => $orderItem->symbol_code,
'width' => $nodeOptions['width'] ?? $nodeOptions['open_width'] ?? null,
'width' => $woWidth,
'height' => $nodeOptions['height'] ?? $nodeOptions['open_height'] ?? null,
'cutting_info' => $nodeOptions['cutting_info'] ?? null,
'slat_info' => $slatInfo,
@@ -1238,6 +1245,16 @@ private function extractSlatInfoFromBom(?array $bomResult, array $locItem = []):
}
}
// 프론트 미전달 시 레거시 5130 자동 계산 (Slat_updateCo76)
// col76 = (2 + floor((제작가로 - 500) / 1000)) * 셔터수량
if ($jointBarQty <= 0) {
$width = (float) ($bomVars['W0'] ?? $locItem['width'] ?? 0);
$quantity = (int) ($bomVars['QTY'] ?? $locItem['quantity'] ?? 1);
if ($width > 0) {
$jointBarQty = (2 + (int) floor(($width - 500) / 1000)) * $quantity;
}
}
// 방화유리 수량: 프론트 입력값 우선, 없으면 개소 수량(QTY)
$glassQty = (int) ($locItem['glass_qty'] ?? $bomVars['glass_qty'] ?? $locItem['quantity'] ?? 0);