陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Quintiq file version 2.0
#parent: #root
Method Generate (
  OfflinePlanArchiveSearch search,
  Strings products,
  Strings units
)
{
  TextBody:
  [*
    // 甄兰鸽 Jun-25-2024 (created)
    info( '-----------Search start-------' );
    table                   := selectobject( this,InterfaceDataset.OfflinePlanArchiveVersion, report, not report.IsShow() );
    //清空之前存储的显示数据
    aopcolumns              := selectuniquevalues(  table, Column, aopcolumn, aopcolumn.StartDate() >= search.StartDate() and aopcolumn.StartDate() <= search.EndDate(), aopcolumn.StartDate() );//aopcolumn.TimeUnit() = search.TimeUnit() and 
    this.Clear( aopcolumns );
    traverse( table, Row, row, ( units.Size() = 0 or units.Find( row.ProductionLine() ) > -1 ) and ( products.Size() = 0 or products.Find( row.Name() ) > -1 ) ){
      
      showrow               := selectobject( this, Row, showrow, showrow.Name() = row.Name() and showrow.Unit() = search.Unit() );
      if( isnull( showrow ) ){
        showrow             := this.Row( relnew, Name := row.Name(), ProductID := row.ProductID(), Unit := search.Unit() );
      }
      traverse( this, Column, column ){
        cells               := selectset( row, Cell, cell, cell.Column().StartDate() >= column.StartDate() and cell.Column().StartDate() <= column.EndDate() );//cell.Column().TimeUnit() = Translations::MP_GlobalParameters_Day() and 
        
    //  traverse( row, Cell, cell, cell.Column().TimeUnit() = search.TimeUnit() ){
    //    column              := selectobject( this, Column, column, column.ColumnName() = cell.Column().ColumnName() );
        if( not isnull( column ) ){
          showcell          := selectobject( showrow, Cell, showcell, showcell.Column() = column );
          if( isnull( showcell ) ){
            showcell        := showrow.Cell( relnew, Quantity := 0, ActualProductionQty := 0 );
            column.Cell( relinsert, showcell );
          }
          qty               := sum( cells, Elements, cell, cell.Quantity() );
          actqty            := sum( cells, Elements, cell, cell.ActualProductionQty() );
          showcell.Quantity( qty + showcell.Quantity() );
          showcell.ActualProductionQty( actqty + showcell.ActualProductionQty() );
    //      if( search.TimeUnit() = Translations::MP_GlobalParameters_Day() ){
            showcell.Order( cells.Element( 0 ).Order() );
            showcell.OrderNr( cells.Element( 0 ).OrderNr() );
    //      }
        }
      }
    }
    info( '-----------Search end-------' );
  *]
}