From 5ad37285137cfcf072c0e7b38dd4fb562bc83f5c Mon Sep 17 00:00:00 2001
From: lihongji <3117313295@qq.com>
Date: 星期四, 12 十二月 2024 17:49:13 +0800
Subject: [PATCH] 包装计划优化
---
_Main/BL/Type_PackagingPlanCell/StaticMethod_SetInitialPackagingInventory.qbl | 2 +-
_Main/BL/Type_PackagingPlanCell/Function_CalcPackagingInventory.qbl | 4 ++--
_Main/BL/Type_PackagingPlanCell/StaticMethod_CreateData.qbl | 8 ++++----
_Main/BL/Type_PackagingPlanCell/StaticMethod_SetUnpackage_Lotsize.qbl | 38 +++++++++++++++++++++++++-------------
4 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/_Main/BL/Type_PackagingPlanCell/Function_CalcPackagingInventory.qbl b/_Main/BL/Type_PackagingPlanCell/Function_CalcPackagingInventory.qbl
index c4e2762..9f02a64 100644
--- a/_Main/BL/Type_PackagingPlanCell/Function_CalcPackagingInventory.qbl
+++ b/_Main/BL/Type_PackagingPlanCell/Function_CalcPackagingInventory.qbl
@@ -10,11 +10,11 @@
this.InitialPackagingInventory() + guard( this.Previous().PackagingInventory() +
this.TransferIn() +
guard( this.Package(), 0.0 ) -
- ifexpr( this.TransferIn() > 0.0, 0, this.Unpacking() ),
+ guard( this.Unpacking(), 0.0 ),
0.0 )
- this.Out()
);
- this.PackagingInventory( value );
+ this.PackagingInventory( [Number]value );
*]
}
diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_CreateData.qbl
index 7f720f8..3d2de5e 100644
--- a/_Main/BL/Type_PackagingPlanCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_CreateData.qbl
@@ -65,13 +65,13 @@
if ( factory = "澶ц繛宸ュ巶" ) {
// 鍑�闇�姹�&鍓╀綑搴撳瓨&渚涘簲閲�
cell.NetDemand( cell.NetDemand() + pispipl.DependentDemandAndSalesDemandQuantity() );
- cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() );
+ cell.EndingInventory( [Number] ( cell.EndingInventory() + pispipl.InventoryLevelEnd() ) );
}
// 闀挎槬宸ュ巶璁剧疆鍊�
if ( factory = "闀挎槬宸ュ巶" ) {
// 鍓╀綑搴撳瓨&渚涘簲閲�
- cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() );
+ cell.EndingInventory( [Number] ( cell.EndingInventory() + pispipl.InventoryLevelEnd() ) );
// 鍑�闇�姹傘�愬彧鍙栫嚎杈瑰簱銆�&鍖呰搴撳瓨&闈炲寘瑁呭簱瀛�
if ( pisp.StockingPointID().Regex( "澶栫搴�" ) ) {
@@ -94,10 +94,10 @@
preCell := select( ppr, PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn() = planPre );
if ( isnull( preCell ) ) {
preCell := ppr.PackagingPlanCell( relnew );
- preCell.EndingInventory( prePISPIPL.InventoryLevelEnd() );
+ preCell.EndingInventory( [Number]prePISPIPL.InventoryLevelEnd() );
preCell.PackagingPlanColumn( relset, planPre );
} else {
- preCell.EndingInventory( preCell.EndingInventory() + prePISPIPL.InventoryLevelEnd() );
+ preCell.EndingInventory( [Number] ( preCell.EndingInventory() + prePISPIPL.InventoryLevelEnd() ) );
}
}
}
diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetInitialPackagingInventory.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetInitialPackagingInventory.qbl
index c7b0782..2f61481 100644
--- a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetInitialPackagingInventory.qbl
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetInitialPackagingInventory.qbl
@@ -17,7 +17,7 @@
tempPPCell.PackagingPlanRow().ProductID() = iidd.PartNumber() and
tempPPCell.PackagingPlanColumn().StartDate() = ( macroPlan.StartOfPlanning().Date() - 1 ) and
tempPPCell.PackagingPlanRow().Factory() = factory );
- ppcell.PackagingInventory( iidd.Quantity() );
+ ppcell.InitialPackagingInventory( iidd.Quantity() );
}
}
*]
diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetUnpackage_Lotsize.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetUnpackage_Lotsize.qbl
index 128015d..86de67a 100644
--- a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetUnpackage_Lotsize.qbl
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetUnpackage_Lotsize.qbl
@@ -10,8 +10,12 @@
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 )*/ ) {
+ traverse ( macroPlan, PackagingPlanRow, ppr
+ // , ppr.Factory() = "澶ц繛宸ュ巶" and ppr.ProductID() = "06K103011CM"
+ ) {
+ traverse ( ppr, PackagingPlanCell, ppcell
+ // , ppcell.StartDate() <= Date::Construct( 2025, 1, 8 )
+ ) {
// Product_MP
pmp := select( macroPlan, Product_MP, tempPMP, tempPMP.IsLeaf() and tempPMP.ID() = ppr.ProductID() );
// 鍖呰lotsize
@@ -27,12 +31,12 @@
// 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 ) ) {
+ // 闈炲寘瑁呭簱瀛樺嚭鐜拌礋鍊硷紝闇�瑕佽缃媶鍖呴噺
+ if ( ppcell.UnpackagedInventory() < 0 and not isnull( ppls ) and not isnull( ppnc ) ) {
// 闇�瑕佸寘瑁呯殑鏁伴噺
- needPackagingQuantity := abs( ppcell.PackagingInventory() ).Round( 0 );
- // 鍖呰寮�濮嬬殑绱㈠紩
- indexPPCell := ppcell.Previous();
+ needPackagingQuantity := abs( ppcell.UnpackagedInventory() ).Round( 0 );
+ // 鎷嗗寘寮�濮嬬殑绱㈠紩
+ indexPPCell := ppcell;
// info( "浜х嚎涓暟锛�", us.Size(), " 寮�濮嬫椂闂达細", ppcell.StartDate().Format( "Y-M2-D2" ), " 鍖呰搴撳瓨鏁伴噺锛�", ppcell.PackagingInventory(), " 闇�瑕佸寘瑁呯殑鏁伴噺锛�", needPackagingQuantity,
// " 鍖呰lotsize锛�",guard( ppls.LotSize(), 0 ), " 鏈�澶у寘瑁呭閲忥細", ppnc.MaximumDailyPackagingQuantity() );
@@ -44,13 +48,21 @@
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 );
+ canPackagingQuantity := [Number]ifexpr( ceil( needPackagingQuantity / ppls.LotSize() ) < floor( ppnc.MaximumDailyUnpackingQuantity() / ppls.LotSize() ), // 鏈�澶у寘瑁呴噺
+ ceil( needPackagingQuantity / ppls.LotSize() ),
+ floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ) ) * ppls.LotSize();
+ // 鏀圭被涓嬪叾浠栦骇鍝佸寘瑁呮�诲拰
+ categoryPackageQuantity := sum( indexPPCell, PackagingPlanColumn.PackagingPlanCell, tempPPCell,
+ tempPPCell <> indexPPCell and
+ tempPPCell.PackagingPlanRow().Factory() = indexPPCell.PackagingPlanRow().Factory() and
+ tempPPCell.PackagingPlanRow().Category() = indexPPCell.PackagingPlanRow().Category(),
+ tempPPCell.Unpacking() );
+ canPackagingQuantity := minvalue( [Number] ( ppnc.MaximumDailyPackagingQuantity() - categoryPackageQuantity ),
+ canPackagingQuantity,
+ ifexpr( floor( indexPPCell.PackagingInventory() / ppls.LotSize() ) * ppls.LotSize() > 0, floor( indexPPCell.PackagingInventory() / ppls.LotSize() ) * ppls.LotSize(), 0 ) );
+ // info( "寮�濮嬪寘瑁呯殑鏃ユ湡锛�", indexPPCell.StartDate().Format( "Y-M2-D2" ), " 鑳藉寘瑁呯殑鏁伴噺:", canPackagingQuantity, " 鍘熸媶鍖呭�硷細", indexPPCell.Unpacking() );
- indexPPCell.Next().Unpacking( canPackagingQuantity );
+ indexPPCell.Unpacking( ifexpr( indexPPCell.Unpacking() > 0.0 and canPackagingQuantity = 0, indexPPCell.Unpacking(), canPackagingQuantity ) );
Transaction::Transaction().Propagate( attribute( PackagingPlanCell, PackagingInventory ) );
Transaction::Transaction().Propagate( attribute( PackagingPlanCell, UnpackagedInventory ) );
--
Gitblit v1.9.3