import http from '../../util/http';

/**
 * 合包分页列表
 *
 * @param {*} params
 * @return {*}
 */
export const boxMergePkeList = (params) => {
  return http(`/ecw/box-merge-pkg/list`, params, {
    method: 'GET',
  });
};

/**
 * 获得合包箱分页
 * @param params
 * @returns {*}
 */
export const boxMergePkePage = (params) => {
  return http(`/ecw/box-merge-pkg/page`, params, {
    method: 'GET',
  });
};

/**
 * 创建合包箱
 */
export const boxMergePkeCreate = (params) => {
  return http(`/ecw/box-merge-pkg/create`, params, {
    method: 'POST',
  });
}

/**
 * 更新合包箱
 */
export const boxMergePkeUpdate = (params) => {
  return http(`/ecw/box-merge-pkg/update`, params, {
    method: 'PUT',
  });
}

/**
 * 封箱
 */
export const closeMergePkg = (params) => {
  return http(`/ecw/box-merge-pkg/closeMergePkg`, params, {
    method: 'PUT',
  });
}

/**
 * 删除合包箱
 */
export const boxMergePkeDelete = (id) => {
  return http(`/ecw/box-merge-pkg/delete?id=${id}`, {}, {
    method: 'DELETE',
  });
}

/**
 * 获得已装箱列表分页
 */
export const getPkgPageByPkgId = (params) => {
  return http(`/ecw/box-merge-pkg/getPkgPageByPkgId`, params, {
    method: 'GET',
  });
}

/**
 * 获得未装箱列表分页
 */
export const getUnPkgPage = (params) => {
  return http(`/ecw/box-merge-pkg/getUnPkgPage`, params, {
    method: 'GET',
  });
}

/**
 * 完成合包
 */
export const finishMergePkg = (shipmentId) => {
  return http(`/ecw/box-merge-pkg/finishMergePkg?shipmentId=${shipmentId}`, {}, {
    method: 'GET',
  });
}

/**
 * 获得合包箱详情
 */
export const getBoxMergePkgDetail = (id) => {
  return http(`/ecw/box-merge-pkg/get`, {id}, {
    method: 'GET',
  });
}

/**
 * 获得封箱数据
 */
export const getMergePkgInfoById = (id) => {
  return http(`/ecw/box-merge-pkg/getMergePkgInfoById`, {id}, {
    method: 'GET',
  });
}

/**
 * 创建合包订单（装箱）
 */
export const createMergePkgOrder = (params) => {
  return http(`/ecw/box-pkg-order/create`, params, {
    method: 'POST',
  });
}

/**
 * 批量创建合包订单（批量装箱）
 */
export const createMergePkgOrderBatch = (params) => {
  return http(`/ecw/box-pkg-order/createBatch`, params, {
    method: 'POST',
  });
}

/**
 * 移出合包
 */
export const removeMergePkg = (orderId, pkgId) => {
  return http(`/ecw/box-pkg-order/deleteRelate?orderId=${orderId}&pkgId=${pkgId}`, {}, {
    method: 'DELETE',
  });
}

/**
 * 批量移出合包
 */
export const removeMergePkgBatch = (params) => {
  return http(`/ecw/box-pkg-order/deleteBatchRelate`, params, {
    method: 'POST',
  });
}


/**
 * 获取渠道列表
 */
export const getChannelList = (params = {}) => {
  return http(`/ecw/channel/select`, params, {
    method: 'GET',
  });
}

/**
 * 获得空运待遇装列表
 */
export function preloadPageAir(params) {
  return http('/ecw/box-preload-goods/preloadPageAir', params, {
    method: 'POST',
    loading: true,
  });
}

/**
 * 分拣（空运预装）
 */
export function createAir(params) {
  return http('/ecw/box-preload-goods/createAir', params, {
    method: 'POST',
    loading: true,
  });
}

/**
 * 移出
 *
 * @export
 * @param {*} params
 * @return {*}
 */
export function createGoods(params) {
  return http('/ecw/box-preload-goods/v2/createAir', params, {
    method: 'POST',
    loading: true,
  });
}
/**
 * 批量理货
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function batchCreateMore(data) {
  return http('/ecw/box-order-check-info/batchCreate', data, {
    method: 'POST',
    loading: true,
  });
}
/**
 * 理货纠错
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function batchDeleteMore(data) {
  return http('/ecw/box-order-check-info/batchDelete', data, {
    method: 'POST',
    loading: true,
  });
}

/**
 * 扫描订单号装箱
 */
export function scanOrderNoCreate(data){
	return http('/ecw/box-pkg-order/scanOrderNoCreate', data, {
	  method: 'POST',
	  loading: true,
	});
}
