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

// 查询供应商
export function searchSupplier(check1, value1, check2, value2, check3, value3, check4, value4, check5, value5, check6, value6, check7, value7, check8, value8, check9, value9, check10, value10, check11, value11, check12, value12) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_供应商_查询数据_根据条件',
      param: '供应商名称_check=' + check1 + '&供应商名称=' + value1 + '&企业性质_check=' + check2 + '&企业性质=' + value2 + '&创立日期_check=' + check3 + '&创立日期=' + value3 + '&注册资本_check=' + check4 + '&注册资本=' + value4 + '&税号_check=' + check5 + '&税号=' + value5 + '&电子信箱_check=' + check6 + '&电子信箱=' + value6 + '&地址_check=' + check7 + '&地址=' + value7 + '&帐号_check=' + check8 + '&帐号=' + value8 + '&开户行_check=' + check9 + '&开户行=' + value9 + '&电话号码_check=' + check10 + '&电话号码=' + value10 + '&传真_check=' + check11 + '&传真=' + value11 + '&货期_check=' + check12 + '&货期=' + value12
    }
  })
}
// 创建采购单
export function addPurchaseOrder(PurchaseOrderName, supplier, id, money) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_离线采购计划_增加数据',
      param: `离线采购计划名称=${PurchaseOrderName}&供应商=${supplier}&采购员=${id}&预付款=${money}`
    }
  })
}
// 编辑采购单
export function editPurchaseOrder(PurchaseOrderNameValue, PurchaseOrderName, supplier, money) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_离线采购计划_编辑数据',
      param: `离线采购计划流水号=${PurchaseOrderNameValue}&离线采购计划名称=${PurchaseOrderName}&供应商=${supplier}&预付款=${money}`
    }
  })
}
// 删除采购单
export function deletePurchaseOrder(PurchaseOrderNameValue) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_离线采购计划_删除数据',
      param: `离线采购计划流水号=${PurchaseOrderNameValue}`
    }
  })
}
// 查询采购单
export function searchPurchaseOrder(check1, num, check3, name2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_离线采购计划_查询数据',
      param: `离线采购计划编号_check=${check1}&离线采购计划编号=${num}&供应商流水号_check=${check3}&供应商流水号=${name2}`
    }
  })
}
// 查询材料
export function searchMX(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_离线采购计划明细_查询数据',
      param: '离线采购计划流水号=' + num
    }
  })
}
export function AddMaterial(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 getMachines() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_传递后_机床名称_根据机床查询',
      param: '是否传递=2=int&考核状态=6=int&工艺任务分配状态=2=int&定额任务分配状态=2=int&单件是否外协=1=int'
    }
  })
}

export function getGroups(stepNumber) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_传递后_组件名称_查询数据_查询所有组',
      param: '机床流水号=' + stepNumber + '=int'
    }
  })
}

export function getTable(checkbox_Machine, Machine, checkbox_Group, Group, checkbox_number, number, k, m, ordername, order) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_零件工序_查询数据_已编制工序的全部零件及工序_横向赋值新建存储过程_新',
      param: '项目流水号_check=0=string&机床流水号_check=' + checkbox_Machine + '=string&机床流水号=' + Machine + '=string&组件流水号_check=' + checkbox_Group + '=string&组件流水号=' + Group + '=string&零件图号_check=' + checkbox_number + '=string&零件图号=' + number + '=string&是否查询全部数据=1=string&单件是否外协=1=string&考核状态=6=int&开始时间_check=0&开始时间=' + k + '&结束时间_check=0&结束时间=' + m + '&排序名称=' + ordername + '&排序方式=' + order
    }
  })
}
export function saveWeight(num1, num2, num3, num4) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_离线采购计划明细_编辑数据',
      param: `离线采购计划明细流水号=${num1}&成品尺寸=${num2}&备注=${num3}&数量=${num4}`
    }
  })
}
export function deleteMX(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_离线采购计划明细_移出数据',
      param: `离线采购计划明细流水号=${num1}`
    }
  })
}
