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

export function insertInto(num2, num3, num4, num5, num6, num7, num8, num9) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '外协管理_发票结算申请单_增加数据',
      param: `发票号=${num2}&发票金额=${num3}&外协厂家流水号=${num4}&已付款项=${num5}&尚欠金额=${num6}&税额=${num7}&是否费用类=${num8}&备注=${num9}`
    }
  })
}

// 初始化 外协厂商
export function searchSupplier() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_基础表_外协厂家_查询数据'
    }
  })
}
// 根据条件查发票结算申请单
export function searchTable1(...group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '外协管理_发票结算申请单_查询数据_到票申请',
      param: `发票号_check=${group[0]}&发票号=${group[1]}`,
      Pagination: group[2] + '&' + group[3]
    }
  })
}
// 编辑发票结算申请单
export function submitEdit(...group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '外协管理_发票结算申请单_修改数据',
      param: `发票号=${group[0]}&发票金额=${group[1]}&已付款项=${group[2]}&尚欠金额=${group[3]}&税额=${group[4]}&是否费用类=${group[5]}&备注=${group[6]}&发票结算申请单流水号=${group[7]}`
    }
  })
}
// 删除发票结算申请单
export function submitDelete(...group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '外协管理_发票结算申请单_删除数据',
      param: `发票结算申请单流水号=${group[0]}`
    }
  })
}
// 提交申请 发票结算申请单
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]}&申请人=${group[1]}`
    }
  })
}
// 发票结算申请单明细列表
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 searchPurchase(data) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '外协管理_外协任务_查询数据',
      param: '外协厂家流水号_check=1&外协厂家流水号=' + data
    }
  })
}
// 查询外协明细
export function searchPurchaseDetail(data) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '外协管理_外协任务明细_查询数据',
      param: '外协加工任务单流水号=' + data
    }
  })
}

// 发票结算申请单明细增加
export function addTable2(data, group1, group2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '外协管理_发票结算申请单明细_增加数据',
      param: '发票结算申请单流水号=' + data + '&外协明细流水号组=' + group1 + '&到票数量组=' + group2
    }
  })
}
// 发票结算申请单明细删除
export function deleteTable2(data) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '外协管理_发票结算申请单明细_删除数据',
      param: '发票结算申请单明细流水号=' + data
    }
  })
}
