104 lines
4.1 KiB
C#
104 lines
4.1 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace Ounibo.Catalog.Core
|
|
{
|
|
// ---- .opc 数据包模型 (字段名与 catalog.json 键一一对应) ----
|
|
|
|
public class Catalog
|
|
{
|
|
public string schemaVersion { get; set; }
|
|
public string catalogName { get; set; }
|
|
public string catalogNameEn { get; set; }
|
|
public string catalogVersion { get; set; }
|
|
public string defaultLang { get; set; }
|
|
public string genApi { get; set; } // NX 按需生成服务地址 (空 = 非标下载维持置灰; 二期 2026-08-25)
|
|
public List<string> langs { get; set; }
|
|
public List<Category> categories { get; set; }
|
|
public List<Series> series { get; set; }
|
|
public List<CrossRefRow> crossRefs { get; set; } // 平替对照 (可空)
|
|
}
|
|
|
|
public class Category
|
|
{
|
|
public string code { get; set; }
|
|
public string nameZh { get; set; }
|
|
public string nameEn { get; set; }
|
|
public string keywords { get; set; } // 搜索关键词 (英文/拼音等, 空格分隔)
|
|
public List<string> series { get; set; }
|
|
}
|
|
|
|
public class Series
|
|
{
|
|
public string code { get; set; }
|
|
public string nameZh { get; set; }
|
|
public string nameEn { get; set; }
|
|
public string keywords { get; set; } // 搜索关键词
|
|
public string mode { get; set; } // "parametric"=参数化引擎; 缺失/其他=枚举模式 (现行为)
|
|
public string modelCodeTemplate { get; set; } // 参数化: 型号编码模板, 如 "KC{type}{bore}-{stroke}{magnet}{mount}" ({field[:padN]})
|
|
public List<ParameterDef> parameters { get; set; }
|
|
public List<Rule> rules { get; set; }
|
|
public Naming naming { get; set; }
|
|
public List<Attachment> attachments { get; set; }
|
|
public List<Variant> variants { get; set; }
|
|
}
|
|
|
|
public class ParameterDef
|
|
{
|
|
public string code { get; set; }
|
|
public string nameZh { get; set; }
|
|
public string nameEn { get; set; }
|
|
public string keywords { get; set; } // 搜索关键词 (如拼音 gangjing)
|
|
public string unit { get; set; }
|
|
public string type { get; set; } // enum / number / range (range=连续参数化域)
|
|
public List<object> values { get; set; }
|
|
public Dictionary<string, string> display { get; set; }
|
|
// ---- range 域 (type=range 时生效) ----
|
|
public double? min { get; set; } // 域下限 (含)
|
|
public double? max { get; set; } // 域上限 (含)
|
|
public double? step { get; set; } // 步长 (缺省 1)
|
|
public List<object> gridValues { get; set; } // 标准档位快捷值 (仅 UI 快捷选择, 网格真源仍是 CSV)
|
|
}
|
|
|
|
public class Rule
|
|
{
|
|
public RuleCond If { get; set; }
|
|
public RuleCond Then { get; set; }
|
|
}
|
|
|
|
public class RuleCond
|
|
{
|
|
public string Param { get; set; }
|
|
public string Op { get; set; } // eq/ne/in/gt/ge/lt/le/between
|
|
public object Value { get; set; } // 标量或数组 (op=in/between)
|
|
}
|
|
|
|
public class Naming
|
|
{
|
|
public string stepNameTemplate { get; set; }
|
|
}
|
|
|
|
public class Attachment
|
|
{
|
|
public string kind { get; set; } // dimDrawing / datasheet / note
|
|
public string lang { get; set; }
|
|
public string path { get; set; }
|
|
public string model { get; set; } // dimDrawing 可绑定具体型号
|
|
}
|
|
|
|
public class Variant
|
|
{
|
|
public string modelCode { get; set; }
|
|
public Dictionary<string, object> @params { get; set; } // C# 保留字用 @ 前缀
|
|
public string step { get; set; }
|
|
}
|
|
|
|
/// <summary>平替对照行 (竞品型号 → 我方型号, 源: catalog\crossref.csv)。</summary>
|
|
public class CrossRefRow
|
|
{
|
|
public string brand { get; set; } // 竞品品牌 (SMC/亚德客/FESTO/...)
|
|
public string foreignModel { get; set; } // 竞品型号
|
|
public string ourModel { get; set; } // 我方型号 (必须存在于目录变体)
|
|
public string note { get; set; } // 备注 (完全互换/近似平替/需确认)
|
|
}
|
|
}
|