hongji.li
2023-09-05 94cda282c88d473dc4921fbafc821eb32d837a6d
Merge branch 'dev' of http://47.101.211.7:10101/r/TIANMA_JITUAN into dev_lhj
已修改7个文件
已添加4个文件
555 ■■■■ 文件已修改
_Main/BL/Type_BaseConversionFactor/StaticMethod_CreateOrUpdate.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting#576.qbl 75 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl 127 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingProductInLaneData.qbl 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl 150 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_ProductInLane/StaticMethod_CreateOrUpdate.qbl 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_ProductInLane/_ROOT_Type_ProductInLane.qbl 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_Product_MP/StaticMethod_CreateOrUpdate.qbl 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_Unit/StaticMethod_CreateOrUpdate.qbl 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_BaseConversionFactor/StaticMethod_CreateOrUpdate.qbl
@@ -21,12 +21,11 @@
    if( isnull( source ) or isnull( target ) ) {
        error( "can't find source or target unit of measure" )
    }
    //info( source)
    if( productId <> "" ) {
        product := Product_MP::FindById( macroPlan, productId );
    //    info( productId)
    //    }
    }
    }else{
      result := BaseConversionFactor::CreateUpdate( source, target, factor, product, isEnable )
      }
    
    if( isnull( product ) ) {
          info( "invalid product id" )  
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting#576.qbl
@@ -49,43 +49,44 @@
              firstAlterRow := alterRows.Element( 0 );
              // æ£€æŸ¥ä¸»æ–™
              component := Product_MP::FindById( this, firstAlterRow.ComponentCode() );
              if( isnull( component ) ) {
                  error( "component : " + firstAlterRow.ComponentCode() + " not found" );
              }
              traverse( routingStep, Operation, toLink ) {
                  // è¿žæŽ¥äº§å“ä¸Žoperation
                  pisp := ProductInStockingPoint_MP::CreateIfNotFound( component, stockingPoint );
                  trash := construct( OperationBOMs );
                  mainBOM := toLink.LinkProduct( component, true, BaseOperationLink::GetGroupID( toLink, true, false ), pisp,
                                                      true, trash );
                  mainBOM.Quantity( firstAlterRow.UnitUsageOfComponents() / firstAlterRow.ComponentOutputRate() );
                  mainBOM.MaxQuantityInGroup( firstAlterRow.UnitUsageOfComponents() / firstAlterRow.ComponentOutputRate() );
                  mainQty := mainBOM.Quantity();
                  Transaction::Transaction().Propagate();
                  // æ·»åŠ è¾…æ–™
                  traverse( alterRows, Elements, alterRow ) {
                      alterProd := Product_MP::FindById( this, alterRow.AlternativeMaterialCode() );
                      if( not isnull( alterProd ) ) {
      //                    error( "alterProd : " + alterRow.AlternativeMaterialCode() + " not found" );
                        stockingPointIdAlter := alterRow.OrganCode()  + "_" + alterRow.ProductType() + "_STOCK";
                        stockingPointAlter := StockingPoint_MP::FindById( this, stockingPointIdAlter );
                        if( isnull( stockingPointAlter ) ) {
                            error( "stockingPoint : " + stockingPointIdAlter + " not found" );
                        }
                        pispAlter := ProductInStockingPoint_MP::CreateIfNotFound( alterProd, stockingPointAlter );
                        mainInput := toLink.LastOperationInput();
                        trash := construct( OperationBOMs );
                        if( not isnull( mainInput ) ) {
                            alterBom := mainInput.Operation().LinkPISP( pispAlter, true, mainInput.OperationLinkGroupID(), trash );
                            alterBom.Quantity( mainBOM.MaxQuantityInGroup() * alterRow.AlternativeRate() );
                            alterBom.MaxQuantityInGroup( mainBOM.MaxQuantityInGroup() );
                            info( "Quantity" + [String]alterBom.Quantity() )
                            info( "MaxQuantityInGroup" + [String]alterBom.MaxQuantityInGroup() )
                            mainQty := mainQty - alterBom.Quantity();
                        }
                    }
                    mainBOM.Quantity( mainQty );
                 }
              if( not isnull( component ) ) {
    //              error( "component : " + firstAlterRow.ComponentCode() + " not found" );
    //          }
                traverse( routingStep, Operation, toLink ) {
                    // è¿žæŽ¥äº§å“ä¸Žoperation
                    pisp := ProductInStockingPoint_MP::CreateIfNotFound( component, stockingPoint );
                    trash := construct( OperationBOMs );
                    mainBOM := toLink.LinkProduct( component, true, BaseOperationLink::GetGroupID( toLink, true, false ), pisp,
                                                        true, trash );
                    mainBOM.Quantity( firstAlterRow.UnitUsageOfComponents() / firstAlterRow.ComponentOutputRate() );
                    mainBOM.MaxQuantityInGroup( firstAlterRow.UnitUsageOfComponents() / firstAlterRow.ComponentOutputRate() );
                    mainQty := mainBOM.Quantity();
                    Transaction::Transaction().Propagate();
                    // æ·»åŠ è¾…æ–™
                    traverse( alterRows, Elements, alterRow ) {
                        alterProd := Product_MP::FindById( this, alterRow.AlternativeMaterialCode() );
                        if( not isnull( alterProd ) ) {
        //                    error( "alterProd : " + alterRow.AlternativeMaterialCode() + " not found" );
                          stockingPointIdAlter := alterRow.OrganCode()  + "_" + alterRow.ProductType() + "_STOCK";
                          stockingPointAlter := StockingPoint_MP::FindById( this, stockingPointIdAlter );
                          if( isnull( stockingPointAlter ) ) {
                              error( "stockingPoint : " + stockingPointIdAlter + " not found" );
                          }
                          pispAlter := ProductInStockingPoint_MP::CreateIfNotFound( alterProd, stockingPointAlter );
                          mainInput := toLink.LastOperationInput();
                          trash := construct( OperationBOMs );
                          if( not isnull( mainInput ) ) {
                              alterBom := mainInput.Operation().LinkPISP( pispAlter, true, mainInput.OperationLinkGroupID(), trash );
                              alterBom.Quantity( mainBOM.MaxQuantityInGroup() * alterRow.AlternativeRate() );
                              alterBom.MaxQuantityInGroup( mainBOM.MaxQuantityInGroup() );
                              info( "Quantity" + [String]alterBom.Quantity() )
                              info( "MaxQuantityInGroup" + [String]alterBom.MaxQuantityInGroup() )
                              mainQty := mainQty - alterBom.Quantity();
                          }
                      }
                      mainBOM.Quantity( mainQty );
                   }
                }
              }
          }
       }
_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl
@@ -12,12 +12,6 @@
    // list to deal
    //info( "Get list to deal of product" );
    listToDeal := construct( structured[MappingProduct] );
    //listToDeal := selectset( this, MappingProduct, item, item.ID()='1107000030' );
    //info( listToDeal.First().BusinessType() );
    //traverse( listToDeal.First().BusinessType().Tokenize( ", " ), Elements, item ){
    //  info(item);
    //  }
    //info(  businesstypes.Difference( businesstypes.Difference( listToDeal.First().BusinessType().Tokenize( ", " ) ) ).Size() > 0 );
    
    if( isnull( businesstypes ) or businesstypes.Size() = 0 ) {
        if( iskeyproduct = true ){
@@ -35,60 +29,27 @@
        }
    }
    
    // Set the default value
    isbyproduct := false;
    hasshelflife := false;
    hasmaturation := false;
    manturationdays := 0.0;
    isexcludedfromoptimiazation := false;
    isplannedafteroptimization := false;
    isexcludedfromfulfilmentkpis := false;
    isfromdb := false;
    // Get the root data
    existroot := Product_MP::FindById( this, "全部物料产品" );
    if( isnull( existroot ) ){
        Product_MP::Create( this,
                            "全部物料产品",
                            "",
                            "全部物料产品",
                            "PCS",
                            isbyproduct,
                            "全部物料产品",
                            hasshelflife,
                            0.0,
                            hasmaturation,
                            manturationdays,
                            isexcludedfromoptimiazation,
                            isplannedafteroptimization,
                            isexcludedfromfulfilmentkpis,
                            isfromdb
                            );
     }
    Product_MP::CreateOrUpdate( this,
                                "全部物料产品",
                                "",
                                "全部物料产品",
                                "PCS",
                                "全部物料产品",
                                0.0
                                );
    
    // Get the ProductMajorType list & ProductSubclassType list
    traverse( listToDeal, Elements, item ){
      if( not item.ProductMajorType() = "" ){
    //    info( "Create major product: " + item.ProductMajorType().AsQUILL() );
        existmajor := Product_MP::FindById( this, item.ProductMajorType() );
        if( isnull( existmajor ) ){
          Product_MP::Create( this,
                              item.ProductMajorType(),
                              "全部物料产品",
                              item.ProductMajorType(),
                              "PCS",
                              isbyproduct,
                              item.ProductMajorType(),
                              hasshelflife,
                              0.0,
                              hasmaturation,
                              manturationdays,
                              isexcludedfromoptimiazation,
                              isplannedafteroptimization,
                              isexcludedfromfulfilmentkpis,
                              isfromdb
                              );
          }
        Product_MP::CreateOrUpdate( this,
                                    item.ProductMajorType(),
                                    "全部物料产品",
                                    item.ProductMajorType(),
                                    "PCS",
                                    item.ProductMajorType(),
                                    0.0
                                    );
      }
      productmajortype := item.ProductMajorType();
      if( productmajortype="" ){
@@ -96,26 +57,14 @@
        }
       
      if( not item.ProductSubclassType() = "" ){
    //    info( "Create subclass product: " + item.ProductSubclassType().AsQUILL() );
        existsubclass := Product_MP::FindById( this, item.ProductSubclassType() );
        if( isnull( existsubclass ) ){
          Product_MP::Create( this,
                              item.ProductSubclassType(),
                              productmajortype,
                              item.ProductSubclassType(),
                              "PCS",
                              isbyproduct,
                              item.ProductSubclassType(),
                              hasshelflife,
                              0.0,
                              hasmaturation,
                              manturationdays,
                              isexcludedfromoptimiazation,
                              isplannedafteroptimization,
                              isexcludedfromfulfilmentkpis,
                              isfromdb
                              );
          }
        Product_MP::CreateOrUpdate( this,
                                    item.ProductSubclassType(),
                                    productmajortype,
                                    item.ProductSubclassType(),
                                    "PCS",
                                    item.ProductSubclassType(),
                                    0.0
                                    );
        }
      productsubclasstype := item.ProductSubclassType();
      if( productsubclasstype="" ){
@@ -123,26 +72,14 @@
        }
      
      if( not item.ID() = "" ){
    //    info( "Create product: " + item.ID().AsQUILL() );
        existproduct := Product_MP::FindById( this, item.ID() );
        if( isnull( existproduct ) ){
            Product_MP::Create( this,
                                item.ID(),
                                productsubclasstype,
                                item.ID(),
                                item.UnitOfMeasureName(),
                                isbyproduct,
                                item.Name(),
                                hasshelflife,
                                item.ShelfLife(),
                                hasmaturation,
                                manturationdays,
                                isexcludedfromoptimiazation,
                                isplannedafteroptimization,
                                isexcludedfromfulfilmentkpis,
                                isfromdb
                                );
          }
          Product_MP::CreateOrUpdate( this,
                                      item.ID(),
                                      productsubclasstype,
                                      item.ID(),
                                      item.UnitOfMeasureName(),
                                      item.Name(),
                                      item.ShelfLife()
                                      );
        }
      }
  *]
_Main/BL/Type_MacroPlan/Method_MappingProductInLaneData.qbl
@@ -9,14 +9,9 @@
    // list to deal
    listtodeal := selectset( this, MappingProductInLane, item, not isnull( Product_MP::FindById( this, item.ProductID() ) ), not isnull( Lane::FindLaneTypeIndex( item.LineID() ) ) );
    
    // Set Default value if needed
    isexcluded := false;
    isfromdb := false;
    // Create ProductInLane
    traverse( listtodeal, Elements, item ){
      info( item.ProductID().AsQUILL() );
      ProductInLane::Create( Product_MP::FindById( this, item.ProductID() ), Lane::FindLaneTypeIndex( item.LineID() ), isexcluded, isfromdb );
      ProductInLane::CreateOrUpdate( this, item.ProductID(), item.LineID() );
      }
  *]
}
_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl
@@ -15,131 +15,85 @@
        listtodeal := selectset( this, MappingOperation, item, true );
    } else {
        listtodeal := selectset( this, MappingOperation, item, 
    //                             businesstypes.Find( item.BusinessType() ) <> -1,
                                 businesstypes.Difference( businesstypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0
                                  );
    }
    
    //Set the Default values
    unitofmeasurename := "PCS";
    currencyid := "CNY";
    startdate := Date::Date( 1900, 1, 1 );
    enddate := Date::Date( 9999, 12, 31 );
    capacitytype := "Infinite";
    
    // Get the root data
    existroot := Unit::FindById( this, "天马集团" );
    if( isnull( existroot ) ){
      this.Unit( relnew,
                 ID := "天马集团",
                 Name := "天马集团",
                 UnitOfMeasureName := unitofmeasurename,
                 CurrencyID := currencyid,
                 StartDate := startdate,
                 EndDate := enddate,
                 CapacityType := capacitytype );
     }
    Unit::CreateOrUpdate( this,
                          "天马集团",
                          "天马集团",
                          "",
                          capacitytype,
                          unitofmeasurename );
    
    // Get the sub root data
    existsubroot := Unit::FindById( this, "生产" );
    if( isnull( existsubroot ) ){
      this.Unit( relnew, ID := "生产",
                 Name := "生产",
                 ParentUnitID := "天马集团",
                 UnitOfMeasureName := unitofmeasurename,
                 CurrencyID := currencyid,
                 StartDate := startdate,
                 EndDate := enddate,
                 CapacityType := capacitytype );
     }
    Unit::CreateOrUpdate( this,
                          "生产",
                          "生产",
                          "天马集团",
                          capacitytype,
                          unitofmeasurename );
    
    existsubroot := Unit::FindById( this, "供应商" );
    if( isnull( existsubroot ) ){
      this.Unit( relnew, ID := "供应商",
                 Name := "供应商",
                 ParentUnitID := "天马集团",
                 UnitOfMeasureName := unitofmeasurename,
                 CurrencyID := currencyid,
                 StartDate := startdate,
                 EndDate := enddate,
                 CapacityType := capacitytype );
     }
    Unit::CreateOrUpdate( this,
                          "供应商",
                          "供应商",
                          "天马集团",
                          capacitytype,
                          unitofmeasurename );
    
    existsubroot := Unit::FindById( this, "整车运输" );
    if( isnull( existsubroot ) ){
      this.Unit( relnew, ID := "整车运输",
                 Name := "整车运输",
                 ParentUnitID := "天马集团",
                 UnitOfMeasureName := unitofmeasurename,
                 CurrencyID := currencyid,
                 StartDate := startdate,
                 EndDate := enddate,
                 CapacityType := capacitytype );
     }
    Unit::CreateOrUpdate( this,
                          "整车运输",
                          "整车运输",
                          "天马集团",
                          capacitytype,
                          unitofmeasurename );
    
    // Get the unit list
    traverse( listtodeal, Elements, item){
      //Get the first level unit
      existfirstlevelunit := Unit::FindById( this, item.OrganCode() );
    //  info( item.OrganCode().AsQUILL() );
      OrgName := item.OrganName();
      if( OrgName = ''){
        OrgName := item.OrganCode();
      }
      if( isnull( existfirstlevelunit ) ){
        this.Unit( relnew, ID := item.OrganCode(),
    //               Name := item.OrganName(),
                   Name :=OrgName,
                   ParentUnitID := "生产",
                   UnitOfMeasureName := unitofmeasurename,
                   CurrencyID := currencyid,
                   StartDate := startdate,
                   EndDate := enddate,
                   CapacityType := capacitytype );
        }
      //Get the first level unit
      Unit::CreateOrUpdate( this,
                            item.OrganCode(),
                            OrgName,
                            "生产",
                            capacitytype,
                            unitofmeasurename );
      //Get the second level unit
      secondlevelid := item.OrganCode() + "_" + item.PlantName();
    //  info( secondlevelid.AsQUILL() );
      existsecondlevelunit := Unit::FindById( this, secondlevelid );
      if( isnull( existsecondlevelunit ) ){
        this.Unit( relnew, ID := secondlevelid,
                   Name := secondlevelid,
                   ParentUnitID := item.OrganCode(),
                   UnitOfMeasureName := unitofmeasurename,
                   CurrencyID := currencyid,
                   StartDate := startdate,
                   EndDate := enddate,
                   CapacityType := capacitytype );
        }
      Unit::CreateOrUpdate( this,
                            secondlevelid,
                            secondlevelid,
                            item.OrganCode(),
                            capacitytype,
                            unitofmeasurename );
      //Get the third level unit
      thirdlevelid := secondlevelid + "_" + item.ProcessSection();
    //  info( thirdlevelid.AsQUILL() );
      existthirdlevelunit := Unit::FindById( this, thirdlevelid );
      if( isnull( existthirdlevelunit ) ){
        this.Unit( relnew, ID := thirdlevelid,
                   Name := thirdlevelid,
                   ParentUnitID := secondlevelid,
                   CapacityType := "Time",
                   UnitOfMeasureName := item.UnitOfMeasureName(),
                   CurrencyID := currencyid,
                   StartDate := startdate,
                   EndDate := enddate );
        }
      Unit::CreateOrUpdate( this,
                            thirdlevelid,
                            thirdlevelid,
                            secondlevelid,
                            "Time",
                            item.UnitOfMeasureName() );
      //Get the last level unit
      if( item.Line()<>"" ){
        lastlevelid := thirdlevelid + "_" + item.Line();
    //    info( lastlevelid.AsQUILL() );
        existlastlevelunit := Unit::FindById( this, lastlevelid );
        if( isnull( existlastlevelunit ) ){
          this.Unit( relnew, ID := lastlevelid,
                     Name := lastlevelid,
                     ParentUnitID := thirdlevelid,
                     CapacityType := "Time",
                     UnitOfMeasureName := item.UnitOfMeasureName(),
                     CurrencyID := currencyid,
                     StartDate := startdate,
                     EndDate := enddate );
        }
        Unit::CreateOrUpdate( this,
                              lastlevelid,
                              lastlevelid,
                              thirdlevelid,
                              "Time",
                              item.UnitOfMeasureName() );
      }
      }
  *]
_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
@@ -63,8 +63,8 @@
    //todo: æ•°æ®æœ‰é‡å¤ï¼Œå…ˆç•¥è¿‡
    macroPlan.Broker_OTD_Product().Execute();
    info( "Start data mapping of product" );
    testproduct := construct( Strings );
    macroPlan.MappingProductData( testproduct, false );
    //testproduct := construct( Strings );
    macroPlan.MappingProductData( businessTypes, false );
    //单位转换-7
    info( "BaseConversionFactor::DoSync" )
    BaseConversionFactor::DoSync( macroPlan );
@@ -98,28 +98,28 @@
    port := 443;
    data := macroPlan.ApiResponesCheck( address, url, port, postrequestbody );
    macroPlan.ApiLaneLegsData( data );
    //// ä¾›åº”网络(车道)-12
    //info( "ProductInLane::DoSync" )
    //macroPlan.Broker_OTD_ProductInLane().Execute();
    //macroPlan.MappingProductInLaneData();
    // ä¾›åº”网络(车道)-12
    info( "ProductInLane::DoSync" )
    macroPlan.Broker_OTD_ProductInLane().Execute();
    macroPlan.MappingProductInLaneData();
    // åœ¨åº“库存数据-13
    info( "ActualPISPIP::DoSync" )
    macroPlan.Broker_OTD_ActualPISPIP().Execute();
    //macroPlan.MappingActualPISPIPData( businessTypes, true );
    macroPlan.MappingActualPISPIPData( businessTypes, false );
    //// åœ¨é€”库存-14
    //info( "ExternalSupply::DoSync" )
    //info( "Start data broker of External supply" );
    //macroPlan.Broker_OTD_ExternalSupply().Execute();
    ////macroPlan.MappingExternalSupplyData( businessTypes, true );
    //info( "Start data mapping of External supply" );
    //macroPlan.MappingExternalSupplyData( businessTypes, false );
    //// åº“存成本-15
    //info( "InventoryCost::DoSync" );
    //InventoryValueAndCost::DoSync( macroPlan );
    //// todo åˆ¶é€ æˆæœ¬-16
    //info( "OperationCost::DoSync" );
    //macroPlan.MappingOperationCostData( businessTypes );
    // åœ¨é€”库存-14
    info( "ExternalSupply::DoSync" )
    info( "Start data broker of External supply" );
    macroPlan.Broker_OTD_ExternalSupply().Execute();
    //macroPlan.MappingExternalSupplyData( businessTypes, true );
    info( "Start data mapping of External supply" );
    macroPlan.MappingExternalSupplyData( businessTypes, false );
    // åº“存成本-15
    info( "InventoryCost::DoSync" );
    InventoryValueAndCost::DoSync( macroPlan );
    // todo åˆ¶é€ æˆæœ¬-16
    info( "OperationCost::DoSync" );
    macroPlan.MappingOperationCostData( businessTypes );
    // è®¢å•预测-17
    info( "Forecast::DoSync" );
    Forecast::DoSync( macroPlan, businessTypes );
_Main/BL/Type_ProductInLane/StaticMethod_CreateOrUpdate.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
Quintiq file version 2.0
#parent: #root
StaticMethod CreateOrUpdate (
  MacroPlan owner,
  String productid,
  String lineid
)
{
  TextBody:
  [*
    // Administrator Sep-5-2023 (created)
    // Set Default value if needed
    isexcluded := false;
    isfromdb := false;
    // Get product&line
    product :=  Product_MP::FindById( owner, productid );
    line :=  Lane::FindLaneTypeIndex( lineid );
    productinline := ProductInLane::FindProductInLaneTypeIndex( lineid, productid );
    if( isnull( productinline ) ){
      ProductInLane::Create( product, line, isexcluded, isfromdb );
      }else{
        productinline.Update( productid, lineid, isexcluded, isfromdb );
        }
  *]
}
_Main/BL/Type_ProductInLane/_ROOT_Type_ProductInLane.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,6 @@
Quintiq file version 2.0
#root
#parent: #DomainModel
Type ProductInLane #extension
{
}
_Main/BL/Type_Product_MP/StaticMethod_CreateOrUpdate.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,65 @@
Quintiq file version 2.0
#parent: #root
StaticMethod CreateOrUpdate (
  MacroPlan owner,
  String productid,
  String parentid,
  String name,
  String unitofmeasurename,
  String description,
  Real shelflife
)
{
  TextBody:
  [*
    // Administrator Sep-5-2023 (created)
    // Set the default value
    isbyproduct := false;
    hasshelflife := false;
    hasmaturation := false;
    manturationdays := 0.0;
    isexcludedfromoptimiazation := false;
    isplannedafteroptimization := false;
    isexcludedfromfulfilmentkpis := false;
    isfromdb := false;
    // Find the product
    product := Product_MP::FindById( owner, productid );
    info( productid );
    if( isnull( product ) ){
      Product_MP::Create( owner,
                          productid,
                          parentid,
                          name,
                          unitofmeasurename,
                          isbyproduct,
                          description,
                          hasshelflife,
                          shelflife,
                          hasmaturation,
                          manturationdays,
                          isexcludedfromoptimiazation,
                          isplannedafteroptimization,
                          isexcludedfromfulfilmentkpis,
                          isfromdb
                          );
      }else{
        product.Update( productid,
                        name,
                        parentid,
                        unitofmeasurename,
                        isbyproduct,
                        description,
                        hasshelflife,
                        shelflife,
                        hasmaturation,
                        manturationdays,
                        isexcludedfromoptimiazation,
                        isplannedafteroptimization,
                        isexcludedfromfulfilmentkpis,
                        isfromdb
                        );
        }
  *]
}
_Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl
@@ -5,7 +5,7 @@
  TextBody:
  [*
    // yypsybs Aug-23-2023 (created)
    strings := "手机事业部;";
    strings := "集团面板;专业显示事业部;外卖CELL;非显;运动健康;运动健康事业部;手机事业部;特种显示;汽车电子事业部;车载显示事业部;IT事业部;";
    
    //table := KB_BusinessTypesTable;
    
_Main/BL/Type_Unit/StaticMethod_CreateOrUpdate.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,50 @@
Quintiq file version 2.0
#parent: #root
StaticMethod CreateOrUpdate (
  MacroPlan owner,
  String id,
  String name,
  String parentunitid,
  String capacitytype,
  String unitofmeasurename
)
{
  TextBody:
  [*
    // Administrator Sep-5-2023 (created)
    //Set the Default values
    currencyid := "CNY";
    startdate := Date::Date( 1900, 1, 1 );
    enddate := Date::Date( 9999, 12, 31 );
    // Get the unit
    unit := Unit::FindById( owner, id );
    if( id="天马集团" and isnull( unit ) ){
      owner.Unit( relnew,
                 ID := id,
                 Name := name,
                 UnitOfMeasureName := unitofmeasurename,
                 CurrencyID := currencyid,
                 StartDate := startdate,
                 EndDate := enddate,
                 CapacityType := capacitytype );
      }else{
      if( isnull( unit ) ){
        owner.Unit( relnew, ID := id,
                   Name := name,
                   ParentUnitID := parentunitid,
                   CapacityType := capacitytype,
                   UnitOfMeasureName := unitofmeasurename,
                   CurrencyID := currencyid,
                   StartDate := startdate,
                   EndDate := enddate );
        }else{
          unit.Name( name );
          unit.ParentUnitID( parentunitid );
          unit.CapacityType( capacitytype );
          unit.UnitOfMeasureName( unitofmeasurename );
          }
        }
  *]
}