import request from '@/utils/request'
import state from '@/store'
import router from '@/router'
// 初始化项目
export function initProject() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_项目名称_查询数据_按时间排序'
    }
  })
}
// 查询仓库
export function initWarehouse() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_货位仓库_仓库_查询数据'
    }
  })
}
// 机床查询
export function searchmachine(check, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_机床名称_查询数据',
      param: '项目流水号_check=' + check + '=int&项目流水号=' + num
    }
  })
}
// 分组查询
export function searchTeam(machineNumber) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_组件名称_查询数据',
      param: '机床流水号=' + machineNumber
    }
  })
}

// 修改记录查询
export function searchAlterRecord(pageCurrent, pageSize, project_check, project, machine_check, machine, group_check, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_修改记录查询',
      param: '项目流水号_check=' + project_check + '&项目流水号=' + project + '&机床流水号_check=' + machine_check + '&机床流水号=' + machine + '&组件流水号_check=' + group_check + '&组件流水号=' + group,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 异常记录查询
export function searchErrorRecord(pageCurrent, pageSize, project_check, project, machine_check, machine, group_check, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_零件出库_异常记录查询',
      param: '项目流水号_check=' + project_check + '&项目流水号=' + project + '&机床流水号_check=' + machine_check + '&机床流水号=' + machine + '&组件流水号_check=' + group_check + '&组件流水号=' + group,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 补投单查询
export function searchReplacementCard(pageCurrent, pageSize, card_check, card) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_补投单_补投单查询',
      param: '补投单编号_check=' + card_check + '&补投单编号=' + card,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 补投增加
export function addReplacementCard(Number, house) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '库存管理_补投单_补投单增加',
      param: '人员编号=' + Number + '&仓库流水号=' + house
    }
  })
}
// 补投删除
export function deleteReplacementCard(Number) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '库存管理_补投单_补投单删除',
      param: '补投单流水号=' + Number
    }
  })
}
// 补投删除
export function deleteCardDetail(Number) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '库存管理_补投单_补投单明细删除',
      param: '补投单明细流水号=' + Number
    }
  })
}
// 补投增加
export function addCardDetail(Number, project, machine, team, name, mass, locate, parttype, reason) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '库存管理_零件补投_批量增加补投单明细',
      param: '补投单流水号=' + Number + '&项目流水号组=' + project + '&机床流水号组=' + machine + '&组件流水号组=' + team + '&名称组=' + name + '&数量组=' + mass + '&货位流水号组=' + locate + '&零件类型组=' + parttype + '&原因组=' + reason
    }
  })
}

// 补投单明细查询
export function searchCardDetail(cardNumber) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_仓库补投_补投单明细_查询',
      param: '补投单流水号=' + cardNumber
    }
  })
}
