lqInventory.js 3.71 KB
import request from '@/utils/request'

// ========== 库存管理接口 ==========

// 创建库存
export function createInventory(data) {
  return request({
    url: '/api/Extend/LqInventory/Create',
    method: 'post',
    data
  })
}

// 更新库存
export function updateInventory(data) {
  return request({
    url: '/api/Extend/LqInventory/Update',
    method: 'put',
    data
  })
}

// 获取库存列表
export function getInventoryList(params) {
  return request({
    url: '/api/Extend/LqInventory/GetList',
    method: 'get',
    data: params
  })
}

// 获取库存详情
export function getInventoryInfo(id) {
  return request({
    url: '/api/Extend/LqInventory/GetInfo',
    method: 'get',
    data: { id }
  })
}

// ========== 库存使用记录接口 ==========

// 添加库存使用记录
export function createInventoryUsage(data) {
  return request({
    url: '/api/Extend/LqInventoryUsage/Create',
    method: 'post',
    data
  })
}

// 作废库存使用记录
export function cancelInventoryUsage(id, remarks) {
  return request({
    url: '/api/Extend/LqInventoryUsage/Cancel?id=' + id + '&remarks=' + remarks,
    method: 'put',
  })
}

// 获取使用记录列表
export function getInventoryUsageList(params) {
  return request({
    url: '/api/Extend/LqInventoryUsage/GetList',
    method: 'get',
    data: params
  })
}

// 获取产品使用统计
export function getProductUsageStatistics(data) {
  return request({
    url: '/api/Extend/LqInventoryUsage/GetProductUsageStatistics',
    method: 'post',
    data
  })
}

// 获取门店使用统计
export function getStoreUsageStatistics(data) {
  return request({
    url: '/api/Extend/LqInventoryUsage/GetStoreUsageStatistics',
    method: 'post',
    data
  })
}

// 获取使用趋势统计
export function getUsageTrendStatistics(data) {
  return request({
    url: '/api/Extend/LqInventoryUsage/GetUsageTrendStatistics',
    method: 'post',
    data
  })
}

// 获取产品使用排行榜
export function getProductUsageRanking(data) {
  return request({
    url: '/api/Extend/LqInventoryUsage/GetProductUsageRanking',
    method: 'post',
    data
  })
}

// ========== 库存使用审批流程接口 ==========

// 批量创建使用记录并提交审批
export function batchCreateInventoryUsage(data) {
  return request({
    url: '/api/Extend/LqInventoryUsage/BatchCreate',
    method: 'post',
    data
  })
}

// 根据批次ID查询申请记录
export function getApplicationByBatchId(batchId) {
  return request({
    url: '/api/Extend/LqInventoryUsage/GetApplicationByBatchId',
    method: 'get',
    data: { batchId }
  })
}

// 审批申请
export function approveApplication(applicationId, result, opinion) {
  const params = new URLSearchParams()
  params.append('result', result)
  if (opinion) {
    params.append('opinion', opinion)
  }
  const queryString = params.toString()
  return request({
    url: `/api/Extend/LqInventoryUsage/Approve/${applicationId}${queryString ? '?' + queryString : ''}`,
    method: 'post'
  })
}

// 标记已领取
export function markReceived(applicationId) {
  return request({
    url: `/api/Extend/LqInventoryUsage/MarkReceived/${applicationId}`,
    method: 'put'
  })
}

// 查询批次信息
export function getBatchInfo(batchId) {
  return request({
    url: '/api/Extend/LqInventoryUsage/GetBatchInfo',
    method: 'get',
    data: { batchId }
  })
}

// 门店领取统计
export function getStoreReceiveStatistics(data) {
  return request({
    url: '/api/Extend/LqInventoryUsage/GetStoreReceiveStatistics',
    method: 'post',
    data
  })
}

// 仓库待领取统计
export function getWarehousePendingDelivery(data) {
  return request({
    url: '/api/Extend/LqInventoryUsage/GetWarehousePendingDelivery',
    method: 'post',
    data
  })
}