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: '考核部门编号=9'
    }
  })
}
// 初始化 工序分类
export function initprocessNameClass() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间装配管理_工序分类_查询数据'
    }
  })
}
// 初始化 机床分类
export function initmachineType() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间装配管理_机床分类_查询数据'
    }
  })
}
// 查询机床编号
export function SearchMachine(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间装配管理_典型机床_查询数据',
      param: '机床分类流水号=' + num
    }
  })
}
// 查询工序名称
export function initProcessName(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间装配管理_工序名称_查询数据',
      param: '工序分类流水号=' + num
    }
  })
}
// 查询机床
export function searchMachine(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间装配管理_机床编号_查询数据',
      param: '人员编号=' + num + '&是否编制=' + num1
    }
  })
}
// 查询组件
export function searchGroup(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间装配管理_组件名称_查询数据',
      param: '机床流水号=' + num
    }
  })
}
// 查询组件工艺
export function searchDetail(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间装配管理_组件工艺_查询数据',
      param: '机床流水号=' + num
    }
  })
}
// 增加组件工艺
export function submitAdd(machineNumberValue, SerialNumber, Group, AssemblyTask, GroupNumberValue1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_组件工艺_增加数据',
      param: '机床流水号=' + machineNumberValue + '&序号=' + SerialNumber + '&组号=' + Group + '&装配任务=' + AssemblyTask + '&组件流水号=' + GroupNumberValue1
    }
  })
}
// 编辑组件工艺
export function submitEdit(GroupProcessNumber, SerialNumber, Group, AssemblyTask, GroupNumberValue1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_组件工艺_编辑数据',
      param: '组件工艺流水号=' + GroupProcessNumber + '&序号=' + SerialNumber + '&组号=' + Group + '&装配任务=' + AssemblyTask + '&组件流水号=' + GroupNumberValue1
    }
  })
}
// 删除组件工艺
export function deleteGroup(GroupProcessNumber) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_组件工艺_删除数据',
      param: '组件工艺流水号=' + GroupProcessNumber
    }
  })
}
// 查询工序
export function searchProcess(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间装配管理_装配工序_查询数据',
      param: '组件工艺流水号=' + num
    }
  })
}
// 增加工序
export function insertOne(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_装配工序_增加数据',
      param: '组件工艺流水号=' + num
    }
  })
}
// 编辑工序
export function update(num, num1, num2, num3, num4) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_装配工序_编辑数据',
      param: '装配工序流水号=' + num + '&序号=' + num1 + '&工序名称=' + num2 + '&工艺内容及装配具体要求=' + num3 + '&质检=' + num4
    }
  })
}
// 编辑工序1
export function update1(num, num1, num2, num3) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_装配工序_编辑数据',
      param: '装配工序流水号=' + num + '&序号=' + num1 + '&工序名称=' + num2 + '&工艺内容及装配具体要求=' + num3
    }
  })
}
// 上移
export function upOne(num, num1, num2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_装配工序_上移',
      param: '装配工序流水号=' + num + '&组件工艺流水号=' + num1 + '&工序顺序=' + num2
    }
  })
}
// 下移
export function downOne(num, num1, num2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_装配工序_下移',
      param: '装配工序流水号=' + num + '&组件工艺流水号=' + num1 + '&工序顺序=' + num2
    }
  })
}
// 删除工序
export function deleteOne(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_装配工序_删除数据',
      param: '装配工序流水号=' + num
    }
  })
}
// 保存
export function saveApprove(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
    }
  })
}
// 工艺删除
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 processCopy1(machineNumberValue, SerialNumber, Group, AssemblyTask) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_已完组件工艺_增加数据',
      param: '机床流水号=' + machineNumberValue + '&序号=' + SerialNumber + '&组号=' + Group + '&装配任务=' + AssemblyTask + '&组件工艺流水号=10=int=output'
    }
  })
}
// 增加已完装配工序 工艺拷贝
export function procedureCopy1(GroupNum, SerialNumberGroup, ProcedureNameGroup, ProcessContentGroup, QualityTesting, ProcessSequence) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_已完装配工序_增加数据',
      param: '组件工艺流水号=' + GroupNum + '&序号=' + SerialNumberGroup + '&工序名称=' + ProcedureNameGroup + '&工艺内容及装配具体要求=' + ProcessContentGroup + '&质检=' + QualityTesting + '&工序顺序=' + ProcessSequence
    }
  })
}
