| | |
| | | [* |
| | | // Akari Oct-10-2024 (created) |
| | | owner := unit.MacroPlan(); |
| | | |
| | | saveDays := construct( Dates ); |
| | | flag := startDate.StartOfNextWeek(); |
| | | for( i := startDate; i<endDate; i := i + 1 ){ |
| | | if( i < flag ){ |
| | | saveDays.Add( i ); |
| | | }else{ |
| | | temp := skipWeek - 1; |
| | | while( temp > 0 ){ |
| | | i := flag; |
| | | flag := i.StartOfNextWeek(); |
| | | temp--; |
| | | |
| | | info( i.Format( "Y-M2-D2") ); |
| | | info( flag.Format( "Y-M2-D2") ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | info( "----------------------------"); |
| | | |
| | | traverse( saveDays,Elements,element ){ |
| | | info( element.Format( "Y-M2-D2")); |
| | | } |
| | | |
| | | dayPeriod_MPs := selectsortedset( owner,Period_MP,period_MP, |
| | | period_MP.TimeUnit() = 'Day' and |
| | | period_MP.StartDate() >= startDate and |
| | |
| | | period_MP.StartDate() >= startDate and |
| | | period_MP.EndDate() <= endDate and exists( weekdays, Elements,dayOfWeek,dayOfWeek = period_MP.StartDate().DayOfWeek() ),period_MP.StartDate()); |
| | | |
| | | |
| | | if( dayPeriod_MPs.Size() > 0 ){ |
| | | unitPeriodTimes := selectset( unit,UnitPeriod.astype( UnitPeriodTime ),unitPeriodTime,exists( dayPeriod_MPs,Elements,period_MP,period_MP = unitPeriodTime.Period_MP())); |
| | | if( unitPeriodTimes.Size() > 0 ){ |
对比新文件 |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | StaticMethod BatchSetUnitShiftPattern ( |
| | | Unit unit, |
| | | ShiftPattern shiftPattern, |
| | | Date startDate, |
| | | Date endDate, |
| | | Number skipDay |
| | | ) |
| | | { |
| | | TextBody: |
| | | [* |
| | | // Akari Oct-10-2024 (created) |
| | | owner := unit.MacroPlan(); |
| | | |
| | | saveDays := construct( Dates ); |
| | | for( i := startDate; i < endDate; i := i + skipDay ){ |
| | | saveDays.Add( i ); |
| | | } |
| | | |
| | | |
| | | dayPeriod_MPs := selectsortedset( owner,Period_MP,period_MP, |
| | | period_MP.TimeUnit() = 'Day' and |
| | | period_MP.StartDate() >= startDate and |
| | | period_MP.EndDate() <= endDate and exists( saveDays, Elements,day,day = period_MP.StartDate()) ,period_MP.StartDate()); |
| | | weekPeriod_MPs := selectsortedset( owner,Period_MP,period_MP, |
| | | period_MP.TimeUnit() = 'Week' and |
| | | period_MP.StartDate() >= startDate and |
| | | period_MP.EndDate() <= endDate and exists( saveDays, Elements,day,day = period_MP.StartDate()) ,period_MP.StartDate()); |
| | | |
| | | |
| | | if( dayPeriod_MPs.Size() > 0 ){ |
| | | unitPeriodTimes := selectset( unit,UnitPeriod.astype( UnitPeriodTime ),unitPeriodTime,exists( dayPeriod_MPs,Elements,period_MP,period_MP = unitPeriodTime.Period_MP())); |
| | | if( unitPeriodTimes.Size() > 0 ){ |
| | | info( unitPeriodTimes.Size() ); |
| | | LocalTool::SetUnitShiftPattern( owner,unitPeriodTimes,shiftPattern ); |
| | | } |
| | | } |
| | | if( weekPeriod_MPs.Size() <> 0 ){ |
| | | unitPeriodTimes := selectset( unit,UnitPeriod.astype( UnitPeriodTime ),unitPeriodTime,exists( weekPeriod_MPs,Elements,period_MP,period_MP = unitPeriodTime.Period_MP())); |
| | | if( unitPeriodTimes.Size() > 0 ){ |
| | | LocalTool::SetUnitShiftPattern( owner,unitPeriodTimes,shiftPattern ); |
| | | } |
| | | } |
| | | *] |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | traverse( unitPeriodTimes,Elements,unitPeriodTime,isnull( unitPeriodTime.UnitAvailability())){ |
| | | // UnitAvailability::Create( unitPeriodTime.Unit(), |
| | | // unitPeriodTime.Start(), |
| | | // timeunit, |
| | | // maintenance, |
| | | // efficiency, |
| | | // allocation, |
| | | // shiftPattern, |
| | | // maxloadpercentage, |
| | | // nrofunitopen, |
| | | // minloadthreshold, |
| | | // true ); |
| | | unitPeriodTime.CalcUnitAvailability(); |
| | | } |
| | | |
| | | isbatchedit := unitPeriodTimes.Size() > 1; |
| | | UnitAvailability::CreateOrUpdateForUnitPeriodTimes( unitPeriodTimes, |
| | | not isbatchedit or false, |
| | |
| | | not isbatchedit or false, |
| | | minloadthreshold |
| | | ); |
| | | //UnitAvailability::CreateOrUpdateForUnitPeriodTimes( unitPeriodTimes, |
| | | // not isbatchedit or CheckBoxBatchEditMaintenance.Checked(), |
| | | // data.TimeUnit(), |
| | | // data.Maintenance(), |
| | | // not isbatchedit or CheckBoxBatchEditEfficiency.Checked(), |
| | | // data.Efficiency(), |
| | | // false, |
| | | // data.Allocation(), |
| | | // not isbatchedit or CheckBoxBatchEditShiftPattern.Checked(), |
| | | // data.ShiftPattern(), |
| | | // not isbatchedit or CheckBoxBatchEditMaxLoadPercentage.Checked(), |
| | | // data.MaximumLoadPercentage(), |
| | | // not isbatchedit or CheckBoxBatchEditNrOfUnitsOpen.Checked(), |
| | | // data.NrOfUnitsOpen(), |
| | | // DataHolderFromThisPeriodOnward.Data(), |
| | | // not isbatchedit or CheckBoxBatchEditMinimumLoadThreshold.Checked(), |
| | | // data.MinimumLoadThreshold() |
| | | // ); |
| | | *] |
| | | } |
| | |
| | | TextBody: |
| | | [* |
| | | // rislai Jun-9-2024 (created) |
| | | firstElement := minselect( unitPeriodTimes, Elements, e, true, e.Start() ); |
| | | |
| | | start := this.MacroPlan().Start(); |
| | | timeunit := this.MacroPlan().StartOfPlanningPeriod().TimeUnit(); |
| | | maintenance := Duration::Zero(); |
| | | efficiency := 1.0; |
| | | allocation := 1.0; |
| | | |
| | | maxloadpercentage := this.MacroPlan().GlobalParameters_MP().DefaultMaxLoadPercentage(); |
| | | nrofunitopen := 1; |
| | | minloadthreshold := 0.0; |
| | | |
| | | if( not isnull( firstElement ) ){ |
| | | // To inherit the value from last unit availability while creating a new unit availability |
| | | unitavailability := firstElement.UnitAvailability(); |
| | | start := firstElement.Start(); |
| | | |
| | | if( not isnull( unitavailability ) ){ |
| | | timeunit := unitavailability.TimeUnit(); |
| | | maintenance := unitavailability.Maintenance(); |
| | | efficiency := unitavailability.Efficiency(); |
| | | allocation := unitavailability.Allocation(); |
| | | |
| | | maxloadpercentage := unitavailability.MaximumLoadPercentage(); |
| | | nrofunitopen := unitavailability.NrOfUnitsOpen(); |
| | | minloadthreshold := unitavailability.MinimumLoadThreshold(); |
| | | }else{ |
| | | timeunit := firstElement.Period_MP().TimeUnit(); |
| | | maintenance := firstElement.Maintenance(); |
| | | efficiency := firstElement.Efficiency(); |
| | | allocation := firstElement.Allocation(); |
| | | |
| | | maxloadpercentage := firstElement.MaximumLoadPercentage(); |
| | | nrofunitopen := firstElement.NrOfOpen(); |
| | | minloadthreshold := firstElement.MinimumLoadThreshold(); |
| | | } |
| | | } |
| | | |
| | | isbatchedit := unitPeriodTimes.Size() > 1; |
| | | UnitAvailability::CreateOrUpdateForUnitPeriodTimes( unitPeriodTimes, |
| | | not isbatchedit or false, |
| | | timeunit, |
| | | maintenance, |
| | | not isbatchedit or false, |
| | | efficiency, |
| | | false, |
| | | allocation, |
| | | not isbatchedit or true, |
| | | shiftPattern, |
| | | not isbatchedit or false, |
| | | maxloadpercentage, |
| | | not isbatchedit or false, |
| | | nrofunitopen, |
| | | false, |
| | | not isbatchedit or false, |
| | | minloadthreshold |
| | | ); |
| | | |
| | | //UnitAvailability::CreateOrUpdateForUnitPeriodTimes( unitPeriodTimes, |
| | | // not isbatchedit or CheckBoxBatchEditMaintenance.Checked(), |
| | | // data.TimeUnit(), |
| | | // data.Maintenance(), |
| | | // not isbatchedit or CheckBoxBatchEditEfficiency.Checked(), |
| | | // data.Efficiency(), |
| | | // false, |
| | | // data.Allocation(), |
| | | // not isbatchedit or CheckBoxBatchEditShiftPattern.Checked(), |
| | | // data.ShiftPattern(), |
| | | // not isbatchedit or CheckBoxBatchEditMaxLoadPercentage.Checked(), |
| | | // data.MaximumLoadPercentage(), |
| | | // not isbatchedit or CheckBoxBatchEditNrOfUnitsOpen.Checked(), |
| | | // data.NrOfUnitsOpen(), |
| | | // DataHolderFromThisPeriodOnward.Data(), |
| | | // not isbatchedit or CheckBoxBatchEditMinimumLoadThreshold.Checked(), |
| | | // data.MinimumLoadThreshold() |
| | | // ); |
| | | LocalTool::SetUnitShiftPattern( this.MacroPlan(),unitPeriodTimes,shiftPattern ); |
| | | *] |
| | | } |
| | |
| | | [* |
| | | |
| | | skipDay := [Number]efDaily.Text(); |
| | | // LocalTool::BatchSetUnitShiftPattern( dhSelectUnit.Data(),ddlShiftPattern.Data(),dsStartDate.Date(),dsEndDate.Date(),weekdays ,skipWeek ); |
| | | LocalTool::BatchSetUnitShiftPattern( dhSelectUnit.Data(),ddlShiftPattern.Data(),dsStartDate.Date(),dsEndDate.Date() ,skipDay ); |
| | | WebMessageBox::Success( "Success"); |
| | | *] |
| | | } |
| | |
| | | { |
| | | forms |
| | | { |
| | | form_legacy_2 |
| | | { |
| | | title: 'Time Capacities' |
| | | shown: true |
| | | componentID: 'FormTimeCapacities' |
| | | layout |
| | | { |
| | | mode: 'open' |
| | | rowPosition: 13 |
| | | rowSpan: 10 |
| | | columnPosition: 1 |
| | | columnSpan: 12 |
| | | } |
| | | components |
| | | { |
| | | FormTimeCapacities_PanelMatrix |
| | | { |
| | | sizeRatio: 1 |
| | | } |
| | | FormTimeCapacities_MatrixEditorTimeCapacities |
| | | { |
| | | gridColor: '#c4c4c4' |
| | | totalHeaderWidth: 449 |
| | | attributeHeaderWidthRatio: 0.6 |
| | | nameHeaderWidthRatio: 0.4 |
| | | columnWidth: 100 |
| | | horizontalGrid: true |
| | | verticalGrid: true |
| | | backendState |
| | | { |
| | | componentId: 'QLibMacroPlannerWebUI::FormTimeCapacities.MatrixEditorTimeCapacities' |
| | | state |
| | | { |
| | | cells |
| | | { |
| | | attributes |
| | | { |
| | | attribute_ShiftPatternName |
| | | { |
| | | type: 'MatrixEditorWebApiCellDataModelInterest' |
| | | index: 0 |
| | | rowsubtotal: '' |
| | | columnsubtotal: '' |
| | | attribute: 'ShiftPatternName' |
| | | } |
| | | attribute_Efficiency |
| | | { |
| | | type: 'MatrixEditorWebApiCellDataModelInterest' |
| | | index: 1 |
| | | rowsubtotal: '' |
| | | columnsubtotal: '' |
| | | attribute: 'Efficiency' |
| | | } |
| | | attribute_TotalAvailableCapacity |
| | | { |
| | | type: 'MatrixEditorWebApiCellDataModelInterest' |
| | | index: 2 |
| | | rowsubtotal: '' |
| | | columnsubtotal: '' |
| | | attribute: 'TotalAvailableCapacity' |
| | | } |
| | | } |
| | | } |
| | | columns |
| | | { |
| | | sorting |
| | | { |
| | | criteria: "datamember:'StartDate'" |
| | | } |
| | | } |
| | | rows |
| | | { |
| | | sorting |
| | | { |
| | | criteria: "datamember:'DisplayIndex'" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | form_FormProductionLineBatchSetShiftPattern |
| | | { |
| | | title: 'QMacroPlanner::FormProductionLineBatchSetShiftPattern' |
| | |
| | | { |
| | | mode: 'open' |
| | | rowPosition: 1 |
| | | rowSpan: 23 |
| | | rowSpan: 12 |
| | | columnPosition: 1 |
| | | columnSpan: 9 |
| | | columnSpan: 10 |
| | | } |
| | | components |
| | | { |
| | |
| | | { |
| | | sizeRatio: 1 |
| | | } |
| | | FormProductionLineBatchSetShiftPattern_PanelRight445 |
| | | { |
| | | sizeRatio: 1 |
| | | activeChild: 'PanelWeekly' |
| | | } |
| | | FormProductionLineBatchSetShiftPattern_PanelDaily |
| | | { |
| | | sizeRatio: 1 |
| | | } |
| | | FormProductionLineBatchSetShiftPattern_PanelDaily819 |
| | | { |
| | | sizeRatio: 1 |
| | | } |
| | | FormProductionLineBatchSetShiftPattern_PanelWeekly |
| | | { |
| | | sizeRatio: 1 |
| | | } |
| | | FormProductionLineBatchSetShiftPattern_PanelWeekly996 |
| | | { |
| | | sizeRatio: 1 |
| | | } |
| | | } |
| | | } |
| | | form_FormKPI |
| | |
| | | FormProductionLineBatchData_DataSetLevelProductionLineBatchData |
| | | { |
| | | groupDepth: -1 |
| | | sort: 'StartDate' |
| | | sort: 'DESC:Unit3.Name' |
| | | column_ImageIsEnable |
| | | { |
| | | columnId: 'ImageIsEnable' |
| | |
| | | subtotals: '' |
| | | width: 150 |
| | | } |
| | | column_Unit3_Name |
| | | { |
| | | columnId: 'Unit3.Name' |
| | | dataPath: 'Unit3.Name' |
| | | dataType: 'string' |
| | | index: 5 |
| | | subtotals: '' |
| | | width: 150 |
| | | } |
| | | column_ShiftPattern1_Name |
| | | { |
| | | columnId: 'ShiftPattern1.Name' |
| | | dataPath: 'ShiftPattern1.Name' |
| | | dataType: 'string' |
| | | index: 5 |
| | | index: 6 |
| | | subtotals: '' |
| | | width: 112 |
| | | } |
| | |
| | | columnId: 'ShiftPattern2.Name' |
| | | dataPath: 'ShiftPattern2.Name' |
| | | dataType: 'string' |
| | | index: 6 |
| | | index: 7 |
| | | subtotals: '' |
| | | width: 112 |
| | | } |
| | | column_ShiftPattern3_Name |
| | | { |
| | | columnId: 'ShiftPattern3.Name' |
| | | dataPath: 'ShiftPattern3.Name' |
| | | dataType: 'string' |
| | | index: 8 |
| | | subtotals: '' |
| | | width: 150 |
| | | } |
| | | } |
| | | } |
| | | } |