lihongji
2024-11-15 c6e8187d8a90489b985609fe7d94d4996ecee491
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
Quintiq file version 2.0
#parent: #root
Method Generate (
  CustomerDemandIDSSearch search
)
{
  TextBody:
  [*
    // 甄兰鸽 Jun-25-2024 (created)
    info( '-----------Search start-------' );
    table                   := selectobject( this,InterfaceDataset.CustomerDemandIDS, report, not report.IsShow() );
    //清空之前存储的显示数据
    idscolumns              := selectuniquevalues(  table, Column, idscolumn, idscolumn.TimeUnit() = search.TimeUnit() and idscolumn.StartDate() >= search.StartDate() and idscolumn.StartDate() <= search.EndDate(), idscolumn.StartDate() );
    this.Clear( idscolumns );
    traverse( table, Row, row, ( search.Unit() = FinancialProductionReport::GetDefaultAllUnit() or row.Factory() = search.Unit() ) 
              and ( search.Product() = FinancialProductionReport::GetDefaultAllUnit() or search.Product() = row.Name() ) ){
      
      showrow               := selectobject( this, Row, showrow, showrow.Name() = row.Name() and showrow.Factory() = search.Unit() );
      if( isnull( showrow ) ){
        showrow             := this.Row( relnew, Name := row.Name(), Factory := search.Unit() );
      }
      traverse( row, Cell, cell, cell.Column().TimeUnit() = search.TimeUnit() ){
        column              := selectobject( this, Column, column, column.Name() = cell.Column().Name() );
        if( not isnull( column ) ){
          showcell          := selectobject( showrow, Cell, showcell, showcell.Column() = column );
          if( isnull( showcell ) ){
            showcell        := column.Cell( relnew, Value := '' );
            showrow.Cell( relinsert, showcell );
          }
          showcell.Value( [String]( [Number]cell.Value() + [Number]showcell.Value() ) );
        }
      }
    }
    info( '-----------Search end-------' );
  *]
}