| Quintiq file version 2.0 | 
| #parent: #root | 
| Method CalcEngineCost ( | 
|   ProductInTrips pits, | 
|   LogisticsCostEngines enginecosts, | 
|   LogisticsCostTransports transcosts | 
| ) as Real | 
| { | 
|   TextBody: | 
|   [* | 
|     // 甄兰鸽 Nov-14-2024 (created)  | 
|     transcost        := 0.0; | 
|     enginecost       := selectobject( enginecosts, Elements, engine, engine.StartDate() <= this.StartDate() and engine.EndDate() >= this.EndDate() ); | 
|     if( isnull( enginecost ) ){ | 
|       fenginecost    := selectobject( enginecosts, Elements, engine, engine.EndDate() > this.StartDate() and engine.EndDate() <= this.EndDate() and engine.StartDate() < this.StartDate() ); | 
|       if( not isnull( fenginecost ) ){ | 
|         fpits        := selectset( pits, Elements, pit, pit.Trip().Arrival().Date() >= fenginecost.StartDate() and pit.Trip().Arrival().Date() <= fenginecost.EndDate() ); | 
|         transcost    := transcost + this.CalcTransCost( fpits, transcosts, fenginecost ); | 
|       } | 
|       menginecost    := selectobject( enginecosts, Elements, engine, engine.StartDate() > this.StartDate() and engine.EndDate() < this.EndDate() ); | 
|       if( not isnull( menginecost ) ){ | 
|         mpits        := selectset( pits, Elements, pit, pit.Trip().Arrival().Date() >= menginecost.StartDate() and pit.Trip().Arrival().Date() <= menginecost.EndDate() ); | 
|         transcost    := transcost + this.CalcTransCost( mpits, transcosts, menginecost ); | 
|       } | 
|       benginecost    := selectobject( enginecosts, Elements, engine, engine.StartDate() > this.StartDate() and engine.StartDate() <= this.EndDate() and engine.EndDate() > this.EndDate() ); | 
|       if( not isnull( benginecost ) ){ | 
|         bpits        := selectset( pits, Elements, pit, pit.Trip().Arrival().Date() >= benginecost.StartDate() and pit.Trip().Arrival().Date() <= benginecost.EndDate() ) | 
|         transcost    := transcost + this.CalcTransCost( bpits, transcosts, benginecost ); | 
|       } | 
|     }else{ | 
|       transcost      := transcost + this.CalcTransCost( pits, transcosts, enginecost ); | 
|     } | 
|     return transcost; | 
|   *] | 
| } |