import request from "@/utils/request";

// 创建出货
export function createbox(data) {
  return request({
    url: "/shipment/box/createAir",
    method: "post",
    data: data,
  });
}

// 更新出货
export function updatebox(data) {
  return request({
    url: "/shipment/box/update",
    method: "put",
    data: data,
  });
}

/**
 * 订舱
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function booking(data) {
  if (data.id) {
    return request({
      url: "/shipment/box-book-air/update",
      method: "put",
      data,
    });
  }

  return request({
    url: "/shipment/box-book-air/create",
    method: "post",
    data,
  });
}

/**
 * 获得待预装分页
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function preloadPage(data) {
  return request({
    url: "/ecw/box-preload-goods/preloadPageAir",
    method: "post",
    data,
  });
}

/**
 * 预装
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function createGoods(data) {
  return request({
    url: "/ecw/box-preload-goods/createAir",
    method: "post",
    data,
  });
}

/**
 * 获得获得合包箱分页
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function getMergePkgList(params) {
  return request({
    url: "/ecw/box-merge-pkg/page",
    method: "get",
    params,
  });
}

/**
 * 创建合包箱
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function createMergePkg(data) {
  return request({
    url: "/ecw/box-merge-pkg/create",
    method: "post",
    data,
  });
}

/**
 * 更新合包箱
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function updateMergePkg(data) {
  return request({
    url: "/ecw/box-merge-pkg/update",
    method: "put",
    data,
  });
}

/**
 * 删除合包箱
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function deleteMergePkg(id) {
  return request({
    url: `/ecw/box-merge-pkg/delete?id=`+id,
    method: "delete",
  });
}

/**
 * 获得未装箱列表分页
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function getUnPkgPage(params) {
  return request({
    url: "/ecw/box-merge-pkg/getUnPkgPage",
    method: "get",
    params,
  });
}

/**
 * 获得已装箱列表分页
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function getPkgPageByPkgId(params) {
  return request({
    url: "/ecw/box-merge-pkg/getPkgPageByPkgId",
    method: "get",
    params,
  });
}