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

// 初始化项目
export function initProject() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_项目名称_查询数据_按时间排序'
    }
  })
}
// 机床查询
export function searchMachine(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_机床名称_查询数据',
      param: '项目流水号_check=1&项目流水号=' + num
    }
  })
}
// 分组查询
export function searchGroup(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_组件名称_查询数据',
      param: '机床流水号=' + num
    }
  })
}
// 初始化项目金额统计表
export function searchReceiveCheck(check1, num1, check2, num2, check3, num3, check4, num4, pageCurrent, pageSize, order, partName) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_领用核算_查询数据',
      param: `项目流水号_check=${check1}&项目流水号=${num1}&机床流水号_check=${check2}&机床流水号=${num2}&组件流水号_check=${check3}&组件流水号=${num3}&机床号物料名称_check=${check4}&机床号物料名称=${num4}&PageCurrent=${pageCurrent}=int&PageSize=${pageSize}=int&排序方式=${order}=int&排序名称=${partName}=int&PageCount=1=int=output&ItemCount=1=int=output`
    }
  })
}
export function searchsum(check1, num1, check2, num2, check3, num3, check4, num4) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_领用核算_查询数据_合计',
      param: `项目流水号_check=${check1}&项目流水号=${num1}&机床流水号_check=${check2}&机床流水号=${num2}&组件流水号_check=${check3}&组件流水号=${num3}&机床号物料名称_check=${check4}&机床号物料名称=${num4}`
    }
  })
}

// 机床名称
export function getMachines() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_机床名称_查询数据_查询全部'
    }
  })
}
