首页 > 代码库 > NC nc5.x笔记(编辑中)

NC nc5.x笔记(编辑中)

一、设置卡片界面下 金额字段负数为红色!

 1 /** 2      * 设置卡片界面下 金额字段负数为红色! 3      */ 4     private void repaintBodyMoneyColor(){ 5         if(!isListPanelSelected()){ 6             int rows = getBModel().getRowCount(); 7             if(rows>0){ 8                 for(int i=0;i<rows;i++){ 9                     CbGatheringBVO bvo = (CbGatheringBVO)getBModel().getBodyValueRowVO(i, CbGatheringBVO.class.getName());10                     if(bvo!=null){11                         if(SafeCompute.compare(UFDouble.ZERO_DBL, bvo.getNbroddaccountreceiv())>012                                 ||SafeCompute.compare(UFDouble.ZERO_DBL, bvo.getNboddaccountreceiv())>0){13                             setBodyForeGroundByRow(tabB,i,new String[]{"nbroddaccountreceiv","nboddaccountreceiv"}, Color.RED);14                         }15                     }16                 }17             }18         }19     }

 二、读取XML并解析参数

Document document = null;        try {            DocumentBuilderFactory builderFactory = DocumentBuilderFactory                    .newInstance();            DocumentBuilder builder = builderFactory.newDocumentBuilder();            // 接收XX电子票返回的信息            document = builder.parse(new ByteArrayInputStream(retStr                    .getBytes("utf-8")));        } catch (Exception e) {            e.printStackTrace();            throw new BusinessException("更新失败!!!解析XX返回信息为: " + document);        }        NodeList fphm = document.getElementsByTagName("FP_HM"); // XX号码        NodeList fpdm = document.getElementsByTagName("FP_DM"); // XX代码        NodeList kprq = document.getElementsByTagName("KPRQ");        NodeList code = document.getElementsByTagName("returnCode");        NodeList msg = document.getElementsByTagName("returnMsg");        NodeList pdfurl = document.getElementsByTagName("PDF_URL");        String returncode = code.item(0).getTextContent();        String returnMsg = msg.item(0).getTextContent();        String PDF_URL = pdfurl.item(0).getTextContent();        if (!"0".equals(returncode)) {            throw new BusinessException("更新开票失败!!!XX返回信息为: " + returnMsg);        }        String FP_HM = fphm.item(0).getTextContent();        String FP_DM = fpdm.item(0).getTextContent();        String KPRQ1 = kprq.item(0).getTextContent();        String KPRQ = KPRQ1.substring(0, 4)  + KPRQ1.substring(4, 7)                 + KPRQ1.substring(7, 10);

  三、继承ManageEventHandler取AggVO(按钮事件类)

@Override    protected void onBoSave() throws Exception {                VatinvoiceAggVO aggVO = (VatinvoiceAggVO) getBillCardPanelWrapper()                .getBillVOFromUI();        VatinvoiceBVO[] vatinvoiceBVO = (VatinvoiceBVO[]) aggVO.getChildrenVO();        UFDouble amount = new UFDouble(0);        UFDouble amountnotax = new UFDouble(0);        UFDouble taxamount = new UFDouble(0);        for (VatinvoiceBVO vatBVO : vatinvoiceBVO) {            // 表体含税金额            amount = amount.add(vatBVO.getAmount());            // 表体无税金额            amountnotax = amountnotax.add(vatBVO.getAmountnotax());            // 表体税额            taxamount = taxamount.add(vatBVO.getTaxamount());        }
     // 表头 getBillCardPanelWrapper().getBillCardPanel().getHeadItem(
"totalamount") .setValue(amount); getBillCardPanelWrapper().getBillCardPanel() .getHeadItem("totalamountnotax").setValue(amountnotax); getBillCardPanelWrapper().getBillCardPanel() .getHeadItem("totaltaxamount").setValue(taxamount); getBillCardPanelWrapper().getBillCardPanel().dataNotNullValidate();
     // 表尾
     getBillCardPanelWrapper().getBillCardPanel().getHeadTailItem("pk_checker").setValue(getChecker(headVO.getPk_manager()));
super.onBoSave(); }

 四、按钮事件类下判断是什么界面

 

BillManageUI manageUI = (BillManageUI) getBillUI();        boolean isListPanel = manageUI.isListPanelSelected();        if(isListPanel){//列表界面                                }else{//卡片界面                }        

 


 五、取得所有行数

 

int[] selects = manageUI.getBillListPanel().getHeadTable()                    .getSelectedRows();for (int i : selects) {                VatinvoiceAggVO aggVO = (VatinvoiceAggVO) getBufferData()                        .getVOByRowNo(i);}

 


 六、eclispce起中间间报内存不足

 

 

-Dnc.exclude.modules=${FIELD_EX_MODULES} -Dnc.runMode=develop -Dnc.server.location=${FIELD_NC_HOME} -DEJBConfigDir=${FIELD_NC_HOME}/ejbXMLs -DExtServiceConfigDir=${FIELD_NC_HOME}/ejbXMLs-Xms512m -Xmx768m -XX:PermSize=128m -XX:MaxPermSize=256m-Duser.timezone=GMT+8

 


 七、设置单据号

 

String billcode = (new BillcodeGenerater()).getBillCode(                            "节点编码", 公司主键, null, null);

 八、取单据VO

 

AggregatedValueObject[] vos = getBillListPanelWrapper().getBillListPanel().getMultiSelectedVOs(                HzAuthenticateBillVO.class.getName(), HzAuthenticateHVO.class.getName(),                HzAuthenticateHVO.class.getName());for (AggregatedValueObject vo : vos) {            String key = vo.getParentVO().getPrimaryKey();HzVatinvoiceBillVO vatbillvo = (HzVatinvoiceBillVO) getService().queryBillVOByPrimaryKey(billVOName, key);}

 

NC nc5.x笔记(编辑中)