import request from '@/utils/request'

/**
 * 获取待入库订单
 * @param params
 * @returns {AxiosPromise}
 */
export function getStockOrderList(params) {
  return request({
    url: '/delivery/getStockOrderList',
    method: 'get',
    params
  })
}

/**
 * 添加入库记录及包签记录,此时入库记录状态为待入库
 * @param params
 * @returns {AxiosPromise}
 */
export function addOrderStockItem(params, token) {
  return request({
    url: '/delivery/addOrderStockItem?token=' + token,
    method: 'post',
    data: params
  })
}

/**
 * 保存入库记录的库位信息
 * @param params
 * @returns {AxiosPromise}
 */
export function saveStockPlace(params) {
  return request({
    url: '/delivery/saveStockPlace',
    method: 'post',
    params
  })
}

/**
 * 打包退回
 * @param params
 * @returns {AxiosPromise}
 */
export function orderStockItemBack(params) {
  return request({
    url: '/delivery/orderStockItemBack',
    method: 'post',
    params
  })
}

/**
 * 将入库记录标记为已入库
 * @param params
 * @returns {AxiosPromise}
 */
export function orderInStock(data, token) {
  return request({
    url: '/delivery/orderInStock?token=' + token,
    method: 'post',
    data: data
  })
}

/**
 * 打印标签并入库
 * @param params
 * @returns {AxiosPromise}
 */
export function orderInStockAndPrint(data, token) {
  return request({
    url: '/delivery/orderInStockAndPrint?token=' + token,
    method: 'post',
    data: data
  })
}

/**
 * 获取入库记录
 * @param params
 * @returns {AxiosPromise}
 */
export function getOrderStockItemList(params) {
  return request({
    url: '/delivery/getOrderStockItemList',
    method: 'get',
    params
  })
}

/**
 * 获取入库记录合计
 * @param params
 * @returns {AxiosPromise}
 */
export function getOrderStockItemCount(params) {
  return request({
    url: '/delivery/getOrderStockItemCount',
    method: 'get',
    params
  })
}

/**
 * 获取待发货订单
 * @param params
 * @returns {AxiosPromise}
 */
export function getDeliveryOrderList(params) {
  return request({
    url: '/delivery/getDeliveryOrderList',
    method: 'get',
    params
  })
}

/**
 * 获取入库记录,包含包签
 * @param params
 * @returns {AxiosPromise}
 */
export function getOrderStockItem(params) {
  return request({
    url: '/delivery/getOrderStockItem',
    method: 'get',
    params
  })
}

/**
 * 针对入库记录发货,并生成发货单
 * @param params
 * @returns {AxiosPromise}
 */
export function deliveryOutStock(params) {
  return request({
    url: '/delivery/deliveryOutStock',
    method: 'post',
    data: params
  })
}

/**
 * 导出发货清单
 * @param params
 * @returns {AxiosPromise}
 */
export function exportSendItem(params) {
  return request({
    url: '/delivery/exportSendItem',
    method: 'post',
    data: params
  })
}

/**
 * 发货单打印
 * @param params
 * @returns {AxiosPromise}
 */
export function printSendBill(params) {
  return request({
    url: '/delivery/printSendBill',
    method: 'post',
    params
  })
}

/**
 * 强制发货完成,针对订单
 * @param params
 * @returns {AxiosPromise}
 */
export function enforceFinishDelivery(params) {
  return request({
    url: '/delivery/enforceFinishDelivery',
    method: 'post',
    params
  })
}

/**
 * 获取发货单列表
 * @param params
 * @returns {AxiosPromise}
 */
export function getSendBillList(params) {
  return request({
    url: '/delivery/getSendBillList',
    method: 'get',
    params
  })
}

/**
 * 获取发货单明细列表,用以发货反馈
 * @param params
 * @returns {AxiosPromise}
 */
export function getSendBillItemList(params) {
  return request({
    url: '/delivery/getSendBillItemList',
    method: 'get',
    params
  })
}

/**
 * 获取发货单详情,包含发货明细,包含多地址
 * @param params
 * @returns {AxiosPromise}
 */
export function getSendBillDetail(params) {
  return request({
    url: '/delivery/getSendBillDetail',
    method: 'get',
    params
  })
}

/**
 * 发货反馈,针对发货明细
 * @param params
 * @returns {AxiosPromise}
 */
export function deliverFeedback(params) {
  return request({
    url: '/delivery/deliveryFeedBack',
    method: 'post',
    data: params
  })
}

/**
 * 发货退回
 * @param params
 * @returns {*}
 */
export function deliveryBack(params) {
  return request({
    url: '/delivery/deliveryBack',
    method: 'post',
    params: params
  })
}

/**
 * 发货单作废
 * @param params
 * @returns {*}
 */
export function voidSendBill(params) {
  return request({
    url: '/delivery/voidSendBill',
    method: 'post',
    params: params
  })
}

/**
 * 获取物流档案,不分页
 * @param params
 * @returns {AxiosPromise}
 */
export function getLogisticsInfoList(params) {
  return request({
    url: '/doc/getLogisticsInfoList',
    method: 'post',
    params
  })
}

/**
 * 获取担保人档案,不分页
 * @param params
 * @returns {AxiosPromise}
 */
export function getGuarantorInfoListFront(params) {
  return request({
    url: '/doc/getGuarantorInfoListFront',
    method: 'post',
    params
  })
}

/**
 * 发货审核,针对发货明细
 * @param params
 * @returns {AxiosPromise}
 */
export function deliverFeedbackVerify(params) {
  return request({
    url: '/delivery/deliverFeedbackVerify',
    method: 'post',
    params
  })
}


/**
 * 获取包签打印数据
 * @param params
 * @returns {AxiosPromise}
 */
export function getPrintLabelInfo(params) {
  return request({
    url: '/delivery/printLabel',
    method: 'post',
    params
  })
}

/**
 * 发货单审核列表
 * @param params
 * @returns {AxiosPromise}
 */
export function sendBillReviewPage(params) {
  return request({
    url: '/delivery/sendBillReviewPage',
    method: 'post',
    params: params
  })
}

/**
 * 审核发货单
 * @param params
 * @returns {AxiosPromise}
 */
export function sendBillReview(params) {
  return request({
    url: '/delivery/sendBillReview',
    method: 'post',
    params: params
  })
}

/**
 * 发货单审核退回
 * @param params
 * @returns {AxiosPromise}
 */
export function sendBillReviewBack(params) {
  return request({
    url: '/delivery/sendBillReviewBack',
    method: 'post',
    params: params
  })
}

/**
 * 修改发货单反馈信息
 * @param params
 * @returns {AxiosPromise}
 */
export function updateDeliveryFeedBackInfo(params) {
  return request({
    url: '/delivery/updateDeliveryFeedBackInfo',
    method: 'post',
    params: params
  })
}


/**
 * 获取发货模块的请求token(一次请求的唯一凭据)
 * @param params
 * @returns {AxiosPromise}
 */
export function deliveryFormToken(params) {
  return request({
    url: '/delivery/deliveryFormToken',
    method: 'post',
    params: params
  })
}
