//根据映射名称,获取映射关系对应的主键
public static IObjectPK getBotmpID(Context ctx){
String sql = "select fid from T_BOT_Mapping t where t.fname = ?";
IRowSet rowset = null;
try {
rowset = DbUtil.executeQuery(ctx,sql,new Object[]{ruleName});
if(rowset.next())
return new ObjectUuidPK(rowset.getString("fid"));
} catch (BOSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public static void generateDestBill(Context ctx, String srcBosType,
String destBosType, CoreBillBaseCollection srcBillCollection,
IObjectPK botpPK) throws Exception {
IBOTMapping botMapping = BOTMappingFactory.getLocalInstance(ctx);
CoreBillBaseInfo billInfo = srcBillCollection.get(0);
BOTMappingInfo botMappingInfo = botMapping.getMapping(billInfo, destBosType, DefineSysEnum.BTP);
if (botMappingInfo == null) {
throw new FMException(FMException.NODESTBILL);
}
IBTPManager iBTPManager = BTPManagerFactory.getLocalInstance(ctx);
BTPTransformResult btpResult = null;
/*String[] ids = new String[srcBillCollection.size()];
for (int i = 0; i < srcBillCollection.size(); ++i) {
CoreBaseInfo info = srcBillCollection.get(i);
ids[i] = info.getId().toString();
}*/
btpResult = iBTPManager.transformForBotp(srcBillCollection,destBosType, botpPK);
IObjectCollection destBillCols = btpResult.getBills();
BOTRelationCollection botRelationCols = btpResult.getBOTRelationCollection();
for (int i = 0; i < destBillCols.size(); i++) {
CoreBillBaseInfo destBillInfo = (CoreBillBaseInfo) destBillCols.getObject(i);
iBTPManager.submitRelations(destBillInfo, botRelationCols);
}
}
原文链接:http://xy0792.iteye.com/blog/789210