import request from '@/utils/request'

// 初始化 项目名称
export function initProject() {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_项目名称_查询数据_按时间排序'
    }
  })
}

export function isExit(projectNum, machineNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '组件明细表_基本件_导入数据_校验',
      param: `项目流水号=${projectNum}&机床图号=${machineNum}`
    }
  })
}
export function isDrawingNum(projectName, machineNum, groupNum, drawingNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '组件明细表_基本件_导入验证gj',
      param: `项目名称=${projectName}&机床名称=${machineNum}&分组名称=${groupNum}&图号=${drawingNum}`
    }
  })
}
export function update(projectName, machineNum, id, type, drawingNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_零件明细表_基本件_数据导入保存_编辑整改类型',
      param: `项目名称=${projectName}&机床名称=${machineNum}&id=${id}&整改类型=${type}&前图号或者型号=${drawingNum}`
    }
  })
}
export function searchOldParts(projectName, machineNum, drawingNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_零件明细表_整改件_数据关联查询_gj',
      param: `项目名称=${projectName}&机床名称=${machineNum}&图号或者型号=${drawingNum}`
    }
  })
}
export function importBasics(establishment, proofread, review, date, projectName, machineNum, machineName, componentName, componentNum, groupNum, contractNum, totalNum, pageNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '组件明细表_基本件_导入数据gj',
      param: `编制=${establishment}&校对=${proofread}&审核=${review}&日期=${date}&项目=${projectName}&机床=${machineNum}&设备名称=${machineName}&部件名称=${componentName}&部件数量=${componentNum}&组号=${groupNum}&合同编号=${contractNum}&合计页码=${totalNum}&页码=${pageNum}&图号=${drawingNum}&名称=${name}&规格\\=${type}&材料=${material}&备件数量=${spareNum}&装机数量=${useNum}&制造商=${manufacturer}&备注\\=${remarks}&分类码=${classificationCode}`
    }
  })
}

export function importPurcharse(establishment, proofread, review, date, projectName, machineNum, machineName, componentName, componentNum, groupNum, contractNum, totalNum, pageNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '零件明细表_外购件和标准件_导入数据gj',
      param: `编制=${establishment}&校对=${proofread}&审核=${review}&日期=${date}&项目=${projectName}&机床=${machineNum}&设备名称=${machineName}&部件名称=${componentName}&部件数量=${componentNum}&组号=${groupNum}&合同编号=${contractNum}&合计页码=${totalNum}&页码=${pageNum}&图号=${drawingNum}&名称=${name}&规格\\=${type}&材料=${material}&备件数量=${spareNum}&装机数量=${useNum}&制造商=${manufacturer}&备注\\=${remarks}&分类码=${classificationCode}`
    }
  })
}

export function specificationQuery(projectCheck, project, machineCheck, machine, groupCheck, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_零件明细表_基本件_规范数据查询_gj',
      param: `项目名字_check=${projectCheck}&项目名字=${project}&机床名字_check=${machineCheck}&机床名字=${machine}&组号_check=${groupCheck}&组号=${group}`
    }
  })
}
export function specificationQuery1(projectCheck, project, machineCheck, machine, groupCheck, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_零件明细表_整改件_规范数据查询_gj',
      param: `项目名字_check=${projectCheck}&项目名字=${project}&机床名字_check=${machineCheck}&机床名字=${machine}&组号_check=${groupCheck}&组号=${group}`
    }
  })
}
export function specificationQueryWB(projectCheck, project, machineCheck, machine, groupCheck, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_零件明细表_外购件和标准件_规范数据查询_gj',
      param: `项目名字_check=${projectCheck}&项目名字=${project}&机床名字_check=${machineCheck}&机床名字=${machine}&组号_check=${groupCheck}&组号=${group}`
    }
  })
}
export function unSpecificationQuery(projectCheck, project, machineCheck, machine, groupCheck, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_零件明细表_基本件_不规范数据查询_gj',
      param: `项目名字_check=${projectCheck}&项目名字=${project}&机床名字_check=${machineCheck}&机床名字=${machine}&组号_check=${groupCheck}&组号=${group}`
    }
  })
}
export function unSpecificationQuery1(projectCheck, project, machineCheck, machine, groupCheck, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_零件明细表_整改件_不规范数据查询_gj',
      param: `项目名字_check=${projectCheck}&项目名字=${project}&机床名字_check=${machineCheck}&机床名字=${machine}&组号_check=${groupCheck}&组号=${group}`
    }
  })
}
export function unSpecificationQueryWB(projectCheck, project, machineCheck, machine, groupCheck, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_零件明细表_外购件和标准件_不规范数据查询gj',
      param: `项目名字_check=${projectCheck}&项目名字=${project}&机床名字_check=${machineCheck}&机床名字=${machine}&组号_check=${groupCheck}&组号=${group}`
    }
  })
}

export function deleteBasicParts(id) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_零件明细表_基本件_数据导入保存_删除数据gj',
      param: 'id=' + id
    }
  })
}

export function deleteBWParts(id) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_零件明细表_外购件和标准件_数据导入保存_删除数据gj',
      param: 'id=' + id
    }
  })
}

export function getMaterial() {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_零件明细表_材料_名称_查询数据_gj'
    }
  })
}

export function getMaterialWB(pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_零件明细表_物料查询总gj',
      pagination: pageCurrent + '&' + pageSize
    }
  })
}

export function searchMaterialWB(material, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_零件明细表_物料查询gj',
      param: `物料=${material}`,
      pagination: pageCurrent + '&' + pageSize
    }
  })
}

export function updateRow(drawingNum, name, type, materialName, spareNum, useNum, manufacturer, remarks, classificationCode, id, materialNum, partsNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '组件明细表_基本件_导入数据_更新数据_gj',
      param: `图号=${drawingNum}&名称=${name}&规格=${type}&材料=${materialName}&备件数量=${spareNum}&装机数量=${useNum}&制造商=${manufacturer}&备注=${remarks}&分类码=${classificationCode}&id=${id}&材料流水号=${materialNum}&部件数量=${partsNum}`
    }
  })
}

export function updateRowWB(drawingNum, name, type, materialName, spareNum, useNum, manufacturer, remarks, classificationCode, id, materialNum, partsNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '零件明细表_外购件和标准件_导入数据_更新数据_gj',
      param: `图号=${drawingNum}&名称=${name}&规格=${type}&材料=${materialName}&备件数量=${spareNum}&装机数量=${useNum}&制造商=${manufacturer}&备注=${remarks}&分类码=${classificationCode}&id=${id}&物料流水号=${materialNum}&部件数量=${partsNum}`
    }
  })
}
// 查询机床名称
export function searchMachine(project) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_零件明细表_基本件_数据导入保存_机床_查询数据gj',
      param: `项目=${project}`
    }
  })
}
// 查询组号
export function searchGroupNum(project, name) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_零件明细表_基本件_数据导入保存_组号_查询数据gj',
      param: `项目=${project}&机床=${name}`
    }
  })
}
// 查询组号
export function searchGroupNum1(project, name) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_零件明细表_整改件_数据导入保存_组号_查询数据gj',
      param: `项目=${project}&机床=${name}`
    }
  })
}
// 一键删除
export function allDelete(project, machine, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_零件明细表_一键删除',
      param: `项目=${project}&机床=${machine}&组号=${group}`
    }
  })
}
// 传递零件
export function transferMX(num1, name, num2, remark, mark, num3, num4, num5, num7, type, transmit, num6, id, Num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_零件明细表_基本件_大量导入',
      param: '图号或者型号=' + num1 + '&零件名称=' + name + '&零件数量=' + num2 + '&零件备注\\=' + remark + '&标记=' + mark + '&设计者编号=' + num3 + '&组件流水号=' + num4 + '&材料流水号=' + num5 + '&规格\\=' + num7 + '&数据类型=' + type + '&是否传递=' + transmit + '&序号=' + num6 + '&id=' + id + '&备件数量=' + Num
    }
  })
}
// 传递零件
export function transferMX1(num1, name, num2, remark, mark, num3, num4, num5, num7, type, transmit, num6, num8, num9, id, oldId, oldNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_零件明细表_整改件_大量导入',
      param: '图号或者型号=' + num1 + '&零件名称=' + name + '&零件数量=' + num2 + '&零件备注\\=' + remark + '&标记=' + mark + '&设计者编号=' + num3 + '&组件流水号=' + num4 + '&材料流水号=' + num5 + '&规格\\=' + num7 + '&数据类型=' + type + '&是否传递=' + transmit + '&序号=' + num6 + '&分类码=' + num8 + '&整改类型=' + num9 + '&id=' + id + '&前id=' + oldId + '&前图号或者型号=' + oldNum
    }
  })
}
export function transferWG(groupNum, materialNum, totalNum, remarks, mark, designNum, isTransfer, dataType, No, id, Num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_零件明细表_标准件和外购件_大量导入',
      param: `组件流水号=${groupNum}&物料流水号=${materialNum}&零件数量=${totalNum}&备注\\=${remarks}&标记=${mark}&设计者编号=${designNum}&是否传递=${isTransfer}&数据类型=${dataType}&序号=${No}&id=${id}&备件数量=${Num}`
    }
  })
}
export function searchMaterial1(num, name, Specifications) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_零件明细表_标准件和外购件_物料对比',
      param: `图号或者型号=${num}&名称=${name}&规格=${Specifications}`
    }
  })
}
