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

// 领料单查询
export function searchList(listNumber_check, listNumber, pageCurrent, pageSize, isCheck) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间装配管理_领料单_领料单查询',
      param: '领料单编号_check=' + listNumber_check + '&领料单编号=' + listNumber + '&是否确认=0',
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 领料单明细查询
export function searchListDetail(listNumber) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间装配管理_领料单_领料单明细查询',
      param: '领料单流水号=' + listNumber
    }
  })
}
// 领料单明细出库
// export function ListDetailOut(listNumber) {
//   return request({
//     url: '',
//     method: 'post',
//     data: {
//       type: '1',
//       name: '车间装配管理_领料单_领料单明细出库',
//       param: '领料单明细流水号=' + listNumber
//     }
//   })
// }
// 交换件查询
export function ExchangeOut(listNumber) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_零件出库_交换件查询',
      param: '领料单流水号=' + listNumber
    }
  })
}
// 滞货件出库
export function backlogPart(...params) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '采购管理_滞货件出库_修改数据',
      param: `领料单明细流水号=${params[0]}&出库数量=${params[1]}&滞货物料与货位对照流水号=${params[2]}`
    }
  })
}
// 外购件零件出库
export function PurchasePart(listNumber, data1, data2, data3, data4, data5, data6) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '库存管理_外购件出库_修改数据',
      param: '领料单明细流水号=' + listNumber + '采购合同明细流水号=' + data1 + '&领用者=' + data2 + '&出库数量=' + data3 + '&货位流水号=' + data4 + '&物料与货位对照流水号=' + data5 + '&备注=' + data6
    }
  })
}
// 基本件零件出库
export function BasicPart(listNumber, data1, data2, data3, data4, data5) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'MES_机加工MES_库存管理_出库模块_出库零件信息_零件出库',
      param: '领料单明细流水号=' + listNumber + '&工艺计划流水号=' + data1 + '&本次出库数量=' + data2 + '&收件信息ID=' + data3 + '&领用人编号=' + data4 + '&出库备注=' + data5
    }
  })
}
// 车间采购件零件出库
export function WorkShopPart(listNumber, data1, data2, data3, data4, data5, data6) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '库存管理_车间采购出库_修改数据',
      param: '领料单明细流水号=' + listNumber + '请购单明细流水号=' + data1 + '&领用者=' + data2 + '&出库数量=' + data3 + '&货位流水号=' + data4 + '&物料与货位对照流水号=' + data5 + '&备注=' + data6
    }
  })
}
// 异常出库
export function ErrorOut(data1, data2, data3, data4, data5, data6, data7, data8, data9, data10, data11, data12) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '零件出库_零件出库_异常出库',
      param: '项目流水号=' + data1 + '&机床流水号=' + data2 + '&组件流水号=' + data3 + '&名称=' + data4 + '&人员编号=' + data5 + '&采购合同明细流水号=' + data6 + '&请购单明细流水号=' + data7 + '&工艺计划流水号=' + data8 + '&货位流水号=' + data9 + '&异常数量=' + data10 + '&异常原因=' + data11 + '&零件类型=' + data12
    }
  })
}
// 交换出库
export function ExchangePartOut(data0, data1, data2, data3, data4, data5) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '库存管理_交换件出库_修改数据',
      param: '交换单流水号=' + data0 + '&采购合同明细流水号=' + data1 + '&领用者=' + data2 + '&出库数量=' + data3 + '&货位流水号=' + data4 + '&备注=' + data5
    }
  })
}
