KBBosStudio技术文档.docx
- 文档编号:29986996
- 上传时间:2023-08-04
- 格式:DOCX
- 页数:47
- 大小:31.18KB
KBBosStudio技术文档.docx
《KBBosStudio技术文档.docx》由会员分享,可在线阅读,更多相关《KBBosStudio技术文档.docx(47页珍藏版)》请在冰豆网上搜索。
KBBosStudio技术文档
------------------------------------------------------------------------------------------------
1设置单元格格式(EU->onload)
在EditUI.java的OnLoad事件实现:
getTable(kDPanel1).getColumn("CageWithBrlrQty").getStyleAttributes().setNumberFormat("%r-[=]{#}f");
getTable(kDPanel1).getColumn("BrlrQty").getStyleAttributes().setNumberFormat("%r-[=]{#}f");
getTable(kDPanel1).getColumn("GrossWt").getStyleAttributes().setNumberFormat("%r-[=]{#.00}f");
getTable(kDPanel1).getColumn("CageWt").getStyleAttributes().setNumberFormat("%r-[=]{#.00}f");
getTable(kDPanel1).getColumn("NetWt").getStyleAttributes().setNumberFormat("%r-[=]{#.00}f");
getTable(kDPanel1).getColumn("SelPrice").getStyleAttributes().setNumberFormat("%r-[=]{#.00}f");
getTable(kDPanel1).getColumn("SelAmt").getStyleAttributes().setNumberFormat("%r-[=]{#.00}f");
getTable(kDPanel2).getColumn("FeeAmt").getStyleAttributes().setNumberFormat("%r-[=]{#.00}f");
------------------------------------------------------------------------------------------------
2增加事件监听器,监听删除分录动作(EU->onload)
this.getTable(kDPanel1).setBeforeAction(newBeforeActionListener()
{
publicvoidbeforeAction(BeforeActionEvente)
{
if(e.getType()==BeforeActionEvent.ACTION_REMOVE_ROW)
{
txtTotalAmt.setValue(newBigDecimal(0));
for(inti=0,n=getTable(kDPanel1).getRowCount();i { if(i! =((KDTable)e.getSource()).getSelectManager().get().getBeginRow()) { txtTotalAmt.setValue(UIRuleUtil.getBigDecimal(UIRuleUtil.getBigDecimalValue(txtTotalAmt.getValue())).add(UIRuleUtil.getBigDecimal(UIRuleUtil.getBigDecimalValue(getTable(kDPanel1).getCell(i,"Amt").getValue())))); } } } } }); //为分录1增加监听事件,捕获行变化事件 this.getTable(kDPanel1).addKDTSelectListener(newKDTSelectListener() { publicvoidtableSelectChanged(KDTSelectEvente) { try { kDPanel1_entryTable_tableSelectChanged(e); } catch(Exceptionexc) { handUIException(exc); } finally { } } }); ------------------------------------------------------------------------------------------------ 3Exception(CB) 单独增加,在Sdudio里面,不会自动生成 要指定主异常号和父类(mon.BaseSysException) ------------------------------------------------------------------------------------------------ 4在分录中新增加空白行(EU) getTable(kDPanel1).addRow(); ------------------------------------------------------------------------------------------------ 5初始化字段(日期等)(EU) publicvoidloadFields() { if(this.getOprtState()==OprtState.ADDNEW)//单据状态为新增时 { this.pkBillDate.setValue(newDate());//单据日期 this.txtGrossWt.setValue(newBigDecimal(0));//毛重 } } 6枚举类型的初始化 kdtEntrys.getCell(0,"Gender").setValue((Enum)GdOfBrdr.Male); Category.setSelectedIndex(0); ------------------------------------------------------------------------------------------------ 7给F7字段设新值(EU) RecordOfBroilerFlockInforecordOfBroilerFlockInfo=recordOfBroilerFlockCollection.get(a-1); //赋值给鸡群编号 this.prmtFlock.setValue(recordOfBroilerFlockInfo); ------------------------------------------------------------------------------------------------ 8提示信息(EU) MsgBox.showInfo(EASResource.getString(strRes,"No_Feed_Broiler")); SysUtil.abort();//略过本方法后面的代码 提示框(EU) MsgBox.showInfo("Hello! "); 确认框(EU) MsgBox.showConfirm2("对不起,在肉鸡收购价格单中找不到对应的单价信息! 继续保存吗? ");//确定和取消 MsgBox.showConfirm3("对不起,在肉鸡收购价格单中找不到对应的单价信息! 继续保存吗? ");//是、否、取消 MsgBox.showConfirm3a("对不起,在肉鸡收购价格单中找不到对应的单价信息! 继续保存吗? ");//确定和取消,可以增加详细信息 Example: i=MsgBox.showConfirm3("对不起,在肉鸡收购价格单中找不到对应的单价信息! 继续保存吗? "); if(i==MsgBox.CANCEL) { SysUtil.abort(); } if(i==MsgBox.NO) { submit=false; MsgBox.showInfo("数据未保存! "); SysUtil.abort(); } ------------------------------------------------------------------------------------------------ 9在分录中计算某字段的合计金额(EU) 在单分录中,在kdtEntrys_Changed方法内实现(如果没有此方法,先在BIM里面增加更新事件生成) 求单分录的某列的合计值: com.kingdee.bos.ui.face.UIRuleUtil.sum(“分录名称”,"列名称") txtBIMUDF0001.setValue(UIRuleUtil.getInt(com.kingdee.bos.ui.face.UIRuleUtil.sum(kdtEntrys,"FPIECE"))); 在多分录中,在kDPanel1_entryTable_Changed方法内实现 //计算合计金额 if("Qty".equalsIgnoreCase(colName)||"Price".equalsIgnoreCase(colName)) { txtTotalAmt.setValue(newBigDecimal(0)); BigDecimaltotal=newBigDecimal(0); for(inti=0,n=getTable(kDPanel1).getRowCount();i { total=total.add((BigDecimal)getTable(kDPanel1).getCell(i,"Amt").getValue()); } txtTotalAmt.setValue(total); } // ------------------------------------------------------------------------------------------------ 10CB的方法处理(CB) 一般要分别对 protectedIObjectPK_addnew(Contextarg0,IObjectValuearg1)throwsBOSException,EASBizException protectedvoid_delete(Contextarg0,IObjectPKarg1)throwsBOSException,EASBizException protectedvoid_update(Contextarg0,IObjectPKarg1,IObjectValuearg2)throwsBOSException,EASBizException 这三个方法分别进行相关的处理,才能对反写其它数据表的实现进行灵活地处理 ------------------------------------------------------------------------------------------------ 11获取当前的养户ID(CB) StringidRearer=info.getRearer().getId().toString(); ObjectUuidPKpkRearer=newObjectUuidPK(BOSUuid.read(idRearer)); ------------------------------------------------------------------------------------------------ 12系统内置的编码、名称校验,直接调用就可以啦(CB->_submit) //编码/名称校验 _checkNumberBlank(arg0,arg1); _checkNumberDup(arg0,arg1); _checkNameBlank(arg0,arg1); _checkNameDup(arg0,arg1); ------------------------------------------------------------------------------------------------ 13校验输入数据的合法性,提交时被调用,针对文本型、数值型、基础资料类别、日期型(EU) protectedvoidverifyInput(ActionEventarg0)throwsException { super.verifyInput(arg0); //资源文件 StringstrRes="com.kingdee.eas.custom.broiler.hatch.client.HatchResource3"; //单据编号不能为空! if(StringUtils.isEmpty(txtNumber.getText())) { MsgBox.showInfo(EASResource.getString(strRes,"Number_Not_Null")); SysUtil.abort(); } if(prmtHatchOrgUnit.getValue()==null) if(pkPlanDate.getValue()==null) if(StringUtils.isEmpty(txtQty.getText())) if(EggSrcType.getSelectedItem()==null) if(Weather.getSelectedItem()==null) KDTabletable1=this.getTable(kDPanel1); //分录检查 for(inti=0,n=table1.getRowCount();i { if(table1.getCell(i,"ForDate").getValue()==null) { MsgBox.showInfo(EASResource.getString(strRes,"ForDate_Not_Null")); SysUtil.abort(); } if(table1.getCell(i,"Genetics").getValue()==null) if(table1.getCell(i,"ForcastQty").getValue()==null) } } ------------------------------------------------------------------------------------------------ 14校验输入数据的合法性,提交时被调用,针对文本型、数值型、基础资料类别、日期型(CB) privatevoidverifyInput(IObjectValuearg0)throwsBOSException,EASBizException{ //获得输入数据的值对象 RecordOfBroilerRearerInforobrInfo=(RecordOfBroilerRearerInfo)arg0; //地址空校验 if("".equalsIgnoreCase(robrInfo.getAddress())){ thrownewRecordOfBroilerRearerException(RecordOfBroilerRearerException.ADDRESS_NOT_NULL); } //技术员不能为空 if(robrInfo.getTechnologist()==null){ thrownewRecordOfBroilerRearerException(RecordOfBroilerRearerException.TECHNOLOGIST_NOT_NULL); } //开户日期不能为空 if(robrInfo.getOpenDate()==null){ thrownewRecordOfBroilerRearerException(RecordOfBroilerRearerException.OPENDATE_NOT_NULL); } } ------------------------------------------------------------------------------------------------ 15数值计算(EU) txtTotalAmt.setValue(txtTotalAmt.getBigDecimalValue().add(UIRuleUtil.getBigDecimal(getTable(kDPanel1).getCell(i,"Amt").getValue()))); ------------------------------------------------------------------------------------------------ 16定义BigDecimal变量,并赋初值0 BigDecimaltotalAmt=newBigDecimal(0); ------------------------------------------------------------------------------------------------ 17BIM属性,规则事件的使用条件的设计方法 条件设置: ([收购单价]<>0)AND([净重]<>0) 条件成立时设置: [收购金额]=[收购单价]*[净重] ------------------------------------------------------------------------------------------------ 18当前页面的值对象操作(EU) editData.getNumber() ------------------------------------------------------------------------------------------------ 19当前页面的控件操作(EU) this.txtNumber ------------------------------------------------------------------------------------------------ 20获得F7的值对象(EU) (GeneOfMarkBroInfo)this.prmtGenOfMrkBrlr.getData(); editData.getGenOfMrkBrlr(); ------------------------------------------------------------------------------------------------ 21判断当前页面的控件是否为空的方法(EU) DatebillDate=(Date)this.pkBillDate.getValue(); if((prmtGenOfMrkBrlr.getText()! =null)&&(prmtGradeOfBrlr.getValue()! =null)&&(billDate! =null)) {...} ------------------------------------------------------------------------------------------------ 22EntityViewInfo,FilterInfo使用方法(EU) (注意: 这里决不能使用: DatebillDate=editData.getBillDate();因为这时billDate为空,一般在EU时使用控件操作,而不使用值对象) StringidGen=geneOfMarkBroInfo.getId().toString(); StringidGrade=gradeOfBroilerInfo.getId().toString(); DatebillDate=(Date)this.pkBillDate.getValue(); EntityViewInfoevi=newEntityViewInfo(); FilterInfofilterInfo=newFilterInfo(); filterInfo.getFilterItems().add(newFilterItemInfo("GenOfMrkBrlr",idGen,CompareType.EQUALS)); filterInfo.getFilterItems().add(newFilterItemInfo("GradeOfBrlr",idGrade,CompareType.EQUALS)); filterInfo.getFilterItems().add(newFilterItemInfo("InDate",billDate,CompareType.LESS_EQUALS)); filterInfo.getFilterItems().add(newFilterItemInfo("OutDate",billDate,CompareType.GREATER_EQUALS)); filterInfo.setMaskString("#0and#1and#2and#3"); evi.setFilter(filterInfo); PurPriceOfBroilerEntryCollectioncon=(PurPriceOfBroilerEntryCollection)ipurPrice.getPurPriceOfBroilerEntryCollection(evi); ------------------------------------------------------------------------------------------------ 23Collection使用方法(EU) Iteratoriterator=con.iterator(); If(iterator.next()) { …… } if(con.size()>0)
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- KBBosStudio 技术 文档
![提示](https://static.bdocx.com/images/bang_tan.gif)