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

// 初始化项目
export function initProject() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_项目名称_查询数据_按时间排序'
    }
  })
}
// 机床查询
export function searchmachine(check, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_机床名称_查询数据',
      param: '项目流水号_check=' + check + '=int&项目流水号=' + num
    }
  })
}
// 分组查询
export function searchTeam(machineNumber) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_组件名称_查询数据',
      param: '机床流水号=' + machineNumber
    }
  })
}
// 外购件查询
export function searchPurchasePart(pageCurrent, pageSize, project_check, project, machine_check, machine, group_check, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_外购件查询',
      param: '项目流水号_check=' + project_check + '&项目流水号=' + project + '&机床流水号_check=' + machine_check + '&机床流水号=' + machine + '&组件流水号_check=' + group_check + '&组件流水号=' + group,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 外购件入库记录查询
export function searchPurchasePartIn(contractdetail) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_外购件入库记录',
      param: '采购合同明细流水号=' + contractdetail
    }
  })
}
// 外购件出库记录查询
export function searchPurchasePartOut(teampart) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_外购件出库记录',
      param: '采购合同明细流水号=' + teampart
    }
  })
}
// 标准件查询
export function searchStandardPart(pageCurrent, pageSize, project_check, project, machine_check, machine, group_check, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_标准件查询',
      param: '项目流水号_check=' + project_check + '&项目流水号=' + project + '&机床流水号_check=' + machine_check + '&机床流水号=' + machine + '&组件流水号_check=' + group_check + '&组件流水号=' + group,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 标准件入库记录查询
export function searchStandardPartIn(data1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_标准件入库记录',
      param: '采购合同明细流水号=' + data1
    }
  })
}
// 标准件出库记录查询
export function searchStandardPartOut(data1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_标准件出库记录',
      param: '采购合同明细流水号=' + data1
    }
  })
}
// 标准件安全库存修改
export function safeAmount(data1, data2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '库存管理_库存盘点_标准件安全库存修改',
      param: '组件零件流水号=' + data1 + '&安全库存量=' + data2
    }
  })
}

// 采购基本件件查询
export function searchPurchaseBasicPart(pageCurrent, pageSize, project_check, project, machine_check, machine, group_check, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_采购部基本件查询',
      param: '项目流水号_check=' + project_check + '&项目流水号=' + project + '&机床流水号_check=' + machine_check + '&机床流水号=' + machine + '&组件流水号_check=' + group_check + '&组件流水号=' + group,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 基本件查询
export function searchBasicPart(pageCurrent, pageSize, project_check, project, machine_check, machine, group_check, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_基本件查询',
      param: '项目流水号_check=' + project_check + '&项目流水号=' + project + '&机床流水号_check=' + machine_check + '&机床流水号=' + machine + '&组件流水号_check=' + group_check + '&组件流水号=' + group,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 基本件入库记录查询
export function searchBasicPartIn(craftNumber) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_基本件入库记录',
      param: '工艺计划流水号=' + craftNumber
    }
  })
}
// 基本件出库记录查询
export function searchBasicPartOut(craftNumber) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_基本件出库记录',
      param: '工艺计划流水号=' + craftNumber
    }
  })
}
// 通用件查询
export function searchGeneralPart(pageCurrent, pageSize, project_check, project, machine_check, machine, group_check, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_通用件查询',
      param: '项目流水号_check=' + project_check + '&项目流水号=' + project + '&机床流水号_check=' + machine_check + '&机床流水号=' + machine + '&组件流水号_check=' + group_check + '&组件流水号=' + group,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 车间采购基本件查询
export function searchHourseBasicPart(pageCurrent, pageSize, project_check, project, machine_check, machine, group_check, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_车间采购基本件查询',
      param: '项目流水号_check=' + project_check + '&项目流水号=' + project + '&机床流水号_check=' + machine_check + '&机床流水号=' + machine + '&组件流水号_check=' + group_check + '&组件流水号=' + group,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 车间采购外购件查询
export function searchHoursePurchasePart(pageCurrent, pageSize, project_check, project, machine_check, machine, group_check, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_车间采购外购件查询',
      param: '项目流水号_check=' + project_check + '&项目流水号=' + project + '&机床流水号_check=' + machine_check + '&机床流水号=' + machine + '&组件流水号_check=' + group_check + '&组件流水号=' + group,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 车间采购外购件出库记录查询
export function searchShopPurchasePartOut(teampart) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_车间外购件出库记录',
      param: '请购单明细流水号=' + teampart
    }
  })
}
// 车间采购外购件入库记录查询
export function searchShopPurchasePartIn(teampart) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '库存管理_库存盘点_车间外购件入库记录',
      param: '请购单明细流水号=' + teampart
    }
  })
}
// 车间采购库存盘点修改
export function CheckAlter(receive, project, machinenumber, partnumber, oldnumber, reason, number, people, locate, contractdetail, craftnumber, materialType, materiallocate, name, mode, picture, type, material) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '库存管理_库存盘点_修改数量',
      param: '收件信息ID=' + receive + '&项目流水号=' + project + '&机床流水号=' + machinenumber + '&组件流水号=' + partnumber + '&原数量=' + oldnumber + '&修改原因=' + reason + '&数量=' + number + '&人员编号=' + people + '&货位流水号=' + locate + '&采购合同明细流水号=' + contractdetail + '&工艺计划流水号=' + craftnumber + '&零件类型代码=' + materialType + '&物料与货位对照流水号=' + materiallocate + '&名称=' + name + '&规格=' + mode + '&图号=' + picture + '&型号=' + type + '&材料=' + material
    }
  })
}
