From b29049d4ed2a4216c941244b46732366e0385dec Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期五, 18 十月 2024 10:46:13 +0800
Subject: [PATCH] 包装库存优化
---
_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl | 51 +++++++++++++++++++++++++
_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl | 6 ++-
_Main/Sys/Repr/Global/PackagingPlanCell.qrp | 51 +++++++++++++++++++++++++
_Main/BL/Type_PackagingPlanCell/Attribute_NewSupply.qbl | 8 ++++
_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Component_MatrixEditor493.def | 2
5 files changed, 115 insertions(+), 3 deletions(-)
diff --git a/_Main/BL/Type_PackagingPlanCell/Attribute_NewSupply.qbl b/_Main/BL/Type_PackagingPlanCell/Attribute_NewSupply.qbl
new file mode 100644
index 0000000..4b563cc
--- /dev/null
+++ b/_Main/BL/Type_PackagingPlanCell/Attribute_NewSupply.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute NewSupply
+{
+ #keys: '3[415754.0.436130246][415754.0.436130245][415754.0.436130247]'
+ Description: '渚涘簲'
+ ValueType: Real
+}
diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl
index 2d1b73c..4e84001 100644
--- a/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl
@@ -62,15 +62,17 @@
// 澶ц繛宸ュ巶璁剧疆鍊�
if ( factory = "澶ц繛宸ュ巶" ) {
- // 鍑�闇�姹�&鍓╀綑搴撳瓨
+ // 鍑�闇�姹�&鍓╀綑搴撳瓨&渚涘簲閲�
cell.NetDemand( cell.NetDemand() + pispipl.DependentDemandAndSalesDemandQuantity() );
cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() );
+ cell.NewSupply( cell.NewSupply() + pispipl.NewSupplyQuantity() );
}
// 闀挎槬宸ュ巶璁剧疆鍊�
if ( factory = "闀挎槬宸ュ巶" ) {
- // 鍓╀綑搴撳瓨
+ // 鍓╀綑搴撳瓨&渚涘簲閲�
cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() );
+ cell.NewSupply( cell.NewSupply() + pispipl.NewSupplyQuantity() );
// 鍑�闇�姹傘�愬彧鍙栫嚎杈瑰簱銆�&鍖呰搴撳瓨&闈炲寘瑁呭簱瀛�
if ( pisp.StockingPointID().Regex( "澶栫搴�" ) ) {
diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl
index 72ed702..fab92f2 100644
--- a/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl
@@ -91,5 +91,56 @@
}
}
}
+
+ // 璁剧疆鎷嗗寘鍊硷紙绗﹀悎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();
+ }
+ }
+ }
+ }
*]
}
diff --git a/_Main/Sys/Repr/Global/PackagingPlanCell.qrp b/_Main/Sys/Repr/Global/PackagingPlanCell.qrp
new file mode 100644
index 0000000..876c5e6
--- /dev/null
+++ b/_Main/Sys/Repr/Global/PackagingPlanCell.qrp
@@ -0,0 +1,51 @@
+Quintiq file version 2.0
+#parent: #root
+TypeRepresentation PackagingPlanCell
+{
+ AttributeRepresentation EndingInventory
+ {
+ AttributeKey: '[413988.0.1393320114]'
+ Synonym: 'Inventory end'
+ }
+ AttributeRepresentation NetDemand
+ {
+ AttributeKey: '[413988.0.1393320104]'
+ Synonym: 'Demand'
+ }
+ AttributeRepresentation NewSupply
+ {
+ AttributeKey: '[415754.0.436130245]'
+ Synonym: 'New supply'
+ }
+ AttributeRepresentation Out
+ {
+ AttributeKey: '[413988.0.1393320156]'
+ Synonym: 'Transport-out'
+ }
+ AttributeRepresentation Package
+ {
+ AttributeKey: '[413988.0.1393320188]'
+ Synonym: 'Package'
+ }
+ AttributeRepresentation PackagingInventory
+ {
+ AttributeKey: '[413988.0.1393320143]'
+ Synonym: 'Packaged'
+ }
+ AttributeRepresentation TransferIn
+ {
+ AttributeKey: '[413988.0.1393320166]'
+ Synonym: 'Transport-in'
+ }
+ AttributeRepresentation UnpackagedInventory
+ {
+ AttributeKey: '[413988.0.1393320130]'
+ Synonym: 'Unpackaged'
+ }
+ AttributeRepresentation Unpacking
+ {
+ AttributeKey: '[413988.0.1393320198]'
+ Synonym: 'Unpackage'
+ }
+ RelationRepresentation AsFirst { RelationKey: '[413988.0.1425205682]' Visibility: 'Normal' }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Component_MatrixEditor493.def b/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Component_MatrixEditor493.def
index c33b1c6..6a2a171 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Component_MatrixEditor493.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Component_MatrixEditor493.def
@@ -26,7 +26,7 @@
]
Properties:
[
- Attributes: 'NetDemand;EndingInventory;UnpackagedInventory;PackagingInventory;Out;TransferIn;Package;Unpacking'
+ Attributes: 'NetDemand;NewSupply;EndingInventory;Out;TransferIn;UnpackagedInventory;PackagingInventory;Package;Unpacking'
Column: 'PackagingPlanColumn'
Row: 'PackagingPlanRow'
Taborder: 0
--
Gitblit v1.9.3