import request from '@/utils/request'
import {param} from "@/utils";

// 创建订单
export function createOrder(data) {
  return request({
    url: '/ecw/order/create',
    method: 'post',
    data: data
  })
}

// 更新订单
export function updateOrder(data) {
  return request({
    url: '/ecw/order/update',
    method: 'put',
    data: data
  })
}

// 删除订单
export function deleteOrder(id) {
  return request({
    url: '/ecw/order/delete?orderId=' + id,
    method: 'delete'
  })
}

// 获得订单
export function getOrder(orderId) {
  return request({
    url: '/ecw/order/info/' + orderId,
    method: 'get'
  })
}

// 获得订单编辑详情
export function getOrderDetail(orderId) {
  return request({
    url: '/ecw/order/get',
    method: 'get',
    params: {orderId}
  })
}

// 获得订单分页
export function getOrderPage(query) {
  return request({
    url: '/ecw/order/page',
    method: 'get',
    params: query
  })
}

// 导出订单 Excel
export function exportOrderExcel(query) {
  return request({
    url: '/ecw/order/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 打印标签
export function printTag(id) {
  return request({
    url: '/order/print/orderTagPrint?orderId=' + id,
    method: 'get',
  })
}

//根据订单号获得订单费用申请列表
export function feeApplicationListByOrderId(query){
  return request({
    url:'/order/fee-application/listByOrderId',
    method: 'get',
    params: query,
  })
}
//费用申请提交
 export function feeApplicationCreate(data){
  return request({
    url:'order/fee-application/create',
    method:'post',
    data:data,
  })
 }
  //费用申请修改
 export function applicationUpdate(data){
  return request({
    url:'/order/fee-application/update',
    method:'put',
    data:data,
  })
 }
  export function ApplicationListByOrderId(params){
   return request({
     url:'order/fee-application/listByOrderId',
     method:'get',
     params:params

   })
  }
// 创建特殊
export function specialNeedCreate(data){
  return request({
    url:'ecw/order-special-need/create',
    method:'post',
    data:data,
  })
}
// 创建特殊
export function getSpecialListByOrderId(orderId){
  return request({
    url: 'ecw/order-special-need/getListByOrderId',
    method: 'get',
    params: {orderId},
  })
}
// 删除特需
 export function orderSpecialNeed(params){
  return request({
    url:'/ecw/order-special-need/deleteByOrderId',
    method: 'delete',
    data:params
  })
 }

// 获得提单pdf
export function getLadingBill(query){
  return request({
    url:'ecw/order/billLading/template',
    method: 'get',
    responseType: 'arraybuffer',
    params: query,
  })
}
//调仓申请
export function orderWarehouseInAdjustApply(data){
  return request({
    url:'/order/order-warehouse-in/adjust-apply',
    method:'put',
    data:data,
  })
}

// 获得入仓货物详情
export function getOrderWarehouseIn(id) {
  return request({
    url: '/order/order-warehouse-in/get-order-warehouse-in?orderId=' + id,
    method: 'get'
  })
}

// 入仓
export function orderWarehouseIn(data){
  return request({
    url: '/order/order-warehouse-in/create',
    method: 'post',
    data
  })
}

// 入仓完成
export function orderWarehouseInFinish(data){
  return request({
    url: '/order/order-warehouse-in/finish',
    method: 'post',
    data
  })
}

// 退仓
export function rollbackApply(data){
  return request({
    url: '/order/order-warehouse-in/rollback-apply',
    method: 'put',
    data
  })
}

//取消订单
export function cancelOrder(orderId){
  return request({
    url: `/ecw/order/cancel/${orderId}`,
    method: 'put',
  })
}

// 恢复订单
export function recoveryOrder(orderId){
  return request({
    url: `/ecw/order/recovery/${orderId}`,
    method: 'put',
  })
}

// 获得我的订单分页
export function getMyOrderPage(query) {
  return request({
    url: '/ecw/order/my/page',
    method: 'get',
    params: query
  })
}


// 创建提货
export function createOrderPickup(data){
  return request({
    url: '/ecw/order-pickup/create',
    method: 'post',
    data
  })
}

// 批量提货
export function createOrderPickupBatch(data){
  return request({
    url: '/ecw/order-pickup/createBatch',
    method: 'post',
    data
  })
}

// 分批提货
export function createOrderPickupSplitBatch(data){
  return request({
    url: '/ecw/order-pickup/createSplitBatch',
    method: 'post',
    data
  })
}
//根据流程ID获得订单信息
 export function applicationGetOrderByProcessId(params){
  return request({
    url:'/order/fee-application/getOrderByProcessId',
    method:'get',
    params
  })
 }
export function feeApplicationGet(params){
  return request({
    url:'/order/fee-application/get',
    method:'get',
    params
  })
}

// 获得控货分页
export function getCargoControlOrderPage(params){
  return request({
    url:'ecw/order-cargo-control/cargo/control/order',
    method:'get',
    params
  })
}

//获得调仓明细
 export function orderWarehouseInGetAdjustInfo(params){
  return request({
    url:'order/order-warehouse-in/get-adjust-info',
    method:'get',
    params
  })
 }
 export function warehouseAdjustSendOut(data){
  return request({
    url:'/order/order-warehouse-in/warehouse-adjust-send-out',
    method:'put',
    data
  })
 }
 //获得订单仓库图片分页
 export function orderWarehousePicturePage(params){
  return request({
    url:'/order/warehouse-picture/page',
    method:'get',
    params
  })
 }
 export function warehouseAdjustPage(params){
  return request({
    url:'/order/warehouse-adjust/page',
    method:'get',
    params
  })
 }
  export function  warehouseAdjustArrived(data){
     return request({
       url:'/order/order-warehouse-in/warehouse-adjust-arrived',
       method:'put',
       data
     })
}