From 83ec31b01a61d9a6bc74933572991469eeea4d44 Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期一, 11 十一月 2024 19:33:19 +0800
Subject: [PATCH] 包装计划优化
---
_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesDL.qbl | 134 +-------------------------------------------
1 files changed, 3 insertions(+), 131 deletions(-)
diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesDL.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesDL.qbl
index 3e2e0e5..eb6eca2 100644
--- a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesDL.qbl
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesDL.qbl
@@ -6,141 +6,13 @@
{
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 );
*]
}
--
Gitblit v1.9.3