From d6e278442ccf32b1ca1f58afc622d595842d21a3 Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期三, 30 十月 2024 11:50:03 +0800
Subject: [PATCH] 上线计划优化
---
_Main/BL/Type_NewAssemblyOnlinePlanCell/StaticMethod_PostLayingProcessing.qbl | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/_Main/BL/Type_NewAssemblyOnlinePlanCell/StaticMethod_PostLayingProcessing.qbl b/_Main/BL/Type_NewAssemblyOnlinePlanCell/StaticMethod_PostLayingProcessing.qbl
index b1f1cf1..9674eb9 100644
--- a/_Main/BL/Type_NewAssemblyOnlinePlanCell/StaticMethod_PostLayingProcessing.qbl
+++ b/_Main/BL/Type_NewAssemblyOnlinePlanCell/StaticMethod_PostLayingProcessing.qbl
@@ -5,4 +5,63 @@
)
{
Description: '閾虹嚎鍚庣画澶勭悊'
+ TextBody:
+ [*
+ // 鎵�鏈変笂绾胯鍒掍骇绾�
+ pls := selectuniquevalues( macroPlan, NewAssemblyOnlinePlanRow, tempNAOPR, true, tempNAOPR.ProductionLine() );
+
+ // 鏄惁鎵ц澶勭悊鏍囧織
+ isFlag := false;
+
+ traverse ( pls, Elements, pl, pl = "CC MoMo" ) {
+ traverse ( macroPlan, NewAssemblyOnlinePlanColumn, naopc
+ , naopc.StartDate() <= Date::Construct( 2025, 2, 15 )
+ ) {
+ // 闇�瑕佸鐞嗙殑鏁伴噺
+ targetQuantity := ifexpr( pl = "CC MoMo", guard( macroPlan.AssemblyOnlineQuantity().CCMoMo(), 0 ),
+ ifexpr( pl = "DL MoMo", guard( macroPlan.AssemblyOnlineQuantity().DLMoMo(), 0 ), guard( macroPlan.AssemblyOnlineQuantity().DLZKM(), 0 ) )
+ );
+
+ currentCells := selectset( naopc, NewAssemblyOnlinePlanCell, tempNAOPCell, tempNAOPCell.NewAssemblyOnlinePlanRow().ProductionLine() = pl and tempNAOPCell.Quantity() > 0 );
+ isFlag := ifexpr( exists( currentCells, Elements, tempNAOPCell, tempNAOPCell.LineLayingOrEmptying() = "閾虹嚎" ), true,
+ ifexpr( exists( currentCells, Elements, tempNAOPCell, tempNAOPCell.LineLayingOrEmptying() = "鎷夌┖" ), false, isFlag ) );
+ info( "鏃ユ湡锛�", naopc.StartDate().Format( "Y-M2-D2" ), " 鏄惁澶勭悊锛�", isFlag, " 褰撳墠鍗曞厓鏍兼暟閲忥細", currentCells.Size(), "----------------------------" );
+
+ // 澶勭悊閾虹嚎鍚庣殑閫昏緫
+ if ( isFlag and currentCells.Size() > 0 ) {
+ targetNAOPC := minselect( macroPlan, NewAssemblyOnlinePlanColumn, tempNAOPC,
+ exists( tempNAOPC, NewAssemblyOnlinePlanCell, tempNAOPCell, tempNAOPCell.NewAssemblyOnlinePlanRow().ProductionLine() = pl and tempNAOPCell.OrderNr() > 0, tempNAOPCell.Quantity() > 0 ) and
+ tempNAOPC.StartDate() > naopc.StartDate(), tempNAOPC.StartDate() );
+
+ if ( not isnull( targetNAOPC ) ) {
+ // info( "鏈�灏忓垪鏃堕棿锛�", targetNAOPC.StartDate().Format( "Y-M2-D2" ) );
+ targetCells := selectset( targetNAOPC, NewAssemblyOnlinePlanCell, tempNAOPCell, tempNAOPCell.NewAssemblyOnlinePlanRow().ProductionLine() = pl );
+
+ // 鐩爣鍗曞厓鏍�
+ targetCell := minselect( targetCells, Elements, tempNAOPCell, tempNAOPCell.OrderNr() > 0 and tempNAOPCell.Quantity() > 0, tempNAOPCell.OrderNr() );
+ finalQuantity := minvalue( targetQuantity, targetCell.Quantity() );
+ currentCell := select( naopc, NewAssemblyOnlinePlanCell, tempNAOPCell, tempNAOPCell.NewAssemblyOnlinePlanRow() = targetCell.NewAssemblyOnlinePlanRow() );
+
+ while ( targetQuantity > 0 and finalQuantity > 0 ) {
+ targetCell.Quantity( targetCell.Quantity() - finalQuantity );
+ currentCell.Quantity( currentCell.Quantity() + finalQuantity );
+ if ( currentCell.OrderNr() <= 0 ) {
+ orderNr := maxselect( naopc, NewAssemblyOnlinePlanCell, tempNAOPCell,
+ tempNAOPCell.NewAssemblyOnlinePlanRow().ProductionLine() = pl and tempNAOPCell.Quantity() > 0,
+ tempNAOPCell.OrderNr() ).OrderNr() + 1;
+ info( orderNr );
+ currentCell.OrderNr( orderNr );
+ currentCell.Order( "#" + orderNr.Format( "N(LPad0(2))" ) );
+ }
+
+ targetQuantity := targetQuantity - [Number]finalQuantity;
+ targetCell := minselect( targetCells, Elements, tempNAOPCell, tempNAOPCell.OrderNr() > 0 and tempNAOPCell.Quantity() > 0, tempNAOPCell.OrderNr() );
+ finalQuantity := minvalue( targetQuantity, targetCell.Quantity() );
+ currentCell := select( naopc, NewAssemblyOnlinePlanCell, tempNAOPCell, tempNAOPCell.NewAssemblyOnlinePlanRow() = targetCell.NewAssemblyOnlinePlanRow() );
+ }
+ }
+ }
+ }
+ }
+ *]
}
--
Gitblit v1.9.3