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

// 查询入库单列表
export function initWarehouseReceipt(check1, num, check2, name) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_入库单_查询数据',
      param: `入库单号_check=${check1}&入库单号=${num}&供应商名称_check=${check2}&供应商名称=${name}`
    }
  })
}
// 查询采购单列表
export function initPurchaseOrder() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_采购计划_查询数据_发票'
    }
  })
}
// 查询入库单
export function searchWarehouseReceipt(pageCurrent, pageSize, check1, num, check2, name) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_入库单_查询数据',
      param: `入库单号_check=${check1}&入库单号=${num}&供应商名称_check=${check2}&供应商名称=${name}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 查询入库单明细
export function searchMateriel(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_采购计划明细_查询数据',
      param: `采购计划流水号=${num}`
    }
  })
}
// 创建入库单
export function AddWarehousing(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_入库单_增加数据',
      param: `采购计划流水号=${num}&入库人员=${num1}`
    }
  })
}
// 删除入库单
export function deleteWarehousing(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_入库单_删除数据',
      param: `入库单流水号=${num}`
    }
  })
}
