zoukankan      html  css  js  c++  java
  • NC 5系自定义显示公式

    1、继承NcInnerFunction(nc.vo.pub.formulaset.function.NcInnerFunction)

    在方法中引用父类方法function,并在里面写方法

    @Override
        public Object function(List param) throws ParseException {
            if(param==null&&param.size()!=1)
                throw new ParseException("参数不正确!");
            
            String id = (String) param.get(0);
            
            IUAPQueryBS bs = NCLocator.getInstance().lookup(IUAPQueryBS.class);
            String sql = " select h.vbillno,h.invoiceno,h.invoicestatus,h.pk_buleid,h.invoicetype from XXXXt  " +
                    " inner join XXXX h on t.pk_vatinvoice = h.pk_vatinvoice " +
                    "where nvl(h.dr,0)=0 and t.pk_detail='"+id+"' ";
            if(getInvoiceType()==1){
                sql+=" t.ispenal ='N' ";
            }else if(getInvoiceType()==2){
                sql+=" t.ispenal ='Y' ";
            }
            try {
                System.out.println(sql);
                List resList = (List) bs.executeQuery(sql, new MapListProcessor());
                if(resList.isEmpty())
                    return null;
                
                StringBuffer sb = new StringBuffer();
                for (int i=0;i<resList.size();i++) {
                    Map<String, Object> linMap = (Map<String, Object>)resList.get(i);
                    String no = (String)linMap.get("invoiceno");
                    String billno = (String)linMap.get("vbillno");
                    
                    sb.append(no==null?billno:no);
                    Integer st = (Integer)linMap.get("invoicestatus");
                    Integer type = (Integer)linMap.get("invoicetype");
                    String ty = "";
                    if(InvoiceType.VATCOM.getType() == type)
                        ty = "XX";
                    if(InvoiceType.VATPRO.getType() == type)
                        ty = "XX";
                    if(InvoiceType.VATELCOM.getType() == type)
                        ty = "XX";
                    // End
                    
                    if(st==InvoiceStatus.OUTED.getStatus()){
                        if(linMap.get("pk_buleid")!=null){
                            sb.append("(").append(ty+",").append("XX").append(")");
                        }else{
                            sb.append("(").append(InvoiceStatus.OUTED.getName()).append(")");
                        }
                    }
            
    //                else if(st==InvoiceStatus.OUTING.getStatus()){
    //                    sb.append("(").append(InvoiceStatus.OUTING.getName()).append(")");
    //                }
                    else if(st==InvoiceStatus.CANCEL.getStatus()){
                        sb.append("(").append(ty+",").append(InvoiceStatus.CANCEL.getName()).append(")");
                    }else if(st==InvoiceStatus.RCW.getStatus()){
                        sb.append("(").append(ty+",").append(InvoiceStatus.RCW.getName()).append(")");
                    }else{
                        sb.append("(").append(ty+",").append(InvoiceStatus.UNOUT.getName()).append(")");
                    }
                    if(i<resList.size()-1)
                        sb.append(",");
                }
                if(sb.length()>0)
                    return sb.toString();
            } catch (BusinessException e) {
                e.printStackTrace();
            }
            
            return null;
        }

    返回描述为:

    @Override
        public String getFunctionDesc() {
            return "invoiceall(String):传入XX主键,返回全部XX信息";
        }

    引入到配置文件中:

    <?xml version="1.0" encoding="gb2312"?>
    <formula-array>
        <formula>
            <customType>9</customType>
            <functionName>invoiceall</functionName>
            <functionClass>xx.xx.xx.InvoiceAll</functionClass>
        </formula>
    </formula-array>

    配置文件放在nchome 下 resources/formulaconfig/custfunction/xx.xml


    效果为:


    作者:冬瓜茶饮料
    出处:http://www.cnblogs.com/dongguacha/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    [SAP Rolling Out] Unit TEST/INTEGRATION TEST/UAT TEST/PARREL TESTING
    针式PKM与众不同的地方
    针式PKM拖动收集功能兼容所有的浏览器
    周九常:个人知识管理的三个重点领域
    关闭word文件老是说normal.dot被另外一人使用
    针式PKM初级应用:修改知识点的颜色评介
    寻找识货的人
    针式PKM中级应用如何将知识管理应用到新项目研发中
    针式PKM中级应用在10秒以内找到本月收集的任意文章
    针式PKM中级应用:知识点之间如何链接
  • 原文地址:https://www.cnblogs.com/dongguacha/p/6530805.html
Copyright © 2011-2022 走看看