注意事项:不要导错包,query, 过滤字段

/**
* output package name
*/
package com.kingdee.eas.guiliumuye.duckbreeding.client;

import java.awt.event.*;
import org.apache.log4j.Logger;

import com.kingdee.eas.basedata.framework.client.GeneralKDPromptSelectorAdaptor;
import com.kingdee.eas.basedata.master.cssp.CSSPGroupInfo;
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.query.util.CompareType;
import com.kingdee.bos.ui.face.CoreUIObject;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.eas.basedata.master.cssp.client.F7CustomerTreeDetailListUI;
import com.kingdee.eas.basedata.master.cssp.client.F7SupplierTreeDetailListUI;
import com.kingdee.eas.basedata.master.material.client.F7BaseSelector;
import com.kingdee.eas.common.client.SysContext;

import com.kingdee.bos.ctrl.extendcontrols.KDBizPromptBox;
import com.kingdee.bos.ctrl.kdf.table.KDTable;
import com.kingdee.bos.ctrl.swing.KDPromptBox;


/**
* output class name
*/
public class FreightUnitEditUI extends AbstractFreightUnitEditUI
{
private static final Logger logger = CoreUIObject.getLogger(FreightUnitEditUI.class);

/**
* output class constructor
*/
public FreightUnitEditUI() throws Exception
{
super();
}


@Override
public void onLoad() throws Exception {
// TODO Auto-generated method stub
super.onLoad();
initEntryF7() ;
}

/**
* output loadFields method
*/
public void loadFields()
{
super.loadFields();
try {
initEntryF7();
} catch (Exception e) {
e.printStackTrace();
}
}

/**
* output storeFields method
*/
public void storeFields()
{
super.storeFields();

}


/**
* 客户F7功能,实现左树右表
* @param prmt 绑定F7功能控件
* @param owner 传递对象
* @param flag 是否多选
* @return
*/
public static EntityViewInfo setCustomerTree(KDPromptBox prmt, Object owner
,boolean flag){
GeneralKDPromptSelectorAdaptor selectorLisenterCustomer = new GeneralKDPromptSelectorAdaptor(
prmt, F7CustomerTreeDetailListUI.class.getName(),
owner, CSSPGroupInfo.getBosType(), "com.kingdee.eas.basedata.master.cssp.app.F7CustomerSaleQuery",
"browseGroup.id");

selectorLisenterCustomer.setIsMultiSelect(false);
selectorLisenterCustomer.setQueryProperty("mnemonicCode", "or");
prmt.setSelector(selectorLisenterCustomer);
prmt.addSelectorListener(selectorLisenterCustomer);

return setF7CustomerFilterUsedDuckSale();
}


/**
* 客户F7过滤(销售属性)
* @return
*/
public static EntityViewInfo setF7CustomerFilterUsedDuckSale(){
// 客户F7过滤
EntityViewInfo entityViewInfo = new EntityViewInfo();
SysContext ctx = SysContext.getSysContext();
FilterInfo filterInfo = new FilterInfo(); // 建立过滤条件
FilterItemInfo fii = null;
int iFldCount = 0;
StringBuffer maskStr = new StringBuffer();
// 建立过滤条件集合
FilterItemCollection filterItems = filterInfo.getFilterItems();

fii = new FilterItemInfo("saleOrgUnit.id",ctx.getCurrentCtrlUnit().getId().toString(), CompareType.EQUALS);
filterItems.add(fii);
maskStr.append("#").append(iFldCount);
iFldCount++;
// 设置基础属性过滤为核准
fii = new FilterItemInfo("usedStatus", 1, CompareType.EQUALS);
filterItems.add(fii);
maskStr.append(" and #").append(iFldCount);
iFldCount++;


filterInfo.setMaskString(maskStr.toString());
entityViewInfo.setFilter(filterInfo);
return entityViewInfo;
}


/**
* 供应商F7功能,实现左树右表
* @param prmt 绑定F7功能控件
* @param owner 传递对象
* @param flag 是否多选
* @return
*/
public static EntityViewInfo setSupplierTree(KDPromptBox prmt, Object owner
,boolean flag){
GeneralKDPromptSelectorAdaptor selectorLisenterSupplier = new GeneralKDPromptSelectorAdaptor(
prmt, F7SupplierTreeDetailListUI.class.getName(),
owner, CSSPGroupInfo.getBosType(), "com.kingdee.eas.basedata.master.cssp.app.F7SupplierCompanyQuery",
"browseGroup.id");

selectorLisenterSupplier.setIsMultiSelect(false);
selectorLisenterSupplier.setQueryProperty("mnemonicCode", "or");
prmt.setSelector(selectorLisenterSupplier);
prmt.addSelectorListener(selectorLisenterSupplier);

return setF7SupplierFilterUsedSale();
}

/**
*供应商F7过滤(销售属性)
* @return
*/
public static EntityViewInfo setF7SupplierFilterUsedSale(){
// 供应商F7过滤
EntityViewInfo entityViewInfo = new EntityViewInfo();
SysContext ctx = SysContext.getSysContext();
FilterInfo filterInfo = new FilterInfo(); // 建立过滤条件
FilterItemInfo fii = null;
int iFldCount = 0;
StringBuffer maskStr = new StringBuffer();
// 建立过滤条件集合
FilterItemCollection filterItems = filterInfo.getFilterItems();

fii = new FilterItemInfo("COMPANYORGUNIT.ID",ctx.getCurrentCtrlUnit().getId().toString(), CompareType.EQUALS);
filterItems.add(fii);
maskStr.append("#").append(iFldCount);
iFldCount++;
// 设置基础属性过滤为核准
fii = new FilterItemInfo("usedStatus", 1, CompareType.EQUALS);
filterItems.add(fii);
maskStr.append(" and #").append(iFldCount);
iFldCount++;


filterInfo.setMaskString(maskStr.toString());
entityViewInfo.setFilter(filterInfo);
return entityViewInfo;
}





/**
* 分录中,F7字段实现数据过滤
* 需要在界面加载onload()方法中调用该方法
*/
public void initEntryF7() throws Exception {
KDBizPromptBox customer = (KDBizPromptBox) kdtE1.getColumn("customer").getEditor().getComponent(); //获取表格特定列绑定的F7
//调用
EntityViewInfo entityViewInfo = setCustomerTree(customer,this,false);
customer.setEntityViewInfo(entityViewInfo);

//调用
KDBizPromptBox supplyNumber = (KDBizPromptBox) kdtE1.getColumn("supplyNumber").getEditor().getComponent(); //获取表格特定列绑定的F7
EntityViewInfo entityViewInfo2 = setSupplierTree(supplyNumber,this,false);
supplyNumber.setEntityViewInfo(entityViewInfo2);

}

/**
* output btnAddLine_actionPerformed method
*/
protected void btnAddLine_actionPerformed(java.awt.event.ActionEvent e) throws Exception
{
super.btnAddLine_actionPerformed(e);
}



}