admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Quintiq file version 2.0
#parent: #root
Method GetUnusedPIT (
  output owning ProductInTrips unusedpits_o,
  output Number nrofunsedtrip_o
)
{
  Description: 'Retrieve all the unsed pit from algorithmrun, count trip that is totally not in used'
  TextBody:
  [*
    unusedpits_o := selectset( this, ProductInTrip, productintrip,
                             productintrip.OptimizerQuantity() = 0
                              and not productintrip.HasUserQuantity()
                              and not productintrip.HasFeedback() );
    
    // get all the trip in that has unused pits
    totaltripfromunsedpit := counter( unusedpits_o, Elements.Trip, trip, true, true );
    // exclude the trip that still has pit with optimizer quantity or has feedback or has user quantity
    excludetrips := counter(  unusedpits_o, Elements.Trip, trip, 
                              exists(  trip, ProductInTrip, pit, pit.OptimizerQuantity() > 0 or pit.HasUserQuantity() or pit.HasFeedback() ) );
    
    nrofunsedtrip_o := totaltripfromunsedpit - excludetrips;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}