feat: 견적확정 밸리데이션, 작업지시 통계 공정별 카운트, 입고/재고 개선

- 견적확정 시 업체명/현장명/담당자/연락처 필수 검증 추가 (QuoteService)
- 작업지시 stats API에 by_process 공정별 카운트 반환 추가
- 작업지시 목록/상세 쿼리에 수주 개소(rootNodes) 연관 로딩
- 작업지시 품목에 sourceOrderItem.node 관계 추가
- 입고관리 완료건 수정 허용 및 재고 차이 조정
- work_order_step_progress 테이블 마이그레이션
- receivings 테이블 options 컬럼 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-07 03:27:07 +09:00
parent 6b3e5c3e87
commit 487e651845
22 changed files with 1422 additions and 72 deletions

View File

@@ -1029,23 +1029,34 @@ private function getItemsWithInspectionTemplate(array $itemIds): array
$tenantId = $this->tenantId();
// document_templates에서 category='incoming_inspection'이고
// linked_item_ids JSON 배열에 품목 ID가 포함된 템플릿 조회
// DocumentService::resolve()와 동일한 category 매칭 조건
$categoryCode = 'incoming_inspection';
$categoryName = '수입검사';
$templates = \DB::table('document_templates')
->where('tenant_id', $tenantId)
->where('category', 'incoming_inspection')
->where('is_active', true)
->whereNotNull('linked_item_ids')
->where(function ($q) use ($categoryCode, $categoryName) {
$q->where('category', $categoryCode)
->orWhere('category', $categoryName)
->orWhere('category', 'LIKE', "%{$categoryName}%");
})
->get(['linked_item_ids']);
$linkedItemIds = [];
foreach ($templates as $template) {
$ids = json_decode($template->linked_item_ids, true) ?? [];
$linkedItemIds = array_merge($linkedItemIds, $ids);
// int/string 타입 모두 매칭되도록 정수로 통일
foreach ($ids as $id) {
$linkedItemIds[] = (int) $id;
}
}
// 요청된 품목 ID와 연결된 품목 ID의 교집합
return array_values(array_intersect($itemIds, array_unique($linkedItemIds)));
// 요청된 품목 ID도 정수로 통일하여 교집합
$intItemIds = array_map('intval', $itemIds);
return array_values(array_intersect($intItemIds, array_unique($linkedItemIds)));
}
/**