package com.yem.ia.intebilllogon.commom;

import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;

/**
 * @author zhouc
 * @date 2023/8/17 18:08
 * @className DyDataUtils
 * @description 智能审批单据注册动态默认帮助类
 * 动态默认方法需要自己手动定义
 * 注意标识需一致
 */
public class DyDataUtils {


    /**
     * 单据头动态默认方法
     *
     * @param bill 单据对象
     * @param type 方法唯一标识
     * @return
     */
    public static Object getDyData(DynamicObject bill, String type, String yem_identifierbasic) {
        Object obj = "";
        if ("GetBillNo".equals(type)) {//处理单据类型字段
            if (yem_identifierbasic.length() > 0) {
                DynamicObject dynamicObject = bill.getDynamicObject(yem_identifierbasic);
                if (dynamicObject != null) {
                    obj = dynamicObject.getString("billno");
                }
            }
        }
        return obj;
    }

    /**
     * @param bill 分录行对象
     * @param type 方法唯一标识
     * @return
     */
    public static Object getDyDataEntry(DynamicObject bill, DynamicObject EntryDynamico, String type, String yem_identifierbasic) {
        Object obj = null;
        if ("GetBillNo".equals(type)) {//处理单据类型字段
            if (yem_identifierbasic.length() > 0) {
                DynamicObject dynamicObject = EntryDynamico.getDynamicObject(yem_identifierbasic);
                if (dynamicObject != null) {
                    obj = dynamicObject.getString("billno");
                }
            }
        }
        return obj;
    }
}
