import request from '@/utils/request'
let devCode = getDevCode()



function getDevCode() {
  return localStorage.getItem('devStorage')?JSON.parse(localStorage.getItem('devStorage')).devCode:""

}


// 查询设备列表
export function getAll() {
  return request({
    url: '/pms/device/all',
    method: 'get',
  })
}

// 查询设备列表
export function getdeviceInfo() {
  let deviceCode = getDevCode()
  devCode = deviceCode
  return request({
    url: '/pms/statement/getdeviceInfo/'+devCode,
    method: 'get',
    // params: Object.assign({}, checkQuery, query)
  })
}









//获取设备信息
export function device(obj) {
  return request({
    url: '/mf/device',
    method: 'get',
    params: obj
  })
}

//获取缝纫工作记录
export function getSewingList(obj) {
  return request({
    url: '/pms/device/getSewingList',
    method: 'get',
    params: obj
  })
}


//获取裁片视觉检测工作记录
export function getOKOrNGList(obj) {
  return request({
      url: '/pms/device/getOKOrNGList',
      method: 'get',
      params: obj
  })
}
//获取缝纫，冲孔机工作记录
export function abnormalShutdown(obj) {
  return request({
      url: '/pms/device/abnormalShutdown',
      method: 'get',
      params: obj
  })
}
//获取平板扫描工作记录
export function getScanList(obj) {
  return request({
      url: '/pms/device/getScanList',
      method: 'get',
      params: obj
  })
}

//OEE
export function oee(obj) {
  return request({
      url: '/pms/device/oee',
      method: 'get',
      params: obj
  })
}




// 查询设备保养记录
export function checkRecord(obj) {
  return request({
      url: 'pms/checkRecord/list',
      method: 'get',
      params: obj
  })
}
// 查询设备维修单列表
// 设备保养提醒
export function deviceCheck(devCode) {
  return request({
      url: '/mf/deviceCheck',
      method: 'get',
      params: { devCode:devCode }
  })
}

//设备报警记录
export function deviceRepair(devCode) {
  return request({
      url: '/mf/deviceRepair',
      method: 'get',
      params: { devCode }
  })
}

//查询单设产量统计
export function productionChartByDevice(obj) {
  return request({
      url: '/mf/productionChartByDevice',
      method: 'get',
      params: obj
  })
}


//查询单设备状态统计
export function deviceStatusChartByDevice(obj) {
  return request({
      url: '/mf/deviceStatusChartByDevice',
      method: 'get',
      params: obj
  })
}

//查询单设备电耗趋势
export function powerConsumptionTrend(obj) {
  return request({
      url: '/mf/powerConsumptionTrend',
      method: 'get',
      params: obj
  })
}