namespace Admin.NET.Plugin.AiDOP.DataPlatform;
///
/// 标准对象目录。附录 A 是本文的来源;新增中立表必须先加在这里。
///
public static class MdpStdObjectCatalog
{
public sealed record Def(string Code, string[] Tables, string? DocType, string Module, bool IsS0);
public static readonly IReadOnlyList All =
[
new("INV_TRANS", ["mdp_std_inv_trans"], null, "S5", false),
new("WO_LINE_PROD", ["mdp_std_work_order_line"], "PROD_TASK", "S6", false),
new("WO_LINE_SALES", ["mdp_std_work_order_line"], "SALES_ORDER", "S7", false),
new("WO_BOM", ["mdp_std_work_order_bom"], null, "S5", false),
new("EMPLOYEE", ["mdp_std_employee"], null, "S5", false),
new("INV_BAL_MONTHLY", ["mdp_std_inventory_balance_monthly"], null, "S5", false),
new("S6_REPORT", ["mdp_std_s6_report"], null, "S6", false),
new("FQC_TASK", ["mdp_std_fqc_task", "mdp_std_fqc_result", "mdp_std_fqc_result_detail"], null, "S7", false),
new("SO", ["mdp_std_so", "mdp_std_ship_trans"], null, "S1", false),
new("WO_SCHEDULE", ["mdp_std_work_order_schedule", "mdp_std_operation_schedule"], null, "S2", false),
new("SUPPLY_DEMAND", ["mdp_std_supply_demand", "mdp_std_material_readiness"], null, "S3", false),
new("PURCHASE", ["mdp_std_purchase_request", "mdp_std_purchase_order", "mdp_std_purchase_order_completion", "mdp_std_purchase_receipt"], null, "S3", false),
new("SUPPLIER_DELIVERY", ["mdp_std_delivery_schedule", "mdp_std_delivery_result", "mdp_std_delivery_exception", "mdp_std_s4_shipment", "mdp_std_s4_shortage", "mdp_std_s4_return", "mdp_std_s4_iqc"], null, "S4", false),
new("MASTER_ITEM", ["mdp_std_item"], null, "S0", true),
new("SUPPLIER", ["mdp_std_supplier", "mdp_std_supplier_item"], null, "S3", false),
new("ACTION_EVENT", ["mdp_std_action_event"], null, "S1", false),
new("INV_SNAPSHOT", ["mdp_std_inventory"], null, "S5", false),
new("IQC", ["mdp_std_iqc_inspection", "mdp_std_iqc_receipt_state"], null, "S5", false),
new("IPQC", ["mdp_std_ipqc_inspection", "mdp_std_ipqc_inspection_detail"], null, "S6", false),
new("PROD_DOC", ["mdp_std_production_issue", "mdp_std_production_receipt", "mdp_std_production_return", "mdp_std_production_return_detail"], null, "S5", false),
new("OUTSOURCE", ["mdp_std_outsource_issue", "mdp_std_outsource_issue_detail", "mdp_std_process_outsource_order"], null, "S5", false),
];
public static Def? FindByTable(string table) =>
All.FirstOrDefault(d => d.Tables.Contains(table, StringComparer.OrdinalIgnoreCase));
public static Def? Find(string code) =>
All.FirstOrDefault(d => string.Equals(d.Code, code, StringComparison.OrdinalIgnoreCase));
}