前后台通用环境变量
nc.vo.pubapp.AppContext
如:AppContext.getInstance.getServerTime()
对VO进行排序的工具类
nc.vo.pubapp.util.VOSortUtils
数学运算工具类
nc.vo.pubapp.pattern.pub.MathTool
获得当前单据类型或交易类型
String transtypecode = TrantypeFuncUtils.getTrantype(this.getModel().getContext());
从数据缓存中根据交易类型编码获取交易类型主键
PfDataCache.getBillTypeInfo(header.getPk_group(), header.getPk_tradetype()).getPk_billtypeid()
查询可用量的服务类,按计划日期查询Atp完整信息 ,若计划日期为空,则与查询可用量报表返回信息一致
nc.itf.pu.reference.ic.AtpQueryServices.queryAtpVOs(String[] pk_calbodyoids, String[] cmaterialoids, UFDate[] ddates)
单据操作工具类,根据单据主键获取单据vo
String[] hids=new String[]{"1123123adasd","2342321"};
BillQuery<SaleInvoiceVO> srv =new BillQuery<SaleInvoiceVO>(SaleInvoiceVO.class);
SaleInvoiceVO[] vos = srv.query(hids);
NCLocator.getInstance().lookup(IMDPersistenceQueryService.class).queryBillOfNCObjectByPK(aggvo.class,billid)
|
调用动作脚本
IPFBusiAction busiAction = NCLocator.getInstance().lookup(IPFBusiAction.class);
AggregatedValueObject[] retVOs = (AggregatedValueObject[]) busiAction.processBatch("SAVE","F2", AggGatheringBillVOs, null, null, null);
|
加上动态锁,控制并发,判断存在时不能并发
if(PKLock.getInstance().addDynamicLock(con.getDocID()+ con.getBilltype())){ isExists(vo, con); }else{ throw new GLBusinessException(nc.vo.ml.NCLangRes4VoTransl .getNCLangRes().getStrByID("20021005","UPT2002100573-900071")); }
|
生成NC主键的方法
new nc.jdbc.framework.generator.SequenceGenerator().generate(pkcorp, num);
NCLocator.getInstance().lookup(IdGenerator.class).generate()
|
单据卡片常用操作工具类
CardPanelValueUtils util = new CardPanelValueUtils(this.getEditor().getBillCardPanel()); util.delBodyLine();
|
单据列表常用操作工具类
ListPanelValueUtils
数量单价金额计算工具类
IRelationForItems item = new RelationItemForCal(); item.setnumKey("number"); IDataSetForCal data = new BillCardPanelDataSet(new BillCardPanel(), row,item);
ScaleUtils scale = UIScaleUtils.getScaleUtils(); Calculator tool = new Calculator(data, scale); Condition cond = new Condition(); cond.setIsCalLocalCurr(false); cond.setIsChgPriceOrDiscount(false); cond.setIsFixNchangerate(false); cond.setIsFixNqtunitrate(false); cond.setIsTaxOrNet(false);
Cond.setUnitPriorType(type);
Cond. setGroupLocalCurrencyEnable (true);
Cond. setGlobalLocalCurrencyEnable(true);
Cond. setIsCalLocalCurr(true); tool.calculate(cond, item.getNorigtaxpriceKey());
|
获取系统参数的接口
nc.itf.uap.busibean.ISysInitQry #queryByCode(pk_corp,para_code) nc.itf.uap.busibean.SysinitAccessor 带缓存的查询,可在前后台调用,查询效率更高 SysinitAccessor.getInstance().getSysInitVO(pk_org, initCode);
|
获取NCHOME下的文件
获取NCHOME所在路径properties文件: String path=RuntimeEnv.getInstance().getNCHome()+"\\aa.properties";
account=InitConfigFile.readValue(path,"account");
|
弹出提示框参考
if(MessageDialog.showYesNoDlg(this,"车客流量统计","表体存在数据,调整表头会清空表体,是否继续?")==UIDialog.ID_NO){ return; }
Runnable checkRun = new Runnable(){ public void run() { BannerDialog dialog = new BannerDialog(ui); dialog.start(); try{
} catch(Exception e) { e.printStackTrace(); ui.showErrorMessage(e.getMessage()); } finally { dialog.end(); } } };
new Thread(checkRun).start();
|
常用数据访问类
DataAccessUtils tool = new DataAccessUtils(); SqlBuilder sqlWhere = new SqlBuilder(); sqlWhere.append("select csettlepathid from to_settlepath where dr=0 and blatestflag='Y' and vPathName=",csettlepathname); IRowSet rowset = tool.query(sqlWhere.toString()); String[] csettlepathids = rowset.toOneDimensionStringArray(); if ((csettlepathids == null) || (csettlepathids.length == 0)) { }
BaseDAO basedao=new BaseDAO("design");
if(getDao().getDBType() == DBConsts.SQLSERVER){ } else if (getDao().getDBType() == DBConsts.ORACLE) { } else if (getDao().getDBType() == DBConsts.DB2) { }
ArrayList list = (ArrayList)NCLocator.getInstance().lookup(IUAPQueryBS.class) .executeQuery(strSql.toString(), new BeanListProcessor(MarBasClassVO.class));
ArrayList matVosOld = (ArrayList) NCLocator.getInstance().lookup(IUAPQueryBS.class).retrieveByClause( MarBasClassVO.class, " dr=0 and pk_group='" + swapContext.getPk_group() + "' and pk_org='" + swapContext.getPk_group() + "' and code='" + materClassCode + "' ");
|
实现定时任务
实现IBackgroundWorkPlugin接口
public class PoSunSys implements IBackgroundWorkPlugin { public String executeTask(BgWorkingContext bgwc) throws BusinessException { } }
|