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

  • 相关阅读:
    尝试实现一个简单的C语言string类型
    LeetCode.49
    Python学习 —— 实现简单的爬虫
    图表可视化表达的逻辑原理
    颜色参数
    Python交互图表可视化Bokeh:7. 工具栏
    Python交互图表可视化Bokeh:6. 轴线| 浮动| 多图表
    Python交互图表可视化Bokeh:5 柱状图| 堆叠图| 直方图
    Python交互图表可视化Bokeh:4. 折线图| 面积图
    Python交互图表可视化Bokeh:3. 散点图
  • 原文地址:https://www.cnblogs.com/dongguacha/p/6530805.html
Copyright © 2020-2023  润新知