| | |
| | | { |
| | | TextBody: |
| | | [* |
| | | macroPlan.PackagingPlanRow( relflush ); |
| | | macroPlan.PackagingPlanColumn( relflush ); |
| | | |
| | | // å建计ååä¸å¤©å |
| | | planPre := macroPlan.PackagingPlanColumn( relnew, StartDate := macroPlan.StartOfPlanning().Date() - 1 ); |
| | | |
| | | // çææ¥è¡¨ |
| | | 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( "é¿æ¥" ), "é¿æ¥å·¥å", "大è¿å·¥å" ); |
| | | factoryAbbreviation := ifexpr( pisp.StockingPointID().Regex( "CC" ) or pisp.StockingPointID().Regex( "é¿æ¥" ), "CC", "DL" ); |
| | | |
| | | // åå»ºè¡ |
| | | ppr := select( macroPlan, PackagingPlanRow, tempPPR, tempPPR.ProductID() = pisp.ProductID() and tempPPR.Factory() = factory ); |
| | | if ( isnull( ppr ) ) { |
| | | ppr := macroPlan.PackagingPlanRow( relnew, ProductID := pisp.ProductID(), Factory := factory, Category := guard( pisp.Product_MP().ParentID(), "" ) ); |
| | | } |
| | | |
| | | // 循ç¯pispippl |
| | | traverse ( pisp, ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), pispipl, not pispipl.IsPeriodFrozen() ) { |
| | | // å建å |
| | | ppc := select( macroPlan, PackagingPlanColumn, tempPPC, tempPPC.StartDate() = pispipl.Start().Date() ); |
| | | if ( isnull( ppc ) ) { |
| | | ppc := macroPlan.PackagingPlanColumn( relnew, StartDate := pispipl.Start().Date() ); |
| | | } |
| | | |
| | | // å建åå
æ ¼ |
| | | cell := select( ppr, PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn() = ppc ); |
| | | if ( isnull( cell ) ) { |
| | | cell := ppr.PackagingPlanCell( relnew ); |
| | | cell.NetDemand( pispipl.InventoryLevelEnd() + pispipl.NewSupplyQuantity() - pispipl.DependentDemandAndSalesDemandQuantity() ); |
| | | cell.EndingInventory( pispipl.InventoryLevelEnd() ); |
| | | cell.PackagingPlanColumn( relset, ppc ); |
| | | } else { |
| | | cell.NetDemand( cell.NetDemand() + ( pispipl.InventoryLevelEnd() + pispipl.NewSupplyQuantity() - pispipl.DependentDemandAndSalesDemandQuantity() ) ); |
| | | cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() ); |
| | | } |
| | | |
| | | // 设置è°åº |
| | | traverse ( pispipl, AsDeparturePISPIP, pit, |
| | | pit.Quantity() > 0 and |
| | | pit.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( factoryAbbreviation ) and |
| | | TransferPlanRow::IdentifyTheFactory( pit.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP() ) <> TransferPlanRow::IdentifyTheFactory( pit.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP() ) |
| | | ) |
| | | { |
| | | cell.Out( cell.Out() + pit.Quantity() ); |
| | | } |
| | | |
| | | // 设置è°è¿ |
| | | traverse ( pispipl, AsArrivalPISPIP, pit, |
| | | pit.Quantity() > 0 and |
| | | pit.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( factoryAbbreviation ) and |
| | | TransferPlanRow::IdentifyTheFactory( pit.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP() ) <> TransferPlanRow::IdentifyTheFactory( pit.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP() ) |
| | | ) |
| | | { |
| | | cell.TransferIn( cell.TransferIn() + pit.Quantity() ); |
| | | } |
| | | |
| | | // é¿æ¥å·¥åç¹æ®æ
åµè®¾ç½®å
è£
åºååéå
è£
åºå |
| | | if ( factory = "é¿æ¥å·¥å" ) { |
| | | if ( pisp.StockingPointID().Regex( "å¤ç§åº" ) ) { |
| | | cell.CC_PackagingInventory( pispipl.InventoryLevelEnd() ); |
| | | } else if ( pisp.StockingPointID().Regex( "线边åº" ) ) { |
| | | cell.CC_UnpackagedInventory( pispipl.InventoryLevelEnd() ); |
| | | } |
| | | } |
| | | |
| | | // 设置åä¸å¤©åºå |
| | | if ( pispipl.Start().Date() = macroPlan.StartOfPlanning().Date() ) { |
| | | 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( attribute( PackagingPlanRow, FactoryAbbreviation ) ); |
| | | PackagingPlanCell::CalculationPackagingPlanProperties(); |
| | | Transaction::Transaction().Propagate( relation( PackagingPlanCell, Next ) ); |
| | | //macroPlan.PackagingPlanRow( relflush ); |
| | | //macroPlan.PackagingPlanColumn( relflush ); |
| | | // |
| | | //// å建计ååä¸å¤©å |
| | | //planPre := macroPlan.PackagingPlanColumn( relnew, StartDate := macroPlan.StartOfPlanning().Date() - 1 ); |
| | | // |
| | | //// çææ¥è¡¨ |
| | | //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( "é¿æ¥" ), "é¿æ¥å·¥å", "大è¿å·¥å" ); |
| | | // factoryAbbreviation := ifexpr( pisp.StockingPointID().Regex( "CC" ) or pisp.StockingPointID().Regex( "é¿æ¥" ), "CC", "DL" ); |
| | | // |
| | | // // åå»ºè¡ |
| | | // ppr := select( macroPlan, PackagingPlanRow, tempPPR, tempPPR.ProductID() = pisp.ProductID() and tempPPR.Factory() = factory ); |
| | | // if ( isnull( ppr ) ) { |
| | | // ppr := macroPlan.PackagingPlanRow( relnew, ProductID := pisp.ProductID(), Factory := factory, Category := guard( pisp.Product_MP().ParentID(), "" ) ); |
| | | // } |
| | | // |
| | | // // 循ç¯pispippl |
| | | // traverse ( pisp, ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), pispipl, not pispipl.IsPeriodFrozen() ) { |
| | | // // å建å |
| | | // ppc := select( macroPlan, PackagingPlanColumn, tempPPC, tempPPC.StartDate() = pispipl.Start().Date() ); |
| | | // if ( isnull( ppc ) ) { |
| | | // ppc := macroPlan.PackagingPlanColumn( relnew, StartDate := pispipl.Start().Date() ); |
| | | // } |
| | | // |
| | | // // å建åå
æ ¼ |
| | | // cell := select( ppr, PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn() = ppc ); |
| | | // if ( isnull( cell ) ) { |
| | | // cell := ppr.PackagingPlanCell( relnew ); |
| | | // cell.NetDemand( pispipl.InventoryLevelEnd() + pispipl.NewSupplyQuantity() - pispipl.DependentDemandAndSalesDemandQuantity() ); |
| | | // cell.EndingInventory( pispipl.InventoryLevelEnd() ); |
| | | // cell.PackagingPlanColumn( relset, ppc ); |
| | | // } else { |
| | | // cell.NetDemand( cell.NetDemand() + ( pispipl.InventoryLevelEnd() + pispipl.NewSupplyQuantity() - pispipl.DependentDemandAndSalesDemandQuantity() ) ); |
| | | // cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() ); |
| | | // } |
| | | // |
| | | // // 设置è°åº |
| | | // traverse ( pispipl, AsDeparturePISPIP, pit, |
| | | // pit.Quantity() > 0 and |
| | | // pit.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( factoryAbbreviation ) and |
| | | // TransferPlanRow::IdentifyTheFactory( pit.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP() ) <> TransferPlanRow::IdentifyTheFactory( pit.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP() ) |
| | | // ) |
| | | // { |
| | | // cell.Out( cell.Out() + pit.Quantity() ); |
| | | // } |
| | | // |
| | | // // 设置è°è¿ |
| | | // traverse ( pispipl, AsArrivalPISPIP, pit, |
| | | // pit.Quantity() > 0 and |
| | | // pit.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( factoryAbbreviation ) and |
| | | // TransferPlanRow::IdentifyTheFactory( pit.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP() ) <> TransferPlanRow::IdentifyTheFactory( pit.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP() ) |
| | | // ) |
| | | // { |
| | | // cell.TransferIn( cell.TransferIn() + pit.Quantity() ); |
| | | // } |
| | | // |
| | | // // é¿æ¥å·¥åç¹æ®æ
åµè®¾ç½®å
è£
åºååéå
è£
åºå |
| | | // if ( factory = "é¿æ¥å·¥å" ) { |
| | | // if ( pisp.StockingPointID().Regex( "å¤ç§åº" ) ) { |
| | | // cell.CC_PackagingInventory( pispipl.InventoryLevelEnd() ); |
| | | // } else if ( pisp.StockingPointID().Regex( "线边åº" ) ) { |
| | | // cell.CC_UnpackagedInventory( pispipl.InventoryLevelEnd() ); |
| | | // } |
| | | // } |
| | | // |
| | | // // 设置åä¸å¤©åºå |
| | | // if ( pispipl.Start().Date() = macroPlan.StartOfPlanning().Date() ) { |
| | | // 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( attribute( PackagingPlanRow, FactoryAbbreviation ) ); |
| | | //PackagingPlanCell::CalculationPackagingPlanProperties(); |
| | | //Transaction::Transaction().Propagate( relation( PackagingPlanCell, Next ) ); |
| | | |
| | | // 设置å
è£
&æå
-æ°é |
| | | PackagingPlanCell::SetPackagingAndUnpackingValues( macroPlan ); |
| | | //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 )*/ ) { |
| | | // // 设置å
è£
æ°é |