import request from '@/utils/request'
const baseUrl = import.meta.env.VITE_APP_PRODUCTION_API

// 查询计划查询列表
export function listLot(query) {
  return request({
    url: baseUrl + '/business/lot/list',
    method: 'get',
    params: query
  })
}
// 根据生产计划查询批次
export function getLotInfo(query) {
  return request({
    url: baseUrl + '/business/lot/getLotInfo',
    method: 'get',
    params: query
  })
}

//通过批次号查批次信息
export function getLotInfoByLotCode(data) {
  return request({
    url: baseUrl + '/business/lot/getLotInfoByLotCode',
    method: 'post',
    data: data
  })
}

// 查询计划查询详细
export function getLot(id) {
  return request({
    url: baseUrl + '/business/lot/' + id,
    method: 'get'
  })
}
export function getProcessList(query) {
  return request({
    url: baseUrl + '/business/lot/getProcessList',
    method: 'get',
    params:query
  })
}

// 查询批次查询详细
export function getLotList(query) {
  return request({
    url: baseUrl + '/business/lot/getLotList',
    method: 'get',
    params: query
  })
}
//保存废品回用
export function addWasteRecycling(data) {
  return request({
    url: baseUrl + '/business/lot/addWasteRecycling',
    method: 'post',
    data: data
  })
}


// 新增计划查询
export function addLot(data) {
  return request({
    url: baseUrl + '/business/lot',
    method: 'post',
    data: data
  })
}
// 新增计划查询
export function getProcess(data) {
  return request({
    url: baseUrl + '/business/lot/getProcess',
    method: 'post',
    data: data
  })
}

//查找对应计划单下最后一批
export function getLastLot(query) {
  return request({
    url: baseUrl + '/business/lot/getLastLot',
    method: 'get',
    params: query
  })
}
// 修改计划查询
export function updateLot(data) {
  return request({
    url: baseUrl + '/business/lot',
    method: 'put',
    data: data
  })
}

// 删除计划查询
export function delLot(id) {
  return request({
    url: baseUrl + '/business/lot/' + id,
    method: 'delete'
  })
}

export function getLotInfoForInBatches(data) {
  return request({
    url: baseUrl + '/business/lot/getLotInfoForInBatches',
    method: 'post',
    data: data
  })
}
export function getAllLot(params) {
  return request({
    url: baseUrl + '/business/lot/getAllLot/',
    method: 'get',
    params
  })
}

export function listCarriers(params) {
  return request({
    url: baseUrl + '/business/carrier/list',
    method: 'get',
    params
  })
}
export function getListNotInspectionList(params) {
  return request({
    url: baseUrl + '/business/carrier/getListNotInspectionList',
    method: 'get',
    params
  })
}

export function saveInBatches(data) {
  return request({
    url: baseUrl + '/business/lot/saveIsBatches',
    method: 'post',
    data: data
  })
}
