import { axios } from "@/utils/request";
import request from "@/utils/request";
// import api from './default.js'
import qs from "qs";
import { upcloud_base_wh_operate, SERVICE_DATA_API_BASE, upcloud_base_wh_outbound, upcloud_base_inventory, SERVICE_CTRL_TOWER } from "@/config/serviceSettings";

//获取波次订单详情
export function getWaveList(id) {
  return axios({
    url: upcloud_base_wh_outbound + "/wave/" + id,
    method: "get",
    // headers: { 'Content-Type': 'application/json' },
    // data: params
  });
}
//获取波次订单商品详情
export function getWaveItemList(id) {
  return axios({
    url: upcloud_base_wh_outbound + "/wave/bill/" + id,
    method: "get",
    // headers: { 'Content-Type': 'application/json' },
    // data: params
  });
}
//获取波次订单商品详情
export function deletWave(params) {
  return axios({
    url: upcloud_base_wh_outbound + "/wave/" + params,
    method: "delete",
    // headers: { 'Content-Type': 'application/json' },
    // params: params
  });
}
//批量下发
export function postdistributeList(params) {
  return axios({
    url: upcloud_base_wh_outbound + "/wave/distribute",
    method: "post",
    headers: { "Content-Type": "application/json" },
    data: params,
  });
}
//删除波次
export function deleteWaveId(id) {
  return axios({
    url: upcloud_base_wh_outbound + "/wave/" + id,
    method: "delete",
    // headers: { 'Content-Type': 'application/json' },
  });
}
//取消波次订单
export function cencelWaveList(params) {
  return axios({
    url: upcloud_base_wh_outbound + "/wave/bill/cancel",
    method: "post",
    // headers: { 'Content-Type': 'application/json' },
    params: params,
  });
}
//订单状态列表
export function getstatusList(params) {
  return axios({
    url: upcloud_base_wh_outbound + "/wave/status/enum",
    method: "get",
    headers: { "Content-Type": "application/json" },
    data: params,
  });
}
//波次订单合并
export function orderConsolidation(params) {
  return axios({
    url: upcloud_base_wh_outbound + "/bill/merge",
    method: "post",
    headers: { "Content-Type": "application/json" },
    data: params,
  });
}
//货位修改提交
export function postbillDPrePosition(params) {
  return axios({
    url: upcloud_base_wh_outbound + "/billDPrePosition",
    method: "post",
    headers: { "Content-Type": "application/json" },
    data: params,
  });
}
//货位查询 //波次创建特殊订单下发 点击指定库位查询接口公用 调用新地址
export function getbillDPrePosition(params) {
  console.log(params, "params");
  return axios({
    url: upcloud_base_wh_outbound + "/billDPrePosition/getPositions",
    method: "get",
    // headers: { 'Content-Type': 'application/json' },
    params: params,
  });
}

//查询货位状态列表
export function getavlpagelist(params) {
  return axios({
    url: upcloud_base_inventory + "/stock/v1/qty/avl-page",
    method: "get",
    // headers: { 'Content-Type': 'application/json' },
    params: params,
  });
}
//获取货主信息
export function getAuthByUser(params) {
  return axios({
    url: SERVICE_CTRL_TOWER + "/userDataAuth/allDataAuthByUser/?companyType=H&pageNum=1&pageSize=10",
    method: "get",
    // headers: { 'Content-Type': 'application/json' },
    params: params,
  });
}
//获取波次监控
export function getStatistics(params) {
  return axios({
    url: upcloud_base_wh_outbound + "/wave/statistics",
    method: "get",
    // headers: { 'Content-Type': 'application/json' },
    params: params,
  });
}
/* 主动补货、紧急补货
 通用带分页查询(接口id) post  */
// 主动补货——保存
export function initiative_save(params) {
  return axios({
    url: upcloud_base_wh_operate + "/replenish/v1/initiative",
    method: "post",
    data: params,
  });
}

// 紧急补货——保存
export function urgent_save(params) {
  return axios({
    url: upcloud_base_wh_operate + "/replenish/v1/urgent",
    method: "post",
    data: params,
  });
}
// 通用带分页查询(接口id) post  */
export function search_page(params) {
  return axios({
    url: SERVICE_DATA_API_BASE + "/search/page",
    method: "post",
    data: params,
  });
}

// 波次试算
export function waveTaskTrial(params) {
  return axios({
    url: upcloud_base_wh_outbound + "/wave/waveTaskTrial",
    method: "post",
    data: params,
  });
}

// export function replenish_pre(params) {
//   return axios({
//     url: upcloud_base_wh_operate + "/replenish/v1/pre",
//     method: "post",
//     data: params,
//   });
// }

export function replenish_pre(params) {
  return request({
    // url: 'mapi/eis/containerMonitoring',
    url: upcloud_base_wh_operate + "/replenish/v1/pre",
    method: "post",
    data: params,
    // params: params
  });
}
