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

export function getData(check, equipmentName, check1, opName, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '设备管理_设备加工能力_查询数据_设备维护NEW',
      param: '设备名称_check=' + check + '=int&设备名称=' + equipmentName + '&工位_check=' + check1 + '=int&工位=' + opName
      // pagination: pageCurrent + '&' + pageSize
    }
  })
}
export function initProcessing(a = '') {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_基础表_工艺名称_查询数据',
      param: '工艺分类流水号_check=0=int&工艺分类流水号=' + a
    }
  })
}
export function searchProcess(machine) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '设备管理_工艺绑定_查询数据',
      param: '设备流水号=' + machine
    }
  })
}
export function processAdd(machine, processingName, process, timePrice, ability) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '设备管理_工艺绑定_增加数据',
      param: '设备流水号=' + machine + '&工艺名称简称=' + process + '&工艺编号=' + process + '&工时单价=' + timePrice + '&加工能力=' + ability
    }
  })
}
export function addTable(equipmentName, equipmentModel, performance, processingCapacity, workingTimeFactor, processName, processNumber, shift, reorganizationTimeFactor, equipmentNumber, reservedTimeFactor, price, ability, opname) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '设备管理_设备加工能力_增加数据_设备维护New',
      param: '设备名称=' + equipmentName + '&设备型号=' + equipmentModel + '&设备性能指标=' + performance + '&设备加工能力工时=' + processingCapacity + '&设备工时系数=' + workingTimeFactor + '&工艺名称简称=' + processName + '&工艺编号=' + processNumber + '&班次类型=' + shift + '&整改工时系数=' + reorganizationTimeFactor + '&设备编号=' + equipmentNumber + '&预留工时系数=' + reservedTimeFactor + '&工时单价=' + price + '&月设备加工能力=' + ability + '&MES终端号=' + opname + '&已存在=0=int=output'
    }
  })
}
export function editTable(equipmentSerialNumber, equipmentName, equipmentModel, performance, processingCapacity, workingTimeFactor, shift, processCode, reorganizationTimeFactor, equipmentNumber, reservedTimeFactor) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '设备管理_设备加工能力_修改数据_设备维护New',
      param: '设备流水号=' + equipmentSerialNumber + '=int&设备名称=' + equipmentName + '=string&设备型号=' + equipmentModel + '=string&设备性能指标=' + performance + '= string&设备加工能力工时=' + processingCapacity + '=string&设备工时系数=' + workingTimeFactor + '=string&班次类型=' + shift + '=int&工艺属性代码=' + processCode + '=string&整改工时系数=' + reorganizationTimeFactor + '=string&设备编号=' + equipmentNumber + '=string&预留工时系数=' + reservedTimeFactor
    }
  })
}
export function deleteTable(number, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '设备管理_设备加工能力_删除数据_设备维护',
      param: '设备流水号=' + number + '=int' + '&工位号=' + num
    }
  })
}
export function deleteProcess(number, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '设备管理_设备加工能力_删除数据_工艺绑定',
      param: '设备流水号=' + number + '=int' + '&工艺属性代码=' + num
    }
  })
}
export function setUp(time) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间生产管理工艺_新排产算法_设备能力_系数有效时间设定',
      param: '系数有效时间=' + time
    }
  })
}
export function generate() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间生产管理工艺_新排产算法_设备加工能力_生成设备能力表'
    }
  })
}
