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

export function machine() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_序间外协_项目查询'
    }
  })
}
export function getToolNum() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_零件工艺计划_序间外协预算机床查询'
    }
  })
}
// 组号
export function getNum(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_传递后_组件名称_查询数据_查询所有组',
      param: '机床流水号=' + num
    }
  })
}
// 查询（未编制）
export function searchPartNum1(num1, num2, num3, num4, num5, num6, num7, num8, num9, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_零件工艺计划_查询序间外协零件_价格预算_new',
      param: '项目流水号_check=' + num1 + '&项目流水号=' + num2 + '&机床流水号_check=' + num3 + '&机床流水号=' + num4 + '&组件流水号_check=' + num5 + '&组件流水号=' + num6 + '&零件图号_check=' + num7 + '&零件图号=' + num8 + '&预算状态=' + num9,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 查询零件工艺
export function searchTable(num, outHelp) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_零件工序_查询数据_根据工艺计划流水号_新',
      param: '工艺计划流水号=' + num + '&单件是否外协=' + outHelp
    }
  })
}
// 保存重量面积
export function saveWeightArea(num, weight, area) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间生产管理工艺_零件工艺计划_修改数据_重量面积',
      param: '工艺计划流水号=' + num + '&重量=' + weight + '&面积=' + area
    }
  })
}
// 保存材料费
export function saveMaterialPrice(num, price) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间生产管理工艺_零件工艺计划_修改数据_材料费',
      param: '工艺计划流水号=' + num + '&材料费=' + price
    }
  })
}
// 保存每行价格
export function saveRowPrice(num1, price1, num2, price2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间生产管理工艺_零件工序_修改数据_序间外协预算价格_系数',
      param: '工序流水号=' + num1 + '&外协预算价格=' + price1 + '&工艺计划流水号=' + num2 + '&材料费=' + price2
    }
  })
}
