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

/**
 * 获得待理货分页
 *
 * @param {*} params
 * @return {*}
 */
export const tallyPage = (params) => {
  return http(`/my/shipment/tallyPage`, 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'
  })
}
