eas之单据转换规则


/**
  * BOTP单据转换
  * @param botpNum 转换规则编号
  * @param BillInfo 原单据
  */
 public static void BOTP(String botpNum,CoreBillBaseInfo BillInfo){
  String error = "";
  try {
   // 取得BOPT的映射
   BOTMappingCollection botmapping = BOTMappingFactory.getRemoteInstance().getBOTMappingCollection("select * where    name = '"+botpNum+"'  ");
   BOTMappingInfo btpMappingInfo = null;
   if (botmapping !=null && botmapping.size() == 1) {
    btpMappingInfo = botmapping.get(0);
   } else {
    if(botmapping==null || botmapping.size()<1){
     error = "未找到转换规则  规则编号:"+botpNum;
    }
    if(botmapping.size()>1){
     error = "找到多条转换规则,请删除重复规则。   规则编号:"+botpNum;
    }
    throw new Exception();
   }
   //执行单据转换
   BTPTransformResult transformResult = BTPManagerFactory.getRemoteInstance().transform(BillInfo, btpMappingInfo);

   //取得目标单据列表
   IObjectCollection toBillList = transformResult.getBills();
   
   //保存目标单据
   for (int i = 0; i < toBillList.size(); i++) {  
    CoreBillBaseInfo destBillInfo = (CoreBillBaseInfo) toBillList.getObject(i);
    BTPManagerFactory.getRemoteInstance().saveRelations(destBillInfo, transformResult.getBOTRelationCollection());
   }
   
  } catch (Exception e) {
   if("".equals(error) || error == null){
    alert2("单据转换出错",e.getMessage());
   }else{
    alert2("单据转换出错",error);
   }
  }
 }

转载于:https://www.cnblogs.com/luojiabao/p/10980372.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值