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

//扫描监管码
export function addSupervisionCode(parameter) {
  return request({
    method: 'post',
    url: upcloud_base_wh_outbound + '/supervisionCode/addSupervisionCode',
    data: parameter
  })
}

/* 查询订单商品明细列表 */
export function orderOne(params) {
  return request({
    url: upcloud_base_wh_outbound + '/wave/billdbybillid',
    method: 'post',
    data: params
  })
}

/* 查询波次订单列表-分页 */
export function orderPage(params) {
  return request({
    url: upcloud_base_wh_outbound + '/wave/billhpage',
    method: 'post',
    data: params
  })
}

/* 计划波次 */
export function planWaveCreate(params) {
  return request({
    url: upcloud_base_wh_outbound + '/wave/create',
    method: 'post',
    data: params
  })
}
export function getAuthByUser(params) {
  return request({
    url: SERVICE_CTRL_TOWER+'/userDataAuth/allDataAuthByUser/?companyType=H&pageNum=1&pageSize=10',
    method: 'get',
    // headers: { 'Content-Type': 'application/json' },
    params: params
  })
}
/* 新增波次 */
export function orderAdd(params) {
  return request({
    url: upcloud_base_wh_outbound + '/locator/add',
    method: 'post',
    data: params
  })
}

/* 波次列表 */
export function executeOne(params) {
  return request({
    url: upcloud_base_wh_outbound + '/wave/wavesheaderpage',
    method: 'post',
    data: params
  })
}

/* 波次订单分页查询 */
export function executePage(params) {
  return request({
    url: upcloud_base_wh_outbound + '/wave/wavesheaderpage',
    method: 'post',
    data: params
  })
}

/* 计划波次 */
export function executeAdd(params) {
  return request({
    url: upcloud_base_wh_outbound + '/locator/add',
    method: 'post',
    data: params
  })
}

/* 计划波次 */
export function executeDispatch(params) {
  return request({
    url: upcloud_base_wh_outbound + '/special-wave/create',
    method: 'post',
    data: params,
    headers: { 'Content-Type': 'application/json' }
  })
}
/* 波次整单红冲 */
export function redomsbill(params) {
  return request({
    url: upcloud_base_wh_outbound + '	/red/omsbill',
    method: 'post',
    data: params,
    headers: { 'Content-Type': 'application/json' }
  })
}
/* 波次商品红冲 */
export function redomsItembill(params) {
  return request({
    url: upcloud_base_wh_outbound + '/red/omsbill/item',
    method: 'post',
    data: params,
    headers: { 'Content-Type': 'application/json' }
  })
}
/* 波次商品红冲查询 */
export function redomsItembillQuery(params) {
  return request({
    url: upcloud_base_wh_outbound + '/red/omsbill/item/query',
    method: 'get',
    params: params
    // headers: { 'Content-Type': 'application/json' },
  })
}

/* 库存预占查询 20210512*/
export function waveBillItemLocator(params) {
  return request({
    url: upcloud_base_wh_outbound + '/wave/bill/item/locator',
    method: 'post',
    data: qs.stringify(params),
    headers: {
      'content-type': 'application/x-www-form-urlencoded'
    }
  })
}

//货位修改提交
export function postbillDPrePosition(params) {
  return request({
    url: upcloud_base_wh_outbound+'/billDPrePosition',
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: params
  })
}
//特殊订单下发货位修改提交
export function postbillDPrePosition_TS1(data) {
  return request({
    url: upcloud_base_wh_outbound + "/billDPrePosition/assignPosition",
    method: "post",
    headers: { "Content-Type": "application/json" },
    data,
  });
}