feat(analytics): CapabilityDevice 增加 material_name(X 轴展示物料名)
- 后端 CapabilityDevice 新增 material_name,get_capability_profile 查询并填充 - 前端类型同步 material_name
This commit is contained in:
@ -32,6 +32,7 @@ class CapabilityDevice(BaseModel):
|
|||||||
product_sn: str # 身份证
|
product_sn: str # 身份证
|
||||||
external_serial: str | None # 产品序列号(业务序列号)
|
external_serial: str | None # 产品序列号(业务序列号)
|
||||||
spec_model: str # 规格型号
|
spec_model: str # 规格型号
|
||||||
|
material_name: str # 物料名称
|
||||||
|
|
||||||
|
|
||||||
class CapabilitySeries(BaseModel):
|
class CapabilitySeries(BaseModel):
|
||||||
@ -150,6 +151,7 @@ async def get_capability_profile(
|
|||||||
Task.assignee_id, Task.status,
|
Task.assignee_id, Task.status,
|
||||||
Task.received_at, Task.created_at, Task.completed_at,
|
Task.received_at, Task.created_at, Task.completed_at,
|
||||||
Product.serial_number, Product.external_serial, Product.spec_model,
|
Product.serial_number, Product.external_serial, Product.spec_model,
|
||||||
|
Product.material_name,
|
||||||
)
|
)
|
||||||
.join(Product, Task.product_id == Product.id)
|
.join(Product, Task.product_id == Product.id)
|
||||||
.where(
|
.where(
|
||||||
@ -184,8 +186,9 @@ async def get_capability_profile(
|
|||||||
sn = row[5]
|
sn = row[5]
|
||||||
ext = row[6]
|
ext = row[6]
|
||||||
spec = row[7] or "未知型号"
|
spec = row[7] or "未知型号"
|
||||||
|
mat = row[8] or ""
|
||||||
|
|
||||||
meta = device_meta.setdefault(sn, {"external_serial": ext, "spec_model": spec, "earliest": None})
|
meta = device_meta.setdefault(sn, {"external_serial": ext, "spec_model": spec, "material_name": mat, "earliest": None})
|
||||||
if start and (meta["earliest"] is None or start < meta["earliest"]):
|
if start and (meta["earliest"] is None or start < meta["earliest"]):
|
||||||
meta["earliest"] = start
|
meta["earliest"] = start
|
||||||
|
|
||||||
@ -212,6 +215,7 @@ async def get_capability_profile(
|
|||||||
product_sn=sn,
|
product_sn=sn,
|
||||||
external_serial=device_meta[sn]["external_serial"],
|
external_serial=device_meta[sn]["external_serial"],
|
||||||
spec_model=device_meta[sn]["spec_model"],
|
spec_model=device_meta[sn]["spec_model"],
|
||||||
|
material_name=device_meta[sn]["material_name"],
|
||||||
)
|
)
|
||||||
for sn in categories
|
for sn in categories
|
||||||
]
|
]
|
||||||
|
|||||||
@ -18,6 +18,7 @@ export interface CapabilityDevice {
|
|||||||
product_sn: string; // 身份证
|
product_sn: string; // 身份证
|
||||||
external_serial: string | null; // 产品序列号(业务序列号)
|
external_serial: string | null; // 产品序列号(业务序列号)
|
||||||
spec_model: string;
|
spec_model: string;
|
||||||
|
material_name: string; // 物料名称
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CapabilitySeries {
|
export interface CapabilitySeries {
|
||||||
|
|||||||
Reference in New Issue
Block a user