import request from '@/config/axios'

// 物资更换记录查询参数
export interface ChangeRecordQuery {
  current: number
  size: number
  materialsId?: number
  oldCabinetId?: number
  newCabinetId?: number
  changeTime?: Date
}

// 物资更换记录表单对象
export interface ChangeRecordVO {
  changeId?: number
  materialsId: number
  oldCabinetId: number
  newCabinetId: number
  changeReason: string
  changeTime: Date
  remark?: string
  createTime?: Date
}

// 查询物资更换记录列表
export const listChangeRecord = async (params: ChangeRecordQuery) => {
  return await request.get({ url: '/iscs/materials-change-record/getMaterialsChangeRecordPage', params })
}

// 查询物资更换记录详情
export const getChangeRecordInfo = async (id: number) => {
  return await request.get({
    url: '/iscs/materials-change-record/selectMaterialsChangeRecordById',
    params: { id: id }
  })
}

// 新增物资更换记录
export const addChangeRecord = async (data: ChangeRecordVO) => {
  return await request.post({ url: '/iscs/change/insertIsMaterialsChangeRecord', data })
}

// 修改物资更换记录
export const updateChangeRecord = async (data: ChangeRecordVO) => {
  return await request.put({ url: '/iscs/materials-change-record/updateMaterialsChangeRecord', data })
}

// 删除物资更换记录
export const deleteChangeRecord = async (ids: number) => {
  return await request.post({
    url: '/iscs/materials-change-record/deleteMaterialsChangeRecordList?ids='+ids,

  })
}
