From 92c0a1e04cd0cf38fcc93839765755495c3887c5 Mon Sep 17 00:00:00 2001
From: Administrator <renhui.hao@capgemini.com>
Date: 星期日, 10 九月 2023 23:39:57 +0800
Subject: [PATCH] Merge remote-tracking branch 'refs/remotes/origin/dev_release'

---
 _Main/BL/Type_LaneLeg/StaticMethod_CreateLaneLegFromJson.qbl             |    4 ++--
 _Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl                         |   14 +++++++-------
 _Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataSupplyPurchase.qbl |   25 ++++++++++++++++---------
 3 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/_Main/BL/Type_LaneLeg/StaticMethod_CreateLaneLegFromJson.qbl b/_Main/BL/Type_LaneLeg/StaticMethod_CreateLaneLegFromJson.qbl
index ed77c9e..2d6f3dd 100644
--- a/_Main/BL/Type_LaneLeg/StaticMethod_CreateLaneLegFromJson.qbl
+++ b/_Main/BL/Type_LaneLeg/StaticMethod_CreateLaneLegFromJson.qbl
@@ -9,8 +9,8 @@
   [*
     // Administrator Jul-12-2023 (created)
     laneid := datarow.Get( "laneid" ).GetString();
-    originstockingpointid := datarow.Get( "originstockingpointid" ).GetString();
-    destinationstockingpointid := datarow.Get( "destinationstockingpointid" ).GetString();
+    originstockingpointid := datarow.Get( "originstockingpointid" ).GetString()+"_STOCK";
+    destinationstockingpointid := datarow.Get( "destinationstockingpointid" ).GetString()+"_STOCK";
     name := datarow.Get( "name" ).GetString();
     userleadtime := datarow.Get( "userleadtime" );
     processingtime := Duration::Zero();
diff --git a/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataSupplyPurchase.qbl b/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataSupplyPurchase.qbl
index ab499a8..36dcb7a 100644
--- a/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataSupplyPurchase.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataSupplyPurchase.qbl
@@ -18,28 +18,35 @@
     routingStep := RoutingStep::Create( routing, routingStepName, "", true );
     product := Product_MP::FindById( this, productId );
     if( isnull( product ) ) {
-        error( "product : " + productId + " not found" );
+        info(  "product : " + productId + " not found" );
     }
-    stockingPointId := orgCode + "_" + productType + "_Stock";
+    stockingPointId := orgCode + "_" + productType + "_STOCK";
     stockingPoint := StockingPoint_MP::FindById( this, stockingPointId );
     if( isnull( stockingPoint ) ) {
-        error( "stockingPoint : " + stockingPointId + " not found" );
+        info( "stockingPoint : " + stockingPointId + " not found" );
     }
-    unit := Unit::FindById( this, unitId );
-    if( isnull( unit ) ) {
+    
+    if( not isnull( product) and not isnull( stockingPoint)){
+      unit := Unit::FindById( this, unitId );
+      if( isnull( unit ) ) {
         unit := this.Unit( relnew, 
                           ID := unitId, Name := unitId, CapacityType := "Infinite",
                           DefaultGridX := 0, DefaultGridY := 0,
                           IsManuallyConfigured := false,
                           Currency_MP := this.BaseCurrency(), UnitOfMeasure_MP := this.DefaultUnitOfMeasure() );
-    }
+      }
     // Operation
-    operation := Operation::Create( operationId, unit, operationId, routingStep, 
+      operation := Operation::FindOperationTypeIndex( operationId);
+      if( isnull( operation)){
+        operation := Operation::Create( operationId, unit, operationId, routingStep, 
                                     Duration::Zero(), Duration::Zero(), 1.0, false, 
                                     Real::MinReal(), false, Real::MaxReal(), 
                                     0.0, 0.0, false, true );
     // OperaionBom
-    operation.CreateOperationBOM( product, stockingPoint, false, true );
-    operation.GetOperationBOM( product.ID(), stockingPoint.ID(), false ).Quantity( 1 );
+        operation.CreateOperationBOM( product, stockingPoint, false, true );
+        operation.GetOperationBOM( product.ID(), stockingPoint.ID(), false ).Quantity( 1 );
+      }
+      
+    }
   *]
 }
diff --git a/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl b/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
index dc5d8d6..093fa04 100644
--- a/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
+++ b/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
@@ -107,25 +107,25 @@
     data := macroPlan.ApiResponesCheck( address, url, port, postrequestbody );
     macroPlan.ApiLaneLegsData( data );
     
-    //// 渚涘簲缃戠粶锛堣溅閬擄級-12
-    //info( "Get Lanelegs From Api Finished, Start ProductInLane Data Broker" );
-    //macroPlan.Broker_OTD_ProductInLane().Execute();
-    //info( "ProductInLane Data Broker Finished, Start ProductInLane Mapping" );
-    //macroPlan.MappingProductInLaneData();
+    // 渚涘簲缃戠粶锛堣溅閬擄級-12
+    info( "Get Lanelegs From Api Finished, Start ProductInLane Data Broker" );
+    macroPlan.Broker_OTD_ProductInLane().Execute();
+    info( "ProductInLane Data Broker Finished, Start ProductInLane Mapping" );
+    macroPlan.MappingProductInLaneData();
     
     // 鍦ㄥ簱搴撳瓨鏁版嵁-13
     info( "ProductInLane Finished, Start ActualPISPIP Data Broker" );
     macroPlan.Broker_OTD_ActualPISPIP().Execute();
     info( "ActualPISPIP Data Broker Finished, Start ActualPISPIP Mapping" );
     //macroPlan.MappingActualPISPIPData( businessTypes, true );
-    macroPlan.MappingActualPISPIPData( businessTypes, false );
+    macroPlan.MappingActualPISPIPData( businessTypes, isKeyProduct );
     
     // 鍦ㄩ�斿簱瀛�-14
     info( "ActualPISPIP Finished, Start ExternalSupply Data Broker" );
     macroPlan.Broker_OTD_ExternalSupply().Execute();
     //macroPlan.MappingExternalSupplyData( businessTypes, true );
     info( "ExternalSupply Data Broker Finished, Start ExternalSupply Mapping" );
-    macroPlan.MappingExternalSupplyData( businessTypes, false );
+    macroPlan.MappingExternalSupplyData( businessTypes, isKeyProduct );
     
     // 搴撳瓨鎴愭湰-15
     InventoryValueAndCost::DoSync( macroPlan );

--
Gitblit v1.9.3