From 3cb5a54def670d97301f07170fcaad213bfc54f2 Mon Sep 17 00:00:00 2001 From: yypsybs <yypsybs@foxmail.com> Date: 星期六, 09 九月 2023 15:30:46 +0800 Subject: [PATCH] 同步逻辑由MacroPlan移到MPSync --- _Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl | 168 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 84 insertions(+), 84 deletions(-) diff --git a/_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl index a3a19ed..47487bf 100644 --- a/_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl +++ b/_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl @@ -6,89 +6,89 @@ { TextBody: [* - // yypsybs Aug-18-2023 (created) - // 鑾峰彇鏈夊簭鐨勫緟澶勭悊璁板綍 - toDealList := construct( MappingOperations ); - if( not isnull( businessTypes ) and businessTypes.Size() > 0 ) { - toDealList := selectsortedset( this, MappingOperation, item, - // businessTypes.Find( item.BusinessType() ) >= 0, - businessTypes.Difference( businessTypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0, - item.SequenceNumber() ); - } else { - toDealList := selectsortedset( this, MappingOperation, item, - true, - item.SequenceNumber() ); - } - // 閫愭潯澶勭悊锛岄娆″鐞嗘椂鍒犻櫎steps - dealtRoutingIds := construct( Strings ); - routingList := construct( Routings ); - traverse( toDealList, Elements, item ) { - routingId := item.OrganCode() + "_" + item.ProductID(); - unitId := item.OrganCode() + "_" + item.PlantName() + "_" + item.ProcessSection(); - routingStepName := item.ProcessSection() + "_" + [String]item.SequenceNumber(); - operationId := item.OrganCode() + "_" + item.ProductID() + "_" + item.ProcessSection(); - // info( "========" ) - // info( "routingId:" + routingId ); - // info( "unitId:" + unitId ); - // info( "routingStepName:" + routingStepName ); - // info( "operationId:" + operationId ); - if( guard( item.Line(), "" ).Length() > 0 ) { - unitId := unitId + "_" + item.Line(); - operationId := operationId + "_" + item.Line() - } - routing := Routing::CreateOrUpdate( this, routingId ); - if( routingList.Find( routing ) < 0 ) { - routingList.Add( routing ); - } - // 鍒犻櫎steps(units鍏崇郴銆乷perations涔熶細鍒犻櫎) - if( dealtRoutingIds.Find( routingId ) < 0 ) { - toDeleteSteps := selectset( routing, RoutingStep, routingStep, true ); - RoutingStep::Delete( toDeleteSteps ); - dealtRoutingIds.Add( routingId ); - } - // RoutingStep - routingStep := RoutingStep::FindByName( routing, routingStepName ); - if( isnull( routingStep ) ) { - routingStep := RoutingStep::Create( routing, routingStepName, "", true ); - } - // UnitOfMeasure - unitOfMeasure := UnitOfMeasure_MP::FindByName( this, item.UnitOfMeasureName() ); - if( isnull( unitOfMeasure ) ) { - error( "unit of measure [" + item.UnitOfMeasureName() + "] not found for routing [" + routingId + "]" ); - } - // Unit - unit := Unit::FindById( this, unitId ); - if( isnull( unit ) ) { - unit := this.Unit( relnew, - ID := unitId, Name := unitId, CapacityType := "Infinite", - DefaultGridX := 0, DefaultGridY := 0, - IsManuallyConfigured := false, - Currency_MP := this.BaseCurrency(), UnitOfMeasure_MP := unitOfMeasure ); - } - // Operation - haveMaxQty := item.MaximumQuantity() <> 0.0; - op := Operation::FindOperationTypeIndex( operationId ); - if( isnull( op)){ - op := Operation::Create( operationId, unit, operationId, routingStep, - Duration::Hours( item.UserLeadTime() ), Duration::Zero(), item.ActualCapacity(), false, - [Real]item.MinimumQuantity(), haveMaxQty, guard( [Real]item.MaximumQuantity(), Real::MaxReal() ), - 0.0, 0.0, false, true ); - } - - ManufactureLTProcessSection::CreateOrUpdate( op ); - } - info( "========" ) - // 閬嶅巻routing锛岃繘琛宭ink - lastStep := null( RoutingStep ); - traverse( routingList, Elements.RoutingStep, step ) { - // 鍚屽伐鑹鸿矾绾挎椂杩炴帴 - if( not isnull( lastStep ) and lastStep.Routing() = step.Routing() ) { - toLink := construct( RoutingSteps ); - toLink.Add( lastStep ); - // todo 瀛樼枒 - step.LinkOperations( toLink ); - } - lastStep := step; - } + //// yypsybs Aug-18-2023 (created) + //// 鑾峰彇鏈夊簭鐨勫緟澶勭悊璁板綍 + //toDealList := construct( MappingOperations ); + //if( not isnull( businessTypes ) and businessTypes.Size() > 0 ) { + // toDealList := selectsortedset( this, MappingOperation, item, + //// businessTypes.Find( item.BusinessType() ) >= 0, + // businessTypes.Difference( businessTypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0, + // item.SequenceNumber() ); + //} else { + // toDealList := selectsortedset( this, MappingOperation, item, + // true, + // item.SequenceNumber() ); + //} + //// 閫愭潯澶勭悊锛岄娆″鐞嗘椂鍒犻櫎steps + //dealtRoutingIds := construct( Strings ); + //routingList := construct( Routings ); + //traverse( toDealList, Elements, item ) { + // routingId := item.OrganCode() + "_" + item.ProductID(); + // unitId := item.OrganCode() + "_" + item.PlantName() + "_" + item.ProcessSection(); + // routingStepName := item.ProcessSection() + "_" + [String]item.SequenceNumber(); + // operationId := item.OrganCode() + "_" + item.ProductID() + "_" + item.ProcessSection(); + //// info( "========" ) + //// info( "routingId:" + routingId ); + //// info( "unitId:" + unitId ); + //// info( "routingStepName:" + routingStepName ); + //// info( "operationId:" + operationId ); + // if( guard( item.Line(), "" ).Length() > 0 ) { + // unitId := unitId + "_" + item.Line(); + // operationId := operationId + "_" + item.Line() + // } + // routing := Routing::CreateOrUpdate( this, routingId ); + // if( routingList.Find( routing ) < 0 ) { + // routingList.Add( routing ); + // } + // // 鍒犻櫎steps(units鍏崇郴銆乷perations涔熶細鍒犻櫎) + // if( dealtRoutingIds.Find( routingId ) < 0 ) { + // toDeleteSteps := selectset( routing, RoutingStep, routingStep, true ); + // RoutingStep::Delete( toDeleteSteps ); + // dealtRoutingIds.Add( routingId ); + // } + // // RoutingStep + // routingStep := RoutingStep::FindByName( routing, routingStepName ); + // if( isnull( routingStep ) ) { + // routingStep := RoutingStep::Create( routing, routingStepName, "", true ); + // } + // // UnitOfMeasure + // unitOfMeasure := UnitOfMeasure_MP::FindByName( this, item.UnitOfMeasureName() ); + // if( isnull( unitOfMeasure ) ) { + // error( "unit of measure [" + item.UnitOfMeasureName() + "] not found for routing [" + routingId + "]" ); + // } + // // Unit + // unit := Unit::FindById( this, unitId ); + // if( isnull( unit ) ) { + // unit := this.Unit( relnew, + // ID := unitId, Name := unitId, CapacityType := "Infinite", + // DefaultGridX := 0, DefaultGridY := 0, + // IsManuallyConfigured := false, + // Currency_MP := this.BaseCurrency(), UnitOfMeasure_MP := unitOfMeasure ); + // } + // // Operation + // haveMaxQty := item.MaximumQuantity() <> 0.0; + // op := Operation::FindOperationTypeIndex( operationId ); + // if( isnull( op)){ + // op := Operation::Create( operationId, unit, operationId, routingStep, + // Duration::Hours( item.UserLeadTime() ), Duration::Zero(), item.ActualCapacity(), false, + // [Real]item.MinimumQuantity(), haveMaxQty, guard( [Real]item.MaximumQuantity(), Real::MaxReal() ), + // 0.0, 0.0, false, true ); + // } + // + // ManufactureLTProcessSection::CreateOrUpdate( op ); + //} + //info( "========" ) + //// 閬嶅巻routing锛岃繘琛宭ink + //lastStep := null( RoutingStep ); + //traverse( routingList, Elements.RoutingStep, step ) { + // // 鍚屽伐鑹鸿矾绾挎椂杩炴帴 + // if( not isnull( lastStep ) and lastStep.Routing() = step.Routing() ) { + // toLink := construct( RoutingSteps ); + // toLink.Add( lastStep ); + // // todo 瀛樼枒 + // step.LinkOperations( toLink ); + // } + // lastStep := step; + //} *] } -- Gitblit v1.9.3