標籤:
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); } }
參數說明:
1、ctx :服務端上下文
2、srcBosType:源單據的BosType
3、destBosType:目標單據的BosType
4、srcBillCollection:源單據集合,可以批量轉換
5、botpPK:要使用的BOTP的PK。
可以通過表T_BOT_Mapping尋找到id,將id轉換成PK。
select t.fid from T_BOT_Mapping t where t.fname=‘***‘,***是botp的名稱。
[轉]服務端直接調用BOTP