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

// 机床名称
export function getMachines() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '机床名称流水号_查询数据'
    }
  })
}

export function getGroups(stepNumber) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_传递后_组件名称_查询数据_查询所有组',
      param: '机床流水号=' + stepNumber + '=int'
    }
  })
}

// 查询零件
export function searchtable(num1, num2, num3, num4, num5, num6, num7, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_零件工艺计划_编制工艺_备料到货查询',
      param: '机床流水号_check=' + num1 + '&机床流水号=' + num2 + '&组件流水号_check=' + num3 + '&组件流水号=' + num4 + '&零件图号_check=' + num5 + '&零件图号=' + num6 + '&备料到货_check=' + num7,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 外购备料出库
export function change3(Number, code, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间生产管理工艺_自家备料到货更改',
      param: '工序流水号组=' + Number + '&工作者考勤编号=' + code + '&工艺计划流水号组=' + num
    }
  })
}
// 查询零件工艺
export function searchtable2(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_备料打印_查询工序信息',
      param: '工艺计划流水号=' + num1
    }
  })
}
// 完成备料工序
export function handlechange(Number, code) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间生产管理工艺_零件工序_修改数据_工作者',
      param: '工序流水号=' + Number + '&工作者考勤编号=' + code
    }
  })
}
// 查询外购备料零件
export function searchtable3(num, num1, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_外购备料查询',
      param: '零件图号_check=' + num + '&零件图号=' + num1,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 自家备料出库
export function change(Number, code, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间生产管理工艺_备料到货_状态更改',
      param: '工艺计划流水号=' + Number + '&重量=' + code + '&单价=' + num
    }
  })
}
// 外购备料出库
export function change2(Number, code, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间生产管理工艺_外购备料到货更改',
      param: '工序流水号组=' + Number + '&工作者考勤编号=' + code + '&工艺计划流水号组=' + num
    }
  })
}
export function handlechange2(Number, code) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间生产管理工艺_零件工序_修改数据_修改实际完成时间',
      param: '工序流水号=' + Number + '&实际完成时间=' + code
    }
  })
}

// 打回
export function edit(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间生产管理工艺_备料单导出_状态更改',
      param: `工艺计划流水号=${num1}&备料打印=0`
    }
  })
}
