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

// 查询审批/付款
export function initApproval(pageCurrent, pageSize, state2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_采购合同_审批付款_查询数据',
      param: `审批_付款状态=${state2}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
export function initApprovalOutsourcing(pageCurrent, pageSize, state2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '外协管理_审批付款_查询数据',
      param: `审批_付款状态=${state2}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 执行审批/付款
export function execApproval(num1, num2, reason, person, state2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理_采购合同_审批付款_修改数据',
      param: `采购合同请款流水号=${num1}&审批_付款情况流水号=${num2}&未通过原因=${reason}&操作员编号=${person}&审批_付款状态=${state2}`
    }
  })
}
// 查询车间合同审批/付款
export function initApproval1(pageCurrent, pageSize, state2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_采购合同_审批付款_查询数据',
      param: `审批_付款状态=${state2}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
export function searchRequsetFundDetail3(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_采购合同_请款明细_查询数据',
      param: `采购合同请款流水号=${num}`
    }
  })
}
export function searchRequsetFundDetail4(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '外协管理_外协任务_请款明细_查询数据',
      param: `外协任务请款流水号=${num}`
    }
  })
}
// 执行车间合同审批/付款
export function execApproval1(num1, num2, reason, person, state2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理_采购合同_审批付款_修改数据',
      param: `采购合同请款流水号=${num1}&审批_付款情况流水号=${num2}&未通过原因=${reason}&操作员编号=${person}&审批_付款状态=${state2}`
    }
  })
}
// 查询离线合同审批/付款
export function initApprovalOffline(pageCurrent, pageSize, state2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_离线合同_审批付款_查询数据',
      param: `审批_付款状态=${state2}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
export function searchRequsetFundDetail(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_采购合同_请款明细_查询数据',
      param: `采购合同请款流水号=${num}`
    }
  })
}
// 执行审批/付款（离线合同）
export function execApprovalOffline(num1, num2, reason, person, state2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理_离线合同_审批付款_修改数据',
      param: `离线合同请款流水号=${num1}&审批_付款情况流水号=${num2}&未通过原因=${reason}&操作员编号=${person}&审批_付款状态=${state2}`
    }
  })
}
// 查询采购计划待请款信息
export function searchRequsetFundDetail1(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_请款明细_查询数据',
      param: `采购计划请款流水号=${num}`
    }
  })
}
// 查询备料审批/付款
export function initApprovalMaterials(pageCurrent, pageSize, state2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_审批付款_查询数据',
      param: `审批_付款状态=${state2}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 执行审批/付款（备料）
export function execMaterials(num1, num2, reason, person, state2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_审批付款_修改数据',
      param: `采购计划请款流水号=${num1}&审批_付款情况流水号=${num2}&未通过原因=${reason}&操作员编号=${person}&审批_付款状态=${state2}`
    }
  })
}
// 执行审批/付款（外协）
export function execOutsourcing(num1, num2, reason, person, state2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '外协管理_审批付款_修改数据',
      param: `外协任务请款流水号=${num1}&审批_付款情况流水号=${num2}&未通过原因=${reason}&操作员编号=${person}&审批_付款状态=${state2}`
    }
  })
}
// 采购合同明细查询
export function searchTable2(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间管理_车间采购_合同请款_采购件查询',
      param: '采购合同流水号=' + num
    }
  })
}
// 采购合同明细查询
export function searchTable3(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_采购合同明细_成组采购_查询数据',
      param: '采购合同流水号=' + num
    }
  })
}
// 查询任务单明细
export function getParts(Number) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_外协任务执行_外协加工任务单明细_查询数据',
      param: '外协加工任务单流水号=' + Number
    }
  })
}
// 发票明细查询
export function searchInvoiceDetail(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_发票明细_查询数据',
      param: '发票流水号=' + num
    }
  })
}
// 查询采购计划明细
export function searchTable5(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_到货单明细查询_新',
      param: `到货单流水号=${num}`
    }
  })
}
export function searchTable6(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_关联材料_查询数据_新',
      param: `到货单明细流水号=${num1}`
    }
  })
}
// 查询采购计划明细
export function searchMateriel(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_采购计划明细_查询数据',
      param: `采购计划流水号=${num}`
    }
  })
}
// 查询材料
export function searchMX(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_离线采购计划明细_查询数据',
      param: '离线采购计划流水号=' + num
    }
  })
}
