package com.yem.wm.im.placeexamine.op;

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

import static com.yem.wm.im.placeexamine.op.AlaceexamineAuditOp.back_placeexamine;

public class AlaceexamineSubmitOp extends AbstractOperationServicePlugIn
{
    @Override
    public void afterExecuteOperationTransaction(AfterOperationArgs e) {
        super.afterExecuteOperationTransaction(e);

        String key = e.getOperationKey();
        if ("place".equals(key) || "submit".equals(key)) {
            if (null != e.getDataEntities()) {
                DynamicObject[] bills = e.getDataEntities();
                for (DynamicObject dynamicObject : bills) {
                    DynamicObject bill = dynamicObject;
                    bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(), bill.getDynamicObjectType().getName());
                    back_placeexamine(bill);
                }
            }
        }
    }
}
