import {
	request
} from '@/utils/request'
// 获取保养工单统计数量
export function getMaintenanceCount(params) {
  return request({
    url: '/rq/stat/maintenance/total',
    method: 'get',
    params
  })
}

// 获取保养工单列表
export function getMaintenanceList(params) {
  return request({
    url: '/pms/iot-main-work-order/sortedMainWorkOrderPage',
    // url: '/pms/iot-main-work-order/page',
    method: 'get',
    params
  })
}

// 以设备为维度查询最近保养距离
export function getDeviceMainDistances(params) {
  return request({
    url: '/pms/iot-main-work-order/deviceMainDistances',
    method: 'get',
    params
  })
}

// 根据保养计划查询保养项
export function getMainPlanBOMs(params) {
  return request({
    url: '/pms/iot-maintenance-bom/getMainPlanBOMs',
    method: 'get',
    params
  })
}
// 根据设备id获取设备保养项
export function getDeviceAssociateBomList(params) {
  return request({
    url: '/rq/iot-device/deviceAssociateBomList',
    method: 'get',
    params
  })
}

// 保存保养工单
export function saveMaintenance(data) {
  return request({
    url: '/pms/iot-main-work-order/addWorkOrder',
    method: 'put',
    data
  })
}

// 查询保养工单详情
export function getMaintenanceDetail(params) {
  return request({
    url: '/pms/iot-main-work-order/get',
    method: 'get',
    params
  })
}
 // 查询保养工单详情 - 保养工单明细BOM列表
 export function getWorkOrderBOMs(params) {
  return request({
    url: '/pms/iot-main-work-order-bom/getWorkOrderBOMs',
    method: 'get',
    params
  })
}
// 填报保养工单
export function fillWorkOrder(data) {
  return request({
    url: '/pms/iot-main-work-order/fillWorkOrder',
    method: 'put',
    data
  })
}
// 查询保养工单已经选择的所有物料
export function getBomMaterialsByWorkOrderId(params) {
  return request({
    url: '/pms/iot-main-work-order-bom-material/list',
    method: 'get',
    params
  })
}
