import request from "@/api/request";
import type { LotTraceOrderData, LotTraceOrderQuery } from "./model";
import type { ID } from "@/api/common";

// 查询随工单列表
export function listLotTraceOrder(params: LotTraceOrderQuery) {
  return request({
    url: "/mes/lot-trace-order/list",
    method: "get",
    params,
  });
}

// 高级查询随工单列表
export function advListLotTraceOrder(params: LotTraceOrderQuery) {
  return request({
    url: "/mes/lot-trace-order/advList",
    method: "get",
    params,
  });
}

// 查询随工单详细
export function getLotTraceOrder(id: ID) {
  return request({
    url: "/mes/lot-trace-order/" + id,
    method: "get",
  });
}

// 新增随工单
export function addLotTraceOrder(data: LotTraceOrderData) {
  return request({
    url: "/mes/lot-trace-order",
    method: "post",
    data,
  });
}

// 修改随工单
export function updateLotTraceOrder(data: LotTraceOrderData) {
  return request({
    url: "/mes/lot-trace-order",
    method: "put",
    data,
  });
}

// 删除随工单
export function delLotTraceOrder(id: ID) {
  return request({
    url: "/mes/lot-trace-order/" + id,
    method: "delete",
  });
}

// 关闭随工单
export function closeLotTraceOrder(id: ID) {
  return request({
    url: "/mes/lot-trace-order/close/" + id,
    method: "put",
  });
}
