admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
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
50
51
52
53
Quintiq file version 2.0
#parent: #root
Method IdentifyNullValues
{
  TextBody:
  [*
    // 删除空行数据
    productcolumn := selectobject( this, FinancialSalesColumn, column, column.Index() = 0 );
    unitcolumn    := selectobject( this, FinancialSalesColumn, column, column.Index() = 1 );
    //删除没有对应日期数据的行
    traverse ( this, FinancialSalesRow, row ) {
      if ( forall( row, FinancialSalesCell, cell, true, ( cell.FinancialSalesColumn() <> productcolumn or cell.FinancialSalesColumn() <> unitcolumn ) and cell.Value().TrimBoth() = "" ) ) {
        row.Delete();
      }
    }
    
    // 判断是否存在负数
    traverse ( this, FinancialSalesRow.FinancialSalesCell, cell ) { 
      if ( cell.FinancialSalesColumn().Index() <= 1 ) {
        if ( cell.Value().TrimBoth() = "" ) {
          error( Translations::MP_FinancialProductionReport_ImportIndetifyNullStrings() );
        }
      } else {
        if ( cell.Value().TrimBoth() = "" ) {
          cell.Value( '0' );
    //      error( Translations::AC_SalesForecastInputSource_Error6() );
        } else {
          stn := StringToReal::StandardConverter();
          if ( not stn.CanConvert( cell.Value().TrimBoth() ) ) {
            error( Translations::MP_FinancialProductionReport_ImportIndetifyIllegalCharacter() );
          } else {
            if ( stn.Convert( cell.Value().TrimBoth() ) >= 0 ) {
              cell.Value( [String]ceil( stn.Convert( cell.Value().TrimBoth() ) ) );
            } else {
              error( Translations::MP_FinancialProductionReport_ImportIndetifyNegativeNumber() );
            }
          }
        }
      }
      
      cell.FinancialSalesRow().DuplicateValueMarker( cell.FinancialSalesRow().DuplicateValueMarker()                  + 
                                                        ifexpr( cell.FinancialSalesColumn().Index() = 0, "", "-" ) +
                                                        cell.Value()
                                                       );
    }
    
    // 判断是否存在重复数据
    row := selectduplicates( this, FinancialSalesRow, row, true, row.DuplicateValueMarker() );
    if ( row.Size() > 1 ) {
      error( Translations::MP_FinancialProductionReport_ImportIndetifyDuplicateData() );
    }
  *]
}