From bcf28ff5a04e52420ce53b224862e9f436166b98 Mon Sep 17 00:00:00 2001
From: yanyuan <yuan.yan@capgemini.com>
Date: 星期三, 01 十一月 2023 16:35:56 +0800
Subject: [PATCH] FIx BaseConversionFactor error

---
 /dev/null                                                              |    6 ------
 _Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan#127.qbl |    2 +-
 _Main/BL/Type_MacroPlan/StaticMethod_DoASync#253.qbl                   |    2 ++
 _Main/BL/Type_BaseConversionFactor/StaticMethod_CreateOrUpdate.qbl     |   14 ++++++++++++++
 4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/_Main/BL/Type_BaseConversionFactor/StaticMethod_CreateOrUpdate.qbl b/_Main/BL/Type_BaseConversionFactor/StaticMethod_CreateOrUpdate.qbl
index cd44e09..2e4ee74 100644
--- a/_Main/BL/Type_BaseConversionFactor/StaticMethod_CreateOrUpdate.qbl
+++ b/_Main/BL/Type_BaseConversionFactor/StaticMethod_CreateOrUpdate.qbl
@@ -26,6 +26,20 @@
       if( productId <> "" ) {
         product := Product_MP::FindById( macroPlan, productId );
       }else{
+    //    info( productId );
+    //    cf := select( source,
+    //              AsSourceUnitOfMeasure,
+    //              cf,
+    //              ( cf.TargetUnitOfMeasure() = target
+    //                or cf.TargetUnitOfMeasure() = source )
+    //              and cf.Product_MP() = product
+    //              );
+    //    info( isnull( cf ) );
+    //    info( "sourceuomname: " + cf.astype( BaseConversionFactor ).SourceUnitOfMeasureName() );
+    //    info( "targetuomname: " + target.Name() );
+    //    info( "cf.targetuomname: " + cf.astype( BaseConversionFactor ).TargetUnitOfMeasureName() );
+    //    info( "productid: " + guard( product.ID(), "" ) );
+    //    info( "cf.product: " + cf.astype( BaseConversionFactor ).ProductID() );
         result := BaseConversionFactor::CreateUpdate( source, target, factor, product, isEnable )
       }
     
diff --git "a/_Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan\043127.qbl" "b/_Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan\043127.qbl"
index 007623c..f20706a 100644
--- "a/_Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan\043127.qbl"
+++ "b/_Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan\043127.qbl"
@@ -28,6 +28,7 @@
   TextBody:
   [*
     organcodelist := selectvalues( this, Global_MappingOperationBOM, bom,true, bom.OrganCode() );
+    info( macroPlan.BusinessType() );
     businessTypes := macroPlan.BusinessType().Tokenize( "," );
     if( not isnull( businessTypes ) and businessTypes.Size() > 0 ) {
         traverse( businessTypes, Elements, item ) {
@@ -48,7 +49,6 @@
       }
     
     macroPlan.InitialUnitAndStockingPoint();
-    info( macroPlan.BusinessType() );
     info( organcodelist.Element( 0 ) );
     //
     //if ( isUnitOfMeasure_MP ) {
diff --git a/_Main/BL/Type_MacroPlan/DefaultValue_BusinessType.qbl b/_Main/BL/Type_MacroPlan/DefaultValue_BusinessType.qbl
deleted file mode 100644
index 1672b03..0000000
--- a/_Main/BL/Type_MacroPlan/DefaultValue_BusinessType.qbl
+++ /dev/null
@@ -1,6 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-DefaultValue
-{
-  TargetAttribute: BusinessType
-}
diff --git "a/_Main/BL/Type_MacroPlan/StaticMethod_DoASync\043253.qbl" "b/_Main/BL/Type_MacroPlan/StaticMethod_DoASync\043253.qbl"
index bdf837d..70b4b76 100644
--- "a/_Main/BL/Type_MacroPlan/StaticMethod_DoASync\043253.qbl"
+++ "b/_Main/BL/Type_MacroPlan/StaticMethod_DoASync\043253.qbl"
@@ -17,6 +17,8 @@
     info( "Prepare to do sync" )
     info( "Get organ code list" )
     businessTypeName := businessType.BusinessTypeName().Tokenize( "," );
+    macroPlan.BusinessType( businessType.BusinessTypeName() );
+    
     organcodelist := selectvalues( businessType, OrganCode, organ, true, organ.OrganCodeName() );
     
     if( organcodelist.Size() = 0 ){

--
Gitblit v1.9.3