import request from "@/utils/request";

// 创建物料
export function createMaterial(data) {
    return request({
        url: "/rtkerp/material/create",
        method: "post",
        data: data,
    });
}

// 更新物料
export function updateMaterial(data) {
    return request({
        url: "/rtkerp/material/update",
        method: "put",
        data: data,
    });
}

// 删除物料
export function deleteMaterial(id) {
    return request({
        url: "/rtkerp/material/delete?id=" + id,
        method: "delete",
    });
}

// 获得物料
export function getMaterial(id) {
    return request({
        url: "/rtkerp/material/get?id=" + id,
        method: "get",
    });
}

// 获得物料分页
export function getMaterialPage(query) {
    return request({
        url: "/rtkerp/material/page",
        method: "get",
        params: query,
    });
}

// 导出物料 Excel
export function exportMaterialExcel(query) {
    return request({
        url: "/rtkerp/material/export-excel",
        method: "get",
        params: query,
        responseType: "blob",
    });
}
// 获取物料编码下拉列表--iqc
export function getMaterialDropDownList(query) {
    return request({
        url: "/rtkerp/material/dropDownList",
        method: "get",
        params: query,
    });
}

// 获取物料编码下拉列表--ipqc
export function getMaterialDropDownListOfIpqc(query) {
    return request({
        url: "/mes/material/page",
        method: "get",
        params: query,
    });
}

// 获取物料列表
export function getMaterialList(query) {
    return request({
        url: "/rtkerp/material/materialList",
        method: "get",
        params: query,
    });
}
// 根据标签码获取物料信息
export function getQrQodeMSG(query) {
    return request({
        url: "/rtkwms/entrustedReturnDetail/getInfoByQrCode",
        method: "get",
        params: query,
    });
}
// 获取受托加工材料退料单列表
export function getOutSourceReturnPage(query) {
    return request({
        url: "/rtkwms/entrustedReturnDetail/getEntrustedReturnDetailPage",
        method: "get",
        params: query,
    });
}

// 创建受托加工材料退料
export function createOutSourceReturnPage(data) {
    return request({
        url: "/rtkwms/entrustedReturnDetail/submit",
        method: "post",
        data,
    });
}