feat(production): 临床科研出库细胞改由生产确认

市场出库交接对 basic_experiment 保留细胞只读并不改库存;生产工单新增确认出库细胞 API/弹窗,从细胞产品库勾选并联动已售状态。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-11-20 17:03:45 +08:00
1 parent 4de69c37ff
commit f3672d3cc2
11 files changed
+713 -55

No files matched your search

+52
View File
@@ -49,7 +49,9 @@ from app.schemas.production_work_order import (
ProductionWorkOrderCreate,
ProductionWorkOrderConfigureBody,
ProductionWorkOrderUpdate,
ProductionDeliveryCellOutboundBody,
)
from app.crud import outbound_handover as outbound_handover_svc
from app.schemas.production_task_set import (
ProductionTaskSetCreateBody,
ProductionTaskSetFromWorkOrderBody,
@@ -2025,6 +2027,56 @@ async def list_production_work_order_cell_product_options(
return error_response(400, str(e))
@router.get("/production-work-orders/{wo_id}/delivery-cell-outbound")
async def get_production_delivery_cell_outbound_api(
wo_id: str,
user: dict = Depends(require_admin_or_super_admin),
db: Session = Depends(get_db),
):
"""临床科研出库工单 — 获取已确认的交付出库细胞。"""
try:
tenant_no = _get_tenant_no(db, user)
data = outbound_handover_svc.get_production_delivery_cell_outbound(
db, wo_id, tenant_no
)
return success_response(data)
except HTTPException as e:
return error_response(e.status_code, e.detail)
except ValueError as e:
return error_response(400, str(e))
@router.put("/production-work-orders/{wo_id}/delivery-cell-outbound")
async def save_production_delivery_cell_outbound_api(
wo_id: str,
body: ProductionDeliveryCellOutboundBody,
user: dict = Depends(require_admin_or_super_admin),
db: Session = Depends(get_db),
):
"""临床科研出库工单 — 确认出库细胞(写台账并联动库存)。"""
try:
tenant_no = _get_tenant_no(db, user)
data = outbound_handover_svc.save_production_delivery_cell_outbound(
db,
wo_id,
cells=body.cells or [],
tenant_no=tenant_no,
user_id=user.get("user_id") or "",
create_dept_id=user.get("dept_id") or "",
)
db.commit()
return success_response(data, message="出库细胞已确认")
except HTTPException as e:
db.rollback()
return error_response(e.status_code, e.detail)
except ValueError as e:
db.rollback()
return error_response(400, str(e))
except Exception as e:
db.rollback()
return error_response(400, str(e))
@router.get("/production-work-orders/{wo_id}/qc-info")
async def get_production_work_order_qc_info_api(
wo_id: str,