¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | StaticMethod AddMonthByYYYYMM ( |
| | | Number data, |
| | | Number addMonthNumber |
| | | ) as Number |
| | | { |
| | | TextBody: |
| | | [* |
| | | // Akari Dec-6-2024 (created) |
| | | stringData := [String]data; |
| | | if( stringData.Length() <> 6 ){ |
| | | error( "wrong date: " + [String]data ); |
| | | } |
| | | year := [Number]stringData.SubString( 0,4 ); |
| | | month := [Number]stringData.SubString( 4,2 ); |
| | | |
| | | while( addMonthNumber >= 12 ){ |
| | | addMonthNumber := addMonthNumber - 12; |
| | | year := year + 1; |
| | | } |
| | | |
| | | if( month + addMonthNumber > 12 ){ |
| | | year := year + 1; |
| | | month := month + addMonthNumber - 12; |
| | | }else{ |
| | | month := month + addMonthNumber; |
| | | } |
| | | |
| | | result := [String]year; |
| | | |
| | | if( month < 10 ){ |
| | | result := result + "0" + [String]month; |
| | | }else{ |
| | | result := result + [String]month; |
| | | } |
| | | |
| | | return [Number]result; |
| | | *] |
| | | } |
| | |
| | | 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, |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | StaticMethod BatchSetUnitShiftPatternByMonth ( |
| | | Unit unit, |
| | | ShiftPattern shiftPattern, |
| | | Date startDate, |
| | | Date endDate, |
| | | Number skipMonth |
| | | ) |
| | | { |
| | | TextBody: |
| | | [* |
| | | // Akari Oct-10-2024 (created) |
| | | owner := unit.MacroPlan(); |
| | | |
| | | saveMonths := construct( Numbers ); |
| | | |
| | | for( i := LocalTool::GetYYYYMM( startDate ); i < LocalTool::GetYYYYMM( endDate ) ; i := LocalTool::AddMonthByYYYYMM( i,skipMonth ) ){ |
| | | |
| | | saveMonths.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( saveMonths, Elements,month,month = LocalTool::GetYYYYMM( 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( saveMonths, Elements,month,month = LocalTool::GetYYYYMM( period_MP.StartDate() )) ,period_MP.StartDate()); |
| | | monthPeriod_MPs := selectsortedset( owner,Period_MP,period_MP, |
| | | period_MP.TimeUnit() = 'Month' and |
| | | period_MP.StartDate() >= startDate and |
| | | period_MP.EndDate() <= endDate and exists( saveMonths, Elements,month,month = LocalTool::GetYYYYMM( 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 ); |
| | | } |
| | | } |
| | | if( monthPeriod_MPs.Size() <> 0 ){ |
| | | unitPeriodTimes := selectset( unit,UnitPeriod.astype( UnitPeriodTime ),unitPeriodTime,exists( monthPeriod_MPs,Elements,period_MP,period_MP = unitPeriodTime.Period_MP())); |
| | | if( unitPeriodTimes.Size() > 0 ){ |
| | | LocalTool::SetUnitShiftPattern( owner,unitPeriodTimes,shiftPattern ); |
| | | } |
| | | } |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | StaticMethod GetYYYYMM ( |
| | | Date date |
| | | ) as Number |
| | | { |
| | | TextBody: |
| | | [* |
| | | // Akari Dec-6-2024 (created) |
| | | year := date.Year(); |
| | | month := date.Month(); |
| | | |
| | | result := [String]year; |
| | | |
| | | if( month < 10 ){ |
| | | result := result + "0" + [String]month; |
| | | }else{ |
| | | result := result + [String]month; |
| | | } |
| | | |
| | | return [Number]result; |
| | | *] |
| | | } |
| | |
| | | localTable := recycleBin.LocalTable( relnew,Name := ArchiveCell_ScheduleSummary::GetTableName() ); |
| | | |
| | | // è·åå¼å§æ¶é´åç»ææ¶é´ |
| | | startDate := minselect( archive,ActualDailyProductionData,data,data.ProductionDate() ).ProductionDate(); |
| | | startDate := Date::Construct( Date::ActualDate().Year() - 1, 6, 1 ); |
| | | { |
| | | minActualDailyProductionDataDate := guard( minselect( archive,ActualDailyProductionData,data,data.ProductionDate() ).ProductionDate(),Date::MaxDate() ); |
| | | minArchiveShiftPlanDate := guard( minselect( archive,ArchiveShiftPlanColumn,data,data.StartDate()).StartDate(),Date::MaxDate() ); |
| | | if( minActualDailyProductionDataDate <> Date::MaxDate() or minArchiveShiftPlanDate <> Date::MaxDate() ){ |
| | | if( minArchiveShiftPlanDate > minActualDailyProductionDataDate ){ |
| | | startDate := minActualDailyProductionDataDate; |
| | | }else { |
| | | startDate := minArchiveShiftPlanDate; |
| | | } |
| | | } |
| | | } |
| | | |
| | | endDate := maxselect( macroPlan,Period_MP,period,period.EndDate() ).EndDate(); |
| | | |
| | | // æå»ºLocalColumnçç´¢å¼ |
| | |
| | | |
| | | // 计åå¼å§ä¹åç产åºåå®é
æ¯æ¥ç产æ¥å£ |
| | | if( localColumn.CustomDate() < macroPlan.StartOfPlanning().Date() ){ |
| | | // å¼å§æ¶é´åæ¯è¾å°çå¼å§æ¶é´ |
| | | historyStartDate := ifexpr( macroPlan.StartOfPlanning().Date() <= localColumn.CustomDate(), macroPlan.StartOfPlanning().Date(), localColumn.CustomDate() ); |
| | | // ç»ææ¶é´åæ¯è¾å¤§çå¼å§æ¶é´ï¼å¦æå计åå¼å§æ¶é´å¤äºåä¸ä¸ªæä»½ï¼åå计åå¼å§æ¶é´ï¼å¦ååæåºæ¶é´ |
| | | historyEndDate := ifexpr( macroPlan.StartOfPlanning().Date() > localColumn.CustomDate().StartOfNextMonth() and |
| | | macroPlan.StartOfPlanning().Date().Month() = localColumn.CustomDate().Month() and |
| | | macroPlan.StartOfPlanning().Date().Year() = localColumn.CustomDate().Year() ,macroPlan.StartOfPlanning().Date(), localColumn.CustomDate().StartOfNextMonth() ); |
| | |
| | | localCell.WorkingDay( localCell.WorkingDay() + workingDay ); |
| | | localCell.Capacity( localCell.Capacity() + capacity ); |
| | | localCell.Output( localCell.Output() + output ); |
| | | } |
| | | } |
| | | |
| | | traverse( archive,ArchiveShiftPlanRow,row ){ |
| | | localRow := null( LocalRow ); |
| | | { |
| | | localRowHandle := localRowIndexTree.GetHandle( row.UnitID()); |
| | | localRowIndex := guard( localRowIndexTree.Root().Child( localRowHandle ),null( NamedValue )); |
| | | if( isnull( localRowIndex )){ |
| | | localRow := localTable.LocalRow( relnew,CustomName := row.UnitID(),Index := localTable.GetRowIndexCache() ); |
| | | localRows.Add( localRow ); |
| | | localRowIndexTree.Root().AddChild( localRowHandle,localRows.Size() - 1 ); |
| | | }else{ |
| | | localRow := localRows.Element( localRowIndex.GetValueAsNumber()); |
| | | } |
| | | } |
| | | traverse( localColumns,Elements,localColumn ){ |
| | | archiveCells := selectset( row,ArchiveShiftPlanCell,cell, |
| | | cell.ArchiveShiftPlanColumn().StartDate() >= localColumn.CustomDate() and |
| | | cell.ArchiveShiftPlanColumn().StartDate() < localColumn.CustomDate().StartOfNextMonth() ); |
| | | |
| | | workingDay := 0; |
| | | capacity := 0.0; |
| | | shiftPatterns := construct( Strings ); |
| | | |
| | | traverse( archiveCells,Elements,cell ){ |
| | | // capacity := capacity + cell.Capacity(); |
| | | if( cell.Outcome() <> "" ){ |
| | | workingDay := workingDay + 1; |
| | | shiftPatterns.Add( cell.Outcome() ); |
| | | } |
| | | } |
| | | |
| | | |
| | | localCell := null( LocalCell_ScheduleSummary ); |
| | | { |
| | | localCellHandle := localCellIndexTree.GetHandle( row.UnitID() + localColumn.CustomDate().AsQUILL() ); |
| | | localCellIndex := guard( localCellIndexTree.Root().Child( localCellHandle ),null( NamedValue )); |
| | | if( isnull( localCellIndex )){ |
| | | localCell := localRow.LocalCell( relnew,LocalCell_ScheduleSummary,LocalColumn := localColumn ); |
| | | localCells.Add( localCell ); |
| | | localCellIndexTree.Root().AddChild( localCellHandle , localCells.Size() - 1 ); |
| | | }else{ |
| | | localCell := localCells.Element( localCellIndex.GetValueAsNumber() ); |
| | | } |
| | | } |
| | | |
| | | localCell.ShiftPattern( selectuniquevalues( shiftPatterns,Elements,element,element ).Concatenate( "/" ) ); |
| | | |
| | | localCell.WorkingDay( localCell.WorkingDay() + workingDay ); |
| | | localCell.Capacity( localCell.Capacity() + capacity ); |
| | | } |
| | | } |
| | | |
| | |
| | | InterfaceDataset interfaceDataset |
| | | ) |
| | | { |
| | | TextBody: '//archive.ActualDailyProductionData( relnew ,ActualOut := 100,Fac := "CC",LineName := "CC1",ProductionDate := Date::ActualDate(),ProductNo := "112233445566",ShiftCode := "3",ShiftName := "ç½ç");' |
| | | TextBody: |
| | | [* |
| | | //archive.ActualDailyProductionData( relnew ,ActualOut := 100,Fac := "CC",LineName := "CC1",ProductionDate := Date::ActualDate(),ProductNo := "112233445566",ShiftCode := "3",ShiftName := "ç½ç"); |
| | | |
| | | info( LocalTool::AddMonthByYYYYMM( 202401,25 ) ) |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | Component PanelMonthly |
| | | { |
| | | #keys: '[414996.1.263421916]' |
| | | BaseType: 'WebPanel' |
| | | Children: |
| | | [ |
| | | #child: PanelMonthly743 |
| | | Component bApply902 |
| | | { |
| | | #keys: '[414996.1.265980213]' |
| | | BaseType: 'WebButton' |
| | | Properties: |
| | | [ |
| | | Label: 'Apply' |
| | | Taborder: 1 |
| | | ] |
| | | } |
| | | ] |
| | | Properties: |
| | | [ |
| | | Taborder: 2 |
| | | Title: 'Monthly' |
| | | ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | Component PanelMonthly743 |
| | | { |
| | | #keys: '[414996.1.263422034]' |
| | | BaseType: 'WebPanel' |
| | | Children: |
| | | [ |
| | | Component efMonthly |
| | | { |
| | | #keys: '[414996.1.263422035]' |
| | | BaseType: 'WebEditField' |
| | | Properties: |
| | | [ |
| | | Label: 'Recur every ' |
| | | Taborder: 0 |
| | | Text: '1' |
| | | ] |
| | | } |
| | | Component LabelMonthly |
| | | { |
| | | #keys: '[414996.1.263422036]' |
| | | BaseType: 'WebLabel' |
| | | Properties: |
| | | [ |
| | | Label: 'month(s)' |
| | | Taborder: 1 |
| | | ] |
| | | } |
| | | ] |
| | | Properties: |
| | | [ |
| | | FixedSize: true |
| | | Orientation: 'horizontal' |
| | | Taborder: 0 |
| | | ] |
| | | } |
| | |
| | | [ |
| | | #child: PanelDaily_478 |
| | | #child: PanelWeekly_791 |
| | | #child: PanelMonthly |
| | | ] |
| | | Properties: |
| | | [ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: PanelMonthly/bApply902 |
| | | Response OnClick () id:Response_PanelMonthly_bApply902_OnClick |
| | | { |
| | | #keys: '[414996.1.265980212]' |
| | | CanBindMultiple: false |
| | | DefinitionID: 'Responsedef_WebButton_OnClick' |
| | | GroupServerCalls: true |
| | | QuillAction |
| | | { |
| | | Body: |
| | | [* |
| | | |
| | | skipMonth := [Number]efMonthly.Text(); |
| | | LocalTool::BatchSetUnitShiftPatternByMonth( dhSelectUnit.Data(),ddlShiftPattern.Data(),dsStartDate.Date(),dsEndDate.Date() ,skipMonth ); |
| | | WebMessageBox::Success( "Success"); |
| | | *] |
| | | } |
| | | } |