Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method UnifiedProcessingOfRoundingLogic ( 
 | 
  Real unifiedProcessingTimeOfRounding, 
 | 
  UnitPeriodTimeBase sourceUnitPeriodTimeBase, 
 | 
  PeriodTaskOperation periodTaskOperation, 
 | 
  MacroPlan macroPlan 
 | 
) 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    sourcePeriodTaskOperation := select( sourceUnitPeriodTimeBase, PeriodTaskOperation, tempOTO, tempOTO.Operation() = periodTaskOperation.Operation() ); 
 | 
         
 | 
    if ( isnull( sourcePeriodTaskOperation ) ) { 
 | 
      debuginfo( "源产能周期不存在目标周期任务" ); 
 | 
      periodTaskOperation.Update( periodTaskOperation.Quantity() - ( periodTaskOperation.Operation().Throughput() * unifiedProcessingTimeOfRounding ), false ); 
 | 
      sourcePeriodTaskOperation := PeriodTaskOperation::Create( periodTaskOperation.Operation(), sourceUnitPeriodTimeBase, periodTaskOperation.Operation().Throughput() * unifiedProcessingTimeOfRounding, false ); 
 | 
      Transaction::Transaction().Propagate(); 
 | 
           
 | 
    //  info( "新创建的周期任务有几个需求:", sourcePeriodTaskOperation.DependentDemand( relsize ), "    周期任务ID为:", sourcePeriodTaskOperation.Key().AsQUILL() ); 
 | 
      traverse ( sourcePeriodTaskOperation, DependentDemand, dd, true ) { 
 | 
        targetDependentDemand := select( periodTaskOperation, DependentDemand, tempDD, tempDD.ProcessInput().astype( OperationInput ).Name() = dd.ProcessInput().astype( OperationInput ).Name() ); 
 | 
        targetTempDependentDemandInputGroup := select( macroPlan, TempDependentDemandInputGroup, tempTDDIG, tempTDDIG.ID() = guard( targetDependentDemand.Key().AsQUILL(), "" ) ); 
 | 
        if ( not isnull( targetTempDependentDemandInputGroup ) ) { 
 | 
    //      info( "创建了依赖需求,ID为:", dd.Key().AsQUILL() ); 
 | 
          macroPlan.TempDependentDemandInputGroup( relnew, ID                    := dd.Key().AsQUILL(), 
 | 
                                                           Divisor               := targetTempDependentDemandInputGroup.Divisor(), 
 | 
                                                           UnitID                := targetTempDependentDemandInputGroup.UnitID(), 
 | 
                                                           ProductInStockingName := targetTempDependentDemandInputGroup.ProductInStockingName() ); 
 | 
        } 
 | 
      } 
 | 
      Transaction::Transaction().Propagate(); 
 | 
    } else { 
 | 
      debuginfo( "源产能周期存在目标周期任务" ); 
 | 
      periodTaskOperation.Update( periodTaskOperation.Quantity() - ( periodTaskOperation.Operation().Throughput() * unifiedProcessingTimeOfRounding ), false ); 
 | 
      sourcePeriodTaskOperation.Update( sourcePeriodTaskOperation.Quantity() + ( sourcePeriodTaskOperation.Operation().Throughput() * unifiedProcessingTimeOfRounding ), false ); 
 | 
      Transaction::Transaction().Propagate(); 
 | 
    } 
 | 
  *] 
 | 
} 
 |