import request from "@/utils/request";

// 获取物料流转终点，有仓库，也有工位
export function getDestinationList(withStore: number) {
  return request({
    url: `/api/v1/process/circulation/target/${withStore}`,
    method: "get",
  });
}

// 根据仓库获取具体的坐标列表
export function getStoreListByNo(no: string) {
  return request({
    url: `/api/v1/wms/position/list`,
    method: "post",
    data: { houseNo: no },
  });
}

// 扫码料箱获取料箱详情
export function getBoxDetailByLabel(label: string) {
  return request({
    url: `/api/v1/process/circulation/vehicle/${label}`,
    method: "get",
  });
}

// 通过扫码获取物料信息
export function getMaterialInfoByLabel(label: string) {
  return request(
    {
      url: `/api/v1/process/circulation/material`,
      method: "post",
      data: { label },
    },
    { loadingKey: "getMaterialInfoByLabel" }
  );
}

//新增物料流转过程
export function addMaterialFlow(data: any) {
  return request({
    url: `/api/v1/process/circulation/add`,
    method: "post",
    data,
  });
}

//获取物料流转历史记录列表
export function getMaterialFlowHistoryList(data?: any) {
  return request({
    url: `/api/v1/process/circulation/page`,
    method: "post",
    data,
  });
}
