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

/**
 * 获得待理货分页
 *
 * @param {*} params
 * @return {*}
 */
export const tallyPage = (params) => {
  return http(`/my/shipment/tallyPageAir`, params, {
    method: 'POST',
  });
};

/**
 * 获得待理货分页
 *
 * @param {*} data
 * @return {*}
 */
export const tallyList = (data) => {
  return http(`/my/shipment/tallyList`, data, {
    method: 'POST',
    loading: true,
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  });
};

/**
 * 理货移出
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function tallyRemove(data) {
  return http('/ecw/box-preload-goods/remove', data, {
    method: 'POST',
    loading: true,
  });
}

/**
 * 理货
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function tallyLocationUpdate(data) {
  return http('/shipment/box/batchOrderLocationUpdate', data, {
    method: 'POST',
    loading: true,
  });
}

/**
 * 理货提交
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function tallyCommit(data) {
  return http('/shipment/box/tallyCommit', data, {
    method: 'POST',
    loading: true,
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  });
}

export const listByOrderId = (params) => {
  return http('/order/location/list-by-order-id', params, {
    method: 'GET',
  });
};

// 订单详情
export const getOrder = (orderId) => {
  return http(
    `/ecw/order/info/${orderId}`,
    {},
    {
      method: 'GET',
      loading: true,
    }
  );
};

// 获得入仓货物详情
export const getOrderWarehouseIn = (id) => {
  return http(
    '/order/order-warehouse-in/get-order-warehouse-in?orderId=' + id,
    {},
    {
      method: 'GET',
    }
  );
};

// 数量是否必填
export function quantityRequired(lineId) {
  return http('/ecw/warehouse/quantity/required/' + lineId, {}, {
    method: 'get'
  })
}

// 订单批量转异
export function orderBatchToException(data) {
  return http('/air/order/manual-exception/batch', data, {
    method: 'PUT',
    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/batchRemove', data, {
    method: 'POST',
    loading: true,
  });
}

/**
 * 理货纠错
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function singleCreate(data) {
  return http('/ecw/box-order-check-info/singleCreate', data, {
    method: 'POST',
    loading: true,
  });
}

/**
 * 订单装箱编号列表
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function orderTagList(orderId,type) {
  return http('/ecw/box-order-check-info/orderTagList?orderId='+orderId+'&type='+type, {}, {
    method: 'GET'
  });
}