import request from '@/utils/request'
import state from '@/store'
import router from '@/router'

// 查询滞货使用记录
export function searchBacklogUseRecord(pageCurrent, pageSize, status) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_滞货使用记录_查询数据',
      param: '关联状态=' + status,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 查询滞货使用记录
export function searchBacklogLocation(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_滞货物料与货位_查询数据',
      param: '物料流水号=' + num
    }
  })
}
// 提交关联
export function submitConnectBacklog(...params) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '采购管理_滞货物料关联_增加数据',
      param: `滞货使用流水号=${params[0]}&物料与货位对照流水号组=${params[1]}&关联数量组=${params[2]}`
    }
  })
}
// 查询滞货关联明细
export function searchBacklogConnectDetail(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_滞货关联明细_查询数据',
      param: '滞货使用流水号=' + num
    }
  })
}
