{
    "display_name": "FC廣瀬西受注（034014）",
    "description": "廣瀬無線電機関西LC向けフォーキャストExcel取込（1ファイル=1伝票、全件引当しない）",
    "processor_class": "App\\Services\\Logic\\User\\CsvImport\\Processors\\FcForecastOrderProcessor",
    "business_key_field": "注番",
    "header_table": "order_headers",
    "detail_table": "order_details",
    "file_type": "xlsx",
    "excel_format": "fc_forecast",
    "fc_pattern": "fc_hirose_west",
    "has_header": false,
    "headers": [
        "No", "商品CD", "商品型番", "原価", "数量", "注番"
    ],
    "header_fields": {
        "注番": {
            "label": "注番",
            "csv_column": 5,
            "type": "string",
            "required": false,
            "max_length": 200,
            "description": "Excel E4セルの値。order_headers.order_number と全明細にコピー（空欄許容）"
        }
    },
    "detail_fields": {
        "商品CD": {
            "label": "商品CD（JANコード）",
            "csv_column": 1,
            "type": "string",
            "required": true,
            "max_length": 13,
            "description": "B列のJANコード。products.jan_code から商品IDを解決（複数該当時はStep3.4で選択）"
        },
        "商品型番": {
            "label": "商品型番",
            "csv_column": 2,
            "type": "string",
            "required": false,
            "description": "C列の商品型番（参照用、Step3.4の商品選択UIに表示）"
        },
        "原価": {
            "label": "原価",
            "csv_column": 3,
            "type": "decimal",
            "required": false,
            "description": "D列の原価。>0 なら unit_price として手単登録、0/空欄/文字列ならOrderAssistで自動取得"
        },
        "数量": {
            "label": "数量",
            "csv_column": 4,
            "type": "integer",
            "required": true,
            "min": 1,
            "description": "E列の数量。0または空欄の行は取込対象外（バリデーションエラーにしない）"
        }
    },
    "business_rules": {
        "jan_code_resolution": {
            "rule": "resolve_by_jan_code",
            "description": "商品CD(JAN)から商品IDを解決。is_active=1, stock_output_type=1 で検索",
            "on_not_found": "validation_error",
            "on_multiple": "step3_4_selection"
        },
        "allocation_fixed": {
            "rule": "allocation_type_fixed_to_2",
            "description": "フォーキャスト用途のため、全明細を allocation_type=2（確保しない）固定で登録"
        },
        "single_slip_per_file": {
            "rule": "group_all_rows_into_one_header",
            "description": "1取込=1伝票。全明細を単一の order_headers にまとめて登録"
        },
        "order_number_propagation": {
            "rule": "copy_e4_to_all_details",
            "description": "E4セルの注番を order_headers.order_number と全明細の order_details.order_number にコピー（空欄許容、重複チェックなし）"
        },
        "unit_price_fallback": {
            "rule": "fallback_to_order_assist_when_invalid",
            "description": "D列が 0/空欄/数値変換不可の場合は unit_price を未設定とし、BaseOrderProcessor::setPriceTypeAndUnitPrice() 経由で OrderAssist::getUnitPrice() による特単→ランク単価の自動取得に委ねる"
        },
        "row_filtering": {
            "rule": "skip_qty_zero_and_aggregate_rows",
            "description": "数量0/空欄の行と末尾集計行（B列に「総数」「総額(千)」を含む行）はパース時にスキップ"
        }
    },
    "excel_format_example": {
        "description": "FCフォーキャスト固定構造（kiro/CSVFC/FCインポート.xlsx 参照）",
        "layout": {
            "Row 1": "タイトル（無視）",
            "Row 2": "空行",
            "Row 3": "拠点情報など（無視）",
            "Row 4": "[D]仮注番ラベル [E]注番（取込対象）",
            "Row 5": "列見出し（無視）",
            "Row 6": "空行",
            "Row 7+": "明細データ [A]No [B]商品CD [C]商品型番 [D]原価 [E]数量",
            "末尾2行": "総数 / 総額(千)（無視）"
        }
    }
}
