import request from '@/config/axios'

// PMS 货架 VO
export interface IotShelvesVO {
  id: number // 主键
  deptId: number // 部门id
  factoryId: number // 工厂id(SAP) 专业公司id system_sap_org表id
  factoryCode: string // 工厂code
  factoryName: string // 工厂name
  costCenterId: number // 成本中心id (system_sap_org表id)
  costCenterCode: string // 成本中心 code
  storageLocationId: number // 库存地点id (system_sap_org表id)
  storageLocationCode: string // 库存地点编码
  storageLocationName: string // 库存地点名称
  storageAreaId: number // 仓库区域id(A区 B区)
  storageAreaName: string // 仓库库区名称
  code: string // 货架编码
  name: string // 货架名称
  type: number // 货架类型
  sort: number // 显示顺序
  status: number // 状态 0启用  1停用
  remark: string // 备注
}

// PMS 货架 API
export const IotShelvesApi = {
  // 查询PMS 货架分页
  getIotShelvesPage: async (params: any) => {
    return await request.get({ url: `/pms/iot-shelves/page`, params })
  },

  getSimpleShelvesList: async (): Promise<IotShelvesVO[]> => {
    return await request.get({ url: '/pms/iot-shelves/simple-list' })
  },

  // 查询PMS 货架详情
  getIotShelves: async (id: number) => {
    return await request.get({ url: `/pms/iot-shelves/get?id=` + id })
  },

  // 新增PMS 货架
  createIotShelves: async (data: IotShelvesVO) => {
    return await request.post({ url: `/pms/iot-shelves/create`, data })
  },

  // 修改PMS 货架
  updateIotShelves: async (data: IotShelvesVO) => {
    return await request.put({ url: `/pms/iot-shelves/update`, data })
  },

  // 删除PMS 货架
  deleteIotShelves: async (id: number) => {
    return await request.delete({ url: `/pms/iot-shelves/delete?id=` + id })
  },

  // 导出PMS 货架 Excel
  exportIotShelves: async (params) => {
    return await request.download({ url: `/pms/iot-shelves/export-excel`, params })
  },
}
