| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | StaticMethod Dispatch |
| | | StaticMethod Dispatch ( |
| | | Date startDate, |
| | | Date endDate, |
| | | const OfflinePlanTable offlinePlan, |
| | | RecycleBin owner |
| | | ) |
| | | { |
| | | TextBody: |
| | | [* |
| | | // Akari Sep-4-2024 (created) |
| | | owner.DispatchShiftSchedulingInformation( relflush ); |
| | | macroPlan := offlinePlan.MacroPlan(); |
| | | now := DateTime::Now(); |
| | | |
| | | shiftPatterns := selectset( macroPlan,ShiftPattern,object,true ); |
| | | shiftPatternIndexTree := NamedValueTree::Create(); |
| | | for( i := 0; i < shiftPatterns.Size(); i++){ |
| | | shiftPattern := shiftPatterns.Element( i ); |
| | | shiftPatternHandle := shiftPatternIndexTree.GetHandle( shiftPattern.Name() ); |
| | | shiftPatternIndexTree.Root().AddChild( shiftPatternHandle,i ); |
| | | } |
| | | |
| | | units := selectset( macroPlan,Unit,object, true ); |
| | | unitIndexTree := NamedValueTree::Create(); |
| | | for( i := 0; i < units.Size(); i++){ |
| | | unit := units.Element( i ); |
| | | unitHandle := unitIndexTree.GetHandle( unit.Name() ); |
| | | unitIndexTree.Root().AddChild( unitHandle,i ); |
| | | } |
| | | |
| | | traverse( offlinePlan,OfflinePlanRow,row ){ |
| | | productID := row.ProductID(); |
| | | productLine := row.ProductionLine(); |
| | | factory := constnull( Unit ); |
| | | { |
| | | unitHandle := unitIndexTree.GetHandle( productLine ); |
| | | unitIndex := guard( unitIndexTree.Root().Child( unitHandle ), null( NamedValue )); |
| | | if( not isnull( unitIndex )){ |
| | | unit := units.Element( unitIndex.GetValueAsNumber() ); |
| | | temp1 := unit; |
| | | temp2 := unit.Parent(); |
| | | while( not isnull( temp1.Parent())){ |
| | | temp2 := temp1; |
| | | temp1 := temp1.Parent(); |
| | | } |
| | | factory := temp2; |
| | | } |
| | | } |
| | | traverse( row,OfflinePlanCell,cell ,startDate <= cell.OfflinePlanColumn().ColumnDate() and endDate > cell.OfflinePlanColumn().ColumnDate()){ |
| | | shiftDate := cell.OfflinePlanColumn().ColumnDate(); |
| | | shiftName := cell.Shift(); |
| | | shiftVolume := cell.Quantity(); |
| | | shiftDayTime := constnull( ShiftDayTime ); |
| | | { |
| | | shiftPatternHandle := shiftPatternIndexTree.GetHandle( shiftName ); |
| | | shiftPatternIndex := guard( shiftPatternIndexTree.Root().Child( shiftPatternHandle ),null( NamedValue )); |
| | | if( not isnull( shiftPatternIndex )){ |
| | | shiftPattern := shiftPatterns.Element( shiftPatternIndex.GetValueAsNumber() ); |
| | | shiftDayTime := select( shiftPattern,ShiftDayTime,object,true ); |
| | | } |
| | | } |
| | | |
| | | shiftSchedulingInformation := owner.DispatchShiftSchedulingInformation( relnew , |
| | | ID := IDHolder::GetGUID() , |
| | | InterfaceTime := now , |
| | | VersionName := macroPlan.MDSMacroPlan().Description(), |
| | | Product := productID, |
| | | ProductLine := productLine, |
| | | ShiftDate := shiftDate, |
| | | ShiftName := shiftName, |
| | | ShiftVolume := shiftVolume ); |
| | | if( not isnull( shiftDayTime )){ |
| | | shiftSchedulingInformation.ShiftStartDate( shiftDayTime.StartDateTime() ); |
| | | shiftSchedulingInformation.ShiftEndDate( shiftDayTime.EndDateTIme() ); |
| | | } |
| | | if( not isnull( factory )){ |
| | | shiftSchedulingInformation.FactoryName( factory.Name() ); |
| | | } |
| | | } |
| | | } |
| | | *] |
| | | } |