import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { OrdersQuery } from "./types";

//首页涉及相关api（获取未完成任务、扫码开工）
/**
 * 获取未完成任务
 *
 * @param data
 */
export function getOrders(data: any) {
  return request(
    {
      url: "/api/v1/plan/workOrder/taskPage",
      method: "post",
      data: data,
    },
    { loadingKey: "getProcessOrders" }
  );
}

export function queryOpsList(data: any) {
  return request(
      {
        url: "/api/v1/plan/workOrder/queryOps",
        method: "post",
        data: data,
      },
  );
}
export function getTaskWorkOrder(data: any) {
  return request(
      {
        url: "/api/v1/plan/workOrder/taskWorkPage",
        method: "post",
        data: data,
      },
      { loadingKey: "getProcessOrders" }
  );
}

/**
 * 扫码开工
 *
 * @param data
 */
export function getScan(data: any) {
  return request({
    url: "/api/v1/process/info/scan",
    method: "post",
    data: data,
  });
}
// 流程叫料
export function callItems(data: any) {
  return request(
    {
      url: "/api/v1/process/vehicleOperation/callItems",
      method: "post",
      data: data,
    },
    { loadingKey: "callItems" }
  );
}
// 设备点检列表查询
export function checkList() {
  return request({
    url: "/api/v1/process/equit/checkList",
    method: "get",
  });
}

// 设备点检提交
export function maintenanceCheck(data: any) {
  return request({
    url: "/api/v1/process/equit/maintenanceCheck",
    method: "post",
    data: data,
  });
}
//通过工单号获取所有工位的类型
export function getStationType(workOrderCode: any) {
  return request({
    url: `/api/v1/plan/task/stationType/${workOrderCode}`,
    method: "get",
  });
}

export function sendMsg(data: any) {
  return request({
    url: `/api/v1/process/info/sendMessage`,
    method: "post",
    data: data,
  });
}

//通过工单检验批次号
export function getJYNum(workOrderCode: any) {
  return request({
    url: `/api/v1/plan/workOrder/checkCode/${workOrderCode}`,
    method: "get",
  });
}

export function sendJYData(data: any) {
  return request({
    url: `/api/v1/plan/workOrder/updateCheckCode`,
    method: "post",
    data: data,
  });
}
//新增暴力抽检查
export function addProcessSeqDestruction(data: any) {
  return request({
    url: `/api/v1/processSeqDestruction/add`,
    method: "post",
    data: data,
  });
}
//获取管号
export function getSeqList(data: any) {
  return request({
    url: `/api/v1/plan/seq/list`,
    method: "post",
    data: data,
  });
}
