| | |
| | | planPre := macroPlan.PackagingPlanColumn( relnew, StartDate := macroPlan.StartOfPlanning().Date() - 1 ); |
| | | |
| | | // çææ¥è¡¨ |
| | | traverse ( macroPlan, Product_MP.ProductInStockingPoint_MP, pisp, pisp.IsLeaf() and not pisp.IsSystem() ) { |
| | | // åå»ºè¡ |
| | | ppr := select( macroPlan, PackagingPlanRow, tempPPR, tempPPR.ProductID() = pisp.ProductID() and tempPPR.StockingPointID() = pisp.StockingPointID() ); |
| | | if ( isnull( ppr ) ) { |
| | | ppr := macroPlan.PackagingPlanRow( relnew, ProductID := pisp.ProductID(), StockingPointID := pisp.StockingPointID(), Factory := "大è¿å·¥å", Category := "ZKG" ); |
| | | } |
| | | traverse ( macroPlan, Product_MP.ProductInStockingPoint_MP, pisp, pisp.IsLeaf() and not pisp.IsSystem() and |
| | | ( pisp.StockingPointID().Regex( "CC" ) or pisp.StockingPointID().Regex( "DL" ) or pisp.StockingPointID().Regex( "大è¿" ) or pisp.StockingPointID().Regex( "é¿æ¥" ) ) ) { |
| | | // å½åpispæå¤å°ç¹ |
| | | factory := ifexpr( pisp.StockingPointID().Regex( "CC" ) or pisp.StockingPointID().Regex( "é¿æ¥" ), "é¿æ¥å·¥å", "大è¿å·¥å" ); |
| | | |
| | | // å建计ååä¸å¤©æ ¼å |
| | | planPreCell := ppr.PackagingPlanCell( relnew, PackagingPlanColumn := planPre, InitialPackagingInventory := 200 ); |
| | | // åå»ºè¡ |
| | | ppr := select( macroPlan, PackagingPlanRow, tempPPR, tempPPR.ProductID() = pisp.ProductID() and tempPPR.Factory() = factory ); |
| | | if ( isnull( ppr ) ) { |
| | | ppr := macroPlan.PackagingPlanRow( relnew, ProductID := pisp.ProductID(), StockingPointID := pisp.StockingPointID(), Factory := factory, Category := guard( pisp.Product_MP().ParentID(), "" ) ); |
| | | } |
| | | |
| | | // åºåå°åºåç¹Trip |
| | | originTrips := selectset( macroPlan, Unit.Lane.LaneLeg.Trip, tempT, tempT.LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID() = pisp.StockingPointID() ); |
| | | // ç®çå°åºåç¹Trip |
| | | destinationTrips := selectset( macroPlan, Unit.Lane.LaneLeg.Trip, tempT, tempT.LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() = pisp.StockingPointID() ); |
| | | |
| | | // å建åå
æ ¼ |
| | | traverse ( pisp, ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), pispipl, not pispipl.IsPeriodFrozen() ) { |
| | | // å建å |
| | | ppc := select( macroPlan, PackagingPlanColumn, tempPPC, tempPPC.StartDate() = pispipl.Start().Date() ); |
| | |
| | | // å建åå
æ ¼ |
| | | cell := select( ppr, PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn() = ppc ); |
| | | if ( isnull( cell ) ) { |
| | | cell := ppr.PackagingPlanCell( relnew, NetDemand := pispipl.DependentDemandAndSalesDemandQuantity() - pispipl.NewSupplyQuantity(), EndingInventory := pispipl.InventoryLevelEnd() ); |
| | | cell := ppr.PackagingPlanCell( relnew ); |
| | | cell.NetDemand( pispipl.DependentDemandAndSalesDemandQuantity() - pispipl.NewSupplyQuantity() ); |
| | | cell.EndingInventory( pispipl.InventoryLevelEnd() ); |
| | | cell.PackagingPlanColumn( relset, ppc ); |
| | | } else { |
| | | cell.NetDemand( cell.NetDemand() + ( pispipl.DependentDemandAndSalesDemandQuantity() - pispipl.NewSupplyQuantity() ) ); |
| | | cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() ); |
| | | } |
| | | |
| | | // 设置è°åº&è°è¿ |
| | | // 设置è°åº |
| | | outs := selectset( originTrips, Elements, tempT, tempT.Departure().Date() = pispipl.Start().Date() ); |
| | | traverse ( outs, Elements, out ) { |
| | | cell.Out( cell.Out() + out.Quantity() ); |
| | | } |
| | | |
| | | // 设置è°è¿ |
| | | transferIns := selectset( destinationTrips, Elements, tempT, tempT.Arrival().Date() = pispipl.Start().Date() ); |
| | | traverse ( transferIns, Elements, ti ) { |
| | | cell.TransferIn( cell.TransferIn() + ti.Quantity() ); |
| | |
| | | |
| | | // 设置åä¸å¤©åºå |
| | | if ( pispipl.Start().Date() = macroPlan.StartOfPlanning().Date() ) { |
| | | // prePISPIPL := pispipl.PreviousPlanningPISPIP().astype( ProductInStockingPointInPeriodPlanningLeaf ); |
| | | planPreCell.EndingInventory( 2000 ); |
| | | prePISPIPL := pispipl.PreviousPlanningPISPIP().astype( ProductInStockingPointInPeriodPlanningLeaf ); // åä¸ä¸ªpispippl |
| | | // å建计ååä¸å¤©æ ¼å |
| | | preCell := select( ppr, PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn() = planPre ); |
| | | if ( isnull( preCell ) ) { |
| | | preCell := ppr.PackagingPlanCell( relnew ); |
| | | preCell.EndingInventory( prePISPIPL.InventoryLevelEnd() ); |
| | | preCell.PackagingPlanColumn( relset, planPre ); |
| | | } else { |
| | | preCell.EndingInventory( preCell.EndingInventory() + prePISPIPL.InventoryLevelEnd() ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | Transaction::Transaction().Propagate( relation( PackagingPlanCell, Next ) ); |
| | | |
| | | // 设置å
è£
&æå
-æ°é |
| | | traverse ( macroPlan, PackagingPlanRow, ppr, ( ppr.ProductID() = "Windshield" and ppr.StockingPointID() = "Bosch" ) or ( ppr.ProductID() = "Windshield" and ppr.StockingPointID() = "Components (Spain)" ) ) { |
| | | traverse ( ppr, PackagingPlanCell, ppc/*, ppc.StartDate() = Date::Construct( 2020, 4, 1 )*/ ) { |
| | | // 设置å
è£
æ°é |
| | | if ( ppc.PackagingInventory() < ppc.Out() ) { // å
è£
åºåæ¯å¦å°äºè°åº |
| | | prePPC := ppc.Previous(); |
| | | needPackagingQuantity := ppc.Out() - prePPC.PackagingInventory(); |
| | | while ( not isnull( prePPC ) and needPackagingQuantity > 0.0 ) { |
| | | // è·åå
è£
lotsize |
| | | ppls := select( macroPlan, PackagingPlanLotSize, tempPPLS, tempPPLS.Factory() = ppc.PackagingPlanRow().Factory() and |
| | | tempPPLS.ProductID() = ppc.PackagingPlanRow().ProductID() ); |
| | | |
| | | // è·åæå¤§å
è£
æ°é |
| | | maxPackageReflection := Reflection::FindAttribute( "PackagingPlanCapability", ppc.PackagingPlanRow().FactoryAbbreviation() + "_" + ppc.PackagingPlanRow().Category() + "_Package" ); |
| | | // maxPackageQuantity := maxPackageReflection.GetNumber( macroPlan.PackagingPlanCapability() ); // æ¤å¤éè¦ä¿®æ¹ |
| | | maxPackageQuantity := 100000; |
| | | |
| | | // è·åæç»å
è£
æ°é |
| | | finalPackagingQuantity := minvalue( ceil( needPackagingQuantity / ppls.LotSize() ), ceil( ( maxPackageQuantity - prePPC.Package() ) / ppls.LotSize() ) ) * ppls.LotSize(); |
| | | needPackagingQuantity := needPackagingQuantity - finalPackagingQuantity; |
| | | |
| | | // 设置å
è£
å¼ |
| | | prePPC.Package( prePPC.Package() + finalPackagingQuantity ); |
| | | |
| | | //debuginfo( "éè¦å
è£
æ°éï¼", needPackagingQuantity, " lotsize: ", ppls.LotSize(), " æå¤§å
è£
æ°éï¼", maxPackageQuantity, " æç»è¡¥çæ°éï¼", finalPackagingQuantity ); |
| | | PackagingPlanCell::CalculationPackagingPlanProperties(); |
| | | |
| | | prePPC := prePPC.Previous(); |
| | | } |
| | | } |
| | | |
| | | // 设置æå
æ°é |
| | | if ( ppc.TransferIn() > 0.0 ) { // æè°å
¥æ°é |
| | | // è·åå
è£
lotsize |
| | | ppls := select( macroPlan, PackagingPlanLotSize, tempPPLS, tempPPLS.Factory() = ppc.PackagingPlanRow().Factory() and |
| | | tempPPLS.ProductID() = ppc.PackagingPlanRow().ProductID() ); |
| | | |
| | | // 设置æå
å¼ |
| | | ppc.Unpacking( ppc.TransferIn() ); |
| | | } |
| | | } |
| | | } |
| | | //traverse ( macroPlan, PackagingPlanRow, ppr, ( ppr.ProductID() = "Windshield" and ppr.StockingPointID() = "Bosch" ) or ( ppr.ProductID() = "Windshield" and ppr.StockingPointID() = "Components (Spain)" ) ) { |
| | | // traverse ( ppr, PackagingPlanCell, ppc/*, ppc.StartDate() = Date::Construct( 2020, 4, 1 )*/ ) { |
| | | // // 设置å
è£
æ°é |
| | | // if ( ppc.PackagingInventory() < ppc.Out() ) { // å
è£
åºåæ¯å¦å°äºè°åº |
| | | // prePPC := ppc.Previous(); |
| | | // needPackagingQuantity := ppc.Out() - prePPC.PackagingInventory(); |
| | | // while ( not isnull( prePPC ) and needPackagingQuantity > 0.0 ) { |
| | | // // è·åå
è£
lotsize |
| | | // ppls := select( macroPlan, PackagingPlanLotSize, tempPPLS, tempPPLS.Factory() = ppc.PackagingPlanRow().Factory() and |
| | | // tempPPLS.ProductID() = ppc.PackagingPlanRow().ProductID() ); |
| | | // |
| | | // // è·åæå¤§å
è£
æ°é |
| | | // maxPackageReflection := Reflection::FindAttribute( "PackagingPlanCapability", ppc.PackagingPlanRow().FactoryAbbreviation() + "_" + ppc.PackagingPlanRow().Category() + "_Package" ); |
| | | //// maxPackageQuantity := maxPackageReflection.GetNumber( macroPlan.PackagingPlanCapability() ); // æ¤å¤éè¦ä¿®æ¹ |
| | | // maxPackageQuantity := 100000; |
| | | // |
| | | // // è·åæç»å
è£
æ°é |
| | | // finalPackagingQuantity := minvalue( ceil( needPackagingQuantity / ppls.LotSize() ), ceil( ( maxPackageQuantity - prePPC.Package() ) / ppls.LotSize() ) ) * ppls.LotSize(); |
| | | // needPackagingQuantity := needPackagingQuantity - finalPackagingQuantity; |
| | | // |
| | | // // 设置å
è£
å¼ |
| | | // prePPC.Package( prePPC.Package() + finalPackagingQuantity ); |
| | | // |
| | | // //debuginfo( "éè¦å
è£
æ°éï¼", needPackagingQuantity, " lotsize: ", ppls.LotSize(), " æå¤§å
è£
æ°éï¼", maxPackageQuantity, " æç»è¡¥çæ°éï¼", finalPackagingQuantity ); |
| | | // PackagingPlanCell::CalculationPackagingPlanProperties(); |
| | | // |
| | | // prePPC := prePPC.Previous(); |
| | | // } |
| | | // } |
| | | // |
| | | // // 设置æå
æ°é |
| | | // if ( ppc.TransferIn() > 0.0 ) { // æè°å
¥æ°é |
| | | // // è·åå
è£
lotsize |
| | | // ppls := select( macroPlan, PackagingPlanLotSize, tempPPLS, tempPPLS.Factory() = ppc.PackagingPlanRow().Factory() and |
| | | // tempPPLS.ProductID() = ppc.PackagingPlanRow().ProductID() ); |
| | | // |
| | | // // 设置æå
å¼ |
| | | // ppc.Unpacking( ppc.TransferIn() ); |
| | | // } |
| | | // } |
| | | //} |
| | | *] |
| | | } |