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
54
55
56
57
58
59
60
61
Quintiq file version 2.0
#parent: #root
StaticMethod Import (
  NewOfflinePlanTable nopt,
  GeneralExcelImportAndExportDataTable table
)
{
  TextBody:
  [*
    cnv2 := StringToDate::StandardConverter();
    cnv2.SetCustomConversion();
    cnv2.CustomFormatString( 'yyyy/MM/dd' );
    
    productionLine   := "";
    productID        := "";
    isUpdateQuantity := false;
    isUpdateOrder    := false;
    
    traverse ( table, GeneralExcelImportAndExportDataRow, row ) {  
      traverse ( table, GeneralExcelImportAndExportDataColumn, column ) {
        // 单元格值
        cell := select( row, GeneralExcelImportAndExportDataCell, tempGEIAEDCell, tempGEIAEDCell.GeneralExcelImportAndExportDataColumn() = column );
        
        // 第一列判断
        if ( cell.Value().Tokenize( "_" ).Size() = 2 and column.ColumnIndex() = 0 ) {
          productionLine := cell.Value().Tokenize( "_" ).Element( 0 );
          productID      := cell.Value().Tokenize( "_" ).Element( 1 );
        }
        
        // 第二列判断
        if ( cell.Value() = "Quantity" and column.ColumnIndex() = 1 ) {
          isUpdateQuantity := true;
          isUpdateOrder    := false;
        } else if ( cell.Value() = "Order" and column.ColumnIndex() = 1 ) {
          isUpdateQuantity := false;
          isUpdateOrder    := true;
        } else if ( cell.Value() <> "Quantity" and cell.Value() <> "Order" and column.ColumnIndex() = 1 ) {
          isUpdateQuantity := false;
          isUpdateOrder    := false;
        }
        
        // 时间列更新
        if ( isUpdateQuantity and cnv2.CanConvert( column.Name() ) and column.ColumnIndex() > 1 ) {
          noopcell := select( nopt, NewOfflinePlanRow.NewOfflinePlanCell, tempNOPCell, 
                              tempNOPCell.NewOfflinePlanRow().ProductionLine() = productionLine and 
                              tempNOPCell.NewOfflinePlanRow().ProductID()      = productID      and
                              tempNOPCell.NewOfflinePlanRow().Type()           = "1"            and
                              tempNOPCell.NewOfflinePlanColumn().StartDate()   = cnv2.Convert( column.Name() ) );
          noopcell.Quantity( [Number]cell.Value() );
        } else if ( isUpdateOrder and cnv2.CanConvert( column.Name() ) and column.ColumnIndex() > 1 ) {
          noopcell := select( nopt, NewOfflinePlanRow.NewOfflinePlanCell, tempNOPCell, 
                              tempNOPCell.NewOfflinePlanRow().ProductionLine() = productionLine and 
                              tempNOPCell.NewOfflinePlanRow().ProductID()      = productID      and
                              tempNOPCell.NewOfflinePlanRow().Type()           = "1"            and
                              tempNOPCell.NewOfflinePlanColumn().StartDate()   = cnv2.Convert( column.Name() ) );
          noopcell.Order( cell.Value() );
        }
      }
    }
  *]
}