package com.yem.wm.im.trackplace.List;

import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.form.ShowType;
import kd.bos.form.events.SetFilterEvent;
import kd.bos.list.ListShowParameter;
import kd.bos.list.events.BeforeShowBillFormEvent;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;

/**
 * @author zhouc
 * @date 2023/9/27 16:53
 * @className TrackplaceListPlugIn
 * @description 产品经理下单确认列表插件
 */
public class TrackplaceListPlugIn extends AbstractListPlugin {
    @Override
    public void setFilter(SetFilterEvent e) {
        super.setFilter(e);
        ListShowParameter parameter = (ListShowParameter) this.getView().getFormShowParameter();
        if (null != parameter) {
            String formId = parameter.getBillFormId();
            if (null != formId && !"".equals(formId)) {
                QFilter qFilter1 = new QFilter("yem_billtypetext", QCP.equals, "A");
//                DynamicObject[] bos_billtype_s = BusinessDataServiceHelper.load("bos_billtype",
//                        "id,name,number", new QFilter[]{qFilter1}, null);
//                if (null != bos_billtype_s && bos_billtype_s.length > 0) {
//                    QFilter filter = new QFilter("yem_billtype.id", QCP.equals, bos_billtype_s[0].getPkValue());
                e.getQFilters().add(qFilter1);
//                }
            }
        }
    }

    @Override
    public void beforeShowBill(BeforeShowBillFormEvent e) {
        super.beforeShowBill(e);
//        e.getParameter().setFormId("yem_trackplace");
    }
}
