浏览代码

241202-1代码。

baoyubo 7 月之前
父节点
当前提交
a52fcdab29

+ 96 - 1
models/resource_provision_base.py

@@ -352,4 +352,99 @@ class ResourceProvisionWarehouseInfo(Base):
     update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='数据更新时间')
     create_dept = Column(BigInteger, default=None, comment='创建部门')
     create_by = Column(BigInteger, default=None, comment='创建者')
-    update_by = Column(BigInteger, default=None, comment='更新者')
+    update_by = Column(BigInteger, default=None, comment='更新者')
+
+
+class ResourceProvisionWarehouseRoomInfo(Base):
+    __tablename__ = 'resource_provision_warehouse_room_info'
+
+    id = Column(String(255), primary_key=True,  comment='ID')
+    room_name = Column(String(255), nullable=True, comment='库房名称')
+    warehouse = Column(String(255), nullable=True, comment='所在仓库')
+    room_area = Column(Numeric(15, 2), nullable=True, comment='库房面积(平方米)')
+    available_area = Column(Numeric(15, 2), nullable=True, comment='可用仓储面积(平方米)')
+    height = Column(Numeric(10, 2), nullable=True, comment='高度(米)')
+    room_volume = Column(Numeric(20, 2), nullable=True, comment='库房容积(立方米)')
+    available_volume = Column(Numeric(20, 2), nullable=True, comment='可用库房容积(立方米)')
+    level = Column(String(50), nullable=True, comment='等级')
+    storage_type_code = Column(String(50), nullable=True, comment='存放类型')
+    storage_type = Column(String(50), nullable=True, comment='保管类型')
+    last_inventory_time = Column(DateTime, nullable=True, comment='库存确认最新时间')
+    del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
+    create_time = Column(DateTime, default=datetime.now, comment='数据创建时间')
+    update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='数据更新时间')
+    create_dept = Column(BigInteger, default=None, comment='创建部门')
+    create_by = Column(BigInteger, default=None, comment='创建者')
+    update_by = Column(BigInteger, default=None, comment='更新者')
+    remark = Column(Text, nullable=True, comment='备注')
+
+
+class ResourceProvisionMaterialInfo(Base):
+    __tablename__ = 'resource_provision_material_info'
+
+    material_id = Column(Integer, primary_key=True, autoincrement=True, comment='物资编码')
+    material_name = Column(String(255), nullable=True, comment='物资名称')
+    warehouse_id = Column(Integer, nullable=True, comment='仓库id')
+    inventory = Column(Integer, nullable=True, comment='库存')
+    specification = Column(String(255), nullable=True, comment='规格')
+    model = Column(String(255), nullable=True, comment='型号')
+    category_name = Column(String(255), nullable=True, comment='分类名称')
+    material_type = Column(String(255), nullable=True, comment='物资类型')
+    unit_name = Column(String(255), nullable=True, comment='计量单位名称')
+    brand_name = Column(String(255), nullable=True, comment='品牌名称')
+    length = Column(Numeric(10, 2), nullable=True, comment='长(厘米)')
+    width = Column(Numeric(10, 2), nullable=True, comment='宽(厘米)')
+    height = Column(Numeric(10, 2), nullable=True, comment='高(厘米)')
+    volume = Column(Numeric(20, 2), nullable=True, comment='体积(立方厘米)')
+    gross_weight = Column(Numeric(10, 2), nullable=True, comment='毛重(kg)')
+    net_weight = Column(Numeric(10, 2), nullable=True, comment='净重(kg)')
+    manufacturer = Column(String(255), nullable=True, comment='生产厂商')
+    origin = Column(String(255), nullable=True, comment='产地')
+    status = Column(String(50), nullable=True, comment='状态')
+    room_id = Column(Integer, nullable=True, comment='库房id')
+    package_quantity = Column(Integer, nullable=True, comment='包装数量')
+    package_volume = Column(Numeric(20, 2), nullable=True, comment='包装体积(立方厘米)')
+    package_weight = Column(Numeric(10, 2), nullable=True, comment='包装重量(kg)')
+    price = Column(Numeric(10, 2), nullable=True, comment='价格')
+    selling_price = Column(Numeric(10, 2), nullable=True, comment='售卖价格')
+    value = Column(Numeric(10, 2), nullable=True, comment='价值')
+    cost_price = Column(Numeric(10, 2), nullable=True, comment='成本价格')
+    disaster_types = Column(String(255), nullable=True, comment='适用灾种')
+    maintenance = Column(Text, nullable=True, comment='使用保养')
+    supplier_name = Column(String(255), nullable=True, comment='供应商名称')
+    special_transportation_requirements = Column(Text, nullable=True, comment='特殊运输要求')
+    material = Column(String(255), nullable=True, comment='材质')
+    shelf_life = Column(DateTime, nullable=True, comment='保质期')
+    inventory_warning_pusher = Column(String(255), nullable=True, comment='库存预警推送人')
+    inventory_warning_quantity = Column(Integer, nullable=True, comment='库存预警数量')
+    shelf_life_warning_days = Column(Integer, nullable=True, comment='保质期到期预警天数')
+    shelf_life_warning_pusher = Column(String(255), nullable=True, comment='保质期预警推送人')
+    from_sys= Column(String(255), nullable=True, comment='来源系统')
+    del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
+    create_time = Column(DateTime, default=datetime.now, comment='数据创建时间')
+    update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='数据更新时间')
+    create_dept = Column(BigInteger, default=None, comment='创建部门')
+    create_by = Column(BigInteger, default=None, comment='创建者')
+    update_by = Column(BigInteger, default=None, comment='更新者')
+    remark = Column(Text, nullable=True, comment='备注')
+
+class ResourceProvisionFile(Base):
+    __tablename__ = 'resource_provision_file'
+
+    id = Column(Integer, autoincrement=True, primary_key=True)
+    file_id = Column(String(50), nullable=False, comment='文件id')
+    file_name = Column(String(255), nullable=False, comment='文件名称')
+    file_name_desc = Column(String(255), nullable=False, comment='文件名称原名')
+    file_path = Column(String(255), comment='文件存储路径')
+    file_size = Column(String(50), comment='文件大小')
+    status = Column(String(50), comment='文件状态')
+    foreign_key = Column(String(50), comment='文件外键 --技术字段')
+    from_scenario = Column(String(50), comment='对应标识 --技术字段')
+    create_time = Column(DateTime, default=datetime.now, comment='数据创建时间')
+    update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='数据更新时间')
+    create_dept = Column(BigInteger, default=None, comment='创建部门')
+    create_by = Column(BigInteger, default=None, comment='创建者')
+    del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)') #更新预案信息的时候 先将原有的进行备注删除
+
+    class Config:
+        orm_mode = True

+ 373 - 0
routers/api/resourceProvison/MaterialReserveManagement/material.py

@@ -0,0 +1,373 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+from fastapi import APIRouter, Request, Depends, Query, HTTPException, status,WebSocket,WebSocketDisconnect
+from common.security import valid_access_token,valid_websocket_token
+from fastapi.responses import JSONResponse
+from sqlalchemy.orm import Session
+from sqlalchemy.sql import func
+from common.auth_user import *
+from sqlalchemy import  text
+from pydantic import BaseModel
+from common.BigDataCenterAPI import *
+from database import get_db
+from typing import List
+from models import *
+from utils import *
+from utils.spatial import *
+from utils.ry_system_util import *
+from common.websocketManager import *
+import json
+import traceback
+
+router = APIRouter()
+
+def warehouse_room_id_get_warehouse_room_info(db,id):
+    query = db.query(ResourceProvisionWarehouseRoomInfo)
+    query = query.filter_by(id = id,del_flag = '0')
+    return query.first()
+def warehouse_id_get_warehouse_info(db,id):
+    query = db.query(ResourceProvisionWarehouseInfo)
+    query = query.filter_by(warehouse_id = id,del_flag = '0')
+    return query.first()
+def type_id_get_material_type_info(db,id):
+    query = db.query(ResourceProvisionMaterialType)
+    query = query.filter_by(id = id,del_flag = '0')
+    return query.first()
+def material_id_get_material_info(db,id):
+    query = db.query(ResourceProvisionMaterialInfo)
+    query = query.filter_by(material_id = id,del_flag = '0')
+    return query.first()
+def delete_resource_provision_file(db,from_scenario,foreign_key):
+    file_query = db.query(ResourceProvisionFile)
+    file_query = file_query.filter(ResourceProvisionFile.del_flag != '2')
+    file_query = file_query.filter(ResourceProvisionFile.from_scenario == from_scenario)
+    file_query = file_query.filter(ResourceProvisionFile.foreign_key == foreign_key)
+    files = file_query.all()
+    for file in files:
+        file.del_flag = '2'
+
+@router.post("/create")
+async def create_pattern(
+    user_id=Depends(valid_access_token),
+    body = Depends(remove_xss_json),
+    db: Session = Depends(get_db)
+):
+    try:
+        new_material = ResourceProvisionMaterialInfo(
+            # id = new_guid(),
+            material_name=body['material_name'],
+            warehouse_id=body['warehouse_id'],
+            inventory=body['inventory'],
+            specification=body['specification'],
+            model=body['model'],
+            category_name=body['category_name'],
+            material_type=body['material_type_id'],
+            unit_name=body['unit_name'],
+            brand_name=body['brand_name'],
+            length=body['length'],
+            width=body['width'],
+            height=body['height'],
+            volume=body['volume'],
+            gross_weight=body['gross_weight'],
+            net_weight=body['net_weight'],
+            manufacturer=body['manufacturer'],
+            origin=body['origin'],
+            status=body['status'],
+            room_id=body['room_id'],
+            package_quantity=body['package_quantity'],
+            package_volume=body['package_volume'],
+            package_weight=body['package_weight'],
+            price=body['price'],
+            selling_price=body['selling_price'],
+            value=body['value'],
+            cost_price=body['cost_price'],
+            disaster_types=body['disaster_types'],
+            maintenance=body['maintenance'],
+            supplier_name=body['supplier_name'],
+            special_transportation_requirements=body['special_transportation_requirements'],
+            material=body['material'],
+            shelf_life=body['shelf_life'],
+            inventory_warning_pusher=body['inventory_warning_pusher'],
+            inventory_warning_quantity=body['inventory_warning_quantity'],
+            shelf_life_warning_days=body['shelf_life_warning_days'],
+            shelf_life_warning_pusher=body['shelf_life_warning_pusher'],
+            from_sys=body['from_sys'],
+            create_id = user_id
+        )
+
+        db.add(new_material)
+        new_file_list = body['fileList']
+
+        for file in new_file_list:
+            file_name = file['file_name']
+            file_name_desc = file['file_name_desc']
+            status = file['status']
+            new_file = ResourceProvisionFile(
+                file_id=new_guid(),
+                foreign_key=new_material.material_id,
+                from_scenario='ResourceProvisionMaterialInfo',
+                file_name=file_name,
+                file_name_desc=file_name_desc,
+                status=status
+            )
+            db.add(new_file)
+        db.commit()
+        return {"code": 200, "msg": "创建成功", "data": None}
+    except Exception as e:
+        traceback.print_exc()
+        raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
+
+
+
+@router.put("/update/{id}")
+async def update_pattern(
+    id :str ,
+    user_id=Depends(valid_access_token),
+    body=Depends(remove_xss_json),
+    db: Session = Depends(get_db)
+):
+    try:
+        info = material_id_get_material_info(db,id)
+        if not info:
+            return JSONResponse(status_code=404,content={"code":404,"msg":"warehouse room not found"})
+        # info.room_name = body['room_name']
+        info.material_name = body['material_name']
+        info.warehouse_id = body['warehouse_id']
+        info.inventory = body['inventory']
+        info.specification = body['specification']
+        info.model = body['model']
+        info.category_name = body['category_name']
+        info.material_type = body['material_type_id']
+        info.unit_name = body['unit_name']
+        info.brand_name = body['brand_name']
+        info.length = body['length']
+        info.width = body['width']
+        info.height = body['height']
+        info.volume = body['volume']
+        info.gross_weight = body['gross_weight']
+        info.net_weight = body['net_weight']
+        info.manufacturer = body['manufacturer']
+        info.origin = body['origin']
+        info.status = body['status']
+        info.room_id = body['room_id']
+        info.package_quantity = body['package_quantity']
+        info.package_volume = body['package_volume']
+        info.package_weight = body['package_weight']
+        info.price = body['price']
+        info.selling_price = body['selling_price']
+        info.value = body['value']
+        info.cost_price = body['cost_price']
+        info.disaster_types = body['disaster_types']
+        info.maintenance = body['maintenance']
+        info.supplier_name = body['supplier_name']
+        info.special_transportation_requirements = body['special_transportation_requirements']
+        info.material = body['material']
+        info.shelf_life = body['shelf_life']
+        info.inventory_warning_pusher = body['inventory_warning_pusher']
+        info.inventory_warning_quantity = body['inventory_warning_quantity']
+        info.shelf_life_warning_days = body['shelf_life_warning_days']
+        info.shelf_life_warning_pusher = body['shelf_life_warning_pusher']
+        info.from_sys = body['from_sys']
+        info.update_by = user_id
+
+        delete_resource_provision_file(db,'ResourceProvisionMaterialInfo',id)
+
+
+        new_file_list = body['fileList']
+        for file in new_file_list:
+            file_name = file['file_name']
+            file_name_desc = file['file_name_desc']
+            status = file['status']
+            new_file = ResourceProvisionFile(
+                file_id=new_guid(),
+                foreign_key=id,
+                from_scenario='ResourceProvisionMaterialInfo',
+                file_name=file_name,
+                file_name_desc=file_name_desc,
+                status=status
+            )
+            db.add(new_file)
+        db.commit()
+        return {"code": 200, "msg": "更新成功"}
+    except Exception as e:
+        traceback.print_exc()
+        raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
+
+@router.get("/info/{id}")
+async def get_pattern_info(
+    id: str,
+    db: Session = Depends(get_db)
+):
+    try:
+
+        info = material_id_get_material_info(db,id)
+        if not info:
+            return JSONResponse(status_code=404,content={"code":404,"msg":"warehouse room not found"})
+        warehouse_info = warehouse_id_get_warehouse_info(db,info.warehouse_id)
+        if not warehouse_info:
+            warehouse_name=None
+        else:
+            warehouse_name = warehouse_info.warehouse_name
+        material_type_info = type_id_get_material_type_info(db,info.material_type)
+        if not material_type_info:
+            material_category_name=None
+        else:
+            material_category_name = material_type_info.material_category_name
+        warehouse_room_info = type_id_get_material_type_info(db, info.room_id)
+        if not warehouse_room_info:
+            room_name = None
+        else:
+            room_name = warehouse_room_info.room_name
+        data = {
+            "id": info.id,
+            "material_name": info.material_name,
+            "warehouse_id": info.warehouse_id,
+            "warehouse_name": warehouse_name,
+            "inventory": info.inventory,
+            "specification": info.specification,
+            "model": info.model,
+            "category_name": info.category_name,
+            "material_type_id": info.material_type,
+            "material_type_name": material_category_name,
+            "unit_name": info.unit_name,
+            "brand_name": info.brand_name,
+            "length": info.length,
+            "width": info.width,
+            "height": info.height,
+            "volume": info.volume,
+            "gross_weight": info.gross_weight,
+            "net_weight": info.net_weight,
+            "manufacturer": info.manufacturer,
+            "origin": info.origin,
+            "status": info.status,
+            "room_id": info.room_id,
+            "room_name":room_name,
+            "package_quantity": info.package_quantity,
+            "package_volume": info.package_volume,
+            "package_weight": info.package_weight,
+            "price": info.price,
+            "selling_price": info.selling_price,
+            "value": info.value,
+            "cost_price": info.cost_price,
+            "disaster_types": info.disaster_types,
+            "maintenance": info.maintenance,
+            "supplier_name": info.supplier_name,
+            "special_transportation_requirements": info.special_transportation_requirements,
+            "material": info.material,
+            "shelf_life": info.shelf_life,
+            "inventory_warning_pusher": info.inventory_warning_pusher,
+            "inventory_warning_quantity": info.inventory_warning_quantity,
+            "shelf_life_warning_days": info.shelf_life_warning_days,
+            "shelf_life_warning_pusher": info.shelf_life_warning_pusher,
+            "from_sys": info.from_sys,
+            "create_time":info.create_time}
+        return {"code": 200, "msg": "获取成功", "data": data}
+    except Exception as e:
+        traceback.print_exc()
+        raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
+
+@router.get("/list")
+async def get_pattern_list(
+    # name: str = Query(None, description='名称'),
+    page: int = Query(1, gt=0, description='页码'),
+    pageSize: int = Query(10, gt=0, description='每页条目数量'),
+    db: Session = Depends(get_db)
+):
+    try:
+        query = db.query(ResourceProvisionWarehouseRoomInfo)
+        query = query.filter_by(del_flag='0')
+        # if name:
+        #     query = query.filter(ResourceProvisionWarehouseInfo.material_category_name.like(f'%{name}%'))
+        total_items = query.count()
+        # 排序
+        query = query.order_by(ResourceProvisionWarehouseRoomInfo.create_time.desc())
+        # 执行分页查询
+        lists = query.offset((page - 1) * pageSize).limit(pageSize).all()
+        data = []
+        for info in lists:
+            warehouse_info = warehouse_id_get_warehouse_info(db, info.warehouse_id)
+            if not warehouse_info:
+                warehouse_name = None
+            else:
+                warehouse_name = warehouse_info.warehouse_name
+            material_type_info = type_id_get_material_type_info(db, info.material_type)
+            if not material_type_info:
+                material_category_name = None
+            else:
+                material_category_name = material_type_info.material_category_name
+            warehouse_room_info = type_id_get_material_type_info(db, info.room_id)
+            if not warehouse_room_info:
+                room_name = None
+            else:
+                room_name = warehouse_room_info.room_name
+            data.append({
+            "id": info.id,
+            "material_name": info.material_name,
+            "warehouse_id": info.warehouse_id,
+            "warehouse_name": warehouse_name,
+            "inventory": info.inventory,
+            "specification": info.specification,
+            "model": info.model,
+            "category_name": info.category_name,
+            "material_type_id": info.material_type,
+            "material_type_name": material_category_name,
+            "unit_name": info.unit_name,
+            "brand_name": info.brand_name,
+            "length": info.length,
+            "width": info.width,
+            "height": info.height,
+            "volume": info.volume,
+            "gross_weight": info.gross_weight,
+            "net_weight": info.net_weight,
+            "manufacturer": info.manufacturer,
+            "origin": info.origin,
+            "status": info.status,
+            "room_id": info.room_id,
+            "room_name":room_name,
+            "package_quantity": info.package_quantity,
+            "package_volume": info.package_volume,
+            "package_weight": info.package_weight,
+            "price": info.price,
+            "selling_price": info.selling_price,
+            "value": info.value,
+            "cost_price": info.cost_price,
+            "disaster_types": info.disaster_types,
+            "maintenance": info.maintenance,
+            "supplier_name": info.supplier_name,
+            "special_transportation_requirements": info.special_transportation_requirements,
+            "material": info.material,
+            "shelf_life": info.shelf_life,
+            "inventory_warning_pusher": info.inventory_warning_pusher,
+            "inventory_warning_quantity": info.inventory_warning_quantity,
+            "shelf_life_warning_days": info.shelf_life_warning_days,
+            "shelf_life_warning_pusher": info.shelf_life_warning_pusher,
+            "from_sys": info.from_sys,
+            "create_time":info.create_time})
+        return {"code": 200, "msg": "查询成功", "data": data,
+                "total": total_items,
+                "page": page,
+                "pageSize": pageSize,
+                "totalPages": (total_items + pageSize - 1) // pageSize
+                }
+    except Exception as e:
+        traceback.print_exc()
+        raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
+
+@router.delete("/delete/{id}")
+async def delete_pattern(
+    id: str,
+    db: Session = Depends(get_db)
+):
+    try:
+        # 检查图案是否存在
+        info = material_id_get_material_info(db, id)
+        if not info:
+            return JSONResponse(status_code=404, content={"code": 404, "msg": "warehouse room not found"})
+        info.del_flag='2'
+        delete_resource_provision_file(db, 'ResourceProvisionMaterialInfo', id)
+        db.commit()
+        return {"code": 200, "msg": "删除成功"}
+    except Exception as e:
+        traceback.print_exc()
+        raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")

+ 194 - 0
routers/api/resourceProvison/MaterialReserveManagement/warehouse_root.py

@@ -0,0 +1,194 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+from fastapi import APIRouter, Request, Depends, Query, HTTPException, status,WebSocket,WebSocketDisconnect
+from common.security import valid_access_token,valid_websocket_token
+from fastapi.responses import JSONResponse
+from sqlalchemy.orm import Session
+from sqlalchemy.sql import func
+from common.auth_user import *
+from sqlalchemy import  text
+from pydantic import BaseModel
+from common.BigDataCenterAPI import *
+from database import get_db
+from typing import List
+from models import *
+from utils import *
+from utils.spatial import *
+from utils.ry_system_util import *
+from common.websocketManager import *
+import json
+import traceback
+
+router = APIRouter()
+
+def warehouse_room_id_get_warehouse_room_info(db,id):
+    query = db.query(ResourceProvisionWarehouseRoomInfo)
+    query = query.filter_by(id = id,del_flag = '0')
+    return query.first()
+def warehouse_id_get_warehouse_info(db,id):
+    query = db.query(ResourceProvisionWarehouseInfo)
+    query = query.filter_by(warehouse_id = id,del_flag = '0')
+    return query.first()
+
+
+@router.post("/create")
+async def create_pattern(
+    user_id=Depends(valid_access_token),
+    body = Depends(remove_xss_json),
+    db: Session = Depends(get_db)
+):
+    try:
+        new_type = ResourceProvisionWarehouseRoomInfo(
+            id = new_guid(),
+            room_name=body['room_name'],
+            warehouse=body['warehouse_id'],
+            room_area=body['room_area'],
+            available_area=body['available_area'],
+            height=body['height'],
+            room_volume=body['room_volume'],
+            available_volume=body['available_volume'],
+            storage_type=body['storage_type'],
+            level=body['level'],
+            storage_type_code=body['storage_type_code'],
+            last_inventory_time=body['last_inventory_time'],
+            create_id = user_id
+        )
+        db.add(new_type)
+        db.commit()
+        return {"code": 200, "msg": "创建成功", "data": None}
+    except Exception as e:
+        traceback.print_exc()
+        raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
+
+
+
+@router.put("/update/{id}")
+async def update_pattern(
+    id :str ,
+    user_id=Depends(valid_access_token),
+    body=Depends(remove_xss_json),
+    db: Session = Depends(get_db)
+):
+    try:
+        info = warehouse_room_id_get_warehouse_room_info(db,id)
+        if not info:
+            return JSONResponse(status_code=404,content={"code":404,"msg":"warehouse room not found"})
+        info.room_name = body['room_name']
+        info.warehouse = body['warehouse_id']
+        info.room_area = body['room_area']
+        info.available_area = body['available_area']
+        info.height = body['height']
+        info.room_volume = body['room_volume']
+        info.available_volume = body['available_volume']
+        info.storage_type = body['storage_type']
+        info.level = body['level']
+        info.storage_type_code = body['storage_type_code']
+        info.last_inventory_time = body['last_inventory_time']
+        info.update_by = user_id
+        db.commit()
+        return {"code": 200, "msg": "更新成功"}
+    except Exception as e:
+        traceback.print_exc()
+        raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
+
+@router.get("/info/{id}")
+async def get_pattern_info(
+    id: str,
+    db: Session = Depends(get_db)
+):
+    try:
+
+        info = warehouse_room_id_get_warehouse_room_info(db,id)
+        if not info:
+            return JSONResponse(status_code=404,content={"code":404,"msg":"warehouse room not found"})
+        warehouse_info = warehouse_id_get_warehouse_info(db,info.warehouse)
+        if not warehouse_info:
+            warehouse_name=None
+        else:
+            warehouse_name = warehouse_info.warehouse_name
+        data = {
+                "id":info.id,
+                "warehouse_id": info.warehouse,
+                "warehouse_name": warehouse_name,
+                "room_name": info.room_name,
+                "room_area": info.room_area,
+                "available_area": info.available_area,
+                "height": info.height,
+                "room_volume": info.room_volume,
+                "available_volume": info.available_volume,
+                "storage_type": info.storage_type,
+                "level": info.level,
+                "storage_type_code": info.storage_type_code,
+                "last_inventory_time": info.last_inventory_time,
+                "create_time":info.create_time}
+        return {"code": 200, "msg": "获取成功", "data": data}
+    except Exception as e:
+        traceback.print_exc()
+        raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
+
+@router.get("/list")
+async def get_pattern_list(
+    # name: str = Query(None, description='名称'),
+    page: int = Query(1, gt=0, description='页码'),
+    pageSize: int = Query(10, gt=0, description='每页条目数量'),
+    db: Session = Depends(get_db)
+):
+    try:
+        query = db.query(ResourceProvisionWarehouseRoomInfo)
+        query = query.filter_by(del_flag='0')
+        # if name:
+        #     query = query.filter(ResourceProvisionWarehouseInfo.material_category_name.like(f'%{name}%'))
+        total_items = query.count()
+        # 排序
+        query = query.order_by(ResourceProvisionWarehouseRoomInfo.create_time.desc())
+        # 执行分页查询
+        lists = query.offset((page - 1) * pageSize).limit(pageSize).all()
+        data = []
+        for info in lists:
+            warehouse_info = warehouse_id_get_warehouse_info(db, info.warehouse)
+            if not warehouse_info:
+                warehouse_name = None
+            else:
+                warehouse_name = warehouse_info.warehouse_name
+            data.append({
+                "id":info.id,
+                "warehouse_id": info.warehouse,
+                "warehouse_name": warehouse_name,
+                "room_name": info.room_name,
+                "room_area": info.room_area,
+                "available_area": info.available_area,
+                "height": info.height,
+                "room_volume": info.room_volume,
+                "available_volume": info.available_volume,
+                "storage_type": info.storage_type,
+                "level": info.level,
+                "storage_type_code": info.storage_type_code,
+                "last_inventory_time": info.last_inventory_time,
+                "create_time":info.create_time} )
+        return {"code": 200, "msg": "查询成功", "data": data,
+                "total": total_items,
+                "page": page,
+                "pageSize": pageSize,
+                "totalPages": (total_items + pageSize - 1) // pageSize
+                }
+    except Exception as e:
+        traceback.print_exc()
+        raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
+
+@router.delete("/delete/{id}")
+async def delete_pattern(
+    id: str,
+    db: Session = Depends(get_db)
+):
+    try:
+        # 检查图案是否存在
+        info = warehouse_room_id_get_warehouse_room_info(db, id)
+        if not info:
+            return JSONResponse(status_code=404, content={"code": 404, "msg": "warehouse room not found"})
+        info.del_flag='2'
+        db.commit()
+        return {"code": 200, "msg": "删除成功"}
+    except Exception as e:
+        traceback.print_exc()
+        raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")