import request from "@/utils/request";
import axios from "axios";
const baseURL = process.env.VUE_APP_REPORT_API;

// 创建WMS 入库业务-来料登记主
export function createIncomingReceipt(data) {
  return request({
    url: "/rtkwms/incoming-receipt/create",
    method: "post",
    data: data,
  });
}

// 获得WMS 入库业务-来料登记主分页
export function getIncomingReceiptPage(query) {
  return request({
    url: "/rtkwms/incoming-receipt/page",
    method: "get",
    params: query,
  });
}
// 通过批次查看标签数据(补打)分页---挑选
export function getLabelPrintDataDetail(query) {
  return request({
    url: "/rtkwms/incoming-receipt/labelPrintDataDetail",
    method: "get",
    params: query,
  });
}
// 通过批次查看标签数据(补打)分页---来料登记
export function getIncomingLabelPrintDetail(query) {
  return request({
    url: "/rtkwms/incoming-receipt/incomingLabelPrintDetail",
    method: "get",
    params: query,
  });
}
// 获得标签打印数据
export function getLabelPrintData(query) {
  return request({
    url: "/rtkwms/incoming-receipt/labelPrintData",
    method: "get",
    params: query,
  });
}
// 获得来料登记标签打印数据
export function getRegisterMaterialLabelPrintData(query) {
  return axios({
    url: baseURL + "/report/wms-print/labelPrintData",
    method: "get",
    params: query,
  });
}

// 获得批量打印的数据
export function getBatchLabelPrintData(query) {
  return request({
    url: "/rtkwms/label-master/labelPrintDataBatch",
    method: "get",
    params: query,
  });
}
// export function getBatchLabelPrintData (query) {
//   return request({
//     url: '/rtkwms/incoming-receipt/labelPrintData',
//     method: 'get',
//     params: query
//   })
// }

// 收料类别下拉列表查询
export function getCustomerPage(query) {
  return request({
    url: "/rtkerp/customer/page",
    method: "get",
    params: query,
  });
}

// 来料登记扫供应商标签
export function getSupplierData(query) {
  return request({
    url: "/rtkwms/label-master-supplier/receiptShowData",
    method: "get",
    params: query,
  });
}

// 导出WMS 入库业务-来料登记主 Excel
export function exportIncomingReceiptExcel(query) {
  return request({
    url: "/rtkwms/incoming-receipt/export-excel",
    method: "get",
    params: query,
    responseType: "blob",
  });
}
// 删除WMS 入库业务-来料登记主分页
export function deleteIncomingReceipt(id) {
  return request({
    url: "/rtkwms/incoming-receipt/delete?id=" + id,
    method: "delete",
  });
}

// 完成挑选 /wms/label-master/updateBatch
export function updateBatchChoice(data) {
  return request({
    url: "/rtkqms/incoming-receipt-inspection/updateNoPassType",
    method: "put",
    data: data,
  });
}

// 校验来料是否过保质期
export function validateIsQuality(data) {
  return request({
    url: "/rtkwms/incoming-receipt/validateQuality",
    method: "post",
    data: data,
  });
}

// 获取供应商下拉列表
export function getSupplierList(query) {
  return request({
    url: "/rtkerp/supplier/page",
    method: "get",
    params: query,
  });
}

// 获取部门下拉列表
export function getDepartmentList(query) {
  return request({
    url: "/rtkerp/department/page",
    method: "get",
    params: query,
  });
}

// 获取单位下拉列表
export function getUnitPage(query) {
  return request({
    url: "/rtkerp/unit/page",
    method: "get",
    params: query,
  });
}

// 查看上传的附件
export function getFiles(id) {
  return request({
    url: "/rtkwms/incoming-receipt/getFile?id=" + id,
    method: "get",
  });
}

// 获取已上传的附件
export function getFilesById(query) {
  return request({
    url: "/minio/files/getFileList",
    method: "get",
    params: query,
  });
}

// 根据物料批次获取来料登记表头表体
export function getMaterialInfo(query) {
  return request({
    url: "/rtkwms/incoming-receipt/getDetail",
    method: "get",
    params: query,
  });
}
