import request from '@/utils/request'
const baseUrl = import.meta.env.VITE_APP_PRODUCTION_API
import { download, downloadPdf } from '@/utils/request'

// 查询盘点批次信息列表
export function listTaksStockLot(query) {
  return request({
    url: baseUrl + '/business/taksStockLot/list',
    method: 'get',
    params: query
  })
}


// 查询盘点批次信息详细
export function getOutsourceInfo(query) {
  return request({
    url: baseUrl + '/business/taksStockLot/outsourceInfo',
    method: 'get',
    params: query
  })
}
export function getNotInboundInfo(query) {
  return request({
    url: baseUrl + '/business/taksStockLot/getNotInboundInfo',
    method: 'get',
    params: query
  })
}
export function getAnyInboundInfo(query) {
  return request({
    url: baseUrl + '/business/taksStockLot/getAnyInboundInfo',
    method: 'get',
    params: query
  })
}
export function notInboundExport(data) {
  download(
    baseUrl + "/business/taksStockLot/notInboundExport",
    {
      ...data,
    },
    `未入库盘点_${new Date().getTime()}.xlsx`
  )
}
export function anyInboundExport(data) {
  download(
    baseUrl + "/business/taksStockLot/anyInboundExport",
    {
      ...data,
    },
    `部分入库盘点_${new Date().getTime()}.xlsx`
  )
}

// 查询盘点批次信息详细
export function getTaksStockLot(id) {
  return request({
    url: baseUrl + '/business/taksStockLot/' + id,
    method: 'get'
  })
}
export function updateNoStartLot(data) {
  return request({
    url: baseUrl + '/business/taksStockLot/updateNoStartLot',
    method: 'post',
    data: data
  })
}
export function getProductionPlanDetail(data) {
  return request({
    url: baseUrl + '/business/taksStockLot/getProductionPlanDetail',
    method: 'post',
    data: data
  })
}
export function getNotTaksLot(data) {
  return request({
    url: baseUrl + '/business/taksStockLot/getNotTaksLot',
    method: 'post',
    data: data
  })
}
export function getLotNumber(data) {
  return request({
    url: baseUrl + '/business/taksStockLot/getLotNumber',
    method: 'post',
    data: data
  })
}
// 新增盘点批次信息
export function addTaksStockLot(data) {
  return request({
    url: baseUrl + '/business/taksStockLot',
    method: 'post',
    data: data
  })
}

// 修改盘点批次信息
export function updateTaksStockLot(data) {
  return request({
    url: baseUrl + '/business/taksStockLot',
    method: 'put',
    data: data
  })
}
export function multiplyInventoryCheck(data) {
  return request({
    url: baseUrl + '/business/taksStockLot/multiplyInventoryCheck',
    method: 'put',
    data: data
  })
}
export function singleInventoryCheck(data) {
  return request({
    url: baseUrl + '/business/taksStockLot/singleInventoryCheck',
    method: 'put',
    data: data
  })
}


export function saveOutsourceInfo(data) {
  return request({
    url: baseUrl + '/business/taksStockLot/saveOutsourceInfo',
    method: 'post',
    data: data
  })
}
export function saveNotInboundInfo(data) {
  return request({
    url: baseUrl + '/business/taksStockLot/saveNotInboundInfo',
    method: 'post',
    data: data
  })
}
export function saveAnyInboundInfo(data) {
  return request({
    url: baseUrl + '/business/taksStockLot/saveAnyInboundInfo',
    method: 'post',
    data: data
  })
}



// 删除盘点批次信息
export function delTaksStockLot(id) {
  return request({
    url: baseUrl + '/business/taksStockLot/' + id,
    method: 'delete'
  })
}

// 导出
export function exportNoStartLot(data) {
  download(
    baseUrl + "/business/taksStockLot/export",
    {
      ...data,
    },
    `未盘点批次_${new Date().getTime()}.xlsx`
  )
}

export function getLotsByOutsourceFormNo(data) {
  return request({
    url: baseUrl + "/business/taksStockLot/getLotsByOutsourceFormNo",
    method: "post",
    data: data,
  });
}

export function batchTaksStockLot(data) {
  return request({
    url: baseUrl + "/business/taksStockLot/batchTaksStockLot",
    method: "post",
    data: data,
  })
}
