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: '车间装配管理_装配MES_机床编号_查询数据'
    }
  })
}
export function initProjectNew(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 searchTable(check, machineNumberValue, check1, startTime, endTime, check2, stateValue, check3, workerValue) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间管理_装配任务_MES_查询数据',
      param: '机床流水号_check=' + check + '&机床流水号=' + machineNumberValue + '&时间段_check=' + check1 + '&开始时间=' + startTime + '&结束时间=' + endTime + '&状态_check=' + check2 + '&状态=' + stateValue + '&人员_check=' + check3 + '&人员=' + workerValue
    }
  })
}
export function searchTableALL(check, machineNumberValue, check1, startTime, endTime, check2, stateValue, check3, workerValue, role, personnel) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间管理_装配任务_MES_查询数据_全部',
      param: '机床流水号_check=' + check + '&机床流水号=' + machineNumberValue + '&时间段_check=' + check1 + '&开始时间=' + startTime + '&结束时间=' + endTime + '&状态_check=' + check2 + '&状态=' + stateValue + '&人员_check=' + check3 + '&人员=' + workerValue + '&角色编号=' + role + '&人员编号=' + personnel
    }
  })
}
// 获取分配后装配人员
export function searchName(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间管理_装配计划_装配工_查询数据',
      param: '计划流水号=' + num
    }
  })
}
export function ComponentStateUpdate() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间管理_工作计划_执行计划',
      param: '计划流水号=' + arguments[0] + '&是否工作=' + arguments[1] + '&考勤编号=' + arguments[2]
    }
  })
}
export function submitSuspend() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间管理_工作计划_暂停计划',
      param: '计划流水号=' + arguments[0] + '&是否暂停=' + arguments[1]
    }
  })
}
// 获取装配人员
export function searchPeople() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '人事档案管理_人员_部门与人员_查询数据_根据部门编号',
      param: '考核部门编号=11'
    }
  })
}
export function submitRework() {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '车间装配管理_装配任务_返工',
      param: '计划流水号=' + arguments[0] + '&返工原因=' + arguments[1] + '&返工工时=' + arguments[2]
    }
  })
}
export function searchReworkMX(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '车间装配管理_装配任务_返工记录_查询',
      param: '计划流水号=' + num
    }
  })
}
export function searchProcess(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '车间装配管理_装配工艺_查询',
      param: '计划流水号=' + num
    }
  })
}
export function submitRemark(num, remark) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '车间装配管理_装配工艺_备注编辑',
      param: '计划流水号=' + num + '&备注=' + remark
    }
  })
}
