From 03f93088637930acbda3cd0b405114e0b00c13e4 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期一, 30 九月 2024 17:29:00 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev

---
 _Main/BL/Type_OfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl |   86 ++++++++++++++++++++++++++-----------------
 1 files changed, 52 insertions(+), 34 deletions(-)

diff --git a/_Main/BL/Type_OfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl b/_Main/BL/Type_OfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl
index 98e9f56..131d267 100644
--- a/_Main/BL/Type_OfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl
+++ b/_Main/BL/Type_OfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl
@@ -35,12 +35,13 @@
           }
           
           // 璧嬪�煎崟鍏冩牸
-          cellQuantity := opc.OfflinePlanCell( relnew, Value := [String]ns.Quantity().Round( 0 ), Shift := ns.PeriodTask_MP().UnitPeriod().astype( UnitPeriodTimeBase ).ShiftPattern().Name(), Quantity := ns.Quantity() );
-          cellQuantity.OfflinePlanRow( relset, oprQuantity );
-          cellOrder := opc.OfflinePlanCell( relnew, Value := "鍗曞彿" + [String]ns.Quantity().Round( 0 ) + "_" + [String]( ns.ProductInStockingPointInPeriodPlanningLeaf().InventoryLevelEnd() - ns.ProductInStockingPointInPeriodPlanningLeaf().MinInventoryLevel() ), 
-                                            Quantity := ns.Quantity(), 
-                                            InventoryWeight := ns.ProductInStockingPointInPeriodPlanningLeaf().InventoryLevelEnd() - ns.ProductInStockingPointInPeriodPlanningLeaf().MinInventoryLevel() );
-          cellOrder.OfflinePlanRow( relset, oprOrder );
+          cellQuantity := oprQuantity.OfflinePlanCell( relnew, Value := [String]ns.Quantity().Round( 0 ), Shift := ns.PeriodTask_MP().UnitPeriod().astype( UnitPeriodTimeBase ).ShiftPattern().Name() );
+          cellQuantity.OfflinePlanColumn( relset, opc );
+          cellOrder := oprOrder.OfflinePlanCell( relnew, 
+    //                                             Value := "鍗曞彿" + [String]ns.Quantity().Round( 0 ) + "_" + [String]( ns.ProductInStockingPointInPeriodPlanningLeaf().InventoryLevelEnd() - ns.ProductInStockingPointInPeriodPlanningLeaf().MinInventoryLevel() ),
+                                                 Value := [String]ns.Quantity().Round( 0 ),
+                                                 InventoryWeight := ns.ProductInStockingPointInPeriodPlanningLeaf().InventoryLevelEnd() - ns.ProductInStockingPointInPeriodPlanningLeaf().MinInventoryLevel() );
+          cellOrder.OfflinePlanColumn( relset, opc );
         }
       }
       
@@ -59,30 +60,30 @@
     typeOPC    := opt.OfflinePlanColumn( relnew, ColumnDate := macroPlan.StartOfPlanning().Date() - 1 );
     traverse ( opt, OfflinePlanRow, opr ) {
       if ( opr.Type() = "0" ) {
-        productLineCell := productOPC.OfflinePlanCell( relnew, Value := opr.ProductionLine() );
-        productLineCell.OfflinePlanRow( relset, opr );
+        productLineCell := opr.OfflinePlanCell( relnew, Value := opr.ProductionLine() );
+        productLineCell.OfflinePlanColumn( relset, productOPC );
       } else if( opr.Type() = "1" ) {
-        productCell := productOPC.OfflinePlanCell( relnew, Value := opr.ProductID() + ifexpr( opr.Notes() = "", "", "-" + opr.Notes() ) );
-        productCell.OfflinePlanRow( relset, opr );
-        typeCell    := typeOPC.OfflinePlanCell( relnew, Value :=  "Quantity" );
-        typeCell.OfflinePlanRow( relset, opr );
+        productCell := opr.OfflinePlanCell( relnew, Value := opr.ProductID() + ifexpr( opr.Notes() = "", "", "-" + opr.Notes() ) );
+        productCell.OfflinePlanColumn( relset, productOPC );
+        typeCell    := opr.OfflinePlanCell( relnew, Value :=  "Quantity" );
+        typeCell.OfflinePlanColumn( relset, typeOPC );
       } else if ( opr.Type() = "2" ) {
-        typeCell    := typeOPC.OfflinePlanCell( relnew, Value :=  "Order" );
-        typeCell.OfflinePlanRow( relset, opr );
+        typeCell    := opr.OfflinePlanCell( relnew, Value :=  "Order" );
+        typeCell.OfflinePlanColumn( relset, typeOPC );
       } else if ( opr.Type() = "3" ) {
-        totalCell := productOPC.OfflinePlanCell( relnew, Value := "鍚堣" );
-        totalCell.OfflinePlanRow( relset, opr );
-        totalCell := typeOPC.OfflinePlanCell( relnew, Value :=  "鎬婚噺" );
-        totalCell.OfflinePlanRow( relset, opr );
+        totalCell := opr.OfflinePlanCell( relnew, Value := "鍚堣" );
+        totalCell.OfflinePlanColumn( relset, productOPC );
+        totalCell := opr.OfflinePlanCell( relnew, Value :=  "鎬婚噺" );
+        totalCell.OfflinePlanColumn( relset, typeOPC );
       } else if ( opr.Type() = "4" ) {
-        shiftCell := typeOPC.OfflinePlanCell( relnew, Value :=  "鐝" );
-        shiftCell.OfflinePlanRow( relset, opr );
+        shiftCell := opr.OfflinePlanCell( relnew, Value :=  "鐝" );
+        shiftCell.OfflinePlanColumn( relset, typeOPC );
       } else if ( opr.Type() = "5" ) {
-        shiftStartDateCell := typeOPC.OfflinePlanCell( relnew, Value :=  "鐝寮�濮嬫椂闂�" );
-        shiftStartDateCell.OfflinePlanRow( relset, opr );
+        shiftStartDateCell := opr.OfflinePlanCell( relnew, Value :=  "鐝寮�濮嬫椂闂�" );
+        shiftStartDateCell.OfflinePlanColumn( relset, typeOPC );
       } else if ( opr.Type() = "6" ) {
-        shiftEndDateCell := typeOPC.OfflinePlanCell( relnew, Value :=  "鐝缁撴潫鏃堕棿" );
-        shiftEndDateCell.OfflinePlanRow( relset, opr );
+        shiftEndDateCell := opr.OfflinePlanCell( relnew, Value :=  "鐝缁撴潫鏃堕棿" );
+        shiftEndDateCell.OfflinePlanColumn( relset, typeOPC );
       }
     }
     
@@ -92,35 +93,39 @@
     shiftStartDateOPRs := selectset( opt, OfflinePlanRow, tempOPR, tempOPR.Type() = "5" );
     shiftEndDateOPRs   := selectset( opt, OfflinePlanRow, tempOPR, tempOPR.Type() = "6" );
     traverse ( opt, OfflinePlanColumn, opc, opc.OfflinePlanCell( relsize ) > 0 and opc.ColumnDate() >= macroPlan.StartOfPlanning().Date() ) {
+      // 琛ュ叏鎬婚噺
       traverse ( totalOPRs, Elements, totalOPR ) {
         total     := sum( opc, OfflinePlanCell, tempOPC, tempOPC.OfflinePlanRow().ProductionLine() = totalOPR.ProductionLine() and tempOPC.OfflinePlanRow().Type() = "1", [Real]tempOPC.Value() );
-        totalCell := opc.OfflinePlanCell( relnew, Value := [String]total );
-        totalCell.OfflinePlanRow( relset, totalOPR );
+        totalCell := totalOPR.OfflinePlanCell( relnew, Value := [String]total );
+        totalCell.OfflinePlanColumn( relset, opc );
       }
       
+      // &鐝
       traverse ( shiftOPRs, Elements, shiftOPR ) {
         shift := select( opc, OfflinePlanCell, tempOPC, tempOPC.OfflinePlanRow().ProductionLine() = shiftOPR.ProductionLine() and tempOPC.OfflinePlanRow().Type() = "1" ); 
         if ( not isnull( shift ) ) {
-          shiftCell := opc.OfflinePlanCell( relnew, Value := shift.Shift() );
-          shiftCell.OfflinePlanRow( relset, shiftOPR );
+          shiftCell := shiftOPR.OfflinePlanCell( relnew, Value := shift.Shift() );
+          shiftCell.OfflinePlanColumn( relset, opc );
         }
       }
       
+      // 鐝寮�濮嬫椂闂�
       traverse ( shiftStartDateOPRs, Elements, ssdOPR ) {
         shift := select( opc, OfflinePlanCell, tempOPC, tempOPC.OfflinePlanRow().ProductionLine() = ssdOPR.ProductionLine() and tempOPC.OfflinePlanRow().Type() = "1" ); 
         if ( not isnull( shift ) ) {
           startDate     := guard( minselect( macroPlan, ShiftPattern.ShiftDayTime, tempSDT, tempSDT.ShiftPattern().Name() = shift.Shift(), tempSDT.Sequence() ).StartDateTime().Format( "H:m" ), "" );
-          startDateCell := opc.OfflinePlanCell( relnew, Value := startDate );
-          startDateCell.OfflinePlanRow( relset, ssdOPR );
+          startDateCell := ssdOPR.OfflinePlanCell( relnew, Value := startDate );
+          startDateCell.OfflinePlanColumn( relset, opc );
         }
       }
       
+      // 鐝缁撴潫鏃堕棿
       traverse ( shiftEndDateOPRs, Elements, sedOPR ) {
         shift := select( opc, OfflinePlanCell, tempOPC, tempOPC.OfflinePlanRow().ProductionLine() = sedOPR.ProductionLine() and tempOPC.OfflinePlanRow().Type() = "1" ); 
         if ( not isnull( shift ) ) {
           endDate     := guard( maxselect( macroPlan, ShiftPattern.ShiftDayTime, tempSDT, tempSDT.ShiftPattern().Name() = shift.Shift(), tempSDT.Sequence() ).EndDateTIme().Format( "H:m" ), "" );
-          endDateCell := opc.OfflinePlanCell( relnew, Value := endDate );
-          endDateCell.OfflinePlanRow( relset, sedOPR );
+          endDateCell := sedOPR.OfflinePlanCell( relnew, Value := endDate );
+          endDateCell.OfflinePlanColumn( relset, opc );
         }
       }
     }
@@ -136,6 +141,18 @@
       indexDate := indexDate + 1;
     }
     
+    // 琛ュ叏绌烘牸瀛�
+    traverse ( opt, OfflinePlanRow, opr ) {
+      traverse ( opt, OfflinePlanColumn, opc ) {
+        cell := select( opr, OfflinePlanCell, tempOPC, tempOPC.OfflinePlanColumn() = opc );
+        if ( isnull( cell ) ) {
+          cell := opr.OfflinePlanCell( relnew, Value := "" );
+          cell.OfflinePlanColumn( relset, opc );
+        }
+      }
+    }
+    
+    Transaction::Transaction().Propagate( attribute( OfflinePlanCell, Quantity ) );
     Transaction::Transaction().PropagateAll();
     
     // 璁剧疆鐢熶骇椤哄簭
@@ -146,12 +163,13 @@
       nextColumn     := indexColumn.NextColumn();
       
       while ( not isnull( indexColumn.NextColumn() ) 
-    //          and indexColumn.ColumnDate() <= Date::Construct( 2024, 4, 16 ) // 娴嬭瘯瀹為檯鍦烘櫙鏃跺彲浠ヨ繃婊�
+    //          and indexColumn.ColumnDate() <= Date::Construct( 2020, 4, 1 ) // 娴嬭瘯瀹為檯鍦烘櫙鏃跺彲浠ヨ繃婊�
              ) {
         productionSerialNumber := 1;
         opcs                   := selectsortedset( indexColumn, OfflinePlanCell, tempOPC, tempOPC.FindType( "2", pl ), tempOPC.InventoryWeight() );
         initialSize            := opcs.Size();
-        if ( opcs.Size() > 0 ) {
+        info( "璁″垝寮�濮嬫椂闂达細", macroPlan.StartOfPlanning().Date().Format( "Y-M2-D2" ), "    绱㈠紩鏃堕棿锛�", indexDate.Format( "Y-M2-D2" ), "    涓暟锛�", opcs.Size() );
+        if ( opcs.Size() > 0 ) { 
           // 鍒ゅ畾1
           previousOPC := maxselect( previousColumn, OfflinePlanCell, tempOPC, tempOPC.FindType( "2", pl ), tempOPC.ProductionSerialNumber() );
           if ( isnull( previousOPC ) or indexColumn.ColumnDate() = macroPlan.StartOfPlanning().Date() ) {

--
Gitblit v1.9.3