import request from "@/utils/request";

// 创建出库申请主
export function createInRequest(data) {
  return request({
    url: "/rtkwms/inout-request/createOutRequestOrder",
    method: "post",
    data: data,
  });
}
// 创建入库申请主
export function createRequest(data) {
  return request({
    url: "/rtkwms/in-request/createInRequestOrder",
    method: "post",
    data: data,
  });
}
// 获得出库申请主
export function getSourceOrder(data) {
  return request({
    url: "/rtkwms/inout-request/getSourceOrder",
    method: "post",
    data: data,
  });
}

// 更新出库申请主
export function updateInRequest(data) {
  return request({
    url: "/rtkwms/inout-request/updateOutRequestOrder",
    method: "put",
    data: data,
  });
}
// 更新入库申请主
export function updateRequest(data) {
  return request({
    url: "/rtkwms/in-request/updateInRequestOrder",
    method: "put",
    data: data,
  });
}

// 提交出库申请
export function commitOutRequest(data) {
  return request({
    url: "/rtkwms/inout-request/commit",
    method: "put",
    data: data,
  });
}

// 提交入库申请
export function commitInRequest(data) {
  return request({
    url: "/rtkwms/in-request/commit",
    method: "put",
    data: data,
  });
}

// 撤销出库申请
export function cancelOutRequest(data) {
  return request({
    url: "/rtkwms/inout-request/cancel",
    method: "put",
    data: data,
  });
}

// 撤销入库申请
export function cancelInRequest(data) {
  return request({
    url: "/rtkwms/in-request/cancel",
    method: "put",
    data: data,
  });
}

// 审核出库申请
export function auditOutRequest(data) {
  return request({
    url: "/rtkwms/inout-request/audit",
    method: "put",
    data: data,
  });
}

// 审核入库申请
export function auditInRequest(data) {
  return request({
    url: "/rtkwms/in-request/audit",
    method: "put",
    data: data,
  });
}

// 反审核出库申请
export function antiAuditOutRequest(data) {
  return request({
    url: "/rtkwms/inout-request/antiAudit",
    method: "put",
    data: data,
  });
}

// 反审核入库申请
export function antiAuditInRequest(data) {
  return request({
    url: "/rtkwms/in-request/antiAudit",
    method: "put",
    data: data,
  });
}

// 删除出库申请主
export function deleteInRequest(id) {
  return request({
    url: "/rtkwms/inout-request/delete?id=" + id,
    method: "delete",
  });
}

// 获得出库申请主
export function getInRequest(id) {
  return request({
    url: "/rtkwms/inout-request/get?id=" + id,
    method: "get",
  });
} // 获得入库申请主
export function getRequest(id) {
  return request({
    url: "/rtkwms/in-request/get?id=" + id,
    method: "get",
  });
}
// 获得仓库列表
export function getStockPage(params) {
  return request({
    url: "/rtkerp/stock/page",
    method: "get",
    params,
  });
}
//获得物料列表
export function getMaterialPage(params) {
  return request({
    url: "/rtkerp/material/page",
    method: "get",
    params,
  });
}
// 获得出库申请主分页
export function getInRequestPage(params) {
  return request({
    url: "/rtkwms/inout-request/page",
    method: "get",
    params,
  });
}
// 导出入库申请主 Excel
export function exportInRequestExcel(params) {
  return request({
    url: "/rtkwms/inout-request/export-excel",
    method: "get",
    params,
    responseType: "blob",
  });
}

export function getDictByOrderType(params) {
  return request({
    url: "/rtkwms/inout-request/getDictByOrderType",
    method: "get",
    params,
  });
}

// 查询供应商列表
export function getSupplierPage(query) {
  return request({
    url: "/rtkerp/supplier/page",
    method: "get",
    params: query,
  });
}

// 查询供应商列表
export function getCustomerPage(query) {
  return request({
    url: "rtkerp/customer/page",
    method: "get",
    params: query,
  });
}

// 获得WMS 仓库 仓库区域分页
export function getStockAreaPage(query) {
  return request({
    url: "/rtkwms/stock-area/page",
    method: "get",
    params: query,
  });
}

// 获得WMS 仓库 仓库货位分页
export function getStockLocationPage(query) {
  return request({
    url: "/rtkwms/stock-location/page",
    method: "get",
    params: query,
  });
}
