/**
 * 商品换货相关API
 */

import request from '@/utils/request'

/**
 * 归还商品换货
 * @param id
 * @param parmas
 */
export function returnGoodsExchange(id, parmas) {
  return request({
    url: `admin/change/form/return/${id}`,
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

/**
 * 批量确认商品换货单
 * @param id
 */
export function changeFormConfirm(ids) {
  return request({
    url: `admin/change/form/confirm/${ids}`,
    method: 'post'
  })
}

/**
 * 修改商品换货
 * @param id
 * @param parmas
 */
export function editgoodsExchangeAdd(id, parmas) {
  return request({
    url: `admin/change/form/${id}`,
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

/**
 * 添加商品换货
 * @param params
 */
export function addgoodsExchangeAdd(params) {
  return request({
    url: 'admin/change/form',
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: params
  })
}

/**
 * 提交审核商品换货单
 * @param ids
 */
export function submitAuditGoodsExchange(ids) {
  return request({
    url: `admin/change/form/submit/${ids}`,
    method: 'post'
  })
}

/**
 * 撤回商品换货
 * @param ids
 */
export function cancelGoodsExchange(ids) {
  return request({
    url: `admin/change/form/cancel/${ids}`,
    method: 'post'
  })
}

/**
 * 审核商品换货
 * @param params
 */
export function auditGoodsExchange(ids, parmas) {
  return request({
    url: `admin/change/form/audit/${ids}`,
    method: 'post',
    data: parmas
  })
}

/**
 *入库查询
 * @param params
 */
export function getGoodsExchangeInfo(id) {
  return request({
    url: `/admin/erp/warehouseEntry/${id}`,
    method: 'get',
    loaidng: false
  })
}
/**
 *出库查询
 * @param params
 */
 export function getGoodsWarehouseOut(id) {
  return request({
    url: `/admin/erp/warehouseOut/${id}`,
    method: 'get',
    loaidng: false
  })
}
/**
 * 获取商品换货列表
 * @param params
 */
export function getGoodsExchangeList(params) {
  return request({
    url: 'admin/change/form',
    method: 'get',
    loaidng: false,
    params
  })
}

/**
 * 更新商品换货
 * @param id
 * @param parmas
 */
export function editGoodsExchange(id, parmas) {
  return request({
    url: `admin/change/form/${id}`,
    method: 'put',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

/**
 * 删除商品换货
 * @param id
 */
export function deleteGoodsExchange(ids) {
  return request({
    url: `admin/change/form/${ids}`,
    method: 'delete'
  })
}


// 新增入库
export function warehouseEntry(parmas) {
  return request({
    url: `/admin/erp/warehouseEntry`,
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}
// 编辑入库 /admin/erp/warehouseEntry/{id}
export function editWarehouseEntry(id, parmas) {
  return request({
    url: `/admin/erp/warehouseEntry/${id}`,
    method: 'put',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}


// 新增出库
export function warehouseOut(parmas) {
  return request({
    url: `/admin/erp/warehouseOut`,
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

// 获取商品档案/admin/erp/goods

export function getGoodsInfo(params,id) {
  return request({
    url: `/admin/erp/goods/getSkuByWarehouse/${id}`,
    method: 'get',
    loaidng: false,
    params
  })
}

// 导出入库单 /admin/erp/warehouseEntry/export
export function getGoodsExport(params) {
  return request({
    url: '/admin/erp/warehouseEntry/export',
    method: 'get',
    loaidng: false,
    params
  })
}

// 出库列表 /admin/erp/warehouseOut

export function getWarehouseOut(params) {
  return request({
    url: '/admin/erp/warehouseOut',
    method: 'get',
    loaidng: false,
    params
  })
}

/* 获取入库列表 /admin/erp/warehouseEntry */

export function getWarehouseEntry(params) {
  return request({
    url: '/admin/erp/warehouseEntry',//'/admin/erp/warehouseEntryProduct/query',
    method: 'get',
    loaidng: false,
    params
  })
}
//获取用户信息 /admin/systems/admin-users/info
export function getInfo(params) {
  return request({
    url: '/admin/systems/admin-users/info',
    method: 'get',
    loaidng: false,
    params
  })
}

//获取商品信息

export function getStockByWarehouseGood(params) {
  return request({
    url: '/admin/erp/warehouseEntryProduct/getStockByWarehouseGood',
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: params
  })
}
//查询库存商品 /admin/erp/productStock
export function getProductStock(params) {
  return request({
    url: '/admin/erp/productStock',
    method: 'get',
    loaidng: false,
    params
  })
}

//编辑出库 /admin/erp/warehouseOut

export function editWarehouseOut(id, parmas) {
  return request({
    url: `/admin/erp/warehouseOut/${id}`,
    method: 'put',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

/* 扫条形码 /admin/erp/scancode/getProduct/{warehouseId}/{productCode}*/

export function getProduct(warehouseId,productCode) {
  return request({
    url: `/admin/erp/scancode/getProduct/${warehouseId}/${productCode}`,
    method: 'get',
    loaidng: false
  })
}
/* 扫序列号 /admin/erp/scancode/getsnCode/{sku}/{snCode} */
export function getSnCode(type,sku,snCode) {
  return request({
    url: `/admin/erp/scancode/getsnCode/${type}/${sku}/${snCode}`,
    method: 'get',
    loaidng: false
  })
}

/* 订单扫描 */

export function getOneBySn(orderCode) {
  return request({
    url: `/admin/erp/order/getOneBySn/${orderCode}`,
    method: 'get',
    loaidng: false
  })
}
/* 缓存序列号/admin/erp/scancode/skuRedis */
export function skuRedis(parmas) {
  return request({
    url: `/admin/erp/scancode/skuRedis`,
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}