import { doFetch } from "@/utils/doFetch";
import { message } from "antd";

// 待入库任务
export function getInstoreData(params) {
  return doFetch({
    url: "/ngic-statistics/board/queryDealMaterieInstore",
  }).then((res) => {
    if (res.code == "0000") {
      return res?.data?.dataList;
    } else {
      message.error(res.msg);
    }
  });
}

// 待出库任务
export function getOutstoreData(params) {
  return doFetch({
    url: "/ngic-statistics/board/queryDealMaterieOutstore",
  }).then((res) => {
    if (res.code == "0000") {
      return res?.data?.dataList;
    } else {
      message.error(res.msg);
    }
  });
}

// 库容监控
export async function getStationMonitor(params) {
  await doFetch({ url: "/ngic-statistics/board/queryMonitor" }).then((res) => {
    if (res.code == "0000") {
      return res?.data?.dataList;
    } else {
      message.error(res.msg);
      return [];
    }
  });
}

// 库存统计
export function getStationStatistics(params) {
  return doFetch({
    url: "/ngic-statistics/board/queryInventoryStatistics",
  }).then((res) => {
    if (res.code == "0000") {
      return res?.data?.dataList;
    } else {
      message.error(res.msg);
    }
  });
}

// 出入库条数
export function getInOutstoreNum(params) {
  return doFetch({
    url: "/ngic-statistics/board/queryInOutstoreNum",
  }).then((res) => {
    if (res.code == "0000") {
      return res?.data?.dataList;
    } else {
      message.error(res.msg);
    }
  });
}
// 出入库重量
export function getInOutstoreWeight(params) {
  return doFetch({
    url: "/ngic-statistics/board/queryInOutstoreWeight",
  }).then((res) => {
    if (res.code == "0000") {
      return res?.data?.dataList;
    } else {
      message.error(res.msg);
    }
  });
}
// 实时库存数量
export function queryRealityWeight(params) {
  return doFetch({
    url: "/ngic-statistics/board/queryRealityWeight",
  }).then((res) => {
    if (res.code == "0000") {
      return res?.data;
    } else {
      message.error(res.msg);
    }
  });
}
// 库存监控
export function queryMonitor(params) {
  return doFetch({
    url: "/ngic-statistics/board/queryMonitor",
  }).then((res) => {
    if (res.code == "0000") {
      return res?.data?.dataList;
    } else {
      message.error(res.msg);
    }
  });
}
// 库存信息数据
export function queryStore(params) {
  return doFetch({
    url: "/ngic-statistics/board/queryStore",
  }).then((res) => {
    if (res.code == "0000") {
      return res?.data;
    } else {
      message.error(res.msg);
    }
  });
}
