oower

package com.kingdee.eas.auto4s.prt.yd.customer.client;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.ctrl.extendcontrols.KDBizPromptBox;
import com.kingdee.bos.ctrl.kdf.table.ICell;
import com.kingdee.bos.ctrl.kdf.table.IColumn;
import com.kingdee.bos.ctrl.kdf.table.IRow;
import com.kingdee.bos.ctrl.kdf.table.KDTSelectBlock;
import com.kingdee.bos.ctrl.kdf.table.KDTSelectManager;
import com.kingdee.bos.ctrl.kdf.table.KDTable;
import com.kingdee.bos.ctrl.kdf.table.event.KDTDataRequestEvent;
import com.kingdee.bos.ctrl.kdf.table.event.KDTSelectEvent;
import com.kingdee.bos.ctrl.kdf.util.style.StyleAttributes;
import com.kingdee.bos.ctrl.reportone.r1.common.designercore.gui.common.RadioButtonGroup;
import com.kingdee.bos.ctrl.swing.KDButton;
import com.kingdee.bos.ctrl.swing.KDComboBox;
import com.kingdee.bos.ctrl.swing.KDDatePicker;
import com.kingdee.bos.ctrl.swing.KDMenu;
import com.kingdee.bos.ctrl.swing.KDRadioButton;
import com.kingdee.bos.ctrl.swing.KDTextField;
import com.kingdee.bos.ctrl.swing.KDWorkButton;
import com.kingdee.bos.ctrl.swing.event.DataChangeEvent;
import com.kingdee.bos.ctrl.swing.event.DataChangeListener;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.dao.query.IQueryExecutor;
import com.kingdee.bos.metadata.data.SortType;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.bos.metadata.entity.FilterItemCollection;
import com.kingdee.bos.metadata.entity.FilterItemInfo;
import com.kingdee.bos.metadata.entity.SorterItemCollection;
import com.kingdee.bos.metadata.entity.SorterItemInfo;
import com.kingdee.bos.metadata.query.util.CompareType;
import com.kingdee.bos.ui.face.CoreUIObject;
import com.kingdee.bos.ui.face.IUIFactory;
import com.kingdee.bos.ui.face.IUIWindow;
import com.kingdee.bos.ui.face.UIFactory;
import com.kingdee.bos.ui.face.UIRuleUtil;
import com.kingdee.bos.util.BOSUuid;
import com.kingdee.eas.auto4s.bdm.pbd.BrandCollection;
import com.kingdee.eas.auto4s.bdm.pbd.BrandCompanyCollection;
import com.kingdee.eas.auto4s.bdm.pbd.BrandCompanyFactory;
import com.kingdee.eas.auto4s.bdm.pbd.BrandCompanyInfo;
import com.kingdee.eas.auto4s.bdm.pbd.BrandFactory;
import com.kingdee.eas.auto4s.bdm.pbd.BrandInfo;
import com.kingdee.eas.auto4s.bdm.pbd.CustomerFactory;
import com.kingdee.eas.auto4s.bdm.pbd.CustomerTypeEnum;
import com.kingdee.eas.auto4s.bdm.pbd.IBrand;
import com.kingdee.eas.auto4s.bdm.pbd.IBrandCompany;
import com.kingdee.eas.auto4s.bdm.pbd.ISeries;
import com.kingdee.eas.auto4s.bdm.pbd.MakeControl;
import com.kingdee.eas.auto4s.bdm.pbd.ModelInfo;
import com.kingdee.eas.auto4s.bdm.pbd.OwnOutEnum;
import com.kingdee.eas.auto4s.bdm.pbd.SeriesCollection;
import com.kingdee.eas.auto4s.bdm.pbd.SeriesFactory;
import com.kingdee.eas.auto4s.bdm.pbd.SeriesInfo;
import com.kingdee.eas.auto4s.bdm.pbd.SexEnum;
import com.kingdee.eas.auto4s.bdm.pbd.client.CustomerEditUI;
import com.kingdee.eas.auto4s.bdm.pbd.client.VehicleEditUI;
import com.kingdee.eas.auto4s.bdm.util.CommonUtil;
import com.kingdee.eas.auto4s.bdm.util.VehicleParamCache;
import com.kingdee.eas.auto4s.prt.yd.customer.IMergeCustomer;
import com.kingdee.eas.auto4s.prt.yd.customer.MergeCustomerFactory;
import com.kingdee.eas.base.permission.IOrgRange;
import com.kingdee.eas.base.permission.OrgRangeCollection;
import com.kingdee.eas.base.permission.OrgRangeFactory;
import com.kingdee.eas.base.permission.OrgRangeInfo;
import com.kingdee.eas.base.permission.UserInfo;
import com.kingdee.eas.basedata.assistant.CityFactory;
import com.kingdee.eas.basedata.assistant.CityInfo;
import com.kingdee.eas.basedata.assistant.ICity;
import com.kingdee.eas.basedata.assistant.IProvince;
import com.kingdee.eas.basedata.assistant.IRegion;
import com.kingdee.eas.basedata.assistant.ProvinceFactory;
import com.kingdee.eas.basedata.assistant.ProvinceInfo;
import com.kingdee.eas.basedata.assistant.RegionFactory;
import com.kingdee.eas.basedata.assistant.RegionInfo;
import com.kingdee.eas.basedata.org.AdminOrgUnitInfo;
import com.kingdee.eas.basedata.org.CtrlUnitInfo;
import com.kingdee.eas.basedata.org.FullOrgUnitInfo;
import com.kingdee.eas.basedata.org.ISaleOrgUnit;
import com.kingdee.eas.basedata.org.OrgUnitInfo;
import com.kingdee.eas.basedata.org.PositionInfo;
import com.kingdee.eas.basedata.org.SaleOrgUnitFactory;
import com.kingdee.eas.basedata.org.SaleOrgUnitInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.common.client.OprtState;
import com.kingdee.eas.common.client.SysContext;
import com.kingdee.eas.common.client.UIContext;
import com.kingdee.eas.framework.ICoreBase;
import com.kingdee.eas.util.SysUtil;
import com.kingdee.eas.util.client.EASResource;
import com.kingdee.eas.util.client.MsgBox;
import com.kingdee.jdbc.rowset.IRowSet;
import com.kingdee.util.enums.EnumUtils;
import java.awt.event.ActionEvent;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.log4j.Logger;

public class OwnerInformationListUI extends AbstractOwnerInformationListUI
{
  private static final Logger logger = CoreUIObject.getLogger(OwnerInformationListUI.class);
  private boolean isFirstOnLoad = true;
  private FilterInfo myFilterInfo;
  private boolean isQueryBtnClicked = false;
  private FilterInfo nameFilter;
  private FilterInfo phoneFilter;
  private FilterInfo mainFilter;
  private boolean isFirstDoRequestRowSet = true;
  private boolean isCompanyFilter = false;

  private static IRowSet rs = null;

  public OwnerInformationListUI()
    throws Exception
  {
    this.allocationBill.setVisible(false);
  }

  protected String getEditUIName() {
    return "com.kingdee.eas.auto4s.bdm.pbd.client.CustomerEditUI";
  }

  protected String getEditUIModal()
  {
    return "com.kingdee.eas.base.uiframe.client.UINewTabFactory";
  }

  public void onLoad() throws Exception {
    super.onLoad();

    this.allocationBill.setIcon(EASResource.getIcon("imgTbtn_affirm"));
    this.allocationBill.setVisible(true);
    RadioButtonGroup group = new RadioButtonGroup();
    group.add(this.radioTax);
    group.add(this.radioNoTax);
    this.radioTax.setSelected(true);
    this.radioTax.setVisible(false);
    this.radioNoTax.setVisible(false);
    setUITitle("车主信息查询列表");

    RadioButtonGroup vehicleGroup = new RadioButtonGroup();
    vehicleGroup.add(this.haveVehicle);
    vehicleGroup.add(this.noVehicle);
    this.haveVehicle.setSelected(true);

    this.btnClearSearch.setEnabled(true);
    this.menuFile.setVisible(false);
    this.menuEdit.setVisible(false);
    this.menuView.setVisible(false);
    this.menuBiz.setVisible(false);
    this.menuWorkFlow.setVisible(false);

    this.isFirstOnLoad = false;
    this.tblMain.getColumn("id").getStyleAttributes().setHided(true);
    this.pkTaxStart.setValue(null);
    this.pkTaxLast.setValue(null);
    this.pkBirthday.setValue(null);
    this.pkBirthdayLast.setValue(null);
    this.pkFirstdate.setValue(null);
    this.pkLastdate.setValue(null);
    this.search.setEnabled(true);
    this.btnCar.setEnabled(true);
    this.btnCustomer.setEnabled(true);
    this.btnAttachment.setVisible(false);
    this.btnAuditResult.setVisible(false);

    this.btnQuery.setVisible(true);
    this.btnQuery.setEnabled(true);

    this.tblMain.getColumn("custSource").getStyleAttributes().setHided(true);
    this.tblMain.getColumn("custGroup").getStyleAttributes().setHided(true);
    this.tblMain.getColumn("industry").getStyleAttributes().setHided(true);
    this.tblMain.getColumn("customJob").getStyleAttributes().setHided(true);
    this.tblMain.getColumn("career").getStyleAttributes().setHided(true);
    this.tblMain.getColumn("color").getStyleAttributes().setHided(true);
    this.tblMain.getColumn("orgUnit").getStyleAttributes().setHided(true);
    this.tblMain.getColumn("buyAutoOrgUnit").getStyleAttributes().setHided(true);
    this.tblMain.getColumn("location").getStyleAttributes().setHided(true);
    this.tblMain.getColumn("warehouse").getStyleAttributes().setHided(true);
    this.tblMain.getColumn("inner").getStyleAttributes().setHided(true);
    this.tblMain.getColumn("optionItemCombine").getStyleAttributes().setHided(true);
    this.btnCustomer.setIcon(EASResource.getIcon("imgTbtn_maintenance"));
    this.btnCar.setIcon(EASResource.getIcon("imgTbtn_uniterangemaintenance"));

    SaleOrgUnitInfo saleInfo = SysContext.getSysContext().getCurrentSaleUnit();
    EntityViewInfo evi = new EntityViewInfo();
    FilterInfo filter = new FilterInfo();
    if (UIRuleUtil.isNotNull(saleInfo)) {
      filter.getFilterItems().add(new FilterItemInfo("AdminOrgUnit.id", saleInfo.getId().toString(), CompareType.EQUALS));
    }
    evi.setFilter(filter);

    Set idSet = new HashSet();
    UserInfo user = SysContext.getSysContext().getCurrentUserInfo();
    String userId = user.getId().toString();
    EntityViewInfo evInfo = new EntityViewInfo();
    FilterInfo filterInfo = new FilterInfo();
    filterInfo.getFilterItems().add(new FilterItemInfo("user", userId, CompareType.EQUALS));
    evInfo.setFilter(filterInfo);
    OrgRangeCollection orgRangeCollection = OrgRangeFactory.getRemoteInstance().getOrgRangeCollection(evInfo);
    if (orgRangeCollection.size() > 0) {
      for (int i = 0; i < orgRangeCollection.size(); ++i) {
        OrgRangeInfo orgRangeInfo = orgRangeCollection.get(i);
        String id = orgRangeInfo.getOrg().getId().toString();
        idSet.add(id);
      }

    }

    EntityViewInfo orgEvi = new EntityViewInfo();
    FilterInfo orgFilterInfo = new FilterInfo();
    if (idSet.size() > 0) {
      orgFilterInfo.getFilterItems().add(new FilterItemInfo("id", idSet, CompareType.INCLUDE));
      orgFilterInfo.getFilterItems().add(new FilterItemInfo("isBizUnit", Integer.valueOf(1), CompareType.EQUALS));
    } else {
      orgFilterInfo.getFilterItems().add(new FilterItemInfo("id", "nodata", CompareType.EQUALS));
    }
    orgEvi.setFilter(orgFilterInfo);

    EntityViewInfo brandEvi = new EntityViewInfo();
    FilterInfo brandFilterInfo = new FilterInfo();
    if (idSet.size() > 0)
      brandFilterInfo.getFilterItems().add(new FilterItemInfo("OrgUnit.id", idSet, CompareType.INCLUDE));
    else {
      brandFilterInfo.getFilterItems().add(new FilterItemInfo("id", "nodata", CompareType.EQUALS));
    }
    brandEvi.setFilter(brandFilterInfo);

    Set brandSet = new HashSet();
    BrandCompanyCollection brandCompanyCollection = BrandCompanyFactory.getRemoteInstance().getBrandCompanyCollection(brandEvi);
    if (brandCompanyCollection.size() > 0) {
      for (int i = 0; i < brandCompanyCollection.size(); ++i) {
        BrandCompanyInfo brandCompany = brandCompanyCollection.get(i);
        BrandInfo brand = brandCompany.getParent();
        brandSet.add(brand.getId());
      }

    }

    EntityViewInfo seriesEvi = new EntityViewInfo();
    FilterInfo seriesFilter = new FilterInfo();
    if (brandSet.size() > 0) {
      seriesFilter.getFilterItems().add(new FilterItemInfo("isUse", new Integer(1), CompareType.EQUALS));
      seriesFilter.getFilterItems().add(new FilterItemInfo("brand.isUse", new Integer(1), CompareType.EQUALS));
      seriesFilter.getFilterItems().add(new FilterItemInfo("brand.auditStatus", new Integer("2"), CompareType.EQUALS));
      seriesFilter.getFilterItems().add(new FilterItemInfo("brand.id", brandSet, CompareType.INCLUDE));
    } else {
      seriesFilter.getFilterItems().add(new FilterItemInfo("id", "nodata", CompareType.EQUALS));
    }
    seriesEvi.setFilter(seriesFilter);

    EntityViewInfo modelEvi = new EntityViewInfo();
    FilterInfo modelFilter = new FilterInfo();
    modelEvi.setFilter(modelFilter);
    Set serSet = new HashSet();
    SeriesCollection serCol = SeriesFactory.getRemoteInstance().getSeriesCollection(seriesEvi);
    if (serCol.size() > 0) {
      for (int i = 0; i < serCol.size(); ++i) {
        serSet.add(serCol.get(i).getId());
      }
      modelFilter.getFilterItems().add(new FilterItemInfo("Parent.id", serSet, CompareType.INCLUDE));
      modelFilter.getFilterItems().add(new FilterItemInfo("isUse", new Integer(1), CompareType.EQUALS));
    } else {
      modelFilter.getFilterItems().add(new FilterItemInfo("Parent.id", "nodata", CompareType.EQUALS));
    }

    if (this.prmtCompany.getValue() != null)
    {
      MakeControl.makeBrandF7(this.prmtBrand, (SaleOrgUnitInfo)this.prmtCompany.getValue(), false, false);
      MakeControl.makeModelF7(this.prmtModel, CommonUtil.getBrandByCompany((SaleOrgUnitInfo)this.prmtCompany.getValue()));
    } else {
      this.prmtBrand.setEntityViewInfo(null);
      this.prmtModel.setEntityViewInfo(null);
    }

    MakeControl.makeSeriesF7(this.prmtSeries, new SeriesInfo().getBOSType());

    this.prmtBrand.setQueryInfo("com.kingdee.eas.auto4s.bdm.pbd.app.BrandQuery");
    this.prmtBrand.setCommitFormat("$number$");
    this.prmtBrand.setDisplayFormat("$name$");
    this.prmtBrand.setEntityViewInfo(brandEvi);

    this.prmtSeries.setQueryInfo("com.kingdee.eas.auto4s.bdm.pbd.app.SeriesQuery");
    this.prmtSeries.setCommitFormat("$number$");
    this.prmtSeries.setDisplayFormat("$name$");
    this.prmtSeries.setEntityViewInfo(seriesEvi);

    this.prmtModel.setQueryInfo("com.kingdee.eas.auto4s.bdm.pbd.app.ModelQuery");
    this.prmtModel.setCommitFormat("$number$");
    this.prmtModel.setDisplayFormat("$name$");
    this.prmtModel.setEntityViewInfo(modelEvi);

    this.prmtCompany.setQueryInfo("com.kingdee.eas.auto4s.prt.yd.customer.app.SaleOrgUnitQuery");
    this.prmtCompany.setCommitFormat("$number$");
    this.prmtCompany.setDisplayFormat("$name$");
    this.prmtCompany.setEntityViewInfo(orgEvi);

    this.prmtPosition.setQueryInfo("com.kingdee.eas.hr.org.app.PositionF7Query");
    this.prmtPosition.setCommitFormat("$number$");
    this.prmtPosition.setDisplayFormat("$name$");
    this.prmtPosition.setEntityViewInfo(evi);
    makePositionF7(this.prmtPosition, SysContext.getSysContext().getCurrentSaleUnit(), null);

    this.prmtProvince.setQueryInfo("com.kingdee.eas.basedata.assistant.app.F7ProvinceQuery");
    this.prmtProvince.setCommitFormat("$number$");
    this.prmtProvince.setDisplayFormat("$name$");

    this.prmtCity.setQueryInfo("com.kingdee.eas.basedata.assistant.app.CityQuery");
    this.prmtCity.setCommitFormat("$number$");
    this.prmtCity.setDisplayFormat("$name$");

    this.prmtRegion.setQueryInfo("com.kingdee.eas.basedata.assistant.app.RegionQuery");
    this.prmtRegion.setCommitFormat("$number$");
    this.prmtRegion.setDisplayFormat("$name$");

    this.comboCustAttribute.addItems(EnumUtils.getEnumList("com.kingdee.eas.auto4s.bdm.pbd.OwnOutEnum").toArray());
    this.comboCustType.addItems(EnumUtils.getEnumList("com.kingdee.eas.auto4s.bdm.pbd.CustomerTypeEnum").toArray());
    this.comoSex.addItems(EnumUtils.getEnumList("com.kingdee.eas.auto4s.bdm.pbd.SexEnum").toArray());

    this.prmtCompany.addDataChangeListener(new DataChangeListener() {
      public void dataChanged(DataChangeEvent e) {
        boolean isChanged = true;
        isChanged = MakeControl.isF7ValueChanged(e);
        if (!isChanged) {
          return;
        }
        if (e.getOldValue() != null) {
          OwnerInformationListUI.this.prmtModel.setValue(null);
          OwnerInformationListUI.this.prmtSeries.setValue(null);
          OwnerInformationListUI.this.prmtBrand.setValue(null);
        }

        SaleOrgUnitInfo info = null;
        if (e.getNewValue() != null) {
          IObjectPK pk = new ObjectUuidPK(((SaleOrgUnitInfo)e.getNewValue()).getId().toString());
          try {
            info = SaleOrgUnitFactory.getRemoteInstance().getSaleOrgUnitInfo(pk);
            MakeControl.makeBrandF7(OwnerInformationListUI.this.prmtBrand, info, false, false);
          } catch (EASBizException e1) {
            e1.printStackTrace();
          } catch (BOSException e1) {
            e1.printStackTrace();
          } catch (Exception e1) {
            e1.printStackTrace();
          }
        } else {
          OwnerInformationListUI.this.prmtBrand.setEntityViewInfo(null);
        }
      }
    });
    this.prmtBrand.addDataChangeListener(new DataChangeListener() {
      public void dataChanged(DataChangeEvent e) {
        boolean isChanged = true;
        isChanged = MakeControl.isF7ValueChanged(e);
        if (!isChanged) {
          return;
        }
        if (e.getOldValue() != null) {
          OwnerInformationListUI.this.prmtModel.setValue(null);
          OwnerInformationListUI.this.prmtSeries.setValue(null);
        }

        BrandInfo info = null;
        if (e.getNewValue() != null) {
          IObjectPK pk = new ObjectUuidPK(((BrandInfo)e.getNewValue()).getId().toString());
          try {
            info = BrandFactory.getRemoteInstance().getBrandInfo(pk);
            OwnerInformationListUI.makeModelF7(OwnerInformationListUI.this.prmtModel, info);
            OwnerInformationListUI.makeSeriesF7(OwnerInformationListUI.this.prmtSeries, info);
          }
          catch (Exception e1)
          {
            e1.printStackTrace();
          }
        } else {
          OwnerInformationListUI.this.prmtModel.setEntityViewInfo(null);
          OwnerInformationListUI.this.prmtSeries.setEntityViewInfo(null);
        }
      }
    });
    this.prmtProvince.addDataChangeListener(new DataChangeListener() {
      public void dataChanged(DataChangeEvent e) {
        try {
          OwnerInformationListUI.this.provinceDataChangeListener(e); } catch (Exception exc) {
          exc = exc;

          OwnerInformationListUI.this.handUIException(exc);
        }
      }
    });
    this.prmtCity.addDataChangeListener(new DataChangeListener() {
      public void dataChanged(DataChangeEvent e) {
        try {
          OwnerInformationListUI.this.cityDataChangeListener(e); } catch (Exception exc) {
          exc = exc;

          OwnerInformationListUI.this.handUIException(exc);
        }
      }
    });
    this.prmtRegion.addDataChangeListener(new DataChangeListener() {
      public void dataChanged(DataChangeEvent e) {
        try {
          OwnerInformationListUI.this.regionDataChangeListener(e); } catch (Exception exc) {
          exc = exc;

          OwnerInformationListUI.this.handUIException(exc);
        }
      }
    });
  }

  protected FilterInfo getDefaultFilterForQuery()
  {
    FilterInfo filter = new FilterInfo();
    if (this.isFirstOnLoad) {
      filter.getFilterItems().add(new FilterItemInfo("id", "nodata", CompareType.EQUALS));
      return filter;
    }
    filter.getFilterItems().add(new FilterItemInfo("serviceVerify", Integer.valueOf(1), CompareType.EQUALS));
    filter.getFilterItems().add(new FilterItemInfo("custClass", "4", CompareType.EQUALS));
    return filter;
  }

  public void actionSearch_actionPerformed(ActionEvent e) throws Exception {
    super.actionSearch_actionPerformed(e);

    Date startDate = null;
    Date lastDate = null;
    Date maxDate = null;

    if (UIRuleUtil.isNotNull(this.pkTaxStart.getValue())) {
      startDate = (Date)this.pkTaxStart.getValue();
    }
    if (UIRuleUtil.isNotNull(this.pkTaxLast.getValue())) {
      lastDate = (Date)this.pkTaxLast.getValue();
    }
    if ((startDate != null) && (lastDate != null)) {
      Calendar calendar = Calendar.getInstance();
      calendar.setTime(startDate);
      calendar.add(5, 31);
      maxDate = calendar.getTime();
      if ((!lastDate.before(maxDate)) || (!lastDate.after(startDate))) {
        MsgBox.showInfo("开票日期间隔不能大于30天");
        SysUtil.abort();
      }

    }

    this.mainFilter = getDefaultCUFilter(true);
    this.mainFilter = getDefaultFilterForQuery();

    searchFilter();

    if ((this.isQueryBtnClicked) && (UIRuleUtil.isNotNull(this.mainQuery))) {
      FilterInfo info = this.mainQuery.getFilter();

      if (this.myFilterInfo != null) {
        try {
          if (info != null) {
            if (this.mainFilter == null) {
              this.mainFilter = ((FilterInfo)info.clone());
            }
            if (UIRuleUtil.isNotNull(this.nameFilter)) {
              this.myFilterInfo.mergeFilter(this.nameFilter, "AND");
            }
            if (UIRuleUtil.isNotNull(this.phoneFilter)) {
              this.myFilterInfo.mergeFilter(this.phoneFilter, "AND");
            }

            this.myFilterInfo.mergeFilter(this.mainFilter, "AND");
          }
        } catch (BOSException e1) {
          logger.error(e1);
          handUIException(e1);
        }
        this.mainQuery.setFilter(this.myFilterInfo);
      }
    }

    if (this.isFirstDoRequestRowSet) {
      SorterItemCollection sorters = new SorterItemCollection();
      SorterItemInfo sorterItem = new SorterItemInfo("number");
      sorterItem.setSortType(SortType.ASCEND);
      sorters.add(sorterItem);
      sorterItem = new SorterItemInfo("orderEntry.InvoiceDate");
      sorterItem.setSortType(SortType.ASCEND);
      sorters.add(sorterItem);
      sorterItem = new SorterItemInfo("VEHICLE.VIN");
      sorterItem.setSortType(SortType.ASCEND);
      sorters.add(sorterItem);
      this.mainQuery.setSorter(sorters);
      this.isFirstDoRequestRowSet = false;
    }

    this.mainQuery.getFilter();

    IQueryExecutor iexec = getQueryExecutor(this.mainQueryPK, this.mainQuery);
    logger.info("车主信息查询条件SQL打印:" + iexec.getSQL());
    rs = iexec.executeQuery();
    execQuery();
  }

  protected boolean isIgnoreCUFilter() {
    return true;
  }

  protected void searchFilter() {
    List searchList = new ArrayList();
    FilterInfo filter = new FilterInfo();
    StringBuffer sbuff = new StringBuffer();
    Set idSet = new HashSet();

    if ((this.pkFirstdate.getValue() != null) && (this.pkLastdate.getValue() != null)) {
      Date firstDate = (Date)this.pkFirstdate.getValue();
      Calendar firstDateCalendar = Calendar.getInstance();
      firstDateCalendar.setTime(firstDate);
      firstDateCalendar.add(5, -1);
      firstDateCalendar.add(10, 23 - firstDate.getHours());
      firstDateCalendar.add(12, 59 - firstDate.getMinutes());
      firstDateCalendar.add(13, 59 - firstDate.getSeconds());
      searchList.add(new FilterItemInfo("FirstDate", firstDateCalendar.getTime(), CompareType.GREATER));
      Date endDate = (Date)this.pkLastdate.getValue();
      Calendar endDateCalendar = Calendar.getInstance();
      endDateCalendar.setTime(endDate);
      endDateCalendar.add(10, 23 - endDate.getHours());
      endDateCalendar.add(12, 59 - endDate.getMinutes());
      endDateCalendar.add(13, 59 - endDate.getSeconds());
      searchList.add(new FilterItemInfo("FirstDate", endDateCalendar.getTime(), CompareType.LESS_EQUALS));
    }

    if ((UIRuleUtil.isNotNull(this.textAge.getText())) && (UIRuleUtil.isNotNull(this.textAgeLast.getText()))) {
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
      if ((this.textAge.getText().matches("^[-+]?(([0-9]+)([.]([0-9]+))?|([.]([0-9]+))?)$")) && (this.textAgeLast.getText().matches("^[-+]?(([0-9]+)([.]([0-9]+))?|([.]([0-9]+))?)$"))) {
        int nowYear = Integer.parseInt(sdf.format(new Date()));
        int age = Integer.parseInt(this.textAge.getText());
        int ageLast = Integer.parseInt(this.textAgeLast.getText());
        searchList.add(new FilterItemInfo("age", nowYear - ageLast + "-01-01", CompareType.GREATER));

        searchList.add(new FilterItemInfo("age", nowYear - age + "-12-31", CompareType.LESS_EQUALS));
      } else {
        MsgBox.showInfo("年龄输入有误");
        SysUtil.abort();
      }

    }

    if ((this.pkBirthday.getValue() != null) && (this.pkBirthdayLast.getValue() != null)) {
      Date birthday = (Date)this.pkBirthday.getValue();
      Calendar birthdayCalendar = Calendar.getInstance();
      birthdayCalendar.setTime(birthday);

      birthdayCalendar.add(10, 23 - birthday.getHours());
      birthdayCalendar.add(12, 59 - birthday.getMinutes());
      birthdayCalendar.add(13, 59 - birthday.getSeconds());

      logger.info(birthdayCalendar.get(2) + 1 + "; " + birthdayCalendar.get(5));
      searchList.add(new FilterItemInfo("MONTH(Birthday)>=" + (birthdayCalendar.get(2) + 1)));
      searchList.add(new FilterItemInfo("DAYOFMONTH(Birthday)>=" + birthdayCalendar.get(5)));

      Date birthdayLast = (Date)this.pkBirthdayLast.getValue();
      Calendar birthdayLastCalendar = Calendar.getInstance();
      birthdayLastCalendar.setTime(birthdayLast);
      birthdayLastCalendar.add(10, 23 - birthdayLast.getHours());
      birthdayLastCalendar.add(12, 59 - birthdayLast.getMinutes());
      birthdayLastCalendar.add(13, 59 - birthdayLast.getSeconds());

      searchList.add(new FilterItemInfo("MONTH(Birthday)<=" + (birthdayLastCalendar.get(2) + 1)));
      searchList.add(new FilterItemInfo("DAYOFMONTH(Birthday)<=" + birthdayLastCalendar.get(5)));
    }

    if ((this.pkTaxStart.getValue() != null) && (this.pkTaxLast.getValue() != null)) {
      EntityViewInfo evi = new EntityViewInfo();
      FilterInfo filterInfo = new FilterInfo();

      Date taxStartDate = (Date)this.pkTaxStart.getValue();
      Calendar startCalendar = Calendar.getInstance();
      startCalendar.setTime(taxStartDate);
      startCalendar.add(5, -1);
      startCalendar.add(10, 23 - taxStartDate.getHours());
      startCalendar.add(12, 59 - taxStartDate.getMinutes());
      startCalendar.add(13, 59 - taxStartDate.getSeconds());
      filterInfo.getFilterItems().add(new FilterItemInfo("Date", startCalendar.getTime(), CompareType.GREATER));

      Date taxEndDate = (Date)this.pkTaxLast.getValue();
      Calendar endCalendar = Calendar.getInstance();
      endCalendar.setTime(taxEndDate);
      endCalendar.add(10, 23 - taxEndDate.getHours());
      endCalendar.add(12, 59 - taxEndDate.getMinutes());
      endCalendar.add(13, 59 - taxEndDate.getSeconds());
      filterInfo.getFilterItems().add(new FilterItemInfo("Date", endCalendar.getTime(), CompareType.LESS_EQUALS));
      evi.setFilter(filterInfo);
      try
      {
        idSet = MergeCustomerFactory.getRemoteInstance().getARInvoiceIDForDate(startCalendar.getTime(), endCalendar.getTime());
      }
      catch (BOSException e) {
        e.printStackTrace();
      } catch (EASBizException e) {
        e.printStackTrace();
      }
      if (idSet.size() > 0) {
        searchList.add(new FilterItemInfo("vehicle.id", idSet, CompareType.INCLUDE));
      } else {
        filter.getFilterItems().add(new FilterItemInfo("id", "nodata", CompareType.EQUALS));
        this.myFilterInfo = ((FilterInfo)filter.clone());
        return;
      }

    }

    if (UIRuleUtil.isNotNull(this.prmtProvince.getValue())) {
      ProvinceInfo province = (ProvinceInfo)this.prmtProvince.getValue();
      String provinceNum = province.getNumber();
      searchList.add(new FilterItemInfo("Province.number", provinceNum, CompareType.EQUALS));
    }

    if (UIRuleUtil.isNotNull(this.prmtCity.getValue())) {
      CityInfo city = (CityInfo)this.prmtCity.getValue();
      String cityNum = city.getNumber();
      searchList.add(new FilterItemInfo("city.number", cityNum, CompareType.EQUALS));
    }

    if (UIRuleUtil.isNotNull(this.prmtRegion.getValue())) {
      RegionInfo region = (RegionInfo)this.prmtRegion.getValue();
      String regionNum = region.getNumber();
      searchList.add(new FilterItemInfo("Region.number", regionNum, CompareType.EQUALS));
    }

    if (UIRuleUtil.isNotNull(this.comboCustAttribute.getSelectedItem())) {
      OwnOutEnum own = (OwnOutEnum)this.comboCustAttribute.getSelectedItem();
      searchList.add(new FilterItemInfo("custAttribute", own.getValue(), CompareType.EQUALS));
    }

    if (UIRuleUtil.isNotNull(this.comboCustType.getSelectedItem())) {
      CustomerTypeEnum type = (CustomerTypeEnum)this.comboCustType.getSelectedItem();
      searchList.add(new FilterItemInfo("custType", type.getValue(), CompareType.EQUALS));
    }

    if (UIRuleUtil.isNotNull(this.comoSex.getSelectedItem())) {
      SexEnum sex = (SexEnum)this.comoSex.getSelectedItem();
      searchList.add(new FilterItemInfo("sex", sex.getValue(), CompareType.EQUALS));
    }

    if (UIRuleUtil.isNotNull(this.textPlateNum.getText())) {
      String plateNum = this.textPlateNum.getText();
      searchList.add(new FilterItemInfo("vehicle.plateNum", "%" + plateNum + "%", CompareType.LIKE));
    }

    if (UIRuleUtil.isNotNull(this.textVIN.getText())) {
      String vin = this.textVIN.getText();
      searchList.add(new FilterItemInfo("vehicle.vIN", "%" + vin + "%", CompareType.LIKE));
    }

    if (UIRuleUtil.isNotNull(this.textCustomerName.getText())) {
      String name = this.textCustomerName.getText();
      FilterInfo nameFilterInfo = new FilterInfo();
      nameFilterInfo.getFilterItems().add(new FilterItemInfo("name", "%" + name + "%", CompareType.LIKE));
      nameFilterInfo.getFilterItems().add(new FilterItemInfo("simpleName", "%" + name + "%", CompareType.LIKE));
      nameFilterInfo.getFilterItems().add(new FilterItemInfo("contactPerson.name", "%" + name + "%", CompareType.LIKE));
      nameFilterInfo.getFilterItems().add(new FilterItemInfo("subName", "%" + name + "%", CompareType.LIKE));
      nameFilterInfo.setMaskString("#0 or #1 or #2 or #3");

      this.nameFilter = ((FilterInfo)nameFilterInfo.clone());
    } else {
      this.nameFilter = null;
    }

    if (UIRuleUtil.isNotNull(this.textPhone.getText())) {
      String phone = this.textPhone.getText();
      FilterInfo phoneFilterInfo = new FilterInfo();
      phoneFilterInfo.getFilterItems().add(new FilterItemInfo("phone", "%" + phone + "%", CompareType.LIKE));
      phoneFilterInfo.getFilterItems().add(new FilterItemInfo("phone2", "%" + phone + "%", CompareType.LIKE));
      phoneFilterInfo.getFilterItems().add(new FilterItemInfo("phone3", "%" + phone + "%", CompareType.LIKE));
      phoneFilterInfo.getFilterItems().add(new FilterItemInfo("contactPerson.contactMobile", "%" + phone + "%", CompareType.LIKE));

      phoneFilterInfo.setMaskString("#0 or #1 or #2 or #3");

      this.phoneFilter = ((FilterInfo)phoneFilterInfo.clone());
    } else {
      this.phoneFilter = null;
    }

    if (UIRuleUtil.isNotNull(this.txtPerson.getText())) {
      String person = this.txtPerson.getText();
      searchList.add(new FilterItemInfo("salePerson.name", "%" + person + "%", CompareType.LIKE));
    }

    if (UIRuleUtil.isNotNull(this.prmtPosition.getValue())) {
      PositionInfo position = (PositionInfo)this.prmtPosition.getValue();
      String positionNumber = position.getNumber().toString();
      searchList.add(new FilterItemInfo("Position.number", positionNumber, CompareType.EQUALS));
    }

    if (UIRuleUtil.isNotNull(this.prmtBrand.getValue())) {
      BrandInfo brand = (BrandInfo)this.prmtBrand.getValue();
      searchList.add(new FilterItemInfo("brand.number", brand.getNumber(), CompareType.EQUALS));
    }

    if (UIRuleUtil.isNotNull(this.prmtSeries.getValue())) {
      SeriesInfo series = (SeriesInfo)this.prmtSeries.getValue();
      searchList.add(new FilterItemInfo("series.number", series.getNumber(), CompareType.EQUALS));
    }

    if (UIRuleUtil.isNotNull(this.prmtModel.getValue())) {
      ModelInfo model = (ModelInfo)this.prmtModel.getValue();
      searchList.add(new FilterItemInfo("model.number", model.getNumber(), CompareType.EQUALS));
    }

    if (this.haveVehicle.isSelected())
      searchList.add(new FilterItemInfo("VEHICLE.ID", null, CompareType.NOTEQUALS));
    else if (this.noVehicle.isSelected()) {
      searchList.add(new FilterItemInfo("VEHICLE.ID", null, CompareType.EQUALS));
    }

    if (UIRuleUtil.isNotNull(this.prmtCompany.getValue())) {
      SaleOrgUnitInfo orgUnit = (SaleOrgUnitInfo)this.prmtCompany.getValue();
      searchList.add(new FilterItemInfo("fullOrgUnit.id", orgUnit.getCU().getId(), CompareType.EQUALS));
      searchList.add(new FilterItemInfo("repairOrgUnit.id", orgUnit.getId(), CompareType.EQUALS));
      searchList.add(new FilterItemInfo("belongOrgUnit.id", orgUnit.getId(), CompareType.EQUALS));
      this.isCompanyFilter = true;
    } else {
      this.isCompanyFilter = false;

      idSet = new HashSet();
      UserInfo user = SysContext.getSysContext().getCurrentUserInfo();
      String userId = user.getId().toString();
      EntityViewInfo evInfo = new EntityViewInfo();
      FilterInfo filterInfo = new FilterInfo();
      filterInfo.getFilterItems().add(new FilterItemInfo("user", userId, CompareType.EQUALS));
      evInfo.setFilter(filterInfo);
      try {
        OrgRangeCollection orgRangeCollection = OrgRangeFactory.getRemoteInstance().getOrgRangeCollection(evInfo);
        if (orgRangeCollection.size() > 0)
          for (int i = 0; i < orgRangeCollection.size(); ++i) {
            OrgRangeInfo orgRangeInfo = orgRangeCollection.get(i);
            String id = orgRangeInfo.getOrg().getId().toString();
            idSet.add(id);
          }
      }
      catch (BOSException e)
      {
        e.printStackTrace();
      }
      searchList.add(new FilterItemInfo("fullOrgUnit.id", idSet, CompareType.INCLUDE));
    }

    int size = searchList.size();

    if (UIRuleUtil.isNotNull(this.prmtCompany.getValue())) {
      for (int i = 0; i < size; ++i) {
        filter.getFilterItems().add((FilterItemInfo)searchList.get(i));
        if (i == 0)
          sbuff.append("#0 ");
        else if (i <= size - 4) {
          sbuff.append(" and #" + i);
        }
      }
      String _3 = String.valueOf(size - 3);
      String _2 = String.valueOf(size - 2);
      String _1 = String.valueOf(size - 1);
      sbuff.append(" and (#" + _3 + " or #" + _2 + " or  #" + _1 + ")");
    } else {
      for (int i = 0; i < searchList.size(); ++i) {
        filter.getFilterItems().add((FilterItemInfo)searchList.get(i));
        if (i == 0)
          sbuff.append("#0 ");
        else {
          sbuff.append(" and #" + i);
        }
      }

    }

    this.isQueryBtnClicked = true;
    filter.setMaskString(sbuff.toString());
    this.myFilterInfo = ((FilterInfo)filter.clone());
  }

  protected ICoreBase getBizInterface() throws Exception {
    return CustomerFactory.getRemoteInstance();
  }

  private void provinceDataChangeListener(DataChangeEvent e) throws Exception {
    boolean isChanged = true;
    isChanged = MakeControl.isF7ValueChanged(e);
    if (!isChanged) {
      return;
    }
    if (e.getOldValue() != null) {
      this.prmtCity.setValue(null);
      this.prmtRegion.setValue(null);
    }

    ProvinceInfo info = null;
    if (e.getNewValue() != null) {
      IObjectPK pk = new ObjectUuidPK(((ProvinceInfo)e.getNewValue()).getId().toString());

      info = ProvinceFactory.getRemoteInstance().getProvinceInfo(pk);
      MakeControl.makeCityF7FromProvince(this.prmtCity, info);
      MakeControl.makeRegionF7FromProvince(this.prmtRegion, info);
    }
  }

  private void cityDataChangeListener(DataChangeEvent e) throws Exception {
    boolean isChanged = true;
    isChanged = MakeControl.isF7ValueChanged(e);
    if (!isChanged) {
      return;
    }
    if (e.getOldValue() != null) {
      this.prmtRegion.setValue(null);
    }
    CityInfo info = null;
    if (e.getNewValue() != null) {
      IObjectPK pk = new ObjectUuidPK(((CityInfo)e.getNewValue()).getId().toString());

      info = CityFactory.getRemoteInstance().getCityInfo(pk);
      this.prmtProvince.setValue(MakeControl.getProvinceInfoFromCity(info));
      MakeControl.makeRegionF7FromCity(this.prmtRegion, info);
    } else if ((info == null) && (this.prmtProvince.getValue() != null)) {
      IObjectPK pk = new ObjectUuidPK(((ProvinceInfo)this.prmtProvince.getValue()).getId().toString());

      ProvinceInfo pInfo = ProvinceFactory.getRemoteInstance().getProvinceInfo(pk);

      MakeControl.makeRegionF7FromProvince(this.prmtRegion, pInfo);
    }
  }

  private void regionDataChangeListener(DataChangeEvent e) throws Exception {
    boolean isChanged = true;
    isChanged = MakeControl.isF7ValueChanged(e);
    if (!isChanged) {
      return;
    }

    if (e.getNewValue() != null) {
      IObjectPK pk = new ObjectUuidPK(((RegionInfo)e.getNewValue()).getId().toString());

      RegionInfo info = RegionFactory.getRemoteInstance().getRegionInfo(pk);

      this.prmtCity.setValue(MakeControl.getCityInfoFromRegion(info));
      if (MakeControl.getCityInfoFromRegion(info) != null) {
        IObjectPK cPk = new ObjectUuidPK(MakeControl.getCityInfoFromRegion(info).getId().toString());

        CityInfo cInfo = CityFactory.getRemoteInstance().getCityInfo(cPk);

        if (MakeControl.getProvinceInfoFromCity(cInfo) != null) {
          IObjectPK pks = new ObjectUuidPK(MakeControl.getProvinceInfoFromCity(cInfo).getId().toString());

          ProvinceInfo pInfo = ProvinceFactory.getRemoteInstance().getProvinceInfo(pks);

          this.prmtProvince.setValue(pInfo);
        }
      }
    }
  }

  protected void afterTableFillData(KDTDataRequestEvent e) {
    super.afterTableFillData(e);
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
    for (int i = 0; i < this.tblMain.getRowCount(); ++i) {
      ICell cell = this.tblMain.getCell(i, "age");
      if (cell.getValue() == null) {
        continue;
      }

      Integer nowYear = Integer.valueOf(sdf.format(new Date()));
      Integer birthdayYear = null;
      try {
        birthdayYear = Integer.valueOf(sdf.format(sdf.parse(cell.getValue().toString())));
      } catch (NumberFormatException e1) {
        e1.printStackTrace();
      } catch (ParseException e1) {
        e1.printStackTrace();
      }

      if (birthdayYear.intValue() < 200) {
        continue;
      }

      this.tblMain.getCell(i, "age").setValue(Integer.valueOf(nowYear.intValue() - birthdayYear.intValue()));
    }
  }

  public void actionCar_actionPerformed(ActionEvent e)
    throws Exception
  {
    super.actionCar_actionPerformed(e);
    List rows = getSelectedRows();
    if (rows.size() <= 0) {
      MsgBox.showInfo("没有选中行");
      return;
    }
    IRow row = (IRow)rows.get(0);

    String id = row.getCell("vehicle.id").getValue().toString();
    UIContext uiContext = new UIContext(this);
    uiContext.put("ID", id);
    IUIWindow uiWindow = UIFactory.createUIFactory("com.kingdee.eas.base.uiframe.client.UINewTabFactory").create(VehicleEditUI.class.getName(), uiContext, null, OprtState.EDIT);
    uiWindow.show();
  }

  public void actionCustomer_actionPerformed(ActionEvent e) throws Exception {
    super.actionCustomer_actionPerformed(e);
    List rows = getSelectedRows();
    if (rows.size() <= 0) {
      MsgBox.showInfo("没有选中行");
      return;
    }
    IRow row = (IRow)rows.get(0);
    String id = row.getCell("id").getValue().toString();
    UIContext uiContext = new UIContext(this);
    uiContext.put("ID", id);
    uiContext.put("checkRepeat", "no");
    IUIWindow uiWindow = UIFactory.createUIFactory("com.kingdee.eas.base.uiframe.client.UINewTabFactory").create(CustomerEditUI.class.getName(), uiContext, null, OprtState.EDIT);

    uiWindow.show();
  }

  public void actionAllo_actionPerformed(ActionEvent e) throws Exception {
    super.actionAllo_actionPerformed(e);

    UIContext uiContext = new UIContext(this);
    uiContext.put("Owner", this);
    uiContext.put("myFilterInfo", this.myFilterInfo);
    uiContext.put("rs", rs);

    IUIWindow uiWindow = UIFactory.createUIFactory("com.kingdee.eas.base.uiframe.client.UINewTabFactory").create(AlloBillEditUI.class.getName(), uiContext, null, OprtState.ADDNEW);
    uiWindow.show();
  }

  protected void tblMain_tableSelectChanged(KDTSelectEvent e) throws Exception {
    super.tblMain_tableSelectChanged(e);
    List rows = getSelectedRows();
    if (rows.size() > 1) {
      this.btnCar.setEnabled(false);
      this.btnCustomer.setEnabled(false);
    } else {
      this.btnCar.setEnabled(true);
      this.btnCustomer.setEnabled(true);
    }
  }

  private List getSelectedRows() {
    List rows = new ArrayList();
    KDTSelectBlock selectBlock = null;
    int size = this.tblMain.getSelectManager().size();
    for (int i = 0; i < size; ++i) {
      selectBlock = this.tblMain.getSelectManager().get(i);
      for (int j = selectBlock.getTop(); j <= selectBlock.getBottom(); ++j) {
        IRow row = this.tblMain.getRow(j);
        rows.add(row);
      }
    }
    return rows;
  }

  public static void makeSeriesF7(KDBizPromptBox f7Model, BrandInfo info) throws Exception {
    FilterInfo fi = new FilterInfo();
    FilterItemCollection fic = fi.getFilterItems();
    EntityViewInfo evi = new EntityViewInfo();
    try {
      fic.add(new FilterItemInfo("isUse", new Integer(1), CompareType.EQUALS));

      fic.add(new FilterItemInfo("auditStatus", new Integer("2"), CompareType.EQUALS));

      fic.add(new FilterItemInfo("brand.isUse", new Integer(1), CompareType.EQUALS));

      fic.add(new FilterItemInfo("brand.auditStatus", new Integer("2"), CompareType.EQUALS));

      BrandCollection unitColl = CommonUtil.getBrandCollection(info);
      int size = 0;
      if (unitColl != null) {
        size = unitColl.size();
      }
      if (size > 0) {
        Set idSet = new HashSet();
        for (int i = 0; i < size; ++i) {
          idSet.add(unitColl.get(i).getId().toString());
        }
        fic.add(new FilterItemInfo("brand.id", idSet, CompareType.INCLUDE));

        fi.setMaskString("#0 and #1 and #2 and #3 and #4");
      } else {
        fi.setMaskString("#0 and #1 and #2 and #3");
      }
      evi.setFilter(fi);
      f7Model.setQueryInfo("com.kingdee.eas.auto4s.bdm.pbd.app.SeriesQuery");
      f7Model.setVisible(true);
      f7Model.setEditable(true);
      f7Model.setDisplayFormat("$name$");
      f7Model.setEditFormat("$number$");
      f7Model.setCommitFormat("$number$");
      f7Model.setEntityViewInfo(evi);
    } catch (EASBizException e) {
      e.printStackTrace();
    } catch (BOSException e) {
      e.printStackTrace();
    }
  }

  public static void makeCompanyF7(KDBizPromptBox f7Model, BrandInfo info) throws Exception {
    BrandCompanyCollection brandCollection = null;

    EntityViewInfo evi1 = new EntityViewInfo();
    FilterInfo filter1 = new FilterInfo();
    filter1.getFilterItems().add(new FilterItemInfo("parent.id", info.getId().toString(), CompareType.EQUALS));
    evi1.setFilter(filter1);

    EntityViewInfo evi = new EntityViewInfo();
    FilterInfo filter = new FilterInfo();
    FilterItemCollection fic = filter.getFilterItems();
    try {
      brandCollection = BrandCompanyFactory.getRemoteInstance().getBrandCompanyCollection(evi1);

      int size = 0;
      if (brandCollection != null) {
        size = brandCollection.size();
      }
      if (size > 0) {
        Set idSet = new HashSet();
        for (int i = 0; i < size; ++i) {
          BrandCompanyInfo company = brandCollection.get(i);

          if (company.getOrgUnit() != null) {
            idSet.add(company.getOrgUnit().getId().toString());
          }
        }
        fic.add(new FilterItemInfo("SaleOrgUnit.id", idSet, CompareType.INCLUDE));
      }

      evi.setFilter(filter);
    } catch (BOSException e) {
      e.printStackTrace();
    }

    f7Model.setQueryInfo("com.kingdee.eas.basedata.org.app.SaleOrgUnitQuery");
    f7Model.setVisible(true);
    f7Model.setEditable(true);
    f7Model.setEntityViewInfo(evi);
    f7Model.setDisplayFormat("$name$");
    f7Model.setEditFormat("$number$");
    f7Model.setCommitFormat("$number$");
  }

  public static void makeModelF7(KDBizPromptBox f7Model, BrandInfo info) throws Exception {
    FilterInfo fi = new FilterInfo();
    FilterItemCollection fic = fi.getFilterItems();
    EntityViewInfo evi = new EntityViewInfo();
    try {
      fic.add(new FilterItemInfo("isUse", new Integer(1), CompareType.EQUALS));

      fic.add(new FilterItemInfo("auditStatus", new Integer("2"), CompareType.EQUALS));

      fic.add(new FilterItemInfo("brand.isUse", new Integer(1), CompareType.EQUALS));

      fic.add(new FilterItemInfo("brand.auditStatus", new Integer("2"), CompareType.EQUALS));

      BrandCollection unitColl = CommonUtil.getBrandCollection(info);
      int size = 0;
      if (unitColl != null) {
        size = unitColl.size();
      }
      if (size > 0) {
        Set idSet = new HashSet();
        for (int i = 0; i < size; ++i) {
          idSet.add(unitColl.get(i).getId().toString());
        }
        fic.add(new FilterItemInfo("brand.id", idSet, CompareType.INCLUDE));

        fi.setMaskString("#0 and #1 and #2 and #3 and #4");
      } else {
        fi.setMaskString("#0 and #1 and #2 and #3");
      }
      evi.setFilter(fi);
      f7Model.setQueryInfo("com.kingdee.eas.auto4s.bdm.pbd.app.ModelF7Query");
      f7Model.setVisible(true);
      f7Model.setEditable(true);
      f7Model.setDisplayFormat("$name$");
      f7Model.setEditFormat("$number$");
      f7Model.setCommitFormat("$number$");
      f7Model.setEntityViewInfo(evi);
    } catch (EASBizException e) {
      e.printStackTrace();
    } catch (BOSException e) {
      e.printStackTrace();
    }
  }

  public static void makePositionF7(KDBizPromptBox prmtBox, OrgUnitInfo orgUnit, FilterInfo mergeFilter) throws EASBizException, BOSException {
    prmtBox.setQueryInfo("com.kingdee.eas.hr.org.app.PositionF7Query");
    prmtBox.setDisplayFormat("$name$");
    prmtBox.setEditFormat("$number$");
    prmtBox.setCommitFormat("$number$");

    FilterInfo filter = new FilterInfo();
    filter.getFilterItems().add(new FilterItemInfo("deletedStatus", String.valueOf(1), CompareType.EQUALS));

    if (orgUnit != null) {
      FilterInfo basedataControlFilter = VehicleParamCache.getInstance().getPersonFilter(orgUnit);
      filter.mergeFilter(basedataControlFilter, "AND");
    }

    if (mergeFilter != null) {
      filter.mergeFilter(mergeFilter, "AND");
    }
    EntityViewInfo evi = new EntityViewInfo();
    evi.setFilter(filter);
    prmtBox.setEntityViewInfo(evi);
  }

  public void actionClearSearch_actionPerformed(ActionEvent e) throws Exception {
    this.pkFirstdate.setValue(null);
    this.pkLastdate.setValue(null);
    this.textAge.setText(null);
    this.textAgeLast.setText(null);
    this.pkBirthday.setValue(null);
    this.pkBirthdayLast.setValue(null);
    this.pkTaxStart.setValue(null);
    this.pkTaxLast.setValue(null);
    this.prmtProvince.setValue(null);
    this.prmtCity.setValue(null);
    this.prmtRegion.setValue(null);
    this.comboCustAttribute.setSelectedItem(null);
    this.comboCustType.setSelectedItem(null);
    this.comoSex.setSelectedItem(null);
    this.textPlateNum.setText(null);
    this.textVIN.setText(null);
    this.textCustomerName.setText(null);
    this.textPhone.setText(null);
    this.txtPerson.setText(null);
    this.prmtPosition.setValue(null);
    this.prmtBrand.setValue(null);
    this.prmtSeries.setValue(null);
    this.prmtModel.setValue(null);
    this.prmtCompany.setValue(null);
  }

  public String[] getMergeColumnKeys() {
    String[] attr = { "id", "customerNum", "taxDate", "customerName", "sex", "age", "phone", "phone2", "phone3", "salePerson", "company", "position", "custSource", "customerType", "customerClassify", "custGroup", "custAttribute", "firstdate", "address", "zipCode", "country", "province", "city", "region", "ageRange", "birthday", "familyStatus", "industry", "degree", "incomeRange", "dirveLiceType", "driveLiceEndDate", "hobby", "papersType", "papersNum", "fax", "Email", "QQ", "MSN", "website", "preferContactType", "fitContactDate", "mainBusiness", "compType", "compNature", "createDate", "compScale", "compLegalName", "compLegalTel", "compRemark", "compBillName", "compBillBank", "compBillAccount", "career", "orgNum", "taxNum", "discountClassify", "customJob", "compRegAddress", "compOpenAddress", "areaBelong", "source", "brand", "vIN", "engineNum", "plateNum", "plateColor", "model", "series", "otherBrandVehicle", "vehicleCreateType", "vehicleRemark", "onRoadStatus", "pDIStatus", "reservedStatus", "assignStatus", "virtualIssueStatus", "buyAutoOrgUnit", "orgUnit", "warehouse", "location", "productDate", "guaranteeNum", "certificationNum", "importDocNum", "inspectionNum", "vehicleInfo", "keyNum", "keyPlace", "bankAccount", "transferDate", "transferRemark", "repairOrgUnit", "servicePerson", "toServiceDate", "warrantyStartDate", "warrantyEndDate", "vRCExpireDate", "yearExamineExpireDate", "greenLabelExpireDate", "warrantyMile", "vehicleStatus", "color", "optionItemCombine", "inner", "mainUser", "vRCBelongPlace", "iDNum", "purReceiveDate", "initVehicle", "modelVersion", "isMortgage", "keepingOrgUnit", "isDecoration", "belong", "insuCompany", "insuInvalidDate", "insuranceNumber", "saleOrg", "saleDate", "plateDate", "vRCRegDate", "belongOrgUnit", "trustStatus", "traffInvalidDate", "traffInsuNumber", "bridgeFeeDate", "vehicle.id" };

    return attr;
  }

  protected void prepareUIContext(UIContext uiContext, ActionEvent e)
  {
    uiContext.put("checkRepeat", "no");
    super.prepareUIContext(uiContext, e);
  }
}

你可能感兴趣的:(OO)