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

// 初始化 工艺员A
export function initCraftmen() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '人事档案管理_人员_部门与人员_查询数据_根据部门编号',
      param: '考核部门编号=20'
    }
  })
}
// 查询 项目
export function getProject(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理工艺_零件工艺计划_项目查询',
      param: '是否制定计划=' + num
    }
  })
}
// 查询 机床
export function getMachine(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理工艺_零件工艺计划_机床查询',
      param: '项目流水号=' + num1 + '&是否制定计划=' + num
    }
  })
}
// 查询 组号
export function getGroup(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理工艺_零件工艺计划_组号查询',
      param: '机床流水号=' + num1 + '&是否制定计划=' + num
    }
  })
}
// 查询 零件号
export function getPartnames1(num, num1, num2, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理工艺_零件工艺计划_零件查询',
      param: '组件流水号=' + num1 + '&是否制定计划=' + num + '&组件类别=' + num2,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 查询 零件工序
export function getProcedure(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理工艺_零件工序_查询工序信息',
      param: '工艺流水号=' + num
    }
  })
}
// 初始化工艺名称
export function processNameClick() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_基础表_工艺分类名称_查询数据'
    }
  })
}
// 工艺名称查询
export function processNameSelect(val) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_基础表_工艺名称_查询数据',
      param: '工艺分类流水号_check=1=bit&工艺分类流水号=' + val + '=int'
    }
  })
}
// 工艺要求查询
export function processRequestSelect(val) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理_基础表_工艺要求_查询数据',
      param: '工艺编号=' + val + '=int'
    }
  })
}
// 初始化公差A
export function initTolerance() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_基础表_公差对照表_查询数据'
    }
  })
}
// 公差查询
export function searchTolerance(val1, val2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_基础表_公差对照表_公差_查询数据',
      param: '输入数值=' + val1 + '&参数=' + val2
    }
  })
}
// 完艺工艺拷贝
export function gongyiCopy(num1, num2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理工艺_零件工序_工艺拷贝_工艺流水号',
      param: '工艺流水号_完成工艺=' + num1 + '=int&工艺流水号_被拷工艺=' + num2 + '=int'
    }
  })
}
// 主界面主表难度等级修改
export function hardEdit(num, hard) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理工艺_零件工序_修改数据_工艺难度等级',
      param: '外购件工序流水号=' + num + '=int&工艺难度等级=' + hard
    }
  })
}
// 主界面主表工艺要求修改
export function requestEdit(num, request0) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理工艺_零件工序_修改数据_工艺要求_根据外购件工序流水号',
      param: '外购件工序流水号=' + num + '=int&工艺要求=' + request0
    }
  })
}
// 主界面主表插入功能
export function insertOne(num0, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理工艺_零件工序_修改数据_工艺流水号和外购件工序流水号',
      param: '工艺流水号=' + num0 + '&外购件工序流水号=' + num1
    }
  })
}
// 主界面主表删除功能
export function deleteOne(num0, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理工艺_零件工序_删除数据_外购件工序流水号',
      param: '工艺流水号=' + num0 + '&外购件工序流水号=' + num1
    }
  })
}
// 主界面主表上移功能
export function upOne(num0, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理工艺_零件工序_修改数据_上移工序',
      param: '工艺流水号=' + num0 + '&外购件工序流水号=' + num1
    }
  })
}
// 主界面主表下移功能
export function downOne(num0, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理工艺_零件工序_修改数据_下移工序',
      param: '工艺流水号=' + num0 + '&外购件工序流水号=' + num1
    }
  })
}
// 核准保存
export function saveApprove(num0, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理工艺_零件工序_增加数据_同时修改工艺计划',
      param: '工艺流水号=' + num0 + '&工艺人员编号=' + num1
    }
  })
}
// 选择工艺要求
export function selectRequest(num0, num1, num2, num3, request0) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理工艺_零件工序_修改数据_根据外购件工序流水号和工艺流水号',
      param: '外购件工序流水号=' + num0 + '&工艺流水号=' + num1 + '&工艺编号=' + num2 + '&工艺顺序=' + num3 + '&工艺要求=' + request0
    }
  })
}
// 删除
export function deleteTable(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理工艺_零件工序_删除零件工艺',
      param: '工艺流水号=' + num
    }
  })
}
// 零件工艺修改
export function returnEdit(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理工艺_工艺调整_修改工艺',
      param: '工艺流水号=' + num
    }
  })
}
