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

// 获取分切打印标签
export function getCuttingPrintBatch(query) {
    return axios({
        method: "get",
        url: baseURL + "/report/print/slittingPrintData",
        params: query,
    });
}

// 创建分切任务单  明细转分切任务单
export function createSlittingOrderMaster(data) {
    return request({
        url: "/rtkwms/slitting-order-master/create",
        method: "post",
        data: data,
    });
}

// 更新分切任务单
export function updateSlittingOrderMaster(data) {
    return request({
        url: "/rtkwms/slitting-order-master/update",
        method: "put",
        data: data,
    });
}

// 删除分切任务单
export function deleteSlittingOrderMaster(id) {
    return request({
        url: "/rtkwms/slitting-order-master/delete?id=" + id,
        method: "delete",
    });
}

// 删除分切后规格
export function deleteSlitPlan(id) {
    return request({
        url: "/rtkwms/label-master-slit-plan/delete?id=" + id,
        method: "delete",
    });
}

// 获得分切任务单
export function getSlittingOrderMaster(id) {
    return request({
        url: "/rtkwms/slitting-order-master/get?id=" + id,
        method: "get",
    });
}

// 获得分切任务单分页
export function getSlittingOrderMasterPage(query) {
    return request({
        url: "/rtkwms/slitting-order-master/page",
        method: "get",
        params: query,
    });
}
// 生产订单物料查询
export function getDetailAndMainPage(query) {
    return request({
        url: "/rtkwms/work-order-bom-detail/detailAndMainPage",
        method: "get",
        params: query,
    });
}
// 获取几个生产订单共同物料
export function getSameMaterialNo(query) {
    return request({
        url: "/rtkwms/work-order-bom-detail/getSameMaterialNo",
        method: "get",
        params: query,
    });
}

// 分切任务支援查询
export function getSupportPage(query) {
    return request({
        url: "/rtkwms/slitting-order-detail/page",
        method: "get",
        params: query,
    });
}

// 分切批次来源查询
export function getSlittingLots(query) {
    return request({
        url: "/rtkwms/label-master/slittingLots",
        method: "get",
        params: query,
    });
}
// 分切批次来源查询
export function getSlittingLotsList(query) {
    return request({
        url: "/rtkwms/label-master/slittingLotsPage",
        method: "get",
        params: query,
    });
}

// 分切后规格查询
export function getSlittedLotsPage(query) {
    return request({
        url: "/rtkwms/label-master/slittedLots",
        method: "get",
        params: query,
    });
}

// 获取分切任务单主列表
export function getSlittingOrderMaterPage(query) {
    return request({
        url: "/rtkwms/slitting-order-master/page",
        method: "get",
        params: query,
    });
}

// 根据支援档创建分切后计划规格
export function createSlitPlan(data) {
    return request({
        url: "/rtkwms/label-master-slit-plan/create",
        method: "post",
        data: data,
    });
}

// 分切上料校验
export function loadSlitting(data) {
    return request({
        url: "/rtkwms/slitting-order-master/load",
        method: "post",
        data: data,
    });
}

// 执行分切
export function executeSlit(data) {
    return request({
        url: "/rtkwms/slitting-order-master/slit",
        method: "post",
        data: data,
    });
}

// 导出分切任务单 Excel
export function exportSlittingOrderMasterExcel(query) {
    return request({
        url: "/rtkwms/slitting-order-master/export-excel",
        method: "get",
        params: query,
        responseType: "blob",
    });
}

// 材料汇总单删除
export function deleteOrderDetail(id) {
    return request({
        url: "/rtkwms/slitting-order-detail/delete?id=" + id,
        method: "delete",
    });
}

// 保存精分切
export function createByLength(data) {
    return request({
        url: "/rtkwms/label-master-slit-plan/createByLength",
        method: "post",
        data: data,
    });
}

// 更新分切类型
export function updateSlittingType(data) {
    return request({
        url: "/rtkwms/slitting-order-master/update",
        method: "put",
        data,
    });
}

// 设为损耗
export function slitPlanToLoss(data) {
    return request({
        url: "/rtkwms/label-master-slit-plan/toLoss",
        method: "post",
        data,
    });
}