Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod SetPackagingAndUnpackingValuesCC ( 
 | 
  MacroPlan macroPlan 
 | 
) 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "长春工厂" /*and ppr.Category() = "ZKG" and ppr.ProductID() = "06K103011CP"*/ ) { 
 | 
       
 | 
      u  := select( macroPlan, Unit, tempU, tempU.ID() = "CC " + ppr.Category() + " 线边和外租库间"); 
 | 
       
 | 
      ts := selectset( u, Lane.LaneLeg.Trip, tempT,  
 | 
                       guard( select( tempT, ProductInTrip, tempPIT, tempPIT.ProductID() = ppr.ProductID() ).Quantity() > 0, false ) ); 
 | 
                        
 | 
      traverse ( ts, Elements.ProductInTrip, pit, pit.Quantity() > 0 and pit.ProductID() = ppr.ProductID() ) { 
 | 
        ppcell := select( ppr, PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn().StartDate() = pit.Trip().Departure().Date() ); 
 | 
         
 | 
        if ( pit.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" ) and pit.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" ) ) { 
 | 
          ppcell.Unpacking( pit.Quantity() ); 
 | 
        } 
 | 
         
 | 
        if ( pit.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" ) and pit.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" ) ) { 
 | 
          ppcell.Package( pit.Quantity() ); 
 | 
        } 
 | 
      } 
 | 
    //  traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) { 
 | 
    //    unpackagedQuantity := sum( u, 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 ); 
 | 
    //  } 
 | 
    } 
 | 
  *] 
 | 
} 
 |