参照开发
第一步:在单据类型管理中设置当前单据的上下游对照(集团管理员账号),点击左上边修改,行操作,添加上下游单据对照
第二步:在MDP透视图中,流程信息获取、回写接口映射上下游单据
第三步:上游单据(即开票登记)中设置单据模板和查询模板
第四步:在单据转换规则中设置单据交换规则(pub_vochange pub_vochange_b )
第一步:找到单据对应xml配置文件,在界面布局总装中找到列表和卡片的按钮组,新增按钮修改为红色部分
第二步:开发参照按钮,以合同为例
package nc.ui.wxcont.cont.billref.base;
import java.awt.event.ActionEvent;
import nc.itf.uap.pf.busiflow.PfButtonClickContext;
import nc.ui.arap.model.ArapBillManageModel;
import nc.ui.pub.pf.PfUtilClient;
import nc.ui.pubapp.uif2app.actions.AbstractReferenceAction;
import nc.ui.pubapp.uif2app.funcnode.trantype.TrantypeFuncUtils;
import nc.ui.pubapp.uif2app.model.BillManageModel;
import nc.ui.uif2.UIState;
import nc.ui.uif2.editor.BillForm;
import nc.vo.jcom.lang.StringUtil;
import nc.vo.pub.AggregatedValueObject;
/**
* 参照合同
*/
@SuppressWarnings({ "serial", "restriction" })
public class AddFromHTDJAction extends AbstractReferenceAction{
private BillManageModel model;
private BillForm editor;
private String destBillType;
public String getDestBillType() {
return destBillType;
}
public void setDestBillType(String destBillType) {
this.destBillType = destBillType;
}
public BillForm getEditor() {
return editor;
}
public void setEditor(BillForm editor) {
this.editor = editor;
}
public BillManageModel getModel() {
return model;
}
public void setModel(BillManageModel model) {
this.model = model;
model.addAppEventListener(this);
}
@Override
public void doAction(ActionEvent arg0) throws Exception {
PfUtilClient.childButtonClickedNew(createPfButtonClickContext());
if (PfUtilClient.isCloseOK()) {
AggregatedValueObject[] vos = (AggregatedValueObject[]) PfUtilClient.getRetVos();
// 显示到转单界面上
this.getTransferViewProcessor().processBillTransfer(vos);
}
}
private PfButtonClickContext createPfButtonClickContext() {
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(destBillType);
} else {
context.setCurrBilltype(vtrantype);
}
context.setUserObj(null);
context.setSrcBillId(null);
context.setBusiTypes(this.getBusitypes());
// 上面的参数在原来调用的方法中都有涉及,只不过封成了一个整结构,下面两个参数是新加的参数
// 上游的交易类型集合
context.setTransTypes(this.getTranstypes());
// 标志在交换根据目的交易类型分组时,查找目的交易类型的依据,有三个可设置值:1(根据接口定义)、
// 2(根据流程配置)、-1(不根据交易类型分组)
context.setClassifyMode(PfButtonClickContext.ClassifyByItfdef);
return context;
}
@Override
protected boolean isManual() {
return true;
}
@Override
protected boolean isActionEnable() {
return this.model.getUiState() == UIState.NOT_EDIT;
}
}
------------------------------------------------------------------------
package nc.ui.wxcont.cont.billref.base;
import nc.bs.framework.common.NCLocator;
import nc.itf.wxcont.IWx_contractMaintain;
import nc.ui.pubapp.uif2app.query2.model.IRefQueryService;
import nc.ui.querytemplate.querytree.IQueryScheme;
public class BillQueryService implements IRefQueryService {
@Override
public Object[] queryByWhereSql(String whereSql) throws Exception {
// TODO 自动生成的方法存根
return null;
}
@Override
public Object[] queryByQueryScheme(IQueryScheme queryScheme)
throws Exception {
IWx_contractMaintain contractMaintain=NCLocator.getInstance().lookup(IWx_contractMaintain.class);
return contractMaintain.query(queryScheme);
}
}
-------------------------------------------------------------------------------
package nc.ui.wxcont.cont.billref.base;
import java.awt.Container;
import java.util.ArrayList;
import java.util.List;
import nc.ui.pubapp.billref.src.DefaultBillReferQuery;
import nc.ui.pubapp.uif2app.query2.QueryConditionDLGDelegator;
import nc.ui.pubapp.uif2app.query2.refregion.QueryDefaultOrgFilter;
import nc.vo.querytemplate.TemplateInfo;
/**
*
* @功能说明:拉单加载查询弹窗
*
*
*/
@SuppressWarnings("restriction")
public class BillReferQuery extends DefaultBillReferQuery{
public BillReferQuery(Container c, TemplateInfo info) {
super(c, info);
}
@Override
protected void initQueryConditionDLG(QueryConditionDLGDelegator delegator) {
List
targetFields.add("pk_project");
targetFields.add("pk_supplier");
targetFields.add("pk_customer");
// TODO 加入需要按组织过滤的参照字段
QueryDefaultOrgFilter orgFilter=new QueryDefaultOrgFilter(delegator,"pk_org",targetFields);
orgFilter.addEditorListener();
}
}
--------------------------------------------------------------------------------------------------
package nc.ui.wxcont.cont.billref.base;
import java.awt.Container;
import nc.ui.pub.beans.MessageDialog;
import nc.ui.pub.beans.UIDialogEvent;
import nc.ui.pub.pf.BillSourceVar;
import nc.ui.pubapp.billref.src.view.SourceRefDlg;
import nc.vo.pub.AggregatedValueObject;
import org.apache.commons.lang.ArrayUtils;
/**
* 拉单查询后来源数据显示界面
* @throws
*/
@SuppressWarnings("restriction")
public class BillSourceRefDlg extends SourceRefDlg {
private static final long serialVersionUID = 1L;
public BillSourceRefDlg(Container parent,BillSourceVar bsVar) {
super(parent, bsVar);
}
@Override
public String getRefBillInfoBeanPath() {
return "nc/ui/wxcont/cont/billref/base/BillRefinfo.xml";
}
@Override
public void closeOK() {
setResult(ID_OK);
String msg = validateBillStatus();
if (msg != null && !msg.equals("")) {
MessageDialog.showErrorDlg(this, "参照错误", msg);
} else {
close();
fireUIDialogClosed(new UIDialogEvent(this, UIDialogEvent.WINDOW_OK));
}
return;
}
/**
* 校验数据是否有选择
* @return
*/
private String validateBillStatus() {
AggregatedValueObject[] purbill = (AggregatedValueObject[]) getRetVos();
if (ArrayUtils.isEmpty(purbill)) {
return "没有选择任何数据";
}
StringBuilder msg = new StringBuilder();
return msg.toString();
}
@Override
public void loadHeadData() {
super.loadHeadData();
}
}
----------------------------------------------------------------------------------------------------------
错误一:未设置该单据的下游单据,上下游单据还未建立关系