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

// 获取机床
export function searchMachine(role, personnel) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '机床_查询_营销筛选',
      param: '角色编号=' + role + '&人员编号=' + personnel
    }
  })
}
// 组件查询
export function searchgroup(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_组件名称_查询数据',
      param: '机床流水号=' + num
    }
  })
}
// 查询以投产零件
export function searchtable() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_生产计划_查询零件',
      param: `机床流水号_check=${arguments[0]}&机床流水号=${arguments[1]}&组件流水号_check=${arguments[10]}&组件流水号=${arguments[11]}&零件图号_check=${arguments[2]}&零件图号=${arguments[3]}&投产时间_check=${arguments[4]}&开始时间=${arguments[5]}&结束时间=${arguments[6]}&加急_check=${arguments[7]}`,
      pagination: arguments[8] + '&' + arguments[9]
    }
  })
}
export function repulse(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间生产管理工艺_生产计划_打回零件',
      param: `工艺计划流水号=${num}`
    }
  })
}
export function editNumber(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 gettabledata1(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_追溯加工过程_查询工序',
      param: '工艺计划流水号=' + num + '=int'
    }
  })
}
export function searchTableDetail(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_追溯加工过程_查询_合并情况',
      param: `工艺计划流水号=${num}`
    }
  })
}
