import request from '@/utils/request'

// 查询生产派工列表
export function listProductplan(query) {
  return request({
    url: '/mes/productplan/list',
    method: 'get',
    params: query
  })
}

// 查询生产派工详细
export function getProductplan(planId) {
  return request({
    url: '/mes/productplan/' + planId,
    method: 'get'
  })
}

// 新增生产派工
export function addProductplan(data) {
  return request({
    url: '/mes/productplan',
    method: 'post',
    data: data
  })
}

// 修改生产派工
export function updateProductplan(data) {
  return request({
    url: '/mes/productplan',
    method: 'put',
    data: data
  })
}

// 删除生产派工
export function delProductplan(planId) {
  return request({
    url: '/mes/productplan/' + planId,
    method: 'delete'
  })
}

// 获取派工编号
export function getDispatchCode() {
  return request({
    url: '/mes/productplan/getDispatchCode',
    method: 'get'
  })
}

// 生产工单新增生产派工List
export function orderAddMesProductPlanList(data) {
  return request({
    url: '/mes/productplan/orderAddMesProductPlanList',
    method: 'post',
    data: data
  })
}

// 查询生产派工列表
export function getProductPlan(query) {
  return request({
    url: '/mes/productplan/getProductPlan',
    method: 'get',
    params: query
  })
}

export function uploadFile(data) {
  return request({
    url: '/mes/baseAttachInfo/drawingFileUpload',
    method: 'post',
    timeout: 1000000,//超时时间需要设置的较大，否则容易上传失败
    headers: {
      'Content-Type': 'multipart/form-data'//文件上传需要设置该参数
    },
    data
  })
}

// 获取生产派工图纸List列表
export function getDispatchDrawingList(planId) {
  return request({
    url: '/mes/productplan/drawingList/' + planId,
    method: 'get'
  })
}

// 获取生产派工SOP附件List列表
export function getDispatchSOPAttachList(planId) {
  return request({
    url: '/mes/productplan/SOPAttachList/' + planId,
    method: 'get'
  })
}
