package com.yem.em.ass.assatlasdet.task;

import com.yem.wm.utils.DynamicObjectUtil;
import kd.bos.context.RequestContext;
import kd.bos.dataentity.entity.DynamicObject;

import kd.bos.exception.KDException;
import kd.bos.schedule.executor.AbstractTask;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;

import java.util.Map;

import static com.yem.em.ass.assmaterialpicup.op.AssMaterialPicSynRemarksOp.updateAttachmentDetailEntry;

/**
 * @Description: TODO
 * @Date: 2024/8/21 14:39
 * @Created: by ZZSLL
 */

public class AssAtlasdetAttachmentTask extends AbstractTask {

    @Override
    public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
        String selectfields = DynamicObjectUtil.getSelectfields("yem_em_assatlasdet");
        selectfields = DynamicObjectUtil.getEntrySelectfields(selectfields, "yem_em_assatlasdet", "yem_attdetail");
        DynamicObject[] load = BusinessDataServiceHelper.load("yem_em_assatlasdet", selectfields, null);
        for (DynamicObject dynamicObject : load) {
            updateAttachmentDetailEntry(dynamicObject);
        }
        SaveServiceHelper.save(load);
    }
}
