package com.yem.wm.utils;

import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.plugin.args.AfterOperationArgs;

/**
 * @author zhouc
 * @date 2024/3/12 9:40
 * @className NestedPrintingUtil
 * @description 根据打印模板打印功能
 */
public class NestedPrintingUtil  extends AbstractOperationServicePlugIn {
    @Override
    public void onPreparePropertys(PreparePropertysEventArgs e) {
//        e.getFieldKeys().add("yem_taskid");
//        e.getFieldKeys().add("number");
//        e.getFieldKeys().add("yem_billno");

    }

    @Override
    public void afterExecuteOperationTransaction(AfterOperationArgs e) {
        super.afterExecuteOperationTransaction(e);
        DynamicObject[] dataEnties = e.getDataEntities();
        String operationKey = e.getOperationKey();
        for (DynamicObject temp : dataEnties) {
            if("printdata".equals(operationKey)){
                PrintHelper.printdata(temp,"yem_approval");
            }
            if("submitatt".equals(operationKey)){
                PrintHelper.printdata(temp,"attachmentpanel");
            }
        }
    }
}
