提交
This commit is contained in:
1 parent
c137b46939
commit
b6c63591ea
126 files changed
+41593
-22990
No files matched your search
@@ -12,6 +12,7 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from app.core.utils import generate_uuid, parse_datetime
|
||||
from app.crud.base import camel_to_snake
|
||||
from app.crud.biz_no_generator import allocate_next_biz_no
|
||||
from app.crud.protocol_donation_convert import (
|
||||
assert_biz_no_available,
|
||||
get_partner_sample_codes,
|
||||
@@ -1879,6 +1880,10 @@ def create_collection_protocol(
|
||||
user_id: Optional[str] = None,
|
||||
) -> BizCollectionProtocol:
|
||||
pn = (protocol_no or "").strip()
|
||||
if not pn:
|
||||
pn = allocate_next_biz_no(
|
||||
db, tenant_no=tenant_no, kind="collection", user_id=user_id
|
||||
)
|
||||
assert_biz_no_available(db, tenant_no=tenant_no, biz_no=pn)
|
||||
obj = BizCollectionProtocol(
|
||||
id=generate_uuid(),
|
||||
@@ -1933,16 +1938,8 @@ def update_collection_protocol(
|
||||
raise ValueError("协议单不存在或无权操作")
|
||||
if protocol_no is not None:
|
||||
pn = protocol_no.strip()
|
||||
if not pn:
|
||||
raise ValueError("协议编号不能为空")
|
||||
if pn != obj.protocol_no:
|
||||
assert_biz_no_available(
|
||||
db,
|
||||
tenant_no=tenant_no,
|
||||
biz_no=pn,
|
||||
exclude_protocol_id=protocol_id,
|
||||
)
|
||||
obj.protocol_no = pn
|
||||
if pn != (obj.protocol_no or ""):
|
||||
raise ValueError("协议号不可修改")
|
||||
if protocol_status is not None:
|
||||
obj.protocol_status = protocol_status.strip()
|
||||
if protocol_attachments is not None:
|
||||
|
||||
Reference in new issue
Block a user