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);
   }
  }
 }


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM