From 5ae534ab606e6f2ba5ea60914224d665b0447d5a Mon Sep 17 00:00:00 2001
From: Kevin Kok Khah Whey <khahwhey.kok@3ds.com>
Date: 星期二, 07 十一月 2023 22:48:31 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/TIANMA_JITUAN into dev_Kevin

---
 _Main/BL/Type_MacroPlan/Method_DoASyncMappingActualPISPIPData.qbl |   34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/_Main/BL/Type_MacroPlan/Method_DoASyncMappingActualPISPIPData.qbl b/_Main/BL/Type_MacroPlan/Method_DoASyncMappingActualPISPIPData.qbl
index f9c40e7..7140c64 100644
--- a/_Main/BL/Type_MacroPlan/Method_DoASyncMappingActualPISPIPData.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_DoASyncMappingActualPISPIPData.qbl
@@ -10,11 +10,22 @@
   TextBody:
   [*
     // renhao Aug-14-2023 (created)
-    listtodeal := selectset( globalOTDTable,
-                             Global_MappingActualProductInStockingPointInPeriod,
-                             actual,
-                             ( actual.ActualInventoryLevelEnd() > 0 ) and 
-                             ( organcodelist.Find( actual.StockingPointID().SubString( 0, 3 ) ) >= 0 ) );
+    listtodeal := construct( Global_MappingActualProductInStockingPointInPeriods, constcontent );
+    if ( businessTypes.Size() > 0 ) {
+      targetGlobal_ProductCategory := selectset( globalOTDTable, Global_ProductCategory, tempGPC, 
+                                                 exists( businessTypes, Elements, tempBTN, tempBTN = tempGPC.BusinessTypeName() ) );
+      listtodeal := selectset( targetGlobal_ProductCategory, 
+                               Elements.Global_MappingProduct_MP.Global_MAPISPIPCategory.Global_MappingActualProductInStockingPointInPeriod, 
+                               tempGMPIL, 
+                               ( tempGMPIL.ActualInventoryLevelEnd() > 0 ) and 
+                               ( organcodelist.Find( tempGMPIL.StockingPointID().SubString( 0, 3 ) ) >= 0 ) );
+    } else {  
+      listtodeal := selectset( globalOTDTable,
+                               Global_MappingActualProductInStockingPointInPeriod,
+                               actual,
+                               ( actual.ActualInventoryLevelEnd() > 0 ) and 
+                               ( organcodelist.Find( actual.StockingPointID().SubString( 0, 3 ) ) >= 0 ) );
+    }
     totalcount := listtodeal.Size();
     info( "ActualPISPIP has " + totalcount.AsQUILL() + " rows in total" );
     
@@ -24,13 +35,14 @@
       if( count - [Number](count/1000) * 1000 = 0 or count = totalcount ){
         info( "Now is dealing with the " + count.AsQUILL() + "ActualPISPIP " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
         }
-      product := select( globalOTDTable,Global_MappingProduct_MP,product,product.ID() = actual.ProductID() and product.KeyProduct() = nuclear,true);
-      if( not isnull( product)){
+      //product := select( globalOTDTable,Global_MappingProduct_MP,product,product.ID() = actual.ProductID() and product.KeyProduct() = nuclear,true);
+      //if( guard( actual.Global_MAPISPIPCategory().KeyProduct() = nuclear, false ) ){
+      if( not nuclear or (nuclear and actual.Global_MAPISPIPCategory().Critical() = nuclear) ){
       if( not isnull(businessTypes)){
       
-        for( i :=0 ;i < businessTypes.Size();i++ ){
-          businessType := businessTypes.Element( i );
-          if( product.BusinessType() = businessType and not product.IsCommon()){
+        
+          //businessType := businessTypes.Element( i );
+          if( /*product.BusinessType() = businessType and not product.IsCommon()*/ not actual.Global_MAPISPIPCategory().IsCommon() ){
             ActualProductInStockingPointInPeriod::CreateOrUpdate( this,
                                                                   actual.ProductID(),
                                                                   actual.StockingPointID(),
@@ -38,7 +50,7 @@
                                                                   actual.ActualInventoryLevelEnd(),
                                                                   actual.ManufacturedDate());
           }
-        }
+        
         
       }else{
         ActualProductInStockingPointInPeriod::CreateOrUpdate( this,

--
Gitblit v1.9.3