package com.yem.wm.syn.eas.form.im;

import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.MainEntityType;
import kd.bos.entity.datamodel.ListSelectedRow;
import kd.bos.entity.datamodel.ListSelectedRowCollection;
import kd.bos.list.events.ListRowClickEvent;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.mvc.list.ListView;
import kd.bos.servicehelper.BusinessDataServiceHelper;

import java.util.ArrayList;

/**
 * 配件询价单列表插件
 */
public class ImInQuirylistPJList  extends AbstractListPlugin {


    @Override
    public void listRowClick(ListRowClickEvent evt) {
        super.listRowClick(evt);
        ArrayList<Boolean> list = new ArrayList<>();
        ListSelectedRowCollection selectedRows = evt.getListSelectedRowCollection();
        for (ListSelectedRow selectedRow: selectedRows) {
            Object primaryKeyValue = selectedRow.getPrimaryKeyValue();
            DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(primaryKeyValue, "yem_im_inquirylist");
            boolean yemIseas = dynamicObject.getBoolean("yem_iseas");
            if (yemIseas){
                list.add(yemIseas);
            }
        }
        if (list.size()>0){
            this.getView().setEnable(false,new String[]{"tblcheck","tblunsubmit"});
        }else {
            this.getView().setEnable(true,new String[]{"tblcheck","tblunsubmit"});
        }
    }
}
