金蝶EAS 通过代码调用BOTP生成下游单据

Test1Info test1Info = new Test1Info();
Test1Info test1Info = new Test1Info();
IBOTRelation ibot = BOTRelationFactory.getLocalInstance(ctx);
IBOTMapping  ibm = BOTMappingFactory.getLocalInstance(ctx);
BOTMappingCollection bc = ibm.getBOTMappingCollection("where name = 'BE007'");
String botmaid = "";
if(bc!=null && bc.size()>0){
	botmaid = bc.get(0).getId().toString();
}
createBotRelation(ctx, test1Info, test1Info, ibot, botmaid);
/**
 *  生成关联关系
 * @param test1Info 源单据对象
 * @param test2Info 目标单据对象
 */
private void createBotRelation(Context ctx,Test1Info test1Info,Test2Info test2Info,IBOTRelation ibot,String botmid) throws BOSException{
		
		ArrayList list = ibot.getSrcObjIdBySrcType(test2Info.getId().toString(),test1Info.getBOSType().toString());
		if(list!=null && list.size()>0){
			return;
		}
		BOTRelationInfo relation = new BOTRelationInfo();
		relation.setAvailable(true);
		relation.setBOTMappingID(botmid);
		relation.setSrcObjectID(test1Info.getId().toString());
		relation.setSrcEntityID(test1Info.getBOSType().toString());
		relation.setOperatorID("user");
		relation.setDestObjectID(test2Info.getId().toString());
		relation.setDestEntityID(test2Info.getBOSType().toString());
		relation.setIsEffected(false);
		relation.setType(0);
		relation.setDate(new Date());
		ibot.addnew(relation);
}
上一篇:实现操作主机角色的转移系列一


下一篇:前端需要了解的颜色模型,RGB、HSL和HSV