From efb7b5c7ee8424268f48a168e7f5b869030d3a9b Mon Sep 17 00:00:00 2001
From: yanyuan <yuan.yan@capgemini.com>
Date: 星期三, 06 九月 2023 14:55:22 +0800
Subject: [PATCH] Merge branch 'dev_yy' into dev

---
 _Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl |   53 +++++++++++++++++++++++++++--------------------------
 _Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl   |    2 +-
 2 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl
index d4b8493..5d38e39 100644
--- a/_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl
@@ -9,7 +9,7 @@
   [*
     // renhao Aug-14-2023 (created)
     date := Date :: Today();
-    listtodeal := selectset( this,MappingActualPISPIP,actual,true );
+    listtodeal := selectset( this,MappingActualPISPIP,actual,not isnull( Product_MP::FindById( this, actual.ProductID() ) ) );
     totalcount := listtodeal.Size();
     info( "ActualPISPIP has " + totalcount.AsQUILL() + " rows in total" );
     
diff --git a/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
index c30b6bc..7072e59 100644
--- a/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
@@ -9,7 +9,8 @@
   [*
     // renhao Aug-14-2023 (created)
     
-    listtodeal := selectset( this,MappingExternalSupply,externalSupply, not isnull( StockingPoint_MP::FindById( this, externalSupply.StockingPointID() ) ) );
+    listtodeal := selectset( this,MappingExternalSupply,externalSupply, 
+                             not isnull( StockingPoint_MP::FindById( this, externalSupply.StockingPointID() ) ) and not isnull( Product_MP::FindById( this, externalSupply.ProductID() ) ) );
     totalcount := listtodeal.Size();
     info( "ExternalSupply has " + totalcount.AsQUILL() + " rows in total" );
     
@@ -19,32 +20,32 @@
       if( count - [Number](count/100) * 100 = 0 or count = totalcount ){
         info( "Now is dealing with the " + count.AsQUILL() + "ExternalSupply " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
         }
-    //  product := select( this,MappingProduct,product,product.ID() = externalSupply.ProductID() and product.KeyProduct() = nuclear,true);
-    //  
-    //  if( not isnull( product)){
-    //    productMP :=  select( this,Product_MP,productMP,productMP.ID() = externalSupply.ProductID() ,true);
-    //    stockingpoint := select( this,StockingPoint_MP,st,st.ID() = externalSupply.StockingPointID(),true);
-    //    if( not isnull(businessTypes)){
-    //    
-    //      for( i :=0 ;i < businessTypes.Size();i++ ){
-    //        businessType := businessTypes.Element( i);
-    //        if( product.BusinessType() = businessType and not product.IsCommon()){
-    //          InventorySupply::Create(externalSupply.ID(),productMP,stockingpoint,externalSupply.Date(),externalSupply.ManufacturedDate(),externalSupply.UserQuantity(),"鍦ㄩ�斿湪鍒�",true);
-    //        }
-    //      }
-    //      
-    //    }else{
-      productMP :=  Product_MP::FindById( this, externalSupply.ProductID() );
-      stockingpoint := StockingPoint_MP::FindById( this, externalSupply.StockingPointID() );
-      if( not isnull( stockingpoint) and not isnull( productMP)){
-        InventorySupply::Create(externalSupply.ID(),productMP,stockingpoint,externalSupply.Date(),externalSupply.ManufacturedDate(),externalSupply.UserQuantity(),"鍦ㄩ�斿湪鍒�",true);
-      }
+      product := select( this,MappingProduct,product,product.ID() = externalSupply.ProductID() and product.KeyProduct() = nuclear,true);
       
-    //    }
-    //    
-    //  }else{
-    //    info( "Invaild product" );
-    //    }
+      if( not isnull( product)){
+        productMP :=  select( this,Product_MP,productMP,productMP.ID() = externalSupply.ProductID() ,true);
+        stockingpoint := select( this,StockingPoint_MP,st,st.ID() = externalSupply.StockingPointID(),true);
+        if( not isnull(businessTypes)){
+        
+          for( i :=0 ;i < businessTypes.Size();i++ ){
+            businessType := businessTypes.Element( i);
+            if( product.BusinessType() = businessType and not product.IsCommon()){
+              InventorySupply::Create(externalSupply.ID(),productMP,stockingpoint,externalSupply.Date(),externalSupply.ManufacturedDate(),externalSupply.UserQuantity(),"鍦ㄩ�斿湪鍒�",true);
+            }
+          }
+          
+        }else{
+    //    productMP :=  Product_MP::FindById( this, externalSupply.ProductID() );
+    //    stockingpoint := StockingPoint_MP::FindById( this, externalSupply.StockingPointID() );
+        if( not isnull( stockingpoint) and not isnull( productMP)){
+          InventorySupply::Create(externalSupply.ID(),productMP,stockingpoint,externalSupply.Date(),externalSupply.ManufacturedDate(),externalSupply.UserQuantity(),"鍦ㄩ�斿湪鍒�",true);
+        }
+      
+        }
+        
+      }else{
+        info( "Invaild product" );
+        }
     }
   *]
 }

--
Gitblit v1.9.3