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
62
63
64
65
66
67
68
69
70
71
72
73
74
Quintiq file version 2.0
#parent: #root
StaticMethod CreateOldAssemblyOnlinePlanData (
  MacroPlan macroPlan
)
{
  TextBody:
  [*
    macroPlan.AssemblyOnlinePlanRow( relflush );
    macroPlan.AssemblyOnlinePlanColumn( relflush );
    
    // 创建列
    firstColumn  := macroPlan.AssemblyOnlinePlanColumn( relnew, ColumnDate := macroPlan.StartOfPlanning().Date() - 2 );
    secondColumn := macroPlan.AssemblyOnlinePlanColumn( relnew, ColumnDate := macroPlan.StartOfPlanning().Date() - 1 );
    traverse ( macroPlan, NewAssemblyOnlinePlanColumn, naopc ) {
      macroPlan.AssemblyOnlinePlanColumn( relnew, ColumnDate := naopc.StartDate() );
    }
    
    pls := selectuniquevalues( macroPlan, NewAssemblyOnlinePlanRow, tempNAOPR, true, tempNAOPR.ProductionLine() );
    
    traverse ( pls, Elements, pl ) {
      // 创建明细行
      detailNAOPRs := selectsortedset( macroPlan, NewAssemblyOnlinePlanRow, tempNAOOPR, tempNAOOPR.ProductionLine() = pl and tempNAOOPR.Type() = "1", tempNAOOPR.ProductionLine(), tempNAOOPR.ProductID() );
      traverse ( detailNAOPRs, Elements, naopr ) {
        quantityOPR := macroPlan.AssemblyOnlinePlanRow( relnew, ProductionLine := naopr.ProductionLine(), ProductID := naopr.ProductID(), Type := "1" );
        orderOPR    := macroPlan.AssemblyOnlinePlanRow( relnew, ProductionLine := naopr.ProductionLine(), ProductID := naopr.ProductID(), Type := "2" );
        
        // 第一列
        quantityOPR.AssemblyOnlinePlanCell( relnew, AssemblyOnlinePlanColumn := firstColumn,  Value := naopr.Name() );
        orderOPR.AssemblyOnlinePlanCell(    relnew, AssemblyOnlinePlanColumn := firstColumn,  Value := "" );
        
        // 第二列
        quantityOPR.AssemblyOnlinePlanCell( relnew, AssemblyOnlinePlanColumn := secondColumn, Value := "Quantity" );
        orderOPR.AssemblyOnlinePlanCell(    relnew, AssemblyOnlinePlanColumn := secondColumn, Value := "Order" );
        
        // 时间列
        traverse ( naopr, NewAssemblyOnlinePlanCell, naopcell ) {
          aopc := select( macroPlan, AssemblyOnlinePlanColumn, tempAOPC, tempAOPC.ColumnDate() = naopcell.StartDate() );
          quantityOPR.AssemblyOnlinePlanCell( relnew, AssemblyOnlinePlanColumn := aopc, Value := [String]naopcell.Quantity() );
          orderOPR.AssemblyOnlinePlanCell(    relnew, AssemblyOnlinePlanColumn := aopc, Value := naopcell.Order() );
        }
      }
      
      // 创建合计行
      totalNAOPR           := select( macroPlan, NewAssemblyOnlinePlanRow, tempNAOPR, tempNAOPR.ProductionLine() = pl and tempNAOPR.Type() = "2" );
      
      totalAOPR             := macroPlan.AssemblyOnlinePlanRow( relnew, ProductionLine := totalNAOPR.ProductionLine(), ProductID := "Z", Type := "3" );
      shiftPatternNameAOPR  := macroPlan.AssemblyOnlinePlanRow( relnew, ProductionLine := totalNAOPR.ProductionLine(), ProductID := "Z", Type := "4" );
      shiftPatternStartAOPR := macroPlan.AssemblyOnlinePlanRow( relnew, ProductionLine := totalNAOPR.ProductionLine(), ProductID := "Z", Type := "5" );
      shiftPatternEndOAPR   := macroPlan.AssemblyOnlinePlanRow( relnew, ProductionLine := totalNAOPR.ProductionLine(), ProductID := "Z", Type := "6" );
      
      // 第一列
      totalAOPR.AssemblyOnlinePlanCell(             relnew, AssemblyOnlinePlanColumn := firstColumn, Value := "合计" );
      shiftPatternNameAOPR.AssemblyOnlinePlanCell(  relnew, AssemblyOnlinePlanColumn := firstColumn, Value := "" );
      shiftPatternStartAOPR.AssemblyOnlinePlanCell( relnew, AssemblyOnlinePlanColumn := firstColumn, Value := "" );
      shiftPatternEndOAPR.AssemblyOnlinePlanCell(   relnew, AssemblyOnlinePlanColumn := firstColumn, Value := "" );
      
       // 第二列
      totalAOPR.AssemblyOnlinePlanCell(             relnew, AssemblyOnlinePlanColumn := secondColumn, Value := "总量" );
      shiftPatternNameAOPR.AssemblyOnlinePlanCell(  relnew, AssemblyOnlinePlanColumn := secondColumn, Value := "班次" );
      shiftPatternStartAOPR.AssemblyOnlinePlanCell( relnew, AssemblyOnlinePlanColumn := secondColumn, Value := "班次开始时间" );
      shiftPatternEndOAPR.AssemblyOnlinePlanCell(   relnew, AssemblyOnlinePlanColumn := secondColumn, Value := "班次结束时间" );
      
      // 时间列
      traverse ( totalNAOPR, NewAssemblyOnlinePlanCell, naopcell ) {
        opc := select( macroPlan, AssemblyOnlinePlanColumn, tempAOPC, tempAOPC.ColumnDate() = naopcell.StartDate() );
        totalAOPR.AssemblyOnlinePlanCell(             relnew, AssemblyOnlinePlanColumn := opc, Value := [String]naopcell.TotalQuantity() );
        shiftPatternNameAOPR.AssemblyOnlinePlanCell(  relnew, AssemblyOnlinePlanColumn := opc, Value := naopcell.ShiftPatternName() );
        shiftPatternStartAOPR.AssemblyOnlinePlanCell( relnew, AssemblyOnlinePlanColumn := opc, Value := naopcell.ShiftPatternStart() );
        shiftPatternEndOAPR.AssemblyOnlinePlanCell(   relnew, AssemblyOnlinePlanColumn := opc, Value := naopcell.ShiftPatternEnd() );
      }
    }
  *]
}