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

export function projectSelect() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_项目名称_查询数据_按时间排序'
    }
  })
}

export function machineSelect() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_项目名称_查询数据'
    }
  })
}

export function groupSelect(machineValue) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_零件明细表_组件流水号_查询数据_根据机床',
      param: `机床流水号=${machineValue}`
    }
  })
}
export function searchTable5(machineCheck, machine, groupCheck, group, part_check, part) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_零件明细表_外购件和标准件_临时表数据查询',
      param: `机床名字_check=${machineCheck}&机床名字=${machine}&组号_check=${groupCheck}&组号=${group}&物料名称_check=${part_check}&物料名称=${part}`
    }
  })
}
export function searchTable6(machineCheck, machine, groupCheck, group, part_check, part) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_零件明细表_基本件_临时表数据查询',
      param: `机床名字_check=${machineCheck}&机床名字=${machine}&组号_check=${groupCheck}&组号=${group}&零件图号_check=${part_check}&零件图号=${part}`
    }
  })
}
export function basicPartsData(machine_check, machine, group_check, group, part_check, part) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_零件明细表_基本件_查询数据_综合gj_数量维护',
      param: `机床流水号_check=${machine_check}&机床流水号=${machine}&组件流水号_check=${group_check}&组件流水号=${group}&零件图号_check=${part_check}&零件图号=${part}`
    }
  })
}
export function purchasePartsData(machine_check, machine, group_check, num, part_check, part) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_零件明细表_标准件和外购件_查询数据_数量维护',
      param: `机床流水号_check=${machine_check}&机床流水号=${machine}&组件流水号_check=${group_check}&组件流水号=${num}&物料名称_check=${part_check}&物料名称=${part}`
    }
  })
}
export function deleteBasicParts(basicNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'PDM_零件明细表_基本件_删除数据',
      param: `基本件流水号=${basicNum}`
    }
  })
}
export function alldelete(basicNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'PDM_零件明细表_基本件_删除数据_根据组件流水号',
      param: `基本件流水号组=${basicNum}`
    }
  })
}
export function deleteBasicParts5(basicNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'PDM_零件明细表_外购件和标准件_临时表_删除',
      param: `id=${basicNum}`
    }
  })
}
export function alldeleteBasicParts5(machine, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'PDM_零件明细表_外购件和标准件_临时表_全部删除',
      param: `机床=${machine}&组号=${group}`
    }
  })
}
export function deleteBasicParts6(basicNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'PDM_零件明细表_基本件_临时表_删除',
      param: `id=${basicNum}`
    }
  })
}
export function alldeleteBasicParts6(machine, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'PDM_零件明细表_基本件_临时表_全部删除',
      param: `机床=${machine}&组号=${group}`
    }
  })
}
export function deletePurchaseData(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'PDM_零件明细表_标准件和外购件_删除数据',
      param: '标准件和外购件流水号=' + num + '=int'
    }
  })
}
export function alldeleteWB(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'PDM_零件明细表_标准件和外购件_删除数据_根据组件流水号',
      param: '标准件和外购件流水号组=' + num
    }
  })
}
export function editPurchaseData(num, num1, people) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'PDM_零件明细表_标准件和外购件_修改数据',
      param: '标准件和外购件流水号=' + num + '&零件数量=' + num1 + '&修改人员=' + people
    }
  })
}
export function editBasicParts(num, num1, num2, num3, num4, people) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'PDM_零件明细表_基本件_编辑数据',
      param: '基本件流水号=' + num + '&零件数量=' + num1 + '&零件名称=' + num2 + '&零件图号=' + num3 + '&材料=' + num4 + '&修改人员=' + people
    }
  })
}
export function isExitBasicParts(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_零件明细表_基本件_编辑数据_验证图号',
      param: '基本件流水号=' + num + '&零件图号=' + num1
    }
  })
}
export function getTable(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_零件工艺计划_已投产_按组查',
      param: '组件流水号=' + num + '=int'
    }
  })
}
export function editProductNum(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'MRP_计划订单_组件零件清单_基本件_编辑数据',
      param: '组件零件基本件流水号=' + num + '&数量=' + num1
    }
  })
}
export function getTable1(num, a, b, c, d, e, f, g) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_新排产算法_能力平衡_查询数据_要平衡的零件_数量维护',
      param: '机床流水号_check=' + b + '=string&机床流水号=' + c + '=int&组件流水号_check=' + d + '=string&组件流水号=' + e + '=int&零件图号_check=' + f + '=string&零件图号=' + g + '=string&是否查询全部数据=1=string&单件是否外协=1=int&考核状态=5=int'
    }
  })
}
export function editProduceNum(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间生产管理工艺_零件工艺计划_修改数据',
      param: '工艺计划流水号=' + num + '&零件数量=' + num1
    }
  })
}
// 查询表1标准件和外购件
export function searchTable1(...params) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_采购部采购_查询物料_数量维护',
      param: `机床流水号_check=${params[0]}&机床流水号=${params[1]}&组件流水号_check=${params[2]}&组件流水号=${params[3]}&物料状态=1`
    }
  })
}
// 查询表1基本件
export function searchTable2(...params) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_采购部采购_查询物料_基本件_数量维护',
      param: `机床流水号_check=${params[0]}&机床流水号=${params[1]}&组件流水号_check=${params[2]}&组件流水号=${params[3]}&物料状态=1`
    }
  })
}
export function editGroupPartNum(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'MRP_计划订单_组件零件清单_编辑数据',
      param: '组件零件流水号=' + num + '&零件数量=' + num1
    }
  })
}
export function editGroupBasicPartNum(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'MRP_计划订单_组件零件清单_基本件_采购_编辑数据',
      param: '组件零件基本件流水号=' + num + '&零件数量=' + num1
    }
  })
}
export function getmaterial() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '零件明细表_材料_查询'
    }
  })
}
// 查询物料
export function searchAllMaterial(check1, MaterialName, check2, MaterialSpec, check3, MaterialModel, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_物料主文件_基本_查询数据_分页',
      param: `物料名称_check=${check1}&物料名称=${MaterialName}&物料规格_check=${check2}&物料规格=${MaterialSpec}&物料型号_check=${check3}&物料型号=${MaterialModel}&PageCurrent=${pageCurrent}=int&PageSize=${pageSize}=int&PageCount=1=int=output&ItemCount=1=int=output`
    }
  })
}
// 物料变更
export function materialChange(num1, num2, num3, num4, person) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '采购管理_采购物料修改_零件数量维护_修改数据',
      param: `组件零件流水号=${num1}&标准件和外购件流水号=${num2}&原物料流水号=${num3}&新物料流水号=${num4}&申请人=${person}`
    }
  })
}
// 修改组件数量
export function editgroupNum(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'PDM_零件明细表_组件流水号_组件数量_修改数据',
      param: '组件流水号=' + num + '&数量=' + num1
    }
  })
}
