抽屉化物资与启动授权流程

1、将药物发货新建和编辑从独立页面迁移到抽屉,详情页支持权限控制和停用中心只读状态。

2、补充药物发货状态字段校验,统一 PENDING、IN_TRANSIT、SIGNED、EXCEPTION 状态及演示数据。

3、为物资设备增加详情页和编辑抽屉,复用通用附件上传并按项目权限控制操作入口。

4、将启动会和培训授权编辑迁移到抽屉,详情页按中心过滤培训记录并移除旧独立编辑路由。
This commit is contained in:
Cheng Zhou
2026-06-04 11:08:43 +08:00
parent 720c98765f
commit 6a2e43f829
31 changed files with 3773 additions and 1009 deletions
+20 -1
View File
@@ -8,7 +8,12 @@ from app.crud import audit as audit_crud
from app.crud import drug_shipment as shipment_crud
from app.crud import site as site_crud
from app.crud import study as study_crud
from app.schemas.drug_shipment import DrugShipmentCreate, DrugShipmentRead, DrugShipmentUpdate
from app.schemas.drug_shipment import (
DrugShipmentCreate,
DrugShipmentRead,
DrugShipmentUpdate,
validate_drug_shipment_required_fields,
)
router = APIRouter()
@@ -143,6 +148,20 @@ async def update_shipment(
shipment_in = shipment_in.model_copy(update={"site_name": site.name})
else:
await _ensure_center_active(db, study_id, shipment.center_id)
update_data = shipment_in.model_dump(exclude_unset=True)
try:
validate_drug_shipment_required_fields(
update_data.get("status", shipment.status),
update_data.get("ship_date", shipment.ship_date),
update_data.get("receive_date", shipment.receive_date),
update_data.get("quantity", shipment.quantity),
update_data.get("batch_no", shipment.batch_no),
update_data.get("carrier", shipment.carrier),
update_data.get("tracking_no", shipment.tracking_no),
update_data.get("remark", shipment.remark),
)
except ValueError as exc:
raise HTTPException(status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, detail=str(exc)) from exc
shipment = await shipment_crud.update_shipment(db, shipment, shipment_in)
await audit_crud.log_action(
db,