import request from "@/utils/request";

// 创建ERP采购订单主
export function createPurchaseOrder(data) {
  return request({
    url: "/rtkwms/purchase-order/create",
    method: "post",
    data: data,
  });
}

// 更新ERP采购订单主
export function updatePurchaseOrder(data) {
  return request({
    url: "/rtkwms/purchase-order/update",
    method: "put",
    data: data,
  });
}

// 删除ERP采购订单主
export function deletePurchaseOrder(id) {
  return request({
    url: "/rtkwms/purchase-order/delete?id=" + id,
    method: "delete",
  });
}

// 获得ERP采购订单主
export function getPurchaseOrder(id) {
  return request({
    url: "/rtkwms/purchase-order/get?id=" + id,
    method: "get",
  });
}

// 获得ERP采购订单主分页
export function getPurchaseOrderPage(query) {
  return request({
    url: "/rtkwms/purchase-order/page",
    method: "get",
    params: query,
  });
}
// 获得采购订单主明细分页
export function getPurchaseOrderMainDetailPage(query) {
  return request({
    url: "/rtkerp/purchase-order-detail/mainDetailPage",
    method: "get",
    params: query,
  });
}
// 获得ERP采购订单主分页
export function getErpTaskData(query) {
  return request({
    url: "/dis/erpTask/erpTaskData",
    method: "get",
    params: query,
  });
}

// 导出ERP采购订单主 Excel
export function exportPurchaseOrderExcel(query) {
  return request({
    url: "/rtkwms/purchase-order/export-excel",
    method: "get",
    params: query,
    responseType: "blob",
  });
}
// 获得ERP采购订单明细分页
export function getPurchaseOrderDetailPage(query) {
  return request({
    url: "/rtkwms/purchase-order-detail/page",
    method: "get",
    params: query,
  });
}

// 导出ERP采购订单明细 Excel
export function exportPurchaseOrderDetailExcel(query) {
  return request({
    url: "/rtkwms/purchase-order-detail/export-excel",
    method: "get",
    params: query,
    responseType: "blob",
  });
}
// 获取未到货的采购订单下拉列表
export function getDropDownList(query) {
  return request({
    url: "/rtkerp/purchase-order/dropDownList",
    method: "get",
    params: query,
  });
}
//委外收料获取源单编号
export function getDropDownList2(query) {
  return request({
    url: "/rtkerp/out-source/dropDownList",
    method: "get",
    params: query,
  });
}
// 供应商确认交期
export function purchaseConfirmTime(data) {
  return request({
    url: "/rtkwms/purchase-order-detail/confirmTime",
    method: "put",
    data: data,
  });
}

// 创建送货通知单
export function createDeliveryOrder(data) {
  return request({
    url: "/rtkwms/delivery-notice/create",
    method: "post",
    data: data,
  });
}
