admin/src/Oms.Application/Labeling/LabelFieldDictionary.cs
2026-07-18 19:10:41 +08:00

105 lines
3.5 KiB
C#

namespace Oms.Application.Labeling;
/// <summary>
/// 设计器字段字典(与 PrintData camelCase 对齐)。
/// </summary>
public static class LabelFieldDictionary
{
public static IReadOnlyList<LabelFieldGroup> GetGroups() =>
[
new LabelFieldGroup
{
Code = "numbers",
Title = "单号",
Fields =
[
// 按标题字符数升序:运单号/跟踪号/请求号(3) → 客户单号(4)
Field("serviceNo", "运单号"),
Field("trackNo", "跟踪号"),
Field("requestId", "请求号"),
Field("clientNo", "客户单号")
]
},
new LabelFieldGroup
{
Code = "product",
Title = "产品 / 渠道 / 仓库",
Fields =
[
Field("productCode", "产品编码"),
Field("salesProductName", "销售产品"),
Field("channelCode", "渠道编码"),
Field("channelName", "渠道名称"),
Field("warehouseName", "仓库"),
Field("customerCode", "客户编码"),
Field("customerName", "客户名称")
]
},
new LabelFieldGroup
{
Code = "recipient",
Title = "收件人",
Fields =
[
Field("recipientName", "收件人"),
Field("recipientCompany", "收件公司"),
Field("recipientPhone", "收件电话"),
Field("recipientEmail", "收件邮箱"),
Field("recipientZip", "邮编"),
Field("recipientCountry", "国家代码"),
Field("recipientCountryName", "国家名称"),
Field("recipientProvince", "省/州"),
Field("recipientCity", "城市"),
Field("recipientStreet1", "街道1"),
Field("recipientStreet2", "街道2"),
Field("recipientStreet3", "街道3"),
Field("recipientAddressFull", "完整地址"),
Field("recipientTaxNo", "税号"),
Field("vatNo", "VAT"),
Field("eori", "EORI")
]
},
new LabelFieldGroup
{
Code = "weight",
Title = "重量尺寸",
Fields =
[
Field("actualWeight", "实重"),
Field("volumetricWeight", "体积重"),
Field("chargeableWeight", "计费重"),
Field("length", "长"),
Field("width", "宽"),
Field("height", "高"),
Field("weightUnit", "重量单位"),
Field("dimUnit", "尺寸单位")
]
},
new LabelFieldGroup
{
Code = "system",
Title = "系统",
Fields =
[
Field("printTime", "打印时间"),
Field("operatorName", "操作人")
]
}
];
private static LabelFieldItem Field(string field, string title) => new() { Field = field, Title = title };
}
public sealed class LabelFieldGroup
{
public string Code { get; init; } = string.Empty;
public string Title { get; init; } = string.Empty;
public List<LabelFieldItem> Fields { get; init; } = [];
}
public sealed class LabelFieldItem
{
public string Field { get; init; } = string.Empty;
public string Title { get; init; } = string.Empty;
}