Fix Create&Update
为之前的ProductInLine、Product及Unit补全CreateOrUpdate方法,并修改了单位转换中之前补考了Product ID为空的问题
| | |
| | | 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" ) |
| | |
| | | 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 ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | // 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 ){ |
| | |
| | | } |
| | | } |
| | | |
| | | // 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="" ){ |
| | |
| | | } |
| | | |
| | | 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="" ){ |
| | |
| | | } |
| | | |
| | | 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() |
| | | ); |
| | | } |
| | | } |
| | | *] |
| | |
| | | // 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() ); |
| | | } |
| | | *] |
| | | } |
| | |
| | | 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() ); |
| | | } |
| | | } |
| | | *] |
| | |
| | | //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 ); |
| | |
| | | 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 ); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 ); |
| | | } |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #root |
| | | #parent: #DomainModel |
| | | Type ProductInLane #extension |
| | | { |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 |
| | | ); |
| | | } |
| | | *] |
| | | } |
| | |
| | | TextBody: |
| | | [* |
| | | // yypsybs Aug-23-2023 (created) |
| | | strings := "ææºäºä¸é¨;"; |
| | | strings := "éå¢é¢æ¿;ä¸ä¸æ¾ç¤ºäºä¸é¨;å¤åCELL;éæ¾;è¿å¨å¥åº·;è¿å¨å¥åº·äºä¸é¨;ææºäºä¸é¨;ç¹ç§æ¾ç¤º;汽车çµåäºä¸é¨;车载æ¾ç¤ºäºä¸é¨;ITäºä¸é¨;"; |
| | | |
| | | //table := KB_BusinessTypesTable; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 ); |
| | | } |
| | | } |
| | | *] |
| | | } |