1. 对分录F7字段设置数据过滤
<span style="font-family:Microsoft YaHei;">public void onLoad() throws Exception {
final KDBizPromptBox kdtCT_owner_PromptBox = new KDBizPromptBox();
kdtCT_owner_PromptBox.setQueryInfo("com.kingdee.eas.basedata.org.app.SaleOrgUnitQuery");
kdtCT_owner_PromptBox.setVisible(true);
kdtCT_owner_PromptBox.setEditable(true);
kdtCT_owner_PromptBox.setDisplayFormat("$number$");
kdtCT_owner_PromptBox.setEditFormat("$number$");
kdtCT_owner_PromptBox.setCommitFormat("$number$");
EntityViewInfo eviOwner = new EntityViewInfo(); //过滤设置
FilterInfo fiOwner = new FilterInfo();
fiOwner.getFilterItems().add(new FilterItemInfo("isBizUnit", Boolean.TRUE)); //实体字段名称
eviOwner.setFilter(fiOwner);
kdtCT_owner_PromptBox.setEntityViewInfo(eviOwner);
KDTDefaultCellEditor kdtCT_owner_CellEditor = new KDTDefaultCellEditor(kdtCT_owner_PromptBox);
this.kdtCT.getColumn("owner").setEditor(kdtCT_owner_CellEditor);
ObjectValueRender kdtCT_owner_OVR = new ObjectValueRender();
kdtCT_owner_OVR.setFormat(new BizDataFormat("$name$"));
this.kdtCT.getColumn("owner").setRenderer(kdtCT_owner_OVR);
}</span>
2. F7字段没有对应的 bizunit 界面设置数据过滤
<span style="font-family:Microsoft YaHei;">public void onLoad() throws Exception {
super.onLoad();
final KDBizPromptBox kdtEntrys_attachID_PromptBox = new KDBizPromptBox(); //分录字段名称 -- 标准
kdtEntrys_attachID_PromptBox.setQueryInfo("com.kingdee.eas.fdc.basedata.app.AttachmentQuery");
kdtEntrys_attachID_PromptBox.setVisible(true);
kdtEntrys_attachID_PromptBox.setEditable(true);
kdtEntrys_attachID_PromptBox.setDisplayFormat("$attachID$");
kdtEntrys_attachID_PromptBox.setEditFormat("$attachID$");
kdtEntrys_attachID_PromptBox.setCommitFormat("$attachID$");
KDTDefaultCellEditor kdtEntrys_attachID_CellEditor = new KDTDefaultCellEditor(kdtEntrys_attachID_PromptBox);
this.kdtEntrys.getColumn("attachID").setEditor(kdtEntrys_attachID_CellEditor);
ObjectValueRender kdtEntrys_attachID_OVR = new ObjectValueRender();
kdtEntrys_attachID_OVR.setFormat(new BizDataFormat("$attachID$"));
this.kdtEntrys.getColumn("attachID").setRenderer(kdtEntrys_attachID_OVR);
kdtEntrys_detailPanel.setTitle("合同列表");
kdtEntrys.getColumn("attachName").getStyleAttributes().setLocked(true); //分录关联字段不可编辑设置
kdtEntrys.getColumn("attachType").getStyleAttributes().setLocked(true);
}
public void kdtEntrys_Changed(int rowIndex, int colIndex) throws Exception {//在对应的值改变事件中对关联字段赋值
super.kdtEntrys_Changed(rowIndex, colIndex);
if ("attachID".equalsIgnoreCase(kdtEntrys.getColumn(colIndex).getKey())){ //改变的是指定的设置的 F7
Object attachIDVal = kdtEntrys.getCell(rowIndex, "attachID").getValue();
if (attachIDVal != null) {
AttachmentCollection attachmentCol = AttachmentFactory.getRemoteInstance().getAttachmentCollection(
" where name = '" + attachIDVal.toString() + "'"); //主要是防止多条数据
if (attachmentCol.size() > 0){
AttachmentInfo attachmentInfo = attachmentCol.get(0);
kdtEntrys.getCell(rowIndex, "attachID").setValue(attachmentInfo.getAttachID());//分录界面是文本框,值改变事件之后需充值
kdtEntrys.getCell(rowIndex, "attachType").setValue(attachmentInfo.getType());
kdtEntrys.getCell(rowIndex, "attachName").setValue(attachmentInfo.getName());
}
}
}
}</span>