xiaoding721
2024-12-09 b6e0c9175e15545fbe890611d3b6ce71a3fc916d
修复一些bug,优化计划汇总报表
已添加6个文件
已修改4个文件
286 ■■■■■ 文件已修改
_Main/BL/Type_LocalTool/StaticMethod_AddMonthByYYYYMM.qbl 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPattern.qbl 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPatternByMonth#139.qbl 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LocalTool/StaticMethod_GetYYYYMM.qbl 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_Test/StaticMethod_Test.qbl 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelMonthly.def 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelMonthly743.def 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelRight445.def 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Response_PanelMonthly_bApply902_OnClick.def 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LocalTool/StaticMethod_AddMonthByYYYYMM.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,40 @@
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;
  *]
}
_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPattern.qbl
@@ -25,17 +25,8 @@
          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, 
_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPatternByMonth#139.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,60 @@
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 );
      }
    }
  *]
}
_Main/BL/Type_LocalTool/StaticMethod_GetYYYYMM.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
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;
  *]
}
_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl
@@ -43,7 +43,19 @@
    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的索引
@@ -172,7 +184,9 @@
          
          // è®¡åˆ’开始之前的产出取实际每日生产接口
          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() );
@@ -210,7 +224,57 @@
          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 );
       }
    }
    
_Main/BL/Type_Test/StaticMethod_Test.qbl
@@ -9,5 +9,10 @@
  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 ) )
  *]
}
_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelMonthly.def
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,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'
  ]
}
_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelMonthly743.def
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
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
  ]
}
_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelRight445.def
@@ -7,6 +7,7 @@
  [
    #child: PanelDaily_478
    #child: PanelWeekly_791
    #child: PanelMonthly
  ]
  Properties:
  [
_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Response_PanelMonthly_bApply902_OnClick.def
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
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");
    *]
  }
}