xiaoding721
2024-09-03 2216fba3cc0585064f370ae8348bf6b90ef99e5a
_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl
@@ -42,6 +42,15 @@
    localCells := construct( LocalCell_ScheduleSummarys );
    localCellIndexTree := NamedValueTree::Create();
    
    units := selectset( owner,Unit,unit,unit.HasCapacityTypeTime() and not unit.HasChild());
    unitIndexTree := NamedValueTree::Create();
    for( i := 0 ; i< units.Size() ; i++ ){
      unit := units.Element( i );
      unitHandle := unitIndexTree.GetHandle( unit.ID() );
      unitIndexTree.Root().AddChild( unitHandle,i );
    }
    //shiftPatternCount := NamedValueTree::Create();
    traverse( tables,Elements.MP_Row,row ){
       rowMacroPlan := row.MP_Table().MacroPlan();
@@ -63,14 +72,27 @@
                              cell.MP_Column().CustomDate() >= localColumn.CustomDate() and 
                              cell.MP_Column().CustomDate() < localColumn.CustomDate().StartOfNextMonth() );
          
          output := 0.0;
          isFuture := owner.StartOfPlanning().Date() >= localColumn.CustomDate();
          
          scheduleSummaryOutputDataKey := row.Name() + localColumn.CustomDate().AsQUILL();
          scheduleSummaryOutputDataHandle := scheduleSummaryOutputDataIndexTree.GetHandle( scheduleSummaryOutputDataKey );
          scheduleSummaryOutputDataIndex := guard( scheduleSummaryOutputDataIndexTree.Root().Child( scheduleSummaryOutputDataHandle ),null( NamedValue ));
          if( not isnull( scheduleSummaryOutputDataIndex )){
            scheduleSummaryOutputData := scheduleSummaryOutputDatas.Element( scheduleSummaryOutputDataIndex.GetValueAsNumber() );
            output := scheduleSummaryOutputData.Output();
          output := 0.0;
          if( isFuture ){
            unitHandle := unitIndexTree.GetHandle( row.Name() );
            unitIndex := guard( unitIndexTree.Root().Child( unitHandle ),null( NamedValue ));
            if( not isnull( unitIndex )){
              unit := units.Element( unitIndex.GetValueAsNumber() );
              output := sum( unit,UnitPeriod.PeriodTask_MP.NewSupply,np,
                             np.PeriodTask_MP().UnitPeriod().StartDate() >= localColumn.CustomDate() and
                             np.PeriodTask_MP().UnitPeriod().StartDate() < localColumn.CustomDate(),
                             np.Quantity() );
            }
          }else{
            scheduleSummaryOutputDataKey := row.Name() + localColumn.CustomDate().AsQUILL();
            scheduleSummaryOutputDataHandle := scheduleSummaryOutputDataIndexTree.GetHandle( scheduleSummaryOutputDataKey );
            scheduleSummaryOutputDataIndex := guard( scheduleSummaryOutputDataIndexTree.Root().Child( scheduleSummaryOutputDataHandle ),null( NamedValue ));
            if( not isnull( scheduleSummaryOutputDataIndex )){
              scheduleSummaryOutputData := scheduleSummaryOutputDatas.Element( scheduleSummaryOutputDataIndex.GetValueAsNumber() );
              output := scheduleSummaryOutputData.Output();
            }
          }
          
          maxShiftPattern := "";
@@ -115,7 +137,9 @@
            }
          }
          
          localCell.ShiftPattern( maxShiftPattern );
          if( not maxShiftPattern = "" ){
            localCell.ShiftPattern( maxShiftPattern );
          }
          localCell.WorkingDay( localCell.WorkingDay() + workingDay );
          localCell.Capacity( localCell.Capacity() + capacity );
          localCell.Output( localCell.Output() + output );