From 110846d23e6d86ad6fb883836640dc32b39ea86e Mon Sep 17 00:00:00 2001
From: renhao <renhui.hao@capgemini.com>
Date: 星期三, 20 九月 2023 13:55:59 +0800
Subject: [PATCH] Merge branch 'dev_release'

---
 _Main/BL/Type_MacroPlan/Method_InitialUnitAndStockingPoint.qbl |  110 ++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 85 insertions(+), 25 deletions(-)

diff --git a/_Main/BL/Type_MacroPlan/Method_InitialUnitAndStockingPoint.qbl b/_Main/BL/Type_MacroPlan/Method_InitialUnitAndStockingPoint.qbl
index 767523f..c71e147 100644
--- a/_Main/BL/Type_MacroPlan/Method_InitialUnitAndStockingPoint.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_InitialUnitAndStockingPoint.qbl
@@ -6,51 +6,111 @@
   [*
     // Administrator Sep-1-2023 (created)
     
-    unitOfMeasure_MP := UnitOfMeasure_MP::FindByName( this, "PCS" );
-    if ( isnull( unitOfMeasure_MP ) ) {
-      unitOfMeasure_MP := UnitOfMeasure_MP::Create( this, "PCS", false, false );
-    }
-    
     //Set the Default values
     unitofmeasurename := "PCS";
+    currencyid := "CNY";
+    startdate := Date::Date( 1900, 1, 1 );
+    enddate := Date::Date( 9999, 12, 31 );
     capacitytype := "Transport quantity";
     
-    if ( isnull( Unit::FindById( this, "绌鸿繍" ) ) ) {
-      Unit::Create( "绌鸿繍", this, "绌鸿繍", unitOfMeasure_MP, null( Unit ), capacitytype, "", null( SupplyChainView ), 0, 0, false ); 
-    }
+    if( isnull( Unit::FindById( this, "绌鸿繍" ) ) ){
+      this.Unit( relnew, 
+                 ID := "绌鸿繍", 
+                 Name := "绌鸿繍", 
+                 UnitOfMeasureName := unitofmeasurename, 
+                 CurrencyID := currencyid, 
+                 StartDate := startdate, 
+                 EndDate := enddate, 
+                 CapacityType := capacitytype );
+      }
     
-    if ( isnull( Unit::FindById( this, "搴撳瓨浜嬪姟澶勭悊" ) ) ) {
-      Unit::Create( "搴撳瓨浜嬪姟澶勭悊", this, "搴撳瓨浜嬪姟澶勭悊", unitOfMeasure_MP, null( Unit ), capacitytype, "", null( SupplyChainView ), 0, 0, false ); 
+    if( isnull( Unit::FindById( this, "搴撳瓨浜嬪姟澶勭悊" ) ) ){
+      this.Unit( relnew, 
+                 ID := "搴撳瓨浜嬪姟澶勭悊", 
+                 Name := "搴撳瓨浜嬪姟澶勭悊", 
+                 UnitOfMeasureName := unitofmeasurename, 
+                 CurrencyID := currencyid, 
+                 StartDate := startdate, 
+                 EndDate := enddate, 
+                 CapacityType := capacitytype );
     }
     
     unitofmeasurename := "PCS";
+    name := "鎵嬪姩鍒涘缓搴撳瓨鐐�";
+    currencyname := "CNY";
+    isplannedinfinite := false;
+    datestart := Date::Construct(1900, 1, 1) ;
+    dateend := Date::Construct(9999, 12, 31);
+    groupname := " ";
+    description := " ";
+    isfromdb := true;
     
-    if ( isnull( StockingPoint_MP::FindById( this, "F13_FG_STOCK" ) ) ) {
-      StockingPoint_MP::Create( "F13_FG_STOCK", this, null( Unit ), "F13_FG_STOCK", null( SupplyChainView ), 0, 0, false );
+    if( isnull( StockingPoint_MP::FindById( this, "F13_FG_STOCK" ) ) ){
+      StockingPoint_MP::Create( this, 
+                                "F13_FG_STOCK", 
+                                "F13", 
+                                name, 
+                                unitofmeasurename, 
+                                currencyname, 
+                                isplannedinfinite, 
+                                datestart, 
+                                dateend, 
+                                groupname, 
+                                description, 
+                                isfromdb );
     }
     
-    if ( isnull( StockingPoint_MP::FindById( this, "H10_SA_STOCK" ) ) ) {
-      StockingPoint_MP::Create( "H10_SA_STOCK", this, null( Unit ), "H10_SA_STOCK", null( SupplyChainView ), 0, 0, false );
+    if( isnull( StockingPoint_MP::FindById( this, "H10_SA_STOCK" ) ) ){
+      StockingPoint_MP::Create( this, 
+                                "H10_SA_STOCK", 
+                                "H10", 
+                                name, 
+                                unitofmeasurename, 
+                                currencyname, 
+                                isplannedinfinite, 
+                                datestart, 
+                                dateend, 
+                                groupname, 
+                                description, 
+                                isfromdb );
     }
     
-    if ( isnull( StockingPoint_MP::FindById( this, "Q10_FG_STOCK" ) ) ) {
-      StockingPoint_MP::Create( "Q10_FG_STOCK", this, null( Unit ), "Q10_FG_STOCK", null( SupplyChainView ), 0, 0, false );
+    if( isnull( StockingPoint_MP::FindById( this, "Q10_FG_STOCK" ) ) ){
+      StockingPoint_MP::Create( this, 
+                                "Q10_FG_STOCK", 
+                                "Q10", 
+                                name, 
+                                unitofmeasurename, 
+                                currencyname, 
+                                isplannedinfinite, 
+                                datestart, 
+                                dateend, 
+                                groupname, 
+                                description, 
+                                isfromdb );
     }
     
-    if ( isnull( Currency_MP::FindById( this, "CNY" ) ) ) {
-      Currency_MP::Create( "CNY", this, "CNY", "", false, false );
-    }
+    existcurrency := Currency_MP::FindById( this, "CNY" );
+    if( isnull( existcurrency ) ){
+      Currency_MP::CreateCurrency( this, "CNY", "CNY", "", true );
+      currency := Currency_MP::FindById( this, "EUR" );
+      currency.IsBase(false);
+      Transaction::Transaction().Propagate();
+      }
     
     isproductcatagory := false;
     isfromdb := false;
-    if ( isnull( ProductLevel_MP::FindProductLevelTypeIndex( "1" ) ) ) {
+    existproductlevel := ProductLevel_MP::FindProductLevelTypeIndex( "2" );
+    if( isnull( existproductlevel ) ){
       ProductLevel_MP::Create( "1", isproductcatagory, this, isfromdb );
-    }
-    if ( isnull( ProductLevel_MP::FindProductLevelTypeIndex( "2" ) ) ) {
       ProductLevel_MP::Create( "2", isproductcatagory, this, isfromdb );
-    }
-    if ( isnull( ProductLevel_MP::FindProductLevelTypeIndex( "3" ) ) ) {
       ProductLevel_MP::Create( "3", isproductcatagory, this, isfromdb );
-    }
+      }
+    
+    existsalestlevel := SalesLevel_MP::FindSalesLevelTypeIndex( "2")
+    if( isnull( existsalestlevel ) ){
+        SalesLevel_MP::Create( "1",this,isfromdb);
+        SalesLevel_MP::Create( "2",this,isfromdb);
+      }
   *]
 }

--
Gitblit v1.9.3