1,实现以下两个接口,
(1)IDAPTransformAdapter和IPCATransformAdapter,
(2)前台注册dapadaptor,
(3)查询表格的每一行数据必须有company.id的值
1 package com.kingdee.eas.re.sales.inTransfer.web; 2 3 import com.kingdee.bos.Context; 4 import com.kingdee.bos.metadata.bot.BOTMappingInfo; 5 import com.kingdee.bos.webframework.component.dap.IDAPTransformAdapter; 6 import com.kingdee.bos.webframework.context.WafContext; 7 import com.kingdee.eas.base.dap.DAPTransformResult; 8 import com.kingdee.eas.fdc.sales.IncomeTransferCollection; 9 import com.kingdee.eas.fdc.sales.IncomeTransferFactory;10 import com.kingdee.eas.fi.cas.utils.CASWebUtil;11 12 public class InTransferDATPTransformAdapter implements IDAPTransformAdapter {13 14 public void afterDAPTrans(BOTMappingInfo mappingInfo,15 DAPTransformResult dapresult) throws Exception {16 // TODO Auto-generated method stub17 18 }19 20 public boolean beforeDAP(String ids) throws Exception {21 // TODO Auto-generated method stub22 return true;23 }24 25 public boolean isNeedShowDAPRule() {26 // TODO Auto-generated method stub27 return true;28 }29 30 }
1 package com.kingdee.eas.re.sales.inTransfer.web; 2 3 import com.kingdee.bos.metadata.bot.BOTMappingInfo; 4 import com.kingdee.bos.webframework.component.dap.IPCATransformAdapter; 5 import com.kingdee.eas.base.dap.DAPTransformResult; 6 7 public class InTransferPCATransformAdapter implements IPCATransformAdapter { 8 9 public void afterPCATrans(BOTMappingInfo mappingInfo,10 DAPTransformResult dapresult) throws Exception {11 // TODO Auto-generated method stub12 13 }14 15 public boolean beforePCA(String bills) throws Exception {16 // TODO Auto-generated method stub17 return true;18 }19 20 public boolean isNeedShowPCARule() {21 // TODO Auto-generated method stub22 return true;23 }24 25 }
前台页面加载后注册这两个类
1 var dapAdaptor = "com.kingdee.eas.re.sales.inTransfer.web.InTransferDATPTransformAdapter"; 2 var pcaAdaptor = "com.kingdee.eas.re.sales.inTransfer.web.InTransferPCATransformAdapter"; 3 if(waf("#dap") && waf("#dap").length > 0 && dapAdaptor) { 4 waf("#dap").dap("option", "mainOrgName", "company.id"); 5 waf("#dap").dap("option", "dapTransformAdapter", dapAdaptor); 6 waf("#dap").dap("option", "pcaTransformAdapter", pcaAdaptor); 7 }
2,代码弹出凭证多规则选择界面(或者直接按钮绑定生成凭证功能)
1 url = "/easweb/component/dap.do?method=actionVoucher&billIDs="+id(需要生成凭证该单据id)+"&dapTransformAdapter=com.kingdee.eas.re.sales.inTransfer.web.InTransferDATPTransformAdapter&modelOrgValue="+company.id(公司id)+"&mainorgunit="+company.id(公司id)+"&mainorgtype=Sale&waf2skin=easbase"; 2 waf.window.open({ 3 url:url, 4 OpenType:"iframe", 5 method:'POST', 6 data:{ 7 billIDs : id,(需要生成凭证该单据id) 8 modelOrgValue:company.id,(公司id) 9 dapTransformAdapter:'com.kingdee.eas.re.sales.inTransfer.web.InTransferDATPTransformAdapter'}, 10 modal:true, 11 openFromParent:false, 12 title:"生成凭证", 13 showTitleBar : true,14 position: 'center', 15 width: 500,16 height: 400,17 minHeight:500,18 minWidth:640, 19 iconCls:"ui-icon-winIcon", 20 draggable: true, 21 resizable: false, 22 hideEffect: "slide",23 close:function(event, ui){24 //关闭界面的回调函数25 }, 26 openCompleted:function(event, ui){ }