• 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/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    Linux私房菜——防火墙部分笔记
    ubuntu
    序列求和
    圆的面积
    Fibonacci数列
    JavaScript中定义数组
    C语言中的EOF
    jQuery获取的值去掉px
    jQuery中单引号和双引号的使用
    jQuery报错:Uncaught ReferenceError: $ is not defined
  • 原文地址:https://www.cnblogs.com/dongguacha/p/6530805.html
Copyright © 2020-2023  润新知