From 48c5146921dac0f2346804ac5a913c0e63659632 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期一, 04 十一月 2024 16:00:59 +0800
Subject: [PATCH] 下线计划字段显示

---
 _Main/BL/Type_AOnlineAndMOfflinePlanPIR/StaticMethod_GenerateData.qbl |   31 +++++++++++++++----------------
 1 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/_Main/BL/Type_AOnlineAndMOfflinePlanPIR/StaticMethod_GenerateData.qbl b/_Main/BL/Type_AOnlineAndMOfflinePlanPIR/StaticMethod_GenerateData.qbl
index bad399c..f07250e 100644
--- a/_Main/BL/Type_AOnlineAndMOfflinePlanPIR/StaticMethod_GenerateData.qbl
+++ b/_Main/BL/Type_AOnlineAndMOfflinePlanPIR/StaticMethod_GenerateData.qbl
@@ -38,45 +38,44 @@
     loginfo.AOnlineAndMOfflinePlanPIR( relinsert, pir );
     traverse( owner, AssemblyOnlinePlanVersion, verison, not verison.IsShow() ){
       traverse( verison, Column, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.StartDate() >= startdate and column.StartDate() <= enddate ){
-        traverse( column, Cell, cell, ( werk = 'All' or cell.Row().ProductionLine().FindString( werk, 0 ) > -1 )
-                  and cell.Row().Type() = '1' ){
-          quantityrow        := cell.Row();
+        traverse( column, Cell, cell, ( werk = 'All' or cell.Row().Unit().FindString( werk, 0 ) > -1 ) ){
+          quantityrow      := cell.Row();
+          rowwerk          := ifexpr( quantityrow.ProductionLine().FindString( "CC", 0 ) > -1, AOnlineAndMOfflinePlanPIR::GetWerk( FinancialProductionReport::GetDefaultCCUnit() ), AOnlineAndMOfflinePlanPIR::GetWerk( FinancialProductionReport::GetDefaultDLUnit() ) );
           if( not exists( productids, Elements, e, e = quantityrow.ProductID() ) ){
             productids.Add( quantityrow.ProductID() );
           }
       
-          pir.PIRData( relnew, Product           := quantityrow.ProductID()
-                       , PlanningDate            := column.StartDate()
-                       , PlanningQty             := [Number]cell.Value());
+          pir.PIRData( relnew, Product := quantityrow.ProductID(), PlanningDate := column.StartDate(), PlanningQty := [Number]cell.Value(), Werk := rowwerk );
         }
       }
     }
     
     traverse( owner, OfflinePlanArchiveVersion, table ){
       traverse( table, Column, column, column.StartDate() >= startdate and column.StartDate() <= enddate ){
-        traverse( column, Cell, cell, ( werk = 'All' or cell.Row().ProductionLine().FindString( werk, 0 ) > -1 )
-                  and ( cell.Row().ProductionLine() <> 'DL_MOMO' or cell.Row().ProductionLine() <> 'CC_MOMO' )
-                  and cell.Row().Type() = '1' ){
+        traverse( column, Cell, cell, ( werk = 'All' or cell.Row().Unit().FindString( werk, 0 ) > -1 )
+                  and ( cell.Row().ProductionLine() <> 'DL_MOMO' or cell.Row().ProductionLine() <> 'CC_MOMO' ) ){
           row              := cell.Row();
+          rowwerk          := ifexpr( row.ProductionLine().FindString( "CC", 0 ) > -1, AOnlineAndMOfflinePlanPIR::GetWerk( FinancialProductionReport::GetDefaultCCUnit() ), AOnlineAndMOfflinePlanPIR::GetWerk( FinancialProductionReport::GetDefaultDLUnit() ) );
           if( not exists( productids, Elements, e, e = row.ProductID() ) ){
             productids.Add( row.ProductID() );
           }
           pirdata          := selectobject(  pir, PIRData, pirdata, pirdata.Product() = row.ProductID() and pirdata.PlanningDate() = column.StartDate() );
           if( isnull( pirdata ) ){
-            pirdata          := pir.PIRData( relnew, Product           := row.ProductID()
-                                             , PlanningDate            := column.StartDate()
-                                             , PlanningQty             := 0 );
+            pirdata        := pir.PIRData( relnew, Product := row.ProductID(), PlanningDate := column.StartDate(), PlanningQty := 0, Werk := rowwerk );
           }
           pirdata.PlanningQty( pirdata.PlanningQty() + [Number]cell.Value() );
         }
       }
     }
     traverse( productids, Elements, e ){
-      for( date := startdate.StartOfWeek(); date <= enddate; date := ( date + Duration::Days( 1 ) ).Date() ){
+      for( date        := startdate.StartOfWeek(); date <= enddate; date := ( date + Duration::Days( 1 ) ).Date() ){
         if( not exists( pir, PIRData, pirdata, pirdata.Product() = e and pirdata.PlanningDate() = date ) ){
-          pir.PIRData( relnew, Product         := e
-                     , PlanningDate            := date
-                     , PlanningQty             := 0 );
+          if( werk = 'All' ){
+            pir.PIRData( relnew, Product := e, PlanningDate := date, PlanningQty := 0, Werk := '8200' );
+            pir.PIRData( relnew, Product := e, PlanningDate := date, PlanningQty := 0, Werk := '8201' );
+          }else{
+            pir.PIRData( relnew, Product := e, PlanningDate := date, PlanningQty := 0, Werk := pir.Werk() );
+          }
         }
       }
     }

--
Gitblit v1.9.3