From 4981fae2e6147b7977422e377d71839a3d2769f0 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期三, 23 十月 2024 17:50:58 +0800
Subject: [PATCH] 修复一些bug,添加包装计划的存档方法
---
/dev/null | 146 -----------------------------
_Main/BL/Type_LocalTool/StaticMethod_IsOverlap.qbl | 2
_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_Archive.qbl | 113 ++++++++++++++++++++++
3 files changed, 114 insertions(+), 147 deletions(-)
diff --git a/_Main/BL/Type_ArchivePackagingPlanCell/Attribute_StartDate.qbl b/_Main/BL/Type_ArchivePackagingPlanCell/Attribute_StartDate.qbl
deleted file mode 100644
index f197b14..0000000
--- a/_Main/BL/Type_ArchivePackagingPlanCell/Attribute_StartDate.qbl
+++ /dev/null
@@ -1,7 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute StartDate
-{
- #keys: '3[414996.1.150965222][414996.1.150965221][414996.1.150965223]'
- ValueType: Date
-}
diff --git a/_Main/BL/Type_ArchivePackagingPlanCell/Function_CalcPackagingInventory.qbl b/_Main/BL/Type_ArchivePackagingPlanCell/Function_CalcPackagingInventory.qbl
deleted file mode 100644
index f799399..0000000
--- a/_Main/BL/Type_ArchivePackagingPlanCell/Function_CalcPackagingInventory.qbl
+++ /dev/null
@@ -1,19 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Function CalcPackagingInventory
-{
- TextBody:
- [*
- // lihongji Jul-26-2024 (created)
-
- value := ifexpr( this.ArchivePackagingPlanRow().Factory() = "闀挎槬宸ュ巶", this.CC_PackagingInventory(),
- this.InitialPackagingInventory() + guard( this.Previous().PackagingInventory() +
- guard( this.Package(), 0.0 ) -
- ifexpr( this.TransferIn() > 0.0, 0, this.Unpacking() ),
- 0.0 )
- - this.Out()
- );
-
- this.PackagingInventory( value );
- *]
-}
diff --git a/_Main/BL/Type_ArchivePackagingPlanCell/Function_CalcStartDate.qbl b/_Main/BL/Type_ArchivePackagingPlanCell/Function_CalcStartDate.qbl
deleted file mode 100644
index ba5011f..0000000
--- a/_Main/BL/Type_ArchivePackagingPlanCell/Function_CalcStartDate.qbl
+++ /dev/null
@@ -1,13 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Function CalcStartDate
-{
- TextBody:
- [*
- // lihongji Jul-26-2024 (created)
-
- value := guard( this.ArchivePackagingPlanColumn().StartDate(), Date::MinDate() );
-
- this.StartDate( value );
- *]
-}
diff --git a/_Main/BL/Type_ArchivePackagingPlanCell/Function_CalcUnpackagedInventory.qbl b/_Main/BL/Type_ArchivePackagingPlanCell/Function_CalcUnpackagedInventory.qbl
deleted file mode 100644
index b8c8108..0000000
--- a/_Main/BL/Type_ArchivePackagingPlanCell/Function_CalcUnpackagedInventory.qbl
+++ /dev/null
@@ -1,14 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Function CalcUnpackagedInventory
-{
- TextBody:
- [*
- // lihongji Jul-24-2024 (created)
-
- value := ifexpr( this.ArchivePackagingPlanRow().Factory() = "闀挎槬宸ュ巶", this.CC_UnpackagedInventory(),
- guard( this.EndingInventory() - this.PackagingInventory(), 0.0 ) );
-
- this.UnpackagedInventory( value );
- *]
-}
diff --git a/_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_Archive.qbl b/_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_Archive.qbl
new file mode 100644
index 0000000..995a324
--- /dev/null
+++ b/_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_Archive.qbl
@@ -0,0 +1,113 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Archive (
+ const MacroPlan macroPlan,
+ Archive archive
+)
+{
+ TextBody:
+ [*
+ // Akari Oct-23-2024 (created)
+ //packagingPlanCells := selectset( macroPlan,PackagingPlanRow.PackagingPlanCell,cell,true );
+ //packagingPlanCellIndexTree := NamedValueTree::Create();
+ //for( i := 0; i < packagingPlanCells.Size(); i++ ){
+ // packagingPlanCell := packagingPlanCells.Element( i );
+ // packagingPlanRow := packagingPlanCell.PackagingPlanRow();
+ // packagingPlanColumn := packagingPlanCell.PackagingPlanColumn();
+ //
+ // packagingPlanRowKey := packagingPlanRow.Category() + packagingPlanRow.Factory() + packagingPlanRow.ProductID() + packagingPlanRow.StockingPointID();
+ // packagingPlanColumnKey := packagingPlanColumn.StartDate().AsQUILL();
+ // packagingPlanCellKey := packagingPlanRowKey + packagingPlanColumnKey;
+ // packagingPlanCellHandle := packagingPlanCellIndexTree.GetHandle( packagingPlanCellKey );
+ //
+ // packagingPlanCellIndexTree.Root().AddChild( packagingPlanCellHandle,i );
+ //}
+
+ archivePackagingPlanCells := selectset( archive,ArchivePackagingPlanRow.ArchivePackagingPlanCell,cell,true );
+ archivePackagingPlanCellIndexTree := NamedValueTree::Create();
+ for( i := 0; i < archivePackagingPlanCells.Size(); i++ ){
+ archivePackagingPlanCell := archivePackagingPlanCells.Element( i );
+ archivePackagingPlanRow := archivePackagingPlanCell.ArchivePackagingPlanRow();
+ archivePackagingPlanColumn := archivePackagingPlanCell.ArchivePackagingPlanColumn();
+
+ archivePackagingPlanRowKey := archivePackagingPlanRow.Category() + archivePackagingPlanRow.Factory() + archivePackagingPlanRow.ProductID() + archivePackagingPlanRow.StockingPointID();
+ archivePackagingPlanColumnKey := archivePackagingPlanColumn.StartDate().AsQUILL();
+ archivePackagingPlanCellKey := archivePackagingPlanRowKey + archivePackagingPlanColumnKey;
+ archivePackagingPlanCellHandle := archivePackagingPlanCellIndexTree.GetHandle( archivePackagingPlanCellKey );
+
+ archivePackagingPlanCellIndexTree.Root().AddChild( archivePackagingPlanCellHandle,i );
+ }
+
+ archivePackagingPlanRows := selectset( archive,ArchivePackagingPlanRow,row,true );
+ archivePackagingPlanRowIndexTree := NamedValueTree::Create();
+ for( i := 0; i < archivePackagingPlanRows.Size(); i++ ){
+ archivePackagingPlanRow := archivePackagingPlanRows.Element( i );
+ archivePackagingPlanRowKey := archivePackagingPlanRow.Category() + archivePackagingPlanRow.Factory() + archivePackagingPlanRow.ProductID() + archivePackagingPlanRow.StockingPointID();
+ archivePackagingPlanRowHandle := archivePackagingPlanRowIndexTree.GetHandle( archivePackagingPlanRowKey );
+ archivePackagingPlanRowIndexTree.Root().AddChild( archivePackagingPlanRowHandle,i );
+ }
+
+ archivePackagingPlanColumns := selectset( archive,ArchivePackagingPlanColumn,row,true );
+ archivePackagingPlanColumnIndexTree := NamedValueTree::Create();
+ for( i := 0; i < archivePackagingPlanColumns.Size(); i++ ){
+ archivePackagingPlanColumn := archivePackagingPlanColumns.Element( i );
+ archivePackagingPlanColumnKey := archivePackagingPlanColumn.StartDate().AsQUILL();
+ archivePackagingPlanColumnHandle := archivePackagingPlanColumnIndexTree.GetHandle( archivePackagingPlanColumnKey );
+ archivePackagingPlanColumnIndexTree.Root().AddChild( archivePackagingPlanColumnHandle,i );
+ }
+
+ traverse( macroPlan,PackagingPlanRow.PackagingPlanCell,packagingPlanCell ){
+ packagingPlanRow := packagingPlanCell.PackagingPlanRow();
+ packagingPlanColumn := packagingPlanCell.PackagingPlanColumn();
+ packagingPlanRowKey := packagingPlanRow.Category() + packagingPlanRow.Factory() + packagingPlanRow.ProductID() + packagingPlanRow.StockingPointID();
+ packagingPlanColumnKey := packagingPlanColumn.StartDate().AsQUILL();
+ packagingPlanCellKey := packagingPlanRowKey + packagingPlanColumnKey;
+
+ archivePackagingPlanCell := null( ArchivePackagingPlanCell );
+ archivePackagingPlanCellHandle := archivePackagingPlanCellIndexTree.GetHandle( packagingPlanCellKey );
+ archivePackagingPlanCellIndex := guard( archivePackagingPlanCellIndexTree.Root().Child( archivePackagingPlanCellHandle ),null( NamedValue ) );
+ if( isnull( archivePackagingPlanCellIndex )){
+ archivePackagingPlanRow := null( ArchivePackagingPlanRow );
+ archivePackagingPlanRowHandle := archivePackagingPlanRowIndexTree.GetHandle( packagingPlanRowKey );
+ archivePackagingPlanRowIndex := guard( archivePackagingPlanRowIndexTree.Root().Child( archivePackagingPlanRowHandle ),null( NamedValue ));
+ if( isnull( archivePackagingPlanRowIndex )){
+ archivePackagingPlanRow := archive.ArchivePackagingPlanRow( relnew,Category := packagingPlanRow.Category(),Factory := packagingPlanRow.Factory(),ProductID := packagingPlanRow.ProductID(),StockingPointID := packagingPlanRow.StockingPointID() );
+ archivePackagingPlanRows.Add( archivePackagingPlanRow );
+ archivePackagingPlanRowIndexTree.Root().AddChild( archivePackagingPlanRowHandle,archivePackagingPlanRows.Size() - 1 );
+ }else{
+ archivePackagingPlanRow := archivePackagingPlanRows.Element( archivePackagingPlanRowIndex.GetValueAsNumber() );
+ }
+
+ archivePackagingPlanColumn := null( ArchivePackagingPlanColumn );
+ archivePackagingPlanColumnHandle := archivePackagingPlanColumnIndexTree.GetHandle( packagingPlanColumnKey );
+ archivePackagingPlanColumnIndex := guard( archivePackagingPlanColumnIndexTree.Root().Child( archivePackagingPlanColumnHandle ),null( NamedValue ));
+ if( isnull( archivePackagingPlanColumnIndex )){
+ archivePackagingPlanColumn := archive.ArchivePackagingPlanColumn( relnew,StartDate := packagingPlanColumn.StartDate() );
+ archivePackagingPlanColumns.Add( archivePackagingPlanColumn );
+ archivePackagingPlanColumnIndexTree.Root().AddChild( archivePackagingPlanColumnHandle,archivePackagingPlanColumns.Size() - 1 );
+ }else{
+ archivePackagingPlanColumn := archivePackagingPlanColumns.Element( archivePackagingPlanColumnIndex.GetValueAsNumber() );
+ }
+
+ archivePackagingPlanCell := archivePackagingPlanRow.ArchivePackagingPlanCell( relnew,ArchivePackagingPlanColumn := archivePackagingPlanColumn );
+ archivePackagingPlanCells.Add( archivePackagingPlanCell );
+ archivePackagingPlanCellIndexTree.Root().AddChild( archivePackagingPlanCellHandle,archivePackagingPlanCells.Size() - 1 );
+ }else{
+ archivePackagingPlanCell := archivePackagingPlanCells.Element( archivePackagingPlanCellIndex.GetValueAsNumber());
+ }
+
+ archivePackagingPlanCell.CC_PackagingInventory( packagingPlanCell.CC_PackagingInventory() );
+ archivePackagingPlanCell.CC_UnpackagedInventory( packagingPlanCell.CC_UnpackagedInventory() );
+ archivePackagingPlanCell.EndingInventory( packagingPlanCell.EndingInventory() );
+ archivePackagingPlanCell.InitialPackagingInventory( packagingPlanCell.InitialPackagingInventory() );
+ archivePackagingPlanCell.NetDemand( packagingPlanCell.NetDemand() );
+ archivePackagingPlanCell.NewSupply( packagingPlanCell.NewSupply() );
+ archivePackagingPlanCell.Out( packagingPlanCell.Out() );
+ archivePackagingPlanCell.Package( packagingPlanCell.Package() );
+ archivePackagingPlanCell.PackagingInventory( packagingPlanCell.PackagingInventory() );
+ archivePackagingPlanCell.TransferIn( packagingPlanCell.TransferIn() );
+ archivePackagingPlanCell.UnpackagedInventory( packagingPlanCell.UnpackagedInventory() );
+ archivePackagingPlanCell.Unpacking( packagingPlanCell.Unpacking() );
+ }
+ *]
+}
diff --git a/_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_CalculationPackagingPlanProperties.qbl b/_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_CalculationPackagingPlanProperties.qbl
deleted file mode 100644
index 07379b6..0000000
--- a/_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_CalculationPackagingPlanProperties.qbl
+++ /dev/null
@@ -1,11 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-StaticMethod CalculationPackagingPlanProperties
-{
- TextBody:
- [*
- Transaction::Transaction().Propagate( attribute( PackagingPlanCell, PackagingInventory ) );
- Transaction::Transaction().Propagate( attribute( PackagingPlanCell, StartDate ) );
- Transaction::Transaction().Propagate( attribute( PackagingPlanCell, UnpackagedInventory ) );
- *]
-}
diff --git a/_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_GenerateReport.qbl b/_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_GenerateReport.qbl
deleted file mode 100644
index 4e84001..0000000
--- a/_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_GenerateReport.qbl
+++ /dev/null
@@ -1,150 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-StaticMethod GenerateReport (
- MacroPlan macroPlan
-)
-{
- 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() );
- cell.NewSupply( cell.NewSupply() + pispipl.NewSupplyQuantity() );
- }
-
- // 闀挎槬宸ュ巶璁剧疆鍊�
- if ( factory = "闀挎槬宸ュ巶" ) {
- // 鍓╀綑搴撳瓨&渚涘簲閲�
- cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() );
- cell.NewSupply( cell.NewSupply() + pispipl.NewSupplyQuantity() );
-
- // 鍑�闇�姹傘�愬彧鍙栫嚎杈瑰簱銆�&鍖呰搴撳瓨&闈炲寘瑁呭簱瀛�
- 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() );
- }
- }
-
- // 璁剧疆鍓嶄竴澶╁簱瀛�
- if ( pispipl.Start().Date() = macroPlan.StartOfPlanning().Date() ) {
- prePISPIPL := pispipl.PreviousPlanningPISPIP().astype( ProductInStockingPointInPeriodPlanningLeaf ); // 鍓嶄竴涓猵ispippl
- // 鍒涘缓璁″垝鍓嶄竴澶╂牸瀛�
- 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::SetPackagingAndUnpackingValues( 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 )*/ ) {
- // // 璁剧疆鍖呰鏁伴噺
- // if ( ppc.PackagingInventory() < ppc.Out() ) { // 鍖呰搴撳瓨鏄惁灏忎簬璋冨嚭
- // prePPC := ppc.Previous();
- // needPackagingQuantity := ppc.Out() - prePPC.PackagingInventory();
- // while ( not isnull( prePPC ) and needPackagingQuantity > 0.0 ) {
- // // 鑾峰彇鍖呰lotsize
- // ppls := select( macroPlan, PackagingPlanLotSize, tempPPLS, tempPPLS.Factory() = ppc.PackagingPlanRow().Factory() and
- // tempPPLS.ProductID() = ppc.PackagingPlanRow().ProductID() );
- //
- // // 鑾峰彇鏈�澶у寘瑁呮暟閲�
- // maxPackageReflection := Reflection::FindAttribute( "PackagingPlanCapability", ppc.PackagingPlanRow().FactoryAbbreviation() + "_" + ppc.PackagingPlanRow().Category() + "_Package" );
- //// maxPackageQuantity := maxPackageReflection.GetNumber( macroPlan.PackagingPlanCapability() ); // 姝ゅ闇�瑕佷慨鏀�
- // maxPackageQuantity := 100000;
- //
- // // 鑾峰彇鏈�缁堝寘瑁呮暟閲�
- // finalPackagingQuantity := minvalue( ceil( needPackagingQuantity / ppls.LotSize() ), ceil( ( maxPackageQuantity - prePPC.Package() ) / ppls.LotSize() ) ) * ppls.LotSize();
- // needPackagingQuantity := needPackagingQuantity - finalPackagingQuantity;
- //
- // // 璁剧疆鍖呰鍊�
- // prePPC.Package( prePPC.Package() + finalPackagingQuantity );
- //
- // //debuginfo( "闇�瑕佸寘瑁呮暟閲忥細", needPackagingQuantity, " lotsize: ", ppls.LotSize(), " 鏈�澶у寘瑁呮暟閲忥細", maxPackageQuantity, " 鏈�缁堣ˉ鐨勬暟閲忥細", finalPackagingQuantity );
- // PackagingPlanCell::CalculationPackagingPlanProperties();
- //
- // prePPC := prePPC.Previous();
- // }
- // }
- //
- // // 璁剧疆鎷嗗寘鏁伴噺
- // if ( ppc.TransferIn() > 0.0 ) { // 鏈夎皟鍏ユ暟閲�
- // // 鑾峰彇鍖呰lotsize
- // ppls := select( macroPlan, PackagingPlanLotSize, tempPPLS, tempPPLS.Factory() = ppc.PackagingPlanRow().Factory() and
- // tempPPLS.ProductID() = ppc.PackagingPlanRow().ProductID() );
- //
- // // 璁剧疆鎷嗗寘鍊�
- // ppc.Unpacking( ppc.TransferIn() );
- // }
- // }
- //}
- *]
-}
diff --git a/_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_Package.qbl b/_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_Package.qbl
deleted file mode 100644
index 7e0d597..0000000
--- a/_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_Package.qbl
+++ /dev/null
@@ -1,61 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-StaticMethod Package (
- MacroPlan macroPlan,
- PackagingPlanRow ppr,
- PackagingPlanColumn ppc,
- output Number needPackagingQuantity
-)
-{
- TextBody:
- [*
- // 璁″垝寮�濮嬫椂闂�
- plannedStartDate := macroPlan.StartOfPlanning().Date();
-
- traverse ( ppr, PackagingPlanCell, ppcell, ppcell.PackagingPlanColumn() = ppc ) {
- // 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 ( not isnull( ppls ) and not isnull( ppnc ) ) {
- // 鍖呰寮�濮嬬殑绱㈠紩
- 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/BL/Type_ArchivePackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl b/_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl
deleted file mode 100644
index fab92f2..0000000
--- a/_Main/BL/Type_ArchivePackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl
+++ /dev/null
@@ -1,146 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-StaticMethod SetPackagingAndUnpackingValues (
- 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();
- }
- }
- }
- }
-
- // 璁剧疆鍖呰鍊硷紙绗﹀悎澶х被涓嬫墍鏈変骇鍝侀潪鍖呰閲忓簱瀛樺姞鍜屼笉鑳藉ぇ浜庣郴缁熷�硷級
- 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 );
- }
- }
- }
- }
- }
-
- // 璁剧疆鎷嗗寘鍊硷紙绗﹀悎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/BL/Type_LocalTool/StaticMethod_IsOverlap.qbl b/_Main/BL/Type_LocalTool/StaticMethod_IsOverlap.qbl
index f73846d..5cee6d1 100644
--- a/_Main/BL/Type_LocalTool/StaticMethod_IsOverlap.qbl
+++ b/_Main/BL/Type_LocalTool/StaticMethod_IsOverlap.qbl
@@ -10,6 +10,6 @@
TextBody:
[*
// rislai Jun-14-2024 (created)
- return start1 <= start2 and end1 >= end2 ;
+ return start1 <= start2 and end1 + 1 >= end2 ;
*]
}
--
Gitblit v1.9.3