import request from '@/utils/request'

export function projectSelect() {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_项目名称_查询数据_按时间排序'
    }
  })
}
export function getReciptData(projectNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_装箱单_总单据_查询数据',
      param: `项目流水号=${projectNum}`
    }
  })
}
export function insertReciptData(num, time, name, address, tel, contact, projectNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_装箱单_总单据_增加数据',
      param: `装箱单号=${num}&发货节点=${time}&名称=${name}&收货单位=${address}&联系方式=${tel}&联系人=${contact}&项目流水号=${projectNum}`
    }
  })
}

export function updateReciptData(num, time, name, address, tel, contact, projectNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_装箱单_总单据_修改数据',
      param: `装箱单号=${num}&发货节点=${time}&名称=${name}&收货单位=${address}&联系方式=${tel}&联系人=${contact}&装箱单编号=${projectNum}`
    }
  })
}

export function deleteReciptData(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_装箱单_总单据_删除数据',
      param: `装箱单编号=${num}`
    }
  })
}

export function getMachineData(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_装箱单_主机_查询数据',
      param: `装箱单编号=${num}`
    }
  })
}

export function deleteMachineData(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_装箱单_主机_删除数据',
      param: `序号=${num}`
    }
  })
}

export function addMachineData(projectName, machine, remark, number, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_装箱单_主机_增加数据',
      param: `项目=${projectName}&机床号=${machine}&数量=${number}&备注=${remark}&装箱单编号=${num}`
    }
  })
}

export function updateMachineData(No, number, remark) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_装箱单_主机_修改数据',
      param: `序号=${No}&数量=${number}&备注=${remark}`
    }
  })
}

export function getGroupData(machine) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_装箱单_机床所属部件_查询数据',
      param: `机床流水号=${machine}`
    }
  })
}

export function editGroupData(num, num1, num2, num3, num4, num5) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_装箱单_部件_编辑数据',
      param: `部件编号=${num}&代号=${num1}&名称=${num2}&规格=${num3}&数量=${num4}&备注=${num5}`
    }
  })
}

export function deleteGroupData(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_装箱单_部件_删除数据',
      param: `部件编号=${num}`
    }
  })
}

export function machineSelect(projectValue) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_机床名称_查询数据2',
      param: `项目流水号=${projectValue}`
    }
  })
}

export function getFileData(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_装箱单_随机技术文件_查询数据',
      param: `装箱单编号=${num}`
    }
  })
}

export function deleteFileData(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_装箱单_随机技术文件_删除数据',
      param: `文件编号=${num}`
    }
  })
}

export function editFileData(name, number, remark, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_装箱单_随机技术文件_修改数据',
      param: `名称=${name}&数量=${number}&备注=${remark}&文件编号=${num}`
    }
  })
}

export function addFileData(name, number, remark, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_装箱单_随机技术文件_增加数据',
      param: `名称=${name}&数量=${number}&备注=${remark}&装箱单编号=${num}`
    }
  })
}

export function getSpareData(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: 'PDM_装箱单_备件_查询数据',
      param: `项目流水号=${num}&机床流水号=${num1}`
    }
  })
}

export function deleteSpareData(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_装箱单_备件_删除数据',
      param: `备件编号=${num}`
    }
  })
}

export function editSpareData(MapNumber, name, specification, unit, number, remark, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_装箱单_备件_修改数据',
      param: `图号=${MapNumber}&名称=${name}&规格=${specification}&数量=${number}&单位=${unit}&备注=${remark}&备件编号=${num}`
    }
  })
}

export function addSpareData(MapNumber, name, specification, unit, number, remark, num, num1, num2) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: 'PDM_装箱单_备件_增加数据',
      param: `图号=${MapNumber}&名称=${name}&规格=${specification}&数量=${number}&单位=${unit}&备注=${remark}&装箱单编号=${num}&项目流水号=${num1}&机床流水号=${num2}`
    }
  })
}
