admin
2024-10-31 602aee97554a09ab36ac0396bd4cd155ab590a80
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
26
27
28
29
30
31
Quintiq file version 2.0
#parent: #root
StaticMethod SetPackagingAndUnpackingValuesCC (
  MacroPlan macroPlan
)
{
  TextBody:
  [*
    traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "长春工厂" /*and ppr.ProductID() = "06K103011CM"*/ ) {
      traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) {
        unpackagedQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT, 
                                   tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
                                   tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
                                   tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" )      and
                                   tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" ),
                                   tempPIT.Quantity()
                                  );
        ppcell.Unpacking( unpackagedQuantity );
        
        packagedQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT, 
                                 tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
                                 tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
                                 tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" )      and
                                 tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" ),
                                 tempPIT.Quantity()
                                );
        ppcell.Package( packagedQuantity );
      }
    }
  *]
}