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

// 机床名称
export function getMachines(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 getMachinesStatue(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '3',
      name: ` select COUNT(*) as 是否发货 from [发货管理_发货单明细] left join [发货管理_发货单]
              on [发货管理_发货单].发货单流水号 = [发货管理_发货单明细].发货单流水号 where 机床流水号 = ${num}`
    }
  })
}
// 获取组号
export function getGroups(stepNumber) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_组件状态查询_查询所有组',
      param: '机床流水号=' + stepNumber
    }
  })
}
// 查询零件
export function selectParts(check1, stepNumber, check2, num, check3) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_车间组件完成情况_查询数据',
      param: '组件流水号_check=' + check1 + '&组件流水号=' + stepNumber + '&工艺计划流水号_check=' + check2 + '&工艺计划流水号=' + num + '&显示全部=' + check3
    }
  })
}
// 查询工序
export function selectProcedure(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_零件工序_查询数据_车间组件完成情况',
      param: '工艺计划流水号=' + num
    }
  })
}
