From b262ab5a8021b0a3b9bb4bab78c52981ac39e35e Mon Sep 17 00:00:00 2001 From: yanyuan <yuan.yan@capgemini.com> Date: 星期二, 05 九月 2023 16:00:50 +0800 Subject: [PATCH] Merge branch 'dev_yy' into dev --- _Main/BL/Type_MacroPlan/Method_MappingProductInLaneData.qbl | 7 _Main/BL/Type_ProductInLane/_ROOT_Type_ProductInLane.qbl | 6 _Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl | 2 _Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl | 38 +- _Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting#576.qbl | 75 +++--- _Main/BL/Type_Product_MP/StaticMethod_CreateOrUpdate.qbl | 65 ++++++ _Main/BL/Type_Unit/StaticMethod_CreateOrUpdate.qbl | 50 +++++ _Main/BL/Type_MacroPlan/Method_MappingProductData.qbl | 127 +++--------- _Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl | 150 +++++--------- _Main/BL/Type_ProductInLane/StaticMethod_CreateOrUpdate.qbl | 28 ++ _Main/BL/Type_BaseConversionFactor/StaticMethod_CreateOrUpdate.qbl | 7 11 files changed, 295 insertions(+), 260 deletions(-) diff --git a/_Main/BL/Type_BaseConversionFactor/StaticMethod_CreateOrUpdate.qbl b/_Main/BL/Type_BaseConversionFactor/StaticMethod_CreateOrUpdate.qbl index 4326900..4ecdf63 100644 --- a/_Main/BL/Type_BaseConversionFactor/StaticMethod_CreateOrUpdate.qbl +++ b/_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" ) diff --git "a/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting\043576.qbl" "b/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting\043576.qbl" index 237e007..6d1861c 100644 --- "a/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting\043576.qbl" +++ "b/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting\043576.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 ) { - // 杩炴帴浜у搧涓巓peration - 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 ) { + // 杩炴帴浜у搧涓巓peration + 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 ); + } + } } } } diff --git a/_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl index 56e75fb..88399b7 100644 --- a/_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl +++ b/_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() + ); } } *] diff --git a/_Main/BL/Type_MacroPlan/Method_MappingProductInLaneData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingProductInLaneData.qbl index 59d5b11..6be8dad 100644 --- a/_Main/BL/Type_MacroPlan/Method_MappingProductInLaneData.qbl +++ b/_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() ); } *] } diff --git a/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl index 47e25d4..fa613b6 100644 --- a/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl +++ b/_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() ); } } *] diff --git a/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl b/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl index 3f014f2..5b22e41 100644 --- a/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl +++ b/_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 ); diff --git a/_Main/BL/Type_ProductInLane/StaticMethod_CreateOrUpdate.qbl b/_Main/BL/Type_ProductInLane/StaticMethod_CreateOrUpdate.qbl new file mode 100644 index 0000000..0db749e --- /dev/null +++ b/_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 ); + } + *] +} diff --git a/_Main/BL/Type_ProductInLane/_ROOT_Type_ProductInLane.qbl b/_Main/BL/Type_ProductInLane/_ROOT_Type_ProductInLane.qbl new file mode 100644 index 0000000..fe13d9c --- /dev/null +++ b/_Main/BL/Type_ProductInLane/_ROOT_Type_ProductInLane.qbl @@ -0,0 +1,6 @@ +Quintiq file version 2.0 +#root +#parent: #DomainModel +Type ProductInLane #extension +{ +} diff --git a/_Main/BL/Type_Product_MP/StaticMethod_CreateOrUpdate.qbl b/_Main/BL/Type_Product_MP/StaticMethod_CreateOrUpdate.qbl new file mode 100644 index 0000000..809cc63 --- /dev/null +++ b/_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 + ); + } + *] +} diff --git a/_Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl b/_Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl index 024ef91..64f7bc4 100644 --- a/_Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl +++ b/_Main/BL/Type_ScenarioManager/StaticMethod_AvailableBusinessTypes.qbl @@ -5,7 +5,7 @@ TextBody: [* // yypsybs Aug-23-2023 (created) - strings := "鎵嬫満浜嬩笟閮�;"; + strings := "闆嗗洟闈㈡澘;涓撲笟鏄剧ず浜嬩笟閮�;澶栧崠CELL;闈炴樉;杩愬姩鍋ュ悍;杩愬姩鍋ュ悍浜嬩笟閮�;鎵嬫満浜嬩笟閮�;鐗圭鏄剧ず;姹借溅鐢靛瓙浜嬩笟閮�;杞﹁浇鏄剧ず浜嬩笟閮�;IT浜嬩笟閮�;"; //table := KB_BusinessTypesTable; diff --git a/_Main/BL/Type_Unit/StaticMethod_CreateOrUpdate.qbl b/_Main/BL/Type_Unit/StaticMethod_CreateOrUpdate.qbl new file mode 100644 index 0000000..df72958 --- /dev/null +++ b/_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 ); + } + } + *] +} -- Gitblit v1.9.3