package com.yem.wm.es.salesorder.list;

import kd.bos.form.events.SetFilterEvent;
import kd.bos.list.ListShowParameter;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.sdk.plugin.Plugin;

import java.util.List;

/**
 * @description
 * @author xwudd
 * @time 2023/7/27 15:26
 */
public class SaleOrderList extends AbstractListPlugin implements Plugin {
    @Override
        public void setFilter(SetFilterEvent e) {
        super.setFilter(e);
        ListShowParameter parameter = (ListShowParameter) this.getView().getFormShowParameter();
        String billFormId = parameter.getBillFormId();
        if("yem_es_salesorder_zj".equals(billFormId)){
            e.addCustomQFilter(new QFilter("yem_billtype.number", QCP.equals,"yem_es_salesorder_ZJ"));
        }
        if("yem_es_salesorder_pj".equals(billFormId)){
            e.addCustomQFilter(new QFilter("yem_billtype.number", QCP.equals,"yem_es_salesorder_PJ"));
        }
        if("yem_es_salesorder_nmzj".equals(billFormId)){
            e.addCustomQFilter(new QFilter("yem_billtype.number", QCP.equals,"yem_es_salesorder_nmzj"));
        }
        if("yem_es_salesorder_nmpj".equals(billFormId)){
            e.addCustomQFilter(new QFilter("yem_billtype.number", QCP.equals,"yem_es_salesorder_nmpj"));
        }
        //变更单过滤
        if("yem_es_xsalesorder_pj".equals(billFormId)){
            //外贸配件合同变更单
            e.addCustomQFilter(new QFilter("yem_billtype.number", QCP.equals,"yem_es_xsalesorder_pj"));
        }
        if("yem_es_xsalesorder_zj".equals(billFormId)){
            //外贸整机合同变更单
            e.addCustomQFilter(new QFilter("yem_billtype.number", QCP.equals,"yem_es_xsalesorder_zj"));
        }
        if("yem_es_xsalesorder_nmzj".equals(billFormId)){
            //内贸整机合同变更单
            e.addCustomQFilter(new QFilter("yem_billtype.number", QCP.equals,"yem_es_xsalesorder_nmzj"));
        }
        if("yem_es_xsalesorder_nmpj".equals(billFormId)){
            //内贸配件合同变更单
            e.addCustomQFilter(new QFilter("yem_billtype.number", QCP.equals,"yem_es_xsalesorder_nmpj"));
        }
    }
}