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

export function queryOutSourceDetails(id: object): AxiosPromise<any> {
  return request({
    url: "/api/v1/process/outsource/get/" + id,
    method: "get",
  });
}

export function updateOutSourceApply(params: object): AxiosPromise<any> {
  return request({
    url: "/api/v1/process/outsource/update",
    method: "post",
    data: params,
  });
}

export function queryChildrenInfo(workOrderCode: object): AxiosPromise<any> {
  return request({
    url: "/api/v1/process/info/childrenInfo/" + workOrderCode,
    method: "get",
  });
}

export function traceabilityTabCount(params: object): AxiosPromise<any> {
  return request({
    url: "/api/v1/process/web/traceability/tabCount",
    method: "post",
    data: params,
  });
}

export function updateItemRecord(params: object): AxiosPromise<any> {
  return request({
    url: "/api/v1/processReplace/updateReplaceBatchNo",
    method: "post",
    data: params,
  });
}

export function addProRecord(params: object): AxiosPromise<any> {
  return request({
    url: "/api/v1/proRecord/add",
    method: "post",
    data: params,
  });
}

export function queryProductHandover(params: object): AxiosPromise<any> {
  return request({
    url: "/api/v1/proRecord/queryByType",
    method: "post",
    data: params,
  });
}

export function queryProductHandoverPage(params: object): AxiosPromise<any> {
  return request({
    url: "/api/v1/proRecord/queryByType/page",
    method: "post",
    data: params,
  });
}

export function updateHandoverList(params: object): AxiosPromise<any> {
  return request({
    url: "/api/v1/proRecord/update",
    method: "post",
    data: params,
  });
}

export function exportOperationRecord(queryParams: object) {
  return request({
    url: "/api/v1/proRecord/export",
    method: "post",
    data: queryParams,
    responseType: "arraybuffer",
  });
}
export function exportOperationRecord1(queryParams: object) {
  return request({
    url: "/api/v1/proRecord/export1",
    method: "post",
    data: queryParams,
    responseType: "arraybuffer",
  });
}

export function queryHInfo(id: number) {
  return request({
    url: "/api/v1/handoverDetails/get/" + id,
    method: "get",
  });
}

export function saveOpDetails(queryParams: object) {
  return request({
    url: "/api/v1/handoverDetails/add",
    method: "post",
    data: queryParams,
  });
}
export function queryFormList(queryParams: object) {
  return request({
    url: "/api/v1/proRecord/queryForms",
    method: "post",
    data: queryParams,
  });
}

// 获取工艺中工序分组
export function queryProcessGroup(routeId: string) {
  return request({
    url: `/api/v1/op/routeOperation/groupList/${routeId}`,
    method: "get",
  });
}

// 工艺中工序分组设置
export function saveProcessGroup(params: object) {
  return request({
    url: "/api/v1/op/routeOperation/groupSetting",
    method: "post",
    data: params,
  });
}

export function syncMedias(params: object) {
  return request({
    url: "/api/v1/process/media/syncSeqNo",
    method: "post",
    data: params,
  });
}

export function getLineSortList(ID: any) {
  return request({
    url: `/api/v1/op/routeOperation/lineSortList/${ID}`,
    method: "get",
  });
}

export function setLineSortList(params: any) {
  return request({
    url: `/api/v1/op/routeOperation/lineTagSortSetting`,
    method: "post",
    data: params,
  });
}

export function testData(processId: string, deviceNo: string, pageNo: string) {
  return request({
    url: `/api/v1/testData/get/${processId}/${deviceNo}/${pageNo}`,
    method: "get",
  });
}
