Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method CalcTransCost ( 
 | 
  ProductInStockingPointInPeriods pispips, 
 | 
  LogisticsCostTransports transcosts, 
 | 
  LogisticsCostEngine enginecost, 
 | 
  output Real transcost 
 | 
) 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    // 甄兰鸽 Nov-14-2024 (created)  
 | 
    tran             := selectobject( transcosts, Elements, trans, trans.StartDate() <= this.StartDate() and trans.EndDate() >= this.StartDate() ); 
 | 
    if( isnull( tran ) ){ 
 | 
      ftranscost     := selectobject( transcosts, Elements, trans, trans.EndDate() > this.StartDate() and this.EndDate() <= this.EndDate() and trans.StartDate() < this.StartDate() ); 
 | 
      if( not isnull( ftranscost ) ){ 
 | 
        newsqty      := sum( pispips, Elements, pispip, pispip.Start().Date() >= ftranscost.StartDate() and pispip.Start().Date() <= ftranscost.EndDate(), pispip.NewSupplyQuantity() ); 
 | 
        transcost    := transcost + ceil( ceil( newsqty / enginecost.PackagingCapacity() ) / ftranscost.LoadingCapacity() ) * ftranscost.TransportPrice(); 
 | 
      } 
 | 
      mtranscost     := selectobject( transcosts, Elements, trans, trans.StartDate() > this.StartDate() and trans.EndDate() < this.EndDate() ); 
 | 
      if( not isnull( mtranscost ) ){ 
 | 
        newsqty      := sum( pispips, Elements, pispip, pispip.Start().Date() >= mtranscost.StartDate() and pispip.Start().Date() <= mtranscost.EndDate(), pispip.NewSupplyQuantity() ); 
 | 
        transcost    := transcost + ceil( ceil( newsqty / enginecost.PackagingCapacity() ) / mtranscost.LoadingCapacity() ) * mtranscost.TransportPrice(); 
 | 
      } 
 | 
      btranscost    := selectobject( transcosts, Elements, trans, trans.StartDate() > this.StartDate() and trans.StartDate() <= this.EndDate() and trans.EndDate() > this.EndDate() ); 
 | 
      if( not isnull( btranscost ) ){ 
 | 
        newsqty      := sum( pispips, Elements, pispip, pispip.Start().Date() >= btranscost.StartDate() and pispip.Start().Date() <= btranscost.EndDate(), pispip.NewSupplyQuantity() ); 
 | 
        transcost    := transcost + ceil( ceil( newsqty / enginecost.PackagingCapacity() ) / btranscost.LoadingCapacity() ) * btranscost.TransportPrice(); 
 | 
      } 
 | 
    }else{ 
 | 
      newsqty        := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() ); 
 | 
      transcost      := transcost + ceil( ceil( newsqty / enginecost.PackagingCapacity() ) / tran.LoadingCapacity() ) * tran.TransportPrice(); 
 | 
    } 
 | 
  *] 
 | 
} 
 |