This commit is contained in:
zlwu committed 2026-06-16 07:38:27 +08:00
1 parent a1c2511eb7
commit eaf7d490ec
382 files changed
+44146 -34245

No files matched your search

+20 -20
View File
@@ -262,6 +262,26 @@ async def list_received_samples(
return error_response(400, str(e))
@router.get("/sample-receptions/by-sample-code")
async def get_sample_reception_by_sample_code(
sampleCode: str = Query(..., alias="sampleCode"),
sourceType: Optional[str] = Query(None, alias="sourceType"),
db: Session = Depends(get_db),
user: dict = Depends(require_any_menu_code(*SAMPLE_RECEPTION_READ_MENU_CODES)),
):
"""根据样本编码查询样本接收记录:有则返回 receptionId + sampleInfo;无则仅返回 sampleInfo(用于新建)。"""
try:
tenant_no = _get_tenant_no(db, user)
result = sr_svc.get_reception_by_sample_code(
db, sample_code=sampleCode, source_type=sourceType, tenant_no=tenant_no
)
return success_response(result)
except PermissionError as e:
return error_response(403, str(e))
except Exception as e:
return error_response(400, str(e))
@router.get("/sample-receptions/{reception_id}")
async def get_sample_reception_detail(
reception_id: str,
@@ -444,23 +464,3 @@ async def put_sample_reception(
return error_response(400, str(e))
except Exception as e:
return error_response(400, str(e))
@router.get("/sample-receptions/by-sample-code")
async def get_sample_reception_by_sample_code(
sampleCode: str = Query(..., alias="sampleCode"),
sourceType: Optional[str] = Query(None, alias="sourceType"),
db: Session = Depends(get_db),
user: dict = Depends(require_any_menu_code(*SAMPLE_RECEPTION_READ_MENU_CODES)),
):
"""根据样本编码查询样本接收记录:有则返回 receptionId + sampleInfo;无则仅返回 sampleInfo(用于新建)。"""
try:
tenant_no = _get_tenant_no(db, user)
result = sr_svc.get_reception_by_sample_code(
db, sample_code=sampleCode, source_type=sourceType, tenant_no=tenant_no
)
return success_response(result)
except PermissionError as e:
return error_response(403, str(e))
except Exception as e:
return error_response(400, str(e))