import request from '@/utils/request'

// 查询物资信息--分页 /dev-api/iscs/materials/getIsMaterialsPage
export function listMaterials(query) {
  return request({
    url: '/iscs/materials/getIsMaterialsPage',
    method: 'get',
    params: query
  })
}

// 新增物资信息 /dev-api/iscs/materials/insertIsMaterials
export function addMaterials(data) {
  return request({
    url: '/iscs/materials/insertIsMaterials',
    method: 'post',
    data: data
  })
}

// 修改物资信息 /dev-api/iscs/materials/updateIsMaterials
export function updateMaterials(data) {
  return request({
    url: '/iscs/materials/updateIsMaterials',
    method: 'post',
    data: data
  })
}

// 删除物资信息 /dev-api/iscs/materials/deleteIsMaterialsByMaterialsIds
export function deleteMaterials(data) {
  return request({
    url: '/iscs/materials/deleteIsMaterialsByMaterialsIds?materialsIds=' + data,
    method: 'post'
  })
}

// 获取物资详细信息 /dev-api/iscs/materials/selectIsMaterialsById
export function selectMaterialsById(query) {
  return request({
    url: '/iscs/materials/selectIsMaterialsById?materialsId=' + query,
    method: 'get'
  })
}

// 物资所属柜 查询物资柜-分页
export function getIsMaterialsCabinets(query) {
  return request({
    url: '/iscs/cabinet/getIsMaterialsCabinetPage',
    method: 'get',
    params: query
  })
}

//绑定物资
export function updateMaterialsBinding(data) {
  return request({
    url: '/iscs/materials/updateMaterialsBinding',
    method: 'post',
    data: data
  })
}

///dev-api/iscs/materials/updateIsMaterialById 借出/归还物资(借出参数materialsId-loanState-loanUserId)（归还参数materialsId-loanState-restitutionToId-restitutionUserId）
//物资借出与归还
export function updateIsMaterialById(data) {
  return request({
    url: '/iscs/materials/updateIsMaterialById',
    method: 'post',
    data: {
      list: data
    }
  })
}

//物资绑定与解绑
export function insertIsMaterialsChangeRecord(data) {
  return request({
    url: '/iscs/change/insertIsMaterialsChangeRecord',
    method: 'post',
    data: data
  })
}

//物资 绑定物资-物资柜绑定/解绑物资（物资更换，多对多）
export function updateMaterialsBindingRemove(data) {
  return request({
    url: '/iscs/cabinet/updateMaterialsBindingRemove',
    method: 'post',
    data: data
  })
}

// 物资检查记录模拟 新增
export function insertIsMaterialsCheckRecord(data) {
  return request({
    url: '/iscs/check/insertIsMaterialsCheckRecord',
    method: 'post',
    data: {
      list: data
    }
  })
}

//查询异常还错柜子的物资
export function getExMaterials(query) {
  return request({
    url: '/iscs/materials/getExMaterials',
    method: 'get',
    params: query
  })
}

//手动更换1 表单物资分类 与数据更换信息·
export function selectExMaterialTypeById(data) {
  return request({
    url: '/iscs/hardware/material-api/selectExMaterialTypeById',
    method: 'get',
    params: data
  })
}

///dev-api/iscs/hardware/material-api/insertReplaceRecord  手动更换1的确认更换函数
export function insertReplaceRecord(data) {
  return request({
    url: '/iscs/hardware/material-api/insertReplaceRecord',
    method: 'post',
    data: {
      list: data
    }
  })
}
//新增物资柜开门超时异常 /dev-api/iscs/hardware/material-api/insertCabinetOpenTimeout
export function insertCabinetOpenTimeout(data) {
  return request({
    url: '/iscs/hardware/material-api/insertCabinetOpenTimeout',
    method: 'post',
    data: data
  })
}
//解除物资柜开门超时异常 /dev-api/iscs/hardware/material-api/updateCabinetOpenTimeout
export function updateCabinetOpenTimeout(data) {
  return request({
    url: '/iscs/hardware/material-api/updateCabinetOpenTimeout',
    method: 'post',
    data: data
  })
}

//物资柜开柜门记录 数据接口 /dev-api/iscs/hardware/material-api/insertCabinetOpenRecord
export function insertCabinetOpenRecord(data) {
  return request({
    url: '/iscs/hardware/material-api/insertCabinetOpenRecord',
    method: 'post',
    data: data
  })
}
//物资柜关闭柜门 记录 /dev-api/iscs/hardware/material-api/updateCabinetClose
export function updateCabinetClose(data) {
  return request({
    url: '/iscs/hardware/material-api/updateCabinetClose',
    method: 'post',
    data: data
  })
}
