提交
This commit is contained in:
1 parent
427bcb1551
commit
31b04575e2
247 files changed
+39284
-20367
No files matched your search
@@ -612,6 +612,48 @@ async def list_storage_slots(
|
||||
return success_response(result_list)
|
||||
|
||||
|
||||
@router.get("/storage-facility-slots/select-options")
|
||||
async def list_storage_slot_select_options(
|
||||
keyword: Optional[str] = None,
|
||||
availableOnly: Optional[bool] = Query(None, alias="availableOnly"),
|
||||
includeSlotIds: Optional[str] = Query(None, alias="includeSlotIds"),
|
||||
page: int = Query(1, ge=1),
|
||||
pageSize: int = Query(100, ge=1, le=200, alias="pageSize"),
|
||||
user: dict = Depends(require_admin_or_super_admin),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
tenant_no = _get_tenant_no(db, user)
|
||||
query = db.query(BizStorageFacilitySlot).filter(
|
||||
BizStorageFacilitySlot.del_flag == 0,
|
||||
BizStorageFacilitySlot.tenant_no == tenant_no,
|
||||
)
|
||||
query = apply_data_scope(query, BizStorageFacilitySlot, user, db, tenant_no)
|
||||
include_ids = [
|
||||
x.strip()
|
||||
for x in (includeSlotIds or "").split(",")
|
||||
if x.strip()
|
||||
]
|
||||
items, total = storage_facility_svc.list_slot_select_options(
|
||||
db,
|
||||
query=query,
|
||||
tenant_no=tenant_no,
|
||||
keyword=keyword,
|
||||
available_only=bool(availableOnly),
|
||||
include_slot_ids=include_ids or None,
|
||||
page=page,
|
||||
page_size=pageSize,
|
||||
)
|
||||
return success_response(
|
||||
{
|
||||
"list": items,
|
||||
"total": total,
|
||||
"page": page,
|
||||
"pageSize": pageSize,
|
||||
"totalPages": (total + pageSize - 1) // pageSize if pageSize else 0,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@router.post("/storage-facility-slots/batch")
|
||||
async def batch_create_storage_slots(
|
||||
body: StorageSlotBatchCreateBody,
|
||||
|
||||
Reference in new issue
Block a user