|  |  |  | 
|---|
|  |  |  | // åå»ºè¡ | 
|---|
|  |  |  | 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(), "" ) ); | 
|---|
|  |  |  | ppr := macroPlan.PackagingPlanRow( relnew, ProductID := pisp.ProductID(), Factory := factory, Category := guard( pisp.Product_MP().ParentID(), "" ) ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // åºåå°åºåç¹Trip | 
|---|
|  |  |  | originTrips      := selectset( macroPlan, Unit.Lane.LaneLeg.Trip, tempT, tempT.LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( factoryAbbreviation )      and | 
|---|
|  |  |  | TransferPlanRow::IdentifyTheFactory( tempT.LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP() ) <> TransferPlanRow::IdentifyTheFactory( tempT.LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP() ) ); | 
|---|
|  |  |  | // ç®çå°åºåç¹Trip | 
|---|
|  |  |  | destinationTrips := selectset( macroPlan, Unit.Lane.LaneLeg.Trip, tempT, tempT.LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( factoryAbbreviation ) and | 
|---|
|  |  |  | TransferPlanRow::IdentifyTheFactory( tempT.LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP() ) <> TransferPlanRow::IdentifyTheFactory( tempT.LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP() ) ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // å¾ªç¯pispippl | 
|---|
|  |  |  | traverse ( pisp, ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), pispipl, not pispipl.IsPeriodFrozen() ) { | 
|---|
|  |  |  | 
|---|
|  |  |  | cell := select( ppr, PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn() = ppc ); | 
|---|
|  |  |  | if ( isnull( cell ) ) { | 
|---|
|  |  |  | cell := ppr.PackagingPlanCell( relnew ); | 
|---|
|  |  |  | cell.NetDemand( pispipl.DependentDemandAndSalesDemandQuantity() - pispipl.NewSupplyQuantity() ); | 
|---|
|  |  |  | cell.NetDemand( pispipl.InventoryLevelEnd() + pispipl.NewSupplyQuantity() - pispipl.DependentDemandAndSalesDemandQuantity() ); | 
|---|
|  |  |  | cell.EndingInventory( pispipl.InventoryLevelEnd() ); | 
|---|
|  |  |  | cell.PackagingPlanColumn( relset, ppc ); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | cell.NetDemand( cell.NetDemand() + ( pispipl.DependentDemandAndSalesDemandQuantity() - pispipl.NewSupplyQuantity() ) ); | 
|---|
|  |  |  | cell.NetDemand( cell.NetDemand() + ( pispipl.InventoryLevelEnd() + pispipl.NewSupplyQuantity() - pispipl.DependentDemandAndSalesDemandQuantity() ) ); | 
|---|
|  |  |  | cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // è®¾ç½®è°åº | 
|---|
|  |  |  | outs := selectset( originTrips, Elements, tempT, tempT.Departure().Date() = pispipl.Start().Date() ); | 
|---|
|  |  |  | traverse ( outs, Elements.ProductInTrip, outPIT, outPIT.ProductID() = pisp.ProductID() ) { | 
|---|
|  |  |  | cell.Out( cell.Out() + outPIT.Quantity() ); | 
|---|
|  |  |  | 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() ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // è®¾ç½®è°è¿ | 
|---|
|  |  |  | transferIns := selectset( destinationTrips, Elements, tempT, tempT.Arrival().Date() = pispipl.Start().Date() ); | 
|---|
|  |  |  | traverse ( transferIns, Elements.ProductInTrip, tiPIT, tiPIT.ProductID() = pisp.ProductID() ) { | 
|---|
|  |  |  | cell.TransferIn( cell.TransferIn() + tiPIT.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() ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // é¿æ¥å·¥åç¹æ®æ
åµè®¾ç½®å
è£
åºååéå
è£
åºå | 
|---|