zlwu 5 月之前
父節點
當前提交
320f7e75f0
共有 61 個文件被更改,包括 4905 次插入 和 1790 次删除
  1. 1 1
      backend/app.pid
  2. 111 0
      backend/app/api/operations.py
  3. 64 1
      backend/app/crud/cell_product.py
  4. 84 2
      backend/app/crud/production_task.py
  5. 302 0
      backend/app/crud/storage_occupancy.py
  6. 0 0
      backend/app/graphify-out/cache/ast/b47200174bbd463f61e4a5b3f852ea0f11a275234b6efc614abb0574e742eb79.json
  7. 0 0
      backend/app/graphify-out/cache/ast/bbfa2a915372735a9b0395d3d3db9dcf4dbe9664b3687d239952ed424ccec395.json
  8. 2 0
      backend/app/models/__init__.py
  9. 30 0
      backend/app/models/models.py
  10. 14 9
      backend/app/schemas/production_task.py
  11. 41 0
      backend/app/schemas/storage_occupancy.py
  12. 499 474
      backend/graphify-out/.graphify_analysis.json
  13. 148 112
      backend/graphify-out/.graphify_extract.json
  14. 88 103
      backend/graphify-out/GRAPH_REPORT.md
  15. 1 1
      backend/graphify-out/graph.html
  16. 112 112
      backend/graphify-out/graph.json
  17. 2 2
      backend/graphify-out/manifest.json
  18. 37 0
      docs/sql/2026-05-22-storage-slot-occupancy.sql
  19. 5 0
      docs/sql/production_task_add_task_type.sql
  20. 1251 0
      docs/superpowers/plans/2026-05-22-storage-slot-occupancy.md
  21. 236 0
      docs/superpowers/specs/2026-05-22-storage-slot-occupancy-design.md
  22. 414 400
      web-admin/graphify-out/.graphify_analysis.json
  23. 111 213
      web-admin/graphify-out/.graphify_extract.json
  24. 60 100
      web-admin/graphify-out/GRAPH_REPORT.md
  25. 1 1
      web-admin/graphify-out/graph.html
  26. 25 25
      web-admin/graphify-out/manifest.json
  27. 328 0
      web-admin/mockup-execution-dialog.html
  28. 41 0
      web-admin/src/api/admin.ts
  29. 2 2
      web-admin/src/api/production-task.ts
  30. 0 0
      web-admin/src/graphify-out/cache/ast/0270a86e00fb2d03735edbc82311ab9b2f24797bcb44e37a9c26bd4329b736d7.json
  31. 0 0
      web-admin/src/graphify-out/cache/ast/027b8d8fc27ffaa986fabf1fac7062450c2b22274f8e2d3f7d571b4f2ac18b84.json
  32. 0 0
      web-admin/src/graphify-out/cache/ast/03d8d52a2e39384ef92fdd1223e943a9cb25fd50ec1d862f5c9612e37033ee63.json
  33. 1 0
      web-admin/src/graphify-out/cache/ast/10a8d9ee86620942102b2a18f321be54b6c148d53cccc478fc19a9e6160ab003.json
  34. 1 0
      web-admin/src/graphify-out/cache/ast/12d66314ead0cdc2586d13e556f529d97ace2a87265f3ec08397fe5f7a869c15.json
  35. 0 0
      web-admin/src/graphify-out/cache/ast/286c7f5cb5dfd9b96a42d27822638f7f8a6382f571fc258156c727231b5c8272.json
  36. 1 0
      web-admin/src/graphify-out/cache/ast/2fedac0f4e8095b7688afe6499a43fc3bfdf5c91c2ba2dd341e31f7d300735bf.json
  37. 1 0
      web-admin/src/graphify-out/cache/ast/318b84714c5fcbea1417d5b94ca640798930a1f5f4edbf2b01c0fd92fb78cbe4.json
  38. 1 0
      web-admin/src/graphify-out/cache/ast/582fa79ca3b6b2de10a5923504ba1af312d3d2edab9d78840a92dd78ff4a37e3.json
  39. 0 0
      web-admin/src/graphify-out/cache/ast/5874bcb3a0814d0003228122afff00aa1f1d28e24f1cba0fc336b4f0ec37ece3.json
  40. 1 0
      web-admin/src/graphify-out/cache/ast/6141fa236d8c03d9be0fc9c8cd55f4bb034374a1524b41c7f654ef272dab115e.json
  41. 1 0
      web-admin/src/graphify-out/cache/ast/6332b49387277ffab36847b88a8826e06a80dbabeeae4b278d63b0a9b12bcf70.json
  42. 1 0
      web-admin/src/graphify-out/cache/ast/65296d2c824789b0a9ad88e08113a8832e84769a1ca331f41cc016dffeb88621.json
  43. 0 0
      web-admin/src/graphify-out/cache/ast/657d55449547de2486d3343fc83928e0715fc21885f4588ad336d87dbdaa8c44.json
  44. 1 0
      web-admin/src/graphify-out/cache/ast/9dcc71c3ce46820f0f575a5a4fca282694c444def165b7ac667efb9c7e5ebdd5.json
  45. 1 0
      web-admin/src/graphify-out/cache/ast/a760b18e336769cd455aa5140d30a53529367322e100dcbf2f181acb620529f5.json
  46. 0 0
      web-admin/src/graphify-out/cache/ast/a86137fb4bca464bdb8c825795c600b1bec356f31855256bf7be9681e54c2af1.json
  47. 1 0
      web-admin/src/graphify-out/cache/ast/b3954803eb25a6e8cf1ace8e52c8e966e54ed1c7299c4f334be84e6d7f450ed3.json
  48. 1 0
      web-admin/src/graphify-out/cache/ast/cb706f31e29d0bee0a8a1cb672dd0f412819b07752b2a49811d6678b6e0db08d.json
  49. 0 0
      web-admin/src/graphify-out/cache/ast/cbad878c95ca3b0ca71336fe66a510b44fd36ad9e6faa9baf29220db3d1fe4d6.json
  50. 1 0
      web-admin/src/graphify-out/cache/ast/cdf1201b96832ec9724e9ce7f50f2830aca6a73301661c5ec778f29cf4dae9a7.json
  51. 1 0
      web-admin/src/graphify-out/cache/ast/d0d14b943c73211ccababf0686d9209778e311fbacf6000f489c792c94ad98b4.json
  52. 0 0
      web-admin/src/graphify-out/cache/ast/fb97c0bd015f9c5bfa03763c36811290720bb9d1f217611018ba4e788c162f38.json
  53. 1 0
      web-admin/src/graphify-out/cache/ast/fe324eeb511b1c7154e38444b690bf2212bbef5e7260ab9361a34e27db824bea.json
  54. 3 0
      web-admin/src/styles/_route-config.scss
  55. 380 2
      web-admin/src/views/operations/storage-facility/index.vue
  56. 12 6
      web-admin/src/views/production/process-route/index.vue
  57. 32 0
      web-admin/src/views/production/production-task/index.vue
  58. 1 0
      web-admin/src/views/production/production-work-order/DispatchTaskDialog.vue
  59. 29 23
      web-admin/src/views/production/production-work-order/StepDetailPanel.vue
  60. 336 188
      web-admin/src/views/production/production-work-order/TaskExecutionDialog.vue
  61. 87 13
      web-admin/src/views/production/production-work-order/useTaskStepEditor.ts

+ 1 - 1
backend/app.pid

@@ -1 +1 @@
-52296
+77442

+ 111 - 0
backend/app/api/operations.py

@@ -14,6 +14,8 @@ from app.core.response import error_response, success_response
 from app.crud import clean_room as clean_room_svc
 from app.crud import exhibition_appointment as exhibition_svc
 from app.crud import storage_facility as storage_facility_svc
+from app.crud import storage_occupancy as occupancy_svc
+from app.core.utils import generate_uuid
 from app.models.models import BizCleanRoom, BizCleanRoomAccessLog, BizExhibitionAppointment, BizStorageFacility, BizStorageFacilitySlot, SysUser
 
 router = APIRouter(prefix="/web/admin", tags=["运营支撑"])
@@ -587,6 +589,115 @@ async def delete_storage_slot(
         return error_response(400, str(e))
 
 
+# ---------------------------------------------------------------------------
+# 库位占用记录
+# ---------------------------------------------------------------------------
+
+
+class OccupancyCreateBody(BaseModel):
+    model_config = ConfigDict(populate_by_name=True)
+
+    slot_id: str = Field(..., alias="slotId")
+    item_type: str = Field("other", alias="itemType")
+    item_code: str = Field(..., alias="itemCode")
+    item_name: str = Field(..., alias="itemName")
+    item_source: str = Field("manual", alias="itemSource")
+    remark: Optional[str] = None
+
+
+@router.get("/storage-slot-occupancies")
+async def list_occupancies(
+    slotId: str = Query(..., alias="slotId"),
+    occupancyStatus: Optional[str] = Query("stored", alias="occupancyStatus"),
+    itemType: Optional[str] = Query(None, alias="itemType"),
+    page: int = Query(1),
+    pageSize: int = Query(20, alias="pageSize"),
+    user: dict = Depends(require_admin_or_super_admin),
+    db: Session = Depends(get_db),
+):
+    tenant_no = _get_tenant_no(db, user)
+    result = occupancy_svc.list_occupancies(
+        db,
+        slot_id=slotId,
+        occupancy_status=occupancyStatus,
+        item_type=itemType,
+        tenant_no=tenant_no,
+        page=page,
+        page_size=pageSize,
+    )
+    return success_response(result)
+
+
+@router.get("/storage-slot-occupancies/history")
+async def list_occupancy_history(
+    slotId: Optional[str] = Query(None, alias="slotId"),
+    facilityNodeId: Optional[str] = Query(None, alias="facilityNodeId"),
+    itemType: Optional[str] = Query(None, alias="itemType"),
+    startDate: Optional[str] = Query(None, alias="startDate"),
+    endDate: Optional[str] = Query(None, alias="endDate"),
+    page: int = Query(1),
+    pageSize: int = Query(20, alias="pageSize"),
+    user: dict = Depends(require_admin_or_super_admin),
+    db: Session = Depends(get_db),
+):
+    tenant_no = _get_tenant_no(db, user)
+    result = occupancy_svc.list_occupancy_history(
+        db,
+        slot_id=slotId,
+        facility_node_id=facilityNodeId,
+        item_type=itemType,
+        start_date=startDate,
+        end_date=endDate,
+        tenant_no=tenant_no,
+        page=page,
+        page_size=pageSize,
+    )
+    return success_response(result)
+
+
+@router.post("/storage-slot-occupancies")
+async def create_occupancy(
+    body: OccupancyCreateBody,
+    user: dict = Depends(require_admin_or_super_admin),
+    db: Session = Depends(get_db),
+):
+    try:
+        tenant_no = _get_tenant_no(db, user)
+        item_id = generate_uuid()
+        obj = occupancy_svc.create_occupancy(
+            db,
+            slot_id=body.slot_id,
+            item_type=body.item_type,
+            item_id=item_id,
+            item_code=body.item_code,
+            item_name=body.item_name,
+            item_source=body.item_source,
+            tenant_no=tenant_no,
+            user_id=user.get("user_id"),
+            remark=body.remark,
+        )
+        return success_response(occupancy_svc._row_to_dict(obj), message="入库成功")
+    except ValueError as e:
+        return error_response(400, str(e))
+
+
+@router.put("/storage-slot-occupancies/{occupancy_id}/remove")
+async def remove_occupancy(
+    occupancy_id: str,
+    user: dict = Depends(require_admin_or_super_admin),
+    db: Session = Depends(get_db),
+):
+    try:
+        obj = occupancy_svc.remove_occupancy(
+            db,
+            occupancy_id,
+            user_id=user.get("user_id"),
+        )
+        return success_response(occupancy_svc._row_to_dict(obj), message="出库成功")
+    except ValueError as e:
+        return error_response(400, str(e))
+
+
 # ---------------------------------------------------------------------------
 # 展厅预约
 # ---------------------------------------------------------------------------

+ 64 - 1
backend/app/crud/cell_product.py

@@ -10,6 +10,8 @@ from sqlalchemy import and_, func, or_
 from sqlalchemy.orm import Session
 
 from app.core.utils import generate_uuid
+from app.crud import storage_occupancy as occupancy_svc
+from app.models.models import BizStorageSlotOccupancy
 from app.models.models import (
     BizCellProduct,
     BizCellProductSpec,
@@ -269,6 +271,32 @@ def create_cell_product(
         del_flag=0,
     )
     db.add(obj)
+    db.flush()
+
+    if obj.storage_slot_id:
+        occ = BizStorageSlotOccupancy(
+            id=generate_uuid(),
+            slot_id=obj.storage_slot_id,
+            item_type="cell_product",
+            item_id=obj.id,
+            item_code=obj.product_code,
+            item_name=obj.product_name,
+            item_source=obj.source_type or "manual",
+            stored_at=datetime.now(),
+            occupancy_status="stored",
+            tenant_no=tenant_no,
+            order_num=0,
+            create_by=user_id,
+            create_dept_id=create_dept_id or "",
+            create_time=datetime.now(),
+            update_by=user_id,
+            update_time=datetime.now(),
+            del_flag=0,
+        )
+        db.add(occ)
+        db.flush()
+        occupancy_svc._refresh_slot_cache(db, obj.storage_slot_id)
+
     db.commit()
     db.refresh(obj)
     return obj
@@ -310,6 +338,13 @@ def update_cell_product(
         if from_status not in allowed or to_status not in allowed[from_status]:
             raise ValueError(f"不允许从状态 {from_status} 变更为 {to_status}")
         obj.product_status = data.product_status
+        if obj.storage_slot_id:
+            try:
+                occupancy_svc.remove_by_item(
+                    db, "cell_product", obj.id, user_id=user_id,
+                )
+            except Exception:
+                pass
     if data.quantity is not None:
         obj.quantity = data.quantity
     if data.unit is not None:
@@ -359,7 +394,8 @@ def _next_code_start_seq(db: Session, tenant_no: str, prefix: str) -> int:
     seq = 1
     if last and last.product_code:
         try:
-            seq = int(last.product_code[-6:]) + 1
+            base = normalize_product_code_base(last.product_code)
+            seq = int(base[-6:]) + 1
         except (ValueError, IndexError):
             seq = 1
     return seq
@@ -527,6 +563,33 @@ def create_cell_products_batch(
         )
         db.add(obj)
         created.append(obj)
+    for obj in created:
+        if obj.storage_slot_id:
+            occ = BizStorageSlotOccupancy(
+                id=generate_uuid(),
+                slot_id=obj.storage_slot_id,
+                item_type="cell_product",
+                item_id=obj.id,
+                item_code=obj.product_code,
+                item_name=obj.product_name,
+                item_source=obj.source_type or "manual",
+                stored_at=now,
+                occupancy_status="stored",
+                tenant_no=tenant_no,
+                order_num=0,
+                create_by=user_id,
+                create_dept_id=create_dept_id or "",
+                create_time=now,
+                update_by=user_id,
+                update_time=now,
+                del_flag=0,
+            )
+            db.add(occ)
+    db.flush()
+    slot_ids_seen = {obj.storage_slot_id for obj in created if obj.storage_slot_id}
+    for sid in slot_ids_seen:
+        occupancy_svc._refresh_slot_cache(db, sid)
+
     db.commit()
     for obj in created:
         db.refresh(obj)

+ 84 - 2
backend/app/crud/production_task.py

@@ -10,6 +10,7 @@ from sqlalchemy.orm import Session
 
 from app.core.utils import generate_uuid
 from app.models.models import (
+    BizCellSampleType,
     BizProcess,
     BizProcessConsumable,
     BizProcessDataCollection,
@@ -29,6 +30,9 @@ from app.models.models import (
     BizProductionTaskStepDataCollection,
     BizProductionTaskStepOutput,
     BizProductionTaskStepReagent,
+    BizProductionWorkOrder,
+    BizProtocolSample,
+    BizSampleReception,
 )
 
 
@@ -50,11 +54,13 @@ def _generate_task_no(db: Session, tenant_no: str) -> str:
     return f"RW{day}{(cnt or 0) + 1:04d}"
 
 
-def _task_to_dict(t: BizProductionTask) -> Dict[str, Any]:
+def _task_to_dict(t: BizProductionTask, *, work_order_no: str = "") -> Dict[str, Any]:
     return {
         "id": t.id,
         "taskNo": t.task_no,
         "workOrderId": t.work_order_id,
+        "workOrderNo": work_order_no,
+        "taskType": t.task_type or "cell_storage",
         "taskName": t.task_name or "",
         "description": t.description or "",
         "routeId": t.route_id or "",
@@ -294,6 +300,7 @@ def create_production_task(
         id=generate_uuid(),
         task_no=task_no,
         work_order_id=data.get("work_order_id", ""),
+        task_type=data.get("task_type") or "cell_storage",
         task_name=(data.get("task_name") or "").strip() or None,
         description=(data.get("description") or "").strip() or None,
         route_id=data.get("route_id") or None,
@@ -366,6 +373,77 @@ def list_production_tasks(
         }
         for item, row in zip(items, rows):
             item["routeName"] = route_map.get(row.route_id, "")
+    # 批量补充工单号 + 协议号 + 样本编码
+    wo_ids = [x.work_order_id for x in rows if x.work_order_id]
+    wo_map: Dict[str, Any] = {}
+    if wo_ids:
+        wo_rows = (
+            db.query(
+                BizProductionWorkOrder.id,
+                BizProductionWorkOrder.work_order_no,
+                BizProductionWorkOrder.protocol_no,
+                BizProductionWorkOrder.sample_code,
+                BizProductionWorkOrder.reception_id,
+                BizProductionWorkOrder.protocol_sample_id,
+            )
+            .filter(BizProductionWorkOrder.id.in_(wo_ids))
+            .all()
+        )
+        for w in wo_rows:
+            wo_map[w.id] = w
+        for item, row in zip(items, rows):
+            wo = wo_map.get(row.work_order_id)
+            if wo:
+                item["workOrderNo"] = wo.work_order_no or ""
+                item["protocolNo"] = wo.protocol_no or ""
+                item["sampleCode"] = wo.sample_code or ""
+    # 批量补充接收人、接收时间
+    reception_ids = [wo.reception_id for wo in wo_map.values() if getattr(wo, "reception_id", None)]
+    reception_map: Dict[str, Any] = {}
+    if reception_ids:
+        for r in (
+            db.query(
+                BizSampleReception.id,
+                BizSampleReception.handler_name,
+                BizSampleReception.reception_time,
+            )
+            .filter(BizSampleReception.id.in_(reception_ids))
+            .all()
+        ):
+            reception_map[r.id] = r
+    # 批量补充样本类型名称
+    protocol_sample_ids = [
+        wo.protocol_sample_id for wo in wo_map.values() if getattr(wo, "protocol_sample_id", None)
+    ]
+    sample_type_map: Dict[str, str] = {}
+    if protocol_sample_ids:
+        ps_rows = (
+            db.query(BizProtocolSample.id, BizProtocolSample.sample_type_id)
+            .filter(BizProtocolSample.id.in_(protocol_sample_ids))
+            .all()
+        )
+        st_ids = [ps.sample_type_id for ps in ps_rows if ps.sample_type_id]
+        if st_ids:
+            st_name_map = {
+                st.id: st.type_name
+                for st in db.query(BizCellSampleType.id, BizCellSampleType.type_name)
+                .filter(BizCellSampleType.id.in_(st_ids))
+                .all()
+            }
+            for ps in ps_rows:
+                sample_type_map[ps.id] = st_name_map.get(ps.sample_type_id, "") if ps.sample_type_id else ""
+    # 将补充字段写入 items
+    for item, row in zip(items, rows):
+        wo = wo_map.get(row.work_order_id)
+        if wo:
+            item["protocolNo"] = wo.protocol_no or ""
+            item["sampleCode"] = wo.sample_code or ""
+            # 接收人、接收时间
+            reception = reception_map.get(wo.reception_id) if wo.reception_id else None
+            item["receiverName"] = reception.handler_name or "" if reception else ""
+            item["receptionTime"] = _fmt_dt(reception.reception_time) if reception else ""
+            # 样本类型
+            item["sampleTypeName"] = sample_type_map.get(wo.protocol_sample_id, "") if wo.protocol_sample_id else ""
     return items, int(total)
 
 
@@ -380,7 +458,11 @@ def get_production_task_detail(db: Session, task_id: str, tenant_no: str) -> Opt
     if not task:
         return None
 
-    result = _task_to_dict(task)
+    wo = db.query(BizProductionWorkOrder).filter(BizProductionWorkOrder.id == task.work_order_id).first()
+    result = _task_to_dict(task, work_order_no=wo.work_order_no if wo else "")
+    if wo:
+        result["sampleCode"] = wo.sample_code or ""
+        result["protocolNo"] = wo.protocol_no or ""
 
     steps = (
         db.query(BizProductionTaskStep)

+ 302 - 0
backend/app/crud/storage_occupancy.py

@@ -0,0 +1,302 @@
+"""库位占用记录 CRUD(biz_storage_slot_occupancy)"""
+from __future__ import annotations
+
+from datetime import datetime
+from typing import Any, Dict, List, Optional
+
+from sqlalchemy import and_, func
+from sqlalchemy.orm import Session
+
+from app.core.utils import generate_uuid
+from app.models.models import BizStorageFacilitySlot, BizStorageSlotOccupancy
+
+
+def _row_to_dict(c: BizStorageSlotOccupancy) -> Dict[str, Any]:
+    return {
+        "id": c.id,
+        "slotId": c.slot_id,
+        "itemType": c.item_type or "",
+        "itemId": c.item_id or "",
+        "itemCode": c.item_code or "",
+        "itemName": c.item_name or "",
+        "itemSource": c.item_source or "",
+        "storedAt": c.stored_at.strftime("%Y-%m-%d %H:%M:%S") if c.stored_at else "",
+        "removedAt": c.removed_at.strftime("%Y-%m-%d %H:%M:%S") if c.removed_at else "",
+        "occupancyStatus": c.occupancy_status or "",
+        "tenantNo": c.tenant_no,
+        "remark": c.remark or "",
+        "createBy": c.create_by or "",
+        "createTime": c.create_time.strftime("%Y-%m-%d %H:%M:%S") if c.create_time else "",
+    }
+
+
+def _refresh_slot_cache(db: Session, slot_id: str) -> None:
+    """刷新 slot 的 occupied_count / last_item_type / last_stored_at / slot_status"""
+    slot = db.query(BizStorageFacilitySlot).filter(
+        BizStorageFacilitySlot.id == slot_id,
+        BizStorageFacilitySlot.del_flag == 0,
+    ).first()
+    if not slot:
+        return
+
+    count = db.query(func.count(BizStorageSlotOccupancy.id)).filter(
+        BizStorageSlotOccupancy.slot_id == slot_id,
+        BizStorageSlotOccupancy.occupancy_status == "stored",
+        BizStorageSlotOccupancy.del_flag == 0,
+    ).scalar() or 0
+
+    slot.occupied_count = count
+    if count > 0:
+        slot.slot_status = "占用"
+        latest = db.query(BizStorageSlotOccupancy).filter(
+            BizStorageSlotOccupancy.slot_id == slot_id,
+            BizStorageSlotOccupancy.occupancy_status == "stored",
+            BizStorageSlotOccupancy.del_flag == 0,
+        ).order_by(BizStorageSlotOccupancy.stored_at.desc()).first()
+        if latest:
+            slot.last_item_type = latest.item_type
+            slot.last_stored_at = latest.stored_at
+    else:
+        slot.slot_status = "空"
+        slot.last_item_type = None
+        slot.last_stored_at = None
+    slot.update_time = datetime.now()
+    db.add(slot)
+    db.flush()
+
+
+def create_occupancy(
+    db: Session,
+    *,
+    slot_id: str,
+    item_type: str,
+    item_id: str,
+    item_code: str,
+    item_name: str,
+    item_source: str = "manual",
+    tenant_no: str = "",
+    user_id: Optional[str] = None,
+    remark: Optional[str] = None,
+) -> BizStorageSlotOccupancy:
+    """创建入库记录 + 刷新 slot 缓存"""
+    now = datetime.now()
+    obj = BizStorageSlotOccupancy(
+        id=generate_uuid(),
+        slot_id=slot_id,
+        item_type=item_type,
+        item_id=item_id,
+        item_code=(item_code or "").strip() or None,
+        item_name=(item_name or "").strip() or None,
+        item_source=(item_source or "manual").strip(),
+        stored_at=now,
+        removed_at=None,
+        occupancy_status="stored",
+        tenant_no=tenant_no,
+        order_num=0,
+        remark=(remark or "").strip() or None,
+        create_by=user_id,
+        create_dept_id="",
+        create_time=now,
+        update_by=user_id,
+        update_time=now,
+        del_flag=0,
+    )
+    db.add(obj)
+    db.flush()
+    _refresh_slot_cache(db, slot_id)
+    db.commit()
+    db.refresh(obj)
+    return obj
+
+
+def batch_create_occupancies(
+    db: Session,
+    *,
+    items: List[Dict[str, Any]],
+    tenant_no: str = "",
+    user_id: Optional[str] = None,
+) -> List[BizStorageSlotOccupancy]:
+    """批量入库"""
+    now = datetime.now()
+    created: List[BizStorageSlotOccupancy] = []
+    slot_ids_seen: set = set()
+    for it in items:
+        obj = BizStorageSlotOccupancy(
+            id=generate_uuid(),
+            slot_id=it["slot_id"],
+            item_type=it.get("item_type", "cell_product"),
+            item_id=it["item_id"],
+            item_code=(it.get("item_code") or "").strip() or None,
+            item_name=(it.get("item_name") or "").strip() or None,
+            item_source=(it.get("item_source") or "production").strip(),
+            stored_at=now,
+            removed_at=None,
+            occupancy_status="stored",
+            tenant_no=tenant_no,
+            order_num=0,
+            remark=(it.get("remark") or "").strip() or None,
+            create_by=user_id,
+            create_dept_id="",
+            create_time=now,
+            update_by=user_id,
+            update_time=now,
+            del_flag=0,
+        )
+        db.add(obj)
+        created.append(obj)
+        slot_ids_seen.add(it["slot_id"])
+    db.flush()
+    for sid in slot_ids_seen:
+        _refresh_slot_cache(db, sid)
+    db.commit()
+    for obj in created:
+        db.refresh(obj)
+    return created
+
+
+def remove_occupancy(
+    db: Session,
+    occupancy_id: str,
+    *,
+    user_id: Optional[str] = None,
+) -> BizStorageSlotOccupancy:
+    """手动出库"""
+    obj = db.query(BizStorageSlotOccupancy).filter(
+        BizStorageSlotOccupancy.id == occupancy_id,
+        BizStorageSlotOccupancy.del_flag == 0,
+    ).first()
+    if not obj:
+        raise ValueError("占用记录不存在")
+    if obj.occupancy_status == "removed":
+        raise ValueError("该物品已出库")
+    now = datetime.now()
+    obj.occupancy_status = "removed"
+    obj.removed_at = now
+    obj.update_by = user_id
+    obj.update_time = now
+    db.add(obj)
+    db.flush()
+    _refresh_slot_cache(db, obj.slot_id)
+    db.commit()
+    db.refresh(obj)
+    return obj
+
+
+def remove_by_item(
+    db: Session,
+    item_type: str,
+    item_id: str,
+    *,
+    user_id: Optional[str] = None,
+) -> None:
+    """按物品类型+ID出库(细胞产品状态变更时调用)"""
+    obj = db.query(BizStorageSlotOccupancy).filter(
+        BizStorageSlotOccupancy.item_type == item_type,
+        BizStorageSlotOccupancy.item_id == item_id,
+        BizStorageSlotOccupancy.occupancy_status == "stored",
+        BizStorageSlotOccupancy.del_flag == 0,
+    ).first()
+    if not obj:
+        return
+    now = datetime.now()
+    obj.occupancy_status = "removed"
+    obj.removed_at = now
+    obj.update_by = user_id
+    obj.update_time = now
+    db.add(obj)
+    db.flush()
+    _refresh_slot_cache(db, obj.slot_id)
+    db.commit()
+
+
+def list_occupancies(
+    db: Session,
+    *,
+    slot_id: str,
+    occupancy_status: Optional[str] = "stored",
+    item_type: Optional[str] = None,
+    tenant_no: str = "",
+    page: int = 1,
+    page_size: int = 20,
+) -> Dict[str, Any]:
+    """分页查询占用记录"""
+    q = db.query(BizStorageSlotOccupancy).filter(
+        BizStorageSlotOccupancy.slot_id == slot_id,
+        BizStorageSlotOccupancy.del_flag == 0,
+    )
+    if tenant_no:
+        q = q.filter(BizStorageSlotOccupancy.tenant_no == tenant_no)
+    if occupancy_status:
+        q = q.filter(BizStorageSlotOccupancy.occupancy_status == occupancy_status)
+    if item_type:
+        q = q.filter(BizStorageSlotOccupancy.item_type == item_type)
+
+    total = q.order_by(None).with_entities(func.count(BizStorageSlotOccupancy.id)).scalar() or 0
+    page = max(1, page)
+    page_size = min(max(1, page_size), 100)
+    rows = (
+        q.order_by(BizStorageSlotOccupancy.stored_at.desc())
+        .offset((page - 1) * page_size)
+        .limit(page_size)
+        .all()
+    )
+    return {"items": [_row_to_dict(r) for r in rows], "total": int(total)}
+
+
+def list_occupancy_history(
+    db: Session,
+    *,
+    slot_id: Optional[str] = None,
+    facility_node_id: Optional[str] = None,
+    item_type: Optional[str] = None,
+    start_date: Optional[str] = None,
+    end_date: Optional[str] = None,
+    tenant_no: str = "",
+    page: int = 1,
+    page_size: int = 20,
+) -> Dict[str, Any]:
+    """出入库历史"""
+    q = db.query(BizStorageSlotOccupancy).filter(
+        BizStorageSlotOccupancy.del_flag == 0,
+    )
+    if tenant_no:
+        q = q.filter(BizStorageSlotOccupancy.tenant_no == tenant_no)
+    if slot_id:
+        q = q.filter(BizStorageSlotOccupancy.slot_id == slot_id)
+    if item_type:
+        q = q.filter(BizStorageSlotOccupancy.item_type == item_type)
+    if start_date:
+        try:
+            sd = datetime.strptime(start_date, "%Y-%m-%d")
+            q = q.filter(BizStorageSlotOccupancy.stored_at >= sd)
+        except ValueError:
+            pass
+    if end_date:
+        try:
+            ed = datetime.strptime(end_date, "%Y-%m-%d")
+            ed = ed.replace(hour=23, minute=59, second=59)
+            q = q.filter(BizStorageSlotOccupancy.stored_at <= ed)
+        except ValueError:
+            pass
+    if facility_node_id:
+        slot_ids = [
+            r[0] for r in db.query(BizStorageFacilitySlot.id).filter(
+                BizStorageFacilitySlot.facility_node_id == facility_node_id,
+                BizStorageFacilitySlot.del_flag == 0,
+            ).all()
+        ]
+        if slot_ids:
+            q = q.filter(BizStorageSlotOccupancy.slot_id.in_(slot_ids))
+        else:
+            return {"items": [], "total": 0}
+
+    total = q.order_by(None).with_entities(func.count(BizStorageSlotOccupancy.id)).scalar() or 0
+    page = max(1, page)
+    page_size = min(max(1, page_size), 100)
+    rows = (
+        q.order_by(BizStorageSlotOccupancy.create_time.desc())
+        .offset((page - 1) * page_size)
+        .limit(page_size)
+        .all()
+    )
+    return {"items": [_row_to_dict(r) for r in rows], "total": int(total)}

文件差異過大導致無法顯示
+ 0 - 0
backend/app/graphify-out/cache/ast/b47200174bbd463f61e4a5b3f852ea0f11a275234b6efc614abb0574e742eb79.json


文件差異過大導致無法顯示
+ 0 - 0
backend/app/graphify-out/cache/ast/bbfa2a915372735a9b0395d3d3db9dcf4dbe9664b3687d239952ed424ccec395.json


+ 2 - 0
backend/app/models/__init__.py

@@ -47,6 +47,7 @@ from app.models.models import (
     BizProductionTaskStepOutput,
     BizProductionTaskStepDataCollection,
     BizProductionTaskOutput,
+    BizStorageSlotOccupancy,
 )
 from app.models.research_donation import (  # noqa: F401
     BizResearchDonation,
@@ -112,4 +113,5 @@ __all__ = [
     "BizProductionTaskStepOutput",
     "BizProductionTaskStepDataCollection",
     "BizProductionTaskOutput",
+    "BizStorageSlotOccupancy",
 ]

+ 30 - 0
backend/app/models/models.py

@@ -1342,6 +1342,35 @@ class BizStorageFacilitySlot(Base):
     update_by = Column(String(64), nullable=True, comment="更新人id")
     update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment="更新时间")
     del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记")
+    occupied_count = Column(Integer, nullable=True, default=0, comment="当前占用数量")
+    last_item_type = Column(String(32), nullable=True, comment="最近存储物品类型")
+    last_stored_at = Column(DateTime, nullable=True, comment="最近入库时间")
+
+
+class BizStorageSlotOccupancy(Base):
+    """库位占用记录 biz_storage_slot_occupancy"""
+
+    __tablename__ = "biz_storage_slot_occupancy"
+
+    id = Column(String(64), primary_key=True, comment="主键ID")
+    slot_id = Column(String(64), nullable=False, comment="储物格ID")
+    item_type = Column(String(32), nullable=False, comment="物品类型: cell_product/other")
+    item_id = Column(String(64), nullable=False, comment="物品ID")
+    item_code = Column(String(64), nullable=True, comment="物品编码(冗余)")
+    item_name = Column(String(200), nullable=True, comment="物品名称(冗余)")
+    item_source = Column(String(32), nullable=True, comment="来源: production/manual/transfer")
+    stored_at = Column(DateTime, nullable=True, comment="入库时间")
+    removed_at = Column(DateTime, nullable=True, comment="出库时间")
+    occupancy_status = Column(String(16), nullable=False, default="stored", comment="stored=在库/removed=已出库")
+    tenant_no = Column(String(64), nullable=False, default="zkxw", comment="租户编号")
+    order_num = Column(Integer, nullable=True, comment="排序号")
+    remark = Column(String(500), nullable=True, comment="备注")
+    create_by = Column(String(64), nullable=True, comment="创建人id")
+    create_dept_id = Column(String(64), nullable=False, default="", comment="创建人部门ID")
+    create_time = Column(DateTime, nullable=False, default=datetime.now, comment="创建时间")
+    update_by = Column(String(64), nullable=True, comment="更新人id")
+    update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment="更新时间")
+    del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记")
 
 
 class BizExhibitionAppointment(Base):
@@ -2187,6 +2216,7 @@ class BizProductionTask(Base):
     id = Column(String(64), primary_key=True, comment="主键ID")
     task_no = Column(String(32), nullable=False, comment="任务号")
     work_order_id = Column(String(64), nullable=False, comment="工单ID")
+    task_type = Column(String(20), nullable=False, default="cell_storage", comment="任务类型 cell_storage入库生产单 outbound出库生产单")
     task_name = Column(String(200), nullable=True, comment="任务名称")
     description = Column(String(500), nullable=True, comment="描述")
     route_id = Column(String(64), nullable=True, comment="工艺路线ID")

+ 14 - 9
backend/app/schemas/production_task.py

@@ -5,6 +5,7 @@ from datetime import datetime
 
 class ProductionTaskCreate(BaseModel):
     work_order_id: str
+    task_type: Optional[str] = 'cell_storage'
     task_name: Optional[str] = None
     route_id: Optional[str] = None
     description: Optional[str] = None
@@ -27,7 +28,8 @@ class ProductionTaskUpdate(BaseModel):
 
 
 class ProductionTaskStatusUpdate(BaseModel):
-    task_status: str
+    model_config = ConfigDict(populate_by_name=True)
+    task_status: str = Field(..., alias="taskStatus")
 
 
 class TaskStepAdd(BaseModel):
@@ -79,17 +81,20 @@ class TaskStepDataCollectionItem(BaseModel):
 
 
 class TaskInputItem(BaseModel):
-    input_type: str
-    input_id: Optional[str] = None
-    input_code: Optional[str] = None
-    input_name: Optional[str] = None
+    model_config = ConfigDict(populate_by_name=True)
+    input_type: str = Field(..., alias="inputType")
+    input_id: Optional[str] = Field(None, alias="inputId")
+    input_code: Optional[str] = Field(None, alias="inputCode")
+    input_name: Optional[str] = Field(None, alias="inputName")
+    remark: Optional[str] = None
 
 
 class TaskOutputItem(BaseModel):
-    cell_product_id: Optional[str] = None
-    storage_slot_id: Optional[str] = None
-    output_name: Optional[str] = None
-    output_barcode: Optional[str] = None
+    model_config = ConfigDict(populate_by_name=True)
+    cell_product_id: Optional[str] = Field(None, alias="cellProductId")
+    storage_slot_id: Optional[str] = Field(None, alias="storageSlotId")
+    output_name: Optional[str] = Field(None, alias="outputName")
+    output_barcode: Optional[str] = Field(None, alias="outputBarcode")
     quantity: Optional[float] = None
     unit: Optional[str] = None
     remark: Optional[str] = None

+ 41 - 0
backend/app/schemas/storage_occupancy.py

@@ -0,0 +1,41 @@
+"""库位占用记录 schemas"""
+from datetime import datetime
+from typing import Optional
+
+from pydantic import BaseModel, ConfigDict, Field
+
+
+class OccupancyCreateBody(BaseModel):
+    """手动入库请求"""
+    model_config = ConfigDict(populate_by_name=True)
+
+    slot_id: str = Field(..., alias="slotId")
+    item_type: str = Field("other", alias="itemType")
+    item_code: str = Field(..., alias="itemCode")
+    item_name: str = Field(..., alias="itemName")
+    item_source: str = Field("manual", alias="itemSource")
+    remark: Optional[str] = None
+
+
+class OccupancyListQuery(BaseModel):
+    """占用记录查询"""
+    model_config = ConfigDict(populate_by_name=True)
+
+    slot_id: str = Field(..., alias="slotId")
+    occupancy_status: Optional[str] = Field("stored", alias="occupancyStatus")
+    item_type: Optional[str] = Field(None, alias="itemType")
+    page: int = 1
+    page_size: int = Field(20, alias="pageSize")
+
+
+class OccupancyHistoryQuery(BaseModel):
+    """出入库历史查询"""
+    model_config = ConfigDict(populate_by_name=True)
+
+    slot_id: Optional[str] = Field(None, alias="slotId")
+    facility_node_id: Optional[str] = Field(None, alias="facilityNodeId")
+    item_type: Optional[str] = Field(None, alias="itemType")
+    start_date: Optional[str] = Field(None, alias="startDate")
+    end_date: Optional[str] = Field(None, alias="endDate")
+    page: int = 1
+    page_size: int = Field(20, alias="pageSize")

文件差異過大導致無法顯示
+ 499 - 474
backend/graphify-out/.graphify_analysis.json


文件差異過大導致無法顯示
+ 148 - 112
backend/graphify-out/.graphify_extract.json


+ 88 - 103
backend/graphify-out/GRAPH_REPORT.md

@@ -1,12 +1,12 @@
-# Graph Report - app  (2026-05-21)
+# Graph Report - app  (2026-05-22)
 
 ## Corpus Check
-- 135 files · ~119,973 words
+- 135 files · ~120,233 words
 - Verdict: corpus is large enough that graph structure adds value.
 
 ## Summary
-- 2411 nodes · 9448 edges · 57 communities detected
-- Extraction: 42% EXTRACTED · 58% INFERRED · 0% AMBIGUOUS · INFERRED: 5492 edges (avg confidence: 0.63)
+- 2411 nodes · 9466 edges · 54 communities detected
+- Extraction: 42% EXTRACTED · 58% INFERRED · 0% AMBIGUOUS · INFERRED: 5506 edges (avg confidence: 0.63)
 - Token cost: 0 input · 0 output
 
 ## Community Hubs (Navigation)
@@ -58,15 +58,12 @@
 - [[_COMMUNITY_Community 45|Community 45]]
 - [[_COMMUNITY_Community 46|Community 46]]
 - [[_COMMUNITY_Community 47|Community 47]]
-- [[_COMMUNITY_Community 48|Community 48]]
-- [[_COMMUNITY_Community 49|Community 49]]
 - [[_COMMUNITY_Community 50|Community 50]]
+- [[_COMMUNITY_Community 51|Community 51]]
+- [[_COMMUNITY_Community 52|Community 52]]
 - [[_COMMUNITY_Community 53|Community 53]]
 - [[_COMMUNITY_Community 54|Community 54]]
 - [[_COMMUNITY_Community 55|Community 55]]
-- [[_COMMUNITY_Community 56|Community 56]]
-- [[_COMMUNITY_Community 57|Community 57]]
-- [[_COMMUNITY_Community 58|Community 58]]
 
 ## God Nodes (most connected - your core abstractions)
 1. `success_response()` - 380 edges
@@ -95,267 +92,255 @@
 ## Communities
 
 ### Community 0 - "Community 0"
-Cohesion: 0.02
-Nodes (387): attachment_download_url(), create_dept(), create_dict_data(), create_dict_type(), create_express_company(), create_item_unit(), create_menu(), create_post() (+379 more)
+Cohesion: 0.01
+Nodes (402): AttachmentDownloadUrlBody, DeptCreateBody, DeptUpdateBody, DictDataCreateBody, DictDataUpdateBody, DictTypeCreateBody, DictTypeUpdateBody, ExpressCompanyCreateBody (+394 more)
 
 ### Community 1 - "Community 1"
 Cohesion: 0.02
-Nodes (369): AttachmentDownloadUrlBody, DeptCreateBody, DeptUpdateBody, DictDataCreateBody, DictDataUpdateBody, DictTypeCreateBody, DictTypeUpdateBody, ExpressCompanyCreateBody (+361 more)
+Nodes (385): attachment_download_url(), create_dept(), create_dict_data(), create_dict_type(), create_express_company(), create_item_unit(), create_menu(), create_post() (+377 more)
 
 ### Community 2 - "Community 2"
 Cohesion: 0.05
-Nodes (229): AccessLogCreateBody, AccessLogUpdateBody, CleanRoomCreateBody, CleanRoomUpdateBody, ExhibitionAppointmentCreateBody, ExhibitionAppointmentUpdateBody, 运营支撑 API(洁净室、进出记录、仓储设施、储位、展厅预约), StorageFacilityCreateBody (+221 more)
+Nodes (272): AuditCreateBody, BatchDetailIdsBody, BatchRefundFinanceSubmitBody, FinanceConfirmBody, FullmoonTodoInsuranceBody, ProtocolCreateBody, ProtocolUpdateBody, 细胞存储 — 采集协议单 / 审核 / 财务确认 / 分期预警 API (+264 more)
 
 ### Community 3 - "Community 3"
 Cohesion: 0.02
-Nodes (192): generate_uuid(), _code_exists(), create_material(), _dec(), _fmt_dt(), get_material(), list_materials(), options_list() (+184 more)
+Nodes (157): generate_uuid(), batch_stock_in(), batch_stock_out(), _code_exists(), create_material(), _dec(), _fmt_dt(), get_material() (+149 more)
 
 ### Community 4 - "Community 4"
 Cohesion: 0.03
 Nodes (138): create_collection_protocol(), delete_collection_protocol(), _ensure_customer_for_mother(), get_collection_protocol_detail(), _get_current_user_id(), _get_tenant_no(), list_collection_protocol_audits(), list_collection_protocols() (+130 more)
 
 ### Community 5 - "Community 5"
-Cohesion: 0.08
-Nodes (136): CellSampleTypeCreateBody, CellSampleTypeUpdateBody, CollectionRegionCreateBody, CollectionRegionUpdateBody, CustomerCreateBody, CustomerUpdateBody, HospitalCreateBody, HospitalUpdateBody (+128 more)
-
-### Community 6 - "Community 6"
 Cohesion: 0.04
-Nodes (105): _format_attachment_file_size(), get_protocol_nos_used_in_protocols(), urls_to_attachment_list(), _accept_conclusion_label(), _attach_reception_detail(), complete_production_work_order(), create_production_work_order_from_reception(), _enrich_wo_items() (+97 more)
+Nodes (106): _format_attachment_file_size(), get_protocol_nos_used_in_protocols(), urls_to_attachment_list(), _accept_conclusion_label(), _attach_reception_detail(), complete_production_work_order(), create_production_work_order_from_reception(), _enrich_wo_items() (+98 more)
 
-### Community 7 - "Community 7"
+### Community 6 - "Community 6"
 Cohesion: 0.03
 Nodes (55): get_designer_data(), BaseStorage, convert_heic_to_jpeg(), get_storage(), LocalStorage, MinIOStorage, OSSStorage, process_image_content() (+47 more)
 
+### Community 7 - "Community 7"
+Cohesion: 0.05
+Nodes (88): AccessLogCreateBody, AccessLogUpdateBody, CleanRoomCreateBody, CleanRoomUpdateBody, ExhibitionAppointmentCreateBody, ExhibitionAppointmentUpdateBody, list_storage_slots(), 运营支撑 API(洁净室、进出记录、仓储设施、储位、展厅预约) (+80 more)
+
 ### Community 8 - "Community 8"
 Cohesion: 0.04
 Nodes (65): list_roles_for_select(), _avatar_url_field(), _build_user_info_payload(), get_web_auth_menu_codes(), _jwt_user_payload(), logout(), 公共接口(Web 登录、刷新 Token、登出;用户模型对齐 docs/sql/zkxw.sql 基线), 登出:吊销 Redis 会话(若已配置 REDIS_HOST)。 (+57 more)
 
 ### Community 9 - "Community 9"
-Cohesion: 0.08
-Nodes (36): BaseHTTPMiddleware, parse_admin_request_json(), 运营 Web(/web/admin)JSON 请求体解析。  与 ApiCryptoMiddleware 配合:中间件未改写 body 时,在路由内解密 `, 读取 JSON body;dict 时走 resolve_request_payload(明文 / 密文 / data 包装)。      Returns:, ApiCryptoError, _b64url_decode(), _b64url_encode(), decrypt_json() (+28 more)
+Cohesion: 0.32
+Nodes (52): ConsumableCreateBody, ConsumablePackCreateBody, ConsumablePackUpdateBody, ConsumableUpdateBody, OutputTypeCreateBody, OutputTypeUpdateBody, PackItemInput, ProcessCategoryCreateBody (+44 more)
 
 ### Community 10 - "Community 10"
-Cohesion: 0.16
-Nodes (32): _create_insurance_company(), _create_insurance_company_invoice(), _create_insurance_project_price(), delete_insurance_company(), delete_insurance_company_invoice(), delete_insurance_project_price(), _fmt_dt(), _generate_uuid() (+24 more)
+Cohesion: 0.11
+Nodes (42): create_collection_protocol(), _active_link_query(), assert_biz_no_available(), create_convert_link(), get_convert_partner(), get_partner_sample_codes(), has_active_convert_link(), upsert_convert_link_for_to_storage() (+34 more)
 
 ### Community 11 - "Community 11"
-Cohesion: 0.15
-Nodes (31): _audit_to_dict(), batch_delete_donations(), _collection_to_dict(), _create_collection(), create_donation(), _create_party(), _create_samples(), _create_transport() (+23 more)
+Cohesion: 0.08
+Nodes (36): BaseHTTPMiddleware, parse_admin_request_json(), 运营 Web(/web/admin)JSON 请求体解析。  与 ApiCryptoMiddleware 配合:中间件未改写 body 时,在路由内解密 `, 读取 JSON body;dict 时走 resolve_request_payload(明文 / 密文 / data 包装)。      Returns:, ApiCryptoError, _b64url_decode(), _b64url_encode(), decrypt_json() (+28 more)
 
 ### Community 12 - "Community 12"
-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)
+Cohesion: 0.16
+Nodes (32): _create_insurance_company(), _create_insurance_company_invoice(), _create_insurance_project_price(), delete_insurance_company(), delete_insurance_company_invoice(), delete_insurance_project_price(), _fmt_dt(), _generate_uuid() (+24 more)
 
 ### Community 13 - "Community 13"
-Cohesion: 0.15
-Nodes (22): Config, Config, ProductReviewMediaBase, ProductReviewMediaCreate, ProductReviewMediaCreateBatch, ProductReviewMediaListResponse, ProductReviewMediaResponse, ProductReviewMediaUpdate (+14 more)
+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)
 
 ### Community 14 - "Community 14"
-Cohesion: 0.17
-Nodes (12): BusinessException, InvalidStatusTransitionException, log_delivery_operation(), log_operation(), log_order_operation(), log_settlement_operation(), log_user_operation(), OrderLockedException (+4 more)
+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 15 - "Community 15"
-Cohesion: 0.18
-Nodes (18): company_code_exists(), create_company(), get_company(), list_companies(), list_company_options(), _row_to_dict(), soft_delete_company(), update_company() (+10 more)
+Cohesion: 0.17
+Nodes (12): BusinessException, InvalidStatusTransitionException, log_delivery_operation(), log_operation(), log_order_operation(), log_settlement_operation(), log_user_operation(), OrderLockedException (+4 more)
 
 ### Community 16 - "Community 16"
 Cohesion: 0.18
-Nodes (17): get_next_cell_product_code(), _build_facility_path_label(), build_split_product_codes(), create_cell_product(), create_cell_products_batch(), create_cell_products_by_quantity(), delete_cell_product(), _enrich_product_dicts() (+9 more)
+Nodes (18): company_code_exists(), create_company(), get_company(), list_companies(), list_company_options(), _row_to_dict(), soft_delete_company(), update_company() (+10 more)
 
 ### Community 17 - "Community 17"
-Cohesion: 0.21
-Nodes (15): batch_issue_protocol_nos(), batch_revoke_protocol_nos(), create_protocol_no(), enrich_issued_user_names(), get_protocol_no(), list_protocol_nos(), _parse_issued_time(), protocol_no_exists() (+7 more)
+Cohesion: 0.2
+Nodes (14): deduct_for_task(), _display_remark(), list_usages(), list_usages_by_task(), _parse_receiver_purpose_from_remark(), 查询质检任务关联的物料使用记录(task_complete)。, 撤销任务此前 task_complete 扣减,便于重新填报物料使用。, 兼容旧数据:领用人/用途曾拼接在 remark 中。 (+6 more)
 
 ### Community 18 - "Community 18"
-Cohesion: 0.17
-Nodes (15): Config, QuotationBase, QuotationCreate, QuotationDetailResponse, QuotationItemBase, QuotationItemCreate, QuotationItemResponse, QuotationItemUpdate (+7 more)
+Cohesion: 0.25
+Nodes (13): code_exists(), create_material(), _dec(), _fmt_dt(), get_material(), list_materials(), _norm_status(), options_list() (+5 more)
 
 ### Community 19 - "Community 19"
-Cohesion: 0.21
-Nodes (13): _access_log_to_dict(), create_access_log(), create_clean_room(), get_access_log(), get_clean_room(), list_access_logs(), list_clean_rooms(), room_code_exists() (+5 more)
-
-### Community 20 - "Community 20"
 Cohesion: 0.25
-Nodes (13): code_exists(), create_material(), _dec(), _fmt_dt(), get_material(), list_materials(), _norm_status(), options_list() (+5 more)
+Nodes (13): batch_issue_protocol_nos(), batch_revoke_protocol_nos(), create_protocol_no(), get_protocol_no(), list_protocol_nos(), _parse_issued_time(), protocol_no_exists(), 采集协议号池 CRUD(biz_collection_protocol_no) (+5 more)
 
-### Community 21 - "Community 21"
+### Community 20 - "Community 20"
 Cohesion: 0.26
 Nodes (12): batch_issue_sample_codes(), batch_revoke_sample_codes(), create_sample_code(), get_sample_code(), list_sample_codes(), _parse_issued_time(), 样本编码池 CRUD(biz_sample_code), _resolve_issued_user_display_name() (+4 more)
 
-### Community 22 - "Community 22"
+### 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)
 
-### Community 23 - "Community 23"
-Cohesion: 0.22
-Nodes (12): Config, InquiryBase, InquiryCreate, InquiryDetailResponse, InquiryItemBase, InquiryItemCreate, InquiryItemResponse, InquiryListResponse (+4 more)
-
-### Community 24 - "Community 24"
+### Community 22 - "Community 22"
 Cohesion: 0.23
 Nodes (12): Config, ProductBase, ProductCategoryBase, ProductCategoryCreate, ProductCategoryResponse, ProductCreate, ProductResponse, ProductUnitBase (+4 more)
 
-### Community 25 - "Community 25"
+### Community 23 - "Community 23"
+Cohesion: 0.27
+Nodes (10): create_collection_region(), create_hospital(), get_collection_region(), get_hospital(), _hospital_to_dict(), list_hospitals(), soft_delete_collection_region(), soft_delete_hospital() (+2 more)
+
+### Community 24 - "Community 24"
 Cohesion: 0.3
 Nodes (10): create_consumable_pack(), get_consumable_pack(), get_pack_detail(), _item_row_to_dict(), list_all_packs(), list_consumable_packs(), pack_code_exists(), _row_to_dict() (+2 more)
 
-### Community 26 - "Community 26"
+### 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)
 
-### Community 27 - "Community 27"
+### Community 26 - "Community 26"
 Cohesion: 0.29
 Nodes (9): _build_tree(), _cascade_soft_delete(), create_menu(), get_menu(), list_menus(), list_menus_tree(), _row_to_dict(), soft_delete_menu() (+1 more)
 
-### Community 28 - "Community 28"
+### Community 27 - "Community 27"
 Cohesion: 0.31
 Nodes (8): consumable_code_exists(), create_consumable(), get_consumable(), list_consumables(), 耗材 CRUD(biz_consumable), _row_to_dict(), soft_delete_consumable(), update_consumable()
 
-### Community 29 - "Community 29"
+### Community 28 - "Community 28"
 Cohesion: 0.31
 Nodes (8): create_sop_document(), get_sop_document(), list_sop_documents(), SOP文档 CRUD(biz_sop_document), _row_to_dict(), soft_delete_sop_document(), sop_code_exists(), update_sop_document()
 
-### Community 30 - "Community 30"
+### Community 29 - "Community 29"
 Cohesion: 0.31
 Nodes (8): create_express_company(), express_code_exists(), get_express_company(), list_express_companies(), 快递公司 CRUD(biz_express_company), _row_to_dict(), soft_delete_express_company(), update_express_company()
 
-### Community 31 - "Community 31"
+### Community 30 - "Community 30"
 Cohesion: 0.38
 Nodes (9): create_check_item(), get_check_item(), item_code_exists(), list_active_check_items(), list_check_items(), _order_query(), _row_to_dict(), soft_delete_check_item() (+1 more)
 
-### Community 32 - "Community 32"
+### Community 31 - "Community 31"
 Cohesion: 0.27
 Nodes (8): create_dict_data(), get_dict_data(), list_dict_data(), list_dict_data_options(), 字典数据 CRUD(sys_dict_data), _row_to_dict(), soft_delete_dict_data(), update_dict_data()
 
-### Community 33 - "Community 33"
+### Community 32 - "Community 32"
 Cohesion: 0.31
 Nodes (8): category_code_exists(), create_process_category(), get_process_category(), list_process_categories(), 工艺工序分类 CRUD(biz_process_category), _row_to_dict(), soft_delete_process_category(), update_process_category()
 
-### Community 34 - "Community 34"
+### Community 33 - "Community 33"
 Cohesion: 0.31
 Nodes (8): create_item_unit(), get_item_unit(), list_item_units(), 物品单位 CRUD(biz_item_unit), _row_to_dict(), soft_delete_item_unit(), unit_code_exists(), update_item_unit()
 
-### Community 35 - "Community 35"
+### Community 34 - "Community 34"
 Cohesion: 0.31
 Nodes (8): create_cell_sample_type(), get_cell_sample_type(), list_cell_sample_types(), 细胞样本类型 CRUD(biz_cell_sample_type), _row_to_dict(), soft_delete_cell_sample_type(), type_code_exists(), update_cell_sample_type()
 
-### Community 36 - "Community 36"
+### Community 35 - "Community 35"
 Cohesion: 0.31
 Nodes (8): create_output_type(), get_output_type(), list_output_types(), 工艺产出物类型 CRUD(biz_output_type), _row_to_dict(), soft_delete_output_type(), type_code_exists(), update_output_type()
 
-### Community 37 - "Community 37"
-Cohesion: 0.31
-Nodes (9): appointment_no_exists(), create_exhibition_appointment(), _generate_appointment_no(), get_exhibition_appointment(), list_exhibition_appointments(), 展览预约 CRUD(biz_exhibition_appointment), 生成预约编号:YYYYMMDD + 6位序号(如 20260515000001), soft_delete_exhibition_appointment() (+1 more)
-
-### Community 38 - "Community 38"
+### Community 36 - "Community 36"
 Cohesion: 0.36
 Nodes (7): create_post(), get_post(), list_posts(), post_code_exists(), _row_to_dict(), soft_delete_post(), update_post()
 
-### Community 39 - "Community 39"
+### Community 37 - "Community 37"
 Cohesion: 0.36
 Nodes (7): create_dict_type(), dict_type_code_exists(), get_dict_type(), list_dict_types(), _row_to_dict(), soft_delete_dict_type(), update_dict_type()
 
-### Community 40 - "Community 40"
+### Community 38 - "Community 38"
 Cohesion: 0.36
 Nodes (7): create_tenant(), get_tenant(), list_tenants(), _row_to_dict(), soft_delete_tenant(), tenant_no_exists(), update_tenant()
 
-### Community 41 - "Community 41"
+### Community 39 - "Community 39"
 Cohesion: 0.36
 Nodes (7): create_reagent(), get_reagent(), list_reagents(), reagent_code_exists(), _row_to_dict(), soft_delete_reagent(), update_reagent()
 
-### Community 42 - "Community 42"
-Cohesion: 0.39
-Nodes (8): create_lab_item(), get_lab_item(), item_code_exists(), list_active_lab_items(), list_lab_items(), _row_to_dict(), soft_delete_lab_item(), update_lab_item()
-
-### Community 43 - "Community 43"
+### Community 40 - "Community 40"
 Cohesion: 0.36
 Nodes (7): create_site(), get_site(), list_sites(), _row_to_dict(), site_code_exists(), soft_delete_site(), update_site()
 
-### Community 44 - "Community 44"
+### Community 41 - "Community 41"
 Cohesion: 0.29
 Nodes (2): BaseModel, SoftDeleteModel
 
-### Community 45 - "Community 45"
+### Community 42 - "Community 42"
 Cohesion: 0.38
 Nodes (6): derive_legacy_status_from_three(), derive_three_status_from_legacy(), 阶段A兼容:从旧 status 推导三字段。     约束:旧 status 本身混合了支付/配送/订单生命周期,因此只能尽力推断;     若业务侧已有更精确, 阶段A兼容:从三字段反推旧 status(用于旧前端/旧筛选参数兼容)。, ThreeStatus, _to_decimal()
 
-### Community 46 - "Community 46"
+### Community 43 - "Community 43"
 Cohesion: 0.5
 Nodes (3): BaseSettings, Config, Settings
 
-### Community 47 - "Community 47"
+### Community 44 - "Community 44"
 Cohesion: 0.5
 Nodes (2): _auto_fill_create_dept_id(), ORM before_insert 钩子:当 create_dept_id 为空时,自动从请求上下文填充当前用户部门 ID
 
-### Community 48 - "Community 48"
+### Community 45 - "Community 45"
 Cohesion: 0.67
 Nodes (2): get_menu_list(), 运营端菜单接口(与 web-admin 前端静态路由 sqxp.ts 对齐,供后端菜单模式联调)
 
-### Community 49 - "Community 49"
+### Community 46 - "Community 46"
 Cohesion: 1.0
 Nodes (1): 请求级别的用户上下文变量  通过 contextvars 在请求处理链路中传递当前用户信息, 供 SQLAlchemy 事件监听器等底层机制使用,避免逐层手动传
 
-### Community 50 - "Community 50"
+### Community 47 - "Community 47"
 Cohesion: 1.0
 Nodes (1): API 路由包(骨架:公共鉴权 + 静态菜单 + 运营端占位)
 
-### Community 53 - "Community 53"
+### Community 50 - "Community 50"
 Cohesion: 1.0
 Nodes (1): 发送订单状态通知                  Args:             openid: 用户openid             ord
 
-### Community 54 - "Community 54"
+### Community 51 - "Community 51"
 Cohesion: 1.0
 Nodes (1): 发送支付成功通知                  Args:             openid: 用户openid             ord
 
-### Community 55 - "Community 55"
+### Community 52 - "Community 52"
 Cohesion: 1.0
 Nodes (1): 发送配送通知                  Args:             openid: 配送员openid             task
 
-### Community 56 - "Community 56"
+### Community 53 - "Community 53"
 Cohesion: 1.0
 Nodes (1): 发送配送时效预警                  Args:             openid: 配送员openid             ta
 
-### Community 57 - "Community 57"
+### Community 54 - "Community 54"
 Cohesion: 1.0
 Nodes (1): 发送退款结果通知                  Args:             openid: 用户openid             ord
 
-### Community 58 - "Community 58"
+### Community 55 - "Community 55"
 Cohesion: 1.0
 Nodes (1): 发送催单通知给配送员                  Args:             deliver_openid: 配送员openid
 
 ## Knowledge Gaps
 - **90 isolated node(s):** `刷新会话 TTL(refreshToken 续期;已登录用户每次 API 校验通过后滑动续期)`, `写入 refreshToken(用于 one-time 使用/吊销)`, `根据 token 获取当前用户(包含 Redis 会话校验;会话滑动续期)`, `登录凭据 RSA 解密(与前端 JSEncrypt PKCS#1 v1.5 兼容)。`, `Base64 密文 -> JSON 对象(须含 username、password、ts 毫秒时间戳)。` (+85 more)
   These have ≤1 connection - possible missing edges or undocumented components.
-- **Thin community `Community 44`** (8 nodes): `BaseModel`, `.to_dict()`, `get_active()`, `base.py`, `SoftDeleteModel`, `.restore()`, `.soft_delete()`, `__tablename__()`
+- **Thin community `Community 41`** (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 47`** (4 nodes): `_auto_fill_create_dept_id()`, `get_db()`, `database.py`, `ORM before_insert 钩子:当 create_dept_id 为空时,自动从请求上下文填充当前用户部门 ID`
+- **Thin community `Community 44`** (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 48`** (3 nodes): `get_menu_list()`, `menu.py`, `运营端菜单接口(与 web-admin 前端静态路由 sqxp.ts 对齐,供后端菜单模式联调)`
+- **Thin community `Community 45`** (3 nodes): `get_menu_list()`, `menu.py`, `运营端菜单接口(与 web-admin 前端静态路由 sqxp.ts 对齐,供后端菜单模式联调)`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 49`** (2 nodes): `context.py`, `请求级别的用户上下文变量  通过 contextvars 在请求处理链路中传递当前用户信息, 供 SQLAlchemy 事件监听器等底层机制使用,避免逐层手动传`
+- **Thin community `Community 46`** (2 nodes): `context.py`, `请求级别的用户上下文变量  通过 contextvars 在请求处理链路中传递当前用户信息, 供 SQLAlchemy 事件监听器等底层机制使用,避免逐层手动传`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 50`** (2 nodes): `__init__.py`, `API 路由包(骨架:公共鉴权 + 静态菜单 + 运营端占位)`
+- **Thin community `Community 47`** (2 nodes): `__init__.py`, `API 路由包(骨架:公共鉴权 + 静态菜单 + 运营端占位)`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 53`** (1 nodes): `发送订单状态通知                  Args:             openid: 用户openid             ord`
+- **Thin community `Community 50`** (1 nodes): `发送订单状态通知                  Args:             openid: 用户openid             ord`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 54`** (1 nodes): `发送支付成功通知                  Args:             openid: 用户openid             ord`
+- **Thin community `Community 51`** (1 nodes): `发送支付成功通知                  Args:             openid: 用户openid             ord`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 55`** (1 nodes): `发送配送通知                  Args:             openid: 配送员openid             task`
+- **Thin community `Community 52`** (1 nodes): `发送配送通知                  Args:             openid: 配送员openid             task`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 56`** (1 nodes): `发送配送时效预警                  Args:             openid: 配送员openid             ta`
+- **Thin community `Community 53`** (1 nodes): `发送配送时效预警                  Args:             openid: 配送员openid             ta`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 57`** (1 nodes): `发送退款结果通知                  Args:             openid: 用户openid             ord`
+- **Thin community `Community 54`** (1 nodes): `发送退款结果通知                  Args:             openid: 用户openid             ord`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 58`** (1 nodes): `发送催单通知给配送员                  Args:             deliver_openid: 配送员openid`
+- **Thin community `Community 55`** (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 `generate_uuid()` connect `Community 3` to `Community 0`, `Community 2`, `Community 4`, `Community 5`, `Community 6`, `Community 7`, `Community 8`, `Community 9`, `Community 11`, `Community 15`, `Community 16`, `Community 17`, `Community 19`, `Community 20`, `Community 21`, `Community 25`, `Community 26`, `Community 27`, `Community 28`, `Community 29`, `Community 30`, `Community 31`, `Community 32`, `Community 33`, `Community 34`, `Community 35`, `Community 36`, `Community 37`, `Community 38`, `Community 39`, `Community 40`, `Community 41`, `Community 42`, `Community 43`?**
+- **Why does `generate_uuid()` connect `Community 3` to `Community 0`, `Community 1`, `Community 2`, `Community 4`, `Community 5`, `Community 6`, `Community 7`, `Community 8`, `Community 10`, `Community 11`, `Community 14`, `Community 16`, `Community 17`, `Community 18`, `Community 19`, `Community 20`, `Community 23`, `Community 24`, `Community 25`, `Community 26`, `Community 27`, `Community 28`, `Community 29`, `Community 30`, `Community 31`, `Community 32`, `Community 33`, `Community 34`, `Community 35`, `Community 36`, `Community 37`, `Community 38`, `Community 39`, `Community 40`?**
   _High betweenness centrality (0.124) - this node is a cross-community bridge._
-- **Why does `SysUser` connect `Community 1` to `Community 2`, `Community 5`, `Community 6`, `Community 7`, `Community 8`, `Community 10`, `Community 17`, `Community 21`?**
+- **Why does `SysUser` connect `Community 0` to `Community 2`, `Community 5`, `Community 6`, `Community 7`, `Community 8`, `Community 9`, `Community 12`, `Community 17`, `Community 19`, `Community 20`?**
   _High betweenness centrality (0.083) - this node is a cross-community bridge._
-- **Why does `success_response()` connect `Community 0` to `Community 1`, `Community 4`, `Community 5`, `Community 7`, `Community 8`, `Community 10`, `Community 48`, `Community 16`?**
+- **Why does `success_response()` connect `Community 1` to `Community 0`, `Community 4`, `Community 6`, `Community 7`, `Community 8`, `Community 12`, `Community 45`?**
   _High betweenness centrality (0.067) - this node is a cross-community bridge._
 - **Are the 379 inferred relationships involving `success_response()` (e.g. with `web_login_rsa_public_key()` and `web_login()`) actually correct?**
   _`success_response()` has 379 INFERRED edges - model-reasoned connections that need verification._

文件差異過大導致無法顯示
+ 1 - 1
backend/graphify-out/graph.html


文件差異過大導致無法顯示
+ 112 - 112
backend/graphify-out/graph.json


+ 2 - 2
backend/graphify-out/manifest.json

@@ -40,7 +40,7 @@
   "/Users/wuzilong/work/00code/zkxw/backend/app/schemas/product_parameter_value.py": 1778578258.0980055,
   "/Users/wuzilong/work/00code/zkxw/backend/app/schemas/product_review_media.py": 1778578258.0986822,
   "/Users/wuzilong/work/00code/zkxw/backend/app/schemas/product_parameter.py": 1778578258.0977957,
-  "/Users/wuzilong/work/00code/zkxw/backend/app/schemas/production_task.py": 1779370093.004463,
+  "/Users/wuzilong/work/00code/zkxw/backend/app/schemas/production_task.py": 1779402943.8622077,
   "/Users/wuzilong/work/00code/zkxw/backend/app/schemas/product_detail_media.py": 1778578258.0973988,
   "/Users/wuzilong/work/00code/zkxw/backend/app/schemas/product_banner.py": 1778578258.097102,
   "/Users/wuzilong/work/00code/zkxw/backend/app/schemas/region.py": 1778578258.099429,
@@ -74,7 +74,7 @@
   "/Users/wuzilong/work/00code/zkxw/backend/app/crud/tenant.py": 1779265611.0532296,
   "/Users/wuzilong/work/00code/zkxw/backend/app/crud/consumable.py": 1779265707.1662717,
   "/Users/wuzilong/work/00code/zkxw/backend/app/crud/sop_document.py": 1779265721.9928973,
-  "/Users/wuzilong/work/00code/zkxw/backend/app/crud/production_task.py": 1779363964.0353281,
+  "/Users/wuzilong/work/00code/zkxw/backend/app/crud/production_task.py": 1779402989.6753793,
   "/Users/wuzilong/work/00code/zkxw/backend/app/crud/qc_third_party_item.py": 1779265661.482352,
   "/Users/wuzilong/work/00code/zkxw/backend/app/crud/reagent.py": 1779265718.524432,
   "/Users/wuzilong/work/00code/zkxw/backend/app/crud/collection_protocol.py": 1779329214.3583212,

+ 37 - 0
docs/sql/2026-05-22-storage-slot-occupancy.sql

@@ -0,0 +1,37 @@
+-- ============================================================
+-- 库位占用记录功能迁移
+-- 日期: 2026-05-22
+-- ============================================================
+
+-- 1. 新增:库位占用记录表
+CREATE TABLE biz_storage_slot_occupancy (
+    id               VARCHAR(64)  NOT NULL              COMMENT '主键ID',
+    slot_id          VARCHAR(64)  NOT NULL              COMMENT '储物格ID (FK → biz_storage_facility_slot)',
+    item_type        VARCHAR(32)  NOT NULL              COMMENT '物品类型: cell_product=细胞产品, other=其他',
+    item_id          VARCHAR(64)  NOT NULL              COMMENT '物品ID (指向对应业务表主键)',
+    item_code        VARCHAR(64)  NULL                  COMMENT '物品编码 (冗余展示)',
+    item_name        VARCHAR(200) NULL                  COMMENT '物品名称 (冗余展示)',
+    item_source      VARCHAR(32)  NULL                  COMMENT '来源: production=生产入库, manual=手动入库, transfer=转移',
+    stored_at        DATETIME     NULL                  COMMENT '入库时间',
+    removed_at       DATETIME     NULL                  COMMENT '出库时间 (NULL=当前在库)',
+    occupancy_status VARCHAR(16)  NOT NULL DEFAULT 'stored' COMMENT 'stored=在库, removed=已出库',
+    tenant_no        VARCHAR(64)  NULL                  COMMENT '租户编号',
+    order_num        INT          DEFAULT 0             COMMENT '排序',
+    remark           VARCHAR(500) NULL                  COMMENT '备注',
+    create_by        VARCHAR(64)  NULL                  COMMENT '创建者',
+    create_dept_id   VARCHAR(64)  NULL                  COMMENT '创建部门',
+    create_time      DATETIME     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    update_by        VARCHAR(64)  NULL                  COMMENT '更新者',
+    update_time      DATETIME     DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+    del_flag         CHAR(1)      DEFAULT '0'           COMMENT '删除标志(0存在 1删除)',
+    PRIMARY KEY (id),
+    INDEX idx_sso_slot (slot_id, occupancy_status, del_flag),
+    INDEX idx_sso_item (item_type, item_id, del_flag),
+    INDEX idx_sso_tenant (tenant_no, del_flag)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库位占用记录表';
+
+-- 2. 增强:biz_storage_facility_slot 增加缓存字段
+ALTER TABLE biz_storage_facility_slot
+    ADD COLUMN occupied_count INT DEFAULT 0 COMMENT '当前占用数量',
+    ADD COLUMN last_item_type VARCHAR(32) NULL COMMENT '最近存储物品类型',
+    ADD COLUMN last_stored_at DATETIME NULL COMMENT '最近入库时间';

+ 5 - 0
docs/sql/production_task_add_task_type.sql

@@ -0,0 +1,5 @@
+-- 生产任务表增加任务类型字段
+-- 区分入库生产单 (cell_storage) / 出库生产单 (outbound)
+ALTER TABLE biz_production_task
+  ADD COLUMN task_type VARCHAR(20) NOT NULL DEFAULT 'cell_storage' COMMENT '任务类型 cell_storage入库生产单 outbound出库生产单'
+  AFTER work_order_id;

+ 1251 - 0
docs/superpowers/plans/2026-05-22-storage-slot-occupancy.md

@@ -0,0 +1,1251 @@
+# 库位占用记录功能实施计划
+
+> **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:** 为库位管理增加占用记录功能,支持多物品类型(细胞产品 + 其他)的统一出入库追踪和历史记录。
+
+**Architecture:** 新增 `biz_storage_slot_occupancy` 表作为多态关联占用记录,通过 `item_type` + `item_id` 关联不同来源的物品。在 `biz_storage_facility_slot` 上增加缓存字段(`occupied_count` 等)提升查询性能。细胞产品 CRUD 入库/出库时自动同步 occupancy 记录。
+
+**Tech Stack:** FastAPI, SQLAlchemy, Pydantic v2, MySQL, Vue 3, Element Plus, TypeScript
+
+**Design Spec:** `docs/superpowers/specs/2026-05-22-storage-slot-occupancy-design.md`
+
+---
+
+## File Structure
+
+| 操作 | 文件 | 职责 |
+|---|---|---|
+| Create | `docs/sql/2026-05-22-storage-slot-occupancy.sql` | DDL 迁移脚本 |
+| Modify | `backend/app/models/models.py` | 新增 `BizStorageSlotOccupancy` 模型 + `BizStorageFacilitySlot` 增加缓存字段 |
+| Modify | `backend/app/models/__init__.py` | 新增导出 |
+| Create | `backend/app/schemas/storage_occupancy.py` | Pydantic schemas |
+| Create | `backend/app/crud/storage_occupancy.py` | CRUD 层(含缓存刷新) |
+| Modify | `backend/app/api/operations.py` | 新增 4 个 API 路由 |
+| Modify | `backend/app/crud/cell_product.py` | 细胞产品入库/出库同步 occupancy |
+| Modify | `web-admin/src/api/admin.ts` | 新增 4 个前端 API 函数 |
+| Modify | `web-admin/src/views/operations/storage-facility/index.vue` | 占用明细弹窗 + 手动出入库 |
+
+---
+
+### Task 1: SQL 迁移脚本
+
+**Files:**
+- Create: `docs/sql/2026-05-22-storage-slot-occupancy.sql`
+
+- [ ] **Step 1: 创建 SQL 迁移文件**
+
+```sql
+-- ============================================================
+-- 库位占用记录功能迁移
+-- 日期: 2026-05-22
+-- ============================================================
+
+-- 1. 新增:库位占用记录表
+CREATE TABLE biz_storage_slot_occupancy (
+    id               VARCHAR(64)  NOT NULL              COMMENT '主键ID',
+    slot_id          VARCHAR(64)  NOT NULL              COMMENT '储物格ID (FK → biz_storage_facility_slot)',
+    item_type        VARCHAR(32)  NOT NULL              COMMENT '物品类型: cell_product=细胞产品, other=其他',
+    item_id          VARCHAR(64)  NOT NULL              COMMENT '物品ID (指向对应业务表主键)',
+    item_code        VARCHAR(64)  NULL                  COMMENT '物品编码 (冗余展示)',
+    item_name        VARCHAR(200) NULL                  COMMENT '物品名称 (冗余展示)',
+    item_source      VARCHAR(32)  NULL                  COMMENT '来源: production=生产入库, manual=手动入库, transfer=转移',
+    stored_at        DATETIME     NULL                  COMMENT '入库时间',
+    removed_at       DATETIME     NULL                  COMMENT '出库时间 (NULL=当前在库)',
+    occupancy_status VARCHAR(16)  NOT NULL DEFAULT 'stored' COMMENT 'stored=在库, removed=已出库',
+    tenant_no        VARCHAR(64)  NULL                  COMMENT '租户编号',
+    order_num        INT          DEFAULT 0             COMMENT '排序',
+    remark           VARCHAR(500) NULL                  COMMENT '备注',
+    create_by        VARCHAR(64)  NULL                  COMMENT '创建者',
+    create_dept_id   VARCHAR(64)  NULL                  COMMENT '创建部门',
+    create_time      DATETIME     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    update_by        VARCHAR(64)  NULL                  COMMENT '更新者',
+    update_time      DATETIME     DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+    del_flag         CHAR(1)      DEFAULT '0'           COMMENT '删除标志(0存在 1删除)',
+    PRIMARY KEY (id),
+    INDEX idx_sso_slot (slot_id, occupancy_status, del_flag),
+    INDEX idx_sso_item (item_type, item_id, del_flag),
+    INDEX idx_sso_tenant (tenant_no, del_flag)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库位占用记录表';
+
+-- 2. 增强:biz_storage_facility_slot 增加缓存字段
+ALTER TABLE biz_storage_facility_slot
+    ADD COLUMN occupied_count INT DEFAULT 0 COMMENT '当前占用数量',
+    ADD COLUMN last_item_type VARCHAR(32) NULL COMMENT '最近存储物品类型',
+    ADD COLUMN last_stored_at DATETIME NULL COMMENT '最近入库时间';
+```
+
+---
+
+### Task 2: 后端 Model — BizStorageSlotOccupancy + BizStorageFacilitySlot 增强
+
+**Files:**
+- Modify: `backend/app/models/models.py` (在 `BizStorageFacilitySlot` 类后插入新模型,在 `BizStorageFacilitySlot` 类中增加字段)
+- Modify: `backend/app/models/__init__.py`
+
+- [ ] **Step 1: 在 `BizStorageFacilitySlot` 模型中增加缓存字段**
+
+在 `backend/app/models/models.py` 中,`BizStorageFacilitySlot` 类的 `del_flag` 字段后面,增加三个字段:
+
+```python
+    occupied_count = Column(Integer, nullable=True, default=0, comment="当前占用数量")
+    last_item_type = Column(String(32), nullable=True, comment="最近存储物品类型")
+    last_stored_at = Column(DateTime, nullable=True, comment="最近入库时间")
+```
+
+即修改后的 `BizStorageFacilitySlot` 类完整如下:
+
+```python
+class BizStorageFacilitySlot(Base):
+    """存储设施小格 biz_storage_facility_slot"""
+
+    __tablename__ = "biz_storage_facility_slot"
+
+    id = Column(String(64), primary_key=True, comment="主键ID")
+    facility_node_id = Column(String(64), nullable=False, comment="设施树叶子节点ID")
+    slot_code = Column(String(64), nullable=True, comment="小格编码/坐标")
+    slot_status = Column(String(16), nullable=True, comment="占用状态等扩展")
+    occupied_count = Column(Integer, nullable=True, default=0, comment="当前占用数量")
+    last_item_type = Column(String(32), nullable=True, comment="最近存储物品类型")
+    last_stored_at = Column(DateTime, nullable=True, comment="最近入库时间")
+    tenant_no = Column(String(64), nullable=False, default="zkxw", comment="租户编号")
+    order_num = Column(Integer, nullable=True, comment="排序号")
+    remark = Column(String(512), nullable=True, comment="备注")
+    create_by = Column(String(64), nullable=True, comment="创建人id")
+    create_dept_id = Column(String(64), nullable=False, default="", comment="创建人部门ID")
+    create_time = Column(DateTime, nullable=False, default=datetime.now, comment="创建时间")
+    update_by = Column(String(64), nullable=True, comment="更新人id")
+    update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment="更新时间")
+    del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记")
+```
+
+- [ ] **Step 2: 在 `BizStorageFacilitySlot` 类之后插入 `BizStorageSlotOccupancy` 模型**
+
+在 `BizStorageFacilitySlot` 类结束(`del_flag` 行之后)和 `BizExhibitionAppointment` 类之间,插入新模型:
+
+```python
+class BizStorageSlotOccupancy(Base):
+    """库位占用记录 biz_storage_slot_occupancy"""
+
+    __tablename__ = "biz_storage_slot_occupancy"
+
+    id = Column(String(64), primary_key=True, comment="主键ID")
+    slot_id = Column(String(64), nullable=False, comment="储物格ID")
+    item_type = Column(String(32), nullable=False, comment="物品类型: cell_product/other")
+    item_id = Column(String(64), nullable=False, comment="物品ID")
+    item_code = Column(String(64), nullable=True, comment="物品编码(冗余)")
+    item_name = Column(String(200), nullable=True, comment="物品名称(冗余)")
+    item_source = Column(String(32), nullable=True, comment="来源: production/manual/transfer")
+    stored_at = Column(DateTime, nullable=True, comment="入库时间")
+    removed_at = Column(DateTime, nullable=True, comment="出库时间")
+    occupancy_status = Column(String(16), nullable=False, default="stored", comment="stored=在库/removed=已出库")
+    tenant_no = Column(String(64), nullable=False, default="zkxw", comment="租户编号")
+    order_num = Column(Integer, nullable=True, comment="排序号")
+    remark = Column(String(500), nullable=True, comment="备注")
+    create_by = Column(String(64), nullable=True, comment="创建人id")
+    create_dept_id = Column(String(64), nullable=False, default="", comment="创建人部门ID")
+    create_time = Column(DateTime, nullable=False, default=datetime.now, comment="创建时间")
+    update_by = Column(String(64), nullable=True, comment="更新人id")
+    update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment="更新时间")
+    del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记")
+```
+
+- [ ] **Step 3: 在 `backend/app/models/__init__.py` 中导出新模型**
+
+在 import 块中(`BizStorageFacilitySlot` 附近,实际文件中没有直接导出它,但需要在 `from app.models.models import (...)` 中添加):
+
+在 `from app.models.models import (` 的导入列表末尾(`BizProductionTaskOutput,` 之后)添加:
+```python
+    BizStorageSlotOccupancy,
+```
+
+在 `__all__` 列表末尾添加:
+```python
+    "BizStorageSlotOccupancy",
+```
+
+---
+
+### Task 3: 后端 Schemas — storage_occupancy.py
+
+**Files:**
+- Create: `backend/app/schemas/storage_occupancy.py`
+
+- [ ] **Step 1: 创建 Pydantic schemas 文件**
+
+```python
+"""库位占用记录 schemas"""
+from datetime import datetime
+from typing import Optional
+
+from pydantic import BaseModel, ConfigDict, Field
+
+
+class OccupancyCreateBody(BaseModel):
+    """手动入库请求"""
+    model_config = ConfigDict(populate_by_name=True)
+
+    slot_id: str = Field(..., alias="slotId")
+    item_type: str = Field("other", alias="itemType")
+    item_code: str = Field(..., alias="itemCode")
+    item_name: str = Field(..., alias="itemName")
+    item_source: str = Field("manual", alias="itemSource")
+    remark: Optional[str] = None
+
+
+class OccupancyListQuery(BaseModel):
+    """占用记录查询"""
+    model_config = ConfigDict(populate_by_name=True)
+
+    slot_id: str = Field(..., alias="slotId")
+    occupancy_status: Optional[str] = Field("stored", alias="occupancyStatus")
+    item_type: Optional[str] = Field(None, alias="itemType")
+    page: int = 1
+    page_size: int = Field(20, alias="pageSize")
+
+
+class OccupancyHistoryQuery(BaseModel):
+    """出入库历史查询"""
+    model_config = ConfigDict(populate_by_name=True)
+
+    slot_id: Optional[str] = Field(None, alias="slotId")
+    facility_node_id: Optional[str] = Field(None, alias="facilityNodeId")
+    item_type: Optional[str] = Field(None, alias="itemType")
+    start_date: Optional[str] = Field(None, alias="startDate")
+    end_date: Optional[str] = Field(None, alias="endDate")
+    page: int = 1
+    page_size: int = Field(20, alias="pageSize")
+```
+
+---
+
+### Task 4: 后端 CRUD — storage_occupancy.py
+
+**Files:**
+- Create: `backend/app/crud/storage_occupancy.py`
+
+- [ ] **Step 1: 创建 CRUD 文件**
+
+```python
+"""库位占用记录 CRUD(biz_storage_slot_occupancy)"""
+from __future__ import annotations
+
+from datetime import datetime
+from typing import Any, Dict, List, Optional
+
+from sqlalchemy import and_, func
+from sqlalchemy.orm import Session
+
+from app.core.utils import generate_uuid
+from app.models.models import BizStorageFacilitySlot, BizStorageSlotOccupancy
+
+
+def _row_to_dict(c: BizStorageSlotOccupancy) -> Dict[str, Any]:
+    return {
+        "id": c.id,
+        "slotId": c.slot_id,
+        "itemType": c.item_type or "",
+        "itemId": c.item_id or "",
+        "itemCode": c.item_code or "",
+        "itemName": c.item_name or "",
+        "itemSource": c.item_source or "",
+        "storedAt": c.stored_at.strftime("%Y-%m-%d %H:%M:%S") if c.stored_at else "",
+        "removedAt": c.removed_at.strftime("%Y-%m-%d %H:%M:%S") if c.removed_at else "",
+        "occupancyStatus": c.occupancy_status or "",
+        "tenantNo": c.tenant_no,
+        "remark": c.remark or "",
+        "createBy": c.create_by or "",
+        "createTime": c.create_time.strftime("%Y-%m-%d %H:%M:%S") if c.create_time else "",
+    }
+
+
+def _refresh_slot_cache(db: Session, slot_id: str) -> None:
+    """刷新 slot 的 occupied_count / last_item_type / last_stored_at / slot_status"""
+    slot = db.query(BizStorageFacilitySlot).filter(
+        BizStorageFacilitySlot.id == slot_id,
+        BizStorageFacilitySlot.del_flag == 0,
+    ).first()
+    if not slot:
+        return
+
+    count = db.query(func.count(BizStorageSlotOccupancy.id)).filter(
+        BizStorageSlotOccupancy.slot_id == slot_id,
+        BizStorageSlotOccupancy.occupancy_status == "stored",
+        BizStorageSlotOccupancy.del_flag == 0,
+    ).scalar() or 0
+
+    slot.occupied_count = count
+    if count > 0:
+        slot.slot_status = "占用"
+        latest = db.query(BizStorageSlotOccupancy).filter(
+            BizStorageSlotOccupancy.slot_id == slot_id,
+            BizStorageSlotOccupancy.occupancy_status == "stored",
+            BizStorageSlotOccupancy.del_flag == 0,
+        ).order_by(BizStorageSlotOccupancy.stored_at.desc()).first()
+        if latest:
+            slot.last_item_type = latest.item_type
+            slot.last_stored_at = latest.stored_at
+    else:
+        slot.slot_status = "空"
+        slot.last_item_type = None
+        slot.last_stored_at = None
+    slot.update_time = datetime.now()
+    db.add(slot)
+    db.flush()
+
+
+def create_occupancy(
+    db: Session,
+    *,
+    slot_id: str,
+    item_type: str,
+    item_id: str,
+    item_code: str,
+    item_name: str,
+    item_source: str = "manual",
+    tenant_no: str = "",
+    user_id: Optional[str] = None,
+    remark: Optional[str] = None,
+) -> BizStorageSlotOccupancy:
+    """创建入库记录 + 刷新 slot 缓存"""
+    now = datetime.now()
+    obj = BizStorageSlotOccupancy(
+        id=generate_uuid(),
+        slot_id=slot_id,
+        item_type=item_type,
+        item_id=item_id,
+        item_code=(item_code or "").strip() or None,
+        item_name=(item_name or "").strip() or None,
+        item_source=(item_source or "manual").strip(),
+        stored_at=now,
+        removed_at=None,
+        occupancy_status="stored",
+        tenant_no=tenant_no,
+        order_num=0,
+        remark=(remark or "").strip() or None,
+        create_by=user_id,
+        create_dept_id="",
+        create_time=now,
+        update_by=user_id,
+        update_time=now,
+        del_flag=0,
+    )
+    db.add(obj)
+    db.flush()
+    _refresh_slot_cache(db, slot_id)
+    db.commit()
+    db.refresh(obj)
+    return obj
+
+
+def batch_create_occupancies(
+    db: Session,
+    *,
+    items: List[Dict[str, Any]],
+    tenant_no: str = "",
+    user_id: Optional[str] = None,
+) -> List[BizStorageSlotOccupancy]:
+    """批量入库"""
+    now = datetime.now()
+    created: List[BizStorageSlotOccupancy] = []
+    slot_ids_seen: set = set()
+    for it in items:
+        obj = BizStorageSlotOccupancy(
+            id=generate_uuid(),
+            slot_id=it["slot_id"],
+            item_type=it.get("item_type", "cell_product"),
+            item_id=it["item_id"],
+            item_code=(it.get("item_code") or "").strip() or None,
+            item_name=(it.get("item_name") or "").strip() or None,
+            item_source=(it.get("item_source") or "production").strip(),
+            stored_at=now,
+            removed_at=None,
+            occupancy_status="stored",
+            tenant_no=tenant_no,
+            order_num=0,
+            remark=(it.get("remark") or "").strip() or None,
+            create_by=user_id,
+            create_dept_id="",
+            create_time=now,
+            update_by=user_id,
+            update_time=now,
+            del_flag=0,
+        )
+        db.add(obj)
+        created.append(obj)
+        slot_ids_seen.add(it["slot_id"])
+    db.flush()
+    for sid in slot_ids_seen:
+        _refresh_slot_cache(db, sid)
+    db.commit()
+    for obj in created:
+        db.refresh(obj)
+    return created
+
+
+def remove_occupancy(
+    db: Session,
+    occupancy_id: str,
+    *,
+    user_id: Optional[str] = None,
+) -> BizStorageSlotOccupancy:
+    """手动出库"""
+    obj = db.query(BizStorageSlotOccupancy).filter(
+        BizStorageSlotOccupancy.id == occupancy_id,
+        BizStorageSlotOccupancy.del_flag == 0,
+    ).first()
+    if not obj:
+        raise ValueError("占用记录不存在")
+    if obj.occupancy_status == "removed":
+        raise ValueError("该物品已出库")
+    now = datetime.now()
+    obj.occupancy_status = "removed"
+    obj.removed_at = now
+    obj.update_by = user_id
+    obj.update_time = now
+    db.add(obj)
+    db.flush()
+    _refresh_slot_cache(db, obj.slot_id)
+    db.commit()
+    db.refresh(obj)
+    return obj
+
+
+def remove_by_item(
+    db: Session,
+    item_type: str,
+    item_id: str,
+    *,
+    user_id: Optional[str] = None,
+) -> None:
+    """按物品类型+ID出库(细胞产品状态变更时调用)"""
+    obj = db.query(BizStorageSlotOccupancy).filter(
+        BizStorageSlotOccupancy.item_type == item_type,
+        BizStorageSlotOccupancy.item_id == item_id,
+        BizStorageSlotOccupancy.occupancy_status == "stored",
+        BizStorageSlotOccupancy.del_flag == 0,
+    ).first()
+    if not obj:
+        return
+    now = datetime.now()
+    obj.occupancy_status = "removed"
+    obj.removed_at = now
+    obj.update_by = user_id
+    obj.update_time = now
+    db.add(obj)
+    db.flush()
+    _refresh_slot_cache(db, obj.slot_id)
+    db.commit()
+
+
+def list_occupancies(
+    db: Session,
+    *,
+    slot_id: str,
+    occupancy_status: Optional[str] = "stored",
+    item_type: Optional[str] = None,
+    tenant_no: str = "",
+    page: int = 1,
+    page_size: int = 20,
+) -> Dict[str, Any]:
+    """分页查询占用记录"""
+    q = db.query(BizStorageSlotOccupancy).filter(
+        BizStorageSlotOccupancy.slot_id == slot_id,
+        BizStorageSlotOccupancy.del_flag == 0,
+    )
+    if tenant_no:
+        q = q.filter(BizStorageSlotOccupancy.tenant_no == tenant_no)
+    if occupancy_status:
+        q = q.filter(BizStorageSlotOccupancy.occupancy_status == occupancy_status)
+    if item_type:
+        q = q.filter(BizStorageSlotOccupancy.item_type == item_type)
+
+    total = q.order_by(None).with_entities(func.count(BizStorageSlotOccupancy.id)).scalar() or 0
+    page = max(1, page)
+    page_size = min(max(1, page_size), 100)
+    rows = (
+        q.order_by(BizStorageSlotOccupancy.stored_at.desc())
+        .offset((page - 1) * page_size)
+        .limit(page_size)
+        .all()
+    )
+    return {"items": [_row_to_dict(r) for r in rows], "total": int(total)}
+
+
+def list_occupancy_history(
+    db: Session,
+    *,
+    slot_id: Optional[str] = None,
+    facility_node_id: Optional[str] = None,
+    item_type: Optional[str] = None,
+    start_date: Optional[str] = None,
+    end_date: Optional[str] = None,
+    tenant_no: str = "",
+    page: int = 1,
+    page_size: int = 20,
+) -> Dict[str, Any]:
+    """出入库历史"""
+    q = db.query(BizStorageSlotOccupancy).filter(
+        BizStorageSlotOccupancy.del_flag == 0,
+    )
+    if tenant_no:
+        q = q.filter(BizStorageSlotOccupancy.tenant_no == tenant_no)
+    if slot_id:
+        q = q.filter(BizStorageSlotOccupancy.slot_id == slot_id)
+    if item_type:
+        q = q.filter(BizStorageSlotOccupancy.item_type == item_type)
+    if start_date:
+        try:
+            sd = datetime.strptime(start_date, "%Y-%m-%d")
+            q = q.filter(BizStorageSlotOccupancy.stored_at >= sd)
+        except ValueError:
+            pass
+    if end_date:
+        try:
+            ed = datetime.strptime(end_date, "%Y-%m-%d")
+            ed = ed.replace(hour=23, minute=59, second=59)
+            q = q.filter(BizStorageSlotOccupancy.stored_at <= ed)
+        except ValueError:
+            pass
+    if facility_node_id:
+        slot_ids = [
+            r[0] for r in db.query(BizStorageFacilitySlot.id).filter(
+                BizStorageFacilitySlot.facility_node_id == facility_node_id,
+                BizStorageFacilitySlot.del_flag == 0,
+            ).all()
+        ]
+        if slot_ids:
+            q = q.filter(BizStorageSlotOccupancy.slot_id.in_(slot_ids))
+        else:
+            return {"items": [], "total": 0}
+
+    total = q.order_by(None).with_entities(func.count(BizStorageSlotOccupancy.id)).scalar() or 0
+    page = max(1, page)
+    page_size = min(max(1, page_size), 100)
+    rows = (
+        q.order_by(BizStorageSlotOccupancy.create_time.desc())
+        .offset((page - 1) * page_size)
+        .limit(page_size)
+        .all()
+    )
+    return {"items": [_row_to_dict(r) for r in rows], "total": int(total)}
+```
+
+---
+
+### Task 5: 后端 API 路由
+
+**Files:**
+- Modify: `backend/app/api/operations.py`
+
+- [ ] **Step 1: 在文件顶部导入中添加新依赖**
+
+在 `backend/app/api/operations.py` 的 import 区域,添加:
+
+```python
+from app.crud import storage_occupancy as occupancy_svc
+from app.models.models import BizStorageSlotOccupancy
+```
+
+(`BizStorageSlotOccupancy` 加到现有的 `BizStorageFacility, BizStorageFacilitySlot` 后面)
+
+- [ ] **Step 2: 在储位路由区域之后添加 4 个新路由**
+
+在 `operations.py` 文件中,找到 `storage-facility-slots` 相关路由的末尾(大约在 `delete_storage_slot` 路由之后),添加以下路由:
+
+```python
+# ---------------------------------------------------------------------------
+# 库位占用记录
+# ---------------------------------------------------------------------------
+
+
+class OccupancyCreateBody(BaseModel):
+    model_config = ConfigDict(populate_by_name=True)
+
+    slot_id: str = Field(..., alias="slotId")
+    item_type: str = Field("other", alias="itemType")
+    item_code: str = Field(..., alias="itemCode")
+    item_name: str = Field(..., alias="itemName")
+    item_source: str = Field("manual", alias="itemSource")
+    remark: Optional[str] = None
+
+
+@router.get("/storage-slot-occupancies")
+async def list_occupancies(
+    slotId: str = Query(..., alias="slotId"),
+    occupancyStatus: Optional[str] = Query("stored", alias="occupancyStatus"),
+    itemType: Optional[str] = Query(None, alias="itemType"),
+    page: int = Query(1),
+    pageSize: int = Query(20, alias="pageSize"),
+    user: dict = Depends(require_admin_or_super_admin),
+    db: Session = Depends(get_db),
+):
+    tenant_no = _get_tenant_no(db, user)
+    result = occupancy_svc.list_occupancies(
+        db,
+        slot_id=slotId,
+        occupancy_status=occupancyStatus,
+        item_type=itemType,
+        tenant_no=tenant_no,
+        page=page,
+        page_size=pageSize,
+    )
+    return success_response(result)
+
+
+@router.get("/storage-slot-occupancies/history")
+async def list_occupancy_history(
+    slotId: Optional[str] = Query(None, alias="slotId"),
+    facilityNodeId: Optional[str] = Query(None, alias="facilityNodeId"),
+    itemType: Optional[str] = Query(None, alias="itemType"),
+    startDate: Optional[str] = Query(None, alias="startDate"),
+    endDate: Optional[str] = Query(None, alias="endDate"),
+    page: int = Query(1),
+    pageSize: int = Query(20, alias="pageSize"),
+    user: dict = Depends(require_admin_or_super_admin),
+    db: Session = Depends(get_db),
+):
+    tenant_no = _get_tenant_no(db, user)
+    result = occupancy_svc.list_occupancy_history(
+        db,
+        slot_id=slotId,
+        facility_node_id=facilityNodeId,
+        item_type=itemType,
+        start_date=startDate,
+        end_date=endDate,
+        tenant_no=tenant_no,
+        page=page,
+        page_size=pageSize,
+    )
+    return success_response(result)
+
+
+@router.post("/storage-slot-occupancies")
+async def create_occupancy(
+    body: OccupancyCreateBody,
+    user: dict = Depends(require_admin_or_super_admin),
+    db: Session = Depends(get_db),
+):
+    try:
+        tenant_no = _get_tenant_no(db, user)
+        item_id = generate_uuid()
+        obj = occupancy_svc.create_occupancy(
+            db,
+            slot_id=body.slot_id,
+            item_type=body.item_type,
+            item_id=item_id,
+            item_code=body.item_code,
+            item_name=body.item_name,
+            item_source=body.item_source,
+            tenant_no=tenant_no,
+            user_id=user.get("user_id"),
+            remark=body.remark,
+        )
+        return success_response(occupancy_svc._row_to_dict(obj), message="入库成功")
+    except ValueError as e:
+        return error_response(400, str(e))
+
+
+@router.put("/storage-slot-occupancies/{occupancy_id}/remove")
+async def remove_occupancy(
+    occupancy_id: str,
+    user: dict = Depends(require_admin_or_super_admin),
+    db: Session = Depends(get_db),
+):
+    try:
+        obj = occupancy_svc.remove_occupancy(
+            occupancy_id,
+            user_id=user.get("user_id"),
+            db=db,
+        )
+        return success_response(occupancy_svc._row_to_dict(obj), message="出库成功")
+    except ValueError as e:
+        return error_response(400, str(e))
+```
+
+注意:需要在文件顶部增加 `generate_uuid` 导入:
+```python
+from app.core.utils import generate_uuid
+```
+
+---
+
+### Task 6: 细胞产品 CRUD 对接 — 自动同步 occupancy
+
+**Files:**
+- Modify: `backend/app/crud/cell_product.py`
+
+- [ ] **Step 1: 在文件顶部添加导入**
+
+在 `from app.core.utils import generate_uuid` 之后添加:
+
+```python
+from app.crud import storage_occupancy as occupancy_svc
+```
+
+- [ ] **Step 2: 在 `create_cell_product` 函数中,`db.commit()` 之前添加 occupancy 同步**
+
+在 `create_cell_product` 函数中,找到 `db.add(obj)` 之后、`db.commit()` 之前的位置。在 `db.add(obj)` 后面添加:
+
+```python
+    db.flush()
+    # 同步写入占用记录
+    if obj.storage_slot_id:
+        try:
+            occupancy_svc.create_occupancy(
+                db,
+                slot_id=obj.storage_slot_id,
+                item_type="cell_product",
+                item_id=obj.id,
+                item_code=obj.product_code,
+                item_name=obj.product_name,
+                item_source=obj.source_type or "manual",
+                tenant_no=tenant_no,
+                user_id=user_id,
+            )
+        except Exception:
+            pass  # occupancy 写入失败不影响主流程
+```
+
+注意:原来的 `db.commit()` 和 `db.refresh(obj)` 保持不变(`create_occupancy` 内部已经有 `db.commit()`)。
+但实际上 `create_occupancy` 有自己的 commit,所以需要调整 —— 在 `create_cell_product` 中改为先 `db.flush()`,然后调 occupancy(occupancy 内部 commit 会一起提交),然后 refresh。
+
+**实际修改策略**:把 `create_occupancy` 改为不 commit 的内部版本,让调用方控制事务。
+
+更好的做法:在 `cell_product.py` 中直接内联写 occupancy 记录,不通过 `occupancy_svc.create_occupancy`(避免嵌套 commit 问题)。
+
+**最终方案**:在 `create_cell_product` 的 `db.add(obj)` 之后、`db.commit()` 之前,直接内联写入 occupancy:
+
+```python
+    db.add(obj)
+    db.flush()  # 先 flush 拿到 obj.id
+
+    # 同步写入占用记录
+    if obj.storage_slot_id:
+        occ = BizStorageSlotOccupancy(
+            id=generate_uuid(),
+            slot_id=obj.storage_slot_id,
+            item_type="cell_product",
+            item_id=obj.id,
+            item_code=obj.product_code,
+            item_name=obj.product_name,
+            item_source=obj.source_type or "manual",
+            stored_at=datetime.now(),
+            occupancy_status="stored",
+            tenant_no=tenant_no,
+            order_num=0,
+            create_by=user_id,
+            create_dept_id=create_dept_id or "",
+            create_time=datetime.now(),
+            update_by=user_id,
+            update_time=datetime.now(),
+            del_flag=0,
+        )
+        db.add(occ)
+        occupancy_svc._refresh_slot_cache(db, obj.storage_slot_id)
+
+    db.commit()
+    db.refresh(obj)
+    return obj
+```
+
+同时在文件顶部 import 中添加:
+```python
+from app.models.models import BizStorageSlotOccupancy
+```
+
+- [ ] **Step 3: 在 `create_cell_products_batch` 函数中添加批量 occupancy 同步**
+
+在 `create_cell_products_batch` 函数中,`db.commit()` 之前(即 `for` 循环结束之后),添加:
+
+```python
+    # 批量同步占用记录
+    for obj in created:
+        if obj.storage_slot_id:
+            occ = BizStorageSlotOccupancy(
+                id=generate_uuid(),
+                slot_id=obj.storage_slot_id,
+                item_type="cell_product",
+                item_id=obj.id,
+                item_code=obj.product_code,
+                item_name=obj.product_name,
+                item_source=obj.source_type or "manual",
+                stored_at=now,
+                occupancy_status="stored",
+                tenant_no=tenant_no,
+                order_num=0,
+                create_by=user_id,
+                create_dept_id=create_dept_id or "",
+                create_time=now,
+                update_by=user_id,
+                update_time=now,
+                del_flag=0,
+            )
+            db.add(occ)
+    # 刷新涉及的 slot 缓存
+    slot_ids_seen = {obj.storage_slot_id for obj in created if obj.storage_slot_id}
+    for sid in slot_ids_seen:
+        occupancy_svc._refresh_slot_cache(db, sid)
+```
+
+这段代码放在 `db.add(obj)` 循环结束之后、`db.commit()` 之前。
+
+- [ ] **Step 4: 在 `update_cell_product` 函数中,状态变更时触发出库**
+
+在 `update_cell_product` 函数中,找到状态变更的代码块:
+
+```python
+    if data.product_status is not None and data.product_status != obj.product_status:
+        allowed = {"frozen": {"sold", "used", "voided"}}
+        from_status = obj.product_status
+        to_status = data.product_status
+        if from_status not in allowed or to_status not in allowed[from_status]:
+            raise ValueError(f"不允许从状态 {from_status} 变更为 {to_status}")
+        obj.product_status = data.product_status
+```
+
+在 `obj.product_status = data.product_status` 之后添加:
+
+```python
+        # 状态变更时自动出库占用记录
+        if obj.storage_slot_id:
+            try:
+                occupancy_svc.remove_by_item(
+                    db, "cell_product", obj.id, user_id=user_id,
+                )
+            except Exception:
+                pass
+```
+
+---
+
+### Task 7: 前端 API 函数
+
+**Files:**
+- Modify: `web-admin/src/api/admin.ts`
+
+- [ ] **Step 1: 在库位管理 API 区域末尾添加 4 个新函数**
+
+在 `fetchDeleteStorageSlot` 函数之后、`// 展馆预约` 注释之前,添加:
+
+```typescript
+// 库位占用记录
+export function fetchSlotOccupancies(params: {
+  slotId: string
+  occupancyStatus?: string
+  itemType?: string
+  page?: number
+  pageSize?: number
+}) {
+  return request.get({ url: '/web/admin/storage-slot-occupancies', params })
+}
+
+export function fetchSlotOccupancyHistory(params?: {
+  slotId?: string
+  facilityNodeId?: string
+  itemType?: string
+  startDate?: string
+  endDate?: string
+  page?: number
+  pageSize?: number
+}) {
+  return request.get({ url: '/web/admin/storage-slot-occupancies/history', params })
+}
+
+export function fetchCreateOccupancy(data: {
+  slotId: string
+  itemType?: string
+  itemCode: string
+  itemName: string
+  itemSource?: string
+  remark?: string
+}) {
+  return request.post({ url: '/web/admin/storage-slot-occupancies', params: data })
+}
+
+export function fetchRemoveOccupancy(id: string) {
+  return request.put({ url: `/web/admin/storage-slot-occupancies/${id}/remove` })
+}
+```
+
+---
+
+### Task 8: 前端库位管理页面 — 占用明细弹窗 + 手动出入库
+
+**Files:**
+- Modify: `web-admin/src/views/operations/storage-facility/index.vue`
+
+- [ ] **Step 1: 添加新的 API 导入**
+
+在文件 `<script setup>` 区域的 import 块中,添加 3 个新 API 函数:
+
+```typescript
+import {
+  fetchStorageFacilityList,
+  fetchCreateStorageFacility,
+  fetchUpdateStorageFacility,
+  fetchDeleteStorageFacility,
+  fetchStorageSlotList,
+  fetchBatchCreateSlots,
+  fetchClearStorageSlots,
+  fetchInsertStorageSlotRow,
+  fetchCreateStorageSlot,
+  fetchUpdateStorageSlot,
+  fetchDeleteStorageSlot,
+  fetchSlotOccupancies,
+  fetchSlotOccupancyHistory,
+  fetchCreateOccupancy,
+  fetchRemoveOccupancy
+} from '@/api/admin'
+```
+
+- [ ] **Step 2: 修改格子点击事件**
+
+将现有的格子点击事件从 `@click="handleEditSlot(cell)"` 改为弹出席占明细弹窗。
+
+在 `shelf-cell` 的 click 处理中,将 `handleEditSlot(cell)` 替换为 `handleOpenOccupancyDialog(cell)`:
+
+```html
+<div
+  v-for="(cell, cellIndex) in row.cells"
+  :key="cell.id"
+  class="shelf-cell"
+  :class="{ occupied: cell.slotStatus === '占用' }"
+  @click="handleOpenOccupancyDialog(cell)"
+>
+  <button class="cell-delete-btn" @click.stop="handleDeleteSlot(cell)" title="删除">×</button>
+  <span class="cell-code">{{ cellIndex + 1 }}</span>
+  <span v-if="cell.occupiedCount > 0" class="cell-badge">{{ cell.occupiedCount }}</span>
+</div>
+```
+
+- [ ] **Step 3: 在 `<template>` 中添加占用明细弹窗**
+
+在现有 `</section>` 之前、最后一个弹窗(新增行弹窗)之后,添加:
+
+```html
+<!-- 占用明细弹窗 -->
+<el-dialog
+  v-model="occupancyDialogVisible"
+  :title="occupancyDialogTitle"
+  width="720px"
+  class="dialog-form-layout"
+  align-center
+  destroy-on-close
+>
+  <el-tabs v-model="occupancyActiveTab">
+    <el-tab-pane label="在库物品" name="stored">
+      <div class="occupancy-toolbar">
+        <el-button type="primary" size="small" @click="handleOpenStoreDialog">
+          入库
+        </el-button>
+      </div>
+      <el-table :data="occupancyList" v-loading="occupancyLoading" size="small" max-height="360">
+        <el-table-column label="物品类型" width="120">
+          <template #default="{ row }">
+            <el-tag :type="row.itemType === 'cell_product' ? 'primary' : 'info'" size="small">
+              {{ row.itemType === 'cell_product' ? '细胞产品' : '其他' }}
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column prop="itemCode" label="物品编码" min-width="140" />
+        <el-table-column prop="itemName" label="物品名称" min-width="140" />
+        <el-table-column label="来源" width="120">
+          <template #default="{ row }">
+            {{ { production: '生产入库', manual: '手动入库', transfer: '转移' }[row.itemSource] || row.itemSource }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="storedAt" label="入库时间" width="170" />
+        <el-table-column label="操作" width="80" fixed="right">
+          <template #default="{ row }">
+            <el-button type="danger" link size="small" @click="handleRemoveOccupancy(row)">
+              出库
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div v-if="occupancyTotal > occupancyPageSize" class="occupancy-pagination">
+        <el-pagination
+          small
+          layout="total, prev, pager, next"
+          :total="occupancyTotal"
+          :page-size="occupancyPageSize"
+          v-model:current-page="occupancyPage"
+          @current-change="loadOccupancies"
+        />
+      </div>
+    </el-tab-pane>
+
+    <el-tab-pane label="出入库历史" name="history">
+      <el-table :data="historyList" v-loading="historyLoading" size="small" max-height="400">
+        <el-table-column label="物品类型" width="120">
+          <template #default="{ row }">
+            <el-tag :type="row.itemType === 'cell_product' ? 'primary' : 'info'" size="small">
+              {{ row.itemType === 'cell_product' ? '细胞产品' : '其他' }}
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column prop="itemCode" label="物品编码" min-width="120" />
+        <el-table-column prop="itemName" label="物品名称" min-width="120" />
+        <el-table-column label="来源" width="100">
+          <template #default="{ row }">
+            {{ { production: '生产入库', manual: '手动入库', transfer: '转移' }[row.itemSource] || row.itemSource }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="storedAt" label="入库时间" width="170" />
+        <el-table-column prop="removedAt" label="出库时间" width="170" />
+        <el-table-column label="状态" width="100">
+          <template #default="{ row }">
+            <el-tag :type="row.occupancyStatus === 'stored' ? 'success' : 'warning'" size="small">
+              {{ row.occupancyStatus === 'stored' ? '在库' : '已出库' }}
+            </el-tag>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div v-if="historyTotal > historyPageSize" class="occupancy-pagination">
+        <el-pagination
+          small
+          layout="total, prev, pager, next"
+          :total="historyTotal"
+          :page-size="historyPageSize"
+          v-model:current-page="historyPage"
+          @current-change="loadHistory"
+        />
+      </div>
+    </el-tab-pane>
+  </el-tabs>
+</el-dialog>
+
+<!-- 手动入库弹窗 -->
+<el-dialog
+  v-model="storeDialogVisible"
+  title="手动入库"
+  width="480px"
+  class="dialog-form-layout"
+  align-center
+  destroy-on-close
+  :close-on-click-modal="false"
+>
+  <el-form
+    ref="storeFormRef"
+    :model="storeFormData"
+    :rules="storeFormRules"
+    label-position="top"
+  >
+    <el-form-item label="物品编码" prop="itemCode">
+      <el-input v-model="storeFormData.itemCode" placeholder="请输入物品编码" />
+    </el-form-item>
+    <el-form-item label="物品名称" prop="itemName">
+      <el-input v-model="storeFormData.itemName" placeholder="请输入物品名称" />
+    </el-form-item>
+    <el-form-item label="来源" prop="itemSource">
+      <el-select v-model="storeFormData.itemSource" placeholder="请选择来源">
+        <el-option label="手动入库" value="manual" />
+        <el-option label="转移" value="transfer" />
+      </el-select>
+    </el-form-item>
+    <el-form-item label="备注">
+      <el-input v-model="storeFormData.remark" type="textarea" :rows="2" placeholder="可选" />
+    </el-form-item>
+  </el-form>
+  <template #footer>
+    <el-button class="btn-ghost" @click="storeDialogVisible = false">取消</el-button>
+    <el-button type="primary" :loading="storeSubmitLoading" @click="handleStoreSubmit">确认入库</el-button>
+  </template>
+</el-dialog>
+```
+
+- [ ] **Step 4: 在 `<script setup>` 中添加占用弹窗相关数据和方法**
+
+在脚本末尾(`onMounted(loadData)` 之前)添加:
+
+```typescript
+// ==================== 占用明细弹窗 ====================
+const occupancyDialogVisible = ref(false)
+const occupancyDialogTitle = ref('')
+const occupancyActiveTab = ref('stored')
+const currentSlot = ref<any>(null)
+const occupancyLoading = ref(false)
+const occupancyList = ref<any[]>([])
+const occupancyTotal = ref(0)
+const occupancyPage = ref(1)
+const occupancyPageSize = 20
+
+const historyLoading = ref(false)
+const historyList = ref<any[]>([])
+const historyTotal = ref(0)
+const historyPage = ref(1)
+const historyPageSize = 20
+
+// 手动入库弹窗
+const storeDialogVisible = ref(false)
+const storeSubmitLoading = ref(false)
+const storeFormRef = ref()
+const storeFormData = reactive({
+  itemCode: '',
+  itemName: '',
+  itemSource: 'manual',
+  remark: ''
+})
+const storeFormRules = {
+  itemCode: [{ required: true, message: '请输入物品编码', trigger: 'blur' }],
+  itemName: [{ required: true, message: '请输入物品名称', trigger: 'blur' }],
+  itemSource: [{ required: true, message: '请选择来源', trigger: 'change' }]
+}
+
+const handleOpenOccupancyDialog = (cell: any) => {
+  currentSlot.value = cell
+  occupancyDialogTitle.value = `储物格明细 — ${cell.slotCode || cell.id}`
+  occupancyActiveTab.value = 'stored'
+  occupancyPage.value = 1
+  historyPage.value = 1
+  occupancyDialogVisible.value = true
+  loadOccupancies()
+  loadHistory()
+}
+
+const loadOccupancies = async () => {
+  if (!currentSlot.value) return
+  occupancyLoading.value = true
+  try {
+    const res: any = await fetchSlotOccupancies({
+      slotId: currentSlot.value.id,
+      occupancyStatus: 'stored',
+      page: occupancyPage.value,
+      pageSize: occupancyPageSize
+    })
+    const data = res?.data || res || {}
+    occupancyList.value = data.items || data.list || []
+    occupancyTotal.value = data.total || 0
+  } catch {
+    occupancyList.value = []
+  } finally {
+    occupancyLoading.value = false
+  }
+}
+
+const loadHistory = async () => {
+  if (!currentSlot.value) return
+  historyLoading.value = true
+  try {
+    const res: any = await fetchSlotOccupancyHistory({
+      slotId: currentSlot.value.id,
+      page: historyPage.value,
+      pageSize: historyPageSize
+    })
+    const data = res?.data || res || {}
+    historyList.value = data.items || data.list || []
+    historyTotal.value = data.total || 0
+  } catch {
+    historyList.value = []
+  } finally {
+    historyLoading.value = false
+  }
+}
+
+const handleOpenStoreDialog = () => {
+  Object.assign(storeFormData, { itemCode: '', itemName: '', itemSource: 'manual', remark: '' })
+  storeDialogVisible.value = true
+  nextTick(() => storeFormRef.value?.clearValidate?.())
+}
+
+const handleStoreSubmit = async () => {
+  await storeFormRef.value?.validate?.()
+  if (!currentSlot.value) return
+  storeSubmitLoading.value = true
+  try {
+    await fetchCreateOccupancy({
+      slotId: currentSlot.value.id,
+      itemType: 'other',
+      itemCode: storeFormData.itemCode.trim(),
+      itemName: storeFormData.itemName.trim(),
+      itemSource: storeFormData.itemSource,
+      remark: storeFormData.remark?.trim() || undefined
+    })
+    ElMessage.success('入库成功')
+    storeDialogVisible.value = false
+    loadOccupancies()
+    loadHistory()
+    if (selectedNode.value?.id) loadSlots(selectedNode.value.id)
+  } catch {
+    /* 错误已全局处理 */
+  } finally {
+    storeSubmitLoading.value = false
+  }
+}
+
+const handleRemoveOccupancy = async (row: any) => {
+  try {
+    await ElMessageBox.confirm(`确认将「${row.itemName || row.itemCode}」出库?`, '出库确认', {
+      type: 'warning'
+    })
+    await fetchRemoveOccupancy(row.id)
+    ElMessage.success('出库成功')
+    loadOccupancies()
+    loadHistory()
+    if (selectedNode.value?.id) loadSlots(selectedNode.value.id)
+  } catch {
+    /* 取消或错误 */
+  }
+}
+```
+
+- [ ] **Step 5: 在 `<style>` 中添加角标和分页样式**
+
+在 `<style>` 区域末尾添加:
+
+```scss
+.cell-badge {
+  position: absolute;
+  top: 2px;
+  right: 2px;
+  min-width: 16px;
+  height: 16px;
+  line-height: 16px;
+  font-size: 10px;
+  text-align: center;
+  color: #fff;
+  background: #f56c6c;
+  border-radius: 8px;
+  padding: 0 4px;
+}
+
+.occupancy-toolbar {
+  margin-bottom: 12px;
+}
+
+.occupancy-pagination {
+  margin-top: 12px;
+  display: flex;
+  justify-content: flex-end;
+}
+```
+
+---
+
+### Task 9: 验证
+
+- [ ] **Step 1: 执行 SQL 迁移**
+
+```bash
+# 在 MySQL 中执行迁移脚本
+mysql -u root -p sanqiang < docs/sql/2026-05-22-storage-slot-occupancy.sql
+```
+
+- [ ] **Step 2: 后端 diagnostics 检查**
+
+检查 `backend/app/models/models.py`、`backend/app/crud/cell_product.py`、`backend/app/api/operations.py` 无语法错误。
+
+- [ ] **Step 3: 前端 build 检查**
+
+```bash
+cd web-admin && pnpm build
+```
+
+Expected: 构建成功,无错误。
+
+- [ ] **Step 4: 更新知识图谱**
+
+```bash
+./scripts/update-graph.sh all
+```

+ 236 - 0
docs/superpowers/specs/2026-05-22-storage-slot-occupancy-design.md

@@ -0,0 +1,236 @@
+# 库位占用记录功能设计文档
+
+> 日期: 2026-05-22
+> 状态: 已确认
+> 范围: 前后端全做(含细胞产品对接)
+
+## 1. 背景与需求
+
+### 1.1 现状
+
+库位管理模块由两张表组成:
+- `biz_storage_facility`:树形结构(液氮罐 → 层 → 盒,`is_leaf=1` 为叶子存储节点)
+- `biz_storage_facility_slot`:叶子节点下的储物格(如 A1-3),仅有 `slot_code` 和 `slot_status`("空"/"占用")
+
+细胞产品表 `biz_cell_product` 通过 `storage_slot_id` FK 指向 slot,但 **slot 本身不知道存了什么**。
+
+### 1.2 问题
+
+1. `slot_status` 只有"空/占用",不记录物品类型、编码、来源
+2. 多来源无法统一查询(想查"这格子里有什么"需逐表扫描)
+3. 一个格子可存放多个物品(一对多关系),当前设计无法支持
+4. 无出入库历史记录
+
+### 1.3 需求确认
+
+| 维度 | 决策 |
+|---|---|
+| 储物格与物品关系 | 一对多 |
+| 物品类型 | `cell_product`(细胞产品)+ `other`(其他,兜底) |
+| 入库触发 | 细胞产品自动同步 + 手动入库(其他物品) |
+| 出库触发 | 细胞产品状态变更自动出库 + 手动出库 |
+| 历史记录 | 需要完整出入库历史 |
+| 前端展示 | 点击储物格弹窗查看明细 + 手动出入库操作 |
+| 实施范围 | 前后端全做 |
+
+## 2. 方案选型
+
+| 方案 | 描述 | 优点 | 缺点 | 结论 |
+|---|---|---|---|---|
+| **A(采用)** | 独立占用表 + Slot 缓存字段 | 统一查询入口、性能好、可扩展 | 双写需事务保证 | ✅ 推荐 |
+| B | 纯占用表,无缓存 | 单一数据源 | 列表页性能差 | ❌ |
+| C | 只加字段到 Slot 表 | 最简单 | 不支持一对多、无历史 | ❌ 不满足需求 |
+
+## 3. 数据模型
+
+### 3.1 新增表 `biz_storage_slot_occupancy`
+
+```sql
+CREATE TABLE biz_storage_slot_occupancy (
+    id               VARCHAR(64)  NOT NULL              COMMENT '主键ID',
+    slot_id          VARCHAR(64)  NOT NULL              COMMENT '储物格ID (FK → biz_storage_facility_slot)',
+    item_type        VARCHAR(32)  NOT NULL              COMMENT '物品类型: cell_product=细胞产品, other=其他',
+    item_id          VARCHAR(64)  NOT NULL              COMMENT '物品ID (指向对应业务表主键)',
+    item_code        VARCHAR(64)  NULL                  COMMENT '物品编码 (冗余展示)',
+    item_name        VARCHAR(200) NULL                  COMMENT '物品名称 (冗余展示)',
+    item_source      VARCHAR(32)  NULL                  COMMENT '来源: production=生产入库, manual=手动入库, transfer=转移',
+    stored_at        DATETIME     NULL                  COMMENT '入库时间',
+    removed_at       DATETIME     NULL                  COMMENT '出库时间 (NULL=当前在库)',
+    occupancy_status VARCHAR(16)  NOT NULL DEFAULT 'stored' COMMENT 'stored=在库, removed=已出库',
+    -- 标准公共字段
+    tenant_no        VARCHAR(64)  NULL                  COMMENT '租户编号',
+    order_num        INT          DEFAULT 0             COMMENT '排序',
+    remark           VARCHAR(500) NULL                  COMMENT '备注',
+    create_by        VARCHAR(64)  NULL                  COMMENT '创建者',
+    create_dept_id   VARCHAR(64)  NULL                  COMMENT '创建部门',
+    create_time      DATETIME     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    update_by        VARCHAR(64)  NULL                  COMMENT '更新者',
+    update_time      DATETIME     DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+    del_flag         CHAR(1)      DEFAULT '0'           COMMENT '删除标志(0存在 1删除)',
+    PRIMARY KEY (id),
+    INDEX idx_sso_slot (slot_id, occupancy_status, del_flag),
+    INDEX idx_sso_item (item_type, item_id, del_flag),
+    INDEX idx_sso_tenant (tenant_no, del_flag)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库位占用记录表';
+```
+
+### 3.2 增强 `biz_storage_facility_slot`
+
+```sql
+ALTER TABLE biz_storage_facility_slot 
+    ADD COLUMN occupied_count INT DEFAULT 0 COMMENT '当前占用数量',
+    ADD COLUMN last_item_type VARCHAR(32) NULL COMMENT '最近存储物品类型',
+    ADD COLUMN last_stored_at DATETIME NULL COMMENT '最近入库时间';
+```
+
+### 3.3 数据关系
+
+```
+biz_storage_facility (树: 液氮罐→层→盒)
+  └── biz_storage_facility_slot (储物格, 新增: occupied_count, last_item_type, last_stored_at)
+        ├── biz_storage_slot_occupancy (占用记录, 多态关联)
+        │     ├── item_type='cell_product' → item_id 指向 biz_cell_product.id
+        │     └── item_type='other'        → item_id 为手动录入的标识
+        └── biz_cell_product.storage_slot_id (保留, 向后兼容)
+```
+
+### 3.4 一致性保证
+
+- **入库**:同一事务内 → 写 occupancy 记录 + 更新 slot 缓存字段(`occupied_count += 1`)
+- **出库**:同一事务内 → 更新 occupancy 状态 + 更新 slot 缓存字段(`occupied_count -= 1`)
+- `occupied_count` 降到 0 时,`slot_status` 改回"空"
+
+## 4. 后端 API 与业务逻辑
+
+### 4.1 新增/修改文件
+
+| 文件 | 作用 |
+|---|---|
+| `backend/app/models/models.py` | 新增 `BizStorageSlotOccupancy` 模型 |
+| `backend/app/schemas/storage_occupancy.py` | 新增,Pydantic schemas |
+| `backend/app/crud/storage_occupancy.py` | 新增,CRUD 层 |
+| `backend/app/api/operations.py` | 在现有 router 下新增路由 |
+| `backend/app/crud/cell_product.py` | 改造:入库/出库时同步写 occupancy |
+| `backend/app/models/__init__.py` | 新增导出 |
+
+### 4.2 API 接口
+
+所有接口挂载在 `/api/web/admin/` 下:
+
+| 方法 | 路径 | 用途 |
+|---|---|---|
+| GET | `/storage-slot-occupancies` | 查询占用记录(按 slot_id / item_type / occupancy_status 筛选) |
+| POST | `/storage-slot-occupancies` | 手动入库(item_type=other) |
+| PUT | `/storage-slot-occupancies/{id}/remove` | 手动出库 |
+| GET | `/storage-slot-occupancies/history` | 出入库历史(支持时间范围、物品类型筛选) |
+
+**GET `/storage-slot-occupancies` 查询参数**:
+- `slot_id`(必传):储物格 ID
+- `occupancy_status`(可选,默认 `stored`):stored / removed
+- `item_type`(可选):cell_product / other
+- `page` / `page_size`:分页
+
+**GET `/storage-slot-occupancies/history` 查询参数**:
+- `slot_id`(可选):储物格 ID
+- `facility_node_id`(可选):设施节点 ID(查该节点下所有格子的历史)
+- `item_type`(可选)
+- `start_date` / `end_date`(可选):时间范围
+- `page` / `page_size`:分页
+
+### 4.3 CRUD 核心函数
+
+| 函数 | 说明 |
+|---|---|
+| `list_occupancies(db, slot_id, status, item_type, page, page_size)` | 分页查询占用记录 |
+| `list_occupancy_history(db, slot_id, facility_node_id, item_type, start_date, end_date, page, page_size)` | 出入库历史 |
+| `create_occupancy(db, data, current_user)` | 创建入库记录 + 更新 slot 缓存(同一事务)。`item_type=other` 时 `item_id` 自动生成 UUID |
+| `remove_occupancy(db, occupancy_id, current_user)` | 出库 + 更新 slot 缓存(同一事务) |
+| `batch_create_occupancies(db, items, current_user)` | 批量入库(细胞产品批量创建时调用) |
+| `remove_by_item(db, item_type, item_id, current_user)` | 按物品出库(细胞产品状态变更时调用) |
+| `_refresh_slot_cache(db, slot_id)` | 内部函数:刷新 slot 的 occupied_count / last_item_type / last_stored_at / slot_status |
+
+### 4.4 细胞产品对接
+
+| 触发点 | 改动 |
+|---|---|
+| `create_cell_product()` | 创建后同步调用 `create_occupancy()` |
+| `create_cell_products_batch()` | 批量创建后同步调用 `batch_create_occupancies()` |
+| `create_cell_products_by_quantity()` | 同上 |
+| `update_cell_product()` | 状态变为 sold/used/voided 时调用 `remove_by_item('cell_product', product_id)` |
+
+## 5. 前端交互设计
+
+### 5.1 库位管理页面改造
+
+**页面**:`web-admin/src/views/operations/storage-facility/index.vue`
+
+#### 5.1.1 储物格弹窗(新增)
+
+点击储物格 → 弹出占用明细弹窗,包含两个 Tab:
+
+**Tab 1:在库物品**
+
+| 列 | 说明 |
+|---|---|
+| 物品类型 | Tag 标签:cell_product=细胞产品, other=其他 |
+| 物品编码 | item_code |
+| 物品名称 | item_name |
+| 来源 | production=生产入库, manual=手动入库, transfer=转移 |
+| 入库时间 | stored_at |
+| 操作 | [出库] 按钮 |
+
+**Tab 2:出入库历史**
+
+| 列 | 说明 |
+|---|---|
+| 物品类型 | 同上 |
+| 物品编码 | item_code |
+| 物品名称 | item_name |
+| 来源 | item_source |
+| 入库时间 | stored_at |
+| 出库时间 | removed_at |
+| 状态 | Tag:stored=在库, removed=已出库 |
+
+#### 5.1.2 手动入库对话框(新增)
+
+弹窗底部「入库」按钮触发,表单字段:
+
+| 字段 | 控件 | 必填 |
+|---|---|---|
+| 物品编码 | el-input | 是 |
+| 物品名称 | el-input | 是 |
+| 来源 | el-select(manual/transfer) | 是 |
+| 备注 | el-input textarea | 否 |
+
+提交后调用 `POST /storage-slot-occupancies`,刷新在库物品列表。
+
+#### 5.1.3 库位网格增强
+
+现有网格每个格子显示 `occupied_count` 数字角标。占用格子背景色保持橙色,角标显示数量。
+
+### 5.2 细胞产品页面
+
+**页面**:`web-admin/src/views/production/cell-product/index.vue`
+
+改动极小:
+- 入库/出库由后端事务自动完成,前端无需额外逻辑
+- 可选:储物格列增加 tooltip 显示占用数量
+
+### 5.3 新增前端 API
+
+**文件**:`web-admin/src/api/admin.ts`(追加)
+
+| 函数 | 接口 |
+|---|---|
+| `fetchSlotOccupancies(params)` | `GET /storage-slot-occupancies` |
+| `fetchSlotOccupancyHistory(params)` | `GET /storage-slot-occupancies/history` |
+| `fetchCreateOccupancy(data)` | `POST /storage-slot-occupancies` |
+| `fetchRemoveOccupancy(id)` | `PUT /storage-slot-occupancies/{id}/remove` |
+
+### 5.4 SQL 迁移文件
+
+**文件**:`docs/sql/2026-05-22-storage-slot-occupancy.sql`
+
+包含:
+1. `CREATE TABLE biz_storage_slot_occupancy`
+2. `ALTER TABLE biz_storage_facility_slot` 增加缓存字段

文件差異過大導致無法顯示
+ 414 - 400
web-admin/graphify-out/.graphify_analysis.json


文件差異過大導致無法顯示
+ 111 - 213
web-admin/graphify-out/.graphify_extract.json


+ 60 - 100
web-admin/graphify-out/GRAPH_REPORT.md

@@ -1,10 +1,10 @@
-# Graph Report - src  (2026-05-21)
+# Graph Report - src  (2026-05-22)
 
 ## Corpus Check
-- Large corpus: 580 files · ~303,455 words. Semantic extraction will be expensive (many Claude tokens). Consider running on a subfolder, or use --no-semantic to run AST-only.
+- Large corpus: 580 files · ~301,189 words. Semantic extraction will be expensive (many Claude tokens). Consider running on a subfolder, or use --no-semantic to run AST-only.
 
 ## Summary
-- 1415 nodes · 1763 edges · 42 communities detected
+- 1412 nodes · 1758 edges · 36 communities detected
 - Extraction: 78% EXTRACTED · 22% INFERRED · 0% AMBIGUOUS · INFERRED: 384 edges (avg confidence: 0.8)
 - Token cost: 0 input · 0 output
 
@@ -36,21 +36,15 @@
 - [[_COMMUNITY_Community 24|Community 24]]
 - [[_COMMUNITY_Community 25|Community 25]]
 - [[_COMMUNITY_Community 27|Community 27]]
-- [[_COMMUNITY_Community 28|Community 28]]
+- [[_COMMUNITY_Community 29|Community 29]]
 - [[_COMMUNITY_Community 30|Community 30]]
 - [[_COMMUNITY_Community 31|Community 31]]
 - [[_COMMUNITY_Community 32|Community 32]]
-- [[_COMMUNITY_Community 33|Community 33]]
 - [[_COMMUNITY_Community 34|Community 34]]
 - [[_COMMUNITY_Community 35|Community 35]]
 - [[_COMMUNITY_Community 36|Community 36]]
 - [[_COMMUNITY_Community 37|Community 37]]
-- [[_COMMUNITY_Community 38|Community 38]]
-- [[_COMMUNITY_Community 40|Community 40]]
-- [[_COMMUNITY_Community 41|Community 41]]
-- [[_COMMUNITY_Community 42|Community 42]]
-- [[_COMMUNITY_Community 43|Community 43]]
-- [[_COMMUNITY_Community 45|Community 45]]
+- [[_COMMUNITY_Community 39|Community 39]]
 
 ## God Nodes (most connected - your core abstractions)
 1. `get()` - 153 edges
@@ -71,45 +65,45 @@
   views/basic-info/customer/index.vue → utils/fullscreen-loading.ts
 - `handleUnauthorizedResponse()` --calls--> `fetchRefreshToken()`  [INFERRED]
   utils/http/index.ts → api/auth.ts
-- `fetchLeaveList()` --calls--> `get()`  [INFERRED]
-  api/leave.ts → views/production/process-route/index.vue
-- `fetchLeaveDetail()` --calls--> `get()`  [INFERRED]
-  api/leave.ts → views/production/process-route/index.vue
+- `fetchConsumableList()` --calls--> `get()`  [INFERRED]
+  api/production.ts → views/production/process-route/index.vue
+- `fetchAllConsumables()` --calls--> `get()`  [INFERRED]
+  api/production.ts → views/production/process-route/index.vue
 
 ## Communities
 
 ### Community 0 - "Community 0"
 Cohesion: 0.01
-Nodes (75): fetchActiveRegions(), fetchCategoryList(), fetchCategoryParameters(), fetchCellProductPriceList(), fetchCellProductSpecList(), fetchCellProductTypeList(), fetchCellSampleTypeList(), fetchChannelAgreementPrices() (+67 more)
+Nodes (110): fetchActiveRegions(), fetchCategoryList(), fetchCategoryParameters(), fetchCellProductPriceList(), fetchCellProductSpecList(), fetchCellProductTypeList(), fetchCellSampleTypeList(), fetchChannelAgreementPrices() (+102 more)
 
 ### Community 1 - "Community 1"
-Cohesion: 0.03
-Nodes (57): fetchBatchGenerateProtocolNos(), fetchBatchGenerateSampleCodes(), fetchBatchIssueProtocolNos(), fetchBatchIssueSampleCodes(), fetchCollectionProtocolNoList(), fetchCreateCollectionProtocolNo(), fetchCreateSampleCode(), fetchDeleteCollectionProtocolNo() (+49 more)
+Cohesion: 0.02
+Nodes (6): fetchDeleteProjectSystemItem(), fetchGetRoleList(), fetchNotDeletedRegions(), fetchRegionList(), loadRoleList(), if()
 
 ### Community 2 - "Community 2"
+Cohesion: 0.03
+Nodes (56): fetchBatchGenerateProtocolNos(), fetchBatchGenerateSampleCodes(), fetchBatchIssueProtocolNos(), fetchBatchIssueSampleCodes(), fetchCollectionProtocolNoList(), fetchCreateCollectionProtocolNo(), fetchCreateSampleCode(), fetchDeleteCollectionProtocolNo() (+48 more)
+
+### Community 3 - "Community 3"
 Cohesion: 0.04
 Nodes (31): fetchGetUserInfo(), clickTab(), handleTouchEnd(), setTransition(), IframeRouteManager, RouteRegistry, useCommon(), setupAfterEachGuard() (+23 more)
 
-### Community 3 - "Community 3"
+### Community 4 - "Community 4"
 Cohesion: 0.05
 Nodes (32): fetchDeptTree(), fetchPostBoundUserIds(), FireworkSystem, reload(), formatUserLabel(), loadDeptData(), onPersonSelectChange(), subscribeTokenRefresh() (+24 more)
 
-### Community 4 - "Community 4"
+### Community 5 - "Community 5"
 Cohesion: 0.04
 Nodes (18): fetchAllConsumablePacks(), fetchAllConsumables(), fetchAllOutputTypes(), fetchAllProcessCategories(), fetchAllProcesses(), fetchAllReagents(), fetchAllSopDocuments(), fetchConsumableList() (+10 more)
 
-### Community 5 - "Community 5"
-Cohesion: 0.05
-Nodes (40): fetchAccessLogList(), fetchCleanRoomList(), fetchCreateAccessLog(), fetchCreateCleanRoom(), fetchCreateSite(), fetchDeleteAccessLog(), fetchDeleteCleanRoom(), fetchDeleteSite() (+32 more)
-
 ### Community 6 - "Community 6"
-Cohesion: 0.09
-Nodes (31): toLogin(), base64ToBytes(), bytesToBase64(), decryptJson(), deriveKey(), encryptJson(), fromBase64Url(), hexToBytes() (+23 more)
-
-### Community 7 - "Community 7"
 Cohesion: 0.06
 Nodes (10): useSettingsHandlers(), useSettingsPanel(), useSettingsState(), RoutePermissionValidator, useCeremony(), useTheme(), TableCache, themeAnimation() (+2 more)
 
+### Community 7 - "Community 7"
+Cohesion: 0.09
+Nodes (31): toLogin(), base64ToBytes(), bytesToBase64(), decryptJson(), deriveKey(), encryptJson(), fromBase64Url(), hexToBytes() (+23 more)
+
 ### Community 8 - "Community 8"
 Cohesion: 0.09
 Nodes (8): getDefaultLanguage(), checkStorageCompatibility(), StorageConfig, getSystemStorage(), getSysVersion(), StorageKeyManager, StorageCompatibilityManager, validateStorageData()
@@ -119,48 +113,48 @@ Cohesion: 0.13
 Nodes (4): handleReset(), handleSearch(), WebSocketClient, emit()
 
 ### Community 10 - "Community 10"
-Cohesion: 0.07
-Nodes (13): fetchAttachmentDownloadUrl(), fetchOrderAdjusts(), fetchOrderDetail(), fetchOrderItems(), fetchOrderList(), fetchPriceVersionDetail(), fetchSystemConfig(), handleReceptionAttachmentDownload() (+5 more)
+Cohesion: 0.08
+Nodes (17): fetchCreateMenu(), fetchDeleteMenu(), fetchMenuTree(), fetchUpdateMenu(), collectIds(), postorder(), preorder(), applyTreeExpand() (+9 more)
 
 ### Community 11 - "Community 11"
-Cohesion: 0.09
-Nodes (9): fetchGetAllUpgradeLogs(), fetchGetChinaMapData(), fetchGetComments(), fetchGetCurrentVersion(), fetchGetLatestUpgradeLog(), fetchGetSystemConfig(), fetchGetUpgradeLogs(), systemUpgrade() (+1 more)
+Cohesion: 0.1
+Nodes (23): fetchAccessLogList(), fetchCleanRoomList(), fetchCreateAccessLog(), fetchCreateCleanRoom(), fetchDeleteAccessLog(), fetchDeleteCleanRoom(), fetchUpdateAccessLog(), fetchUpdateCleanRoom() (+15 more)
 
 ### Community 12 - "Community 12"
 Cohesion: 0.1
-Nodes (8): fetchGetMenuList(), fetchGetMenuCodes(), fetchLogin(), fetchRefreshToken(), MenuProcessor, useAppMode(), useAuth(), buildWebEncryptedLoginBody()
+Nodes (13): fetchEthnicList(), addSample(), applyDonationBundleToForm(), confirmBatchTransportApply(), createEmptyTransport(), ensureDonationProtocolNoInOptions(), ensureEthnicOptionInList(), handleOpenForAdd() (+5 more)
 
 ### Community 13 - "Community 13"
 Cohesion: 0.1
-Nodes (13): fetchEthnicList(), addSample(), applyDonationBundleToForm(), confirmBatchTransportApply(), createEmptyTransport(), ensureDonationProtocolNoInOptions(), ensureEthnicOptionInList(), handleOpenForAdd() (+5 more)
+Nodes (8): fetchGetMenuList(), fetchGetMenuCodes(), fetchLogin(), fetchRefreshToken(), MenuProcessor, useAppMode(), useAuth(), buildWebEncryptedLoginBody()
 
 ### Community 14 - "Community 14"
 Cohesion: 0.1
 Nodes (18): fetchCollectionRegionList(), fetchCreateCollectionRegion(), fetchCreateHospital(), fetchDeleteCollectionRegion(), fetchDeleteHospital(), fetchHospitalList(), fetchUpdateCollectionRegion(), fetchUpdateHospital() (+10 more)
 
 ### Community 15 - "Community 15"
-Cohesion: 0.11
-Nodes (9): auditorDisplay(), dash(), expressName(), formatYm(), formatYmd(), sampleTypeName(), siteName(), unitName() (+1 more)
+Cohesion: 0.1
+Nodes (19): fetchCreateSite(), fetchDeleteSite(), fetchDictDataOptions(), fetchSiteList(), fetchUpdateSite(), fetchUserList(), remoteSearchUsers(), handleAdd() (+11 more)
 
 ### Community 16 - "Community 16"
 Cohesion: 0.12
 Nodes (15): addCopyButton(), highlightCode(), insertLineNumbers(), isBlockProcessed(), markBlockAsProcessed(), processBlock(), setupHighlightDirective(), setupRippleDirective() (+7 more)
 
 ### Community 17 - "Community 17"
-Cohesion: 0.13
-Nodes (16): fetchCreateMenu(), fetchDeleteMenu(), fetchMenuTree(), fetchUpdateMenu(), postorder(), preorder(), applyTreeExpand(), handleAdd() (+8 more)
+Cohesion: 0.12
+Nodes (19): fetchCreateUser(), fetchDeleteUser(), fetchResetPassword(), fetchRoleOptions(), fetchUpdateUser(), fetchUserDetail(), formatUserDeptDisplay(), handleAdd() (+11 more)
 
 ### Community 18 - "Community 18"
-Cohesion: 0.14
-Nodes (17): fetchCreateUser(), fetchDeleteUser(), fetchResetPassword(), fetchUpdateUser(), fetchUserDetail(), formatUserDeptDisplay(), handleAdd(), handleDelete() (+9 more)
+Cohesion: 0.12
+Nodes (7): fetchAttachmentDownloadUrl(), handleReceptionAttachmentDownload(), attachmentFullUrl(), handleAttachmentDownload(), handleAttachmentPreview(), downloadAttachmentFile(), triggerAnchorDownload()
 
 ### Community 19 - "Community 19"
-Cohesion: 0.11
-Nodes (8): fetchCollectionProtocolAuditList(), fetchCollectionProtocolDetail(), fetchCollectionProtocolList(), fetchPaymentDetailList(), fetchReceiptConfirmedList(), fetchReceiptConfirmList(), fetchRefundConfirmedList(), fetchRefundConfirmList()
+Cohesion: 0.19
+Nodes (3): fetchGetLatestUpgradeLog(), systemUpgrade(), VersionManager
 
 ### Community 20 - "Community 20"
-Cohesion: 0.12
-Nodes (12): fetchApproveTask(), fetchBusinessAllTasks(), fetchCompletedTasks(), fetchDesignerData(), fetchInstanceDetail(), fetchMyInstances(), fetchPendingTasks(), fetchProcessDefList() (+4 more)
+Cohesion: 0.16
+Nodes (9): auditorDisplay(), dash(), expressName(), formatYm(), formatYmd(), sampleTypeName(), siteName(), unitName() (+1 more)
 
 ### Community 21 - "Community 21"
 Cohesion: 0.16
@@ -183,66 +177,42 @@ Cohesion: 0.17
 Nodes (12): fetchCreateCustomer(), fetchCustomerList(), fetchDeleteCustomer(), fetchUpdateCustomer(), handleAdd(), handleBatchDelete(), handleDelete(), handleReset() (+4 more)
 
 ### Community 27 - "Community 27"
-Cohesion: 0.18
-Nodes (3): fetchMaterialList(), fetchMaterialOptions(), fetchMaterialStockLogList()
-
-### Community 28 - "Community 28"
 Cohesion: 0.2
 Nodes (2): fetchQcMaterialList(), fetchQcMaterialOptions()
 
-### Community 30 - "Community 30"
+### Community 29 - "Community 29"
 Cohesion: 0.39
 Nodes (6): isIgnorableScriptError(), normalizeErrorMessage(), registerPromiseErrorHandler(), registerResourceErrorHandler(), scriptErrorHandler(), setupErrorHandle()
 
-### Community 31 - "Community 31"
+### Community 30 - "Community 30"
 Cohesion: 0.36
 Nodes (1): TableHeightCalculator
 
-### Community 32 - "Community 32"
+### Community 31 - "Community 31"
 Cohesion: 0.33
 Nodes (2): logApiCryptoBootInfo(), maskSecret()
 
-### Community 33 - "Community 33"
-Cohesion: 0.29
-Nodes (2): fetchLeaveDetail(), fetchLeaveList()
-
-### Community 34 - "Community 34"
+### Community 32 - "Community 32"
 Cohesion: 0.47
 Nodes (3): isPaymentDueWithinWarnWindow(), parsePaymentDueYmd(), startOfLocalDay()
 
-### Community 35 - "Community 35"
-Cohesion: 0.33
-Nodes (2): fetchSampleReceptionCheckItemList(), fetchSampleReceptionCheckItemsActive()
-
-### Community 36 - "Community 36"
-Cohesion: 0.33
-Nodes (2): fetchQcThirdPartyItemList(), fetchQcThirdPartyItemsActive()
-
-### Community 37 - "Community 37"
-Cohesion: 0.33
-Nodes (2): fetchQcThirdPartyCompanyList(), fetchQcThirdPartyCompanyOptions()
-
-### Community 38 - "Community 38"
-Cohesion: 0.33
-Nodes (2): fetchQcLabTestItemList(), fetchQcLabTestItemsActive()
-
-### Community 40 - "Community 40"
+### Community 34 - "Community 34"
 Cohesion: 0.53
 Nodes (4): isEtaTodayOrEarlier(), parseEtaLocalDate(), sampleReceptionRowClassName(), startOfLocalDay()
 
-### Community 41 - "Community 41"
+### Community 35 - "Community 35"
 Cohesion: 0.5
 Nodes (2): focusInput(), handleKeydown()
 
-### Community 42 - "Community 42"
+### Community 36 - "Community 36"
 Cohesion: 0.67
 Nodes (2): if(), logSidebarMenu()
 
-### Community 43 - "Community 43"
+### Community 37 - "Community 37"
 Cohesion: 1.0
 Nodes (2): getSettingDefaults(), resetToDefaults()
 
-### Community 45 - "Community 45"
+### Community 39 - "Community 39"
 Cohesion: 1.0
 Nodes (2): defaultAvatarPathByRole(), resolveUserAvatarUrl()
 
@@ -251,40 +221,30 @@ Nodes (2): defaultAvatarPathByRole(), resolveUserAvatarUrl()
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
 - **Thin community `Community 23`** (17 nodes): `ComponentLoader`, `.constructor()`, `.createEmptyComponent()`, `.createErrorComponent()`, `.load()`, `.loadIframe()`, `.loadLayout()`, `.load()`, `RouteTransformer`, `.extractFirstSegment()`, `.handleFirstLevelRoute()`, `.handleIframeRoute()`, `.handleNormalRoute()`, `.isFirstLevelRoute()`, `.transform()`, `ComponentLoader.ts`, `RouteTransformer.ts`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 28`** (10 nodes): `fetchBatchStockInQcMaterial()`, `fetchBatchStockOutQcMaterial()`, `fetchCreateQcMaterial()`, `fetchDeleteQcMaterial()`, `fetchQcMaterialList()`, `fetchQcMaterialOptions()`, `fetchStockInQcMaterial()`, `fetchStockOutQcMaterial()`, `fetchUpdateQcMaterial()`, `qc-material.ts`
-  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 31`** (8 nodes): `TableHeightCalculator`, `.calculate()`, `.calculateOffset()`, `.calculatePaginationOffset()`, `.constructor()`, `.getHeaderHeight()`, `useTableHeight()`, `useTableHeight.ts`
-  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 32`** (7 nodes): `App.vue`, `main.ts`, `refreshButtonAutoIcons()`, `refreshPanelTitleIcons()`, `logApiCryptoBootInfo()`, `maskSecret()`, `console.ts`
-  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 33`** (7 nodes): `fetchCreateLeave()`, `fetchDeleteLeave()`, `fetchLeaveDetail()`, `fetchLeaveList()`, `fetchSubmitLeave()`, `fetchUpdateLeave()`, `leave.ts`
-  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 35`** (6 nodes): `fetchCreateSampleReceptionCheckItem()`, `fetchDeleteSampleReceptionCheckItem()`, `fetchSampleReceptionCheckItemList()`, `fetchSampleReceptionCheckItemsActive()`, `fetchUpdateSampleReceptionCheckItem()`, `sample-reception-check-item.ts`
-  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 36`** (6 nodes): `fetchCreateQcThirdPartyItem()`, `fetchDeleteQcThirdPartyItem()`, `fetchQcThirdPartyItemList()`, `fetchQcThirdPartyItemsActive()`, `fetchUpdateQcThirdPartyItem()`, `qc-third-party-item.ts`
+- **Thin community `Community 27`** (10 nodes): `fetchBatchStockInQcMaterial()`, `fetchBatchStockOutQcMaterial()`, `fetchCreateQcMaterial()`, `fetchDeleteQcMaterial()`, `fetchQcMaterialList()`, `fetchQcMaterialOptions()`, `fetchStockInQcMaterial()`, `fetchStockOutQcMaterial()`, `fetchUpdateQcMaterial()`, `qc-material.ts`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 37`** (6 nodes): `fetchCreateQcThirdPartyCompany()`, `fetchDeleteQcThirdPartyCompany()`, `fetchQcThirdPartyCompanyList()`, `fetchQcThirdPartyCompanyOptions()`, `fetchUpdateQcThirdPartyCompany()`, `qc-third-party-company.ts`
+- **Thin community `Community 30`** (8 nodes): `TableHeightCalculator`, `.calculate()`, `.calculateOffset()`, `.calculatePaginationOffset()`, `.constructor()`, `.getHeaderHeight()`, `useTableHeight()`, `useTableHeight.ts`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 38`** (6 nodes): `fetchCreateQcLabTestItem()`, `fetchDeleteQcLabTestItem()`, `fetchQcLabTestItemList()`, `fetchQcLabTestItemsActive()`, `fetchUpdateQcLabTestItem()`, `qc-lab-test-item.ts`
+- **Thin community `Community 31`** (7 nodes): `App.vue`, `main.ts`, `refreshButtonAutoIcons()`, `refreshPanelTitleIcons()`, `logApiCryptoBootInfo()`, `maskSecret()`, `console.ts`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 41`** (5 nodes): `focusInput()`, `handleKeydown()`, `if()`, `search()`, `index.vue`
+- **Thin community `Community 35`** (5 nodes): `focusInput()`, `handleKeydown()`, `if()`, `search()`, `index.vue`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 42`** (4 nodes): `if()`, `logSidebarMenu()`, `index.vue`, `SidebarSubmenu.vue`
+- **Thin community `Community 36`** (4 nodes): `if()`, `logSidebarMenu()`, `index.vue`, `SidebarSubmenu.vue`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 43`** (3 nodes): `getSettingDefaults()`, `resetToDefaults()`, `setting.ts`
+- **Thin community `Community 37`** (3 nodes): `getSettingDefaults()`, `resetToDefaults()`, `setting.ts`
   Too small to be a meaningful cluster - may be noise or needs more connections extracted.
-- **Thin community `Community 45`** (3 nodes): `defaultAvatarPathByRole()`, `resolveUserAvatarUrl()`, `user-avatar.ts`
+- **Thin community `Community 39`** (3 nodes): `defaultAvatarPathByRole()`, `resolveUserAvatarUrl()`, `user-avatar.ts`
   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 `get()` connect `Community 0` to `Community 1`, `Community 2`, `Community 3`, `Community 4`, `Community 5`, `Community 10`, `Community 11`, `Community 12`, `Community 13`, `Community 14`, `Community 17`, `Community 18`, `Community 19`, `Community 20`, `Community 22`, `Community 25`, `Community 27`, `Community 28`, `Community 33`, `Community 35`, `Community 36`, `Community 37`, `Community 38`?**
-  _High betweenness centrality (0.266) - this node is a cross-community bridge._
-- **Why does `push()` connect `Community 3` to `Community 0`, `Community 2`, `Community 7`, `Community 9`, `Community 11`, `Community 13`?**
-  _High betweenness centrality (0.077) - this node is a cross-community bridge._
-- **Why does `fetchGetLatestUpgradeLog()` connect `Community 11` to `Community 0`?**
-  _High betweenness centrality (0.043) - this node is a cross-community bridge._
+- **Why does `get()` connect `Community 0` to `Community 1`, `Community 2`, `Community 3`, `Community 4`, `Community 5`, `Community 10`, `Community 11`, `Community 12`, `Community 13`, `Community 14`, `Community 15`, `Community 17`, `Community 19`, `Community 22`, `Community 25`, `Community 27`?**
+  _High betweenness centrality (0.264) - this node is a cross-community bridge._
+- **Why does `push()` connect `Community 4` to `Community 1`, `Community 3`, `Community 6`, `Community 9`, `Community 12`, `Community 19`?**
+  _High betweenness centrality (0.078) - this node is a cross-community bridge._
+- **Why does `fetchGetLatestUpgradeLog()` connect `Community 19` to `Community 0`?**
+  _High betweenness centrality (0.042) - this node is a cross-community bridge._
 - **Are the 152 inferred relationships involving `get()` (e.g. with `buildTreePathLabelFromFlat()` and `alignFqPaymentDetailsForDisplay()`) actually correct?**
   _`get()` has 152 INFERRED edges - model-reasoned connections that need verification._
 - **Are the 17 inferred relationships involving `push()` (e.g. with `fetchAllPagedRecords()` and `calcInstallmentDueAmounts()`) actually correct?**

文件差異過大導致無法顯示
+ 1 - 1
web-admin/graphify-out/graph.html


+ 25 - 25
web-admin/graphify-out/manifest.json

@@ -17,8 +17,8 @@
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/types/common/index.ts": 1778582068.0254738,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/types/directive/directive.d.ts": 1778582068.026978,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/types/api/api.d.ts": 1778582068.0246184,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/types/import/components.d.ts": 1779370146.1200917,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/types/import/auto-imports.d.ts": 1779370141.4874394,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/types/import/components.d.ts": 1779405328.0912213,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/types/import/auto-imports.d.ts": 1779405314.3910556,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/types/store/index.ts": 1778582068.0293276,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/types/router/index.ts": 1778775532.895603,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/locales/index.ts": 1778582068.004279,
@@ -169,14 +169,13 @@
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/core/media/art-cutter-img/index.vue": 1778582067.9817953,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/protocol-finance-confirm-fields/index.vue": 1779184108.8553443,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/protocol-finance-confirm-fields/finance-attachments.ts": 1778987672.644368,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/qc-task-view-dialog/index.vue": 1779333579.4876578,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/dialog-form-body/index.vue": 1779333473.8613615,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/qc-task-view-dialog/index.vue": 1779370659.3847518,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/dialog-form-body/index.vue": 1779370673.9239533,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/sample-qc-info-cards/index.vue": 1779254253.4663467,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/order-operate-local-dialog/index.vue": 1778582866.2188683,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/product-view-dialog/index.vue": 1779333717.557603,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/dialog-detail-skeleton/index.vue": 1779333469.3668177,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/product-view-dialog/index.vue": 1779370638.1218963,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/protocol-payment-detail-readonly/index.vue": 1779006281.4220655,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/system-view-dialog/index.vue": 1779333483.3425906,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/system-view-dialog/index.vue": 1779370582.0906003,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/order-operate-dialog-bridge/index.vue": 1778582865.387537,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/hooks/index.ts": 1778582068.0037498,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/hooks/core/useFastEnter.ts": 1778582068.0014625,
@@ -221,9 +220,9 @@
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/refund-confirm/index.vue": 1779269573.509064,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/protocol/index.vue": 1779329214.96505,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/protocol/ProtocolStatusChangeDialog.vue": 1779161483.857836,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/protocol/ProtocolViewDialog.vue": 1779348607.613315,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/protocol/ProtocolViewDialog.vue": 1779370679.264584,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/protocol/ProtocolAttachmentReadonly.vue": 1778938314.528914,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/protocol/ProtocolFormDialog.vue": 1779333591.365972,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/protocol/ProtocolFormDialog.vue": 1779371035.181769,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/protocol/ProtocolAuditDialog.vue": 1778978838.5026703,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/payment-info/index.vue": 1779313518.430975,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/storage-cert/index.vue": 1779313530.5053055,
@@ -240,15 +239,15 @@
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/research-donation/audit/index.vue": 1779227504.1761265,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/research-donation/list/index.vue": 1779227504.1804457,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/research-donation/list/DonationAuditDialog.vue": 1779112125.8042517,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/research-donation/list/DonationViewDialog.vue": 1779333577.1438212,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/research-donation/list/DonationFormDialog.vue": 1779333609.8141866,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/research-donation/list/DonationViewDialog.vue": 1779370624.9148946,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/research-donation/list/DonationFormDialog.vue": 1779371033.7577431,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/research-donation/list/DonationStatusChangeDialog.vue": 1779161484.445245,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/dashboard/console/index.vue": 1779227504.1947322,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/tenant/index.vue": 1779257191.2809517,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/order/index.vue": 1779333726.5420778,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/order/index.vue": 1779370717.3675566,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/unit/index.vue": 1779269675.2464228,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/role/index.vue": 1779333690.3537648,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/post/index.vue": 1779333705.6902134,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/role/index.vue": 1779371032.6095872,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/post/index.vue": 1779371031.494987,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/category/index.vue": 1779269601.5291371,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/express/index.vue": 1779269623.124673,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/user/index.vue": 1779269558.2320182,
@@ -256,11 +255,11 @@
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/user/modules/user-dialog.vue": 1778775532.9028454,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/user/modules/user-search.vue": 1778582068.0978386,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/product/index.vue": 1779269580.3943145,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/workflow/my-applications/index.vue": 1779333693.858461,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/workflow/task-pending/index.vue": 1779333690.3537714,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/workflow/task-completed/index.vue": 1779333690.353951,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/workflow/my-applications/index.vue": 1779370570.6847572,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/workflow/task-pending/index.vue": 1779370542.7826195,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/workflow/task-completed/index.vue": 1779370518.1351404,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/workflow/components/ProcessStatusTag.vue": 1778635996.7440987,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/workflow/components/ApprovalDialog.vue": 1779333694.8993936,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/workflow/components/ApprovalDialog.vue": 1779371110.4165673,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/workflow/designer/FlowDesigner.vue": 1778758509.6141794,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/workflow/process/index.vue": 1779269669.156024,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/menu/index.vue": 1779265260.150818,
@@ -270,14 +269,15 @@
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/leave/index.vue": 1779257191.2768743,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/output-type/index.vue": 1779307917.5932443,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/cell-product/index.vue": 1779341967.5417912,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/process-route/index.vue": 1779368158.8972282,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/process-route/index.vue": 1779370831.7062883,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/sop/index.vue": 1779309609.6630545,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-task/index.vue": 1779341706.1749396,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-task/index.vue": 1779404266.0171812,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/reagent/index.vue": 1779307562.93293,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue": 1779361308.0826523,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts": 1779369361.892348,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/StepDetailPanel.vue": 1779369836.2400293,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/DispatchTaskDialog.vue": 1779352611.1311061,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/useTaskStepEditor.ts": 1779403989.7509887,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/StepDetailPanel.vue": 1779404000.53773,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/TaskExecutionDialog.vue": 1779405231.9717994,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/DispatchTaskDialog.vue": 1779370890.9720688,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/consumable-pack/index.vue": 1779307488.018346,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/consumable/index.vue": 1779307921.9798808,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/process/index.vue": 1779309524.0991938,
@@ -288,7 +288,7 @@
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/quality-inspection/lab-test-item/index.vue": 1779331328.5864854,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/quality-inspection/qc-material/index.vue": 1779284232.1223023,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/quality-inspection/sample-reception/index.vue": 1779333860.8573632,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/quality-inspection/qc-task/index.vue": 1779333720.422681,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/quality-inspection/qc-task/index.vue": 1779371036.8066387,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/quality-inspection/qc-material-usage/index.vue": 1779285902.4727366,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/quality-inspection/third-party-company/index.vue": 1779330250.9402645,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/exception/500/index.vue": 1778582068.0705533,
@@ -298,7 +298,7 @@
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/checkup-institution/index.vue": 1779311045.8670757,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/checkup-institution/CheckupPackagePanel.vue": 1779311419.51521,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel/index.vue": 1779269591.7394044,
-  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel/ChannelViewDialog.vue": 1779333576.2032166,
+  "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel/ChannelViewDialog.vue": 1779370550.4261858,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/cell-product-price/index.vue": 1779309928.4076538,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/project-price-system/index.vue": 1779310370.9475677,
   "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/cell-product-spec/index.vue": 1779309818.5525613,

+ 328 - 0
web-admin/mockup-execution-dialog.html

@@ -0,0 +1,328 @@
+<!DOCTYPE html>
+<html lang="zh">
+<head>
+<meta charset="UTF-8">
+<title>任务执行弹窗 - 方案样例</title>
+<style>
+* { margin: 0; padding: 0; box-sizing: border-box; }
+body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif; background: #1e293b; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
+
+.dialog {
+  width: 96vw; max-width: 1600px;
+  height: 94vh;
+  background: #fff;
+  border-radius: 12px;
+  display: flex; flex-direction: column;
+  overflow: hidden;
+  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
+}
+
+/* 顶部标题栏 */
+.dialog-header {
+  display: flex; align-items: center; justify-content: space-between;
+  padding: 12px 20px;
+  border-bottom: 1px solid #e5e7eb;
+  background: #fff;
+}
+.dialog-header h2 { font-size: 16px; font-weight: 600; color: #1e293b; }
+.dialog-close { width: 32px; height: 32px; border-radius: 6px; border: none; background: #f1f5f9; cursor: pointer; font-size: 16px; color: #64748b; display: flex; align-items: center; justify-content: center; }
+
+/* 任务信息一行 */
+.task-info-bar {
+  display: flex; align-items: center; gap: 20px;
+  padding: 8px 20px;
+  background: #f0fdf4;
+  border-bottom: 1px solid #d1fae5;
+  font-size: 13px; color: #475569;
+}
+.task-info-bar b { color: #1e293b; }
+.status-tag {
+  display: inline-flex; align-items: center;
+  padding: 2px 10px; border-radius: 4px;
+  font-size: 12px; font-weight: 500;
+}
+.status-tag.running { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
+.task-info-actions { margin-left: auto; display: flex; gap: 8px; }
+.btn-sm { padding: 4px 14px; border-radius: 6px; border: 1px solid #d1d5db; background: #fff; font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 4px; }
+.btn-sm.primary { background: #10b981; color: #fff; border-color: #10b981; }
+.btn-sm.success { background: #059669; color: #fff; border-color: #059669; }
+
+/* 主体三栏 */
+.main-body {
+  flex: 1; display: flex; gap: 0;
+  overflow: hidden;
+}
+
+/* 左侧步骤列表 */
+.step-list-panel {
+  width: 320px; flex-shrink: 0;
+  border-right: 1px solid #e5e7eb;
+  display: flex; flex-direction: column;
+}
+.step-list-header {
+  padding: 12px 16px;
+  border-bottom: 1px solid #e5e7eb;
+  display: flex; align-items: center; justify-content: space-between;
+}
+.step-list-header h3 { font-size: 14px; font-weight: 600; color: #1e293b; }
+.progress-badge { font-size: 12px; color: #6b7280; background: #f3f4f6; padding: 2px 8px; border-radius: 10px; }
+.step-list-body { flex: 1; overflow-y: auto; padding: 8px; }
+
+/* 虚拟步骤(输入/输出) */
+.virtual-step {
+  display: flex; align-items: center; gap: 10px;
+  padding: 10px 12px;
+  margin-bottom: 4px;
+  border-radius: 8px;
+  cursor: pointer;
+  transition: all 0.15s;
+  border: 2px solid #bfdbfe;
+  background: #eff6ff;
+}
+.virtual-step:hover { border-color: #93c5fd; background: #dbeafe; }
+.virtual-step.active { border-color: #3b82f6; background: #dbeafe; }
+.virtual-step-icon {
+  width: 28px; height: 28px; border-radius: 6px;
+  display: flex; align-items: center; justify-content: center;
+  font-size: 14px; flex-shrink: 0;
+}
+.virtual-step-icon.input { background: #dbeafe; }
+.virtual-step-icon.output { background: #fef3c7; }
+.virtual-step-info { flex: 1; min-width: 0; }
+.virtual-step-name { font-size: 13px; font-weight: 500; color: #1e293b; }
+.virtual-step-tag {
+  font-size: 11px; padding: 1px 6px; border-radius: 3px;
+}
+.virtual-step-tag.empty { background: #fef2f2; color: #dc2626; }
+.virtual-step-tag.filled { background: #ecfdf5; color: #059669; }
+
+/* 分割线 */
+.step-divider {
+  display: flex; align-items: center; gap: 8px;
+  margin: 8px 0; padding: 0 12px;
+  color: #9ca3af; font-size: 11px;
+}
+.step-divider::before, .step-divider::after {
+  content: ''; flex: 1; height: 1px; background: #e5e7eb;
+}
+
+/* 真实步骤 */
+.step-card {
+  display: flex; align-items: center; gap: 8px;
+  padding: 10px 12px;
+  margin-bottom: 4px;
+  border-radius: 8px;
+  cursor: pointer;
+  transition: all 0.15s;
+  border: 2px solid #e5e7eb;
+  background: #fff;
+}
+.step-card:hover { border-color: #6ee7b7; }
+.step-card.active { border-color: #10b981; background: #ecfdf5; }
+.step-card.done { opacity: 0.65; border-color: #d1fae5; background: #f0fdf4; }
+.step-seq {
+  width: 24px; height: 24px; border-radius: 50%;
+  display: flex; align-items: center; justify-content: center;
+  font-size: 12px; font-weight: 600; flex-shrink: 0;
+}
+.step-seq.pending { background: #f3f4f6; color: #6b7280; }
+.step-seq.running { background: #10b981; color: #fff; }
+.step-seq.done { background: #d1fae5; color: #059669; }
+.step-info { flex: 1; min-width: 0; }
+.step-name { font-size: 13px; font-weight: 500; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.step-desc { font-size: 11px; color: #9ca3af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.step-status {
+  font-size: 11px; padding: 1px 6px; border-radius: 3px; flex-shrink: 0;
+}
+.step-status.done { background: #d1fae5; color: #059669; }
+.step-status.running { background: #ecfdf5; color: #10b981; }
+.step-status.pending { background: #f3f4f6; color: #6b7280; }
+
+/* 右侧详情面板 */
+.detail-panel {
+  flex: 1; display: flex; flex-direction: column;
+  overflow: hidden;
+}
+.detail-header {
+  padding: 12px 20px;
+  border-bottom: 1px solid #e5e7eb;
+  display: flex; align-items: center; justify-content: space-between;
+}
+.detail-header h3 { font-size: 14px; font-weight: 600; color: #1e293b; }
+.detail-body { flex: 1; overflow-y: auto; padding: 20px; }
+
+/* 详情 - 表格 */
+.mock-table { width: 100%; border-collapse: collapse; font-size: 13px; }
+.mock-table th { background: #f9fafb; padding: 8px 12px; text-align: center; font-weight: 500; color: #6b7280; border: 1px solid #e5e7eb; }
+.mock-table td { padding: 8px 12px; text-align: center; border: 1px solid #e5e7eb; color: #1e293b; }
+.mock-table .input-cell { background: #fffbeb; border: 1px dashed #fbbf24; min-width: 80px; height: 32px; }
+
+/* 详情 - 基本信息 */
+.info-grid {
+  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px;
+  margin-bottom: 16px;
+}
+.info-item { display: flex; gap: 8px; font-size: 13px; }
+.info-label { color: #6b7280; flex-shrink: 0; }
+.info-value { color: #1e293b; font-weight: 500; }
+
+/* 工艺库折叠按钮 */
+.library-toggle {
+  display: flex; align-items: center; justify-content: center; gap: 6px;
+  width: 28px; flex-shrink: 0;
+  background: #f9fafb; border-right: 1px solid #e5e7eb;
+  cursor: pointer; transition: background 0.15s;
+  font-size: 12px; color: #6b7280;
+  writing-mode: vertical-lr;
+}
+.library-toggle:hover { background: #ecfdf5; color: #10b981; }
+
+/* 底部操作栏 */
+.detail-footer {
+  padding: 10px 20px;
+  border-top: 1px solid #e5e7eb;
+  display: flex; justify-content: flex-end; gap: 8px;
+}
+
+/* 提示标注 */
+.annotation {
+  position: absolute;
+  font-size: 11px; color: #6366f1;
+  background: #eef2ff; border: 1px dashed #a5b4fc;
+  padding: 2px 8px; border-radius: 4px;
+  white-space: nowrap;
+}
+
+/* 方案标注 */
+.mode-label {
+  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
+  background: #312e81; color: #c7d2fe; padding: 6px 20px; border-radius: 8px;
+  font-size: 13px; z-index: 10;
+}
+</style>
+</head>
+<body>
+
+<div class="mode-label">💡 方案:虚拟步骤 — 任务输入/输出作为确认节点嵌入步骤列表</div>
+
+<div class="dialog">
+  <!-- 标题栏 -->
+  <div class="dialog-header">
+    <h2>任务执行 — 细胞培养-2026-001</h2>
+    <button class="dialog-close">✕</button>
+  </div>
+
+  <!-- 任务信息一行 -->
+  <div class="task-info-bar">
+    <span>任务号:<b>SK20260522001</b></span>
+    <span>工单号:GD20260522003</span>
+    <span>任务名称:细胞培养</span>
+    <span class="status-tag running">● 进行中</span>
+    <div class="task-info-actions">
+      <button class="btn-sm success">✔ 完成任务</button>
+    </div>
+  </div>
+
+  <!-- 主体 -->
+  <div class="main-body">
+    <!-- 可折叠工艺库把手 -->
+    <div class="library-toggle" title="展开工艺库">工 艺 库 ›</div>
+
+    <!-- 步骤列表 -->
+    <div class="step-list-panel">
+      <div class="step-list-header">
+        <h3>工序步骤</h3>
+        <span class="progress-badge">进度 2/5</span>
+      </div>
+      <div class="step-list-body">
+
+        <!-- ✅ 虚拟步骤:任务输入 -->
+        <div class="virtual-step" style="background:#dbeafe; border-color:#3b82f6;">
+          <div class="virtual-step-icon input">📥</div>
+          <div class="virtual-step-info">
+            <div class="virtual-step-name">任务输入</div>
+          </div>
+          <span class="virtual-step-tag filled">已填写 3 项</span>
+        </div>
+
+        <!-- ✅ 虚拟步骤:任务输出 -->
+        <div class="virtual-step" style="border-style: dashed;">
+          <div class="virtual-step-icon output">📤</div>
+          <div class="virtual-step-info">
+            <div class="virtual-step-name">任务输出</div>
+          </div>
+          <span class="virtual-step-tag empty">⚠ 未填写</span>
+        </div>
+
+        <!-- 分割线 -->
+        <div class="step-divider">工艺步骤</div>
+
+        <!-- 已完成步骤 -->
+        <div class="step-card done">
+          <div class="step-seq done">✓</div>
+          <div class="step-info">
+            <div class="step-name">样本接收</div>
+          </div>
+          <span class="step-status done">已完成</span>
+        </div>
+
+        <!-- 进行中步骤(高亮) -->
+        <div class="step-card active">
+          <div class="step-seq running">2</div>
+          <div class="step-info">
+            <div class="step-name">细胞分离</div>
+            <div class="step-desc">从样本中分离目标细胞</div>
+          </div>
+          <span class="step-status running">▶ 进行中</span>
+        </div>
+
+        <!-- 待执行步骤 -->
+        <div class="step-card">
+          <div class="step-seq pending">3</div>
+          <div class="step-info">
+            <div class="step-name">细胞培养</div>
+          </div>
+          <span class="step-status pending">待执行</span>
+        </div>
+
+        <div class="step-card">
+          <div class="step-seq pending">4</div>
+          <div class="step-info">
+            <div class="step-name">质量检测</div>
+          </div>
+          <span class="step-status pending">待执行</span>
+        </div>
+
+        <div class="step-card">
+          <div class="step-seq pending">5</div>
+          <div class="step-info">
+            <div class="step-name">冻存封装</div>
+          </div>
+          <span class="step-status pending">待执行</span>
+        </div>
+
+      </div>
+    </div>
+
+    <!-- 右侧详情面板 - 展示"任务输出"被选中的状态 -->
+    <div class="detail-panel">
+      <div class="detail-header">
+        <h3>📤 任务输出</h3>
+        <div style="display:flex; gap:8px;">
+          <button class="btn-sm primary">+ 添加输出</button>
+          <button class="btn-sm primary">✔ 保存输出</button>
+        </div>
+      </div>
+      <div class="detail-body">
+        <div style="text-align:center; padding: 40px 0; color:#9ca3af;">
+          <div style="font-size:36px; margin-bottom:12px;">📋</div>
+          <p style="font-size:14px; margin-bottom:4px;">暂无输出项</p>
+          <p style="font-size:12px;">点击上方"添加输出"按钮添加任务输出记录</p>
+        </div>
+      </div>
+    </div>
+  </div>
+</div>
+
+</body>
+</html>

+ 41 - 0
web-admin/src/api/admin.ts

@@ -1388,6 +1388,47 @@ export function fetchDeleteStorageSlot(id: string) {
   return request.del({ url: `/web/admin/storage-facility-slots/${id}` })
 }
 
+// ---------------------------------------------------------------------------
+// 库位占用记录
+// ---------------------------------------------------------------------------
+
+export function fetchSlotOccupancies(params: {
+  slotId: string
+  occupancyStatus?: string
+  itemType?: string
+  page?: number
+  pageSize?: number
+}) {
+  return request.get({ url: '/web/admin/storage-slot-occupancies', params })
+}
+
+export function fetchSlotOccupancyHistory(params?: {
+  slotId?: string
+  facilityNodeId?: string
+  itemType?: string
+  startDate?: string
+  endDate?: string
+  page?: number
+  pageSize?: number
+}) {
+  return request.get({ url: '/web/admin/storage-slot-occupancies/history', params })
+}
+
+export function fetchCreateOccupancy(data: {
+  slotId: string
+  itemType?: string
+  itemCode: string
+  itemName: string
+  itemSource?: string
+  remark?: string
+}) {
+  return request.post({ url: '/web/admin/storage-slot-occupancies', params: data })
+}
+
+export function fetchRemoveOccupancy(id: string) {
+  return request.put({ url: `/web/admin/storage-slot-occupancies/${id}/remove` })
+}
+
 // ---------------------------------------------------------------------------
 // 展馆预约
 // ---------------------------------------------------------------------------

+ 2 - 2
web-admin/src/api/production-task.ts

@@ -65,11 +65,11 @@ export function fetchReplaceStepDataCollection(taskId: string, stepId: string, d
   })
 }
 
-export function fetchSetTaskInputs(taskId: string, data: Record<string, any>) {
+export function fetchSetTaskInputs(taskId: string, data: any[] | Record<string, any>) {
   return request.post({ url: `/web/admin/production-tasks/${taskId}/inputs`, params: data })
 }
 
-export function fetchSetTaskOutputs(taskId: string, data: Record<string, any>) {
+export function fetchSetTaskOutputs(taskId: string, data: any[] | Record<string, any>) {
   return request.post({ url: `/web/admin/production-tasks/${taskId}/outputs`, params: data })
 }
 

文件差異過大導致無法顯示
+ 0 - 0
web-admin/src/graphify-out/cache/ast/0270a86e00fb2d03735edbc82311ab9b2f24797bcb44e37a9c26bd4329b736d7.json


文件差異過大導致無法顯示
+ 0 - 0
web-admin/src/graphify-out/cache/ast/027b8d8fc27ffaa986fabf1fac7062450c2b22274f8e2d3f7d571b4f2ac18b84.json


文件差異過大導致無法顯示
+ 0 - 0
web-admin/src/graphify-out/cache/ast/03d8d52a2e39384ef92fdd1223e943a9cb25fd50ec1d862f5c9612e37033ee63.json


+ 1 - 0
web-admin/src/graphify-out/cache/ast/10a8d9ee86620942102b2a18f321be54b6c148d53cccc478fc19a9e6160ab003.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_taskexecutiondialog_vue", "label": "TaskExecutionDialog.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/TaskExecutionDialog.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}

+ 1 - 0
web-admin/src/graphify-out/cache/ast/12d66314ead0cdc2586d13e556f529d97ace2a87265f3ec08397fe5f7a869c15.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_components_business_dialog_form_body_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/dialog-form-body/index.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}

文件差異過大導致無法顯示
+ 0 - 0
web-admin/src/graphify-out/cache/ast/286c7f5cb5dfd9b96a42d27822638f7f8a6382f571fc258156c727231b5c8272.json


+ 1 - 0
web-admin/src/graphify-out/cache/ast/2fedac0f4e8095b7688afe6499a43fc3bfdf5c91c2ba2dd341e31f7d300735bf.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_system_workflow_task_completed_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/workflow/task-completed/index.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}

+ 1 - 0
web-admin/src/graphify-out/cache/ast/318b84714c5fcbea1417d5b94ca640798930a1f5f4edbf2b01c0fd92fb78cbe4.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_stepdetailpanel_vue", "label": "StepDetailPanel.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/StepDetailPanel.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}

+ 1 - 0
web-admin/src/graphify-out/cache/ast/582fa79ca3b6b2de10a5923504ba1af312d3d2edab9d78840a92dd78ff4a37e3.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_system_workflow_task_pending_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/workflow/task-pending/index.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}

文件差異過大導致無法顯示
+ 0 - 0
web-admin/src/graphify-out/cache/ast/5874bcb3a0814d0003228122afff00aa1f1d28e24f1cba0fc336b4f0ec37ece3.json


+ 1 - 0
web-admin/src/graphify-out/cache/ast/6141fa236d8c03d9be0fc9c8cd55f4bb034374a1524b41c7f654ef272dab115e.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_pilot_service_channel_channelviewdialog_vue", "label": "ChannelViewDialog.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel/ChannelViewDialog.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}

+ 1 - 0
web-admin/src/graphify-out/cache/ast/6332b49387277ffab36847b88a8826e06a80dbabeeae4b278d63b0a9b12bcf70.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_system_workflow_my_applications_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/workflow/my-applications/index.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}

+ 1 - 0
web-admin/src/graphify-out/cache/ast/65296d2c824789b0a9ad88e08113a8832e84769a1ca331f41cc016dffeb88621.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_components_business_product_view_dialog_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/product-view-dialog/index.vue", "source_location": "L1"}, {"id": "product_view_dialog_index_formatmeasureview", "label": "formatMeasureView()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/product-view-dialog/index.vue", "source_location": "L34"}], "edges": [{"source": "users_wuzilong_work_00code_zkxw_web_admin_src_components_business_product_view_dialog_index_vue", "target": "product_view_dialog_index_formatmeasureview", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/product-view-dialog/index.vue", "source_location": "L34", "weight": 1.0}], "raw_calls": []}

文件差異過大導致無法顯示
+ 0 - 0
web-admin/src/graphify-out/cache/ast/657d55449547de2486d3343fc83928e0715fc21885f4588ad336d87dbdaa8c44.json


+ 1 - 0
web-admin/src/graphify-out/cache/ast/9dcc71c3ce46820f0f575a5a4fca282694c444def165b7ac667efb9c7e5ebdd5.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_components_business_system_view_dialog_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/components/business/system-view-dialog/index.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}

+ 1 - 0
web-admin/src/graphify-out/cache/ast/a760b18e336769cd455aa5140d30a53529367322e100dcbf2f181acb620529f5.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_types_import_components_d_ts", "label": "components.d.ts", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/types/import/components.d.ts", "source_location": "L1"}], "edges": [], "raw_calls": []}

文件差異過大導致無法顯示
+ 0 - 0
web-admin/src/graphify-out/cache/ast/a86137fb4bca464bdb8c825795c600b1bec356f31855256bf7be9681e54c2af1.json


+ 1 - 0
web-admin/src/graphify-out/cache/ast/b3954803eb25a6e8cf1ace8e52c8e966e54ed1c7299c4f334be84e6d7f450ed3.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_system_role_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/role/index.vue", "source_location": "L1"}, {"id": "role_index_walk", "label": "walk()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/role/index.vue", "source_location": "L517"}], "edges": [{"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_system_role_index_vue", "target": "role_index_walk", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/role/index.vue", "source_location": "L517", "weight": 1.0}], "raw_calls": [{"caller_nid": "role_index_walk", "callee": "push", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/role/index.vue", "source_location": "L519"}]}

+ 1 - 0
web-admin/src/graphify-out/cache/ast/cb706f31e29d0bee0a8a1cb672dd0f412819b07752b2a49811d6678b6e0db08d.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_task_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-task/index.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}

文件差異過大導致無法顯示
+ 0 - 0
web-admin/src/graphify-out/cache/ast/cbad878c95ca3b0ca71336fe66a510b44fd36ad9e6faa9baf29220db3d1fe4d6.json


+ 1 - 0
web-admin/src/graphify-out/cache/ast/cdf1201b96832ec9724e9ce7f50f2830aca6a73301661c5ec778f29cf4dae9a7.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_cell_storage_protocol_protocolviewdialog_vue", "label": "ProtocolViewDialog.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/protocol/ProtocolViewDialog.vue", "source_location": "L1"}, {"id": "protocol_protocolviewdialog_dash", "label": "dash()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/protocol/ProtocolViewDialog.vue", "source_location": "L324"}, {"id": "protocol_protocolviewdialog_handleclosed", "label": "handleClosed()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/protocol/ProtocolViewDialog.vue", "source_location": "L1643"}], "edges": [{"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_cell_storage_protocol_protocolviewdialog_vue", "target": "protocol_protocolviewdialog_dash", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/protocol/ProtocolViewDialog.vue", "source_location": "L324", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_cell_storage_protocol_protocolviewdialog_vue", "target": "protocol_protocolviewdialog_handleclosed", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/protocol/ProtocolViewDialog.vue", "source_location": "L1643", "weight": 1.0}], "raw_calls": [{"caller_nid": "protocol_protocolviewdialog_dash", "callee": "unitName", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/cell-storage/protocol/ProtocolViewDialog.vue", "source_location": "L324"}]}

+ 1 - 0
web-admin/src/graphify-out/cache/ast/d0d14b943c73211ccababf0686d9209778e311fbacf6000f489c792c94ad98b4.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_dispatchtaskdialog_vue", "label": "DispatchTaskDialog.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/DispatchTaskDialog.vue", "source_location": "L1"}, {"id": "production_work_order_dispatchtaskdialog_if", "label": "if()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/DispatchTaskDialog.vue", "source_location": "L202"}], "edges": [{"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_dispatchtaskdialog_vue", "target": "production_work_order_dispatchtaskdialog_if", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/DispatchTaskDialog.vue", "source_location": "L202", "weight": 1.0}], "raw_calls": [{"caller_nid": "production_work_order_dispatchtaskdialog_if", "callee": "initEditor", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/DispatchTaskDialog.vue", "source_location": "L206"}]}

文件差異過大導致無法顯示
+ 0 - 0
web-admin/src/graphify-out/cache/ast/fb97c0bd015f9c5bfa03763c36811290720bb9d1f217611018ba4e788c162f38.json


+ 1 - 0
web-admin/src/graphify-out/cache/ast/fe324eeb511b1c7154e38444b690bf2212bbef5e7260ab9361a34e27db824bea.json

@@ -0,0 +1 @@
+{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_system_order_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/system/order/index.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}

+ 3 - 0
web-admin/src/styles/_route-config.scss

@@ -234,6 +234,9 @@
 .route-config-right-header {
   padding: 12px 16px;
   border-bottom: 1px solid #e5e7eb;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
   flex-shrink: 0;
 
   h3 {

+ 380 - 2
web-admin/src/views/operations/storage-facility/index.vue

@@ -131,10 +131,11 @@
                         :key="cell.id"
                         class="shelf-cell"
                         :class="{ occupied: cell.slotStatus === '占用' }"
-                        @click="handleEditSlot(cell)"
+                        @click="handleOpenOccupancyDialog(cell)"
                       >
                         <button class="cell-delete-btn" @click.stop="handleDeleteSlot(cell)" title="删除">×</button>
                         <span class="cell-code">{{ cellIndex + 1 }}</span>
+                        <span v-if="cell.occupiedCount > 0" class="cell-badge">{{ cell.occupiedCount }}</span>
                       </div>
                     </div>
                   </div>
@@ -361,6 +362,171 @@
           </el-button>
         </template>
       </el-dialog>
+
+      <!-- 占用明细弹窗 -->
+      <el-dialog
+        v-model="occupancyDialogVisible"
+        :title="occupancyDialogTitle"
+        width="920px"
+        top="5vh"
+        class="dialog-form-layout"
+        align-center
+        destroy-on-close
+      >
+        <el-tabs v-model="occupancyActiveTab">
+          <el-tab-pane label="在库物品" name="stored">
+            <div class="occupancy-toolbar">
+              <el-button type="primary" size="small" @click="handleOpenStoreDialog">
+                入库
+              </el-button>
+            </div>
+            <el-table :data="occupancyList" v-loading="occupancyLoading" size="small" max-height="360">
+              <el-table-column type="index" label="序号" width="60" />
+              <el-table-column label="物品类型" width="120">
+                <template #default="{ row }">
+                  <el-tag :type="row.itemType === 'cell_product' ? 'primary' : 'info'" size="small">
+                    {{ row.itemType === 'cell_product' ? '细胞产品' : '其他' }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column prop="itemCode" label="物品编码" min-width="140" />
+              <el-table-column prop="itemName" label="物品名称" min-width="140" />
+              <el-table-column label="来源" width="120">
+                <template #default="{ row }">
+                  {{ { production: '生产入库', manual: '手动入库', transfer: '转移' }[row.itemSource] || row.itemSource }}
+                </template>
+              </el-table-column>
+              <el-table-column prop="storedAt" label="入库时间" width="170" />
+              <el-table-column label="操作" width="80" fixed="right">
+                <template #default="{ row }">
+                  <el-button type="danger" link size="small" @click="handleRemoveOccupancy(row)">
+                    出库
+                  </el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+            <div v-if="occupancyTotal > occupancyPageSize" class="occupancy-pagination">
+              <el-pagination
+                small
+                layout="total, prev, pager, next"
+                :total="occupancyTotal"
+                :page-size="occupancyPageSize"
+                v-model:current-page="occupancyPage"
+                @current-change="loadOccupancies"
+              />
+            </div>
+          </el-tab-pane>
+
+          <el-tab-pane label="出入库历史" name="history">
+            <el-table :data="historyList" v-loading="historyLoading" size="small" max-height="400">
+              <el-table-column type="index" label="序号" width="60" />
+              <el-table-column label="物品类型" width="120">
+                <template #default="{ row }">
+                  <el-tag :type="row.itemType === 'cell_product' ? 'primary' : 'info'" size="small">
+                    {{ row.itemType === 'cell_product' ? '细胞产品' : '其他' }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column prop="itemCode" label="物品编码" min-width="120" />
+              <el-table-column prop="itemName" label="物品名称" min-width="120" />
+              <el-table-column label="来源" width="100">
+                <template #default="{ row }">
+                  {{ { production: '生产入库', manual: '手动入库', transfer: '转移' }[row.itemSource] || row.itemSource }}
+                </template>
+              </el-table-column>
+              <el-table-column prop="storedAt" label="入库时间" width="170" />
+              <el-table-column prop="removedAt" label="出库时间" width="170" />
+              <el-table-column label="状态" width="100">
+                <template #default="{ row }">
+                  <el-tag :type="row.occupancyStatus === 'stored' ? 'success' : 'warning'" size="small">
+                    {{ row.occupancyStatus === 'stored' ? '在库' : '已出库' }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+            </el-table>
+            <div v-if="historyTotal > historyPageSize" class="occupancy-pagination">
+              <el-pagination
+                small
+                layout="total, prev, pager, next"
+                :total="historyTotal"
+                :page-size="historyPageSize"
+                v-model:current-page="historyPage"
+                @current-change="loadHistory"
+              />
+            </div>
+          </el-tab-pane>
+
+          <el-tab-pane label="格子信息" name="info">
+            <el-form
+              ref="occupancySlotFormRef"
+              :model="occupancySlotFormData"
+              :rules="occupancySlotFormRules"
+              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="格子编码" prop="slotCode">
+                  <el-input v-model="occupancySlotFormData.slotCode" placeholder="请输入格子编码" />
+                </el-form-item>
+                <el-form-item label="格子状态">
+                  <el-select v-model="occupancySlotFormData.slotStatus" placeholder="请选择状态">
+                    <el-option label="空" value="空" />
+                    <el-option label="占用" value="占用" />
+                  </el-select>
+                </el-form-item>
+                <el-form-item label="备注" class="form-col-span-2">
+                  <el-input v-model="occupancySlotFormData.remark" placeholder="可选" />
+                </el-form-item>
+              </div>
+            </el-form>
+            <div class="occupancy-slot-save-bar">
+              <el-button type="primary" size="small" :loading="occupancySlotSaving" @click="handleOccupancySlotSave">
+                保存
+              </el-button>
+            </div>
+          </el-tab-pane>
+        </el-tabs>
+      </el-dialog>
+
+      <!-- 手动入库弹窗 -->
+      <el-dialog
+        v-model="storeDialogVisible"
+        title="手动入库"
+        width="480px"
+        class="dialog-form-layout"
+        align-center
+        destroy-on-close
+        :close-on-click-modal="false"
+      >
+        <el-form
+          ref="storeFormRef"
+          :model="storeFormData"
+          :rules="storeFormRules"
+          label-position="top"
+        >
+          <el-form-item label="物品编码" prop="itemCode">
+            <el-input v-model="storeFormData.itemCode" placeholder="请输入物品编码" />
+          </el-form-item>
+          <el-form-item label="物品名称" prop="itemName">
+            <el-input v-model="storeFormData.itemName" placeholder="请输入物品名称" />
+          </el-form-item>
+          <el-form-item label="来源" prop="itemSource">
+            <el-select v-model="storeFormData.itemSource" placeholder="请选择来源">
+              <el-option label="手动入库" value="manual" />
+              <el-option label="转移" value="transfer" />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="备注">
+            <el-input v-model="storeFormData.remark" type="textarea" :rows="2" placeholder="可选" />
+          </el-form-item>
+        </el-form>
+        <template #footer>
+          <el-button class="btn-ghost" @click="storeDialogVisible = false">取消</el-button>
+          <el-button type="primary" :loading="storeSubmitLoading" @click="handleStoreSubmit">确认入库</el-button>
+        </template>
+      </el-dialog>
     </section>
   </div>
 </template>
@@ -379,7 +545,11 @@
     fetchInsertStorageSlotRow,
     fetchCreateStorageSlot,
     fetchUpdateStorageSlot,
-    fetchDeleteStorageSlot
+    fetchDeleteStorageSlot,
+    fetchSlotOccupancies,
+    fetchSlotOccupancyHistory,
+    fetchCreateOccupancy,
+    fetchRemoveOccupancy
   } from '@/api/admin'
   import { buildTreePathLabelFromFlat } from '@/utils/tree-path'
 
@@ -941,6 +1111,183 @@
     }
   }
 
+  // ==================== 占用明细弹窗 ====================
+  const occupancyDialogVisible = ref(false)
+  const occupancyDialogTitle = ref('')
+  const occupancyActiveTab = ref('stored')
+  const currentSlot = ref<any>(null)
+  const occupancyLoading = ref(false)
+  const occupancyList = ref<any[]>([])
+  const occupancyTotal = ref(0)
+  const occupancyPage = ref(1)
+  const occupancyPageSize = 20
+
+  const historyLoading = ref(false)
+  const historyList = ref<any[]>([])
+  const historyTotal = ref(0)
+  const historyPage = ref(1)
+  const historyPageSize = 20
+
+  // 手动入库弹窗
+  const storeDialogVisible = ref(false)
+  const storeSubmitLoading = ref(false)
+  const storeFormRef = ref()
+  const storeFormData = reactive({
+    itemCode: '',
+    itemName: '',
+    itemSource: 'manual',
+    remark: ''
+  })
+  const storeFormRules = {
+    itemCode: [{ required: true, message: '请输入物品编码', trigger: 'blur' }],
+    itemName: [{ required: true, message: '请输入物品名称', trigger: 'blur' }],
+    itemSource: [{ required: true, message: '请选择来源', trigger: 'change' }]
+  }
+
+  // 格子信息 tab
+  const occupancySlotFormRef = ref()
+  const occupancySlotSaving = ref(false)
+  const occupancySlotFormData = reactive({
+    slotCode: '',
+    slotStatus: '空',
+    remark: ''
+  })
+  const occupancySlotFormRules = {
+    slotCode: [{ required: true, message: '请输入格子编码', trigger: 'blur' }]
+  }
+
+  const handleOccupancySlotSave = async () => {
+    await occupancySlotFormRef.value?.validate?.()
+    if (!currentSlot.value) return
+    occupancySlotSaving.value = true
+    try {
+      await fetchUpdateStorageSlot(currentSlot.value.id, {
+        slotCode: occupancySlotFormData.slotCode.trim(),
+        slotStatus: occupancySlotFormData.slotStatus,
+        remark: occupancySlotFormData.remark?.trim() || undefined
+      })
+      ElMessage.success('保存成功')
+      if (selectedNode.value?.id) await loadSlots(selectedNode.value.id)
+      // 同步更新 currentSlot 以反映最新值
+      const refreshed = slotList.value.find((s: any) => s.id === currentSlot.value.id)
+      if (refreshed) {
+        currentSlot.value = refreshed
+        Object.assign(occupancySlotFormData, {
+          slotCode: refreshed.slotCode || '',
+          slotStatus: refreshed.slotStatus || '空',
+          remark: refreshed.remark || ''
+        })
+      }
+    } catch {
+      /* 错误已全局处理 */
+    } finally {
+      occupancySlotSaving.value = false
+    }
+  }
+
+  const handleOpenOccupancyDialog = (cell: any) => {
+    currentSlot.value = cell
+    occupancyDialogTitle.value = `储物格明细 — ${cell.slotCode || cell.id}`
+    occupancyActiveTab.value = 'stored'
+    occupancyPage.value = 1
+    historyPage.value = 1
+    // 初始化格子编辑表单
+    Object.assign(occupancySlotFormData, {
+      slotCode: cell.slotCode || '',
+      slotStatus: cell.slotStatus || '空',
+      remark: cell.remark || ''
+    })
+    occupancyDialogVisible.value = true
+    nextTick(() => occupancySlotFormRef.value?.clearValidate?.())
+    loadOccupancies()
+    loadHistory()
+  }
+
+  const loadOccupancies = async () => {
+    if (!currentSlot.value) return
+    occupancyLoading.value = true
+    try {
+      const res: any = await fetchSlotOccupancies({
+        slotId: currentSlot.value.id,
+        occupancyStatus: 'stored',
+        page: occupancyPage.value,
+        pageSize: occupancyPageSize
+      })
+      const data = res?.data || res || {}
+      occupancyList.value = data.items || data.list || []
+      occupancyTotal.value = data.total || 0
+    } catch {
+      occupancyList.value = []
+    } finally {
+      occupancyLoading.value = false
+    }
+  }
+
+  const loadHistory = async () => {
+    if (!currentSlot.value) return
+    historyLoading.value = true
+    try {
+      const res: any = await fetchSlotOccupancyHistory({
+        slotId: currentSlot.value.id,
+        page: historyPage.value,
+        pageSize: historyPageSize
+      })
+      const data = res?.data || res || {}
+      historyList.value = data.items || data.list || []
+      historyTotal.value = data.total || 0
+    } catch {
+      historyList.value = []
+    } finally {
+      historyLoading.value = false
+    }
+  }
+
+  const handleOpenStoreDialog = () => {
+    Object.assign(storeFormData, { itemCode: '', itemName: '', itemSource: 'manual', remark: '' })
+    storeDialogVisible.value = true
+    nextTick(() => storeFormRef.value?.clearValidate?.())
+  }
+
+  const handleStoreSubmit = async () => {
+    await storeFormRef.value?.validate?.()
+    if (!currentSlot.value) return
+    storeSubmitLoading.value = true
+    try {
+      await fetchCreateOccupancy({
+        slotId: currentSlot.value.id,
+        itemType: 'other',
+        itemCode: storeFormData.itemCode.trim(),
+        itemName: storeFormData.itemName.trim(),
+        itemSource: storeFormData.itemSource,
+        remark: storeFormData.remark?.trim() || undefined
+      })
+      ElMessage.success('入库成功')
+      storeDialogVisible.value = false
+      loadOccupancies()
+      loadHistory()
+      if (selectedNode.value?.id) loadSlots(selectedNode.value.id)
+    } catch {
+      /* 错误已全局处理 */
+    } finally {
+      storeSubmitLoading.value = false
+    }
+  }
+
+  const handleRemoveOccupancy = async (row: any) => {
+    try {
+      await ElMessageBox.confirm(`确认将「${row.itemName || row.itemCode}」出库?`, '出库确认', {
+        type: 'warning'
+      })
+      await fetchRemoveOccupancy(row.id)
+      ElMessage.success('出库成功')
+      loadOccupancies()
+      loadHistory()
+      if (selectedNode.value?.id) loadSlots(selectedNode.value.id)
+    } catch {
+      /* 取消或错误 */
+    }
+  }
+
   // ==================== 初始化 ====================
   onMounted(() => {
     loadData()
@@ -1304,4 +1651,35 @@
     white-space: nowrap;
     max-width: 34px;
   }
+
+  .cell-badge {
+    position: absolute;
+    top: 2px;
+    right: 2px;
+    min-width: 16px;
+    height: 16px;
+    line-height: 16px;
+    font-size: 10px;
+    text-align: center;
+    color: #fff;
+    background: #f56c6c;
+    border-radius: 8px;
+    padding: 0 4px;
+  }
+
+  .occupancy-toolbar {
+    margin-bottom: 12px;
+  }
+
+  .occupancy-pagination {
+    margin-top: 12px;
+    display: flex;
+    justify-content: flex-end;
+  }
+
+  .occupancy-slot-save-bar {
+    margin-top: 24px;
+    padding-top: 16px;
+    border-top: 1px solid var(--el-border-color-lighter);
+  }
 </style>

+ 12 - 6
web-admin/src/views/production/process-route/index.vue

@@ -322,6 +322,15 @@
             <template v-if="selectedStep">
               <div class="route-config-right-header">
                 <h3>步骤详情</h3>
+                <el-button
+                  class="btn-main"
+                  type="primary"
+                  size="small"
+                  :loading="manualSaveLoading"
+                  @click="handleManualSave"
+                >
+                  <el-icon><Check /></el-icon>保存
+                </el-button>
               </div>
               <div class="route-config-right-body">
                 <el-form label-position="top" class="route-config-step-form">
@@ -691,12 +700,6 @@
                   </el-tab-pane>
                 </el-tabs>
               </div>
-              <div class="route-config-right-footer">
-                <el-button class="btn-main" type="primary" :loading="manualSaveLoading" @click="handleManualSave">
-                  <el-icon><Check /></el-icon>
-                  保存
-                </el-button>
-              </div>
             </template>
             <template v-else>
               <div class="route-config-right-empty">
@@ -1965,6 +1968,9 @@
   .route-config-right-header {
     padding: 12px 16px;
     border-bottom: 1px solid #e5e7eb;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
     flex-shrink: 0;
 
     h3 {

+ 32 - 0
web-admin/src/views/production/production-task/index.vue

@@ -49,10 +49,30 @@
           <el-table-column type="index" label="序号" width="68" align="center" :index="(i: number) => (pagination.page - 1) * pagination.pageSize + i + 1" />
           <el-table-column prop="taskNo" label="任务号" min-width="150" align="center" />
           <el-table-column prop="workOrderNo" label="所属工单号" min-width="140" align="center" />
+          <el-table-column prop="protocolNo" label="协议号" min-width="140" align="center">
+            <template #default="{ row }">{{ row.protocolNo || '—' }}</template>
+          </el-table-column>
+          <el-table-column prop="sampleCode" label="样本编码" min-width="130" align="center">
+            <template #default="{ row }">{{ row.sampleCode || '—' }}</template>
+          </el-table-column>
+          <el-table-column prop="sampleTypeName" label="样本类型" min-width="110" align="center">
+            <template #default="{ row }">{{ row.sampleTypeName || '—' }}</template>
+          </el-table-column>
+          <el-table-column prop="taskType" label="任务类型" width="120" align="center">
+            <template #default="{ row }">
+              <el-tag :type="taskTypeTag(row.taskType).type" size="small">{{ taskTypeTag(row.taskType).label }}</el-tag>
+            </template>
+          </el-table-column>
           <el-table-column prop="taskName" label="任务名称" min-width="160" align="center" show-overflow-tooltip />
           <el-table-column prop="routeName" label="工艺路线" min-width="140" align="center" show-overflow-tooltip>
             <template #default="{ row }">{{ row.routeName || '—' }}</template>
           </el-table-column>
+          <el-table-column prop="receiverName" label="接收人" min-width="100" align="center">
+            <template #default="{ row }">{{ row.receiverName || '—' }}</template>
+          </el-table-column>
+          <el-table-column prop="receptionTime" label="接收时间" min-width="170" align="center">
+            <template #default="{ row }">{{ row.receptionTime || '—' }}</template>
+          </el-table-column>
           <el-table-column prop="taskStatus" label="任务状态" width="110" align="center">
             <template #default="{ row }">
               <el-tag :type="taskStatusTag(row.taskStatus).type" size="small">{{ taskStatusTag(row.taskStatus).label }}</el-tag>
@@ -89,6 +109,7 @@
         v-model:visible="executionDialogVisible"
         :task-id="executionTaskId"
         :task-name="executionTaskName"
+        :readonly="executionReadonly"
         @success="loadData"
       />
     </section>
@@ -116,6 +137,14 @@
     return map[status] || { label: status, type: 'info' }
   }
 
+  function taskTypeTag(taskType: string) {
+    const map: Record<string, { label: string; type: string }> = {
+      cell_storage: { label: '入库生产单', type: 'primary' },
+      outbound: { label: '出库生产单', type: 'warning' }
+    }
+    return map[taskType] || { label: taskType, type: 'info' }
+  }
+
   // ---------------------------------------------------------------------------
   // 列表视图
   // ---------------------------------------------------------------------------
@@ -160,16 +189,19 @@
   const executionDialogVisible = ref(false)
   const executionTaskId = ref('')
   const executionTaskName = ref('')
+  const executionReadonly = ref(false)
 
   function handleEnterExecution(row: Record<string, any>) {
     executionTaskId.value = row.id
     executionTaskName.value = row.taskName || ''
+    executionReadonly.value = false
     executionDialogVisible.value = true
   }
 
   function handleViewDetail(row: Record<string, any>) {
     executionTaskId.value = row.id
     executionTaskName.value = row.taskName || ''
+    executionReadonly.value = true
     executionDialogVisible.value = true
   }
 

+ 1 - 0
web-admin/src/views/production/production-work-order/DispatchTaskDialog.vue

@@ -182,6 +182,7 @@
     try {
       const task = await fetchCreateProductionTask({
         work_order_id: props.workOrderRow.id,
+        task_type: 'cell_storage',
         task_name: form.taskName,
         route_id: form.routeId,
         description: form.description || undefined,

+ 29 - 23
web-admin/src/views/production/production-work-order/StepDetailPanel.vue

@@ -4,26 +4,37 @@
     <template v-if="editor.selectedStep.value">
       <div class="route-config-right-header">
         <h3>步骤详情</h3>
-        <div v-if="editor.mode.value === 'execution' && editor.selectedStep.value" class="step-status-bar">
-          <el-tag :type="editor.stepStatusTag(editor.selectedStep.value.stepStatus || 'dzx').type" size="small">
-            {{ editor.stepStatusTag(editor.selectedStep.value.stepStatus || 'dzx').label }}
-          </el-tag>
+        <div v-if="!readonly" class="step-status-bar">
+          <template v-if="editor.mode.value === 'execution' && editor.selectedStep.value">
+            <el-tag :type="editor.stepStatusTag(editor.selectedStep.value.stepStatus || 'dzx').type" size="small">
+              {{ editor.stepStatusTag(editor.selectedStep.value.stepStatus || 'dzx').label }}
+            </el-tag>
+            <el-button
+              v-if="editor.selectedStep.value.stepStatus === 'dzx'"
+              class="btn-op-item primary"
+              size="small"
+              @click="editor.handleStartStep(editor.selectedStep.value)"
+            >
+              <el-icon><VideoPlay /></el-icon>执行此步骤
+            </el-button>
+            <el-button
+              v-if="editor.selectedStep.value.stepStatus === 'jxz'"
+              class="btn-op-item"
+              size="small"
+              type="success"
+              @click="editor.handleCompleteStep(editor.selectedStep.value)"
+            >
+              <el-icon><Check /></el-icon>完成步骤
+            </el-button>
+          </template>
           <el-button
-            v-if="editor.selectedStep.value.stepStatus === 'dzx'"
-            class="btn-op-item primary"
+            class="btn-main"
+            type="primary"
             size="small"
-            @click="editor.handleStartStep(editor.selectedStep.value)"
+            :loading="editor.manualSaveLoading.value"
+            @click="editor.handleManualSave"
           >
-            <el-icon><VideoPlay /></el-icon>开始执行
-          </el-button>
-          <el-button
-            v-if="editor.selectedStep.value.stepStatus === 'jxz'"
-            class="btn-op-item"
-            size="small"
-            type="success"
-            @click="editor.handleCompleteStep(editor.selectedStep.value)"
-          >
-            <el-icon><Check /></el-icon>完成步骤
+            <el-icon><Check /></el-icon>保存
           </el-button>
         </div>
       </div>
@@ -286,12 +297,6 @@
           </el-tab-pane>
         </el-tabs>
       </div>
-      <div class="route-config-right-footer">
-        <el-button class="btn-main" type="primary" :loading="editor.manualSaveLoading.value" @click="editor.handleManualSave">
-          <el-icon><Check /></el-icon>
-          保存
-        </el-button>
-      </div>
     </template>
     <template v-else>
       <div class="route-config-right-empty">
@@ -308,6 +313,7 @@
 
   defineProps<{
     editor: ReturnType<typeof useTaskStepEditor>
+    readonly?: boolean
   }>()
 </script>
 

+ 336 - 188
web-admin/src/views/production/production-work-order/TaskExecutionDialog.vue

@@ -1,8 +1,7 @@
-<!-- 生产任务执行弹窗 -->
 <template>
   <el-dialog
     v-model="dialogVisible"
-    :title="`任务执行 — ${taskName}`"
+    :title="readonly ? `任务详情 — ${taskName}` : `任务执行 — ${taskName}`"
     width="96vw"
     class="dialog-form-layout execution-dialog"
     align-center
@@ -19,7 +18,7 @@
         <el-tag :type="editor.taskStatusTag(editor.taskDetail.value.taskStatus).type">
           {{ editor.taskStatusTag(editor.taskDetail.value.taskStatus).label }}
         </el-tag>
-        <div class="execution-header-actions">
+        <div v-if="!readonly" class="execution-header-actions">
           <el-button
             v-if="editor.taskDetail.value.taskStatus === 'dpz'"
             class="btn-main"
@@ -43,149 +42,243 @@
       <div v-if="editor.taskDetail.value.remark" class="execution-header-remark">{{ editor.taskDetail.value.remark }}</div>
     </div>
 
-    <!-- 四栏布局:工艺库 + 任务I/O(上下叠放) + 步骤列表 + 步骤详情 -->
-    <div class="route-config-body execution-route-config-body">
-      <!-- 最左侧:任务输入/输出上下叠放 -->
-      <div class="execution-io-column">
-        <!-- 任务输入 -->
-        <div class="execution-io-block">
-          <div class="execution-io-header">
-            <h4><span class="section-bar"></span>任务输入</h4>
-            <div class="execution-io-actions">
-              <el-button class="btn-main" type="primary" size="small" @click="editor.addTaskInputRow"><el-icon><Plus /></el-icon>添加</el-button>
-              <el-button class="btn-main" type="primary" size="small" :loading="editor.inputSaving.value" @click="editor.saveTaskInputs"><el-icon><Check /></el-icon>保存</el-button>
-            </div>
+    <!-- 主体:可折叠工艺库 + 步骤列表 + 详情面板 -->
+    <div class="execution-main">
+      <!-- 可折叠工艺库侧栏(只读时隐藏) -->
+      <template v-if="!readonly">
+        <transition name="slide-lib">
+          <div v-show="editor.processLibraryExpanded.value" class="execution-lib-panel">
+          <div class="execution-lib-header">
+            <h3>工艺库</h3>
+            <el-input v-model="editor.processSearchKeyword.value" placeholder="搜索工序" clearable size="small" class="route-config-search" />
           </div>
-          <el-table :data="editor.taskInputs.value" stripe class="inner-table" max-height="200">
-            <el-table-column type="index" label="序号" width="50" align="center" :index="(i: number) => i + 1" />
-            <el-table-column label="输入类型" min-width="100" align="center">
-              <template #default="{ row }">
-                <el-select v-model="row.inputType" placeholder="选择类型" class="inner-cell-select">
-                  <el-option label="样本" value="sample" />
-                  <el-option label="细胞产品" value="cell_product" />
-                </el-select>
-              </template>
-            </el-table-column>
-            <el-table-column label="输入编码" min-width="110" align="center">
-              <template #default="{ row }">
-                <el-input v-model="row.inputCode" placeholder="输入编码" class="inner-cell-input" />
-              </template>
-            </el-table-column>
-            <el-table-column label="输入名称" min-width="110" align="center">
-              <template #default="{ row }">
-                <el-input v-model="row.inputName" placeholder="输入名称" class="inner-cell-input" />
-              </template>
-            </el-table-column>
-            <el-table-column label="操作" width="60" align="center">
-              <template #default="{ $index }">
-                <el-button link type="danger" size="small" @click="editor.removeTaskInputRow($index)">删除</el-button>
+          <el-collapse v-model="editor.expandedCategories.value" class="route-config-collapse">
+            <el-collapse-item v-for="cat in editor.filteredProcessLibrary.value" :key="cat.categoryId" :name="cat.categoryId">
+              <template #title>
+                <span class="route-config-cat-bar"></span>
+                <span>{{ cat.categoryName }}</span>
               </template>
-            </el-table-column>
-          </el-table>
-          <el-empty v-if="!editor.taskInputs.value.length" description="暂无输入项" :image-size="28" />
+              <div v-for="(proc, procIndex) in cat.processes" :key="proc.id" class="route-config-process-card" draggable="true" @dragstart="editor.onDragStart($event, proc)">
+                <div class="route-config-process-info">
+                  <div class="route-config-process-name">
+                    <span class="route-config-process-seq">{{ procIndex + 1 }}</span>{{ proc.processName }}
+                  </div>
+                  <div class="route-config-process-code">{{ proc.processCode }}</div>
+                </div>
+                <el-icon class="route-config-process-drag"><Rank /></el-icon>
+              </div>
+              <el-empty v-if="!cat.processes.length" description="该分类暂无工序" :image-size="32" />
+            </el-collapse-item>
+          </el-collapse>
+          <el-empty v-if="!editor.filteredProcessLibrary.value.length" description="暂无工艺数据" :image-size="48" />
         </div>
+      </transition>
 
-        <!-- 任务输出 -->
-        <div class="execution-io-block">
-          <div class="execution-io-header">
-            <h4><span class="section-bar"></span>任务输出</h4>
-            <div class="execution-io-actions">
-              <el-button class="btn-main" type="primary" size="small" @click="editor.addTaskOutputRow"><el-icon><Plus /></el-icon>添加</el-button>
-              <el-button class="btn-main" type="primary" size="small" :loading="editor.outputSaving.value" @click="editor.saveTaskOutputs"><el-icon><Check /></el-icon>保存</el-button>
-            </div>
-          </div>
-          <el-table :data="editor.taskOutputs.value" stripe class="inner-table" max-height="200">
-            <el-table-column type="index" label="序号" width="50" align="center" :index="(i: number) => i + 1" />
-            <el-table-column label="输出名称" min-width="100" align="center">
-              <template #default="{ row }">
-                <el-input v-model="row.outputName" placeholder="输出名称" class="inner-cell-input" />
-              </template>
-            </el-table-column>
-            <el-table-column label="输出条码" min-width="100" align="center">
-              <template #default="{ row }">
-                <el-input v-model="row.outputBarcode" placeholder="扫码或输入" class="inner-cell-input" />
-              </template>
-            </el-table-column>
-            <el-table-column label="数量" min-width="80" align="center">
-              <template #default="{ row }">
-                <el-input-number v-model="row.quantity" :min="0" :precision="2" controls-position="right" style="width: 100%" />
-              </template>
-            </el-table-column>
-            <el-table-column label="单位" min-width="70" align="center">
-              <template #default="{ row }">
-                <el-input v-model="row.unit" placeholder="单位" class="inner-cell-input" />
-              </template>
-            </el-table-column>
-            <el-table-column label="操作" width="60" align="center">
-              <template #default="{ $index }">
-                <el-button link type="danger" size="small" @click="editor.removeTaskOutputRow($index)">删除</el-button>
-              </template>
-            </el-table-column>
-          </el-table>
-          <el-empty v-if="!editor.taskOutputs.value.length" description="暂无输出项" :image-size="28" />
-        </div>
+      <!-- 工艺库折叠把手 -->
+      <div class="execution-lib-toggle" @click="editor.processLibraryExpanded.value = !editor.processLibraryExpanded.value">
+        <span>{{ editor.processLibraryExpanded.value ? '‹' : '›' }}</span>
+        <span class="execution-lib-toggle-text">工艺库</span>
       </div>
+      </template>
 
-      <!-- 工艺库 -->
-      <div class="route-config-left">
-        <div class="route-config-left-header">
-          <h3>工艺库</h3>
-          <el-input v-model="editor.processSearchKeyword.value" placeholder="搜索工序" clearable size="small" class="route-config-search" />
+      <!-- 步骤列表 -->
+      <div class="execution-step-list" v-loading="editor.stepListLoading.value" @dragover.prevent @drop="editor.onDropToCenter">
+        <div class="execution-step-list-header">
+          <h3>工序步骤</h3>
+          <span class="execution-progress-badge">{{ editor.completedStepCount.value }}/{{ editor.stepList.value.length }}</span>
         </div>
-        <el-collapse v-model="editor.expandedCategories.value" class="route-config-collapse">
-          <el-collapse-item v-for="cat in editor.filteredProcessLibrary.value" :key="cat.categoryId" :name="cat.categoryId">
-            <template #title>
-              <span class="route-config-cat-bar"></span>
-              <span>{{ cat.categoryName }}</span>
-            </template>
-            <div v-for="(proc, procIndex) in cat.processes" :key="proc.id" class="route-config-process-card" draggable="true" @dragstart="editor.onDragStart($event, proc)">
-              <div class="route-config-process-info">
-                <div class="route-config-process-name">
-                  <span class="route-config-process-seq">{{ procIndex + 1 }}</span>{{ proc.processName }}
-                </div>
-                <div class="route-config-process-code">{{ proc.processCode }}</div>
-              </div>
-              <el-icon class="route-config-process-drag"><Rank /></el-icon>
+        <div class="execution-step-list-body">
+          <!-- 虚拟步骤:任务输入 -->
+          <div
+            class="virtual-step-card"
+            :class="{ 'is-active': editor.selectedVirtualStep.value === 'input' }"
+            @click="editor.selectVirtualStep('input')"
+          >
+            <div class="virtual-step-icon virtual-step-icon--input">📥</div>
+            <div class="virtual-step-info">
+              <div class="virtual-step-name">任务输入</div>
             </div>
-            <el-empty v-if="!cat.processes.length" description="该分类暂无工序" :image-size="32" />
-          </el-collapse-item>
-        </el-collapse>
-        <el-empty v-if="!editor.filteredProcessLibrary.value.length" description="暂无工艺数据" :image-size="48" />
-      </div>
+            <el-tag v-if="editor.virtualInputStatus.value === 'filled'" type="success" size="small">已填写 {{ editor.taskInputs.value.length }} 项</el-tag>
+            <el-tag v-else type="danger" size="small">未填写</el-tag>
+          </div>
 
-      <!-- 中间:步骤列表 -->
-      <div class="route-config-center" v-loading="editor.stepListLoading.value" @dragover.prevent @drop="editor.onDropToCenter">
-        <div class="route-config-center-header">
-          <h3>工序步骤</h3>
-          <span class="route-config-step-count">共 {{ editor.stepList.value.length }} 步</span>
-        </div>
-        <div class="route-config-center-dropzone">
-          <draggable v-model="editor.stepList.value" handle=".route-config-step-handle" :animation="200" @end="editor.onStepDragEnd">
-            <div v-for="(element, index) in editor.stepList.value" :key="element.id" class="route-config-step-card" :class="{ 'is-active': editor.selectedStepId.value === element.id }" @click="editor.selectStep(element)">
-              <div class="route-config-step-handle"><el-icon><Rank /></el-icon></div>
-              <div class="route-config-step-order">{{ index + 1 }}</div>
+          <!-- 虚拟步骤:任务输出 -->
+          <div
+            class="virtual-step-card"
+            :class="{ 'is-active': editor.selectedVirtualStep.value === 'output' }"
+            @click="editor.selectVirtualStep('output')"
+          >
+            <div class="virtual-step-icon virtual-step-icon--output">📤</div>
+            <div class="virtual-step-info">
+              <div class="virtual-step-name">任务输出</div>
+            </div>
+            <el-tag v-if="editor.virtualOutputStatus.value === 'filled'" type="success" size="small">已填写 {{ editor.taskOutputs.value.length }} 项</el-tag>
+            <el-tag v-else type="danger" size="small">未填写</el-tag>
+          </div>
+
+          <!-- 分割线 -->
+          <div class="step-divider"><span>工艺步骤</span></div>
+
+          <!-- 真实步骤列表 -->
+          <draggable v-model="editor.stepList.value" :handle="readonly ? undefined : '.route-config-step-handle'" :animation="200" @end="editor.onStepDragEnd">
+            <div
+              v-for="(element, index) in editor.stepList.value"
+              :key="element.id"
+              class="route-config-step-card"
+              :class="{
+                'is-active': editor.selectedStepId.value === element.id,
+                'is-done': element.stepStatus === 'ywc'
+              }"
+              @click="editor.selectStep(element)"
+            >
+              <div v-if="!readonly" class="route-config-step-handle"><el-icon><Rank /></el-icon></div>
+              <div class="route-config-step-order" :class="stepSeqClass(element.stepStatus)">{{ element.stepStatus === 'ywc' ? '✓' : index + 1 }}</div>
               <div class="route-config-step-info">
                 <div class="route-config-step-name">{{ element.processName || '未命名步骤' }}</div>
                 <div class="route-config-step-desc">{{ element.description || '' }}</div>
               </div>
               <el-tag v-if="element.stepStatus" :type="editor.stepStatusTag(element.stepStatus).type" size="small" style="margin-right:4px">{{ editor.stepStatusTag(element.stepStatus).label }}</el-tag>
-              <el-button link type="primary" size="small" title="复制步骤" @click.stop="editor.handleCopyStep(element)">
-                <el-icon><CopyDocument /></el-icon>
-              </el-button>
-              <el-button link type="danger" size="small" @click.stop="editor.handleDeleteStep(element)">
-                <el-icon><Delete /></el-icon>
-              </el-button>
+              <template v-if="!readonly">
+                <el-button link type="primary" size="small" title="复制步骤" @click.stop="editor.handleCopyStep(element)">
+                  <el-icon><CopyDocument /></el-icon>
+                </el-button>
+                <el-button link type="danger" size="small" @click.stop="editor.handleDeleteStep(element)">
+                  <el-icon><Delete /></el-icon>
+                </el-button>
+              </template>
             </div>
           </draggable>
-          <div v-if="!editor.stepList.value.length" class="route-config-center-empty">
+
+          <div v-if="!editor.stepList.value.length" class="execution-step-list-empty">
             <el-icon :size="32" color="#a7f3d0"><Plus /></el-icon>
             <p>从左侧拖拽工序到此处,添加任务步骤</p>
           </div>
         </div>
       </div>
 
-      <!-- 右侧:步骤详情 -->
-      <StepDetailPanel :editor="editor" />
+      <!-- 右侧详情面板 -->
+      <div class="execution-detail-panel">
+        <!-- 任务输入详情 -->
+        <template v-if="editor.selectedVirtualStep.value === 'input'">
+          <div class="execution-detail-header">
+            <h3>📥 任务输入</h3>
+            <div v-if="!readonly" class="execution-detail-actions">
+              <el-button class="btn-main" type="primary" size="small" @click="editor.addTaskInputRow"><el-icon><Plus /></el-icon>添加输入</el-button>
+              <el-button class="btn-main" type="primary" size="small" :loading="editor.inputSaving.value" @click="editor.saveTaskInputs"><el-icon><Check /></el-icon>保存</el-button>
+            </div>
+          </div>
+          <div class="execution-detail-body">
+            <el-table :data="editor.taskInputs.value" stripe class="inner-table">
+              <el-table-column type="index" label="序号" width="56" align="center" :index="(i: number) => i + 1" />
+              <el-table-column label="输入类型" min-width="120" align="center">
+                <template #default="{ row }">
+                  <span v-if="readonly">{{ row.inputType === 'sample' ? '样本' : row.inputType === 'cell_product' ? '细胞产品' : row.inputType }}</span>
+                  <el-select v-else v-model="row.inputType" placeholder="选择类型" class="inner-cell-select" @change="() => { row.inputId = ''; row.inputCode = ''; row.inputName = '' }">
+                    <el-option label="样本" value="sample" />
+                    <el-option label="细胞产品" value="cell_product" />
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column label="输入编码" min-width="150" align="center">
+                <template #default="{ row }">
+                  <template v-if="row.inputType === 'cell_product'">
+                    <el-select
+                      v-if="!readonly"
+                      v-model="row.inputId"
+                      placeholder="选择细胞产品"
+                      filterable
+                      class="inner-cell-select"
+                      :loading="editor.cellProductOptionsLoading.value"
+                      @change="(val: string) => editor.onCellProductInputSelect(row, val)"
+                    >
+                      <el-option v-for="opt in editor.cellProductOptions.value" :key="opt.id" :label="opt.label" :value="opt.id" />
+                    </el-select>
+                    <span v-else>{{ row.inputCode || '—' }}</span>
+                  </template>
+                  <template v-else>
+                    <span>{{ row.inputCode || '—' }}</span>
+                  </template>
+                </template>
+              </el-table-column>
+              <el-table-column label="输入名称" min-width="150" align="center">
+                <template #default="{ row }">
+                  <span v-if="readonly">{{ row.inputName || '—' }}</span>
+                  <el-input v-else v-model="row.inputName" placeholder="输入名称" class="inner-cell-input" />
+                </template>
+              </el-table-column>
+              <el-table-column label="备注" min-width="120" align="center">
+                <template #default="{ row }">
+                  <span v-if="readonly">{{ row.remark || '—' }}</span>
+                  <el-input v-else v-model="row.remark" placeholder="备注" class="inner-cell-input" />
+                </template>
+              </el-table-column>
+              <el-table-column v-if="!readonly" label="操作" width="80" align="center">
+                <template #default="{ $index }">
+                  <el-button link type="danger" size="small" @click="editor.removeTaskInputRow($index)">删除</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+            <el-empty v-if="!editor.taskInputs.value.length" description="暂无输入项" :image-size="48" />
+          </div>
+        </template>
+
+        <!-- 任务输出详情 -->
+        <template v-else-if="editor.selectedVirtualStep.value === 'output'">
+          <div class="execution-detail-header">
+            <h3>📤 任务输出</h3>
+            <div v-if="!readonly" class="execution-detail-actions">
+              <el-button class="btn-main" type="primary" size="small" @click="editor.addTaskOutputRow"><el-icon><Plus /></el-icon>添加输出</el-button>
+              <el-button class="btn-main" type="primary" size="small" :loading="editor.outputSaving.value" @click="editor.saveTaskOutputs"><el-icon><Check /></el-icon>保存</el-button>
+            </div>
+          </div>
+          <div class="execution-detail-body">
+            <el-table :data="editor.taskOutputs.value" stripe class="inner-table">
+              <el-table-column type="index" label="序号" width="56" align="center" :index="(i: number) => i + 1" />
+              <el-table-column label="输出名称" min-width="140" align="center">
+                <template #default="{ row }">
+                  <span v-if="readonly">{{ row.outputName || '—' }}</span>
+                  <el-input v-else v-model="row.outputName" placeholder="输出名称" class="inner-cell-input" />
+                </template>
+              </el-table-column>
+              <el-table-column label="输出条码" min-width="140" align="center">
+                <template #default="{ row }">
+                  <span v-if="readonly">{{ row.outputBarcode || '—' }}</span>
+                  <el-input v-else v-model="row.outputBarcode" placeholder="扫码或输入" class="inner-cell-input" />
+                </template>
+              </el-table-column>
+              <el-table-column label="数量" min-width="100" align="center">
+                <template #default="{ row }">
+                  <span v-if="readonly">{{ row.quantity ?? '—' }}</span>
+                  <el-input-number v-else v-model="row.quantity" :min="0" :precision="2" controls-position="right" style="width: 100%" />
+                </template>
+              </el-table-column>
+              <el-table-column label="单位" min-width="80" align="center">
+                <template #default="{ row }">
+                  <span v-if="readonly">{{ row.unit || '—' }}</span>
+                  <el-input v-else v-model="row.unit" placeholder="单位" class="inner-cell-input" />
+                </template>
+              </el-table-column>
+              <el-table-column label="备注" min-width="120" align="center">
+                <template #default="{ row }">
+                  <span v-if="readonly">{{ row.remark || '—' }}</span>
+                  <el-input v-else v-model="row.remark" placeholder="备注" class="inner-cell-input" />
+                </template>
+              </el-table-column>
+              <el-table-column v-if="!readonly" label="操作" width="80" align="center">
+                <template #default="{ $index }">
+                  <el-button link type="danger" size="small" @click="editor.removeTaskOutputRow($index)">删除</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+            <el-empty v-if="!editor.taskOutputs.value.length" description="暂无输出项" :image-size="48" />
+          </div>
+        </template>
+
+        <!-- 步骤详情 -->
+        <template v-else>
+          <StepDetailPanel :editor="editor" :readonly="readonly" />
+        </template>
+      </div>
     </div>
   </el-dialog>
 </template>
@@ -200,6 +293,7 @@
     visible: boolean
     taskId: string
     taskName: string
+    readonly?: boolean
   }>()
 
   const emit = defineEmits<{
@@ -219,6 +313,12 @@
     emit('success')
   }
 
+  function stepSeqClass(status: string) {
+    if (status === 'ywc') return 'seq-done'
+    if (status === 'jxz') return 'seq-running'
+    return 'seq-pending'
+  }
+
   watch(() => props.visible, async (val) => {
     if (val && props.taskId) {
       await editor.initEditor(props.taskId, { mode: 'execution' })
@@ -236,11 +336,11 @@
     :deep(.el-dialog__body) {
       max-height: calc(96vh - 54px);
       overflow-y: auto;
-      padding: 12px 16px;
+      padding: 10px 14px;
     }
   }
 
-  /* 顶部信息一行展示,极致压缩 */
+  /* 顶部信息 */
   .execution-header {
     padding: 6px 16px;
     background: #f0fdf4;
@@ -248,88 +348,136 @@
     margin-bottom: 8px;
     border: 1px solid #d1fae5;
   }
-
   .execution-header-row {
-    display: flex;
-    align-items: center;
-    gap: 16px;
-    font-size: 13px;
-    color: #475569;
-
+    display: flex; align-items: center; gap: 16px;
+    font-size: 13px; color: #475569;
     b { color: #1e293b; }
   }
+  .execution-header-item { white-space: nowrap; }
+  .execution-header-actions { display: flex; gap: 8px; margin-left: auto; }
+  .execution-header-remark { margin-top: 4px; font-size: 12px; color: #64748b; }
 
-  .execution-header-item {
-    white-space: nowrap;
+  /* 主体三区域 */
+  .execution-main {
+    display: flex; gap: 0;
+    height: calc(96vh - 110px);
+    min-height: 400px;
   }
 
-  .execution-header-actions {
-    display: flex;
-    gap: 8px;
-    margin-left: auto;
+  /* 工艺库折叠侧栏 */
+  .execution-lib-panel {
+    width: 260px; flex-shrink: 0;
+    display: flex; flex-direction: column;
+    border: 1px solid #e5e7eb; border-radius: 8px;
+    overflow: hidden;
   }
-
-  .execution-header-remark {
-    margin-top: 4px;
-    font-size: 12px;
-    color: #64748b;
+  .execution-lib-header {
+    padding: 10px 12px; border-bottom: 1px solid #e5e7eb; flex-shrink: 0;
+    h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: #1f2937; }
   }
 
-  /* 工艺库右侧 I/O 列 */
-  .execution-io-column {
-    width: 320px;
-    flex-shrink: 0;
-    display: flex;
-    flex-direction: column;
-    gap: 8px;
+  .slide-lib-enter-active, .slide-lib-leave-active {
+    transition: width 0.2s ease, opacity 0.2s ease;
     overflow: hidden;
   }
+  .slide-lib-enter-from, .slide-lib-leave-to {
+    width: 0 !important; opacity: 0;
+  }
 
-  .execution-io-block {
-    flex: 1;
-    display: flex;
-    flex-direction: column;
-    border: 1px solid #e5e7eb;
-    border-radius: 8px;
-    padding: 8px;
-    overflow: hidden;
-    min-height: 0;
+  /* 工艺库折叠把手 */
+  .execution-lib-toggle {
+    width: 24px; flex-shrink: 0;
+    display: flex; flex-direction: column;
+    align-items: center; justify-content: center;
+    gap: 4px; cursor: pointer;
+    background: #f9fafb; border-left: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;
+    transition: background 0.15s;
+    font-size: 14px; color: #9ca3af;
+    &:hover { background: #ecfdf5; color: #10b981; }
+  }
+  .execution-lib-toggle-text {
+    writing-mode: vertical-lr; font-size: 11px; letter-spacing: 2px;
   }
 
-  .execution-io-header {
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-    margin-bottom: 6px;
-    flex-shrink: 0;
+  /* 步骤列表 */
+  .execution-step-list {
+    width: 340px; flex-shrink: 0;
+    display: flex; flex-direction: column;
+    border: 1px solid #e5e7eb; border-radius: 8px;
+    overflow: hidden; margin: 0 8px;
+  }
+  .execution-step-list-header {
+    padding: 10px 14px; border-bottom: 1px solid #e5e7eb;
+    display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
+    h3 { margin: 0; font-size: 14px; font-weight: 600; color: #1f2937; }
+  }
+  .execution-progress-badge {
+    font-size: 12px; color: #6b7280; background: #f3f4f6;
+    padding: 2px 10px; border-radius: 10px;
+  }
+  .execution-step-list-body {
+    flex: 1; overflow-y: auto; padding: 8px;
+  }
+  .execution-step-list-empty {
+    display: flex; flex-direction: column;
+    align-items: center; justify-content: center;
+    padding: 40px 0; color: #9ca3af;
+    p { margin-top: 8px; font-size: 13px; }
+  }
 
-    h4 {
-      margin: 0;
-      font-size: 13px;
-      font-weight: 600;
-      color: #1e293b;
-      display: flex;
-      align-items: center;
-      gap: 0;
-    }
+  /* 虚拟步骤卡片 */
+  .virtual-step-card {
+    display: flex; align-items: center; gap: 10px;
+    padding: 10px 12px; margin-bottom: 4px;
+    border-radius: 8px; cursor: pointer;
+    border: 2px solid #bfdbfe; background: #eff6ff;
+    transition: all 0.15s;
+    &:hover { border-color: #93c5fd; background: #dbeafe; }
+    &.is-active { border-color: #3b82f6; background: #dbeafe; box-shadow: 0 0 0 1px #3b82f6; }
+  }
+  .virtual-step-icon {
+    width: 28px; height: 28px; border-radius: 6px;
+    display: flex; align-items: center; justify-content: center;
+    font-size: 14px; flex-shrink: 0;
+    &--input { background: #dbeafe; }
+    &--output { background: #fef3c7; }
   }
+  .virtual-step-info { flex: 1; min-width: 0; }
+  .virtual-step-name { font-size: 13px; font-weight: 500; color: #1e293b; }
 
-  .execution-io-actions {
-    display: flex;
-    gap: 4px;
+  /* 分割线 */
+  .step-divider {
+    display: flex; align-items: center; gap: 8px;
+    margin: 8px 0; padding: 0 4px;
+    color: #9ca3af; font-size: 11px;
+    &::before, &::after { content: ''; flex: 1; height: 1px; background: #e5e7eb; }
   }
 
-  .section-bar {
-    display: inline-block;
-    width: 3px;
-    height: 14px;
-    background: #10b981;
-    border-radius: 2px;
-    margin-right: 8px;
+  /* 步骤序号状态 */
+  .seq-done { background: #d1fae5 !important; color: #059669 !important; }
+  .seq-running { background: #10b981 !important; color: #fff !important; }
+  .seq-pending { background: #f3f4f6 !important; color: #6b7280 !important; }
+  .route-config-step-card.is-done { opacity: 0.6; }
+
+  /* 右侧详情面板 */
+  .execution-detail-panel {
+    flex: 1; min-width: 0;
+    display: flex; flex-direction: column;
+    border: 1px solid #e5e7eb; border-radius: 8px;
+    overflow: hidden;
+  }
+  .execution-detail-header {
+    padding: 10px 16px; border-bottom: 1px solid #e5e7eb;
+    display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
+    h3 { margin: 0; font-size: 14px; font-weight: 600; color: #1e293b; }
+  }
+  .execution-detail-actions { display: flex; gap: 8px; }
+  .execution-detail-body {
+    flex: 1; overflow-y: auto; padding: 16px;
   }
 
-  .execution-route-config-body {
-    height: calc(96vh - 110px);
-    min-height: 400px;
+  .section-bar {
+    display: inline-block; width: 3px; height: 14px;
+    background: #10b981; border-radius: 2px; margin-right: 8px;
   }
 </style>

+ 87 - 13
web-admin/src/views/production/production-work-order/useTaskStepEditor.ts

@@ -22,6 +22,7 @@ import {
   fetchConsumableList
 } from '@/api/production'
 import { fetchItemUnitList } from '@/api/admin'
+import { fetchCellProductList } from '@/api/cell-product'
 
 // ── helpers ──────────────────────────────────────────────────────────
 function toApiFlag(val: boolean | number | string | undefined): string {
@@ -69,6 +70,8 @@ export function useTaskStepEditor() {
   const taskOutputs = ref<Record<string, any>[]>([])
   const inputSaving = ref(false)
   const outputSaving = ref(false)
+  const selectedVirtualStep = ref<'input' | 'output' | null>(null)
+  const processLibraryExpanded = ref(false)
 
   const processLibrary = ref<Record<string, any>[]>([])
   const expandedCategories = ref<string[]>([])
@@ -87,6 +90,10 @@ export function useTaskStepEditor() {
   const consumableOptionsLoading = ref(false)
   const consumableMasterById = ref<Record<string, Record<string, any>>>({})
 
+  const cellProductOptions = ref<{ id: string; label: string }[]>([])
+  const cellProductOptionsLoading = ref(false)
+  const cellProductMasterById = ref<Record<string, Record<string, any>>>({})
+
   function mapItemUnitOption(u: { unitName?: string; unitCode?: string }) {
     const name = (u.unitName || '').trim()
     const code = (u.unitCode || '').trim()
@@ -287,6 +294,43 @@ export function useTaskStepEditor() {
     ensureItemUnitOption(row.unit)
     ensureConsumableOption(row)
   }
+
+  function mapCellProductOptionLabel(p: { productName?: string; productCode?: string }) {
+    const name = (p.productName || '').trim()
+    const code = (p.productCode || '').trim()
+    return code ? `${name}(${code})` : name
+  }
+  async function searchCellProductOptions(query: string) {
+    cellProductOptionsLoading.value = true
+    try {
+      const res = await fetchCellProductList({ page: 1, pageSize: 100, keyword: query?.trim() || undefined })
+      const list = res.list || []
+      const next = { ...cellProductMasterById.value }
+      for (const p of list) if (p?.id) next[p.id] = p
+      cellProductMasterById.value = next
+      cellProductOptions.value = list
+        .filter((p) => (p.productName || '').trim() || (p.productCode || '').trim())
+        .map((p) => ({ id: p.id, label: mapCellProductOptionLabel(p) }))
+      for (const row of taskInputs.value) {
+        if (row.inputType === 'cell_product' && row.inputId && !cellProductOptions.value.some((o) => o.id === row.inputId)) {
+          cellProductOptions.value = [{ id: row.inputId, label: row.inputName || row.inputCode || '' }, ...cellProductOptions.value]
+        }
+      }
+    } catch {
+      cellProductOptions.value = []
+    } finally {
+      cellProductOptionsLoading.value = false
+    }
+  }
+  function onCellProductInputSelect(row: Record<string, any>, productId: string) {
+    if (!productId) { row.inputId = ''; return }
+    const master = cellProductMasterById.value[productId]
+    if (!master) return
+    row.inputId = master.id
+    row.inputCode = master.productCode || ''
+    if (!row.inputName) row.inputName = master.productName || ''
+  }
+
   function ensureAllStepUnitOptions() {
     for (const step of stepList.value) {
       ;(step.reagents || []).forEach((r: Record<string, any>) => ensureItemUnitOption(r.unit))
@@ -299,6 +343,9 @@ export function useTaskStepEditor() {
     if (!selectedStepId.value) return null
     return stepList.value.find((s) => s.id === selectedStepId.value) || null
   })
+  const virtualInputStatus = computed(() => taskInputs.value.length > 0 ? 'filled' : 'empty')
+  const virtualOutputStatus = computed(() => taskOutputs.value.length > 0 ? 'filled' : 'empty')
+  const completedStepCount = computed(() => stepList.value.filter((s) => s.stepStatus === 'ywc').length)
   const sopIdsArr = computed({
     get() {
       if (!selectedStep.value) return []
@@ -350,7 +397,7 @@ export function useTaskStepEditor() {
     })
     expandedCategories.value = Object.keys(catMap)
     processLibrary.value = Object.values(catMap)
-    await Promise.all([searchItemUnitOptions(''), searchReagentOptions(''), searchConsumableOptions('')])
+    await Promise.all([searchItemUnitOptions(''), searchReagentOptions(''), searchConsumableOptions(''), searchCellProductOptions('')])
   }
   async function loadTaskDetail(overrideId?: string) {
     const id = overrideId || taskId.value
@@ -361,12 +408,19 @@ export function useTaskStepEditor() {
       ensureAllStepReagentOptions()
       ensureAllStepConsumableOptions()
       ensureAllStepUnitOptions()
-      if (stepList.value.length > 0 && !selectedStepId.value)
-        selectedStepId.value = stepList.value[0].id
+      if (stepList.value.length > 0 && !selectedStepId.value) {
+        const firstPending = stepList.value.find((s) => s.stepStatus !== 'ywc')
+        selectedStepId.value = firstPending ? firstPending.id : stepList.value[0].id
+      }
       if (mode.value === 'execution') {
         taskDetail.value = detail
         taskInputs.value = (detail.inputs || []).map((i: Record<string, any>) => ({ ...i }))
         taskOutputs.value = (detail.outputs || []).map((o: Record<string, any>) => ({ ...o }))
+        for (const row of taskInputs.value) {
+          if (row.inputType === 'cell_product' && row.inputId && !cellProductOptions.value.some((o) => o.id === row.inputId)) {
+            cellProductOptions.value = [{ id: row.inputId, label: row.inputName || row.inputCode || '' }, ...cellProductOptions.value]
+          }
+        }
       }
     } catch {
       stepList.value = []
@@ -400,7 +454,14 @@ export function useTaskStepEditor() {
       stepListLoading.value = false
     }
   }
-  function selectStep(step: Record<string, any>) { selectedStepId.value = step.id }
+  function selectStep(step: Record<string, any>) {
+    selectedStepId.value = step.id
+    selectedVirtualStep.value = null
+  }
+  function selectVirtualStep(type: 'input' | 'output') {
+    selectedVirtualStep.value = type
+    selectedStepId.value = ''
+  }
   async function handleCopyStep(step: Record<string, any>) {
     stepListLoading.value = true
     try {
@@ -458,7 +519,8 @@ export function useTaskStepEditor() {
     try {
       const items = (selectedStep.value.reagents || []).map((r: Record<string, any>) => ({
         material_code: r.reagentCode, material_name: r.reagentName, spec: r.spec,
-        standard_usage: r.standardUsage, unit: r.unit,
+        standard_usage: r.standardUsage, actual_usage: r.actualUsage || '',
+        unit: r.unit,
         is_key_material: toApiFlag(r.isKeyMaterial), remark: r.remark || ''
       }))
       await fetchReplaceStepReagents(taskId.value, selectedStep.value.id, items)
@@ -480,7 +542,8 @@ export function useTaskStepEditor() {
       const items = (selectedStep.value.consumables || []).map((c: Record<string, any>) => ({
         material_code: c.consumableCode, material_name: c.consumableName,
         spec_model: c.specModel,
-        standard_usage: c.standardUsage, unit: c.unit,
+        standard_usage: c.standardUsage, actual_usage: c.actualUsage || '',
+        unit: c.unit,
         is_required: toApiFlag(c.isRequired), remark: c.remark || ''
       }))
       await fetchReplaceStepConsumables(taskId.value, selectedStep.value.id, items)
@@ -515,7 +578,7 @@ export function useTaskStepEditor() {
     try {
       const items = (selectedStep.value.dataCollections || []).map((d: Record<string, any>) => ({
         collection_name: d.collectionName, unit: d.unit,
-        collection_value: '', remark: d.remark || ''
+        collection_value: d.collectionValue || '', remark: d.remark || ''
       }))
       await fetchReplaceStepDataCollection(taskId.value, selectedStep.value.id, items)
     } catch { /* ignore */ }
@@ -573,14 +636,22 @@ export function useTaskStepEditor() {
   }
 
   function addTaskInputRow() {
-    taskInputs.value.push({ inputType: 'sample', inputCode: '', inputName: '' })
+    const isCellStorage = taskDetail.value?.taskType === 'cell_storage'
+    const sampleCode = taskDetail.value?.sampleCode || ''
+    taskInputs.value.push({
+      inputType: isCellStorage ? 'sample' : 'sample',
+      inputId: '',
+      inputCode: isCellStorage ? sampleCode : '',
+      inputName: '',
+      remark: ''
+    })
   }
   function removeTaskInputRow(i: number) { taskInputs.value.splice(i, 1) }
   async function saveTaskInputs() {
     if (!taskDetail.value?.id) return
     inputSaving.value = true
     try {
-      await fetchSetTaskInputs(taskDetail.value.id, { items: taskInputs.value })
+      await fetchSetTaskInputs(taskDetail.value.id, taskInputs.value)
       ElMessage.success('输入已保存')
     } catch { /* global error handling */ } finally { inputSaving.value = false }
   }
@@ -593,7 +664,7 @@ export function useTaskStepEditor() {
     if (!taskDetail.value?.id) return
     outputSaving.value = true
     try {
-      await fetchSetTaskOutputs(taskDetail.value.id, { items: taskOutputs.value })
+      await fetchSetTaskOutputs(taskDetail.value.id, taskOutputs.value)
       ElMessage.success('输出已保存')
     } catch { /* global error handling */ } finally { outputSaving.value = false }
   }
@@ -635,13 +706,16 @@ export function useTaskStepEditor() {
     taskId, stepList, selectedStepId, selectedStep, stepListLoading,
     activeSubTab, processSearchKeyword, configSuppressSave,
     mode, taskDetail, taskInputs, taskOutputs, inputSaving, outputSaving,
+    selectedVirtualStep, processLibraryExpanded,
+    virtualInputStatus, virtualOutputStatus, completedStepCount,
     processLibrary, filteredProcessLibrary, expandedCategories,
     categoryOptions, sopOptions, outputTypeOptions,
     itemUnitOptions, itemUnitOptionsLoading,
     reagentOptions, reagentOptionsLoading,
     consumableOptions, consumableOptionsLoading,
+    cellProductOptions, cellProductOptionsLoading,
     sopIdsArr,
-    onDragStart, onDropToCenter, onStepDragEnd, selectStep,
+    onDragStart, onDropToCenter, onStepDragEnd, selectStep, selectVirtualStep,
     handleCopyStep, handleDeleteStep,
     handleStartStep, handleCompleteStep,
     handleStartTask, handleCompleteTask,
@@ -649,8 +723,8 @@ export function useTaskStepEditor() {
     addTaskOutputRow, removeTaskOutputRow, saveTaskOutputs,
     taskStatusTag, stepStatusTag,
     saveStepBasic, onSopIdsChange,
-    searchItemUnitOptions, searchReagentOptions, searchConsumableOptions,
-    onReagentRowSelect, onConsumableRowSelect,
+    searchItemUnitOptions, searchReagentOptions, searchConsumableOptions, searchCellProductOptions,
+    onReagentRowSelect, onConsumableRowSelect, onCellProductInputSelect,
     addReagentRow, removeReagentRow, saveReagents,
     addConsumableRow, removeConsumableRow, saveConsumables,
     addOutputRow, removeOutputRow, saveOutputs,

部分文件因文件數量過多而無法顯示