import request from '@/utils/request'

// 查询外购备料列表
export function initPartDrawing(check1, name) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '备料管理_外购备料_查询数据',
      param: `零件图号_check=${check1}&零件图号=${name}`
    }
  })
}
// 查询外购备料
export function searchPurchasedMaterials(pageCurrent, pageSize, check1, name) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '备料管理_外购备料_查询数据',
      param: `零件图号_check=${check1}&零件图号=${name}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 查询采购单
export function searchPurchaseOrder(pageCurrent, pageSize, check1, num, check2, name) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '备料管理_采购计划_查询数据',
      param: `采购单号_check=${check1}&采购单号=${num}&供应商名称_check=${check2}&供应商名称=${name}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 创建采购单
export function addPurchaseOrder(PurchaseOrderName, supplier, person, date) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '备料管理_采购计划_增加数据',
      param: `采购单名称=${PurchaseOrderName}&采购员=${person}&供应商=${supplier}&计划完成日期=${date}`
    }
  })
}
// 编辑采购单
export function editPurchaseOrder(PurchaseOrderNameValue, PurchaseOrderName, supplier, date) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '备料管理_采购计划_编辑数据',
      param: `采购计划流水号=${PurchaseOrderNameValue}&采购单名称=${PurchaseOrderName}&供应商=${supplier}&计划完成日期=${date}`
    }
  })
}
// 删除采购单
export function deletePurchaseOrder(PurchaseOrderNameValue) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '备料管理_采购计划_删除数据',
      param: `采购计划流水号=${PurchaseOrderNameValue}`
    }
  })
}
// 查询采购计划明细
export function searchMateriel(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '备料管理_采购计划明细_查询数据',
      param: `采购计划流水号=${num}`
    }
  })
}
// 增加采购计划明细
export function addMateriel(num1, num2) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '备料管理_采购计划明细_增加数据',
      param: `采购计划流水号=${num1}&工艺计划流水号组=${num2}`
    }
  })
}
// 保存采购计划明细
export function saveMateriel(num1, num2, num3, num4) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '备料管理_采购计划明细_保存数据',
      param: `采购计划流水号=${num1}&采购计划明细流水号组=${num2}&单位组=${num3}&备注组=${num4}`
    }
  })
}
// 删除采购计划明细
export function deleteMateriel(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '备料管理_外购备料_移出数据',
      param: `采购计划明细流水号=${num}&工艺计划流水号=${num1}`
    }
  })
}
// 查询供应商
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: {
      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
    }
  })
}
