import request from '@/utils/request';

/**
 * 工单发布
 */
export async function release (data) {
  const res = await request.post('/aps/workorder/release', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 工单发布
 */
export async function getDeviceList ({ productionId }) {
  const res = await request.get(`/aps/batchingworkorder/getDeviceList/${productionId}`);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 生产计划添加工单列表
export async function getPlanDeviceList ({ produceVersionId }) {
  const res = await request.get(`/aps/workorder/getDeviceList/${produceVersionId}`);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}