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

// 发票查询
export function searchInvoice(pageCurrent, pageSize, check1, num1, check2, supplierName0, num2, num3, num4, num5, num6) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_发票_查询数据',
      param: '发票号_check=' + check1 + '&发票号=' + num1 + '&供应商名称_check=' + check2 + '&供应商名称=' + supplierName0 + '&供应商流水号_check=' + num2 + '&供应商流水号=' + num3 + '&日期_check=' + num4 + '&开始日期=' + num5 + '&结束日期=' + num6,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 发票明细查询
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 addInvoice(time1, money, send, remark, num3, num4, moneyGroup) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_发票_增加数据',
      param: `开票时间=${time1}&开票金额=${money}&发票号=${send}&备注=${remark}&供应商=${num3}&到货单流水号组=${num4}&本次到票金额组=${moneyGroup}`
    }
  })
}
// 发票编辑
export function editInvoice(num1, time1, money, send, remark, num3) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_发票_编辑数据',
      param: `发票流水号=${num1}&开票时间=${time1}&开票金额=${money}&发票号=${send}&备注=${remark}&供应商=${num3}`
    }
  })
}
// 发票删除
export function deleteInvoice(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_发票_删除数据',
      param: '发票流水号=' + num1
    }
  })
}
export function deleteInvoiceMX(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 initPurchase() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_采购计划_查询数据_发票'
    }
  })
}
// 接收人初始化
export function initPerson() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '人事档案管理_人员_部门与人员_查询数据_根据部门编号',
      param: '考核部门编号=9'
    }
  })
}
// 传送人初始化
export function initPerson1() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '人事档案管理_人员_部门与人员_查询数据_根据部门编号',
      param: '考核部门编号=5'
    }
  })
}
// 初始化合同号
export function initContract() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_付款情况_查询数据',
      param: '采购合同流水号_check=0&供应商名称_check=0'
    }
  })
}
// 查询供应商
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 searchArriveOrder(num, num1, num2, num3, num5) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_到货单查询',
      param: `供应商_check=${num}&供应商=${num1}&开始日期_check=${num2}&开始日期=${num3}&结束日期=${num5}`
    }
  })
}
// 关联到货单
export function addMateriel(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 getGongyingshang() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_发票_初始化获取供应商'
    }
  })
}
// 提交申请
export function submitApply(...group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '备料管理_发票_提交申请',
      param: `发票流水号=${group[0]}`
    }
  })
}
// 查询到货单明细
export function searchMX(...group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '备料管理_到货单明细_查询',
      param: `到货单流水号=${group[0]}`
    }
  })
}
