¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | StaticMethod CreateData ( |
| | | MacroPlan macroPlan |
| | | ) |
| | | { |
| | | Description: 'åå»ºæ°æ®' |
| | | 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.PackagingPlanColumn( relset, ppc ); |
| | | } |
| | | |
| | | // 设置è°åº |
| | | 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 = "大è¿å·¥å" ) { |
| | | // åéæ±&å©ä½åºå&ä¾åºé |
| | | cell.NetDemand( cell.NetDemand() + pispipl.DependentDemandAndSalesDemandQuantity() ); |
| | | cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() ); |
| | | } |
| | | |
| | | // é¿æ¥å·¥åè®¾ç½®å¼ |
| | | if ( factory = "é¿æ¥å·¥å" ) { |
| | | // å©ä½åºå&ä¾åºé |
| | | cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() ); |
| | | |
| | | // åéæ±ãåªå线边åºã&å
è£
åºå&éå
è£
åºå |
| | | if ( pisp.StockingPointID().Regex( "å¤ç§åº" ) ) { |
| | | cell.CC_PackagingInventory( pispipl.InventoryLevelEnd() ); |
| | | } else if ( pisp.StockingPointID().Regex( "线边åº" ) ) { |
| | | cell.CC_UnpackagedInventory( pispipl.InventoryLevelEnd() ); |
| | | cell.NetDemand( cell.NetDemand() + pispipl.DependentDemandAndSalesDemandQuantity() ); |
| | | } |
| | | } |
| | | |
| | | // 设置New Supplyï¼çº¯çäº§å¼ |
| | | traverse ( pispipl, NewSupply, ns, ns.PeriodTask_MP().istype( PeriodTaskOperation ) ) { |
| | | cell.NewSupply( cell.NewSupply() + ns.Quantity() ); |
| | | } |
| | | |
| | | // 设置åä¸å¤©åºå |
| | | 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 ) ); |
| | | *] |
| | | } |
| | |
| | | { |
| | | 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.PackagingPlanColumn( relset, ppc ); |
| | | } |
| | | |
| | | // 设置è°åº |
| | | 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 = "大è¿å·¥å" ) { |
| | | // åéæ±&å©ä½åºå&ä¾åºé |
| | | cell.NetDemand( cell.NetDemand() + pispipl.DependentDemandAndSalesDemandQuantity() ); |
| | | cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() ); |
| | | } |
| | | |
| | | // é¿æ¥å·¥åè®¾ç½®å¼ |
| | | if ( factory = "é¿æ¥å·¥å" ) { |
| | | // å©ä½åºå&ä¾åºé |
| | | cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() ); |
| | | |
| | | // åéæ±ãåªå线边åºã&å
è£
åºå&éå
è£
åºå |
| | | if ( pisp.StockingPointID().Regex( "å¤ç§åº" ) ) { |
| | | cell.CC_PackagingInventory( pispipl.InventoryLevelEnd() ); |
| | | } else if ( pisp.StockingPointID().Regex( "线边åº" ) ) { |
| | | cell.CC_UnpackagedInventory( pispipl.InventoryLevelEnd() ); |
| | | cell.NetDemand( cell.NetDemand() + pispipl.DependentDemandAndSalesDemandQuantity() ); |
| | | } |
| | | } |
| | | |
| | | // 设置New Supplyï¼çº¯çäº§å¼ |
| | | traverse ( pispipl, NewSupply, ns, ns.PeriodTask_MP().istype( PeriodTaskOperation ) ) { |
| | | cell.NewSupply( cell.NewSupply() + ns.Quantity() ); |
| | | } |
| | | |
| | | // 设置åä¸å¤©åºå |
| | | 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::CreateData( macroPlan ); |
| | | |
| | | // 设置å
è£
&æå
-æ°éï¼å¤§è¿å·¥åï¼ |
| | | PackagingPlanCell::SetPackagingAndUnpackingValuesDL( macroPlan ); |
| | | |
| | | // 设置å
è£
&æå
-æ°éï¼é¿æ¥å·¥åï¼ |
| | | PackagingPlanCell::SetPackagingAndUnpackingValuesCC( 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 )*/ ) { |
| | | // // 设置å
è£
æ°é |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | StaticMethod SetPackage_Capacity ( |
| | | MacroPlan macroPlan |
| | | ) |
| | | { |
| | | TextBody: |
| | | [* |
| | | // 计åå¼å§æ¶é´ |
| | | plannedStartDate := macroPlan.StartOfPlanning().Date(); |
| | | |
| | | // 设置å
è£
å¼ï¼ç¬¦åå¤§ç±»ä¸ææäº§åéå
è£
éåºåå åä¸è½å¤§äºç³»ç»å¼ï¼ |
| | | factorys := selectuniquevalues( macroPlan, PackagingPlanRow, tempPPR, true, tempPPR.FactoryAbbreviation() ); |
| | | categorys := selectuniquevalues( macroPlan, PackagingPlanRow, tempPPR, true, tempPPR.Category() ); |
| | | traverse ( factorys, Elements, f/*, f = "DL"*/ ) { |
| | | traverse ( categorys, Elements, c/*, c = "ZKG"*/ ) { |
| | | // ç³»ç»è§å®çæå¤§éå
è£
åºåæ°é |
| | | ppmqReflection := Reflection::FindAttribute( "PackagingPlanMaximumQuantity", f + "_" + c ); |
| | | maxPackageQuantity := guard( ppmqReflection.GetNumber( macroPlan.PackagingPlanMaximumQuantity() ), 0 ); |
| | | // å½åå·¥åä¸ä¸ç±»äº§åè¡ |
| | | pprs := selectset( macroPlan, PackagingPlanRow, tempPPR, tempPPR.FactoryAbbreviation() = f and tempPPR.Category() = c ); |
| | | |
| | | // info( "å½åå·¥åï¼", f, " å½å大类ï¼", c, " 大类ä¸çæå¤§å
è£
æ°éï¼", maxPackageQuantity ); |
| | | traverse ( macroPlan, PackagingPlanColumn, ppc, ppc.StartDate() > plannedStartDate and maxPackageQuantity > 0 ) { |
| | | sumUnpackagedInventoryQuantity := sum( pprs, Elements.PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn() = ppc, tempPPCell.UnpackagedInventory() ).Round( 0 ); |
| | | |
| | | // éè¦å
è£
|
| | | if ( sumUnpackagedInventoryQuantity > maxPackageQuantity ) { |
| | | // éè¦å
è£
çæ°é |
| | | needPackagingQuantity := [Number] ( sumUnpackagedInventoryQuantity - maxPackageQuantity ); |
| | | // æéå
è£
åºåæåºåçè¡ |
| | | itemPPRs := selectsortedset( pprs, Elements, tempPPR, true, |
| | | -select( tempPPR, PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn() = ppc ).UnpackagedInventory() ); |
| | | |
| | | // info( "éè¦å
è£
æ¶é´ï¼", ppc.StartDate().Format( "Y-M2-D2" ), " éè¦å
è£
çæ°éï¼", needPackagingQuantity ); |
| | | traverse ( itemPPRs, Elements, ppr, needPackagingQuantity > 0 ) { |
| | | PackagingPlanCell::Package( macroPlan, ppr, ppc, needPackagingQuantity ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | StaticMethod SetPackage_Lotsize ( |
| | | MacroPlan macroPlan |
| | | ) |
| | | { |
| | | TextBody: |
| | | [* |
| | | // 计åå¼å§æ¶é´ |
| | | plannedStartDate := macroPlan.StartOfPlanning().Date(); |
| | | |
| | | // 设置å
è£
å¼ï¼ç¬¦ålotsizeå䏿¥æå¤§å
è£
éï¼ |
| | | traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "大è¿å·¥å" /*and ppr.ProductID() = "06K103011CM"*/ ) { |
| | | traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) { |
| | | // Product_MP |
| | | pmp := select( macroPlan, Product_MP, tempPMP, tempPMP.IsLeaf() and tempPMP.ID() = ppr.ProductID() ); |
| | | // å
è£
lotsize |
| | | ppls := select( macroPlan, PackagingPlanLotSize, tempPPLS, tempPPLS.Factory() = ppr.Factory() and |
| | | tempPPLS.ProductID() = ifexpr( exists( macroPlan, PackagingPlanLotSize, tempPPLS1, tempPPLS1.ProductID() = pmp.ID() ), |
| | | pmp.ID(), |
| | | pmp.ParentID() ) ); |
| | | // 䏿¥å
è£
容é |
| | | ppnc := select( macroPlan, PackagingPlanNewCapability, tempPPNC, tempPPNC.Factory() = ppr.Factory() and |
| | | tempPPNC.ProductID() = ifexpr( exists( macroPlan, PackagingPlanNewCapability, tempPPNC1, tempPPNC1.ProductID() = pmp.ID() ), |
| | | pmp.ID(), |
| | | pmp.ParentID() ) ); |
| | | // Unit |
| | | us := selectset( macroPlan, Unit, tempU, tempU.ID().Regex( ppr.FactoryAbbreviation() + " " + ppr.Category() ) ); |
| | | |
| | | // å
è£
åºååºç°è´å¼ï¼éè¦è®¾ç½®å
è£
é |
| | | if ( ppcell.PackagingInventory() < 0 and not isnull( ppls ) and not isnull( ppnc ) ) { |
| | | // éè¦å
è£
çæ°é |
| | | needPackagingQuantity := abs( ppcell.PackagingInventory() ).Round( 0 ); |
| | | // å
è£
å¼å§çç´¢å¼ |
| | | indexPPCell := ppcell.Previous(); |
| | | |
| | | // info( "产线个æ°ï¼", us.Size(), " å¼å§æ¶é´ï¼", ppcell.StartDate().Format( "Y-M2-D2" ), " å
è£
åºåæ°éï¼", ppcell.PackagingInventory(), " éè¦å
è£
çæ°éï¼", needPackagingQuantity, |
| | | // " å
è£
lotsizeï¼",guard( ppls.LotSize(), 0 ), " æå¤§å
è£
容éï¼", ppnc.MaximumDailyPackagingQuantity() ); |
| | | |
| | | while ( not isnull( indexPPCell ) and |
| | | indexPPCell.StartDate() >= plannedStartDate and |
| | | exists( us, Elements.UnitPeriod.astype( UnitPeriodTime ).ShiftPlan, tempSP, |
| | | tempSP.UnitPeriodTime().StartDate() = indexPPCell.StartDate(), |
| | | tempSP.Outcome() <> "" ) and |
| | | needPackagingQuantity > 0 ) { |
| | | // è½å
è£
çæ°é |
| | | canPackagingQuantity := ifexpr( ceil( needPackagingQuantity / ppls.LotSize() ) < floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ), |
| | | ceil( needPackagingQuantity / ppls.LotSize() ), |
| | | floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ) ) * ppls.LotSize(); |
| | | // info( "å¼å§å
è£
çæ¥æï¼", indexPPCell.StartDate().Format( "Y-M2-D2" ), " è½å
è£
çæ°é:", canPackagingQuantity ); |
| | | |
| | | indexPPCell.Package( canPackagingQuantity ); |
| | | Transaction::Transaction().Propagate( attribute( PackagingPlanCell, PackagingInventory ) ); |
| | | Transaction::Transaction().Propagate( attribute( PackagingPlanCell, UnpackagedInventory ) ); |
| | | |
| | | needPackagingQuantity := needPackagingQuantity - canPackagingQuantity; |
| | | indexPPCell := indexPPCell.Previous(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | *] |
| | | } |
| | |
| | | { |
| | | TextBody: |
| | | [* |
| | | // 计åå¼å§æ¶é´ |
| | | plannedStartDate := macroPlan.StartOfPlanning().Date(); |
| | | |
| | | // 设置å
è£
å¼ï¼ç¬¦ålotsizeå䏿¥æå¤§å
è£
éï¼ |
| | | traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "大è¿å·¥å" /*and ppr.ProductID() = "06K103011CM"*/ ) { |
| | | traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) { |
| | | // Product_MP |
| | | pmp := select( macroPlan, Product_MP, tempPMP, tempPMP.IsLeaf() and tempPMP.ID() = ppr.ProductID() ); |
| | | // å
è£
lotsize |
| | | ppls := select( macroPlan, PackagingPlanLotSize, tempPPLS, tempPPLS.Factory() = ppr.Factory() and |
| | | tempPPLS.ProductID() = ifexpr( exists( macroPlan, PackagingPlanLotSize, tempPPLS1, tempPPLS1.ProductID() = pmp.ID() ), |
| | | pmp.ID(), |
| | | pmp.ParentID() ) ); |
| | | // 䏿¥å
è£
容é |
| | | ppnc := select( macroPlan, PackagingPlanNewCapability, tempPPNC, tempPPNC.Factory() = ppr.Factory() and |
| | | tempPPNC.ProductID() = ifexpr( exists( macroPlan, PackagingPlanNewCapability, tempPPNC1, tempPPNC1.ProductID() = pmp.ID() ), |
| | | pmp.ID(), |
| | | pmp.ParentID() ) ); |
| | | // Unit |
| | | us := selectset( macroPlan, Unit, tempU, tempU.ID().Regex( ppr.FactoryAbbreviation() + " " + ppr.Category() ) ); |
| | | |
| | | // å
è£
åºååºç°è´å¼ï¼éè¦è®¾ç½®å
è£
é |
| | | if ( ppcell.PackagingInventory() < 0 and not isnull( ppls ) and not isnull( ppnc ) ) { |
| | | // éè¦å
è£
çæ°é |
| | | needPackagingQuantity := abs( ppcell.PackagingInventory() ).Round( 0 ); |
| | | // å
è£
å¼å§çç´¢å¼ |
| | | indexPPCell := ppcell.Previous(); |
| | | |
| | | // info( "产线个æ°ï¼", us.Size(), " å¼å§æ¶é´ï¼", ppcell.StartDate().Format( "Y-M2-D2" ), " å
è£
åºåæ°éï¼", ppcell.PackagingInventory(), " éè¦å
è£
çæ°éï¼", needPackagingQuantity, |
| | | // " å
è£
lotsizeï¼",guard( ppls.LotSize(), 0 ), " æå¤§å
è£
容éï¼", ppnc.MaximumDailyPackagingQuantity() ); |
| | | |
| | | while ( not isnull( indexPPCell ) and |
| | | indexPPCell.StartDate() >= plannedStartDate and |
| | | exists( us, Elements.UnitPeriod.astype( UnitPeriodTime ).ShiftPlan, tempSP, |
| | | tempSP.UnitPeriodTime().StartDate() = indexPPCell.StartDate(), |
| | | tempSP.Outcome() <> "" ) and |
| | | needPackagingQuantity > 0 ) { |
| | | // è½å
è£
çæ°é |
| | | canPackagingQuantity := ifexpr( ceil( needPackagingQuantity / ppls.LotSize() ) < floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ), |
| | | ceil( needPackagingQuantity / ppls.LotSize() ), |
| | | floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ) ) * ppls.LotSize(); |
| | | // info( "å¼å§å
è£
çæ¥æï¼", indexPPCell.StartDate().Format( "Y-M2-D2" ), " è½å
è£
çæ°é:", canPackagingQuantity ); |
| | | |
| | | indexPPCell.Package( canPackagingQuantity ); |
| | | Transaction::Transaction().Propagate( attribute( PackagingPlanCell, PackagingInventory ) ); |
| | | Transaction::Transaction().Propagate( attribute( PackagingPlanCell, UnpackagedInventory ) ); |
| | | |
| | | needPackagingQuantity := needPackagingQuantity - canPackagingQuantity; |
| | | indexPPCell := indexPPCell.Previous(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | PackagingPlanCell::SetPackage_Lotsize( macroPlan ); |
| | | |
| | | // 设置å
è£
å¼ï¼ç¬¦åå¤§ç±»ä¸ææäº§åéå
è£
éåºåå åä¸è½å¤§äºç³»ç»å¼ï¼ |
| | | factorys := selectuniquevalues( macroPlan, PackagingPlanRow, tempPPR, true, tempPPR.FactoryAbbreviation() ); |
| | | categorys := selectuniquevalues( macroPlan, PackagingPlanRow, tempPPR, true, tempPPR.Category() ); |
| | | traverse ( factorys, Elements, f/*, f = "DL"*/ ) { |
| | | traverse ( categorys, Elements, c/*, c = "ZKG"*/ ) { |
| | | // ç³»ç»è§å®çæå¤§éå
è£
åºåæ°é |
| | | ppmqReflection := Reflection::FindAttribute( "PackagingPlanMaximumQuantity", f + "_" + c ); |
| | | maxPackageQuantity := guard( ppmqReflection.GetNumber( macroPlan.PackagingPlanMaximumQuantity() ), 0 ); |
| | | // å½åå·¥åä¸ä¸ç±»äº§åè¡ |
| | | pprs := selectset( macroPlan, PackagingPlanRow, tempPPR, tempPPR.FactoryAbbreviation() = f and tempPPR.Category() = c ); |
| | | |
| | | // info( "å½åå·¥åï¼", f, " å½å大类ï¼", c, " 大类ä¸çæå¤§å
è£
æ°éï¼", maxPackageQuantity ); |
| | | traverse ( macroPlan, PackagingPlanColumn, ppc, ppc.StartDate() > plannedStartDate and maxPackageQuantity > 0 ) { |
| | | sumUnpackagedInventoryQuantity := sum( pprs, Elements.PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn() = ppc, tempPPCell.UnpackagedInventory() ).Round( 0 ); |
| | | |
| | | // éè¦å
è£
|
| | | if ( sumUnpackagedInventoryQuantity > maxPackageQuantity ) { |
| | | // éè¦å
è£
çæ°é |
| | | needPackagingQuantity := [Number] ( sumUnpackagedInventoryQuantity - maxPackageQuantity ); |
| | | // æéå
è£
åºåæåºåçè¡ |
| | | itemPPRs := selectsortedset( pprs, Elements, tempPPR, true, |
| | | -select( tempPPR, PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn() = ppc ).UnpackagedInventory() ); |
| | | |
| | | // info( "éè¦å
è£
æ¶é´ï¼", ppc.StartDate().Format( "Y-M2-D2" ), " éè¦å
è£
çæ°éï¼", needPackagingQuantity ); |
| | | traverse ( itemPPRs, Elements, ppr, needPackagingQuantity > 0 ) { |
| | | PackagingPlanCell::Package( macroPlan, ppr, ppc, needPackagingQuantity ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | PackagingPlanCell::SetPackage_Capacity( macroPlan ); |
| | | |
| | | // 设置æå
å¼ï¼ç¬¦ålotsizeå䏿¥æå¤§å
è£
éï¼ |
| | | traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "大è¿å·¥å" /*and ppr.ProductID() = "06K103011CM"*/ ) { |
| | | traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) { |
| | | // Product_MP |
| | | pmp := select( macroPlan, Product_MP, tempPMP, tempPMP.IsLeaf() and tempPMP.ID() = ppr.ProductID() ); |
| | | // å
è£
lotsize |
| | | ppls := select( macroPlan, PackagingPlanLotSize, tempPPLS, tempPPLS.Factory() = ppr.Factory() and |
| | | tempPPLS.ProductID() = ifexpr( exists( macroPlan, PackagingPlanLotSize, tempPPLS1, tempPPLS1.ProductID() = pmp.ID() ), |
| | | pmp.ID(), |
| | | pmp.ParentID() ) ); |
| | | // 䏿¥å
è£
容é |
| | | ppnc := select( macroPlan, PackagingPlanNewCapability, tempPPNC, tempPPNC.Factory() = ppr.Factory() and |
| | | tempPPNC.ProductID() = ifexpr( exists( macroPlan, PackagingPlanNewCapability, tempPPNC1, tempPPNC1.ProductID() = pmp.ID() ), |
| | | pmp.ID(), |
| | | pmp.ParentID() ) ); |
| | | // Unit |
| | | us := selectset( macroPlan, Unit, tempU, tempU.ID().Regex( ppr.FactoryAbbreviation() + " " + ppr.Category() ) ); |
| | | |
| | | // å½åéå
è£
åºå + ä¸ä¸å¤©çNewSupply < ä¸ä¸å¤©çåéæ± |
| | | if ( ppcell.UnpackagedInventory() < guard( ppcell.Next().NetDemand(), 0 ) and not isnull( ppls ) and not isnull( ppnc ) ) { |
| | | // éè¦å
è£
çæ°é |
| | | needPackagingQuantity := abs( ppcell.PackagingInventory() ).Round( 0 ); |
| | | // å
è£
å¼å§çç´¢å¼ |
| | | indexPPCell := ppcell.Previous(); |
| | | |
| | | // info( "产线个æ°ï¼", us.Size(), " å¼å§æ¶é´ï¼", ppcell.StartDate().Format( "Y-M2-D2" ), " å
è£
åºåæ°éï¼", ppcell.PackagingInventory(), " éè¦å
è£
çæ°éï¼", needPackagingQuantity, |
| | | // " å
è£
lotsizeï¼",guard( ppls.LotSize(), 0 ), " æå¤§å
è£
容éï¼", ppnc.MaximumDailyPackagingQuantity() ); |
| | | |
| | | while ( not isnull( indexPPCell ) and |
| | | indexPPCell.StartDate() >= plannedStartDate and |
| | | exists( us, Elements.UnitPeriod.astype( UnitPeriodTime ).ShiftPlan, tempSP, |
| | | tempSP.UnitPeriodTime().StartDate() = indexPPCell.StartDate(), |
| | | tempSP.Outcome() <> "" ) and |
| | | needPackagingQuantity > 0 ) { |
| | | // è½å
è£
çæ°é |
| | | canPackagingQuantity := ifexpr( ceil( needPackagingQuantity / ppls.LotSize() ) < floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ), |
| | | ceil( needPackagingQuantity / ppls.LotSize() ), |
| | | floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ) ) * ppls.LotSize(); |
| | | // info( "å¼å§å
è£
çæ¥æï¼", indexPPCell.StartDate().Format( "Y-M2-D2" ), " è½å
è£
çæ°é:", canPackagingQuantity ); |
| | | |
| | | indexPPCell.Package( canPackagingQuantity ); |
| | | Transaction::Transaction().Propagate( attribute( PackagingPlanCell, PackagingInventory ) ); |
| | | Transaction::Transaction().Propagate( attribute( PackagingPlanCell, UnpackagedInventory ) ); |
| | | |
| | | needPackagingQuantity := needPackagingQuantity - canPackagingQuantity; |
| | | indexPPCell := indexPPCell.Previous(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | PackagingPlanCell::SetUnpackage_Lotsize( macroPlan ); |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | StaticMethod SetUnpackage_Lotsize ( |
| | | MacroPlan macroPlan |
| | | ) |
| | | { |
| | | TextBody: |
| | | [* |
| | | // 计åå¼å§æ¶é´ |
| | | plannedStartDate := macroPlan.StartOfPlanning().Date(); |
| | | |
| | | // 设置æå
å¼ï¼ç¬¦ålotsizeå䏿¥æå¤§å
è£
éï¼ |
| | | traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "大è¿å·¥å" /*and ppr.ProductID() = "06K103011CM"*/ ) { |
| | | traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) { |
| | | // Product_MP |
| | | pmp := select( macroPlan, Product_MP, tempPMP, tempPMP.IsLeaf() and tempPMP.ID() = ppr.ProductID() ); |
| | | // å
è£
lotsize |
| | | ppls := select( macroPlan, PackagingPlanLotSize, tempPPLS, tempPPLS.Factory() = ppr.Factory() and |
| | | tempPPLS.ProductID() = ifexpr( exists( macroPlan, PackagingPlanLotSize, tempPPLS1, tempPPLS1.ProductID() = pmp.ID() ), |
| | | pmp.ID(), |
| | | pmp.ParentID() ) ); |
| | | // 䏿¥å
è£
容é |
| | | ppnc := select( macroPlan, PackagingPlanNewCapability, tempPPNC, tempPPNC.Factory() = ppr.Factory() and |
| | | tempPPNC.ProductID() = ifexpr( exists( macroPlan, PackagingPlanNewCapability, tempPPNC1, tempPPNC1.ProductID() = pmp.ID() ), |
| | | pmp.ID(), |
| | | pmp.ParentID() ) ); |
| | | // Unit |
| | | us := selectset( macroPlan, Unit, tempU, tempU.ID().Regex( ppr.FactoryAbbreviation() + " " + ppr.Category() ) ); |
| | | |
| | | // å½åéå
è£
åºå + ä¸ä¸å¤©çNewSupply < ä¸ä¸å¤©çåéæ± |
| | | if ( ppcell.UnpackagedInventory() < guard( ppcell.Next().NetDemand(), 0 ) and not isnull( ppls ) and not isnull( ppnc ) ) { |
| | | // éè¦å
è£
çæ°é |
| | | needPackagingQuantity := abs( ppcell.PackagingInventory() ).Round( 0 ); |
| | | // å
è£
å¼å§çç´¢å¼ |
| | | indexPPCell := ppcell.Previous(); |
| | | |
| | | // info( "产线个æ°ï¼", us.Size(), " å¼å§æ¶é´ï¼", ppcell.StartDate().Format( "Y-M2-D2" ), " å
è£
åºåæ°éï¼", ppcell.PackagingInventory(), " éè¦å
è£
çæ°éï¼", needPackagingQuantity, |
| | | // " å
è£
lotsizeï¼",guard( ppls.LotSize(), 0 ), " æå¤§å
è£
容éï¼", ppnc.MaximumDailyPackagingQuantity() ); |
| | | |
| | | while ( not isnull( indexPPCell ) and |
| | | indexPPCell.StartDate() >= plannedStartDate and |
| | | exists( us, Elements.UnitPeriod.astype( UnitPeriodTime ).ShiftPlan, tempSP, |
| | | tempSP.UnitPeriodTime().StartDate() = indexPPCell.StartDate(), |
| | | tempSP.Outcome() <> "" ) and |
| | | needPackagingQuantity > 0 ) { |
| | | // è½å
è£
çæ°é |
| | | canPackagingQuantity := ifexpr( ceil( needPackagingQuantity / ppls.LotSize() ) < floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ), |
| | | ceil( needPackagingQuantity / ppls.LotSize() ), |
| | | floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ) ) * ppls.LotSize(); |
| | | canPackagingQuantity := minvalue( canPackagingQuantity, [Number]indexPPCell.PackagingInventory() ); |
| | | // info( "å¼å§å
è£
çæ¥æï¼", indexPPCell.StartDate().Format( "Y-M2-D2" ), " è½å
è£
çæ°é:", canPackagingQuantity ); |
| | | |
| | | indexPPCell.Next().Unpacking( canPackagingQuantity ); |
| | | Transaction::Transaction().Propagate( attribute( PackagingPlanCell, PackagingInventory ) ); |
| | | Transaction::Transaction().Propagate( attribute( PackagingPlanCell, UnpackagedInventory ) ); |
| | | |
| | | needPackagingQuantity := needPackagingQuantity - canPackagingQuantity; |
| | | indexPPCell := indexPPCell.Previous(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | *] |
| | | } |