import request from '@/utils/request'
import qs from 'qs'
import {upcloud_base_wh_inbound,upcloud_base_wh_outbound,SERVICE_DATA_API_BASE,upcloud_base_common} from "@/config/serviceSettings";

export const api = {
  querySubList: upcloud_base_wh_inbound + '/exceptionHeaders/v1/extractRcvH',
  addItems: upcloud_base_wh_inbound + '/exceptionHeaders/v1/add',
  taskSplit: upcloud_base_wh_inbound + '/exceptionHeaders/v1/extractTask',
  rejectLotNo: upcloud_base_wh_inbound + '/exceptionHeaders/v1/rejectLotNo'
};

export function getList(params) {
  return request ({
    url: SERVICE_DATA_API_BASE+'/search/page',
    method: 'post',
    data: params,
    headers: {
      'Authorization':'Bearer '+JSON.parse( localStorage.getItem("token") ),
      'content-type': 'application/json'
    }
  })
}

export function bizFilePage(parameter) {
  return request({
    method: 'get',
    url: upcloud_base_common+"/bizFile/page",
    params: parameter,
  })
}
export function bizFileAdd(parameter) {
  return request({
    method: 'post',
    url: upcloud_base_wh_inbound + "/pictureManagement/saveOrUpdateFile",
    data: parameter,
  })
}
	
export function bizFileDel(parameter) {
  return request({
    method: 'post',
    url: upcloud_base_common+"/bizFile/del",
    data: parameter,
  })
}

export function bizFileDown(parameter) {
  return request({
    method: 'get',
    url: "/api/service-filemanagement/file/download",
    contentType:"application/octet-stream",
    responseType: 'blob',
    params: parameter,
  })
}

export function addItems(parameter) {
  return request({
    method: 'post',
    url: api.addItems,
    data: parameter,
  })
}

export function taskSplit(parameter) {
  return request({
    method: 'get',
    url: api.taskSplit,
    params: parameter,
  })
}

// 批号驳回 
export function rejectLotNo(parameter) {
  return request({
    method: 'post',
    url: api.rejectLotNo,
    data: parameter,
  })
}

// 删除
export function del(data) {
  return request({
    method: 'post',
    url: upcloud_base_wh_inbound + '/pictureManagement/del',
    data,
  })
}

// 查询打印信息
export function qnSalesData(data) {
  return request({
    method: 'post',
    url: upcloud_base_common + '/print/getPrintInfo',
    data,
  })
}

export function print(url,data) {
  return request({
    method: 'post',
    url: url,
    data,
  })
}