feat: 质检工单结论、库位批量/筛选与协议样本接收质检摘要

落库并展示质检工单级结论(可编辑/任务派生),库位树支持批量新增子节点与货架格子检索,协议/捐赠列表补充接收与门禁质检摘要,并同步生产物料与工单卡片展示优化。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-07-28 18:46:24 +08:00
1 parent f554d77e59
commit a3af039e74
54 files changed
+42429 -35006

No files matched your search

+54 -1
View File
@@ -447,6 +447,22 @@ class StorageFacilityUpdateBody(BaseModel):
remark: Optional[str] = None
class StorageFacilityBatchCreateBody(BaseModel):
model_config = ConfigDict(populate_by_name=True)
parent_id: str = Field("0", alias="parentId")
name_prefix: str = Field("", alias="namePrefix")
name_suffix: str = Field("", alias="nameSuffix")
start_num: int = Field(..., alias="startNum", ge=0)
end_num: int = Field(..., alias="endNum", ge=0)
pad_width: int = Field(0, alias="padWidth", ge=0, le=8)
code_prefix: str = Field("", alias="codePrefix")
code_suffix: str = Field("", alias="codeSuffix")
node_type: Optional[str] = Field(None, alias="nodeType")
is_leaf: Optional[int] = Field(0, alias="isLeaf")
remark: Optional[str] = None
@router.get("/storage-facilities")
async def list_storage_facilities(
keyword: Optional[str] = None,
@@ -500,6 +516,35 @@ async def create_storage_facility(
return error_response(400, str(e))
@router.post("/storage-facilities/batch")
async def batch_create_storage_facilities(
body: StorageFacilityBatchCreateBody,
user: dict = Depends(require_admin_or_super_admin),
db: Session = Depends(get_db),
):
try:
tenant_no = _get_tenant_no(db, user)
items = storage_facility_svc.batch_create_facilities(
db,
parent_id=body.parent_id,
name_prefix=body.name_prefix,
name_suffix=body.name_suffix,
start_num=body.start_num,
end_num=body.end_num,
pad_width=body.pad_width,
code_prefix=body.code_prefix,
code_suffix=body.code_suffix,
node_type=body.node_type,
is_leaf=body.is_leaf or 0,
tenant_no=tenant_no,
remark=body.remark,
user_id=user.get("user_id"),
)
return success_response(items, message=f"批量创建 {len(items)} 个子节点成功")
except ValueError as e:
return error_response(400, str(e))
@router.put("/storage-facilities/{node_id}")
async def update_storage_facility(
node_id: str,
@@ -603,13 +648,21 @@ async def list_storage_slots(
BizStorageFacilitySlot.order_num.asc(),
BizStorageFacilitySlot.create_time.asc(),
).all()
facility_by_id = storage_facility_svc.load_facility_map(db, tenant_no)
facility_by_id = storage_facility_svc.load_facility_ancestor_map(
db, tenant_no, facilityNodeId
)
result_list = [storage_facility_svc._slot_to_dict(r, facility_by_id) for r in items]
if availableOnly:
# 仅空格场景无需 enrich 在库产品
result_list = [
row for row in result_list
if (row.get("slotStatus") or "") == "空" or int(row.get("occupiedCount") or 0) == 0
]
else:
# 占用格附带名称/类型(轻量批量,供库位管理货架展示)
result_list = occupancy_svc.enrich_slots_with_stored_cell_products(
db, tenant_no, result_list
)
return success_response(result_list)
+1
View File
@@ -800,6 +800,7 @@ async def update_qc_work_order(
user_id=_get_current_user_id(user),
cell_product_id=body.cell_product_id,
work_order_status=body.work_order_status,
qc_conclusion=body.qc_conclusion,
remark=body.remark,
)
db.commit()
+18
View File
@@ -1022,12 +1022,26 @@ def list_collection_protocols(
if c:
all_sample_codes.append(c)
lab_code_map: Dict[str, str] = {}
reception_summary_map: Dict[str, Dict[str, str]] = {}
qc_status_map: Dict[str, Dict[str, str]] = {}
from app.services.protocol_sample_list_summary import (
build_sample_item_reception_qc_fields,
get_list_qc_status_map_by_sample_codes,
get_list_reception_summary_map_by_sample_codes,
)
if tenant_no and all_sample_codes:
from app.crud import sample_reception as reception_svc
lab_code_map = reception_svc.get_lab_storage_code_map_by_sample_codes(
db, tenant_no, all_sample_codes, reception_source="cell_storage"
)
reception_summary_map = get_list_reception_summary_map_by_sample_codes(
db, tenant_no, all_sample_codes, reception_source="cell_storage"
)
qc_status_map = get_list_qc_status_map_by_sample_codes(
db, tenant_no, all_sample_codes, reception_source="cell_storage"
)
transport_by_sample_id: Dict[str, BizProtocolSampleTransport] = {}
if protocol_ids:
@@ -1135,6 +1149,10 @@ def list_collection_protocols(
"labStorageCode": lab_code_map.get(code, "") if code else "",
"transport": transport_dict,
**sample_special_to_dict(s),
**build_sample_item_reception_qc_fields(
reception_summary_map.get(code) if code else None,
qc_status_map.get(code) if code else None,
),
}
)
d["sampleItems"] = sample_items
+14 -10
View File
@@ -1168,17 +1168,21 @@ def list_production_tasks(
kw = (keyword or "").strip()
if kw:
like = f"%{kw}%"
keyword_conditions = [
BizProductionTask.task_no.like(like),
BizProductionWorkOrder.work_order_no.like(like),
BizProductionWorkOrder.sample_code.like(like),
]
if tenant_no:
from app.crud.production_work_order import _outbound_work_order_ids_by_keyword
wo_type = (work_order_type or "").strip()
if wo_type == "temporary":
keyword_conditions = [BizProductionWorkOrder.remark.like(like)]
else:
keyword_conditions = [
BizProductionTask.task_no.like(like),
BizProductionWorkOrder.work_order_no.like(like),
BizProductionWorkOrder.sample_code.like(like),
]
if tenant_no:
from app.crud.production_work_order import _outbound_work_order_ids_by_keyword
outbound_ids = _outbound_work_order_ids_by_keyword(db, tenant_no, kw)
if outbound_ids:
keyword_conditions.append(BizProductionWorkOrder.id.in_(outbound_ids))
outbound_ids = _outbound_work_order_ids_by_keyword(db, tenant_no, kw)
if outbound_ids:
keyword_conditions.append(BizProductionWorkOrder.id.in_(outbound_ids))
q = q.outerjoin(
BizProductionWorkOrder,
and_(
+73 -22
View File
@@ -208,6 +208,8 @@ def _wo_to_dict(wo: BizProductionWorkOrder) -> Dict[str, Any]:
}.get(getattr(wo, "biz_type", None) or "", ""),
"workOrderStatus": wo.work_order_status,
"workOrderStatusLabel": _WORK_ORDER_STATUS_LABELS.get(wo.work_order_status, wo.work_order_status),
"qcConclusion": "",
"qcConclusionLabel": "",
"receptionTime": "",
"handlerName": "",
"sampleTypeName": "",
@@ -223,6 +225,49 @@ def _enrich_wo_items(db: Session, items: List[Dict[str, Any]]) -> List[Dict[str,
return qc_wo_svc._enrich_work_order_list_items(db, items)
def _enrich_inbound_qc_conclusions(
db: Session, tenant_no: str, items: List[Dict[str, Any]]
) -> List[Dict[str, Any]]:
"""入库(细胞存储/科研捐赠)生产工单列表补充门禁质检结论。"""
if not items or not (tenant_no or "").strip():
return items
from collections import defaultdict
from app.services.protocol_sample_list_summary import (
get_list_qc_conclusion_map_by_sample_codes,
)
codes_by_source: Dict[str, List[str]] = defaultdict(list)
for item in items:
wo_type = (item.get("workOrderType") or "inbound").strip() or "inbound"
source = (item.get("receptionSource") or "").strip()
code = (item.get("sampleCode") or "").strip()
if wo_type != "inbound" or source not in ("cell_storage", "research_donation") or not code:
item["qcConclusion"] = item.get("qcConclusion") or ""
item["qcConclusionLabel"] = item.get("qcConclusionLabel") or ""
continue
codes_by_source[source].append(code)
conclusion_maps: Dict[str, Dict[str, Dict[str, str]]] = {}
for source, codes in codes_by_source.items():
conclusion_maps[source] = get_list_qc_conclusion_map_by_sample_codes(
db, tenant_no, codes, reception_source=source
)
for item in items:
wo_type = (item.get("workOrderType") or "inbound").strip() or "inbound"
source = (item.get("receptionSource") or "").strip()
code = (item.get("sampleCode") or "").strip()
if wo_type != "inbound" or source not in ("cell_storage", "research_donation") or not code:
item["qcConclusion"] = ""
item["qcConclusionLabel"] = ""
continue
fields = conclusion_maps.get(source, {}).get(code) or {}
item["qcConclusion"] = fields.get("qcConclusion") or ""
item["qcConclusionLabel"] = fields.get("qcConclusionLabel") or ""
return items
_BIZ_TYPE_LABELS = {
"pilot_service": "中试服务",
"clinical_application": "临床应用",
@@ -525,11 +570,13 @@ def _attach_outbound_detail(
def _wo_to_response_dict(db: Session, wo: BizProductionWorkOrder) -> Dict[str, Any]:
"""工单响应(含接收记录关联的样本类型、接收人、接收时间及 reception 详情)。"""
out = _enrich_wo_items(db, [_wo_to_dict(wo)])[0]
tenant_no = (wo.tenant_no or "").strip()
if tenant_no:
out = _enrich_inbound_qc_conclusions(db, tenant_no, [out])[0]
if wo.work_order_type == "outbound" and wo.infusion_schedule_id:
_attach_outbound_detail(db, wo, out)
else:
_attach_reception_detail(db, wo, out, wo.tenant_no or "")
tenant_no = (wo.tenant_no or "").strip()
if tenant_no:
out = enrich_work_order_fee_summaries(db, [out], tenant_no)[0]
return out
@@ -677,27 +724,30 @@ def list_production_work_orders(
kw = (query.keyword or "").strip()
if kw:
like = f"%{kw}%"
keyword_conditions = [
BizProductionWorkOrder.work_order_no.like(like),
BizProductionWorkOrder.sample_code.like(like),
]
from app.crud import sample_reception as reception_svc
if wo_type == "temporary":
q0 = q0.filter(BizProductionWorkOrder.remark.like(like))
else:
keyword_conditions = [
BizProductionWorkOrder.work_order_no.like(like),
BizProductionWorkOrder.sample_code.like(like),
]
from app.crud import sample_reception as reception_svc
rec_ids = reception_svc.reception_ids_matching_lab_storage_keyword(
db, tenant_no, kw
)
if rec_ids:
keyword_conditions.append(BizProductionWorkOrder.reception_id.in_(rec_ids))
lab_codes = reception_svc.sample_codes_matching_lab_storage_keyword(
db, tenant_no, kw
)
if lab_codes:
keyword_conditions.append(BizProductionWorkOrder.sample_code.in_(lab_codes))
if wo_type == "outbound":
outbound_ids = _outbound_work_order_ids_by_keyword(db, tenant_no, kw)
if outbound_ids:
keyword_conditions.append(BizProductionWorkOrder.id.in_(outbound_ids))
q0 = q0.filter(or_(*keyword_conditions))
rec_ids = reception_svc.reception_ids_matching_lab_storage_keyword(
db, tenant_no, kw
)
if rec_ids:
keyword_conditions.append(BizProductionWorkOrder.reception_id.in_(rec_ids))
lab_codes = reception_svc.sample_codes_matching_lab_storage_keyword(
db, tenant_no, kw
)
if lab_codes:
keyword_conditions.append(BizProductionWorkOrder.sample_code.in_(lab_codes))
if wo_type == "outbound":
outbound_ids = _outbound_work_order_ids_by_keyword(db, tenant_no, kw)
if outbound_ids:
keyword_conditions.append(BizProductionWorkOrder.id.in_(outbound_ids))
q0 = q0.filter(or_(*keyword_conditions))
elif query.work_order_no and query.work_order_no.strip():
like = f"%{query.work_order_no.strip()}%"
q0 = q0.filter(BizProductionWorkOrder.work_order_no.like(like))
@@ -778,6 +828,7 @@ def list_production_work_orders(
.all()
)
items = _enrich_wo_items(db, [_wo_to_dict(x) for x in rows])
items = _enrich_inbound_qc_conclusions(db, tenant_no, items)
items = _enrich_outbound_items(db, tenant_no, items)
items = enrich_work_order_fee_summaries(db, items, tenant_no)
return {"items": items, "total": int(total)}
@@ -1257,7 +1308,7 @@ def list_temp_production_work_orders(
kw = (keyword or "").strip()
if kw:
like = f"%{kw}%"
q = q.filter(BizProductionWorkOrder.work_order_no.like(like))
q = q.filter(BizProductionWorkOrder.remark.like(like))
st_raw = (work_order_status or "").strip()
if st_raw:
statuses = [s.strip() for s in st_raw.split(",") if s.strip()]
+81 -3
View File
@@ -23,6 +23,10 @@ from app.crud.sample_reception import _donation_sample_id_col
from app.crud import sample_reception_check_result as check_result_svc
from app.crud.cell_product import _enrich_product_dicts as _cp_enrich, _row_to_dict as _cp_row_to_dict, get_cell_product
from app.services.qc_work_order_fee_summary import enrich_work_order_fee_summaries
from app.services.qc_work_order_conclusion import (
build_qc_conclusion_fields,
work_order_qc_conclusion_label,
)
from app.models.models import (
BizCellProduct,
BizCellSampleType,
@@ -74,8 +78,9 @@ _TRIGGER_SOURCE_LABELS = {
}
_ACCEPT_CONCLUSION_LABELS = {"js": "接收", "bj": "拒收"}
_WORK_ORDER_STATUS_LABELS = {"dpz": "待配置", "ypz": "已配置", "ywc": "已完成", "yzf": "已作废"}
_VALID_QC_DISPATCH_OUTPUT_TYPE_NAME = "有效物"
_VALID_QC_WORK_ORDER_STATUSES = frozenset(_WORK_ORDER_STATUS_LABELS.keys())
_VALID_QC_WORK_ORDER_CONCLUSIONS = frozenset({"tg", "btg"})
_VALID_QC_DISPATCH_OUTPUT_TYPE_NAME = "有效物"
_TASK_TYPE_LABELS = {"sysz": "实验室自检", "dsfjc": "第三方检测"}
_TASK_STATUS_LABELS = {"dzx": "待执行", "jxz": "进行中", "ywc": "已完成"}
_PROTOCOL_STATUS_LABELS = {
@@ -1074,6 +1079,12 @@ def _wo_to_dict(
"workOrderStatusLabel": _WORK_ORDER_STATUS_LABELS.get(
wo.work_order_status or "", wo.work_order_status or ""
),
"qcConclusion": (
(getattr(wo, "conclusion", None) or "").strip()
if (getattr(wo, "conclusion", None) or "").strip() in _VALID_QC_WORK_ORDER_CONCLUSIONS
else ""
),
"qcConclusionLabel": work_order_qc_conclusion_label(getattr(wo, "conclusion", None) or ""),
"hasLab": wo.has_lab == "1",
"hasThirdParty": wo.has_third_party == "1",
"configuredTime": _fmt_dt(wo.configured_time),
@@ -1710,6 +1721,7 @@ def list_work_orders(
items = _enrich_outbound_work_orders(db, tenant_no, items)
items = enrich_work_order_fee_summaries(db, items, tenant_no)
items = _enrich_unfinished_badge_counts(db, items)
items = _enrich_work_order_qc_conclusions(db, items)
return items, int(total)
@@ -1747,6 +1759,7 @@ def list_work_orders_by_sample(
items = _enrich_outbound_work_orders(db, tenant_no, items)
items = enrich_work_order_fee_summaries(db, items, tenant_no)
items = _enrich_unfinished_badge_counts(db, items)
items = _enrich_work_order_qc_conclusions(db, items)
return items
@@ -1771,6 +1784,7 @@ def build_work_order_list_summaries(
items = _enrich_outbound_work_orders(db, tenant_no, items)
items = enrich_work_order_fee_summaries(db, items, tenant_no)
items = _enrich_unfinished_badge_counts(db, items)
items = _enrich_work_order_qc_conclusions(db, items)
return {item["id"]: item for item in items if item.get("id")}
@@ -1853,6 +1867,45 @@ def _enrich_unfinished_badge_counts(
return items
def _enrich_work_order_qc_conclusions(
db: Session, items: List[Dict[str, Any]]
) -> List[Dict[str, Any]]:
"""列表项补充工单级质检结论:优先落库 conclusion,否则由任务结论派生。"""
if not items:
return items
need_derive_ids = [
(x.get("id") or "").strip()
for x in items
if (x.get("id") or "").strip()
and (x.get("qcConclusion") or "").strip() not in _VALID_QC_WORK_ORDER_CONCLUSIONS
]
conclusions_by_wo: Dict[str, List[Optional[str]]] = defaultdict(list)
if need_derive_ids:
rows = (
db.query(BizQcTask.work_order_id, BizQcTask.conclusion)
.filter(
BizQcTask.del_flag == 0,
BizQcTask.work_order_id.in_(need_derive_ids),
)
.all()
)
for wo_id, conclusion in rows:
wid = (wo_id or "").strip()
if wid:
conclusions_by_wo[wid].append(conclusion)
for item in items:
stored = (item.get("qcConclusion") or "").strip()
if stored in _VALID_QC_WORK_ORDER_CONCLUSIONS:
item["qcConclusion"] = stored
item["qcConclusionLabel"] = work_order_qc_conclusion_label(stored)
continue
wid = (item.get("id") or "").strip()
fields = build_qc_conclusion_fields(conclusions_by_wo.get(wid, []))
item["qcConclusion"] = fields["qcConclusion"]
item["qcConclusionLabel"] = fields["qcConclusionLabel"]
return items
def _aggregate_qc_tab_counts(rows) -> Dict[str, int]:
counts = _empty_qc_tab_counts()
for wo_type, rs, bt, cnt in rows:
@@ -2399,6 +2452,7 @@ def get_work_order_detail(
enriched_list = _enrich_work_order_list_items(db, [out])
if tenant_no:
enriched_list = _enrich_work_order_qc_targets(db, tenant_no, enriched_list)
enriched_list = _enrich_work_order_qc_conclusions(db, enriched_list)
enriched = enriched_list[0]
out.update(
{
@@ -2417,6 +2471,8 @@ def get_work_order_detail(
"cellProductTypeName": enriched.get("cellProductTypeName", ""),
"cellProductPassage": enriched.get("cellProductPassage", ""),
"cellProductSpecName": enriched.get("cellProductSpecName", ""),
"qcConclusion": enriched.get("qcConclusion", ""),
"qcConclusionLabel": enriched.get("qcConclusionLabel", ""),
}
)
resolved_reception_id = _resolve_reception_id_for_work_order_detail(db, wo, tenant_no)
@@ -2872,6 +2928,18 @@ def try_complete_work_order(db: Session, work_order_id: str, tenant_no: str) ->
wo = get_work_order(db, work_order_id, tenant_no=tenant_no)
if wo and wo.work_order_status == "ypz":
wo.work_order_status = "ywc"
task_conclusions = [
c
for (c,) in db.query(BizQcTask.conclusion)
.filter(
BizQcTask.work_order_id == work_order_id,
BizQcTask.tenant_no == tenant_no,
BizQcTask.del_flag == 0,
)
.all()
]
derived = build_qc_conclusion_fields(task_conclusions)["qcConclusion"]
wo.conclusion = derived or None
wo.update_time = datetime.now()
db.add(wo)
from app.crud.pilot_outbound_status_sync import sync_schedule_from_qc_work_order
@@ -2886,6 +2954,7 @@ def try_reopen_work_order(db: Session, work_order_id: str, tenant_no: str) -> No
if not wo or (wo.work_order_status or "").strip() != "ywc":
return
wo.work_order_status = "ypz"
wo.conclusion = None
wo.update_time = datetime.now()
db.add(wo)
from app.crud.pilot_outbound_status_sync import sync_schedule_from_qc_work_order
@@ -3018,9 +3087,10 @@ def update_qc_work_order(
user_id: Optional[str] = None,
cell_product_id: Optional[str] = None,
work_order_status: Optional[str] = None,
qc_conclusion: Optional[str] = None,
remark: Optional[str] = None,
) -> BizQcWorkOrder:
"""编辑质检工单:入库/出库可改备注与状态;临时可改备注与质检对象"""
"""编辑质检工单:入库/出库可改备注、状态与质检结论;临时可改备注与质检对象"""
wo = get_work_order(db, work_order_id, tenant_no=tenant_no)
if not wo:
raise ValueError("工单不存在")
@@ -3035,6 +3105,11 @@ def update_qc_work_order(
if st not in _VALID_QC_WORK_ORDER_STATUSES:
raise ValueError("工单状态无效")
wo.work_order_status = st
if qc_conclusion is not None:
conc = (qc_conclusion or "").strip()
if conc and conc not in _VALID_QC_WORK_ORDER_CONCLUSIONS:
raise ValueError("质检结论无效")
wo.conclusion = conc or None
if remark is not None:
wo.remark = (remark or "").strip() or None
wo.update_by = user_id
@@ -3052,9 +3127,10 @@ def update_temp_qc_work_order(
user_id: Optional[str] = None,
cell_product_id: Optional[str] = None,
work_order_status: Optional[str] = None,
qc_conclusion: Optional[str] = None,
remark: Optional[str] = None,
) -> BizQcWorkOrder:
"""编辑临时质检工单(备注、质检对象、状态)"""
"""编辑临时质检工单(备注、质检对象、状态、质检结论)"""
return update_qc_work_order(
db,
work_order_id,
@@ -3062,6 +3138,7 @@ def update_temp_qc_work_order(
user_id=user_id,
cell_product_id=cell_product_id,
work_order_status=work_order_status,
qc_conclusion=qc_conclusion,
remark=remark,
)
@@ -3109,6 +3186,7 @@ def list_temp_qc_work_orders(
items = [_wo_to_dict(x) for x in rows]
if tenant_no:
items = _enrich_work_order_qc_targets(db, tenant_no, items)
items = _enrich_work_order_qc_conclusions(db, items)
return items, int(total)
+18
View File
@@ -670,12 +670,26 @@ def list_donations(
if c:
all_sample_codes.append(c)
lab_code_map: Dict[str, str] = {}
reception_summary_map: Dict[str, Dict[str, str]] = {}
qc_status_map: Dict[str, Dict[str, str]] = {}
from app.services.protocol_sample_list_summary import (
build_sample_item_reception_qc_fields,
get_list_qc_status_map_by_sample_codes,
get_list_reception_summary_map_by_sample_codes,
)
if tenant_no and all_sample_codes:
from app.crud import sample_reception as reception_svc
lab_code_map = reception_svc.get_lab_storage_code_map_by_sample_codes(
db, tenant_no, all_sample_codes, reception_source="research_donation"
)
reception_summary_map = get_list_reception_summary_map_by_sample_codes(
db, tenant_no, all_sample_codes, reception_source="research_donation"
)
qc_status_map = get_list_qc_status_map_by_sample_codes(
db, tenant_no, all_sample_codes, reception_source="research_donation"
)
result = []
for r in rows:
@@ -733,6 +747,10 @@ def list_donations(
"sampleStatus": (s.sample_status or "").strip(),
"labStorageCode": lab_code_map.get(code, "") if code else "",
**sample_special_to_dict(s),
**build_sample_item_reception_qc_fields(
reception_summary_map.get(code) if code else None,
qc_status_map.get(code) if code else None,
),
}
)
d["sampleItems"] = sample_items
+100
View File
@@ -18,6 +18,7 @@ from app.services.storage_facility_code import (
cascade_refresh_slot_name_snapshots_for_slots,
decode_slot_layout_order,
encode_slot_layout_order,
load_facility_ancestor_map,
load_facility_map,
validate_node_code,
)
@@ -149,6 +150,105 @@ def create_facility(
return obj
def _format_seq(num: int, pad_width: int) -> str:
s = str(num)
width = int(pad_width or 0)
if width <= 0:
return s
return s.zfill(width)
def batch_create_facilities(
db: Session,
*,
parent_id: str = "0",
name_prefix: str = "",
name_suffix: str = "",
start_num: int,
end_num: int,
pad_width: int = 0,
code_prefix: str = "",
code_suffix: str = "",
node_type: Optional[str] = None,
is_leaf: int = 0,
tenant_no: str = "zkxw",
remark: Optional[str] = None,
user_id: Optional[str] = None,
) -> List[Dict[str, Any]]:
"""按「前缀 + 序号 + 后缀」批量创建同级子节点。"""
if start_num < 0 or end_num < 0:
raise ValueError("序号不能为负数")
if end_num < start_num:
raise ValueError("结束序号不能小于起始序号")
count = end_num - start_num + 1
if count > 200:
raise ValueError("单次最多创建 200 个子节点")
if pad_width < 0 or pad_width > 8:
raise ValueError("位数补零须在 0~8 之间")
pid = (parent_id or "0").strip() or "0"
if pid != "0":
parent = get_facility(db, pid, tenant_no=tenant_no)
if not parent:
raise ValueError("上级节点不存在")
name_prefix = name_prefix or ""
name_suffix = name_suffix or ""
code_prefix = code_prefix or ""
code_suffix = code_suffix or ""
gen_code = bool(code_prefix.strip() or code_suffix.strip())
node_type_val = (node_type or "").strip() or None
remark_val = (remark or "").strip() or None
leaf_val = 1 if int(is_leaf or 0) == 1 else 0
now = datetime.now()
planned: List[tuple[str, str, int]] = []
seen_codes: set[str] = set()
for num in range(start_num, end_num + 1):
seq = _format_seq(num, pad_width)
name = f"{name_prefix}{seq}{name_suffix}".strip()
if not name:
raise ValueError("节点名称不能为空,请填写前缀或后缀")
code = ""
if gen_code:
code = validate_node_code(f"{code_prefix}{seq}{code_suffix}")
if not code:
raise ValueError("节点编号不能为空")
if code in seen_codes:
raise ValueError(f"批次内节点编号重复:{code}")
seen_codes.add(code)
assert_sibling_node_code_unique(
db, parent_id=pid, node_code=code, tenant_no=tenant_no
)
planned.append((name, code, num))
objs: List[BizStorageFacility] = []
for name, code, num in planned:
obj = BizStorageFacility(
id=generate_uuid(),
parent_id=pid,
node_name=name,
node_code=code,
node_type=node_type_val,
is_leaf=leaf_val,
tenant_no=tenant_no,
order_num=num,
remark=remark_val,
create_by=user_id,
create_dept_id="",
create_time=now,
update_by=user_id,
update_time=now,
del_flag=0,
)
db.add(obj)
objs.append(obj)
db.commit()
for obj in objs:
db.refresh(obj)
return [_row_to_dict(obj) for obj in objs]
def update_facility(
db: Session,
node_id: str,
+66 -4
View File
@@ -175,10 +175,11 @@ def _load_cell_product_map(
tenant_no: str,
product_ids: List[str],
) -> Dict[str, Dict[str, Any]]:
ids = [i for i in { (x or "").strip() for x in product_ids } if i]
"""批量加载细胞产品完整信息(一次 enrich,避免 per-id 的 N+1)。"""
ids = [i for i in {(x or "").strip() for x in product_ids} if i]
if not ids:
return {}
from app.crud.cell_product import product_to_response
from app.crud.cell_product import _enrich_product_dicts, _row_to_dict
q = db.query(BizCellProduct).filter(
BizCellProduct.id.in_(ids),
@@ -186,7 +187,58 @@ def _load_cell_product_map(
)
if tenant_no:
q = q.filter(BizCellProduct.tenant_no == tenant_no)
return {p.id: product_to_response(db, tenant_no, p) for p in q.all()}
rows = q.all()
enriched = _enrich_product_dicts(db, tenant_no, [_row_to_dict(p) for p in rows])
return {item["id"]: item for item in enriched if item.get("id")}
def _load_cell_product_shelf_summaries(
db: Session,
tenant_no: str,
product_ids: List[str],
) -> Dict[str, Dict[str, Any]]:
"""库位货架展示专用:仅批量取 id/编码/名称/类型名/批次号(2 次查询)。"""
from app.models.models import BizProductionProductType
ids = [i for i in {(x or "").strip() for x in product_ids} if i]
if not ids:
return {}
q = db.query(
BizCellProduct.id,
BizCellProduct.product_code,
BizCellProduct.product_name,
BizCellProduct.product_type_id,
BizCellProduct.batch_no,
).filter(
BizCellProduct.id.in_(ids),
BizCellProduct.del_flag == 0,
)
if tenant_no:
q = q.filter(BizCellProduct.tenant_no == tenant_no)
products = q.all()
type_ids = {r.product_type_id for r in products if r.product_type_id}
type_map: Dict[str, str] = {}
if type_ids:
type_rows = (
db.query(BizProductionProductType.id, BizProductionProductType.product_type_name)
.filter(
BizProductionProductType.id.in_(type_ids),
BizProductionProductType.del_flag == 0,
)
.all()
)
type_map = {r.id: r.product_type_name or "" for r in type_rows}
return {
r.id: {
"id": r.id,
"productCode": r.product_code or "",
"productName": r.product_name or "",
"productTypeId": r.product_type_id or "",
"productTypeName": type_map.get(r.product_type_id or "", ""),
"batchNo": r.batch_no or "",
}
for r in products
}
def _attach_cell_product_fields(item: Dict[str, Any], cp: Dict[str, Any]) -> None:
@@ -230,6 +282,7 @@ def enrich_slots_with_stored_cell_products(
tenant_no: str,
slots: List[Dict[str, Any]],
) -> List[Dict[str, Any]]:
"""为占用格附带在库物品摘要(名称/类型),供库位货架展示。"""
slot_ids = [s.get("id") for s in slots if int(s.get("occupiedCount") or 0) > 0 and s.get("id")]
if not slot_ids:
return slots
@@ -248,7 +301,8 @@ def enrich_slots_with_stored_cell_products(
for o in occs
if (o.item_type or "") == "cell_product" and (o.item_id or "").strip()
]
cp_map = _load_cell_product_map(db, tenant_no, cp_ids)
# 货架只需名称+类型,勿走完整 product_to_response(会 N+1 拉设施树/任务等)
cp_map = _load_cell_product_shelf_summaries(db, tenant_no, cp_ids)
for slot in slots:
occ = occ_by_slot.get(slot.get("id"))
if not occ:
@@ -260,6 +314,14 @@ def enrich_slots_with_stored_cell_products(
cp = cp_map.get(occ.item_id)
if cp:
slot["storedCellProduct"] = cp
elif occ.item_name or occ.item_code:
# 产品已删时仍用占用快照展示名称
slot["storedCellProduct"] = {
"id": occ.item_id,
"productCode": occ.item_code or "",
"productName": occ.item_name or "",
"productTypeName": "",
}
return slots
+1
View File
@@ -1618,6 +1618,7 @@ class BizQcWorkOrder(Base):
production_task_id = Column(String(64), nullable=True, comment="关联生产任务ID(可选)")
production_step_output_id = Column(String(64), nullable=True, comment="关联生产任务步骤产出物ID(生产过程触发时)")
work_order_status = Column(String(16), nullable=False, default="dpz", comment="工单状态")
conclusion = Column(String(16), nullable=True, comment="质检结论 tg合格 btg不合格")
has_lab = Column(String(1), nullable=False, default="0", comment="含实验室自检")
has_third_party = Column(String(1), nullable=False, default="0", comment="含第三方检测")
configured_time = Column(DateTime, nullable=True, comment="配置时间")
+4 -1
View File
@@ -97,9 +97,12 @@ class ProductionQcWorkOrderCreateBody(BaseModel):
class QcWorkOrderUpdateBody(BaseModel):
"""编辑质检工单(入库/出库可改备注与状态;临时可含质检对象)"""
"""编辑质检工单(入库/出库可改备注、状态与质检结论;临时可含质检对象)"""
model_config = ConfigDict(populate_by_name=True)
cell_product_id: Optional[str] = Field(None, alias="cellProductId", description="质检对象-细胞产品ID")
work_order_status: Optional[str] = Field(None, alias="workOrderStatus", description="工单状态")
qc_conclusion: Optional[str] = Field(
None, alias="qcConclusion", description="质检结论 tg合格 btg不合格,空串清空"
)
remark: Optional[str] = Field(None, description="备注")
@@ -0,0 +1,158 @@
"""协议/捐赠列表卡片:按样本编码批量取接收结论与门禁质检结论(轻量字段)。"""
from __future__ import annotations
from collections import defaultdict
from typing import Any, Dict, List, Optional
from sqlalchemy.orm import Session
from app.models.models import BizQcTask, BizQcWorkOrder, BizSampleReception
from app.services.qc_work_order_conclusion import (
build_qc_conclusion_fields,
work_order_qc_conclusion_label,
)
_ACCEPT_CONCLUSION_LABELS = {"js": "接收", "bj": "拒收"}
_VALID_QC_CONCLUSIONS = frozenset({"tg", "btg"})
def build_sample_item_reception_qc_fields(
reception: Optional[Dict[str, Any]],
qc: Optional[Dict[str, Any]],
) -> Dict[str, Any]:
"""合并接收/质检结论摘要为列表 sampleItems 字段。"""
conclusion = ""
remark = ""
if reception:
conclusion = (reception.get("acceptConclusion") or "").strip()
remark = (reception.get("remark") or "").strip()
qc_code = ""
qc_label = ""
if qc:
qc_code = (qc.get("qcConclusion") or "").strip()
qc_label = (qc.get("qcConclusionLabel") or "").strip()
if qc_code and not qc_label:
qc_label = work_order_qc_conclusion_label(qc_code)
return {
"receptionAcceptConclusion": conclusion,
"receptionAcceptConclusionLabel": _ACCEPT_CONCLUSION_LABELS.get(conclusion, ""),
"receptionRemark": remark,
"qcConclusion": qc_code,
"qcConclusionLabel": qc_label,
}
def get_list_reception_summary_map_by_sample_codes(
db: Session,
tenant_no: str,
sample_codes: List[str],
*,
reception_source: str,
) -> Dict[str, Dict[str, str]]:
"""按租户 + 样本编码 + 来源返回接收摘要(acceptConclusion / remark),同码取首条。"""
codes = list({(c or "").strip() for c in sample_codes if (c or "").strip()})
if not tenant_no or not codes or not (reception_source or "").strip():
return {}
rows = (
db.query(BizSampleReception)
.filter(
BizSampleReception.tenant_no == tenant_no,
BizSampleReception.del_flag == 0,
BizSampleReception.reception_source == reception_source,
BizSampleReception.sample_code.in_(codes),
)
.all()
)
out: Dict[str, Dict[str, str]] = {}
for rec in rows:
code = (rec.sample_code or "").strip()
if not code or code in out:
continue
out[code] = {
"acceptConclusion": (rec.accept_conclusion or "").strip(),
"remark": (rec.remark or "").strip(),
}
return out
def get_list_qc_conclusion_map_by_sample_codes(
db: Session,
tenant_no: str,
sample_codes: List[str],
*,
reception_source: str,
) -> Dict[str, Dict[str, str]]:
"""按租户 + 样本编码 + 来源返回门禁质检结论(优先工单落库,否则由任务派生)。"""
codes = list({(c or "").strip() for c in sample_codes if (c or "").strip()})
if not tenant_no or not codes or not (reception_source or "").strip():
return {}
rows = (
db.query(BizQcWorkOrder)
.filter(
BizQcWorkOrder.tenant_no == tenant_no,
BizQcWorkOrder.del_flag == 0,
BizQcWorkOrder.reception_source == reception_source,
BizQcWorkOrder.trigger_source == "reception",
BizQcWorkOrder.sample_code.in_(codes),
)
.all()
)
code_to_wo: Dict[str, BizQcWorkOrder] = {}
for wo in rows:
code = (wo.sample_code or "").strip()
if code and code not in code_to_wo:
code_to_wo[code] = wo
need_derive_ids: List[str] = []
for wo in code_to_wo.values():
stored = (getattr(wo, "conclusion", None) or "").strip()
if stored not in _VALID_QC_CONCLUSIONS:
wid = (wo.id or "").strip()
if wid:
need_derive_ids.append(wid)
conclusions_by_wo: Dict[str, List[Optional[str]]] = defaultdict(list)
if need_derive_ids:
task_rows = (
db.query(BizQcTask.work_order_id, BizQcTask.conclusion)
.filter(
BizQcTask.del_flag == 0,
BizQcTask.work_order_id.in_(need_derive_ids),
)
.all()
)
for wo_id, conc in task_rows:
wid = (wo_id or "").strip()
if wid:
conclusions_by_wo[wid].append(conc)
out: Dict[str, Dict[str, str]] = {}
for code, wo in code_to_wo.items():
stored = (getattr(wo, "conclusion", None) or "").strip()
if stored in _VALID_QC_CONCLUSIONS:
out[code] = {
"qcConclusion": stored,
"qcConclusionLabel": work_order_qc_conclusion_label(stored),
}
continue
wid = (wo.id or "").strip()
fields = build_qc_conclusion_fields(conclusions_by_wo.get(wid, []))
out[code] = {
"qcConclusion": fields["qcConclusion"],
"qcConclusionLabel": fields["qcConclusionLabel"],
}
return out
# 兼容旧调用名
def get_list_qc_status_map_by_sample_codes(
db: Session,
tenant_no: str,
sample_codes: List[str],
*,
reception_source: str,
) -> Dict[str, Dict[str, str]]:
return get_list_qc_conclusion_map_by_sample_codes(
db, tenant_no, sample_codes, reception_source=reception_source
)
@@ -0,0 +1,36 @@
"""质检工单级结论:由下属任务 conclusion 派生(合格/不合格)。"""
from __future__ import annotations
from typing import Any, Dict, Iterable, List, Optional
_WORK_ORDER_QC_CONCLUSION_LABELS = {
"tg": "合格",
"btg": "不合格",
}
def derive_work_order_qc_conclusion(task_conclusions: Iterable[Optional[str]]) -> str:
"""与短信模块规则一致:任一 btg → btg;全部 tg → tg;否则空。"""
conclusions = [(c or "").strip() for c in task_conclusions]
if not conclusions:
return ""
if any(c == "btg" for c in conclusions):
return "btg"
if all(c == "tg" for c in conclusions):
return "tg"
return ""
def work_order_qc_conclusion_label(code: Optional[str]) -> str:
return _WORK_ORDER_QC_CONCLUSION_LABELS.get((code or "").strip(), "")
def build_qc_conclusion_fields(
task_conclusions: Iterable[Optional[str]],
) -> Dict[str, str]:
code = derive_work_order_qc_conclusion(task_conclusions)
return {
"qcConclusion": code,
"qcConclusionLabel": work_order_qc_conclusion_label(code),
}
@@ -117,6 +117,31 @@ def load_facility_map(db: Session, tenant_no: str) -> Dict[str, BizStorageFacili
return {r.id: r for r in rows}
def load_facility_ancestor_map(
db: Session,
tenant_no: str,
node_id: str,
) -> Dict[str, BizStorageFacility]:
"""仅加载某节点到根的祖先链(含自身),供单节点格子列表拼 fullSlotCode。"""
result: Dict[str, BizStorageFacility] = {}
cur_id = (node_id or "").strip()
while cur_id and cur_id != "0" and cur_id not in result:
row = (
db.query(BizStorageFacility)
.filter(
BizStorageFacility.id == cur_id,
BizStorageFacility.tenant_no == tenant_no,
BizStorageFacility.del_flag == 0,
)
.first()
)
if not row:
break
result[row.id] = row
cur_id = (row.parent_id or "0").strip()
return result
def collect_slot_ids_under_nodes(
db: Session,
node_ids: List[str],
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+100 -90
View File
@@ -1,11 +1,11 @@
# Graph Report - app (2026-07-27)
# Graph Report - app (2026-07-28)
## Corpus Check
- Large corpus: 227 files · ~283,122 words. Semantic extraction will be expensive (many Claude tokens). Consider running on a subfolder, or use --no-semantic to run AST-only.
- Large corpus: 230 files · ~285,344 words. Semantic extraction will be expensive (many Claude tokens). Consider running on a subfolder, or use --no-semantic to run AST-only.
## Summary
- 4823 nodes · 26699 edges · 40 communities detected
- Extraction: 31% EXTRACTED · 69% INFERRED · 0% AMBIGUOUS · INFERRED: 18332 edges (avg confidence: 0.6)
- 4867 nodes · 26933 edges · 42 communities detected
- Extraction: 31% EXTRACTED · 69% INFERRED · 0% AMBIGUOUS · INFERRED: 18498 edges (avg confidence: 0.6)
- Token cost: 0 input · 0 output
## Community Hubs (Navigation)
@@ -43,18 +43,20 @@
- [[_COMMUNITY_Community 31|Community 31]]
- [[_COMMUNITY_Community 32|Community 32]]
- [[_COMMUNITY_Community 33|Community 33]]
- [[_COMMUNITY_Community 36|Community 36]]
- [[_COMMUNITY_Community 37|Community 37]]
- [[_COMMUNITY_Community 34|Community 34]]
- [[_COMMUNITY_Community 35|Community 35]]
- [[_COMMUNITY_Community 38|Community 38]]
- [[_COMMUNITY_Community 39|Community 39]]
- [[_COMMUNITY_Community 40|Community 40]]
- [[_COMMUNITY_Community 41|Community 41]]
- [[_COMMUNITY_Community 42|Community 42]]
- [[_COMMUNITY_Community 43|Community 43]]
## God Nodes (most connected - your core abstractions)
1. `success_response()` - 715 edges
2. `error_response()` - 592 edges
3. `SysUser` - 559 edges
4. `BizQcTaskResult` - 336 edges
1. `success_response()` - 716 edges
2. `error_response()` - 593 edges
3. `SysUser` - 562 edges
4. `BizQcTaskResult` - 338 edges
5. `BizProductionMaterial` - 326 edges
6. `BizProductionMaterialUsage` - 320 edges
7. `BizQcMaterialUsage` - 318 edges
@@ -78,95 +80,95 @@
### Community 0 - "Community 0"
Cohesion: 0.01
Nodes (954): attachment_download_url(), AttachmentDownloadUrlBody, create_dept(), create_dict_data(), create_dict_type(), create_express_company(), create_item_unit(), create_menu() (+946 more)
Nodes (935): attachment_download_url(), create_dept(), create_dict_data(), create_dict_type(), create_express_company(), create_item_unit(), create_menu(), create_post() (+927 more)
### Community 1 - "Community 1"
Cohesion: 0.01
Nodes (656): generate_uuid(), CRUDBase, allocate_next_biz_no(), _format_biz_no(), _prefix_for(), 业务协议号自动生成:XBCC / JZCC + YYYYMMDD + 6 位序号, 原子分配下一个业务协议号。 须在 create 事务内调用;使用 MySQL LAST_INSERT_ID 保证并发安全。, create_cell_sample_type() (+648 more)
Nodes (714): generate_uuid(), ApiRequestLogCRUD, delete(), get_multi_with_filters(), create_cell_sample_type(), get_cell_sample_type(), list_cell_sample_types(), 细胞样本类型 CRUD(biz_cell_sample_type) (+706 more)
### Community 2 - "Community 2"
Cohesion: 0.01
Nodes (625): CellSampleTypeCreateBody, CellSampleTypeUpdateBody, CollectionRegionCreateBody, CollectionRegionUpdateBody, CustomerCreateBody, CustomerUpdateBody, HospitalCreateBody, HospitalUpdateBody (+617 more)
Nodes (584): AttachmentDownloadUrlBody, DeptCreateBody, DeptUpdateBody, DictDataCreateBody, DictDataUpdateBody, DictTypeCreateBody, DictTypeUpdateBody, ExpressCompanyCreateBody (+576 more)
### Community 3 - "Community 3"
Cohesion: 0.06
Nodes (569): BatchRefundFinanceSubmitBody, 细胞存储 — 采集协议单 / 审核 / 财务确认 / 分期预警 API, 持久化协议子资源。 缴费(含明细校验)须在样本之前:明细校验失败时不得已占用样本编码。 各子表 CRUD 内部仍可能分段 commit,创建接, 与列表接口一致:按租户 + 角色数据权限判断是否可访问该协议单。, If mother info exists but no customerId, create a customer record and link it., RefundFinanceSubmitBody, Base, 细胞产品 CRUD(biz_cell_product) (+561 more)
Cohesion: 0.07
Nodes (421): 环境检测 — 检测项维护 + 登记管理 API, 保险公司及险种价格管理 API(保险公司 + 开票信息 + 险种价格), AccessLogCreateBody, AccessLogUpdateBody, CleanRoomCreateBody, CleanRoomUpdateBody, ExhibitionAppointmentCreateBody, ExhibitionAppointmentUpdateBody (+413 more)
### Community 4 - "Community 4"
Cohesion: 0.01
Nodes (313): _normalize_date_bound(), _persist_protocol_sub_resources(), list_ethnics_for_select(), apply_data_scope(), _get_child_dept_ids(), get_user_dept_id(), _resolve_user_role_scopes(), generate_id() (+305 more)
Nodes (346): _normalize_date_bound(), list_ethnics_for_select(), apply_data_scope(), _get_child_dept_ids(), get_user_dept_id(), _resolve_user_role_scopes(), format_date(), generate_id() (+338 more)
### Community 5 - "Community 5"
Cohesion: 0.02
Nodes (231): ApiRequestLogCRUD, delete(), get_multi_with_filters(), batch_options(), _batch_row_to_dict(), _fmt_date(), list_batches(), _batch_line_to_dict() (+223 more)
Cohesion: 0.07
Nodes (297): CellSampleTypeCreateBody, CellSampleTypeUpdateBody, CollectionRegionCreateBody, CollectionRegionUpdateBody, CustomerCreateBody, CustomerUpdateBody, HospitalCreateBody, HospitalUpdateBody (+289 more)
### Community 6 - "Community 6"
Cohesion: 0.02
Nodes (187): eq_unicode(), like_unicode(), MySQL 字符串比较/模糊匹配时统一排序规则,避免 Illegal mix of collations。, 跨表字符串等值比较(JOIN / WHERE)时统一为 utf8mb4_unicode_ci。, 将列显式设为 utf8mb4_unicode_ci。, unicode_ci(), build_void_type_label_map(), format_protocol_status_label() (+179 more)
Nodes (202): eq_unicode(), like_unicode(), MySQL 字符串比较/模糊匹配时统一排序规则,避免 Illegal mix of collations。, 跨表字符串等值比较(JOIN / WHERE)时统一为 utf8mb4_unicode_ci。, 将列显式设为 utf8mb4_unicode_ci。, unicode_ci(), batch_review(), _dec() (+194 more)
### Community 7 - "Community 7"
Cohesion: 0.02
Nodes (111): get_designer_data(), _error_json(), 数据库异常:返回 JSON 并保留 CORS 头,避免浏览器只报跨域错误, 未捕获异常:统一 JSON 500,确保跨域场景下仍有 Access-Control-Allow-Origin, sqlalchemy_exception_handler(), unhandled_exception_handler(), BaseHTTPMiddleware, ApiCryptoError (+103 more)
Nodes (112): get_designer_data(), _error_json(), 数据库异常:返回 JSON 并保留 CORS 头,避免浏览器只报跨域错误, 未捕获异常:统一 JSON 500,确保跨域场景下仍有 Access-Control-Allow-Origin, sqlalchemy_exception_handler(), unhandled_exception_handler(), BaseHTTPMiddleware, parse_admin_request_json() (+104 more)
### Community 8 - "Community 8"
Cohesion: 0.02
Nodes (159): format_date(), join_equipment_ids(), parse_equipment_ids(), 工艺/步骤设备多选:逗号分隔 ID 与名称快照解析, 校验设备列表,返回 (equipment_ids 逗号串, equipment_name 逗号串快照)。, resolve_equipment_list_snapshot(), _fmt_dt(), get_handover_by_schedule() (+151 more)
Cohesion: 0.03
Nodes (135): get_next_cell_product_code(), _ancestor_link_from_cell_product_input(), _ancestor_sample_chain_link(), _apply_cell_product_status_change(), _build_ancestor_chain(), _build_descendant_chain(), _build_facility_path_label(), build_split_product_codes() (+127 more)
### Community 9 - "Community 9"
Cohesion: 0.04
Nodes (97): 发起前预览审批链(条件齐后解析最终路径与审批人)。, 兼容旧 GET:无 formData,含条件分支时多为待确定占位。, _find_latest_published(), list_oa_role_user_ids(), _active_user_id(), OA 审批人解析(不读 sys_role), 按节点 approverConfig 解析处理人。 assigneeType: users | oa_roles | dept_leader | dir, resolve_assignees() (+89 more)
Nodes (114): _app_to_dict(), create_app(), _create_version(), delete_app(), delete_group(), delete_role(), _dumps(), ensure_presets() (+106 more)
### Community 10 - "Community 10"
Cohesion: 0.05
Nodes (104): AccessLogCreateBody, AccessLogUpdateBody, CleanRoomCreateBody, CleanRoomUpdateBody, ExhibitionAppointmentCreateBody, ExhibitionAppointmentUpdateBody, list_storage_slot_stats(), OccupancyCreateBody (+96 more)
Cohesion: 0.04
Nodes (114): build_void_type_label_map(), format_protocol_status_label(), resolve_void_type_label(), join_equipment_ids(), parse_equipment_ids(), 工艺/步骤设备多选:逗号分隔 ID 与名称快照解析, 校验设备列表,返回 (equipment_ids 逗号串, equipment_name 逗号串快照)。, resolve_equipment_list_snapshot() (+106 more)
### Community 11 - "Community 11"
Cohesion: 0.05
Nodes (71): _avatar_url_field(), _build_current_user_payload(), _build_user_info_payload(), get_current_user_profile(), _jwt_user_payload(), logout(), 公共接口(Web 登录、刷新 Token、登出;用户模型对齐 docs/sql/zkxw.sql 基线), Web 端登录用 RSA 公钥(PKCS#1 v1.5,与 JSEncrypt 一致) (+63 more)
Cohesion: 0.04
Nodes (84): _avatar_url_field(), _build_current_user_payload(), _build_user_info_payload(), get_current_user_profile(), get_web_auth_menu_codes(), _jwt_user_payload(), logout(), 公共接口(Web 登录、刷新 Token、登出;用户模型对齐 docs/sql/zkxw.sql 基线) (+76 more)
### Community 12 - "Community 12"
Cohesion: 0.06
Nodes (70): get_next_cell_product_code(), _ancestor_link_from_cell_product_input(), _ancestor_sample_chain_link(), _apply_cell_product_status_change(), _build_ancestor_chain(), _build_descendant_chain(), _build_facility_path_label(), build_split_product_codes() (+62 more)
Cohesion: 0.45
Nodes (71): BatchStockInBody, BatchStockInItem, BatchStockOutBody, BatchStockOutItem, ConsumableCreateBody, ConsumablePackCreateBody, ConsumablePackUpdateBody, ConsumableUpdateBody (+63 more)
### Community 13 - "Community 13"
Cohesion: 0.08
Nodes (51): auto_create_payment(), complete_application(), create_basic_experiment_sale_schedules(), create_infusion_plan(), create_schedule(), _create_schedule_products(), _format_yyyy_mm_dd(), _generate_application_no() (+43 more)
Cohesion: 0.06
Nodes (70): api_save_application(), auto_generate_schedules(), complete_application(), create_application(), create_basic_experiment_sale_schedules(), create_infusion_plan(), create_schedule(), _create_schedule_products() (+62 more)
### Community 14 - "Community 14"
Cohesion: 0.11
Nodes (39): _amount_for_row(), _batch_map(), deduct_for_task(), _deduct_task_usage_legacy_batch(), _display_remark(), _fmt_date_val(), _linked_qc_task_no_map(), list_linked_task_usages() (+31 more)
Cohesion: 0.07
Nodes (51): _fmt_dt(), get_handover_by_schedule(), get_outbound_handover(), get_outbound_handover_view(), _handover_row_to_dict(), _handover_view_dict(), _parse_handover_time(), 供输注计划 detail 聚合的交接只读信息。 (+43 more)
### Community 15 - "Community 15"
Cohesion: 0.12
Nodes (11): get_wechat_pay_client(), get_wechat_pay_v2(), 微信支付工具模块 支持微信支付 V3 API 文档参考: https://pay.weixin.qq.com/docs/v3/apis/index.ht, 统一下单接口 (V3) Args: out_trade_no: 商户订单号 total, 申请退款 Args: out_trade_no: 商户订单号 total_amount, 小程序调起支付的二次签名参数(与公众号 JSAPI 规则一致), 统一下单 (V2 API) Args: out_trade_no: 商户订单号 tot, 生成签名 V3 (SHA256 with RSA) (+3 more)
Nodes (10): get_wechat_pay_client(), get_wechat_pay_v2(), 微信支付工具模块 支持微信支付 V3 API 文档参考: https://pay.weixin.qq.com/docs/v3/apis/index.ht, 统一下单接口 (V3) Args: out_trade_no: 商户订单号 total, 小程序调起支付的二次签名参数(与公众号 JSAPI 规则一致), 统一下单 (V2 API) Args: out_trade_no: 商户订单号 tot, 生成签名 V3 (SHA256 with RSA), wechat_pay() (+2 more)
### Community 16 - "Community 16"
Cohesion: 0.16
Nodes (22): _code_exists(), create_material(), _dec(), _fmt_dt(), get_material(), get_material_entity(), get_my_usages(), _is_enabled_status() (+14 more)
Cohesion: 0.19
Nodes (27): _amount_for_row(), _batch_map(), deduct_for_task(), _deduct_task_usage_legacy_batch(), _display_remark(), _fmt_date_val(), _linked_qc_task_no_map(), list_linked_task_usages() (+19 more)
### Community 17 - "Community 17"
Cohesion: 0.21
Nodes (20): _body_to_payload(), _get_current_user_id(), get_production_reception_detail(), _get_tenant_no(), post_production_reception(), put_production_reception(), _resolve_reception_id(), _apply_payload_to_row() (+12 more)
Cohesion: 0.19
Nodes (23): add_step(), copy_step(), _create_step_consumable(), _create_step_data_collection(), _create_step_output(), _create_step_reagent(), get_route(), get_route_detail() (+15 more)
### Community 18 - "Community 18"
Cohesion: 0.17
Nodes (19): batch_create_checkups(), create_checkup(), delete_actual_item(), delete_reserve_item(), get_checkup_by_application(), get_checkup_by_id(), list_actual_items(), list_checkups_paginated() (+11 more)
### Community 19 - "Community 19"
Cohesion: 0.21
Nodes (19): _consumable_row_to_dict(), create_process(), _create_sub_consumable(), _create_sub_data_collection(), _create_sub_output(), _create_sub_reagent(), _data_collection_row_to_dict(), get_process() (+11 more)
### Community 19 - "Community 19"
Cohesion: 0.25
Nodes (18): _amount_for_row(), _batch_map(), _display_remark(), _fmt_date_val(), list_stock_check_requisitions(), list_usages(), _list_usages_query(), mark_requisition_fully_used() (+10 more)
### Community 20 - "Community 20"
Cohesion: 0.24
Nodes (16): count_fillable_fields(), _extract_rules(), index_condition_fields(), _node_type(), normalize_use_in_condition_required(), publish_app(), field -> rule(仅 useInCondition 且 type 合格), 就地/深拷贝皆可:打标字段强制 required/$required。发布前调用。 (+8 more)
Cohesion: 0.2
Nodes (19): _code_exists(), create_material(), _dec(), _fmt_dt(), get_material(), get_material_entity(), get_my_usages(), _is_enabled_status() (+11 more)
### Community 21 - "Community 21"
Cohesion: 0.24
Nodes (9): 微信消息通知服务 支持微信小程序模板消息推送 使用方式: from app.core.wechat_message import Wech, 发送模板消息 Args: openid: 用户openid templ, send_delivery_notice(), send_delivery_warning(), send_order_status(), send_payment_success(), send_refund_result(), send_urge_notification() (+1 more)
Cohesion: 0.23
Nodes (17): _apply_qc_status_filter(), _base_query(), _derive_qc_conclusion(), _ensure_notification(), _eq_ci(), _fetch_completed_tasks(), _fmt_dt(), generate_sms_content() (+9 more)
### Community 22 - "Community 22"
Cohesion: 0.23
Nodes (12): Config, ProductBase, ProductCategoryBase, ProductCategoryCreate, ProductCategoryResponse, ProductCreate, ProductResponse, ProductUnitBase (+4 more)
Cohesion: 0.24
Nodes (9): 微信消息通知服务 支持微信小程序模板消息推送 使用方式: from app.core.wechat_message import Wech, 发送模板消息 Args: openid: 用户openid templ, send_delivery_notice(), send_delivery_warning(), send_order_status(), send_payment_success(), send_refund_result(), send_urge_notification() (+1 more)
### Community 23 - "Community 23"
Cohesion: 0.24
@@ -177,107 +179,115 @@ Cohesion: 0.24
Nodes (11): deduct_for_step(), _display_remark(), list_stock_logs(), _parse_receiver_purpose_from_remark(), 耗材变动记录 CRUD(biz_consumable_stock_log), 撤销步骤此前 step_save 扣减,便于重新填报。, 扣减耗材库存并生成变动记录。调用方控制事务,本函数不 commit。, _resolve_receiver_purpose() (+3 more)
### Community 25 - "Community 25"
Cohesion: 0.27
Nodes (11): _build_tree(), _cascade_soft_delete(), _collect_with_ancestors(), create_dept(), get_dept(), list_depts(), list_depts_tree(), 保留匹配节点及其全部上级,供关键词检索后仍能正确组树。 (+3 more)
Cohesion: 0.31
Nodes (10): _build_tree(), _cascade_soft_delete(), _collect_with_ancestors(), get_dept(), list_depts(), list_depts_tree(), 保留匹配节点及其全部上级,供关键词检索后仍能正确组树。, _row_to_dict() (+2 more)
### Community 26 - "Community 26"
Cohesion: 0.33
Nodes (8): _build_tree(), _cascade_soft_delete(), get_menu(), list_menus(), list_menus_tree(), _row_to_dict(), soft_delete_menu(), update_menu()
### Community 27 - "Community 27"
Cohesion: 0.29
Nodes (2): BaseModel, SoftDeleteModel
### Community 27 - "Community 27"
### Community 28 - "Community 28"
Cohesion: 0.38
Nodes (6): derive_legacy_status_from_three(), derive_three_status_from_legacy(), 阶段A兼容:从旧 status 推导三字段。 约束:旧 status 本身混合了支付/配送/订单生命周期,因此只能尽力推断; 若业务侧已有更精确, 阶段A兼容:从三字段反推旧 status(用于旧前端/旧筛选参数兼容)。, ThreeStatus, _to_decimal()
### Community 28 - "Community 28"
### Community 29 - "Community 29"
Cohesion: 0.6
Nodes (5): _dec(), _fmt_dt(), list_stock_logs(), _row_to_dict(), _user_nick_name_map()
### Community 30 - "Community 30"
Cohesion: 0.5
Nodes (3): BaseSettings, Config, Settings
### Community 29 - "Community 29"
### Community 31 - "Community 31"
Cohesion: 0.5
Nodes (2): _auto_fill_create_dept_id(), ORM before_insert 钩子:当 create_dept_id 为空时,自动从请求上下文填充当前用户部门 ID
### Community 30 - "Community 30"
### Community 32 - "Community 32"
Cohesion: 0.67
Nodes (2): get_menu_list(), 运营端菜单接口(与 web-admin 前端静态路由 sqxp.ts 对齐,5 个一级菜单分组)
### Community 31 - "Community 31"
### Community 33 - "Community 33"
Cohesion: 1.0
Nodes (1): 质检物料金额查看授权:专用角色与菜单权限常量。
### Community 32 - "Community 32"
### Community 34 - "Community 34"
Cohesion: 1.0
Nodes (1): 请求级别的用户上下文变量 通过 contextvars 在请求处理链路中传递当前用户信息, 供 SQLAlchemy 事件监听器等底层机制使用,避免逐层手动传
### Community 33 - "Community 33"
### Community 35 - "Community 35"
Cohesion: 1.0
Nodes (1): API 路由包(骨架:公共鉴权 + 静态菜单 + 运营端占位)
### Community 36 - "Community 36"
### Community 38 - "Community 38"
Cohesion: 1.0
Nodes (1): 发送订单状态通知 Args: openid: 用户openid ord
### Community 37 - "Community 37"
### Community 39 - "Community 39"
Cohesion: 1.0
Nodes (1): 发送支付成功通知 Args: openid: 用户openid ord
### Community 38 - "Community 38"
### Community 40 - "Community 40"
Cohesion: 1.0
Nodes (1): 发送配送通知 Args: openid: 配送员openid task
### Community 39 - "Community 39"
### Community 41 - "Community 41"
Cohesion: 1.0
Nodes (1): 发送配送时效预警 Args: openid: 配送员openid ta
### Community 40 - "Community 40"
### Community 42 - "Community 42"
Cohesion: 1.0
Nodes (1): 发送退款结果通知 Args: openid: 用户openid ord
### Community 41 - "Community 41"
### Community 43 - "Community 43"
Cohesion: 1.0
Nodes (1): 发送催单通知给配送员 Args: deliver_openid: 配送员openid
## Knowledge Gaps
- **137 isolated node(s):** `刷新会话 TTL(refreshToken 续期;已登录用户每次 API 校验通过后滑动续期)`, `写入 refreshToken(用于 one-time 使用/吊销)`, `根据 token 获取当前用户(包含 Redis 会话校验;会话滑动续期)`, `登录凭据 RSA 解密(与前端 JSEncrypt PKCS#1 v1.5 兼容)。`, `加载 RSA 密钥对:优先环境变量,否则使用内置固定默认密钥。` (+132 more)
- **141 isolated node(s):** `刷新会话 TTL(refreshToken 续期;已登录用户每次 API 校验通过后滑动续期)`, `写入 refreshToken(用于 one-time 使用/吊销)`, `根据 token 获取当前用户(包含 Redis 会话校验;会话滑动续期)`, `登录凭据 RSA 解密(与前端 JSEncrypt PKCS#1 v1.5 兼容)。`, `加载 RSA 密钥对:优先环境变量,否则使用内置固定默认密钥。` (+136 more)
These have ≤1 connection - possible missing edges or undocumented components.
- **Thin community `Community 26`** (8 nodes): `BaseModel`, `.to_dict()`, `get_active()`, `base.py`, `SoftDeleteModel`, `.restore()`, `.soft_delete()`, `__tablename__()`
- **Thin community `Community 27`** (8 nodes): `BaseModel`, `.to_dict()`, `get_active()`, `base.py`, `SoftDeleteModel`, `.restore()`, `.soft_delete()`, `__tablename__()`
Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 29`** (4 nodes): `_auto_fill_create_dept_id()`, `get_db()`, `database.py`, `ORM before_insert 钩子:当 create_dept_id 为空时,自动从请求上下文填充当前用户部门 ID`
- **Thin community `Community 31`** (4 nodes): `_auto_fill_create_dept_id()`, `get_db()`, `database.py`, `ORM before_insert 钩子:当 create_dept_id 为空时,自动从请求上下文填充当前用户部门 ID`
Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 30`** (3 nodes): `get_menu_list()`, `menu.py`, `运营端菜单接口(与 web-admin 前端静态路由 sqxp.ts 对齐,5 个一级菜单分组)`
- **Thin community `Community 32`** (3 nodes): `get_menu_list()`, `menu.py`, `运营端菜单接口(与 web-admin 前端静态路由 sqxp.ts 对齐,5 个一级菜单分组)`
Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 31`** (2 nodes): `qc_material_amount_auth_constants.py`, `质检物料金额查看授权:专用角色与菜单权限常量。`
- **Thin community `Community 33`** (2 nodes): `qc_material_amount_auth_constants.py`, `质检物料金额查看授权:专用角色与菜单权限常量。`
Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 32`** (2 nodes): `context.py`, `请求级别的用户上下文变量 通过 contextvars 在请求处理链路中传递当前用户信息, 供 SQLAlchemy 事件监听器等底层机制使用,避免逐层手动传`
- **Thin community `Community 34`** (2 nodes): `context.py`, `请求级别的用户上下文变量 通过 contextvars 在请求处理链路中传递当前用户信息, 供 SQLAlchemy 事件监听器等底层机制使用,避免逐层手动传`
Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 33`** (2 nodes): `__init__.py`, `API 路由包(骨架:公共鉴权 + 静态菜单 + 运营端占位)`
- **Thin community `Community 35`** (2 nodes): `__init__.py`, `API 路由包(骨架:公共鉴权 + 静态菜单 + 运营端占位)`
Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 36`** (1 nodes): `发送订单状态通知 Args: openid: 用户openid ord`
- **Thin community `Community 38`** (1 nodes): `发送订单状态通知 Args: openid: 用户openid ord`
Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 37`** (1 nodes): `发送支付成功通知 Args: openid: 用户openid ord`
- **Thin community `Community 39`** (1 nodes): `发送支付成功通知 Args: openid: 用户openid ord`
Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 38`** (1 nodes): `发送配送通知 Args: openid: 配送员openid task`
- **Thin community `Community 40`** (1 nodes): `发送配送通知 Args: openid: 配送员openid task`
Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 39`** (1 nodes): `发送配送时效预警 Args: openid: 配送员openid ta`
- **Thin community `Community 41`** (1 nodes): `发送配送时效预警 Args: openid: 配送员openid ta`
Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 40`** (1 nodes): `发送退款结果通知 Args: openid: 用户openid ord`
- **Thin community `Community 42`** (1 nodes): `发送退款结果通知 Args: openid: 用户openid ord`
Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 41`** (1 nodes): `发送催单通知给配送员 Args: deliver_openid: 配送员openid`
- **Thin community `Community 43`** (1 nodes): `发送催单通知给配送员 Args: deliver_openid: 配送员openid`
Too small to be a meaningful cluster - may be noise or needs more connections extracted.
## Suggested Questions
_Questions this graph is uniquely positioned to answer:_
- **Why does `SysUser` connect `Community 2` to `Community 0`, `Community 1`, `Community 3`, `Community 5`, `Community 6`, `Community 8`, `Community 9`, `Community 10`, `Community 11`, `Community 14`, `Community 16`, `Community 19`, `Community 23`, `Community 24`?**
_High betweenness centrality (0.122) - this node is a cross-community bridge._
- **Why does `success_response()` connect `Community 0` to `Community 2`, `Community 4`, `Community 7`, `Community 10`, `Community 11`, `Community 12`, `Community 17`, `Community 30`?**
_High betweenness centrality (0.053) - this node is a cross-community bridge._
- **Why does `generate_uuid()` connect `Community 1` to `Community 0`, `Community 2`, `Community 3`, `Community 4`, `Community 5`, `Community 6`, `Community 7`, `Community 8`, `Community 9`, `Community 10`, `Community 11`, `Community 12`, `Community 14`, `Community 16`, `Community 17`, `Community 18`, `Community 23`, `Community 24`, `Community 25`?**
_High betweenness centrality (0.044) - this node is a cross-community bridge._
- **Are the 793 inferred relationships involving `str` (e.g. with `unhandled_exception_handler()` and `get_current_user_by_token()`) actually correct?**
_`str` has 793 INFERRED edges - model-reasoned connections that need verification._
- **Are the 714 inferred relationships involving `success_response()` (e.g. with `list_storage_release_reviews()` and `get_storage_release_review_detail()`) actually correct?**
_`success_response()` has 714 INFERRED edges - model-reasoned connections that need verification._
- **Are the 591 inferred relationships involving `error_response()` (e.g. with `_json_error_response()` and `list_storage_release_reviews()`) actually correct?**
_`error_response()` has 591 INFERRED edges - model-reasoned connections that need verification._
- **Are the 557 inferred relationships involving `SysUser` (e.g. with `数据权限过滤(V0.3:基于角色 data_scope 的查询级行级过滤) data_scope 值: 1 = 全部数据 2 = 本部门数据 3` and `从 SysUser 读取用户的 dept_id。`) actually correct?**
_`SysUser` has 557 INFERRED edges - model-reasoned connections that need verification._
- **Why does `SysUser` connect `Community 2` to `Community 1`, `Community 3`, `Community 4`, `Community 5`, `Community 7`, `Community 9`, `Community 11`, `Community 12`, `Community 14`, `Community 23`, `Community 24`?**
_High betweenness centrality (0.134) - this node is a cross-community bridge._
- **Why does `generate_uuid()` connect `Community 1` to `Community 0`, `Community 4`, `Community 5`, `Community 6`, `Community 7`, `Community 8`, `Community 9`, `Community 10`, `Community 11`, `Community 13`, `Community 14`, `Community 16`, `Community 17`, `Community 19`, `Community 20`, `Community 21`, `Community 23`, `Community 24`?**
_High betweenness centrality (0.045) - this node is a cross-community bridge._
- **Why does `success_response()` connect `Community 0` to `Community 32`, `Community 2`, `Community 4`, `Community 7`, `Community 8`, `Community 11`, `Community 13`?**
_High betweenness centrality (0.037) - this node is a cross-community bridge._
- **Are the 798 inferred relationships involving `str` (e.g. with `unhandled_exception_handler()` and `get_current_user_by_token()`) actually correct?**
_`str` has 798 INFERRED edges - model-reasoned connections that need verification._
- **Are the 715 inferred relationships involving `success_response()` (e.g. with `list_storage_release_reviews()` and `get_storage_release_review_detail()`) actually correct?**
_`success_response()` has 715 INFERRED edges - model-reasoned connections that need verification._
- **Are the 592 inferred relationships involving `error_response()` (e.g. with `_json_error_response()` and `list_storage_release_reviews()`) actually correct?**
_`error_response()` has 592 INFERRED edges - model-reasoned connections that need verification._
- **Are the 560 inferred relationships involving `SysUser` (e.g. with `数据权限过滤(V0.3:基于角色 data_scope 的查询级行级过滤) data_scope 值: 1 = 全部数据 2 = 本部门数据 3` and `从 SysUser 读取用户的 dept_id。`) actually correct?**
_`SysUser` has 560 INFERRED edges - model-reasoned connections that need verification._
+4 -4
View File
@@ -57,12 +57,12 @@
</div>
<div id="legend"></div>
</div>
<div id="stats">4823 nodes &middot; 26699 edges &middot; 46 communities</div>
<div id="stats">4867 nodes &middot; 26933 edges &middot; 48 communities</div>
</div>
<script>
const RAW_NODES = [{"id": "init_py", "label": "__init__.py", "color": {"background": "#59A14F", "border": "#59A14F", "highlight": {"background": "#ffffff", "border": "#59A14F"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "__init__.py", "community": 34, "community_name": "Community 34", "source_file": "__init__.py", "file_type": "code", "degree": 0}, {"id": "main_py", "label": "main.py", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.3, "font": {"size": 0, "color": "#ffffff"}, "title": "main.py", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 7}, {"id": "app_main_lifespan", "label": "lifespan()", "color": {"background": "#F28E2B", "border": "#F28E2B", "highlight": {"background": "#ffffff", "border": "#F28E2B"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "lifespan()", "community": 11, "community_name": "Community 11", "source_file": "main.py", "file_type": "code", "degree": 4}, {"id": "app_main_error_json", "label": "_error_json()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "_error_json()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 3}, {"id": "app_main_sqlalchemy_exception_handler", "label": "sqlalchemy_exception_handler()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "sqlalchemy_exception_handler()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 4}, {"id": "app_main_unhandled_exception_handler", "label": "unhandled_exception_handler()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.2, "font": {"size": 0, "color": "#ffffff"}, "title": "unhandled_exception_handler()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 5}, {"id": "app_main_mask_secret", "label": "_mask_secret()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "_mask_secret()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 1}, {"id": "app_main_root", "label": "root()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "root()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 1}, {"id": "app_main_health_check", "label": "health_check()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "health_check()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 1}, {"id": "app_main_rationale_81", "label": "\u6570\u636e\u5e93\u5f02\u5e38\uff1a\u8fd4\u56de JSON \u5e76\u4fdd\u7559 CORS \u5934\uff0c\u907f\u514d\u6d4f\u89c8\u5668\u53ea\u62a5\u8de8\u57df\u9519\u8bef", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "\u6570\u636e\u5e93\u5f02\u5e38\uff1a\u8fd4\u56de JSON \u5e76\u4fdd\u7559 CORS \u5934\uff0c\u907f\u514d\u6d4f\u89c8\u5668\u53ea\u62a5\u8de8\u57df\u9519\u8bef", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "rationale", "degree": 3}, {"id": "app_main_rationale_92", "label": "\u672a\u6355\u83b7\u5f02\u5e38\uff1a\u7edf\u4e00 JSON 500\uff0c\u786e\u4fdd\u8de8\u57df\u573a\u666f\u4e0b\u4ecd\u6709 Access-Control-Allow-Origin", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "\u672a\u6355\u83b7\u5f02\u5e38\uff1a\u7edf\u4e00 JSON 500\uff0c\u786e\u4fdd\u8de8\u57df\u573a\u666f\u4e0b\u4ecd\u6709 Access-Control-Allow-Origin", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "rationale", "degree": 3}, {"id": "tasks_init_py", "label": "__init__.py", "color": {"background": "#F28E2B", "border": "#F28E2B", "highlight": {"background": "#ffffff", "border": "#F28E2B"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "__init__.py", "community": 11, "community_name": "Community 11", "source_file": "tasks/__init__.py", "file_type": "code", Line truncated
const RAW_EDGES = [{"from": "main_py", "to": "app_main_lifespan", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_error_json", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_sqlalchemy_exception_handler", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_unhandled_exception_handler", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_mask_secret", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_root", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_health_check", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_lifespan", "to": "core_login_crypto_ensure_initialized", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_lifespan", "to": "tasks_init_init_scheduled_tasks", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_lifespan", "to": "tasks_init_shutdown_scheduler", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_error_json", "to": "app_main_sqlalchemy_exception_handler", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_error_json", "to": "app_main_unhandled_exception_handler", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_sqlalchemy_exception_handler", "to": "app_main_rationale_81", "label": "rationale_for", "title": "rationale_for [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_sqlalchemy_exception_handler", "to": "exception", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_unhandled_exception_handler", "to": "app_main_rationale_92", "label": "rationale_for", "title": "rationale_for [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_unhandled_exception_handler", "to": "exception", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_unhandled_exception_handler", "to": "str", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_81", "to": "core_api_request_log_middleware_apirequestlogmiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_81", "to": "core_api_crypto_middleware_apicryptomiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_92", "to": "core_api_request_log_middleware_apirequestlogmiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_92", "to": "core_api_crypto_middleware_apicryptomiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "tasks_init_py", "to": "tasks_init_init_scheduled_tasks", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "tasks_init_py", "to": "tasks_init_shutdown_scheduler", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "core_auth_py", "to": "core_auth_redis_session_enabled", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "core_auth_py", "to": "core_auth_get_redis_client", "labeLine truncated
const LEGEND = [{"cid": 0, "color": "#4E79A7", "label": "Community 0", "count": 989}, {"cid": 1, "color": "#F28E2B", "label": "Community 1", "count": 740}, {"cid": 2, "color": "#E15759", "label": "Community 2", "count": 662}, {"cid": 3, "color": "#76B7B2", "label": "Community 3", "count": 575}, {"cid": 4, "color": "#59A14F", "label": "Community 4", "count": 354}, {"cid": 5, "color": "#EDC948", "label": "Community 5", "count": 248}, {"cid": 6, "color": "#B07AA1", "label": "Community 6", "count": 199}, {"cid": 7, "color": "#FF9DA7", "label": "Community 7", "count": 179}, {"cid": 8, "color": "#9C755F", "label": "Community 8", "count": 168}, {"cid": 9, "color": "#BAB0AC", "label": "Community 9", "count": 117}, {"cid": 10, "color": "#4E79A7", "label": "Community 10", "count": 107}, {"cid": 11, "color": "#F28E2B", "label": "Community 11", "count": 79}, {"cid": 12, "color": "#E15759", "label": "Community 12", "count": 74}, {"cid": 13, "color": "#76B7B2", "label": "Community 13", "count": 53}, {"cid": 14, "color": "#59A14F", "label": "Community 14", "count": 40}, {"cid": 15, "color": "#EDC948", "label": "Community 15", "count": 31}, {"cid": 16, "color": "#B07AA1", "label": "Community 16", "count": 23}, {"cid": 17, "color": "#FF9DA7", "label": "Community 17", "count": 22}, {"cid": 18, "color": "#9C755F", "label": "Community 18", "count": 21}, {"cid": 19, "color": "#BAB0AC", "label": "Community 19", "count": 19}, {"cid": 20, "color": "#4E79A7", "label": "Community 20", "count": 17}, {"cid": 21, "color": "#F28E2B", "label": "Community 21", "count": 13}, {"cid": 22, "color": "#E15759", "label": "Community 22", "count": 13}, {"cid": 23, "color": "#76B7B2", "label": "Community 23", "count": 12}, {"cid": 24, "color": "#59A14F", "label": "Community 24", "count": 12}, {"cid": 25, "color": "#EDC948", "label": "Community 25", "count": 12}, {"cid": 26, "color": "#B07AA1", "label": "Community 26", "count": 8}, {"cid": 27, "color": "#FF9DA7", "label": "Community 27", "count": 7}, {"cid": 28, "color": "#9C755F", "label": "Community 28", "count": 4}, {"cid": 29, "color": "#BAB0AC", "label": "Community 29", "count": 4}, {"cid": 30, "color": "#4E79A7", "label": "Community 30", "count": 3}, {"cid": 31, "color": "#F28E2B", "label": "Community 31", "count": 2}, {"cid": 32, "color": "#E15759", "label": "Community 32", "count": 2}, {"cid": 33, "color": "#76B7B2", "label": "Community 33", "count": 2}, {"cid": 34, "color": "#59A14F", "label": "Community 34", "count": 1}, {"cid": 35, "color": "#EDC948", "label": "Community 35", "count": 1}, {"cid": 36, "color": "#B07AA1", "label": "Community 36", "count": 1}, {"cid": 37, "color": "#FF9DA7", "label": "Community 37", "count": 1}, {"cid": 38, "color": "#9C755F", "label": "Community 38", "count": 1}, {"cid": 39, "color": "#BAB0AC", "label": "Community 39", "count": 1}, {"cid": 40, "color": "#4E79A7", "label": "Community 40", "count": 1}, {"cid": 41, "color": "#F28E2B", "label": "Community 41", "count": 1}, {"cid": 42, "color": "#E15759", "label": "Community 42", "count": 1}, {"cid": 43, "color": "#76B7B2", "label": "Community 43", "count": 1}, {"cid": 44, "color": "#59A14F", "label": "Community 44", "count": 1}, {"cid": 45, "color": "#EDC948", "label": "Community 45", "count": 1}, {"cid": 46, "color": "#B07AA1", "label": "Community 46", "count": 0}, {"cid": 47, "color": "#FF9DA7", "label": "Community 47", "count": 0}, {"cid": 48, "color": "#9C755F", "label": "Community 48", "count": 0}, {"cid": 49, "color": "#BAB0AC", "label": "Community 49", "count": 0}, {"cid": 50, "color": "#4E79A7", "label": "Community 50", "count": 0}, {"cid": 51, "color": "#F28E2B", "label": "Community 51", "count": 0}, {"cid": 52, "color": "#E15759", "label": "Community 52", "count": 0}, {"cid": 53, "color": "#76B7B2", "label": "Community 53", "count": 0}, {"cid": 54, "color": "#59A14F", "label": "Community 54", "count": 0}, {"cid": 55, "color": "#EDC948", "label": "Community 55", "count": 0}, {"cid": 56, "color": "#B07AA1", "label": "Community 56", "count": 0}, {"cid": 57, "color": "#FF9DA7", "label": "Community 57", "count": 0}, {"cid": 58, "color": "#9C755F", "label": "Community 58", "count": 0}];
const RAW_NODES = [{"id": "init_py", "label": "__init__.py", "color": {"background": "#B07AA1", "border": "#B07AA1", "highlight": {"background": "#ffffff", "border": "#B07AA1"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "__init__.py", "community": 36, "community_name": "Community 36", "source_file": "__init__.py", "file_type": "code", "degree": 0}, {"id": "main_py", "label": "main.py", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.2, "font": {"size": 0, "color": "#ffffff"}, "title": "main.py", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 7}, {"id": "app_main_lifespan", "label": "lifespan()", "color": {"background": "#F28E2B", "border": "#F28E2B", "highlight": {"background": "#ffffff", "border": "#F28E2B"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "lifespan()", "community": 11, "community_name": "Community 11", "source_file": "main.py", "file_type": "code", "degree": 4}, {"id": "app_main_error_json", "label": "_error_json()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "_error_json()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 3}, {"id": "app_main_sqlalchemy_exception_handler", "label": "sqlalchemy_exception_handler()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "sqlalchemy_exception_handler()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 4}, {"id": "app_main_unhandled_exception_handler", "label": "unhandled_exception_handler()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.2, "font": {"size": 0, "color": "#ffffff"}, "title": "unhandled_exception_handler()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 5}, {"id": "app_main_mask_secret", "label": "_mask_secret()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "_mask_secret()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 1}, {"id": "app_main_root", "label": "root()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "root()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 1}, {"id": "app_main_health_check", "label": "health_check()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "health_check()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 1}, {"id": "app_main_rationale_81", "label": "\u6570\u636e\u5e93\u5f02\u5e38\uff1a\u8fd4\u56de JSON \u5e76\u4fdd\u7559 CORS \u5934\uff0c\u907f\u514d\u6d4f\u89c8\u5668\u53ea\u62a5\u8de8\u57df\u9519\u8bef", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "\u6570\u636e\u5e93\u5f02\u5e38\uff1a\u8fd4\u56de JSON \u5e76\u4fdd\u7559 CORS \u5934\uff0c\u907f\u514d\u6d4f\u89c8\u5668\u53ea\u62a5\u8de8\u57df\u9519\u8bef", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "rationale", "degree": 3}, {"id": "app_main_rationale_92", "label": "\u672a\u6355\u83b7\u5f02\u5e38\uff1a\u7edf\u4e00 JSON 500\uff0c\u786e\u4fdd\u8de8\u57df\u573a\u666f\u4e0b\u4ecd\u6709 Access-Control-Allow-Origin", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "\u672a\u6355\u83b7\u5f02\u5e38\uff1a\u7edf\u4e00 JSON 500\uff0c\u786e\u4fdd\u8de8\u57df\u573a\u666f\u4e0b\u4ecd\u6709 Access-Control-Allow-Origin", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "rationale", "degree": 3}, {"id": "tasks_init_py", "label": "__init__.py", "color": {"background": "#F28E2B", "border": "#F28E2B", "highlight": {"background": "#ffffff", "border": "#F28E2B"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "__init__.py", "community": 11, "community_name": "Community 11", "source_file": "tasks/__init__.py", "file_type": "code", Line truncated
const RAW_EDGES = [{"from": "main_py", "to": "app_main_lifespan", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_error_json", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_sqlalchemy_exception_handler", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_unhandled_exception_handler", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_mask_secret", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_root", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_health_check", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_lifespan", "to": "core_login_crypto_ensure_initialized", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_lifespan", "to": "tasks_init_init_scheduled_tasks", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_lifespan", "to": "tasks_init_shutdown_scheduler", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_error_json", "to": "app_main_sqlalchemy_exception_handler", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_error_json", "to": "app_main_unhandled_exception_handler", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_sqlalchemy_exception_handler", "to": "app_main_rationale_81", "label": "rationale_for", "title": "rationale_for [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_sqlalchemy_exception_handler", "to": "exception", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_unhandled_exception_handler", "to": "app_main_rationale_92", "label": "rationale_for", "title": "rationale_for [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_unhandled_exception_handler", "to": "exception", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_unhandled_exception_handler", "to": "str", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_81", "to": "core_api_request_log_middleware_apirequestlogmiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_81", "to": "core_api_crypto_middleware_apicryptomiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_92", "to": "core_api_request_log_middleware_apirequestlogmiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_92", "to": "core_api_crypto_middleware_apicryptomiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "tasks_init_py", "to": "tasks_init_init_scheduled_tasks", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "tasks_init_py", "to": "tasks_init_shutdown_scheduler", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "core_auth_py", "to": "core_auth_redis_session_enabled", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "core_auth_py", "to": "core_auth_get_redis_client", "labeLine truncated
const LEGEND = [{"cid": 0, "color": "#4E79A7", "label": "Community 0", "count": 973}, {"cid": 1, "color": "#F28E2B", "label": "Community 1", "count": 798}, {"cid": 2, "color": "#E15759", "label": "Community 2", "count": 621}, {"cid": 3, "color": "#76B7B2", "label": "Community 3", "count": 426}, {"cid": 4, "color": "#59A14F", "label": "Community 4", "count": 387}, {"cid": 5, "color": "#EDC948", "label": "Community 5", "count": 299}, {"cid": 6, "color": "#B07AA1", "label": "Community 6", "count": 215}, {"cid": 7, "color": "#FF9DA7", "label": "Community 7", "count": 182}, {"cid": 8, "color": "#9C755F", "label": "Community 8", "count": 141}, {"cid": 9, "color": "#BAB0AC", "label": "Community 9", "count": 135}, {"cid": 10, "color": "#4E79A7", "label": "Community 10", "count": 121}, {"cid": 11, "color": "#F28E2B", "label": "Community 11", "count": 96}, {"cid": 12, "color": "#E15759", "label": "Community 12", "count": 74}, {"cid": 13, "color": "#76B7B2", "label": "Community 13", "count": 73}, {"cid": 14, "color": "#59A14F", "label": "Community 14", "count": 55}, {"cid": 15, "color": "#EDC948", "label": "Community 15", "count": 29}, {"cid": 16, "color": "#B07AA1", "label": "Community 16", "count": 28}, {"cid": 17, "color": "#FF9DA7", "label": "Community 17", "count": 25}, {"cid": 18, "color": "#9C755F", "label": "Community 18", "count": 21}, {"cid": 19, "color": "#BAB0AC", "label": "Community 19", "count": 21}, {"cid": 20, "color": "#4E79A7", "label": "Community 20", "count": 20}, {"cid": 21, "color": "#F28E2B", "label": "Community 21", "count": 19}, {"cid": 22, "color": "#E15759", "label": "Community 22", "count": 13}, {"cid": 23, "color": "#76B7B2", "label": "Community 23", "count": 12}, {"cid": 24, "color": "#59A14F", "label": "Community 24", "count": 12}, {"cid": 25, "color": "#EDC948", "label": "Community 25", "count": 11}, {"cid": 26, "color": "#B07AA1", "label": "Community 26", "count": 10}, {"cid": 27, "color": "#FF9DA7", "label": "Community 27", "count": 8}, {"cid": 28, "color": "#9C755F", "label": "Community 28", "count": 7}, {"cid": 29, "color": "#BAB0AC", "label": "Community 29", "count": 6}, {"cid": 30, "color": "#4E79A7", "label": "Community 30", "count": 4}, {"cid": 31, "color": "#F28E2B", "label": "Community 31", "count": 4}, {"cid": 32, "color": "#E15759", "label": "Community 32", "count": 3}, {"cid": 33, "color": "#76B7B2", "label": "Community 33", "count": 2}, {"cid": 34, "color": "#59A14F", "label": "Community 34", "count": 2}, {"cid": 35, "color": "#EDC948", "label": "Community 35", "count": 2}, {"cid": 36, "color": "#B07AA1", "label": "Community 36", "count": 1}, {"cid": 37, "color": "#FF9DA7", "label": "Community 37", "count": 1}, {"cid": 38, "color": "#9C755F", "label": "Community 38", "count": 1}, {"cid": 39, "color": "#BAB0AC", "label": "Community 39", "count": 1}, {"cid": 40, "color": "#4E79A7", "label": "Community 40", "count": 1}, {"cid": 41, "color": "#F28E2B", "label": "Community 41", "count": 1}, {"cid": 42, "color": "#E15759", "label": "Community 42", "count": 1}, {"cid": 43, "color": "#76B7B2", "label": "Community 43", "count": 1}, {"cid": 44, "color": "#59A14F", "label": "Community 44", "count": 1}, {"cid": 45, "color": "#EDC948", "label": "Community 45", "count": 1}, {"cid": 46, "color": "#B07AA1", "label": "Community 46", "count": 1}, {"cid": 47, "color": "#FF9DA7", "label": "Community 47", "count": 1}, {"cid": 48, "color": "#9C755F", "label": "Community 48", "count": 0}, {"cid": 49, "color": "#BAB0AC", "label": "Community 49", "count": 0}, {"cid": 50, "color": "#4E79A7", "label": "Community 50", "count": 0}, {"cid": 51, "color": "#F28E2B", "label": "Community 51", "count": 0}, {"cid": 52, "color": "#E15759", "label": "Community 52", "count": 0}, {"cid": 53, "color": "#76B7B2", "label": "Community 53", "count": 0}, {"cid": 54, "color": "#59A14F", "label": "Community 54", "count": 0}, {"cid": 55, "color": "#EDC948", "label": "Community 55", "count": 0}, {"cid": 56, "color": "#B07AA1", "label": "Community 56", "count": 0}, {"cid": 57, "color": "#FF9DA7", "label": "Community 57", "count": 0}, {"cid": 58, "color": "#9C755F", "label": "Community 58", "count": 0}];
// HTML-escape helper — prevents XSS when injecting graph data into innerHTML
function esc(s) {
+21584 -18380
View File
File diff suppressed because it is too large. Load diff
+17 -14
View File
@@ -31,7 +31,7 @@
"/Users/wuzilong/work/00code/zkxw/backend/app/models/material.py": 1782894693.6389399,
"/Users/wuzilong/work/00code/zkxw/backend/app/models/production_material.py": 1782404882.9262497,
"/Users/wuzilong/work/00code/zkxw/backend/app/models/qc_param.py": 1782379593.174925,
"/Users/wuzilong/work/00code/zkxw/backend/app/models/models.py": 1785145511.5106366,
"/Users/wuzilong/work/00code/zkxw/backend/app/models/models.py": 1785207107.9364655,
"/Users/wuzilong/work/00code/zkxw/backend/app/models/cleanroom_garment.py": 1781347080.6165943,
"/Users/wuzilong/work/00code/zkxw/backend/app/models/__init__.py": 1781344070.5899634,
"/Users/wuzilong/work/00code/zkxw/backend/app/models/research_donation.py": 1783920516.0199852,
@@ -67,7 +67,7 @@
"/Users/wuzilong/work/00code/zkxw/backend/app/schemas/category_parameter.py": 1778578258.0944862,
"/Users/wuzilong/work/00code/zkxw/backend/app/schemas/common.py": 1778578258.094703,
"/Users/wuzilong/work/00code/zkxw/backend/app/schemas/unit.py": 1778578258.0996897,
"/Users/wuzilong/work/00code/zkxw/backend/app/schemas/qc_work_order.py": 1782350310.733416,
"/Users/wuzilong/work/00code/zkxw/backend/app/schemas/qc_work_order.py": 1785207107.4160411,
"/Users/wuzilong/work/00code/zkxw/backend/app/schemas/outbound_release_material.py": 1779827058.9935315,
"/Users/wuzilong/work/00code/zkxw/backend/app/schemas/product.py": 1778578258.0968297,
"/Users/wuzilong/work/00code/zkxw/backend/app/schemas/workflow.py": 1778633845.5937889,
@@ -88,10 +88,10 @@
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/sample_reception_check_result.py": 1779255909.8554008,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/production_material_stock_batch.py": 1782404955.550011,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/user.py": 1785145511.451647,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/production_work_order.py": 1783305553.0221446,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/production_work_order.py": 1785209206.5290542,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/material.py": 1781522283.6438622,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/dict_type.py": 1779265621.5212462,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_occupancy.py": 1782711147.4996655,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_occupancy.py": 1785214676.375756,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/qc_third_party_company.py": 1781415374.1019006,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/production_material.py": 1781344099.4832826,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/material_stock_log.py": 1779281903.0942652,
@@ -100,12 +100,12 @@
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/material_usage.py": 1782894693.7808309,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/production_material_usage.py": 1781513732.7796721,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/sop_document.py": 1779265721.9928973,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/production_task.py": 1783403507.6142845,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/production_task.py": 1785209208.399707,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/inbound_sample_special.py": 1782890475.769446,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/qc_third_party_item.py": 1779265661.482352,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/sample_production_reception.py": 1782722028.9202535,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/reagent.py": 1779512669.9847593,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/collection_protocol.py": 1785145536.321195,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/collection_protocol.py": 1785205960.3759406,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/cleanroom_garment.py": 1782264452.4901433,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/qc_material_usage.py": 1783428516.0973594,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/biz_no_generator.py": 1779882385.4674172,
@@ -139,14 +139,14 @@
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/site.py": 1781401290.6845422,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/api_request_log.py": 1778578258.0614743,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/dict_data.py": 1782893595.9312406,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/research_donation.py": 1783920527.417902,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/research_donation.py": 1785205964.126392,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/ethnic.py": 1779265849.547566,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/production_material_formula.py": 1781344175.5871844,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/pilot_checkup.py": 1779935785.233911,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/env_detect_item.py": 1781145689.9525824,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/process_category.py": 1779265700.0606413,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/item_unit.py": 1779265653.7504313,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/qc_work_order.py": 1785145511.450811,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/qc_work_order.py": 1785207209.0299742,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/outbound_handover_inventory.py": 1781598316.476379,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/env_detect_record.py": 1782376492.2365673,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/outbound_release_material.py": 1781612877.0137436,
@@ -162,7 +162,7 @@
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/qc_material.py": 1779284415.64655,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/collection_protocol_no.py": 1779882001.753651,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/outbound_handover.py": 1780455574.0993364,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py": 1782785836.0614257,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py": 1785213143.6603208,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/sample_reception_lab_code.py": 1783308340.5854337,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/cell_sample_type.py": 1781747645.1762104,
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/pilot_outbound_status_sync.py": 1781595840.6955194,
@@ -181,7 +181,7 @@
"/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py": 1782122639.96012,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/material.py": 1782894693.6582327,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/production_material.py": 1782404982.2474263,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/qc.py": 1785145511.4433799,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/qc.py": 1785207187.402777,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/market.py": 1781522283.6823432,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/sample_production_reception.py": 1782718998.90251,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/collection_protocol.py": 1785145536.3204737,
@@ -196,7 +196,7 @@
"/Users/wuzilong/work/00code/zkxw/backend/app/api/qc_sms_notification.py": 1780326875.7886882,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/research_donation_sample_collection.py": 1780457788.2998126,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/oa_approval.py": 1785145511.4423275,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/operations.py": 1782699385.46194,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/operations.py": 1785213144.2881503,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/menu.py": 1785145511.4415507,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/pilot_delivery.py": 1779655584.820777,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/admin.py": 1785145511.4409533,
@@ -213,15 +213,18 @@
"/Users/wuzilong/work/00code/zkxw/backend/app/api/protocol_sample_collection.py": 1780457788.2093296,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/leave.py": 1779266168.8693042,
"/Users/wuzilong/work/00code/zkxw/backend/app/api/clinical_payment.py": 1781750841.074568,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/oa_engine.py": 1785145511.5122352,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/oa_engine.py": 1785148503.1387126,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/workflow_callback.py": 1778727966.7277644,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/qc_work_order_fee_summary.py": 1783329884.6125586,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/storage_facility_code.py": 1782289322.2116506,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/storage_facility_code.py": 1785213139.8646047,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/qc_work_order_conclusion.py": 1785206750.2532814,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/oa_dept_select.py": 1785148503.137782,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/oa_publish.py": 1785145511.5138812,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/workflow_engine.py": 1778634664.6293883,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py": 1782122624.7941194,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/protocol_payment_installment.py": 1781432208.0765035,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/oa_related_approval.py": 1785145511.5143557,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/protocol_sample_list_summary.py": 1785207474.9871266,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/oa_related_approval.py": 1785148503.1396382,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/oa_assignee.py": 1785145511.510936,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/protocol_pay_mode_switch.py": 1785145536.322005,
"/Users/wuzilong/work/00code/zkxw/backend/app/services/oa_formula.py": 1785145511.513383,
@@ -0,0 +1,102 @@
"""协议/捐赠列表 sampleItems 接收与质检摘要字段。"""
import unittest
from unittest.mock import MagicMock
class TestSampleItemReceptionQcFields(unittest.TestCase):
"""纯函数:把接收/质检结论摘要合并进列表样本行字段。"""
def test_empty_when_no_reception_or_qc(self):
from app.services.protocol_sample_list_summary import (
build_sample_item_reception_qc_fields,
)
out = build_sample_item_reception_qc_fields(None, None)
self.assertEqual(out["receptionAcceptConclusion"], "")
self.assertEqual(out["receptionAcceptConclusionLabel"], "")
self.assertEqual(out["receptionRemark"], "")
self.assertEqual(out["qcConclusion"], "")
self.assertEqual(out["qcConclusionLabel"], "")
def test_accept_with_remark_and_qc_conclusion(self):
from app.services.protocol_sample_list_summary import (
build_sample_item_reception_qc_fields,
)
out = build_sample_item_reception_qc_fields(
{"acceptConclusion": "js", "remark": "外观正常"},
{"qcConclusion": "tg", "qcConclusionLabel": "合格"},
)
self.assertEqual(out["receptionAcceptConclusion"], "js")
self.assertEqual(out["receptionAcceptConclusionLabel"], "接收")
self.assertEqual(out["receptionRemark"], "外观正常")
self.assertEqual(out["qcConclusion"], "tg")
self.assertEqual(out["qcConclusionLabel"], "合格")
def test_reject_without_qc(self):
from app.services.protocol_sample_list_summary import (
build_sample_item_reception_qc_fields,
)
out = build_sample_item_reception_qc_fields(
{"acceptConclusion": "bj", "remark": "破损"},
None,
)
self.assertEqual(out["receptionAcceptConclusion"], "bj")
self.assertEqual(out["receptionAcceptConclusionLabel"], "拒收")
self.assertEqual(out["receptionRemark"], "破损")
self.assertEqual(out["qcConclusion"], "")
self.assertEqual(out["qcConclusionLabel"], "")
class TestListReceptionSummaryMap(unittest.TestCase):
def test_keyed_by_sample_code(self):
from app.services.protocol_sample_list_summary import (
get_list_reception_summary_map_by_sample_codes,
)
rec = MagicMock()
rec.sample_code = "SC-001"
rec.accept_conclusion = "js"
rec.remark = "ok"
db = MagicMock()
q = MagicMock()
db.query.return_value = q
q.filter.return_value = q
q.all.return_value = [rec]
out = get_list_reception_summary_map_by_sample_codes(
db, "t1", ["SC-001"], reception_source="cell_storage"
)
self.assertEqual(out["SC-001"]["acceptConclusion"], "js")
self.assertEqual(out["SC-001"]["remark"], "ok")
class TestListQcConclusionMap(unittest.TestCase):
def test_uses_stored_conclusion(self):
from app.services.protocol_sample_list_summary import (
get_list_qc_conclusion_map_by_sample_codes,
)
wo = MagicMock()
wo.id = "wo1"
wo.sample_code = "SC-001"
wo.conclusion = "tg"
db = MagicMock()
q = MagicMock()
db.query.return_value = q
q.filter.return_value = q
q.all.return_value = [wo]
out = get_list_qc_conclusion_map_by_sample_codes(
db, "t1", ["SC-001"], reception_source="cell_storage"
)
self.assertEqual(out["SC-001"]["qcConclusion"], "tg")
self.assertEqual(out["SC-001"]["qcConclusionLabel"], "合格")
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,58 @@
"""质检工单列表:由任务结论派生工单级合格/不合格。"""
import unittest
class TestDeriveWorkOrderQcConclusion(unittest.TestCase):
def test_empty_tasks(self):
from app.services.qc_work_order_conclusion import derive_work_order_qc_conclusion
self.assertEqual(derive_work_order_qc_conclusion([]), "")
def test_any_fail_is_unqualified(self):
from app.services.qc_work_order_conclusion import derive_work_order_qc_conclusion
self.assertEqual(derive_work_order_qc_conclusion(["tg", "btg", ""]), "btg")
def test_all_pass_is_qualified(self):
from app.services.qc_work_order_conclusion import derive_work_order_qc_conclusion
self.assertEqual(derive_work_order_qc_conclusion(["tg", "tg"]), "tg")
def test_incomplete_returns_empty(self):
from app.services.qc_work_order_conclusion import derive_work_order_qc_conclusion
self.assertEqual(derive_work_order_qc_conclusion(["tg", ""]), "")
self.assertEqual(derive_work_order_qc_conclusion(["tg", None]), "")
def test_labels_qualified_unqualified(self):
from app.services.qc_work_order_conclusion import (
work_order_qc_conclusion_label,
)
self.assertEqual(work_order_qc_conclusion_label("tg"), "合格")
self.assertEqual(work_order_qc_conclusion_label("btg"), "不合格")
self.assertEqual(work_order_qc_conclusion_label(""), "")
self.assertEqual(work_order_qc_conclusion_label("x"), "")
class TestBuildQcConclusionFields(unittest.TestCase):
def test_build_fields(self):
from app.services.qc_work_order_conclusion import build_qc_conclusion_fields
self.assertEqual(
build_qc_conclusion_fields(["tg", "tg"]),
{"qcConclusion": "tg", "qcConclusionLabel": "合格"},
)
self.assertEqual(
build_qc_conclusion_fields(["btg"]),
{"qcConclusion": "btg", "qcConclusionLabel": "不合格"},
)
self.assertEqual(
build_qc_conclusion_fields(["tg", ""]),
{"qcConclusion": "", "qcConclusionLabel": ""},
)
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,6 @@
-- 质检工单增加质检结论(合格/不合格),可编辑落库;列表无值时仍可由任务结论派生。
-- 执行:在目标库运行本脚本。
ALTER TABLE `biz_qc_work_order`
ADD COLUMN `conclusion` varchar(16) DEFAULT NULL COMMENT '质检结论 tg合格 btg不合格'
AFTER `work_order_status`;
@@ -1,117 +0,0 @@
-- =============================================================================
-- 为全部有效角色授予【OA审批】及其全部子菜单权限
-- 依据:docs/sql/zkxw.sql(sys_menu / sys_role / sys_role_menu)
--
-- 菜单范围:
-- OA000...000001 OA审批(目录)
-- OA000...000101 审批管理
-- OA000...000102 工作流角色
-- OA000...000103 发起审批
-- OA000...000104 待办中心
-- OA000...000105 已办中心
-- OA000...000106 我发起的
-- OA000...000107 抄送我的
-- OA000...000201 审批设计(隐藏页)
-- OA000...000202 审批详情(隐藏页)
--
-- 另按权限约定补齐祖先菜单,避免侧栏孤儿节点无法展示:
-- 2 Web端菜单
-- TOP000...00005 系统管理(OA审批的上级目录)
--
-- 幂等:已存在且未删除则跳过;已软删则恢复;缺失则新增。
-- =============================================================================
SET NAMES utf8mb4;
-- -----------------------------------------------------------------------------
-- 目标菜单集合:OA审批 + 全部子菜单 + 祖先菜单
-- -----------------------------------------------------------------------------
DROP TEMPORARY TABLE IF EXISTS tmp_oa_grant_menus;
CREATE TEMPORARY TABLE tmp_oa_grant_menus (
menu_id VARCHAR(64) NOT NULL PRIMARY KEY
) ENGINE=Memory;
INSERT INTO tmp_oa_grant_menus (menu_id)
SELECT m.id
FROM sys_menu m
WHERE m.del_flag = 0
AND (
-- OA审批自身
m.id = 'OA000000000000000000000000000001'
-- OA审批下全部子菜单(当前均为一级子节点)
OR m.parent_id = 'OA000000000000000000000000000001'
-- 祖先:侧栏可展示
OR m.id IN (
'2', -- Web端菜单
'TOP00000000000000000000000000005' -- 系统管理
)
);
-- -----------------------------------------------------------------------------
-- 1) 恢复已软删的角色-菜单关联
-- -----------------------------------------------------------------------------
UPDATE sys_role_menu rm
INNER JOIN sys_role r
ON r.id = rm.role_id
AND r.del_flag = 0
INNER JOIN tmp_oa_grant_menus t
ON t.menu_id = rm.menu_id
SET
rm.del_flag = 0,
rm.update_time = NOW(),
rm.remark = COALESCE(rm.remark, 'grant OA审批 menu to all roles')
WHERE rm.del_flag = 1;
-- -----------------------------------------------------------------------------
-- 2) 为尚未关联的角色补插菜单权限
-- -----------------------------------------------------------------------------
INSERT INTO sys_role_menu (
id,
role_id,
menu_id,
tenant_no,
order_num,
remark,
create_by,
create_dept_id,
create_time,
update_by,
update_time,
del_flag
)
SELECT
-- MySQL 5.7 批量 INSERT…SELECT 时 UUID() 可能同批重复;用 role+menu 确定性主键
UPPER(MD5(CONCAT('oa-grant|', r.id, '|', t.menu_id))) AS id,
r.id AS role_id,
t.menu_id AS menu_id,
r.tenant_no AS tenant_no,
0 AS order_num,
'grant OA审批 menu to all roles' AS remark,
NULL AS create_by,
'' AS create_dept_id,
NOW() AS create_time,
NULL AS update_by,
NOW() AS update_time,
0 AS del_flag
FROM sys_role r
CROSS JOIN tmp_oa_grant_menus t
WHERE r.del_flag = 0
AND NOT EXISTS (
SELECT 1
FROM sys_role_menu x
WHERE x.role_id = r.id
AND x.menu_id = t.menu_id
);
-- -----------------------------------------------------------------------------
-- 校验(可选,执行后查看结果)
-- -----------------------------------------------------------------------------
-- SELECT r.role_name, COUNT(*) AS oa_menu_cnt
-- FROM sys_role r
-- INNER JOIN sys_role_menu rm ON rm.role_id = r.id AND rm.del_flag = 0
-- INNER JOIN tmp_oa_grant_menus t ON t.menu_id = rm.menu_id
-- WHERE r.del_flag = 0
-- GROUP BY r.id, r.role_name
-- ORDER BY r.role_name;
DROP TEMPORARY TABLE IF EXISTS tmp_oa_grant_menus;
+1
View File
@@ -15344,6 +15344,7 @@ CREATE TABLE `biz_qc_work_order` (
`production_task_id` varchar(64) DEFAULT NULL COMMENT '关联生产任务ID(可选)',
`production_step_output_id` varchar(64) DEFAULT NULL COMMENT '关联生产任务步骤产出物ID(生产过程触发时)',
`work_order_status` varchar(16) NOT NULL DEFAULT 'dpz' COMMENT 'dpz待配置 ypz已配置 ywc已完成',
`conclusion` varchar(16) DEFAULT NULL COMMENT '质检结论 tg合格 btg不合格',
`has_lab` char(1) NOT NULL DEFAULT '0' COMMENT '含实验室自检',
`has_third_party` char(1) NOT NULL DEFAULT '0' COMMENT '含第三方检测',
`configured_time` datetime DEFAULT NULL COMMENT '配置时间',
@@ -0,0 +1,18 @@
# 库位树批量新增子节点 Implementation Plan
> **For agentic workers:** 本计划已在同会话落地;保留作变更说明。
**Goal:** 库位管理左侧树支持按「前缀+序号+后缀」批量新增子节点。
**Architecture:** 后端新增 `batch_create_facilities` 与 `POST /storage-facilities/batch`;前端树节点「批+」打开弹窗,实时预览后一次提交。
**Tech Stack:** FastAPI + SQLAlchemy;Vue 3 + Element Plus
---
## 已完成
- [x] 设计说明 `docs/superpowers/specs/2026-07-28-storage-facility-batch-children-design.md`
- [x] CRUD `batch_create_facilities`(上限 200、编号唯一、单事务)
- [x] API `POST /web/admin/storage-facilities/batch`
- [x] 前端 `fetchBatchCreateStorageFacilities` + 弹窗 + 树入口「批+」
@@ -0,0 +1,133 @@
# 库位管理右侧格子检索 Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 在库位管理叶子节点右侧顶部增加物品名称 / 产品类型 / 批次号检索,命中后只显示匹配格并提示「共命中 N 格」。
**Architecture:** 后端货架摘要补齐 `batchNo`;前端对当前叶子节点 `slotList` 做本地 AND 过滤,驱动 `shelfRows` 只渲染命中格。不改 slots 列表 API 查询参数。
**Tech Stack:** FastAPI/SQLAlchemy、Vue 3、Element Plus、`filter-block` 标准筛选区、`fetchProductionProductTypeList`
**Spec:** `docs/superpowers/specs/2026-07-28-storage-facility-slot-filter-design.md`
---
## File Structure
| File | Responsibility |
|------|----------------|
| `backend/app/crud/storage_occupancy.py` | `_load_cell_product_shelf_summaries` 增加 `batch_no` → `batchNo` |
| `web-admin/src/views/operations/storage-facility/index.vue` | 筛选 UI、过滤逻辑、命中提示、切换节点清空 |
---
### Task 1: 后端货架摘要补齐 batchNo
**Files:**
- Modify: `backend/app/crud/storage_occupancy.py`(`_load_cell_product_shelf_summaries`)
- [x] **Step 1: 查询与返回增加 batchNo**
在 `db.query(...)` 增加 `BizCellProduct.batch_no`,返回字典增加 `"batchNo": r.batch_no or ""`。
同步更新函数 docstring:注明含批次号。
- [x] **Step 2: 快速校验语法**
Run: `cd backend && source venv/bin/activate && python -c "from app.crud.storage_occupancy import _load_cell_product_shelf_summaries; print('ok')"`
Expected: `ok`
---
### Task 2: 前端筛选区 + 本地过滤
**Files:**
- Modify: `web-admin/src/views/operations/storage-facility/index.vue`
- [x] **Step 1: 模板 — 叶子节点右侧 header 下、toolbar 上插入 filter-block**
结构对齐单位列表:
- 物品名称 `el-input`
- 产品类型 `el-select`(`productTypeOptions`)
- 批次号 `el-input`
- 重置 / 搜索按钮(RefreshLeft / Search 图标)
- 有生效筛选时展示「共命中 N 格」
- 筛选后 N=0 且原有格子时:空状态「未找到匹配的库位格子」
- [x] **Step 2: script — 状态与过滤**
```ts
const slotFilterForm = reactive({ itemName: '', productTypeId: '', batchNo: '' })
const slotFilterApplied = reactive({ itemName: '', productTypeId: '', batchNo: '' })
const productTypeOptions = ref<any[]>([])
const slotFilterActive = computed(() => {
const f = slotFilterApplied
return !!(f.itemName.trim() || f.productTypeId || f.batchNo.trim())
})
function slotMatchesFilter(slot: any): boolean {
const f = slotFilterApplied
const nameQ = f.itemName.trim().toLowerCase()
const batchQ = f.batchNo.trim().toLowerCase()
const typeId = f.productTypeId
if (!nameQ && !typeId && !batchQ) return true
const cp = slot.storedCellProduct
const productName = String(cp?.productName || '').toLowerCase()
const storedName = String(slot.storedItemName || '').toLowerCase()
const productTypeId = String(cp?.productTypeId || '')
const batchNo = String(cp?.batchNo || '').toLowerCase()
if (nameQ && !productName.includes(nameQ) && !storedName.includes(nameQ)) return false
if (typeId && productTypeId !== typeId) return false
if (batchQ && !batchNo.includes(batchQ)) return false
return true
}
const filteredSlotList = computed(() => {
if (!slotFilterActive.value) return slotList.value
return slotList.value.filter(slotMatchesFilter)
})
const slotFilterHitCount = computed(() =>
slotFilterActive.value ? filteredSlotList.value.length : 0
)
```
将 `shelfRows` 的数据源从 `slotList.value` 改为 `filteredSlotList.value`。
- [x] **Step 3: 搜索 / 重置 / 切节点清空 / 加载产品类型**
- `handleSlotFilterSearch`:把 form 拷到 applied
- `handleSlotFilterReset`:清空 form + applied
- `handleNodeClick`:调用重置
- `onMounted` 或首次打开叶子时:`loadProductTypeOptions` 调 `fetchProductionProductTypeList({ page: 1, pageSize: 500 })`
- [x] **Step 4: import**
从 `@/api/production` 引入 `fetchProductionProductTypeList`;图标确保 `RefreshLeft`、`Search` 已从 `@element-plus/icons-vue` 引入(若页面已有 Plus 等,一并补全)。
---
### Task 3: 手工验收
- [x] **Step 1: 打开** `/#/production-group/production/storage-facility`,选叶子节点
- [x] **Step 2:** 确认筛选区、命中提示、重置、切节点清空
- [ ] **Step 3:** 有细胞产品占用时,按名称/类型/批次分别验证 AND 过滤
(本仓库后端测试极少;本变更以手工验收为主,不强制新增 pytest。Step 3 需在浏览器对照真实数据验证。)
---
## Spec coverage
| Spec 项 | Task |
|---------|------|
| 后端 batchNo | Task 1 |
| filter-block 三条件 | Task 2 Step 1 |
| AND 本地过滤 + 命中提示 | Task 2 Step 2–3 |
| 切节点清空 | Task 2 Step 3 |
| 统计不受筛选影响 | Task 2(`slotStats` 仍用 `slotList`) |
@@ -0,0 +1,28 @@
# 库位树批量新增子节点
**日期:** 2026-07-28
**范围:** `web-admin` 库位管理左侧树 + `backend` `storage-facilities` 批量接口
## 目标
在选定父节点下,按「前缀 + 序号 + 后缀」一次创建多个子节点;可选同步生成节点编号。
## 命名规则
- 节点名称:`namePrefix + pad(seq) + nameSuffix`(前缀/后缀均可空,但拼出后名称不得为空)
- 节点编号:若编号前缀与后缀皆空,则编号为空;否则 `codePrefix + pad(seq) + codeSuffix`
- 序号:闭区间 `[startNum, endNum]`,支持位数补零 `padWidth`(0 表示不补)
- 单次上限:200 个
## API
`POST /web/admin/storage-facilities/batch`
请求字段(camelCase):`parentId`, `namePrefix`, `nameSuffix`, `startNum`, `endNum`, `padWidth`, `codePrefix`, `codeSuffix`, `nodeType`, `isLeaf`, `remark?`
同级编号唯一校验与单条创建一致;整批同一事务提交。
## UI
- 树节点悬停操作区增加「批+」
- 弹窗与 Demo 一致:上级只读路径、名称/编号规则、序号范围、类型、是否存储格、实时预览
@@ -0,0 +1,76 @@
# 库位管理右侧格子检索
**日期:** 2026-07-28
**范围:** `web-admin` 库位管理右侧货架区 + `backend` 货架摘要字段补齐
**界面模式:** 参考列表筛选 `filter-block`(P01 标准列表筛选区布局)
## 目标
在已选叶子节点的右侧区域顶部增加检索,支持按物品名称、产品类型、批次号筛选当前节点格子;命中后只显示匹配格,并提示「共命中 N 格」。
## 范围与非目标
**范围内:**
- 仅筛选当前选中叶子节点已加载的 `slotList`
- 前端本地 AND 过滤(空条件不参与)
- 后端货架摘要补齐 `batchNo`(及已有 `productTypeId`)供筛选
**非目标:**
- 不跨节点/全库搜索
- 不改 slots 列表 API 查询参数
- 不改变入库/出库/占用弹窗逻辑
## 后端
文件:`backend/app/crud/storage_occupancy.py` → `_load_cell_product_shelf_summaries`
在现有摘要(`id` / `productCode` / `productName` / `productTypeId` / `productTypeName`)上增加:
- `batchNo` ← `BizCellProduct.batch_no`
查询需把 `BizCellProduct.batch_no` 纳入 select 列。产品已删走占用快照兜底时,`batchNo` 可为空字符串。
## 前端 UI
文件:`web-admin/src/views/operations/storage-facility/index.vue`
**位置:** 叶子节点右侧,`storage-content-header` 下方、`storage-toolbar` 上方。
**筛选区(`filter-block`):**
| 字段 | 控件 | 匹配规则 |
|------|------|----------|
| 物品名称 | `el-input`,可清空 | 模糊包含 `storedCellProduct.productName` 或 `storedItemName`(大小写不敏感可选,默认按包含) |
| 产品类型 | `el-select`,可清空,选项来自 `fetchProductionProductTypeList` | 精确匹配 `storedCellProduct.productTypeId` |
| 批次号 | `el-input`,可清空 | 模糊包含 `storedCellProduct.batchNo` |
操作:重置、搜索(与单位列表等标准页一致,带 RefreshLeft / Search 图标)。
**结果展示:**
- 无有效条件:货架显示全部格子;不显示命中提示
- 有条件:`shelfRows` 仅含命中格(空行不展示);筛选区或标题旁显示「共命中 N 格」
- N = 0:空状态文案「未找到匹配的库位格子」
- 切换左侧节点:清空检索条件与命中提示
**统计:** 顶部「总数 / 空闲 / 占用」仍基于完整 `slotList`,不受筛选影响,避免误导库位真实容量。
## 过滤逻辑(伪代码)
```
hasFilter = itemName || productTypeId || batchNo
if !hasFilter → 使用全部 slotList
else → slot 命中当且仅当:
(无 itemName 或 名称字段包含 itemName)
AND (无 productTypeId 或 productTypeId 相等)
AND (无 batchNo 或 batchNo 包含)
空闲格(无在库物品)在有筛选时一律不命中
```
## 验收
1. 叶子节点右侧出现三项筛选 + 重置/搜索
2. 仅物品名称:只显示名称匹配的占用格,提示命中数
3. 产品类型下拉可选主数据;精确过滤
4. 批次号可筛(依赖后端摘要字段)
5. 多条件 AND;重置后恢复全量货架
6. 切换树节点后条件清空
7. 未选叶子 / 非叶子:行为与现网一致,不出现筛选区
+16
View File
@@ -1409,6 +1409,22 @@ export function fetchCreateStorageFacility(data: Record<string, any>) {
return request.post({ url: '/web/admin/storage-facilities', params: data })
}
export function fetchBatchCreateStorageFacilities(data: {
parentId?: string
namePrefix?: string
nameSuffix?: string
startNum: number
endNum: number
padWidth?: number
codePrefix?: string
codeSuffix?: string
nodeType?: string
isLeaf?: number
remark?: string
}) {
return request.post({ url: '/web/admin/storage-facilities/batch', params: data })
}
export function fetchUpdateStorageFacility(id: string, data: Record<string, any>) {
return request.put({ url: `/web/admin/storage-facilities/${id}`, params: data })
}
@@ -25,6 +25,9 @@ export interface ProductionWorkOrderItem {
handlerName?: string
receptionTime?: string
workOrderStatus: string
/** 门禁质检结论:tg=合格 / btg=不合格(细胞存储/科研捐赠入库) */
qcConclusion?: string
qcConclusionLabel?: string
createTime?: string
/** 卡片展示:工单下全部工艺步骤计划开始时间区间(前端聚合) */
plannedStartTimeRange?: string
+4 -1
View File
@@ -114,6 +114,9 @@ export type QcWorkOrder = {
receptionTime?: string
handlerName?: string
workOrderStatus: string
/** 工单级质检结论:tg=合格 / btg=不合格 / 空=尚无 */
qcConclusion?: string
qcConclusionLabel?: string
hasLab: boolean
hasThirdParty: boolean
configuredTime?: string
@@ -292,7 +295,7 @@ export function fetchCreateQcWorkOrder(data: {
export function fetchUpdateQcWorkOrder(
id: string,
data: { cellProductId?: string; workOrderStatus?: string; remark?: string }
data: { cellProductId?: string; workOrderStatus?: string; qcConclusion?: string; remark?: string }
) {
return request.put<QcWorkOrder>({
url: `/web/admin/qc-work-orders/${id}`,
@@ -1,4 +1,4 @@
<!-- 工单编辑(备注;质检工单可选工单状态) -->
<!-- 工单编辑(备注;质检工单可选工单状态、质检结论) -->
<template>
<el-dialog
v-model="dialogVisible"
@@ -24,6 +24,21 @@
/>
</el-select>
</el-form-item>
<el-form-item v-if="showQcConclusion" label="质检结论" class="form-col-span-2">
<el-select
v-model="qcConclusion"
placeholder="请选择"
clearable
style="width: 100%"
>
<el-option
v-for="opt in qcConclusionOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
</el-form-item>
<el-form-item label="备注" class="form-col-span-2">
<el-input
v-model="remark"
@@ -50,11 +65,17 @@
<script setup lang="ts">
import { ref, computed, watch } from 'vue'
import { Close, Check } from '@element-plus/icons-vue'
import { workOrderStatus as workOrderStatusRegistry, workOrderStatusLabel } from '@/utils/status-tag-registry'
import {
workOrderStatus as workOrderStatusRegistry,
workOrderStatusLabel,
qcWorkOrderConclusionLabelMap,
qcWorkOrderConclusionLabel
} from '@/utils/status-tag-registry'
export type WorkOrderRemarkSubmitPayload = {
remark: string
workOrderStatus?: string
qcConclusion?: string
}
const props = withDefaults(
@@ -63,14 +84,18 @@
title?: string
initialRemark?: string
initialWorkOrderStatus?: string
initialQcConclusion?: string
showWorkOrderStatus?: boolean
showQcConclusion?: boolean
submitting?: boolean
}>(),
{
title: '编辑备注',
initialRemark: '',
initialWorkOrderStatus: '',
initialQcConclusion: '',
showWorkOrderStatus: false,
showQcConclusion: false,
submitting: false
}
)
@@ -87,6 +112,7 @@
const remark = ref('')
const workOrderStatus = ref('')
const qcConclusion = ref('')
const workOrderStatusOptions = computed(() =>
Object.keys(workOrderStatusRegistry).map((value) => ({
@@ -95,6 +121,13 @@
}))
)
const qcConclusionOptions = computed(() =>
Object.keys(qcWorkOrderConclusionLabelMap).map((value) => ({
value,
label: qcWorkOrderConclusionLabel(value)
}))
)
function handleClose() {
dialogVisible.value = false
}
@@ -106,6 +139,9 @@
if (props.showWorkOrderStatus) {
payload.workOrderStatus = workOrderStatus.value
}
if (props.showQcConclusion) {
payload.qcConclusion = qcConclusion.value || ''
}
emit('submit', payload)
}
@@ -115,6 +151,7 @@
if (val) {
remark.value = props.initialRemark || ''
workOrderStatus.value = props.initialWorkOrderStatus || ''
qcConclusion.value = props.initialQcConclusion || ''
}
}
)
@@ -51,7 +51,7 @@ function keywordMatchesWorkOrder(
const tab = getProductionWorkOrderTab(tabKey)!
const fields =
tabKey === 'temporary'
? [row.workOrderNo]
? [row.remark]
: tabKey === 'outbound_basic_experiment'
? [
row.workOrderNo,
@@ -1,6 +1,6 @@
import { formatDisplayOrDash } from '@/utils/datetime-display'
import type { ProductionWorkOrderItem } from '@/api/production-work-order'
import { receptionSourceLabel } from '@/utils/qc-labels'
import { receptionSourceLabel, receptionSourceTagType } from '@/utils/qc-labels'
import {
donationStatusDisplayLabel,
donationStatusTagType,
@@ -78,18 +78,19 @@ function protocolStatusTagTypeForTab(
}
function buildInboundMetaFields(tabKey: ProductionWorkOrderTabKey): CardMetaField[] {
const fields: CardMetaField[] = []
if (tabKey === 'inbound_cell_storage') {
fields.push({
const defaultSource = tabKey === 'inbound_research_donation' ? 'research_donation' : 'cell_storage'
return [
{ label: '实验室入库编码', getValue: (row) => row.labStorageCode || '—' },
{ label: '样本类型', getValue: (row) => row.sampleTypeName || '—' },
{ label: '接收经手人', getValue: (row) => row.handlerName || '—' },
{ label: '接收时间', getValue: (row) => formatDisplayOrDash(row.receptionTime) },
{
label: '来源类型',
kind: 'tag',
getValue: (row) => row.receptionSourceLabel || receptionSourceLabel(row.receptionSource || 'cell_storage'),
getTagType: () => 'success'
})
}
fields.push(
{ label: '母亲姓名', getValue: (row) => row.motherName || '—' },
{ label: '新生儿姓名', getValue: (row) => row.newbornName || '—' },
getValue: (row) =>
row.receptionSourceLabel || receptionSourceLabel(row.receptionSource || defaultSource),
getTagType: (row) => receptionSourceTagType(row.receptionSource || defaultSource)
},
{
label: tabKey === 'inbound_research_donation' ? '捐赠状态' : '协议状态',
kind: 'tag',
@@ -97,21 +98,24 @@ function buildInboundMetaFields(tabKey: ProductionWorkOrderTabKey): CardMetaFiel
getTagType: (row) => protocolStatusTagTypeForTab(row, tabKey),
visible: (row) => !!String(row.protocolStatus || '').trim()
},
{ label: '样本类型', getValue: (row) => row.sampleTypeName || '—' },
{ label: '接收经手人', getValue: (row) => row.handlerName || '—' },
{ label: '接收时间', getValue: (row) => formatDisplayOrDash(row.receptionTime) },
plannedStartTimeRangeField,
{ label: '工单号', getValue: (row) => row.workOrderNo || '—' },
{ label: '样本编码', getValue: (row) => row.sampleCode || '—' },
{ label: '实验室入库编码', getValue: (row) => row.labStorageCode || '—' },
{
label: '备注',
getValue: (row) => row.remark || '—',
visible: (row) => !!row.remark,
wide: true
label: '质检结论',
kind: 'tag',
getValue: (row) =>
row.qcConclusionLabel ||
(row.qcConclusion === 'tg'
? '合格'
: row.qcConclusion === 'btg'
? '不合格'
: '—'),
getTagType: (row) => {
const c = String(row.qcConclusion || '').trim()
if (c === 'tg') return 'success'
if (c === 'btg') return 'danger'
return 'info'
}
}
)
return fields
]
}
const outboundPilotClinicalFields: CardMetaField[] = [
@@ -157,10 +161,7 @@ const outboundBasicExperimentFields: CardMetaField[] = [
}
]
const temporaryFields: CardMetaField[] = [
{ label: '工单号', getValue: (row) => row.workOrderNo || '—' },
plannedStartTimeRangeField
]
const temporaryFields: CardMetaField[] = []
const CARD_META_BY_TAB: Record<ProductionWorkOrderTabKey, ProductionWorkOrderCardMetaConfig> = {
all: {
@@ -137,7 +137,7 @@ export function resolveTabKeyFromWorkOrder(row: {
export function keywordPlaceholderForTab(tab: ProductionWorkOrderTabConfig): string {
if (tab.key === 'all') return '工单号 / 样本编码 / 申请单号 / 产品名称等'
if (tab.key === 'temporary') return '工单号'
if (tab.key === 'temporary') return '备注'
if (tab.key === 'outbound_basic_experiment') {
return '工单号/申请单号/课题名称/客户'
}
+2
View File
@@ -15,6 +15,8 @@ export {
qcTaskConclusionTagType,
qcConclusionDisplayLabel,
qcConclusionDisplayTagType,
qcWorkOrderConclusionLabel,
qcWorkOrderConclusionTagType,
taskStatusLabel,
taskStatusTagType
} from './status-tag-registry'
@@ -250,6 +250,14 @@ export const qcConclusion: StatusRegistry = {
export const qcTaskConclusionLabel = createLabelGetter(qcConclusion)
export const qcTaskConclusionTagType = createTagTypeGetter(qcConclusion)
/** 工单级质检结论(列表卡片):合格 / 不合格;无结论返回空串 */
export const qcWorkOrderConclusionLabelMap: StatusRegistry = {
tg: { label: '合格', tagType: 'success' },
btg: { label: '不合格', tagType: 'danger' }
}
export const qcWorkOrderConclusionLabel = createLabelGetter(qcWorkOrderConclusionLabelMap)
export const qcWorkOrderConclusionTagType = createTagTypeGetter(qcWorkOrderConclusionLabelMap)
/** 无 tg/btg 时展示「待结论」(待办醒目,用 danger) */
export function qcConclusionDisplayLabel(code?: string | null): string {
const c = (code || '').trim()
@@ -247,6 +247,47 @@
formatTransportSummary(item.transport)
}}</span>
</div>
<div class="protocol-card__sample-line">
<span class="protocol-card__sample-label">接收</span>
<span class="protocol-card__sample-value protocol-card__sample-value--reception">
<el-tag
:type="
item.receptionAcceptConclusion
? acceptConclusionTagType(item.receptionAcceptConclusion)
: 'info'
"
size="small"
>
{{
item.receptionAcceptConclusion
? acceptConclusionLabel(item.receptionAcceptConclusion)
: '未接收'
}}
</el-tag>
<span
class="protocol-card__sample-remark"
:title="item.receptionRemark || undefined"
>
备注:{{ item.receptionRemark || '—' }}
</span>
</span>
</div>
<div class="protocol-card__sample-line">
<span class="protocol-card__sample-label">质检</span>
<span class="protocol-card__sample-value">
<el-tag
v-if="item.qcConclusion"
:type="qcWorkOrderConclusionTagType(item.qcConclusion)"
size="small"
>
{{
item.qcConclusionLabel ||
qcWorkOrderConclusionLabel(item.qcConclusion)
}}
</el-tag>
<span v-else>—</span>
</span>
</div>
</div>
</div>
</div>
@@ -259,6 +300,7 @@
:summary="getPaymentSummary(row)"
compact
embedded
default-expanded
hide-overall-pay-status
hide-installment-detail-amounts
/>
@@ -381,7 +423,11 @@
newbornSexLabel,
sampleStatusLabel,
sampleStatusTagType,
transportTypeLabel
transportTypeLabel,
acceptConclusionLabel,
acceptConclusionTagType,
qcWorkOrderConclusionLabel,
qcWorkOrderConclusionTagType
} from '@/utils/status-tag-registry'
import { maskIdCard } from '@/utils/mask-sensitive'
@@ -405,6 +451,10 @@
isSpecial?: boolean
specialRemark?: string
transport?: ProtocolSampleTransport | null
receptionAcceptConclusion?: string
receptionRemark?: string
qcConclusion?: string
qcConclusionLabel?: string
}
function getPaymentSummary(row: CollectionProtocolRow): QcProtocolPaymentSummary | null {
@@ -451,7 +501,11 @@
labStorageCode: String(rec.labStorageCode || '').trim(),
isSpecial: !!rec.isSpecial,
specialRemark: String(rec.specialRemark || '').trim(),
transport
transport,
receptionAcceptConclusion: String(rec.receptionAcceptConclusion || '').trim(),
receptionRemark: String(rec.receptionRemark || '').trim(),
qcConclusion: String(rec.qcConclusion || '').trim(),
qcConclusionLabel: String(rec.qcConclusionLabel || '').trim()
}
})
}
@@ -956,6 +1010,24 @@
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 11px;
}
&--reception {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px 8px;
word-break: normal;
}
}
.protocol-card__sample-remark {
min-width: 0;
flex: 1 1 120px;
overflow: hidden;
color: var(--mint-text-muted, #64748b);
font-size: 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
.protocol-card__sample-status {
@@ -52,6 +52,7 @@
<span v-if="data.isLeaf === 1" class="storage-tree-node__leaf">存</span>
<div class="storage-tree-node__actions">
<button title="新增子节点" @click.stop="handleAddChild(data)">+</button>
<button title="批量新增子节点" @click.stop="handleBatchAddChild(data)">批+</button>
<button title="编辑" @click.stop="handleEditNode(data)">✎</button>
<button title="删除" @click.stop="handleDeleteNode(data)">×</button>
</div>
@@ -100,10 +101,25 @@
<span
>占用 <strong>{{ slotStats.occupied }}</strong></span
>
<template v-if="slotFilterActive">
<span class="stats-dot">·</span>
<span
>共命中 <strong>{{ slotFilterHitCount }}</strong> 格</span
>
</template>
</div>
</div>
</div>
<div class="storage-slot-filter">
<el-input
v-model="slotFilterKeyword"
placeholder="物品名称 / 产品类型 / 批次号"
clearable
class="storage-slot-filter__input"
/>
</div>
<div class="storage-toolbar">
<el-button
type="primary"
@@ -126,6 +142,13 @@
<el-empty description="暂无格子" />
</div>
<div
v-else-if="slotFilterActive && slotFilterHitCount === 0"
class="storage-empty-cells"
>
<el-empty description="未找到匹配的库位格子" />
</div>
<div v-else class="shelf-scroll-wrapper" v-loading="slotLoading">
<div class="shelf-container">
<div v-for="(row, ri) in shelfRows" :key="ri" class="shelf-row-wrapper">
@@ -152,27 +175,29 @@
title="删除"
>×</button
>
<span class="cell-code">{{ cell.fullSlotCode || cell.slotCode || '—' }}</span>
<template v-if="cell.storedCellProduct">
<span
class="cell-product-code"
:title="cell.storedCellProduct.productCode"
>
{{ cell.storedCellProduct.productCode }}
</span>
<span
class="cell-product-name"
:title="cell.storedCellProduct.productName"
>
{{ cell.storedCellProduct.productName }}
{{ cell.storedCellProduct.productName || '—' }}
</span>
<span
class="cell-product-type"
:title="cell.storedCellProduct.productTypeName"
>
{{ cell.storedCellProduct.productTypeName || '—' }}
</span>
</template>
<span v-else-if="cell.storedItemCode" class="cell-product-code">{{
cell.storedItemCode
}}</span>
<span v-if="cell.occupiedCount > 0" class="cell-badge">{{
cell.occupiedCount
}}</span>
<template v-else-if="cell.storedItemName || cell.storedItemCode">
<span
class="cell-product-name"
:title="cell.storedItemName || cell.storedItemCode"
>
{{ cell.storedItemName || cell.storedItemCode }}
</span>
</template>
<span v-else class="cell-empty">—</span>
</div>
</div>
</div>
@@ -278,6 +303,182 @@
</template>
</el-dialog>
<!-- 批量新增子节点弹窗 -->
<el-dialog
v-model="batchChildDialogVisible"
title="批量新增子节点"
width="1160px"
class="dialog-form-layout"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
:close-on-click-modal="false"
@close="handleBatchChildDialogClose"
>
<el-form
ref="batchChildFormRef"
:model="batchChildForm"
:rules="batchChildFormRules"
label-position="top"
class="storage-dialog-form"
scroll-to-error
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
<div class="form-grid-2">
<el-form-item label="上级节点">
<el-input :model-value="batchChildParentPath" disabled />
</el-form-item>
<el-form-item prop="startNum">
<template #label>
节点名称<span class="form-label-tip">名称 = 前缀 + 序号 + 后缀</span>
</template>
<div class="storage-name-compose">
<div class="storage-compose-field storage-compose-field--affix">
<span class="storage-compose-label">前缀</span>
<el-input
v-model="batchChildForm.namePrefix"
class="storage-affix-input"
placeholder="如:盒"
/>
</div>
<div class="storage-compose-field storage-compose-field--seq">
<span class="storage-compose-label">起始序号</span>
<el-input-number
v-model="batchChildForm.startNum"
class="storage-seq-input"
:min="0"
:step="1"
:controls="false"
/>
</div>
<span class="storage-compose-sep">~</span>
<div class="storage-compose-field storage-compose-field--seq">
<span class="storage-compose-label">结束序号</span>
<el-input-number
v-model="batchChildForm.endNum"
class="storage-seq-input"
:min="0"
:step="1"
:controls="false"
/>
</div>
<div class="storage-compose-field storage-compose-field--pad">
<span class="storage-compose-label">补零位数</span>
<el-input-number
v-model="batchChildForm.padWidth"
class="storage-pad-input"
:min="0"
:max="8"
:step="1"
:controls="false"
/>
</div>
<div class="storage-compose-field storage-compose-field--affix">
<span class="storage-compose-label">后缀</span>
<el-input
v-model="batchChildForm.nameSuffix"
class="storage-affix-input"
placeholder="如:号"
/>
</div>
</div>
</el-form-item>
<el-form-item>
<template #label>
节点编号<span class="form-label-tip">可选,与名称共用序号</span>
</template>
<div class="storage-name-compose">
<div class="storage-compose-field storage-compose-field--affix">
<span class="storage-compose-label">前缀</span>
<el-input
v-model="batchChildForm.codePrefix"
class="storage-affix-input"
placeholder="如:B"
/>
</div>
<span class="storage-compose-mid">+ 序号 +</span>
<div class="storage-compose-field storage-compose-field--affix">
<span class="storage-compose-label">后缀</span>
<el-input
v-model="batchChildForm.codeSuffix"
class="storage-affix-input"
placeholder="可空"
/>
</div>
</div>
</el-form-item>
<el-form-item label="节点类型" prop="nodeType">
<el-select v-model="batchChildForm.nodeType" placeholder="请选择节点类型">
<el-option label="设施" value="facility" />
<el-option label="层" value="layer" />
<el-option label="盒" value="box" />
</el-select>
</el-form-item>
<el-form-item label="是否存储格">
<el-switch v-model="batchChildForm.isLeaf" :active-value="1" :inactive-value="0" />
</el-form-item>
<el-form-item>
<template #label>
排序<span class="form-label-tip">按序号自动写入</span>
</template>
<el-input-number
:model-value="batchChildForm.startNum"
disabled
:min="0"
:step="1"
controls-position="right"
style="width: 100%"
/>
</el-form-item>
<el-form-item label="备注" class="form-col-span-2">
<el-input v-model="batchChildForm.remark" placeholder="可选" />
<div class="storage-batch-preview">
<template v-if="batchChildPreview.count > 0">
将创建 <strong>{{ batchChildPreview.count }}</strong> 个子节点
<template v-if="batchChildPreview.samples.length">
,示例:
<span
v-for="(item, idx) in batchChildPreview.samples"
:key="idx"
class="storage-batch-chip"
>
<span class="storage-batch-chip__name">名称 {{ item.name }}</span>
<template v-if="item.code">
<span class="storage-batch-chip__sep">·</span>
<span class="storage-batch-chip__code">编号 {{ item.code }}</span>
</template>
</span>
<span
v-if="batchChildPreview.count > batchChildPreview.samples.length"
class="storage-batch-chip storage-batch-chip--more"
>
…共 {{ batchChildPreview.count }} 个
</span>
</template>
</template>
<template v-else>请填写有效的序号范围(结束 ≥ 起始,单次最多 200 个)</template>
</div>
</el-form-item>
</div>
</el-form>
<template #footer>
<el-button class="btn-ghost" @click="batchChildDialogVisible = false">
<el-icon><Close /></el-icon>
取消
</el-button>
<el-button
class="btn-main"
type="primary"
:loading="batchChildSubmitLoading"
@click="handleBatchChildSubmit"
>
<el-icon><Check /></el-icon>
确定创建
</el-button>
</template>
</el-dialog>
<!-- 格子编辑弹窗 -->
<el-dialog
v-model="slotDialogVisible"
@@ -851,6 +1052,7 @@
import {
fetchStorageFacilityList,
fetchCreateStorageFacility,
fetchBatchCreateStorageFacilities,
fetchUpdateStorageFacility,
fetchDeleteStorageFacility,
fetchStorageSlotList,
@@ -1028,6 +1230,7 @@
const handleNodeClick = (data: any) => {
selectedNode.value = data
resetSlotFilter()
if (data.isLeaf === 1) {
loadSlots(data.id)
} else {
@@ -1048,6 +1251,39 @@
}
}
// ==================== 右侧格子检索 ====================
const slotFilterKeyword = ref('')
const slotFilterActive = computed(() => !!slotFilterKeyword.value.trim())
function slotMatchesFilter(slot: any): boolean {
const q = slotFilterKeyword.value.trim().toLowerCase()
if (!q) return true
const cp = slot.storedCellProduct
const haystacks = [
String(cp?.productName || ''),
String(slot.storedItemName || ''),
String(cp?.productTypeName || ''),
String(cp?.batchNo || '')
].map((s) => s.toLowerCase())
return haystacks.some((text) => text.includes(q))
}
const filteredSlotList = computed(() => {
if (!slotFilterActive.value) return slotList.value
return slotList.value.filter(slotMatchesFilter)
})
const slotFilterHitCount = computed(() =>
slotFilterActive.value ? filteredSlotList.value.length : 0
)
function resetSlotFilter() {
slotFilterKeyword.value = ''
}
// ==================== 货架行计算(按 order_num 布局分组) ====================
const batchForm = reactive({
rows: 4,
@@ -1073,7 +1309,7 @@
})
const shelfRows = computed(() => {
const sorted = sortSlotsForShelf(slotList.value)
const sorted = sortSlotsForShelf(filteredSlotList.value)
const hasLayoutOrder = sorted.some((slot) => getStorageSlotOrderNum(slot) >= SLOT_LAYOUT_ROW_STRIDE)
if (hasLayoutOrder) {
@@ -1195,6 +1431,180 @@
nextTick(() => nodeFormRef.value?.clearValidate?.())
}
// ==================== 批量新增子节点 ====================
const batchChildDialogVisible = ref(false)
const batchChildSubmitLoading = ref(false)
const batchChildFormRef = ref()
const batchChildParentId = ref('')
const batchChildForm = reactive({
namePrefix: '',
nameSuffix: '',
startNum: 1,
endNum: 10,
padWidth: 2,
codePrefix: '',
codeSuffix: '',
nodeType: 'box',
isLeaf: 1 as 0 | 1,
remark: ''
})
const batchChildParentPath = computed(() => {
if (!batchChildParentId.value) return '(根节点)'
return (
buildTreePathLabelFromFlat(batchChildParentId.value, flatList.value, {
nameKey: 'nodeName'
}) || '—'
)
})
function formatBatchSeq(num: number, padWidth: number) {
const s = String(num)
const width = Number(padWidth) || 0
if (width <= 0) return s
return s.padStart(width, '0')
}
const batchChildPreview = computed(() => {
const start = Number(batchChildForm.startNum)
const end = Number(batchChildForm.endNum)
if (!Number.isFinite(start) || !Number.isFinite(end) || end < start) {
return { count: 0, samples: [] as Array<{ name: string; code: string }> }
}
const count = end - start + 1
if (count > 200) {
return { count: 0, samples: [] as Array<{ name: string; code: string }> }
}
const genCode = !!(batchChildForm.codePrefix.trim() || batchChildForm.codeSuffix.trim())
const samples: Array<{ name: string; code: string }> = []
const showMax = Math.min(count, 12)
for (let i = 0; i < showMax; i++) {
const num = start + i
const seq = formatBatchSeq(num, batchChildForm.padWidth)
const name = `${batchChildForm.namePrefix}${seq}${batchChildForm.nameSuffix}`.trim()
const code = genCode
? `${batchChildForm.codePrefix}${seq}${batchChildForm.codeSuffix}`.trim()
: ''
samples.push({ name: name || '(空名称)', code })
}
return { count, samples }
})
const validateBatchChildName = (_rule: any, _value: any, callback: (e?: Error) => void) => {
const start = Number(batchChildForm.startNum)
const end = Number(batchChildForm.endNum)
if (!Number.isFinite(start) || !Number.isFinite(end) || end < start) {
callback()
return
}
const seq = formatBatchSeq(start, batchChildForm.padWidth)
const name = `${batchChildForm.namePrefix}${seq}${batchChildForm.nameSuffix}`.trim()
if (!name) {
callback(new Error('拼出的节点名称不能为空,请填写前缀或后缀'))
return
}
callback()
}
const validateBatchChildRange = (_rule: any, _value: any, callback: (e?: Error) => void) => {
const start = Number(batchChildForm.startNum)
const end = Number(batchChildForm.endNum)
if (!Number.isFinite(start) || !Number.isFinite(end)) {
callback(new Error('请输入有效序号'))
return
}
if (end < start) {
callback(new Error('结束序号不能小于起始序号'))
return
}
if (end - start + 1 > 200) {
callback(new Error('单次最多创建 200 个子节点'))
return
}
callback()
}
const batchChildFormRules = {
startNum: [
{ required: true, message: '请输入起始序号', trigger: 'change' },
{ validator: validateBatchChildRange, trigger: 'change' },
{ validator: validateBatchChildName, trigger: 'change' }
],
endNum: [{ validator: validateBatchChildRange, trigger: 'change' }],
nodeType: [{ required: true, message: '请选择节点类型', trigger: 'change' }]
}
const handleBatchAddChild = (data: any) => {
batchChildParentId.value = data.id
Object.assign(batchChildForm, {
namePrefix: '',
nameSuffix: '',
startNum: 1,
endNum: 10,
padWidth: 2,
codePrefix: '',
codeSuffix: '',
nodeType: data.nodeType === 'facility' ? 'layer' : 'box',
isLeaf: data.nodeType === 'layer' || data.nodeType === 'box' ? 1 : 0,
remark: ''
})
batchChildDialogVisible.value = true
nextTick(() => batchChildFormRef.value?.clearValidate?.())
}
const handleBatchChildSubmit = async () => {
await batchChildFormRef.value?.validate?.()
if (batchChildPreview.value.count <= 0) {
ElMessage.warning('请填写有效的序号范围')
return
}
const sampleName = batchChildPreview.value.samples[0]?.name
if (!sampleName || sampleName === '(空名称)') {
ElMessage.warning('拼出的节点名称不能为空,请填写前缀或后缀')
return
}
batchChildSubmitLoading.value = true
try {
await fetchBatchCreateStorageFacilities({
parentId: batchChildParentId.value || undefined,
namePrefix: batchChildForm.namePrefix,
nameSuffix: batchChildForm.nameSuffix,
startNum: Number(batchChildForm.startNum),
endNum: Number(batchChildForm.endNum),
padWidth: Number(batchChildForm.padWidth) || 0,
codePrefix: batchChildForm.codePrefix,
codeSuffix: batchChildForm.codeSuffix,
nodeType: batchChildForm.nodeType,
isLeaf: batchChildForm.isLeaf,
remark: batchChildForm.remark?.trim() || undefined
})
ElMessage.success(`批量创建 ${batchChildPreview.value.count} 个子节点成功`)
batchChildDialogVisible.value = false
await loadData()
} catch {
/* 接口错误已由全局处理 */
} finally {
batchChildSubmitLoading.value = false
}
}
const handleBatchChildDialogClose = () => {
batchChildParentId.value = ''
Object.assign(batchChildForm, {
namePrefix: '',
nameSuffix: '',
startNum: 1,
endNum: 10,
padWidth: 2,
codePrefix: '',
codeSuffix: '',
nodeType: 'box',
isLeaf: 1,
remark: ''
})
batchChildFormRef.value?.clearValidate?.()
}
const handleEditNode = (data: any) => {
isNodeEdit.value = true
nodeDialogTitle.value = '编辑节点'
@@ -1829,6 +2239,17 @@
border-bottom: 1px solid #f0f0f0;
}
.storage-slot-filter {
display: flex;
justify-content: center;
margin-bottom: 12px;
}
.storage-slot-filter__input {
width: 100%;
max-width: 420px;
}
.storage-content-stats {
font-size: 12px;
color: #909399;
@@ -1869,7 +2290,94 @@
padding: 10px 14px;
font-size: 13px;
color: #065f46;
margin-top: 4px;
margin-top: 8px;
}
.storage-name-compose {
display: flex;
flex-wrap: wrap;
align-items: flex-end;
gap: 8px;
width: 100%;
}
.storage-compose-field {
display: flex;
flex-direction: column;
gap: 4px;
flex: 0 0 auto;
}
.storage-compose-label {
font-size: 12px;
line-height: 1.2;
color: var(--mint-text-muted, #64748b);
white-space: nowrap;
}
.storage-affix-input {
width: 100px;
:deep(.el-input__wrapper) {
padding-left: 8px;
padding-right: 8px;
}
}
.storage-seq-input,
.storage-pad-input {
:deep(.el-input__wrapper) {
padding-left: 8px;
padding-right: 8px;
}
}
.storage-seq-input {
width: 72px;
}
.storage-pad-input {
width: 64px;
}
.storage-compose-sep,
.storage-compose-mid {
flex: 0 0 auto;
align-self: flex-end;
height: 32px;
display: inline-flex;
align-items: center;
color: var(--mint-text-muted, #64748b);
font-size: 12px;
white-space: nowrap;
padding-bottom: 2px;
}
.storage-batch-chip {
display: inline-flex;
align-items: center;
height: 26px;
margin: 4px 6px 0 0;
padding: 0 8px;
border-radius: 6px;
background: #fff;
border: 1px solid #a7f3d0;
color: #1e293b;
font-size: 12px;
}
.storage-batch-chip__sep {
margin: 0 4px;
color: #94a3b8;
}
.storage-batch-chip__code {
color: var(--primary-dark, #059669);
}
.storage-batch-chip--more {
border-style: dashed;
color: #64748b;
}
/* Shelf layout — scroll wrapper for overflow */
@@ -1962,22 +2470,25 @@
background: #fff7ed;
}
/* 占用状态 — 深橙背景 */
/* 占用状态 — 淡红背景 */
&.occupied {
background: #ea580c;
border-color: #c2410c;
background: #fef2f2;
border-color: #fecaca;
&:hover {
background: #c2410c;
background: #fee2e2;
}
.cell-code {
color: #fff;
.cell-empty {
color: #991b1b;
}
.cell-product-code,
.cell-product-name {
color: rgba(255, 255, 255, 0.92);
color: #991b1b;
}
.cell-product-type {
color: #b91c1c;
}
}
@@ -2031,56 +2542,32 @@
}
}
.cell-code {
.cell-empty {
font-size: 12px;
font-weight: 600;
color: #303133;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 72px;
padding: 0 4px;
}
.cell-product-code,
.cell-product-name {
.cell-product-name,
.cell-product-type {
text-align: center;
max-width: 72px;
padding: 0 2px;
}
.cell-product-code {
font-size: 9px;
color: #047857;
line-height: 1.15;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-all;
line-height: 1.2;
}
.cell-product-name {
font-size: 9px;
color: #64748b;
line-height: 1.15;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 11px;
font-weight: 600;
color: #303133;
}
.cell-badge {
position: absolute;
top: 4px;
right: 4px;
min-width: 20px;
height: 20px;
line-height: 20px;
font-size: 11px;
text-align: center;
color: #fff;
background: #f56c6c;
border-radius: 8px;
padding: 0 4px;
.cell-product-type {
font-size: 9px;
color: #64748b;
}
.occupancy-list-toolbar {
@@ -6,7 +6,7 @@
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input v-model="searchForm.keyword" placeholder="物料编码/名称/批次号" clearable />
<el-input v-model="searchForm.keyword" placeholder="物料名称/批次号" clearable />
</el-form-item>
<el-form-item label="物料类型">
<el-select v-model="searchForm.materialType" placeholder="全部" clearable>
@@ -50,13 +50,6 @@
header-align="center"
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column
prop="materialCode"
label="物料编码"
min-width="120"
align="center"
header-align="center"
/>
<el-table-column
prop="materialName"
label="物料名称"
@@ -64,6 +57,9 @@
align="center"
header-align="center"
/>
<el-table-column label="批次号" min-width="120" align="center" header-align="center">
<template #default="{ row }">{{ row.batchNo || '—' }}</template>
</el-table-column>
<el-table-column label="物料类型" min-width="90" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="row.materialType === 'reagent' ? 'success' : 'warning'" size="small">
@@ -71,18 +67,6 @@
</el-tag>
</template>
</el-table-column>
<el-table-column label="批次号" min-width="120" align="center" header-align="center">
<template #default="{ row }">{{ row.batchNo || '—' }}</template>
</el-table-column>
<el-table-column
prop="stockInNo"
label="入库编号"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.stockInNo || '—' }}</template>
</el-table-column>
<el-table-column label="消耗数量" min-width="100" align="center" header-align="center">
<template #default="{ row }">
{{ displayConsumptionQty(row) }}
@@ -24,13 +24,6 @@
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
<div class="form-grid-2">
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="formData.materialCode"
placeholder="请输入物料编码"
:disabled="isEdit"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="formData.materialName" placeholder="请输入物料名称" />
</el-form-item>
@@ -85,7 +78,7 @@
<el-option
v-for="opt in componentOptions"
:key="opt.id"
:label="`${opt.materialName}(${opt.materialCode})`"
:label="opt.materialName"
:value="opt.id"
/>
</el-select>
@@ -170,7 +163,6 @@
remark: ''
})
const formRules: FormRules = {
materialCode: [{ required: true, message: '请输入物料编码', trigger: 'blur' }],
materialName: [{ required: true, message: '请输入物料名称', trigger: 'blur' }]
}
@@ -317,9 +309,11 @@
saving.value = true
try {
let id = materialId.value
const materialCode =
(formData.materialCode || '').trim() || `PM-${String(Date.now()).slice(-6)}`
const payload = {
materialType: 'configured_reagent',
materialCode: formData.materialCode.trim(),
materialCode,
materialName: formData.materialName.trim(),
specModel: formData.specModel.trim(),
unit: formData.unit.trim(),
@@ -139,13 +139,6 @@
/>
</el-select>
</el-form-item>
<el-form-item label="入库编号">
<el-input
v-model="formData.stockInNo"
:placeholder="dialogReadonly ? '' : '留空自动生成'"
clearable
/>
</el-form-item>
<el-form-item label="入库日期" prop="stockInDate">
<el-date-picker
v-model="formData.stockInDate"
@@ -164,13 +157,6 @@
style="width: 100%"
/>
</el-form-item>
<el-form-item label="货号">
<el-input
v-model="formData.catalogNo"
:placeholder="dialogReadonly ? '' : '留空自动生成'"
clearable
/>
</el-form-item>
<el-form-item label="批号">
<el-input
v-model="formData.batchNo"
@@ -248,15 +234,6 @@
align="center"
header-align="center"
/>
<el-table-column
label="物料编码"
min-width="120"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.materialCode || '—' }}</template>
</el-table-column>
<el-table-column
label="物料名称"
min-width="140"
@@ -266,6 +243,14 @@
>
<template #default="{ row }">{{ row.materialName || '—' }}</template>
</el-table-column>
<el-table-column
label="批次号"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.batchNo || '—' }}</template>
</el-table-column>
<el-table-column
label="物料类型"
min-width="90"
@@ -281,34 +266,6 @@
</el-tag>
</template>
</el-table-column>
<el-table-column
v-if="dialogReadonly"
label="入库编号"
min-width="120"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.stockInNo || '—' }}</template>
</el-table-column>
<el-table-column
label="批次号"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.batchNo || '—' }}</template>
</el-table-column>
<el-table-column
v-if="dialogReadonly"
label="货号"
min-width="100"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.catalogNo || '—' }}</template>
</el-table-column>
<el-table-column
v-if="dialogReadonly"
label="厂家"
@@ -412,7 +369,7 @@
<div class="material-select-filter">
<el-input
v-model="materialKeyword"
placeholder="搜索物料名称/编码/领用人/入库编号/批号"
placeholder="搜索物料名称/领用人/批号"
clearable
class="material-select-search"
@input="loadAvailableMaterials"
@@ -444,14 +401,6 @@
@selection-change="handleMaterialSelectionChange"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
prop="materialCode"
label="物料编码"
min-width="120"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="materialName"
label="物料名称"
@@ -460,6 +409,23 @@
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="batchNo"
label="批号"
min-width="120"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="stockInDate"
label="入库日期"
min-width="110"
align="center"
header-align="center"
>
<template #default="{ row }">{{ formatDisplayOrDash(row.stockInDate) }}</template>
</el-table-column>
<el-table-column label="类型" min-width="80" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="row.materialType === 'reagent' ? 'success' : 'warning'" size="small">
@@ -477,41 +443,6 @@
>
<template #default="{ row }">{{ row.specModel || '—' }}</template>
</el-table-column>
<el-table-column
prop="catalogNo"
label="货号"
min-width="100"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.catalogNo || '—' }}</template>
</el-table-column>
<el-table-column
prop="stockInNo"
label="入库编号"
min-width="120"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="stockInDate"
label="入库日期"
min-width="110"
align="center"
header-align="center"
>
<template #default="{ row }">{{ formatDisplayOrDash(row.stockInDate) }}</template>
</el-table-column>
<el-table-column
prop="batchNo"
label="批号"
min-width="120"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="expireDate"
label="过期日期"
@@ -235,7 +235,7 @@
<el-input
v-model="requisitionKeyword"
class="unused-list-search"
placeholder="搜索物料/批号/入库编号/领用人"
placeholder="搜索物料/批号/领用人"
clearable
@input="debouncedLoadRequisitions"
/>
@@ -305,7 +305,7 @@
</div>
<div class="unused-line-item__meta">
<span>{{ line.unusedQty }}{{ line.unit || '' }}</span>
<span>{{ line.batchNo || line.stockInNo || '—' }}</span>
<span>{{ line.batchNo || '—' }}</span>
</div>
<div class="unused-line-item__actions" @click.stop>
<el-button link type="danger" size="small" @click="removeManualLine(line._key)">
@@ -323,8 +323,7 @@
<div>
<h3 class="unused-detail-title">{{ activeRequisition.materialName }}</h3>
<p class="unused-detail-sub">
{{ activeRequisition.stockInNo || '—' }} · 批号
{{ activeRequisition.batchNo || '—' }} · 领用
批号 {{ activeRequisition.batchNo || '—' }} · 领用
{{ activeRequisition.requisitionQty }}{{ activeRequisition.unit || '' }}
<template v-if="activeRequisition.taskConsumedQty > 0">
· 任务已消耗 {{ activeRequisition.taskConsumedQty
@@ -407,7 +406,7 @@
filterable
remote
clearable
placeholder="输入入库编号、物料名称、批号检索"
placeholder="输入物料名称、批号检索"
popper-class="batch-out-option-popper"
style="width: 100%"
:loading="batchOptionsLoading"
@@ -422,10 +421,10 @@
>
<div class="batch-option-item">
<span class="batch-option-main"
>{{ opt.stockInNo }} · {{ opt.materialName }}</span
>{{ opt.materialName }} · 批号 {{ opt.batchNo || '—' }}</span
>
<span class="batch-option-sub">
批号:{{ opt.batchNo || '—' }} · 剩余 {{ opt.remainingQty
剩余 {{ opt.remainingQty
}}{{ opt.unit || '' }}
</span>
</div>
@@ -434,9 +433,6 @@
</el-form-item>
<div v-if="manualDraft.fromBatch" class="unused-readonly-grid">
<div><span class="ro-label">物料</span>{{ manualDraft.materialName || '—' }}</div>
<div
><span class="ro-label">入库编号</span>{{ manualDraft.stockInNo || '—' }}</div
>
<div><span class="ro-label">批号</span>{{ manualDraft.batchNo || '—' }}</div>
<div><span class="ro-label">规格</span>{{ manualDraft.specModel || '—' }}</div>
<div><span class="ro-label">厂家</span>{{ manualDraft.manufacturer || '—' }}</div>
@@ -548,12 +544,16 @@
header-align="center"
/>
<el-table-column
label="入库编号"
min-width="110"
label="物料名称"
min-width="130"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ displayText(row.stockInNo) }}</template>
<template #default="{ row }">{{ displayText(row.materialName) }}</template>
</el-table-column>
<el-table-column label="批号" min-width="90" align="center" header-align="center">
<template #default="{ row }">{{ displayText(row.batchNo) }}</template>
</el-table-column>
<el-table-column
label="入库日期"
@@ -571,23 +571,6 @@
>
<template #default="{ row }">{{ displayText(row.expireDate) }}</template>
</el-table-column>
<el-table-column
label="物料编码"
min-width="110"
align="center"
header-align="center"
>
<template #default="{ row }">{{ displayText(row.materialCode) }}</template>
</el-table-column>
<el-table-column
label="物料名称"
min-width="130"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ displayText(row.materialName) }}</template>
</el-table-column>
<el-table-column
label="规格型号"
min-width="100"
@@ -600,12 +583,6 @@
<el-table-column label="单位" min-width="72" align="center" header-align="center">
<template #default="{ row }">{{ displayText(row.unit) }}</template>
</el-table-column>
<el-table-column label="货号" min-width="100" align="center" header-align="center">
<template #default="{ row }">{{ displayText(row.catalogNo) }}</template>
</el-table-column>
<el-table-column label="批号" min-width="90" align="center" header-align="center">
<template #default="{ row }">{{ displayText(row.batchNo) }}</template>
</el-table-column>
<el-table-column
label="厂家"
min-width="110"
@@ -669,12 +646,16 @@
header-align="center"
/>
<el-table-column
label="入库编号"
min-width="110"
label="物料名称"
min-width="130"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ displayText(row.stockInNo) }}</template>
<template #default="{ row }">{{ displayText(row.materialName) }}</template>
</el-table-column>
<el-table-column label="批号" min-width="90" align="center" header-align="center">
<template #default="{ row }">{{ displayText(row.batchNo) }}</template>
</el-table-column>
<el-table-column
label="入库日期"
@@ -692,23 +673,6 @@
>
<template #default="{ row }">{{ displayText(row.expireDate) }}</template>
</el-table-column>
<el-table-column
label="物料编码"
min-width="110"
align="center"
header-align="center"
>
<template #default="{ row }">{{ displayText(row.materialCode) }}</template>
</el-table-column>
<el-table-column
label="物料名称"
min-width="130"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ displayText(row.materialName) }}</template>
</el-table-column>
<el-table-column
label="规格型号"
min-width="100"
@@ -721,12 +685,6 @@
<el-table-column label="单位" min-width="72" align="center" header-align="center">
<template #default="{ row }">{{ displayText(row.unit) }}</template>
</el-table-column>
<el-table-column label="货号" min-width="100" align="center" header-align="center">
<template #default="{ row }">{{ displayText(row.catalogNo) }}</template>
</el-table-column>
<el-table-column label="批号" min-width="90" align="center" header-align="center">
<template #default="{ row }">{{ displayText(row.batchNo) }}</template>
</el-table-column>
<el-table-column
label="厂家"
min-width="110"
@@ -8,7 +8,7 @@
<el-form-item label="关键词">
<el-input
v-model="searchForm.keyword"
placeholder="物料编码/名称/入库编号/批号/货号"
placeholder="物料名称/批号"
clearable
/>
</el-form-item>
@@ -85,13 +85,6 @@
header-align="center"
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column
prop="materialCode"
label="物料编码"
min-width="120"
align="center"
header-align="center"
/>
<el-table-column
prop="materialName"
label="物料名称"
@@ -99,6 +92,12 @@
align="center"
header-align="center"
/>
<el-table-column label="批号" min-width="100" align="center" header-align="center">
<template #default="{ row }">{{ row.batchNo || '—' }}</template>
</el-table-column>
<el-table-column label="入库日期" min-width="110" align="center" header-align="center">
<template #default="{ row }">{{ formatDisplayOrDash(row.stockInDate) }}</template>
</el-table-column>
<el-table-column label="物料类型" min-width="100" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="productionMaterialTypeTagType(row.materialType)" size="small">
@@ -106,24 +105,6 @@
</el-tag>
</template>
</el-table-column>
<el-table-column
prop="stockInNo"
label="入库编号"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.stockInNo || '—' }}</template>
</el-table-column>
<el-table-column label="入库日期" min-width="110" align="center" header-align="center">
<template #default="{ row }">{{ formatDisplayOrDash(row.stockInDate) }}</template>
</el-table-column>
<el-table-column label="货号" min-width="100" align="center" header-align="center">
<template #default="{ row }">{{ row.catalogNo || '—' }}</template>
</el-table-column>
<el-table-column label="批号" min-width="100" align="center" header-align="center">
<template #default="{ row }">{{ row.batchNo || '—' }}</template>
</el-table-column>
<el-table-column
label="厂家"
min-width="120"
@@ -646,17 +627,14 @@
{
title: '变动信息',
fields: [
{ label: '物料编码', value: row.materialCode },
{ label: '物料名称', value: row.materialName },
{ label: '批号', value: row.batchNo || '—' },
{ label: '入库日期', value: row.stockInDate || '—' },
{
label: '物料类型',
value: productionMaterialTypeLabel(row.materialType),
tagType: productionMaterialTypeTagType(row.materialType) as any
},
{ label: '入库编号', value: row.stockInNo || '—' },
{ label: '入库日期', value: row.stockInDate || '—' },
{ label: '货号', value: row.catalogNo || '—' },
{ label: '批号', value: row.batchNo || '—' },
{ label: '厂家', value: row.manufacturer || '—' },
{
label: '单价(元)',
@@ -25,7 +25,7 @@
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input v-model="searchForm.keyword" placeholder="物料编码/名称" clearable />
<el-input v-model="searchForm.keyword" placeholder="物料名称/批号" clearable />
</el-form-item>
<el-form-item label="物料类型">
<el-select v-model="searchForm.materialType" placeholder="全部" clearable>
@@ -106,9 +106,16 @@
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column
prop="stockInNo"
label="入库编号"
min-width="120"
prop="materialName"
label="物料名称"
min-width="150"
align="center"
header-align="center"
/>
<el-table-column
prop="batchNo"
label="批号"
min-width="100"
align="center"
header-align="center"
/>
@@ -133,20 +140,6 @@
align="center"
header-align="center"
/>
<el-table-column
prop="materialCode"
label="物料编码"
min-width="130"
align="center"
header-align="center"
/>
<el-table-column
prop="materialName"
label="物料名称"
min-width="150"
align="center"
header-align="center"
/>
<el-table-column label="物料类型" min-width="100" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="productionMaterialTypeTagType(row.materialType)" size="small">
@@ -168,20 +161,6 @@
align="center"
header-align="center"
/>
<el-table-column
prop="catalogNo"
label="货号"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
prop="batchNo"
label="批号"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
prop="manufacturer"
label="厂家"
@@ -303,15 +282,9 @@
<el-form-item label="物资" prop="materialName">
<el-input v-model="formData.materialName" placeholder="请输入物资名称" />
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input v-model="formData.materialCode" placeholder="请输入物料编码" />
</el-form-item>
<el-form-item label="规格型号" prop="specModel">
<el-input v-model="formData.specModel" placeholder="请输入规格型号" />
</el-form-item>
<el-form-item label="入库编号" prop="stockInNo">
<el-input v-model="formData.stockInNo" placeholder="请输入入库编号" />
</el-form-item>
<el-form-item label="入库日期" prop="stockInDate">
<el-date-picker
v-model="formData.stockInDate"
@@ -339,9 +312,6 @@
style="width: 100%"
/>
</el-form-item>
<el-form-item label="货号" prop="catalogNo">
<el-input v-model="formData.catalogNo" placeholder="请输入货号" />
</el-form-item>
<el-form-item label="批号" prop="batchNo">
<el-input v-model="formData.batchNo" placeholder="请输入批号" />
</el-form-item>
@@ -461,7 +431,7 @@
<el-option
v-for="opt in materialOptions"
:key="opt.id"
:label="`${opt.materialName}(${opt.materialCode})`"
:label="opt.materialName"
:value="opt.id"
/>
</el-select>
@@ -480,19 +450,6 @@
<el-option label="耗材" value="consumable" />
</el-select>
</el-form-item>
<el-form-item label="物料编码" prop="newMaterialCode">
<el-input
v-if="stockInIsManualMaterial"
v-model="stockInForm.newMaterialCode"
placeholder="新物资编码"
/>
<el-input
v-else
:model-value="stockInSelectedOpt?.materialCode || ''"
disabled
placeholder="选择物资后自动带出"
/>
</el-form-item>
<el-form-item label="规格型号">
<el-input
v-if="stockInIsManualMaterial"
@@ -506,9 +463,6 @@
placeholder="—"
/>
</el-form-item>
<el-form-item label="入库编号" prop="stockInNo">
<el-input v-model="stockInForm.stockInNo" placeholder="请输入入库编号" />
</el-form-item>
<el-form-item label="入库日期" prop="stockInDate">
<el-date-picker
v-model="stockInForm.stockInDate"
@@ -536,9 +490,6 @@
style="width: 100%"
/>
</el-form-item>
<el-form-item label="货号" prop="catalogNo">
<el-input v-model="stockInForm.catalogNo" placeholder="请输入货号" />
</el-form-item>
<el-form-item label="批号" prop="batchNo">
<el-input v-model="stockInForm.batchNo" placeholder="请输入批号" />
</el-form-item>
@@ -713,7 +664,7 @@
<el-option
v-for="opt in materialOptions"
:key="opt.id"
:label="`${opt.materialName}(${opt.materialCode})`"
:label="opt.materialName"
:value="opt.id"
/>
</el-select>
@@ -734,9 +685,6 @@
placeholder="选择物资后自动带出"
/>
</el-form-item>
<el-form-item label="入库编号">
<el-input v-model="row.stockInNo" size="small" placeholder="必填" />
</el-form-item>
<el-form-item label="入库日期">
<el-date-picker
v-model="row.stockInDate"
@@ -767,9 +715,6 @@
style="width: 100%"
/>
</el-form-item>
<el-form-item label="货号">
<el-input v-model="row.catalogNo" size="small" placeholder="必填" />
</el-form-item>
<el-form-item label="批号">
<el-input v-model="row.batchNo" size="small" placeholder="必填" />
</el-form-item>
@@ -903,7 +848,7 @@
<div class="batch-stock-move-lines-head-left">
<span class="batch-stock-move-lines-title">出库明细</span>
<span class="batch-stock-move-lines-hint">
共 {{ batchStockOutLines.length }} 项,按入库编号选择批次
共 {{ batchStockOutLines.length }} 项,按物料与批号选择批次
</span>
</div>
<el-button class="btn-ghost" @click="addBatchStockOutLine">
@@ -926,7 +871,7 @@
header-align="center"
/>
<el-table-column
label="入库编号"
label="物料批次"
min-width="280"
align="center"
header-align="center"
@@ -937,7 +882,7 @@
filterable
remote
clearable
placeholder="选择入库批次"
placeholder="选择物料批次"
class="inner-cell-input batch-out-select"
popper-class="batch-out-option-popper"
:loading="batchOptionsLoading"
@@ -947,17 +892,16 @@
<el-option
v-for="opt in batchOptions"
:key="opt.id"
:label="opt.label"
:label="`${opt.materialName} · 批号 ${opt.batchNo || '—'}`"
:value="opt.id"
:disabled="isBatchOutOptionDisabled(opt.id, $index)"
>
<div class="batch-option-item">
<span class="batch-option-main"
>{{ opt.stockInNo }} · {{ opt.materialName }}</span
>{{ opt.materialName }} · 批号 {{ opt.batchNo || '—' }}</span
>
<span class="batch-option-sub">
厂家:{{ opt.manufacturer || '—' }} · 批号:{{ opt.batchNo || '—' }} ·
货号:{{ opt.catalogNo || '—' }} · 剩余 {{ opt.remainingQty
厂家:{{ opt.manufacturer || '—' }} · 剩余 {{ opt.remainingQty
}}{{ opt.unit || '' }}
</span>
</div>
@@ -1141,7 +1085,7 @@
<div class="batch-stock-move-lines-head-left">
<span class="batch-stock-move-lines-title">废弃明细</span>
<span class="batch-stock-move-lines-hint">
共 {{ batchDiscardLines.length }} 项,按入库编号选择批次
共 {{ batchDiscardLines.length }} 项,按物料与批号选择批次
</span>
</div>
<el-button class="btn-ghost" @click="addBatchDiscardLine">
@@ -1164,7 +1108,7 @@
header-align="center"
/>
<el-table-column
label="入库编号"
label="物料批次"
min-width="280"
align="center"
header-align="center"
@@ -1175,7 +1119,7 @@
filterable
remote
clearable
placeholder="选择入库批次"
placeholder="选择物料批次"
class="inner-cell-input batch-out-select"
popper-class="batch-out-option-popper"
:loading="batchOptionsLoading"
@@ -1185,17 +1129,16 @@
<el-option
v-for="opt in batchOptions"
:key="opt.id"
:label="opt.label"
:label="`${opt.materialName} · 批号 ${opt.batchNo || '—'}`"
:value="opt.id"
:disabled="isBatchDiscardOptionDisabled(opt.id, $index)"
>
<div class="batch-option-item">
<span class="batch-option-main"
>{{ opt.stockInNo }} · {{ opt.materialName }}</span
>{{ opt.materialName }} · 批号 {{ opt.batchNo || '—' }}</span
>
<span class="batch-option-sub">
厂家:{{ opt.manufacturer || '—' }} · 批号:{{ opt.batchNo || '—' }} ·
货号:{{ opt.catalogNo || '—' }} · 剩余 {{ opt.remainingQty
厂家:{{ opt.manufacturer || '—' }} · 剩余 {{ opt.remainingQty
}}{{ opt.unit || '' }}
</span>
</div>
@@ -1590,15 +1533,12 @@
})
const formRules = {
stockInNo: [{ required: true, message: '请输入入库编号', trigger: 'blur' }],
stockInDate: [{ required: true, message: '请选择入库日期', trigger: 'change' }],
expireDate: [{ required: true, message: '请选择过期日期', trigger: 'change' }],
catalogNo: [{ required: true, message: '请输入货号', trigger: 'blur' }],
batchNo: [{ required: true, message: '请输入批号', trigger: 'blur' }],
manufacturer: [{ required: true, message: '请输入厂家', trigger: 'blur' }],
unitPrice: [{ required: true, message: '请输入单价', trigger: 'change' }],
amount: [{ required: true, message: '请输入金额', trigger: 'change' }],
materialCode: [{ required: true, message: '请输入物料编码', trigger: 'blur' }],
materialName: [{ required: true, message: '请输入物料名称', trigger: 'blur' }]
}
@@ -1643,20 +1583,8 @@
const stockInRules = {
materialKey: [{ required: true, message: '请选择或输入物资', trigger: 'change' }],
newMaterialCode: [
{
validator: (_r: unknown, _v: unknown, cb: (e?: Error) => void) => {
if (!stockInIsManualMaterial.value) return cb()
if (!(stockInForm.newMaterialCode || '').trim()) return cb(new Error('请输入新物资编码'))
cb()
},
trigger: 'blur'
}
],
stockInNo: [{ required: true, message: '请输入入库编号', trigger: 'blur' }],
stockInDate: [{ required: true, message: '请选择入库日期', trigger: 'change' }],
expireDate: [{ required: true, message: '请选择过期日期', trigger: 'change' }],
catalogNo: [{ required: true, message: '请输入货号', trigger: 'blur' }],
batchNo: [{ required: true, message: '请输入批号', trigger: 'blur' }],
manufacturer: [{ required: true, message: '请输入厂家', trigger: 'blur' }],
unitPrice: [{ required: true, message: '请输入单价', trigger: 'change' }],
@@ -1896,12 +1824,11 @@
if (!viewRow.value) return []
const row = viewRow.value
const batchFields = [
{ label: '入库编号', value: row.stockInNo },
{ label: '物料名称', value: row.materialName },
{ label: '批号', value: row.batchNo },
{ label: '入库日期', value: row.stockInDate },
{ label: '过期日期', value: row.expireDate },
{ label: '生产日期', value: row.productionDate || '—' },
{ label: '货号', value: row.catalogNo },
{ label: '批号', value: row.batchNo },
{ label: '厂家', value: row.manufacturer },
{ label: '存储位置', value: row.storageLocation || '—' },
...(isConfiguredReagentRow(row)
@@ -1921,8 +1848,6 @@
{
title: '物资信息',
fields: [
{ label: '物料编码', value: row.materialCode },
{ label: '物料名称', value: row.materialName },
{ label: '规格型号', value: row.specModel },
{ label: '单位', value: row.unit },
{
@@ -2117,6 +2042,35 @@
return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`
}
/** 入库编号默认值:RK + 年月日时分秒 + 2 位随机数(与配置试剂入库风格一致) */
function generateStockInNo() {
const now = new Date()
const pad = (n: number) => String(n).padStart(2, '0')
const day = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}`
const time = `${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`
const rand = String(Math.floor(Math.random() * 100)).padStart(2, '0')
return `RK${day}${time}${rand}`
}
/** 货号默认值:物料编码 → 批号 → — */
function resolveCatalogNo(materialCode?: string, batchNo?: string, catalogNo?: string) {
const existing = (catalogNo || '').trim()
if (existing) return existing
const code = (materialCode || '').trim()
if (code) return code
const batch = (batchNo || '').trim()
if (batch) return batch
return '—'
}
function ensureNewMaterialCode() {
if ((stockInForm.newMaterialCode || '').trim()) return stockInForm.newMaterialCode.trim()
const pad = String(Date.now()).slice(-6)
const code = `PM-${pad}`
stockInForm.newMaterialCode = code
return code
}
function onStockInMaterialKeyChange(val: string) {
const opt = materialOptions.value.find((o) => o.id === val)
if (opt) {
@@ -2126,9 +2080,8 @@
stockInForm.newUnit = ''
} else {
stockInForm.materialId = ''
if (val && !stockInForm.newMaterialCode) {
const pad = String(Date.now()).slice(-6)
stockInForm.newMaterialCode = `PM-${pad}`
if (val) {
ensureNewMaterialCode()
}
}
}
@@ -2138,7 +2091,7 @@
const name = (stockInForm.materialKey || '').trim()
if (!name) throw new Error('请选择或输入物资')
const created = await fetchCreateProductionMaterial({
materialCode: (stockInForm.newMaterialCode || '').trim(),
materialCode: ensureNewMaterialCode(),
materialName: name,
materialType: stockInForm.newMaterialType || 'consumable',
specModel: stockInForm.newSpecModel?.trim() || undefined,
@@ -2187,12 +2140,22 @@
stockInLoading.value = true
try {
const materialId = await resolveStockInMaterialId()
const materialCode =
stockInSelectedOpt.value?.materialCode ||
(stockInForm.newMaterialCode || '').trim() ||
''
const stockInNo = (stockInForm.stockInNo || '').trim() || generateStockInNo()
const catalogNo = resolveCatalogNo(
materialCode,
stockInForm.batchNo,
stockInForm.catalogNo
)
await fetchStockInProductionMaterial(materialId, {
stockInNo: stockInForm.stockInNo.trim(),
stockInNo,
stockInDate: stockInForm.stockInDate,
expireDate: stockInForm.expireDate,
productionDate: stockInForm.productionDate || undefined,
catalogNo: stockInForm.catalogNo.trim(),
catalogNo,
batchNo: stockInForm.batchNo.trim(),
manufacturer: stockInForm.manufacturer.trim(),
storageLocation: stockInForm.storageLocation?.trim() || undefined,
@@ -2432,10 +2395,6 @@
ElMessage.warning('请选择物资')
return
}
if (!line.stockInNo?.trim()) {
ElMessage.warning('请填写入库编号')
return
}
if (!line.stockInDate) {
ElMessage.warning('请选择入库日期')
return
@@ -2444,8 +2403,8 @@
ElMessage.warning('请选择过期日期')
return
}
if (!line.catalogNo?.trim() || !line.batchNo?.trim() || !line.manufacturer?.trim()) {
ElMessage.warning('请填写货号、批号、厂家')
if (!line.batchNo?.trim() || !line.manufacturer?.trim()) {
ElMessage.warning('请填写批号、厂家')
return
}
if (line.unitPrice == null || line.amount == null) {
@@ -2469,13 +2428,13 @@
batchStockInLoading.value = true
try {
const res = await fetchBatchStockInProductionMaterial({
items: batchStockInLines.value.map((l) => ({
items: batchStockInLines.value.map((l, idx) => ({
materialId: l.materialId,
stockInNo: l.stockInNo.trim(),
stockInNo: (l.stockInNo || '').trim() || `${generateStockInNo()}${String(idx).padStart(2, '0')}`,
stockInDate: l.stockInDate,
expireDate: l.expireDate,
productionDate: l.productionDate || undefined,
catalogNo: l.catalogNo.trim(),
catalogNo: resolveCatalogNo(l.materialCode, l.batchNo, l.catalogNo),
batchNo: l.batchNo.trim(),
manufacturer: l.manufacturer.trim(),
storageLocation: l.storageLocation?.trim() || undefined,
@@ -450,11 +450,8 @@
form.routeId = ''
form.description = ''
form.remark = ''
if (
props.workOrderRow?.workOrderType === 'temporary' &&
props.workOrderRow?.workOrderNo
) {
form.taskName = `${props.workOrderRow.workOrderNo}任务`
if (props.workOrderRow?.workOrderType === 'temporary') {
form.taskName = '任务'
}
void remoteSearchRoutes('')
}
@@ -24,12 +24,9 @@
/>
<span class="production-work-order-card__index">{{ cardIndex(idx) }}</span>
<template v-if="isInboundSampleTitle(row)">
<span class="production-work-order-card__no">
{{ inboundCardTitleLab(row) }} -
</span>
<SampleCodeWithSpecialDisplay
class="production-work-order-card__no"
:sample-code="row.sampleCode"
:sample-code="inboundCardTitleLab(row)"
:is-special="!!row.isSpecial"
:special-remark="row.specialRemark"
monospace
@@ -151,6 +148,9 @@
v-if="field.kind === 'tag'"
:type="field.getTagType?.(row) || 'info'"
size="small"
:class="{
'production-work-order-card__qc-conclusion': field.label === '质检结论'
}"
>
{{ field.getValue(row) }}
</el-tag>
@@ -405,7 +405,7 @@
function cardTitleLabel(row: ProductionWorkOrderItem) {
if (isInboundSampleTitle(row)) {
return `${inboundCardTitleLab(row)} - ${(row.sampleCode || '').trim() || '—'}`
return inboundCardTitleLab(row)
}
if (isTemporaryWorkOrderTitle(row)) {
return (row.remark || '').trim() || row.workOrderNo || '—'
@@ -632,6 +632,10 @@
min-width: 0;
}
.production-work-order-card__qc-conclusion.el-tag {
font-weight: 600;
}
.production-work-order-card__checkbox {
flex-shrink: 0;
margin-right: -4px;
@@ -41,16 +41,18 @@
lazy
>
<template #label>
<span class="production-task-tabs__label">{{ section.taskName }}</span>
<span class="production-task-tabs__label">{{ displayTaskName(section) }}</span>
<span class="production-task-tabs__count">
{{ section.completedStepCount }}/{{ section.stepCount }}
</span>
</template>
<template v-if="activeTaskKey === section.key">
<div class="production-task-tabs__meta">
<span v-if="section.taskNo" class="production-task-tabs__meta-item">{{
section.taskNo
}}</span>
<span
v-if="section.taskNo && !isTemporaryWorkOrder"
class="production-task-tabs__meta-item"
>{{ section.taskNo }}</span
>
<span v-if="section.assigneeUserName" class="production-task-tabs__meta-item">
负责人:{{ section.assigneeUserName }}
</span>
@@ -297,6 +299,22 @@
return status === 'dpz' || status === 'jxz'
})
const isTemporaryWorkOrder = computed(() => props.workOrder?.workOrderType === 'temporary')
/** 临时工单:Tab 标题去掉工单号前缀(如 LSSC…004任务 → 任务) */
function displayTaskName(section: ProductionTaskSection) {
const raw = String(section.taskName || '').trim()
if (!isTemporaryWorkOrder.value) return raw || '生产任务'
const woNo = String(
props.workOrder?.workOrderNo || section.task?.workOrderNo || ''
).trim()
if (woNo && raw.startsWith(woNo)) {
const stripped = raw.slice(woNo.length).trim()
return stripped || '任务'
}
return raw || '任务'
}
function taskStatusTag(status: string) {
const map: Record<string, { label: string; type: string }> = {
dpz: { label: '待配置', type: 'info' },
@@ -247,20 +247,27 @@
defineOptions({ name: 'QcWorkOrderProtocolPaymentPanel' })
const props = defineProps<{
summary?: QcProtocolPaymentSummary | null
/** 嵌入查看弹窗时隐藏区块标题,避免与 section 标题重复 */
embedded?: boolean
/** 列表卡片等窄区域:单行摘要 + 紧凑明细,不展示表格 */
compact?: boolean
/** 紧凑摘要行隐藏整体缴费状态 Tag */
hideOverallPayStatus?: boolean
/** 分期明细 chip 隐藏应缴/实收金额 */
hideInstallmentDetailAmounts?: boolean
}>()
const props = withDefaults(
defineProps<{
summary?: QcProtocolPaymentSummary | null
/** 嵌入查看弹窗时隐藏区块标题,避免与 section 标题重复 */
embedded?: boolean
/** 列表卡片等窄区域:单行摘要 + 紧凑明细,不展示表格 */
compact?: boolean
/** 紧凑摘要行隐藏整体缴费状态 Tag */
hideOverallPayStatus?: boolean
/** 分期明细 chip 隐藏应缴/实收金额 */
hideInstallmentDetailAmounts?: boolean
/** 紧凑模式下默认展开完整缴费摘要(采集协议单列表卡片) */
defaultExpanded?: boolean
}>(),
{
defaultExpanded: false
}
)
/** 列表卡片协议费用默认折叠 */
const feeExpanded = ref(false)
/** 列表卡片协议费用:可由 defaultExpanded 控制初始展开 */
const feeExpanded = ref(!!props.defaultExpanded)
const isInstallment = computed(() => isInstallmentPayMode(props.summary?.payMode || ''))
@@ -86,6 +86,15 @@
>
{{ workOrderStatusLabel(wo.workOrderStatus) }}
</el-tag>
<el-tag
v-if="wo.qcConclusion"
:type="qcWorkOrderConclusionTagType(wo.qcConclusion)"
size="small"
class="qc-wo-tab__conclusion"
>
{{ wo.qcConclusionLabel || qcWorkOrderConclusionLabel(wo.qcConclusion) }}
</el-tag>
<span v-else class="qc-wo-tab__conclusion-empty">—</span>
</button>
</div>
</div>
@@ -123,7 +132,7 @@
import type { QcWorkOrder } from '@/api/qc-work-order'
import type { QcTask } from '@/api/qc-task'
import type { QcInspectionBatch } from '@/utils/qc-inspection-batch'
import { workOrderStatusLabel } from '@/utils/qc-labels'
import { workOrderStatusLabel, qcWorkOrderConclusionLabel, qcWorkOrderConclusionTagType } from '@/utils/qc-labels'
import type { TagType } from '@/utils/status-tag-registry'
import {
type QcWorkOrderSampleGroupModel,
@@ -651,6 +660,12 @@
margin-left: 2px;
}
.qc-wo-tab__conclusion-empty {
margin-left: 2px;
color: var(--mint-text-muted, #64748b);
font-size: 12px;
}
.qc-sample-row :deep(.qc-work-order-card) {
border: none;
border-radius: 0;
@@ -33,6 +33,14 @@
<el-tag :type="workOrderStatusTagType(row.workOrderStatus)" size="small">
{{ workOrderStatusLabel(row.workOrderStatus) }}
</el-tag>
<el-tag
v-if="row.qcConclusion"
:type="qcWorkOrderConclusionTagType(row.qcConclusion)"
size="small"
>
{{ row.qcConclusionLabel || qcWorkOrderConclusionLabel(row.qcConclusion) }}
</el-tag>
<span v-else class="qc-work-order-card__conclusion-empty">—</span>
<el-tag
v-if="effectiveCardMeta.showTriggerTag"
:type="resolveTriggerTagType(row)"
@@ -232,7 +240,7 @@
import type { QcWorkOrder, OutboundQcDetailProduct } from '@/api/qc-work-order'
import type { QcTask } from '@/api/qc-task'
import type { QcInspectionBatch } from '@/utils/qc-inspection-batch'
import { workOrderStatusLabel } from '@/utils/qc-labels'
import { workOrderStatusLabel, qcWorkOrderConclusionLabel, qcWorkOrderConclusionTagType } from '@/utils/qc-labels'
import type { TagType } from '@/utils/status-tag-registry'
import { productStatusLabel, productStatusTagType } from '@/utils/status-tag-registry'
import {
@@ -501,6 +509,11 @@
margin-bottom: 10px;
}
.qc-work-order-card__conclusion-empty {
color: var(--mint-text-muted, #64748b);
font-size: 12px;
}
.qc-work-order-card__index {
flex-shrink: 0;
font-size: 12px;
@@ -149,7 +149,9 @@
:title="remarkEditTitle"
:initial-remark="remarkEditInitialRemark"
:initial-work-order-status="remarkEditInitialStatus"
:initial-qc-conclusion="remarkEditInitialConclusion"
show-work-order-status
show-qc-conclusion
:submitting="remarkEditLoading"
@submit="submitRemarkEdit"
/>
@@ -391,19 +393,25 @@
)
const remarkEditInitialRemark = computed(() => remarkEditRow.value?.remark || '')
const remarkEditInitialStatus = computed(() => remarkEditRow.value?.workOrderStatus || '')
const remarkEditInitialConclusion = computed(() => remarkEditRow.value?.qcConclusion || '')
function handleEditRemark(row: QcWorkOrder) {
remarkEditRow.value = row
remarkEditVisible.value = true
}
async function submitRemarkEdit(payload: { remark: string; workOrderStatus?: string }) {
async function submitRemarkEdit(payload: {
remark: string
workOrderStatus?: string
qcConclusion?: string
}) {
if (!remarkEditRow.value?.id) return
remarkEditLoading.value = true
try {
await fetchUpdateQcWorkOrder(remarkEditRow.value.id, {
remark: payload.remark,
workOrderStatus: payload.workOrderStatus
workOrderStatus: payload.workOrderStatus,
qcConclusion: payload.qcConclusion
})
ElMessage.success('保存成功')
remarkEditVisible.value = false
@@ -258,6 +258,47 @@
{{ item.labStorageCode || '—' }}
</span>
</div>
<div class="protocol-card__sample-line">
<span class="protocol-card__sample-label">接收</span>
<span class="protocol-card__sample-value protocol-card__sample-value--reception">
<el-tag
:type="
item.receptionAcceptConclusion
? acceptConclusionTagType(item.receptionAcceptConclusion)
: 'info'
"
size="small"
>
{{
item.receptionAcceptConclusion
? acceptConclusionLabel(item.receptionAcceptConclusion)
: '未接收'
}}
</el-tag>
<span
class="protocol-card__sample-remark"
:title="item.receptionRemark || undefined"
>
备注:{{ item.receptionRemark || '—' }}
</span>
</span>
</div>
<div class="protocol-card__sample-line">
<span class="protocol-card__sample-label">质检</span>
<span class="protocol-card__sample-value">
<el-tag
v-if="item.qcConclusion"
:type="qcWorkOrderConclusionTagType(item.qcConclusion)"
size="small"
>
{{
item.qcConclusionLabel ||
qcWorkOrderConclusionLabel(item.qcConclusion)
}}
</el-tag>
<span v-else>—</span>
</span>
</div>
</div>
</div>
</div>
@@ -367,7 +408,11 @@
donationStatusDisplayLabel,
donationStatusTagType,
newbornSexLabel,
deliveryModeLabel
deliveryModeLabel,
acceptConclusionLabel,
acceptConclusionTagType,
qcWorkOrderConclusionLabel,
qcWorkOrderConclusionTagType
} from '@/utils/status-tag-registry'
import {
formatProtocolDocDeleteConfirm,
@@ -383,6 +428,10 @@
labStorageCode: string
isSpecial?: boolean
specialRemark?: string
receptionAcceptConclusion?: string
receptionRemark?: string
qcConclusion?: string
qcConclusionLabel?: string
}
function getSampleItems(row: ResearchDonationRow): DonationSampleItem[] {
@@ -395,7 +444,11 @@
sampleCode: String(rec.sampleCode || '').trim(),
labStorageCode: String(rec.labStorageCode || '').trim(),
isSpecial: !!rec.isSpecial,
specialRemark: String(rec.specialRemark || '').trim()
specialRemark: String(rec.specialRemark || '').trim(),
receptionAcceptConclusion: String(rec.receptionAcceptConclusion || '').trim(),
receptionRemark: String(rec.receptionRemark || '').trim(),
qcConclusion: String(rec.qcConclusion || '').trim(),
qcConclusionLabel: String(rec.qcConclusionLabel || '').trim()
}
})
}
@@ -872,6 +925,24 @@
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 11px;
}
&--reception {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px 8px;
word-break: normal;
}
}
.protocol-card__sample-remark {
min-width: 0;
flex: 1 1 120px;
overflow: hidden;
color: var(--mint-text-muted, #64748b);
font-size: 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
.protocol-card__foot {