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

// 初始化机床项目
export function initMachineProject() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_仓库采购_入库记录_机床图号_查询'
    }
  })
}
// 分组查询
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 searchRecord1(check1, project, check2, machine, check3, group, check4, name, check5, spec, check6, model, check7, time1, time2, check8, supplierValue, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: `库存管理_入库记录_采购件_查询数据`,
      param: `项目流水号_check=${check1}&项目流水号=${project}&机床流水号_check=${check2}&机床流水号=${machine}&组件流水号_check=${check3}&组件流水号=${group}&名称_check=${check4}&名称=${name}&规格_check=${check5}&规格=${spec}&图号或型号_check=${check6}&图号或型号=${model}&入库时间_check=${check7}&入库开始时间=${time1}&入库结束时间=${time2}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 查询采购件入库总数量
export function searchRecord2(check1, project, check2, machine, check3, group, check4, name, check5, spec, check6, model, check7, time1, time2, check8, supplierValue) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: `库存管理_入库记录_采购件_查询数据_统计总数量`,
      param: `项目流水号_check=${check1}&项目流水号=${project}&机床流水号_check=${check2}&机床流水号=${machine}&组件流水号_check=${check3}&组件流水号=${group}&名称_check=${check4}&名称=${name}&规格_check=${check5}&规格=${spec}&图号或型号_check=${check6}&图号或型号=${model}&入库时间_check=${check7}&入库开始时间=${time1}&入库结束时间=${time2}`
    }
  })
}
// 查询供应商
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 submitNumber(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '库存管理_入库记录_编辑数据',
      param: '采购入库单号=' + num + '&数量=' + num1
    }
  })
}
export function deletemessage(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '库存管理_入库记录_删除数据',
      param: '采购入库单号=' + num
    }
  })
}
