import { http } from '@/utils/http'; import { CabinetCellDTO } from './cabinet-cell'; export interface SmartCabinetQuery extends BasePageQuery { /** 柜机名称 */ cabinetName?: string; /** 柜机类型(0主柜 1副柜) */ cabinetType?: number; /** 柜机模版编号 */ templateNo?: string; /** 归属类型(0-借还柜 1-固资通) */ belongType?: number; } /** * 智能柜信息 * @description 智能柜信息表 */ export interface SmartCabinetDTO { /** 柜机唯一ID */ cabinetId?: number; /** 柜机名称 */ cabinetName: string; /** 柜机类型(0主柜 1副柜) */ cabinetType: number; /** 归属主柜ID */ mainCabinet?: number; /** 归属主柜名称 */ mainCabinetName?: string; /** MQTT服务ID */ mqttServerId?: number; /** 商店ID */ shopId?: number; /** 商店名称 */ shopName?: string; /** 柜机模版编号 */ templateNo: string; /** 锁控板序号 */ lockControlNo: number; /** 柜机位置 */ location: number; /** 操作人 */ operator?: string; /** 归属类型(0-借还柜 1-固资通) */ belongType?: number; } /** * 添加智能柜命令 */ export interface AddSmartCabinetCommand { /** 柜机名称 */ cabinetName: string; /** 柜机类型(0主柜 1副柜) */ cabinetType: number; /** 归属主柜ID */ mainCabinet?: number; /** MQTT服务ID */ mqttServerId?: number; /** 商店ID */ shopId?: number; /** 柜机模版编号 */ templateNo: string; /** 锁控板序号 */ lockControlNo: number; /** 柜机位置 */ location: number; /** 归属类型(0-借还柜 1-固资通) */ belongType: number; } /** * 更新智能柜命令 */ export interface UpdateSmartCabinetCommand { /** 柜机唯一ID */ cabinetId: number; /** 柜机名称 */ cabinetName?: string; /** 柜机类型(0主柜 1副柜) */ cabinetType?: number; /** 归属主柜ID */ mainCabinet?: number; /** MQTT服务ID */ mqttServerId?: number; /** 商店ID */ shopId?: number; /** 柜机模版编号 */ templateNo?: string; /** 锁控板序号 */ lockControlNo?: number; /** 柜机位置 */ location?: number; /** 归属类型(0-借还柜 1-固资通) */ belongType?: number; } export interface AllCabinetDataDTO { smartCabinetList: SmartCabinetDTO[]; cells: CabinetCellDTO[]; } export const getSmartCabinetList = (params?: SmartCabinetQuery) => { return http.request>>('get', '/cabinet/smartCabinet', { params }); }; export const addSmartCabinet = (data: AddSmartCabinetCommand) => { return http.request>('post', '/cabinet/smartCabinet', { data }); }; export const updateSmartCabinet = (id: number, data: UpdateSmartCabinetCommand) => { return http.request>('put', `/cabinet/smartCabinet/${id}`, { data }); }; export const deleteSmartCabinet = (ids: string) => { return http.request>('delete', `/cabinet/smartCabinet/${ids}`); }; export const getAllCabinetsWithCells = () => { return http.request>('get', '/cabinet/smartCabinet/all'); }; export const allCabinets = () => { return http.request>>('get', '/cabinet/smartCabinet/allCabinets'); }; export const getSmartCabinetDetailApi = (cabinetId: number) => { return http.request>("get", `/cabinet/smartCabinet/detail/${cabinetId}`); };