This commit is contained in:
zlwu committed 2026-06-14 17:20:52 +08:00
1 parent a79aee2614
commit 427bcb1551
274 files changed
+59416 -38342

No files matched your search

+54
View File
@@ -149,6 +149,8 @@ class StockCheckCreateBody(BaseModel):
class StockCheckUnusedLineItem(BaseModel):
model_config = ConfigDict(populate_by_name=True)
usage_id: Optional[str] = Field(None, alias="usageId")
batch_id: Optional[str] = Field(None, alias="batchId")
material_code: Optional[str] = Field(None, alias="materialCode")
material_name: str = Field(..., alias="materialName")
spec_model: Optional[str] = Field(None, alias="specModel")
@@ -624,9 +626,61 @@ async def list_stock_logs(
return error_response(400, str(e))
@router.post("/material-usages/{usage_id}/mark-fully-used")
async def mark_material_usage_fully_used(
usage_id: str,
db: Session = Depends(get_db),
user: dict = Depends(require_menu_code("biz:material:list")),
):
"""标记领用记录已使用完(盘点登记 / 变动记录)。"""
try:
tenant_no = _get_tenant_no(db, user)
user_id = _get_current_user_id(user)
mu_svc.mark_requisition_fully_used(
db,
usage_id,
tenant_no=tenant_no,
user_id=user_id,
user_info=user,
)
return success_response(None, message="已标记为使用完")
except PermissionError as e:
return error_response(403, str(e))
except ValueError as e:
return error_response(400, str(e))
except Exception as e:
return error_response(400, str(e))
# ---------- 库存盘点 ----------
@router.get("/material-stock-check-requisitions")
async def list_material_stock_check_requisitions(
page: int = Query(1, ge=1),
pageSize: int = Query(50, ge=1, le=200),
keyword: Optional[str] = None,
db: Session = Depends(get_db),
user: dict = Depends(require_menu_code("biz:material:list")),
):
"""盘点登记:待处理领用记录(未标记已使用完)。"""
try:
tenant_no = _get_tenant_no(db, user)
items, total = mu_svc.list_stock_check_requisitions(
db,
tenant_no,
page=page,
page_size=pageSize,
keyword=keyword,
user_info=user,
)
return success_response(_page_payload(items, total, page, pageSize))
except PermissionError as e:
return error_response(403, str(e))
except Exception as e:
return error_response(400, str(e))
@router.get("/material-stock-checks")
async def list_material_stock_checks(
page: int = Query(1, ge=1),