'code', 'field_name' => '품목코드', 'field_type' => 'textbox', 'is_required' => true, 'order_no' => 1], ['field_key' => 'name', 'field_name' => '품목명', 'field_type' => 'textbox', 'is_required' => true, 'order_no' => 2], ['field_key' => 'unit', 'field_name' => '단위', 'field_type' => 'dropdown', 'is_required' => true, 'order_no' => 3], ['field_key' => 'product_type', 'field_name' => '제품유형', 'field_type' => 'dropdown', 'order_no' => 4, 'options' => [ ['label' => '완제품', 'value' => 'FG'], ['label' => '부품', 'value' => 'PT'], ]], ['field_key' => 'category_id', 'field_name' => '카테고리', 'field_type' => 'dropdown', 'order_no' => 5], ['field_key' => 'is_sellable', 'field_name' => '판매가능', 'field_type' => 'checkbox', 'order_no' => 6, 'default_value' => 'true'], ['field_key' => 'is_purchasable', 'field_name' => '구매가능', 'field_type' => 'checkbox', 'order_no' => 7], ['field_key' => 'is_producible', 'field_name' => '생산가능', 'field_type' => 'checkbox', 'order_no' => 8, 'default_value' => 'true'], ['field_key' => 'is_active', 'field_name' => '활성화', 'field_type' => 'checkbox', 'order_no' => 9, 'default_value' => 'true'], ['field_key' => 'certification_number', 'field_name' => '인증번호', 'field_type' => 'textbox', 'order_no' => 10], ['field_key' => 'certification_start_date', 'field_name' => '인증시작일', 'field_type' => 'date', 'order_no' => 11], ['field_key' => 'certification_end_date', 'field_name' => '인증만료일', 'field_type' => 'date', 'order_no' => 12], ]; /** * materials 테이블 시스템 필드 정의 */ public const MATERIALS = [ ['field_key' => 'material_code', 'field_name' => '자재코드', 'field_type' => 'textbox', 'is_required' => true, 'order_no' => 1], ['field_key' => 'name', 'field_name' => '자재명', 'field_type' => 'textbox', 'is_required' => true, 'order_no' => 2], ['field_key' => 'item_name', 'field_name' => '품목명', 'field_type' => 'textbox', 'order_no' => 3], ['field_key' => 'specification', 'field_name' => '규격', 'field_type' => 'textbox', 'order_no' => 4], ['field_key' => 'unit', 'field_name' => '단위', 'field_type' => 'dropdown', 'is_required' => true, 'order_no' => 5], ['field_key' => 'category_id', 'field_name' => '카테고리', 'field_type' => 'dropdown', 'order_no' => 6], ['field_key' => 'is_inspection', 'field_name' => '검수필요', 'field_type' => 'checkbox', 'order_no' => 7], ['field_key' => 'search_tag', 'field_name' => '검색태그', 'field_type' => 'textarea', 'order_no' => 8], ]; /** * product_components 테이블 (BOM) 시스템 필드 정의 */ public const PRODUCT_COMPONENTS = [ ['field_key' => 'ref_type', 'field_name' => '참조유형', 'field_type' => 'dropdown', 'order_no' => 1, 'options' => [ ['label' => '제품', 'value' => 'product'], ['label' => '자재', 'value' => 'material'], ]], ['field_key' => 'ref_id', 'field_name' => '참조품목', 'field_type' => 'dropdown', 'order_no' => 2], ['field_key' => 'quantity', 'field_name' => '수량', 'field_type' => 'number', 'is_required' => true, 'order_no' => 3], ['field_key' => 'formula', 'field_name' => '계산공식', 'field_type' => 'textbox', 'order_no' => 4], ['field_key' => 'note', 'field_name' => '비고', 'field_type' => 'textarea', 'order_no' => 5], ]; /** * material_inspections 테이블 시스템 필드 정의 */ public const MATERIAL_INSPECTIONS = [ ['field_key' => 'inspection_date', 'field_name' => '검수일', 'field_type' => 'date', 'is_required' => true, 'order_no' => 1], ['field_key' => 'inspector_id', 'field_name' => '검수자', 'field_type' => 'dropdown', 'order_no' => 2], ['field_key' => 'status', 'field_name' => '검수상태', 'field_type' => 'dropdown', 'order_no' => 3, 'options' => [ ['label' => '대기', 'value' => 'pending'], ['label' => '진행중', 'value' => 'in_progress'], ['label' => '완료', 'value' => 'completed'], ['label' => '불합격', 'value' => 'rejected'], ]], ['field_key' => 'lot_no', 'field_name' => 'LOT번호', 'field_type' => 'textbox', 'order_no' => 4], ['field_key' => 'quantity', 'field_name' => '검수수량', 'field_type' => 'number', 'order_no' => 5], ['field_key' => 'passed_quantity', 'field_name' => '합격수량', 'field_type' => 'number', 'order_no' => 6], ['field_key' => 'rejected_quantity', 'field_name' => '불합격수량', 'field_type' => 'number', 'order_no' => 7], ['field_key' => 'note', 'field_name' => '비고', 'field_type' => 'textarea', 'order_no' => 8], ]; /** * material_receipts 테이블 시스템 필드 정의 */ public const MATERIAL_RECEIPTS = [ ['field_key' => 'receipt_date', 'field_name' => '입고일', 'field_type' => 'date', 'is_required' => true, 'order_no' => 1], ['field_key' => 'lot_no', 'field_name' => 'LOT번호', 'field_type' => 'textbox', 'order_no' => 2], ['field_key' => 'quantity', 'field_name' => '입고수량', 'field_type' => 'number', 'is_required' => true, 'order_no' => 3], ['field_key' => 'unit_price', 'field_name' => '단가', 'field_type' => 'number', 'order_no' => 4], ['field_key' => 'total_price', 'field_name' => '금액', 'field_type' => 'number', 'order_no' => 5], ['field_key' => 'supplier_id', 'field_name' => '공급업체', 'field_type' => 'dropdown', 'order_no' => 6], ['field_key' => 'warehouse_id', 'field_name' => '입고창고', 'field_type' => 'dropdown', 'order_no' => 7], ['field_key' => 'po_number', 'field_name' => '발주번호', 'field_type' => 'textbox', 'order_no' => 8], ['field_key' => 'invoice_number', 'field_name' => '송장번호', 'field_type' => 'textbox', 'order_no' => 9], ['field_key' => 'note', 'field_name' => '비고', 'field_type' => 'textarea', 'order_no' => 10], ]; /** * 소스 테이블 목록 */ public const SOURCE_TABLES = [ 'products' => '제품', 'materials' => '자재', 'product_components' => 'BOM', 'material_inspections' => '자재검수', 'material_receipts' => '자재입고', ]; /** * 소스 테이블별 필드 정의 가져오기 */ public static function getFieldsFor(string $sourceTable): array { return match ($sourceTable) { 'products' => self::PRODUCTS, 'materials' => self::MATERIALS, 'product_components' => self::PRODUCT_COMPONENTS, 'material_inspections' => self::MATERIAL_INSPECTIONS, 'material_receipts' => self::MATERIAL_RECEIPTS, default => [], }; } /** * 전체 테이블 필드 수 조회 */ public static function getTotalFieldCount(string $sourceTable): int { return count(self::getFieldsFor($sourceTable)); } /** * 모든 소스 테이블의 시스템 필드 키 목록 */ public static function getAllSystemFieldKeys(string $sourceTable): array { $fields = self::getFieldsFor($sourceTable); return array_column($fields, 'field_key'); } }