From 0382a81753b0b1ee1dfbc9cab7f529703fa643cf Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 31 十月 2024 12:00:42 +0800
Subject: [PATCH] SAP装配上线计划接口处理

---
 _Main/BL/Type_OfflinePlanArchiveVersion/StaticMethod_RefreshData.qbl |   39 ++++++++++++++++++++++++++++-----------
 1 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/_Main/BL/Type_OfflinePlanArchiveVersion/StaticMethod_RefreshData.qbl b/_Main/BL/Type_OfflinePlanArchiveVersion/StaticMethod_RefreshData.qbl
index 9b9f152..63b0a65 100644
--- a/_Main/BL/Type_OfflinePlanArchiveVersion/StaticMethod_RefreshData.qbl
+++ b/_Main/BL/Type_OfflinePlanArchiveVersion/StaticMethod_RefreshData.qbl
@@ -2,7 +2,8 @@
 #parent: #root
 StaticMethod RefreshData (
   InterfaceDataset interface,
-  const MacroPlan macroPlan
+  const MacroPlan macroPlan,
+  const Archive archive
 )
 {
   TextBody:
@@ -21,19 +22,35 @@
     }
     nopcolumns             := selectuniquevalues(  macroPlan, NewOfflinePlanTable.NewOfflinePlanColumn, nopcolumn, not exists( table, Column, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.StartDate() = nopcolumn.StartDate() ), nopcolumn.StartDate() );
     table.GenerateColumn( nopcolumns, search.TimeUnit(), search.StartDate(), search.EndDate() );
-    traverse( macroPlan, NewOfflinePlanTable, noptable ){
-      
-      traverse( noptable, NewOfflinePlanRow, noprow ){
-        row                  := table.GetRow( noprow );
-        traverse( noprow, NewOfflinePlanCell, nopcell ){
-          column             := selectobject( table, Column, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.StartDate() = nopcell.NewOfflinePlanColumn().StartDate() );
-          cell               := selectobject( row, Cell, cell, cell.Column() = column );
-          cell.InventoryWeight( nopcell.InventoryWeight() );
+    noptable               := maxobject( macroPlan, NewOfflinePlanTable, noptable, noptable.SaveDateTime() );
+    actproductiondatas     := selectset( archive,ActualDailyProductionData,data,true );
+    actproductiontree      := NamedValueTree::Create();
+    for( i := 0; i< actproductiondatas.Size(); i++ ){
+      actproduction        := actproductiondatas.Element( i );
+      actproductionKey     := actproduction.ProductNo() + actproduction.ProductionDate().AsQUILL();
+      actproductionhandle  := actproductiontree.GetHandle( actproductionKey );
+      actproductiontree.Root().AddChild( actproductionhandle,i ); 
+    }
+    traverse( noptable, NewOfflinePlanRow, noprow ){
+      row                  := table.GetRow( noprow );
+      traverse( noprow, NewOfflinePlanCell, nopcell ){
+        column             := selectobject( table, Column, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.StartDate() = nopcell.NewOfflinePlanColumn().StartDate() );
+        cell               := selectobject( row, Cell, cell, cell.Column() = column );
+        actproductionKey   := noprow.ProductID() + column.StartDate().AsQUILL();
+        actproductionhandle:= actproductiontree.GetHandle( actproductionKey );
+        actproductionindex := guard( actproductiontree.Root().Child( actproductionhandle ),null( NamedValue ));
+        
+        actproductionqty       := 0.0;
+        if( not isnull( actproductionindex )){
+          actproduction        := actproductiondatas.Element( actproductionindex.GetValueAsNumber() );
+          actproductionqty     := actproduction.ActualOut();
+        }
+        cell.ActualProductionQty( actproductionqty );
+        cell.InventoryWeight( nopcell.InventoryWeight() );
     //      cell.ProductionSerialNumber( nopcell.ProductionSerialNumber() );
-          cell.Quantity( nopcell.Quantity() );
+        cell.Quantity( nopcell.Quantity() );
     //      cell.Shift( nopcell.Shift() );
     //      cell.Value( nopcell.Value() );
-        }
       }
     }
     //showtable.Generate( search, products );

--
Gitblit v1.9.3