调整 字段顺序、名称

This commit is contained in:
2026-04-22 17:12:37 +08:00
parent 86f120bc18
commit 7b45d04a6b
6 changed files with 56 additions and 50 deletions
+19 -6
View File
@@ -1,6 +1,7 @@
from __future__ import annotations
from dataclasses import dataclass
from datetime import date
PRIMARY_FIELD_NAME = "货品编码"
@@ -26,19 +27,28 @@ BRAND_SYNC_TARGETS = [
BrandSyncTarget(brand_name="羽心堂", table_name="羽心堂"),
]
def month_sales_field_name(month_offset: int, today: date | None = None) -> str:
current = today or date.today()
month_index = current.year * 12 + current.month - 1 - month_offset
year = month_index // 12
month = month_index % 12 + 1
return f"{year}{month:02d}销售数量"
FIELD_SPECS = [
FieldSpec("品牌", "品牌名称", 1),
FieldSpec("分类", "一级分类", 1),
FieldSpec("产品类别", "货品简称", 1),
FieldSpec("货品名称", "商品名称", 1),
FieldSpec("分类", "一级分类", 1),
FieldSpec("条形码", "条形码", 1),
FieldSpec("零售价", "零售价", 2, "0.00", 2),
FieldSpec("店铺名称", "店铺名称", 1),
FieldSpec("店铺可用库存", "店铺挂单量", 2, "0", 0),
FieldSpec("总库存", "总库存", 2, "0", 0),
FieldSpec("本月销售数量", "本月销售数量", 2, "0", 0),
FieldSpec("上月销售数量", "上月销售数量", 2, "0", 0),
FieldSpec("上上月销售数量", "上上月销售数量", 2, "0", 0),
FieldSpec(month_sales_field_name(0), "本月销售数量", 2, "0", 0),
FieldSpec(month_sales_field_name(1), "上月销售数量", 2, "0", 0),
FieldSpec(month_sales_field_name(2), "上上月销售数量", 2, "0", 0),
FieldSpec("品牌", "品牌名称", 1),
FieldSpec("产品类别", "货品简称", 1),
]
LEGACY_NAME_MAP = {
@@ -47,5 +57,8 @@ LEGACY_NAME_MAP = {
"货品简称": "产品类别",
"商品名称": "货品名称",
"店铺挂单量": "店铺可用库存",
"本月销售数量": month_sales_field_name(0),
"上月销售数量": month_sales_field_name(1),
"上上月销售数量": month_sales_field_name(2),
"统一规格编码": PRIMARY_FIELD_NAME,
}