import { postJ, post, get } from "@/utils/request";
import Vue from "vue";

// 投料
export async function feedBatchSave(params) {
  const res = await postJ(Vue.prototype.apiUrl + `/mes/feed/batchSave`, params);
  if (res.code == 0) {
    return res.data;
  }
  return Promise.reject(res.message);
}

// 获取周转车绑定工单信息
export async function getWorkerOrderInfo(turnoverCode) {
  const res = await get(
    Vue.prototype.apiUrl + `/mes/workreport/getWorkerOrderInfo/${turnoverCode}`
  );
  if (res.code == 0) {
    return res.data;
  }
  return Promise.reject(res.message);
}
// pda报工
export async function pdaReport(data) {
  const res = await postJ(
    Vue.prototype.apiUrl + `/mes/workreport/pda/report`,
    data
  );
  if (res.code == 0) {
    return res.data;
  }
  return Promise.reject(res.message);
}
// 报工
export async function workReport(data) {
  const res = await postJ(
    Vue.prototype.apiUrl + `/mes/workreport/report`,
    data
  );
  if (res.code == 0) {
    return res.data;
  }
  return Promise.reject(res.message);
}
// 工序列表
export async function getTaskListById(id) {
  const res = await get(
    Vue.prototype.apiUrl + `/main/produceversion/getTaskListById/${id}`
  );
  if (res.code == 0) {
    return res.data;
  }

  return Promise.reject(res.message);
}
