botp生成目标数据,并建立上查下查关系

本文介绍了如何通过botp生成目标数据,并详细阐述了如何构建上查下查的关系,以实现数据间的关联。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

代码中调用botp规则来生成目标单据,并建立 上查下查关系的方法:

protected void callBotpService(Context ctx, String botpName,MaterialRequestBillInfo billInfo, List entryIds) throws BOSException, BTPException, EASBizException {
//自动生成XX单据
IBOTMapping botFac = BOTMappingFactory.getLocalInstance(ctx);
BOTMappingInfo botInfo = null;
BOTMappingCollection botCol = botFac.getBOTMappingCollection("select id,srcEntityname,destentityName where name='"+botpName+"' and extRule.isEffected=1  ");
if(botCol.size()==1){
botInfo = botCol.get(0);
}else{
throw new BOSException("BOTP("+botpName+")不存在或未启用!");
}
IBTPManager iBTPManager = BTPManagerFactory.getLocalInstance(ctx);
BTPTransformResult btpResult = iBTPManager.transformForBotp(new String[] { billInfo.getId().toString() }, new String[] { "entry" }, entryIds, null, botInfo.getDestEntityName(), 
new ObjectUuidPK(botInfo.getId().toString()),botInfo.getSrcEntityName());
if (btpResult.getBills().size()<=0) {
return;
}
BOTRelationCollection relations = btpResult.getBOTRelationCollection();
Map map = getMapByRelation(relations);
for (int i = 0; i < btpResult.getBills().size(); i++) {
IObjectValue destBillInfo = btpResult.getBills().getObject(i);
CoreBillBaseInfo destBill = (CoreBillBaseInfo) destBillInfo;
BOTRelationCollection botrelationcollection =(BOTRelationCollection)map.get(destBill.getId().toString());
iBTPManager.saveRelations(destBill, botrelationcollection);
}
}

public Map getMapByRelation(BOTRelationCollection relations) {
    Map map = new HashMap();
for (int i = 0; i < relations.size(); i++) {
BOTRelationInfo relationInfo = relations.get(i);
String oid = relationInfo.getDestObjectID();
if (map.get(oid) != null) {
BOTRelationCollection botrelationcollection=(BOTRelationCollection) map.get(oid);
botrelationcollection.add(relationInfo);
map.put(oid, botrelationcollection);
} else {
BOTRelationCollection botrelationcollection = new BOTRelationCollection();
botrelationcollection.add(relationInfo);
map.put(oid, botrelationcollection);
}
}
return map;

    }


botp关系对照表:

关联关系表头:实体(BOTRelation)表(T_BOT_Relation)
字段别名参考值描述
srcEntityID源实体BosTypeBFBCAD51bosType
destEntityID目标实体BosType500AB75EbosType
srcObjectID源对象IDkcYAAAIQ0ui/vK1Rid
destObjectID目标对象IDrV/n+mBsQcW1681XLqJCelAKt14=id
date转换日期2013/12/300:00:00当前日期
operatorID操作ID87212(当前人的名称编号都可以)
relationEntries关系分录对应分录,每条分录都对一个分录规则
BOTMappingID转换规则idjxIXJwEREADgAE3AfwAAAQRRIsQ=id(实体:BOTMapping
表:T_BOT_Mapping)botp规则的id
isEffected是否生效1
type类型0

参考语句:insert into T_BOT_Relation(fid,fsrcEntityID,fdestEntityID,fsrcObjectID,fdestObjectID,foperatorID,fBOTMappingID,fisEffected,ftype) 
values(newbosid('59302EC6'),'C48A423A','CC3E933B','iMsAAAAHsMHEikI6','iMsAAAAHsOTMPpM7','user','6a7669e6-0108-1000-e000-2136c0a812fd045122C4',1,0)


botp关系对照分录表:

关联关系分录:实体(BOTRelationEntry)表(T_BOT_RelationEntry)
字段别名参考值描述
srcObjectID源对象IDkcYAAAIQ0ui/vK1R表头记录的源对象ID
destObjectID目标对象IDrV/n+mBsQcW1681XLqJCelAKt14=表头记录的目标对象ID
srcEntryID源分录IDkcYAAAIQ0ul6YBWh记录源分录对象ID
destEntryID目标分录IDeV3H6QkzQpuenoWSZNxcUhF3S7Q=记录目标分录对象ID
srcEntryPropName源分录属性名__src.entry可为空
destEntryPropName目标分录属性名__dest.entry可为空
srcPropertyName源属性名为空即可
destPropertyName目标属性名id统一id即可
value为空即可
relation单头idwWqp5eBTTnaYUcZP4AtDZFkwLsY=记录单头id


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值