1.在单据类型管理中对二开的单据设置上下游关系
2.退出客户端,清理缓存。
3.在流程管理中的单据转换规则中配置单据转换规则
配置里面的来源单据显示类,来源单据查询类,来源单据单据查询模板标识
4.定义来源单据显示类
package nc.ui.ia.mosystem.ace.refbill;
import java.awt.Container;
import nc.ui.pub.pf.BillSourceVar;
import nc.ui.pubapp.billref.src.view.SourceRefDlg;
public class ScRefBillDlg extends SourceRefDlg {
public ScRefBillDlg(Container parent, BillSourceVar bsVar) {
// TODO Auto-generated constructor stub
super(parent, bsVar);
}
@Override
public String getRefBillInfoBeanPath() {
// TODO Auto-generated method stub
return "nc/ui/ia/mosystem/ace/refbill/refinfo_forSc02.xml";
}
}
5.定义来源单据查询类
package nc.ui.ia.mosystem.ace.refbill;
import java.awt.Container;
import nc.ui.pubapp.billref.src.DefaultBillReferQuery;
import nc.ui.pubapp.uif2app.query2.QueryConditionDLGDelegator;
import nc.vo.querytemplate.TemplateInfo;
public class BillRefQueryForRefBill extends DefaultBillReferQuery {
public BillRefQueryForRefBill(Container c, TemplateInfo info) {
super(c, info);
// TODO Auto-generated constructor stub
}
@Override
protected void initQueryConditionDLG(QueryConditionDLGDelegator dlgDelegator) {
// TODO Auto-generated method stub
super.initQueryConditionDLG(dlgDelegator);
}
}
6.设置来源单据查询模板标识
就是这个节点标识
7.配置转换规则
8.新增单据单表单据模板
执行SQL:
insert into pub_billtemplet(bill_templetcaption,bill_templetname,devorg,dividerproportion,dr,funccode,layer,metadataclass,model_type,modulecode,nodecode,options,pk_billtemplet,pk_billtypecode,pk_corp,pk_org,resid,shareflag,ts)
values('各档位结算价变化率单表','SYSTEM','~',NULL,0,NULL,0,'ia.GdwjsHVO',NULL,'IA','20149902',NULL,'1001Z810000000000099','bt_L','@@@@',null,'1400603010175',null,'2020-07-02 17:45:30');
执行完成后,到单据模板初始化中设置模板字段,并在单据节点默认模板节点中找到对应单据将模板加入进来
9.定义ViewVO
package nc.vo.ia.gdwjs;
import nc.vo.pubapp.pattern.model.meta.entity.view.DataViewMetaFactory;
import nc.vo.pubapp.pattern.model.meta.entity.view.IDataViewMeta;
public class GdwjsViewVO extends nc.vo.pubapp.pattern.model.entity.view.AbstractDataView {
@Override
public IDataViewMeta getMetaData() {
// TODO Auto-generated method stub
return DataViewMetaFactory.getInstance().getBillViewMeta(AggGdwjsHVO.class);
}
public GdwjsHVO getHead(){
return (GdwjsHVO) getVO(GdwjsHVO.class);
}
public void setHead(GdwjsHVO head){
setVO(head);
}
public GdwjsBVO getBody(){
return (GdwjsBVO) getVO(GdwjsBVO.class);
}
public void setBody(GdwjsBVO body){
setVO(body);
}
public AggGdwjsHVO changeToAggGdwjsHVO(){
AggGdwjsHVO vo = new AggGdwjsHVO();
vo.setParent(getHead());
GdwjsBVO[] bodys = {getBody()};
vo.setChildrenVO(bodys);
return vo;
}
}
10.定义refinfo_forSc02.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- 转单参照单据信息 -->
<bean id="refInfo" class="nc.ui.pubapp.billref.src.RefInfo">
<property name="userdefitemListPreparator" ref="userdefitemListPreparator" />
<property name="singleUserdefitemListPreparator" ref="singleUserdefitemListPreparator" />
<property name="headVO">
<bean class="nc.vo.ia.gdwjs.GdwjsHVO">
</bean>
</property>
<property name="bodyVO">
<bean class="nc.vo.ia.gdwjs.GdwjsBVO">
</bean>
</property>
<property name="billVO">
<bean class="nc.vo.ia.gdwjs.AggGdwjsHVO">
</bean>
</property>
<property name="viewVO">
<bean class="nc.vo.ia.gdwjs.GdwjsViewVO">
</bean>
</property>
<property name="billNodeKey" value ="bt"></property>
<property name="billViewNodeKey" value ="bt_L"></property>
<property name="sourcevoPkName" value ="csrcid"></property>
<property name="sourcevoBillNOName" value ="vsrccode"></property>
<!-- 单据查询服务 nc.ui.pubapp.uif2app.model.IQueryService -->
<property name="queryService">
<bean class="nc.ui.ia.mosystem.ace.serviceproxy.QueryServiceForRefBill">
</bean>
</property>
<property name="defaultFilterItem">
<list>
<value>vbillcode</value>
<value>dbilldate</value>
</list>
</property>
</bean>
<!-- 主子表自定义项配置 -->
<bean id="userdefitemListPreparator" class="nc.ui.pubapp.uif2app.view.CompositeBillListDataPrepare">
<property name="billListDataPrepares">
<list>
<ref bean="listPreparator" />
</list>
</property>
</bean>
<!-- 单表自定义项配置 -->
<bean id="singleUserdefitemListPreparator" class="nc.ui.pubapp.uif2app.view.CompositeBillListDataPrepare">
<property name="billListDataPrepares">
<list>
<ref bean="singleListPreparator" />
</list>
</property>
</bean>
<!-- 主子表自定义项处理 -->
<bean name="listPreparator" class="nc.ui.uif2.editor.UserdefitemContainerListPreparator">
<property name="container" ref="userdefitemContainer" />
<property name="params">
<list>
<bean class="nc.ui.uif2.editor.UserdefQueryParam">
<property name="rulecode" value="SC02_H" />
<property name="pos" value="0" />
<property name="prefix" value="def" />
</bean>
<bean class="nc.ui.uif2.editor.UserdefQueryParam">
<property name="rulecode" value="SC02_B" />
<property name="pos" value="1" />
<property name="prefix" value="bdef" />
<property name="tabcode" value="bodytable1" />
</bean>
</list>
</property>
</bean>
<!-- 单表自定义项处理 -->
<bean name="singleListPreparator" class="nc.ui.uif2.editor.UserdefitemContainerListPreparator">
<property name="container" ref="userdefitemContainer" />
<property name="params">
<list>
<bean class="nc.ui.uif2.editor.UserdefQueryParam">
<property name="rulecode" value="SC02_H" />
<property name="pos" value="0" />
<property name="prefix" value="def" />
</bean>
<bean class="nc.ui.uif2.editor.UserdefQueryParam">
<property name="rulecode" value="SC02_B" />
<property name="pos" value="0" />
<property name="prefix" value="bdef" />
</bean>
</list>
</property>
</bean>
<bean id="userdefitemContainer"
class="nc.ui.pubapp.billref.src.editor.BillRefUserDefItemContainer">
<property name="params">
<list>
<bean class="nc.ui.uif2.userdefitem.QueryParam">
<property name="rulecode" value="SC02_H" />
</bean>
<bean class="nc.ui.uif2.userdefitem.QueryParam">
<property name="rulecode" value="SC02_B" />
</bean>
</list>
</property>
</bean>
</beans>
11.增加按钮并实现
单据xml:
<bean id="addFromSC02" class="nc.ui.ia.mosystem.ace.action.AddFromSC02">
<!-- 来源单据类型编码 -->
<property name="sourceBillType" value="SC02" />
<!-- 来源单据类型名称 -->
<property name="sourceBillName" value="参照各档位结算价变化率" />
<!-- 是否流程单据,如果是流程单据,可以删除 -->
<property name="flowBillType" value="false" />
<property name="model" ref="bmModel" />
<property name="editor" ref="billForm" />
<property name="transferBillViewProcessor" ref="transferProcessor" />
</bean>
<bean name="transferProcessor" class="nc.ui.pubapp.billref.dest.TransferBillViewProcessor">
<property name="list" ref="billListView" />
<property name="transferLogic" ref="transferLogic" />
<property name="actionContainer" ref="actionsOfList" />
<property name="billForm" ref="billForm" />
</bean>
<bean name="transferLogic" class="nc.ui.pubapp.billref.dest.DefaultBillDataLogic">
<property name="billForm" ref="billForm" />
</bean>
按钮中的代码:
package nc.ui.ia.mosystem.ace.action;
import java.awt.event.ActionEvent;
import nc.itf.uap.pf.busiflow.PfButtonClickContext;
import nc.ui.pubapp.uif2app.actions.AbstractReferenceAction;
import nc.ui.pubapp.uif2app.funcnode.trantype.TrantypeFuncUtils;
import nc.ui.uif2.editor.IBillCardPanelEditor;
import nc.ui.uif2.model.AbstractAppModel;
import nc.ui.pub.pf.PfUtilClient;
import nc.vo.ia.mosystem.AggMosystemHVO;
import nc.vo.jcom.lang.StringUtil;
public class AddFromSC02 extends AbstractReferenceAction {
private IBillCardPanelEditor editor;
private AbstractAppModel model;
@Override
public void doAction(ActionEvent e) throws Exception {
// TODO Auto-generated method stub
PfUtilClient.childButtonClickedNew(this.createPfButtonClickContext());
if(PfUtilClient.isCloseOK()){
AggMosystemHVO[] vos = (AggMosystemHVO[]) PfUtilClient.getRetVos();
this.getTransferBillViewProcessor().processBillTransfer(vos);
}
}
private PfButtonClickContext createPfButtonClickContext() {
// TODO Auto-generated method stub
PfButtonClickContext context = new PfButtonClickContext();
context.setParent(this.getModel().getContext().getEntranceUI());
context.setSrcBillType(this.getSourceBillType());
context.setPk_group(this.getModel().getContext().getPk_group());
context.setUserId(this.getModel().getContext().getPk_loginUser());
// 如果该节点是由交易类型发布的,那么这个参数应该传交易类型,否则传单据类型
String vtrantype = TrantypeFuncUtils.getTrantype(this.getModel()
.getContext());
if (StringUtil.isEmptyWithTrim(vtrantype)) {
context.setCurrBilltype("SC05");
} else {
context.setCurrBilltype(vtrantype);
}
context.setUserObj(null);
context.setSrcBillId(null);
context.setBusiTypes(this.getBusitypes());
// 上面的参数在原来调用的方法中都有涉及,只不过封成了一个整结构,下面两个参数是新加的参数
// 上游的交易类型集合
context.setTransTypes(this.getTranstypes());
// 标志在交换根据目的交易类型分组时,查找目的交易类型的依据,有三个可设置值:1(根据接口定义)、
// 2(根据流程配置)、-1(不根据交易类型分组)
context.setClassifyMode(PfButtonClickContext.NoClassify);
return context;
}
public IBillCardPanelEditor getEditor() {
return editor;
}
public void setEditor(IBillCardPanelEditor editor) {
this.editor = editor;
}
public AbstractAppModel getModel() {
return model;
}
public void setModel(AbstractAppModel model) {
this.model = model;
model.addAppEventListener(this);
}
}
最后的效果