From 02f93820496e0c14de3b9f8f9b5ef1435d342ddc Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期二, 15 十月 2024 18:52:45 +0800
Subject: [PATCH] 上线计划优化

---
 _Main/BL/Type_NewAssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl |   88 ++++++++++++++++++++++----------------------
 1 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/_Main/BL/Type_NewAssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl b/_Main/BL/Type_NewAssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl
index a8a7fcc..fad645a 100644
--- a/_Main/BL/Type_NewAssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl
+++ b/_Main/BL/Type_NewAssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl
@@ -54,51 +54,51 @@
     }
     
     // 澶勭悊鏃ュ巻浜嬩欢
-    //pls := selectuniquevalues( macroPlan, AssemblyOnlinePlanRow, tempAOPR, true, tempAOPR.ProductionLine() );
-    //traverse ( pls, Elements, pl ) {
-    //  targetQuantity := ifexpr( pl = "CC MoMo", guard( macroPlan.AssemblyOnlineQuantity().CCMoMo(), 0 ),
-    //                            ifexpr( pl = "DL MoMo", guard( macroPlan.AssemblyOnlineQuantity().DLMoMo(), 0 ), guard( macroPlan.AssemblyOnlineQuantity().DLZKM(), 0 ) )
-    //                           );
-    //  
-    //  u           := select( macroPlan, Unit, tempU, tempU.ID() = pl );
-    //  drainPs     := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "鎷夌┖" ), false ) );
-    //  lineLyingPs := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "閾虹嚎" ), false ) );
-    //  
-    //  // 澶勭悊鎺掔┖
+    pls := selectuniquevalues( macroPlan, NewAssemblyOnlinePlanRow, tempNAOPR, true, tempNAOPR.ProductionLine() );
+    traverse ( pls, Elements, pl ) {
+      targetQuantity := ifexpr( pl = "CC MoMo", guard( macroPlan.AssemblyOnlineQuantity().CCMoMo(), 0 ),
+                                ifexpr( pl = "DL MoMo", guard( macroPlan.AssemblyOnlineQuantity().DLMoMo(), 0 ), guard( macroPlan.AssemblyOnlineQuantity().DLZKM(), 0 ) )
+                               );
+      
+      u           := select( macroPlan, Unit, tempU, tempU.ID() = pl );
+      drainPs     := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "鎷夌┖" ), false ) );
+      lineLyingPs := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "閾虹嚎" ), false ) );
+      
+      // 澶勭悊鎷夌┖
     //  info( "褰撳墠浜х嚎锛�", pl, "    澶勭悊鎷夌┖--------------------------" );
-    //  traverse ( drainPs, Elements, p ) {
-    //    traverse ( p, ExplicitTimeInterval, eti ) {
+      traverse ( drainPs, Elements, p ) {
+        traverse ( p, ExplicitTimeInterval, eti ) {
     //      info( "寮�濮嬫椂闂达細", eti.Start().Format( "Y-M2-D2" ), "    缁撴潫鏃堕棿锛�", eti.End().Format( "Y-M2-D2" ) );
-    //      // 鍓嶄竴澶╂棩鍘�
-    //      aopc := select( macroPlan, AssemblyOnlinePlanColumn, tempAOPC, tempAOPC.ColumnDate() = ( eti.Start().Date() - 1 ) );
-    //      info( "闇�瑕佹媺绌虹殑涓婄嚎璁″垝鏃堕棿锛�", aopc.ColumnDate().Format( "Y-M2-D2" ) );
-    //      aoprs := selectset( macroPlan, AssemblyOnlinePlanRow, tempAOPR, tempAOPR.ProductionLine() = pl and tempAOPR.Type() = "2" and
-    //                          exists( tempAOPR, AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc and tempAOPC.Value() <> "" ) );
-    //      aopr  := maxselect( aoprs, Elements.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc,
-    //                          [Number]tempAOPC.Value().ReplaceAll( "#0", "" ) );
-    //      cell  := select( macroPlan, AssemblyOnlinePlanRow.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanRow().ProductionLine() = pl and tempAOPC.AssemblyOnlinePlanColumn() = aopc and
-    //                       tempAOPC.AssemblyOnlinePlanRow().Type() = "1" and tempAOPC.AssemblyOnlinePlanRow().ProductID() = aopr.AssemblyOnlinePlanRow().ProductID() ); 
-    //      
-    //      cell.Value( [String] ( [Number]cell.Value() - targetQuantity ) );
-    //    }
-    //  }
-    //  
-    //  info( "褰撳墠浜х嚎锛�", pl, "    澶勭悊閾虹嚎--------------------------" );
-    //  // 澶勭悊閾虹嚎
-    //  traverse ( lineLyingPs, Elements, p ) {
-    //    traverse ( p, ExplicitTimeInterval, eti ) {
-    //      info( "寮�濮嬫椂闂达細", eti.Start().Format( "Y-M2-D2" ), "    缁撴潫鏃堕棿锛�", eti.End().Format( "Y-M2-D2" ) );
-    //      info( "闇�瑕侀摵绾跨殑涓婄嚎璁″垝鏃堕棿锛�", eti.Start().Format( "Y-M2-D2" ) );
-    //      aopc  := select( macroPlan, AssemblyOnlinePlanColumn, tempAOPC, tempAOPC.ColumnDate() = eti.Start().Date() );
-    //      aoprs := selectset( macroPlan, AssemblyOnlinePlanRow, tempAOPR, tempAOPR.ProductionLine() = pl and tempAOPR.Type() = "2" and
-    //                          exists( tempAOPR, AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc and tempAOPC.Value() <> "" ) );
-    //      aopr  := minselect( aoprs, Elements.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc,
-    //                          [Number]tempAOPC.Value().ReplaceAll( "#0", "" ) );
-    //      cell  := select( macroPlan, AssemblyOnlinePlanRow.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanRow().ProductionLine() = pl and tempAOPC.AssemblyOnlinePlanColumn() = aopc and
-    //                       tempAOPC.AssemblyOnlinePlanRow().Type() = "1" and tempAOPC.AssemblyOnlinePlanRow().ProductID() = aopr.AssemblyOnlinePlanRow().ProductID() );
-    //      cell.Value( [String] ( [Number]cell.Value() + targetQuantity ) );
-    //    }
-    //  }
-    //}
+          
+          cell  := maxselect( macroPlan, NewAssemblyOnlinePlanRow.NewAssemblyOnlinePlanCell, tempNAOPCell, 
+                              tempNAOPCell.NewAssemblyOnlinePlanRow().ProductionLine() = pl                         and 
+                              tempNAOPCell.NewAssemblyOnlinePlanColumn().StartDate()   = ( eti.Start().Date() - 1 ) and
+                              tempNAOPCell.NewAssemblyOnlinePlanRow().Type()           = "1",
+                              tempNAOPCell.OrderNr() ); 
+          
+          if ( not isnull( cell ) ) {
+            cell.Quantity( cell.Quantity() - targetQuantity );
+          }
+        }
+      }
+      
+      info( "褰撳墠浜х嚎锛�", pl, "    澶勭悊閾虹嚎--------------------------" );
+      // 澶勭悊閾虹嚎
+      traverse ( lineLyingPs, Elements, p ) {
+        traverse ( p, ExplicitTimeInterval, eti ) {
+          info( "寮�濮嬫椂闂达細", eti.Start().Format( "Y-M2-D2" ), "    缁撴潫鏃堕棿锛�", eti.End().Format( "Y-M2-D2" ) );
+          
+          cell  := minselect( macroPlan, NewAssemblyOnlinePlanRow.NewAssemblyOnlinePlanCell, tempNAOPCell, 
+                              tempNAOPCell.NewAssemblyOnlinePlanRow().ProductionLine() = pl                 and 
+                              tempNAOPCell.NewAssemblyOnlinePlanColumn().StartDate()   = eti.Start().Date() and
+                              tempNAOPCell.NewAssemblyOnlinePlanRow().Type()           = "1"                and
+                              tempNAOPCell.OrderNr()                                   > 0,
+                              tempNAOPCell.OrderNr() );
+          if ( not isnull( cell ) ) {
+            cell.Quantity( cell.Quantity() + targetQuantity );
+          }
+        }
+      }
+    }
   *]
 }

--
Gitblit v1.9.3