rislai
2024-08-16 bcd7eb876bff759f6aef96f1014b0bca7a3322ff
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
48
49
Quintiq file version 2.0
#parent: #root
Method Generate (
  CCEngineLogisticsCostSearch search,
  Product_MPs products
)
{
  TextBody:
  [*
    // 甄兰鸽 Jun-25-2024 (created)
    table            := selectobject( this, MacroPlan.CCEngineLogisticsCostReport, report, not report.IsShow() );
    allunit          := '<All>';
    //清空之前存储的显示数据
    this.Clear();
    //过滤后的产品id
    productids       := selectuniquevalues( products, Elements, product, ( search.Generation() = allunit or product.Generation() = search.Generation() )
                                      and ( search.MqbMlb() = allunit or product.MQBMLB() = search.MqbMlb() )
                                      and ( search.Power() = allunit or product.Power() = search.Power() ), product.ID() );
    sumrow           := this.Row( relnew, Name := 'SUM', RowNr := table.Row( relsize ) );
    traverse( table, Row, row ){
      productid      := construct( Strings );
      productid.Add( row.Name() );
      
      if( productids.ContainsAll( productid ) ){
        showrow      := this.Row( relnew, Name := row.Name(), RowNr := row.RowNr() );
        
        traverse( row, Cell, cell ){
          column     := selectobject( this, Column, column, column.Name() = cell.Column().Name() );
          
          sumcell    := selectobject( column, Cell, c, c.Row() = sumrow );
          if( isnull( sumcell ) ){
            sumcell  := sumrow.Cell( relnew, RentEnterCost         := 0
                                     , RentOutCost                 := 0 
                                     , FactoryToRentTransCost      := 0
                                     , RentStorageCost             := 0 );
            column.Cell( relinsert, sumcell );
          }
          
          showcell   := showrow.Cell( relnew, RentEnterCost := cell.RentEnterCost(), RentOutCost := cell.RentOutCost(), FactoryToRentTransCost := cell.FactoryToRentTransCost(), RentStorageCost := cell.RentStorageCost() );
          column.Cell( relinsert, showcell );
          sumcell.RentEnterCost( cell.RentEnterCost() + sumcell.RentEnterCost() );
          sumcell.RentOutCost( cell.RentOutCost() + sumcell.RentOutCost() );
          sumcell.FactoryToRentTransCost( cell.FactoryToRentTransCost() + sumcell.FactoryToRentTransCost() );
          sumcell.RentStorageCost( cell.RentStorageCost() + sumcell.RentStorageCost() );
        }
      }
    }
  *]
}