1
0
forked from erp-dev/erp

feat: batch update for plate order

This commit is contained in:
2025-12-18 17:36:43 +08:00
parent 98d797221a
commit 1a6ce32441
33 changed files with 32087 additions and 8 deletions

View File

@@ -45,6 +45,158 @@ plate_order_related_worksheet_map_cn = {
"照图开发": MDY_WORKSHEET_ID_PLATE_ORDER_IMAGE_DEVELOPMENT,
}
# ------------------------------------------------------------------------------
# 明道云:开版相关“关联表”字段映射(用于后续关联查询/解析)
#
# 说明:
# - 这里记录的是“字段 controlId -> 字段含义/类型/备注”。
# - Relation(29) 字段在写入时通常按文档要求使用 rowId 字符串(多条用逗号分割、全量覆盖),
# 但 getFilterRows 拉取时返回结构可能是 list[{"rowid","name","link"}],解析时需兼容两种形态。
# ------------------------------------------------------------------------------
plate_order_related_field_definitions: Dict[str, Dict[str, Any]] = {
# 1) 画图
"drawing": {
"worksheet_id": MDY_WORKSHEET_ID_PLATE_ORDER_DRAWING,
"name": "画图",
"fields": {
"62d7f09ad55983029b644b25": {"name": "设计师名字", "type": "Text"},
"62d52f4b8d2972284492dda0": {"name": "电脑位置", "type": "Text"},
"62d52f4b8d2972284492dd9b": {
"name": "附件",
"type": "Attachment",
"note": "json支持外部链接和 Base64 文件流",
},
"6412d650120c799be027953d": {
"name": "开版管理",
"type": "Relation",
"note": "String 字符串,多条记录 rowId 用(,)分割,全量覆盖操作",
},
"62d52f4b8d2972284492dd9d": {
"name": "开发管理",
"type": "Relation",
"note": "String 字符串,多条记录 rowId 用(,)分割,全量覆盖操作",
},
},
},
# 2) 调色
"coloring": {
"worksheet_id": MDY_WORKSHEET_ID_PLATE_ORDER_COLORING,
"name": "调色",
"fields": {
"62d7f0c2d121077a8492619d": {"name": "设计师名字", "type": "Text"},
"62d52f4b8d2972284492dda8": {"name": "电脑位置", "type": "Text"},
"62d52f4b8d2972284492dda3": {
"name": "附件",
"type": "Attachment",
"note": "json支持外部链接和 Base64 文件流",
},
"6716620b985d1a2af61776b5": {
"name": "完成数量",
"type": "Number",
"note": "Double例如 666.66",
},
"62d52f4b8d2972284492dda5": {
"name": "开发管理",
"type": "Relation",
"note": "String 字符串,多条记录 rowId 用(,)分割,全量覆盖操作",
},
},
},
# 3) 套纸样
"pattern_set": {
"worksheet_id": MDY_WORKSHEET_ID_PLATE_ORDER_PATTERN_SET,
"name": "套纸样",
"fields": {
"62d7f0cfa72269e1965389e7": {"name": "设计师名字", "type": "Text"},
"62d52f4b8d2972284492de8c": {"name": "电脑位置", "type": "Text"},
"62d52f4b8d2972284492de89": {
"name": "附件",
"type": "Attachment",
"note": "json支持外部链接和 Base64 文件流",
},
"671661bc8d15ca93fdec7e5f": {
"name": "完成数量",
"type": "Number",
"note": "Double例如 666.66",
},
"62d52f4b8d2972284492de8d": {
"name": "开版管理",
"type": "Relation",
"note": "String 字符串,多条记录 rowId 用(,)分割,全量覆盖操作",
},
},
},
# 4) 改图
"modify_drawing": {
"worksheet_id": MDY_WORKSHEET_ID_PLATE_ORDER_MODIFY_DRAWING,
"name": "改图",
"fields": {
"62d7f0cfa72269e1965389e7": {"name": "设计师名字", "type": "Text"},
"62d52f4b8d2972284492de8c": {"name": "电脑位置", "type": "Text"},
"62d52f4b8d2972284492de89": {
"name": "附件",
"type": "Attachment",
"note": "json支持外部链接和 Base64 文件流",
},
"66e2ebb7da66655f355bf709": {
"name": "开版管理",
"type": "Relation",
"note": "String 字符串,多条记录 rowId 用(,)分割,全量覆盖操作",
},
},
},
# 5) 配色
"color_scheme": {
"worksheet_id": MDY_WORKSHEET_ID_PLATE_ORDER_COLOR_SCHEME,
"name": "配色",
"fields": {
"62d7f09ad55983029b644b25": {"name": "设计师名字", "type": "Text"},
"62d52f4b8d2972284492dda0": {"name": "电脑位置", "type": "Text"},
"62d52f4b8d2972284492dd9b": {
"name": "附件",
"type": "Attachment",
"note": "json支持外部链接和 Base64 文件流",
},
"672adc9b156abb9a08ab2a61": {
"name": "开版管理",
"type": "Relation",
"note": "String 字符串,多条记录 rowId 用(,)分割,全量覆盖操作",
},
# 注:配色表无“完成数量”,用“开发数量”替代
"66e2ef8d99632ae7376e73ef": {
"name": "开发数量",
"type": "Number",
"note": "Double例如 666.66",
},
},
},
# 6) 找图开发(照图开发)
"image_development": {
"worksheet_id": MDY_WORKSHEET_ID_PLATE_ORDER_IMAGE_DEVELOPMENT,
"name": "找图开发",
"fields": {
"62d7f09ad55983029b644b25": {"name": "设计师名字", "type": "Text"},
"62d52f4b8d2972284492dda0": {"name": "电脑位置", "type": "Text"},
"62d52f4b8d2972284492dd9b": {
"name": "附件",
"type": "Attachment",
"note": "json支持外部链接和 Base64 文件流",
},
"66e2efb0da66655f355bf963": {
"name": "开版管理",
"type": "Relation",
"note": "String 字符串,多条记录 rowId 用(,)分割,全量覆盖操作",
},
# 注:找图开发表无“完成数量”,用“开发数量”替代
"66e2ef8d99632ae7376e73ef": {
"name": "开发数量",
"type": "Number",
"note": "Double例如 666.66",
},
},
},
}
# ------------------------------------------------------------------------------
# 明道云:字段映射(内部字段名 -> controlId
@@ -165,3 +317,19 @@ plate_order_type_map = {
"created_at": "ctime",
"rowid": "rowid",
}
# PlateOrder 行中“关联字段 controlId -> 关联表 key”
# 用于从开版主表记录中提取跨表 rowid 并进一步查询关联表数据。
plate_order_relation_control_map = {
plate_order_type_map["drawing_relation"]: "drawing",
plate_order_type_map["color_relation"]: "coloring",
plate_order_type_map["pattern_set"]: "pattern_set",
plate_order_type_map["modify_drawing_relation"]: "modify_drawing",
plate_order_type_map["color_scheme_relation"]: "color_scheme",
plate_order_type_map["image_development_relation"]: "image_development",
}
# json key 查询
# MDYPlateOrderStaging.objects.filter(
# raw__62d52f4b8d2972284492dd0e="82724" # 设计编号/订单id明道云字段ID
# )