import axios from "@/utils/request";
import request from "@/utils/request";

export function addWorkplaceFreight(query) {
  return axios({
    url: "/udiwms/WorkplaceFreight/addWorkplaceFreight",
    method: "post",
    data: query
  });
}

export function getWorkplaceFreightList(query) {
  return axios({
    url: "/udiwms/WorkplaceFreight/getPage",
    method: "get",
    params: query
  });
}


export function getWorkplaceFreightViewList(query) {
  return axios({
    url: "/udiwms/WorkplaceFreight/getListView",
    method: "get",
    params: query
  });
}


export function deleteFreight(query) {
  return axios({
    url: "/udiwms/WorkplaceFreight/deleteById",
    method: "post",
    data: query
  });
}

export function createFreightCode(query) {
  return axios({
    url: "/udiwms/WorkplaceFreight/createFreightCode",
    method: "get",
    params: query
  });
}

export function updateWorkplaceFreight(query) {
  return axios({
    url: "/udiwms/WorkplaceFreight/updateWorkplaceFreight",
    method: "post",
    data: query
  });
}



export function printAllFreight(query) {
  return axios({
    url: "/udiwms/WorkplaceFreight/printAllFreight",
    method: "post",
    data: query,
    headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
    responseType: 'arraybuffer',   //一定要设置响应类型，否则页面会是空白pdf
  });
}

export function printRegion(query) {
  return axios({
    url: "/udiwms/WorkplaceFreight/printRegion",
    method: "post",
    data: query,
    headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
    responseType: 'arraybuffer',   //一定要设置响应类型，否则页面会是空白pdf
  });
}
// export function printAllFreight(query) {
//   return axios({
//     url: "/udiwms/WorkplaceFreight/printAllFreight",
//     method: "post",
//     data: query
//   });
// }
