Quintiq file version 2.0
|
#parent: #root
|
StaticMethod Archive (
|
const MacroPlan macroPlan,
|
Archive archive
|
)
|
{
|
TextBody:
|
[*
|
// Akari Oct-23-2024 (created)
|
archiveShiftPlanCells := selectset( archive,ArchiveShiftPlanRow.ArchiveShiftPlanCell,cell,true );
|
archiveShiftPlanCellIndexTree := NamedValueTree::Create();
|
for( i := 0; i < archiveShiftPlanCells.Size(); i++ ){
|
archiveShiftPlanCell := archiveShiftPlanCells.Element( i );
|
archiveShiftPlanRow := archiveShiftPlanCell.ArchiveShiftPlanRow();
|
archiveShiftPlanColumn := archiveShiftPlanCell.ArchiveShiftPlanColumn();
|
|
archiveShiftPlanRowKey := archiveShiftPlanRow.UnitID();
|
archiveShiftPlanColumnKey := archiveShiftPlanColumn.StartDate().AsQUILL();
|
archiveShiftPlanCellKey := archiveShiftPlanRowKey + archiveShiftPlanColumnKey;
|
archiveShiftPlanCellHandle := archiveShiftPlanCellIndexTree.GetHandle( archiveShiftPlanCellKey );
|
|
archiveShiftPlanCellIndexTree.Root().AddChild( archiveShiftPlanCellHandle,i );
|
}
|
|
archiveShiftPlanRows := selectset( archive,ArchiveShiftPlanRow,row,true );
|
archiveShiftPlanRowIndexTree := NamedValueTree::Create();
|
for( i := 0; i < archiveShiftPlanRows.Size(); i++ ){
|
archiveShiftPlanRow := archiveShiftPlanRows.Element( i );
|
archiveShiftPlanRowKey := archiveShiftPlanRow.UnitID();
|
archiveShiftPlanRowHandle := archiveShiftPlanRowIndexTree.GetHandle( archiveShiftPlanRowKey );
|
archiveShiftPlanRowIndexTree.Root().AddChild( archiveShiftPlanRowHandle,i );
|
}
|
|
archiveShiftPlanColumns := selectset( archive,ArchiveShiftPlanColumn,row,true );
|
archiveShiftPlanColumnIndexTree := NamedValueTree::Create();
|
for( i := 0; i < archiveShiftPlanColumns.Size(); i++ ){
|
archiveShiftPlanColumn := archiveShiftPlanColumns.Element( i );
|
archiveShiftPlanColumnKey := archiveShiftPlanColumn.StartDate().AsQUILL();
|
archiveShiftPlanColumnHandle := archiveShiftPlanColumnIndexTree.GetHandle( archiveShiftPlanColumnKey );
|
archiveShiftPlanColumnIndexTree.Root().AddChild( archiveShiftPlanColumnHandle,i );
|
}
|
|
traverse( macroPlan,Unit.UnitPeriod.astype( UnitPeriodTime ).ShiftPlan,shiftPlanCell,shiftPlanCell.UnitPeriodTime().Period_MP().StartDate() >= macroPlan.StartOfPlanning().Date() ){
|
shiftPlanRow := shiftPlanCell.UnitPeriodTime().Unit();
|
shiftPlanColumn := shiftPlanCell.UnitPeriodTime().Period_MP();
|
shiftPlanRowKey := shiftPlanRow.ID();
|
shiftPlanColumnKey := shiftPlanColumn.StartDate().AsQUILL();
|
shiftPlanCellKey := shiftPlanRowKey + shiftPlanColumnKey;
|
|
archiveShiftPlanCell := null( ArchiveShiftPlanCell );
|
archiveShiftPlanCellHandle := archiveShiftPlanCellIndexTree.GetHandle( shiftPlanCellKey );
|
archiveShiftPlanCellIndex := guard( archiveShiftPlanCellIndexTree.Root().Child( archiveShiftPlanCellHandle ),null( NamedValue ) );
|
if( isnull( archiveShiftPlanCellIndex )){
|
factory := LocalTool::GetFactoryByUnit( shiftPlanCell.UnitPeriodTime().Unit() );
|
|
archiveShiftPlanRow := null( ArchiveShiftPlanRow );
|
archiveShiftPlanRowHandle := archiveShiftPlanRowIndexTree.GetHandle( shiftPlanRowKey );
|
archiveShiftPlanRowIndex := guard( archiveShiftPlanRowIndexTree.Root().Child( archiveShiftPlanRowHandle ),null( NamedValue ));
|
if( isnull( archiveShiftPlanRowIndex )){
|
archiveShiftPlanRow := archive.ArchiveShiftPlanRow( relnew,UnitID := shiftPlanRow.ID() );
|
archiveShiftPlanRows.Add( archiveShiftPlanRow );
|
archiveShiftPlanRowIndexTree.Root().AddChild( archiveShiftPlanRowHandle,archiveShiftPlanRows.Size() - 1 );
|
}else{
|
archiveShiftPlanRow := archiveShiftPlanRows.Element( archiveShiftPlanRowIndex.GetValueAsNumber() );
|
}
|
|
archiveShiftPlanRow.FactoryName( factory.ID() );
|
|
archiveShiftPlanColumn := null( ArchiveShiftPlanColumn );
|
archiveShiftPlanColumnHandle := archiveShiftPlanColumnIndexTree.GetHandle( shiftPlanColumnKey );
|
archiveShiftPlanColumnIndex := guard( archiveShiftPlanColumnIndexTree.Root().Child( archiveShiftPlanColumnHandle ),null( NamedValue ));
|
if( isnull( archiveShiftPlanColumnIndex )){
|
archiveShiftPlanColumn := archive.ArchiveShiftPlanColumn( relnew,StartDate := shiftPlanColumn.StartDate() );
|
archiveShiftPlanColumns.Add( archiveShiftPlanColumn );
|
archiveShiftPlanColumnIndexTree.Root().AddChild( archiveShiftPlanColumnHandle,archiveShiftPlanColumns.Size() - 1 );
|
}else{
|
archiveShiftPlanColumn := archiveShiftPlanColumns.Element( archiveShiftPlanColumnIndex.GetValueAsNumber() );
|
}
|
|
archiveShiftPlanCell := archiveShiftPlanRow.ArchiveShiftPlanCell( relnew,ArchiveShiftPlanColumn := archiveShiftPlanColumn );
|
archiveShiftPlanCells.Add( archiveShiftPlanCell );
|
archiveShiftPlanCellIndexTree.Root().AddChild( archiveShiftPlanCellHandle,archiveShiftPlanCells.Size() - 1 );
|
}else{
|
archiveShiftPlanCell := archiveShiftPlanCells.Element( archiveShiftPlanCellIndex.GetValueAsNumber());
|
}
|
|
archiveShiftPlanCell.EventType( shiftPlanCell.EventType());
|
archiveShiftPlanCell.IsHoliday( shiftPlanCell.IsHoliday() );
|
archiveShiftPlanCell.Outcome( shiftPlanCell.Outcome() );
|
archiveShiftPlanCell.Remark( shiftPlanCell.Remark() );
|
archiveShiftPlanCell.MacroPlanName( shiftPlanCell.UnitPeriodTime().MacroPlan().MDSMacroPlan().Description() );
|
archiveShiftPlanCell.MacroPlanMDSID( shiftPlanCell.UnitPeriodTime().MacroPlan().MDSID() );
|
}
|
*]
|
}
|