陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Quintiq file version 2.0
#parent: #root
StaticMethod RefreshData (
  MacroPlan macroPlan,
  OfflinePlanTable opt
)
{
  TextBody:
  [*
    //macroPlan.AssemblyOnlinePlanRow( relflush );
    //macroPlan.AssemblyOnlinePlanColumn( relflush );
    //
    //// 找装配线行
    //oprs := selectsortedset( opt, OfflinePlanRow, tempOPR, 
    //                         tempOPR.ProductionLine() = "DL MoMo" 
    //                         or 
    //                         tempOPR.ProductionLine() = "CC MoMo" 
    //                         or 
    //                         tempOPR.ProductionLine() = "DL ZKM"
    //                         , 
    //                         tempOPR.ProductionLine(), tempOPR.ProductID(), tempOPR.Type() );
    //opcs := selectsortedset( opt, OfflinePlanColumn, tempOPC, true, tempOPC.ColumnDate() );
    //
    //// 生成表格
    //traverse ( opcs, Elements, opc ) {
    //  aopc := macroPlan.AssemblyOnlinePlanColumn( relnew, ColumnDate := opc.ColumnDate(), ColumnIndex := opc.ColumnIndex() );
    //  traverse ( oprs, Elements, opr ) {
    //    aopr := select( macroPlan, AssemblyOnlinePlanRow, tempAOPR, tempAOPR.ProductID() = opr.ProductID() and tempAOPR.ProductionLine() = opr.ProductionLine() and tempAOPR.Type() = opr.Type() );
    //    if ( isnull( aopr ) ) {
    //      aopr := macroPlan.AssemblyOnlinePlanRow( relnew, ProductID := opr.ProductID(), ProductionLine := opr.ProductionLine(), Type := opr.Type() );
    //    }
    //    
    //    cellOPC := select( opr, OfflinePlanCell, tempOPC, tempOPC.OfflinePlanColumn() = opc );
    //    if ( not isnull( cellOPC ) ) {
    //      cellAOPC := aopc.AssemblyOnlinePlanCell( relnew, Value := cellOPC.Value() );
    //      cellAOPC.AssemblyOnlinePlanRow( relset, aopr );
    //    }
    //  }
    //}
    //
    //// 处理日历事件
    //pls := selectuniquevalues( macroPlan, AssemblyOnlinePlanRow, tempAOPR, true, tempAOPR.ProductionLine() );
    //traverse ( pls, Elements, pl ) {
    //  targetQuantity := ifexpr( pl = "CC MoMo", guard( macroPlan.AssemblyOnlineQuantity().CCMoMo(), 0 ),
    //                            ifexpr( pl = "DL MoMo", guard( macroPlan.AssemblyOnlineQuantity().DLMoMo(), 0 ), guard( macroPlan.AssemblyOnlineQuantity().DLZKM(), 0 ) )
    //                           );
    //  
    //  u           := select( macroPlan, Unit, tempU, tempU.ID() = pl );
    //  drainPs     := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "拉空" ), false ) );
    //  lineLyingPs := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "铺线" ), false ) );
    //  
    //  // 处理排空
    //  info( "当前产线:", pl, "    处理拉空--------------------------" );
    //  traverse ( drainPs, Elements, p ) {
    //    traverse ( p, ExplicitTimeInterval, eti ) {
    //      info( "开始时间:", eti.Start().Format( "Y-M2-D2" ), "    结束时间:", eti.End().Format( "Y-M2-D2" ) );
    //      // 前一天日历
    //      aopc := select( macroPlan, AssemblyOnlinePlanColumn, tempAOPC, tempAOPC.ColumnDate() = ( eti.Start().Date() - 1 ) );
    //      info( "需要拉空的上线计划时间:", aopc.ColumnDate().Format( "Y-M2-D2" ) );
    //      aoprs := selectset( macroPlan, AssemblyOnlinePlanRow, tempAOPR, tempAOPR.ProductionLine() = pl and tempAOPR.Type() = "2" and
    //                          exists( tempAOPR, AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc and tempAOPC.Value() <> "" ) );
    //      aopr  := maxselect( aoprs, Elements.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc,
    //                          [Number]tempAOPC.Value().ReplaceAll( "#0", "" ) );
    //      cell  := select( macroPlan, AssemblyOnlinePlanRow.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanRow().ProductionLine() = pl and tempAOPC.AssemblyOnlinePlanColumn() = aopc and
    //                       tempAOPC.AssemblyOnlinePlanRow().Type() = "1" and tempAOPC.AssemblyOnlinePlanRow().ProductID() = aopr.AssemblyOnlinePlanRow().ProductID() ); 
    //      
    //      cell.Value( [String] ( [Number]cell.Value() - targetQuantity ) );
    //    }
    //  }
    //  
    //  info( "当前产线:", pl, "    处理铺线--------------------------" );
    //  // 处理铺线
    //  traverse ( lineLyingPs, Elements, p ) {
    //    traverse ( p, ExplicitTimeInterval, eti ) {
    //      info( "开始时间:", eti.Start().Format( "Y-M2-D2" ), "    结束时间:", eti.End().Format( "Y-M2-D2" ) );
    //      info( "需要铺线的上线计划时间:", eti.Start().Format( "Y-M2-D2" ) );
    //      aopc  := select( macroPlan, AssemblyOnlinePlanColumn, tempAOPC, tempAOPC.ColumnDate() = eti.Start().Date() );
    //      aoprs := selectset( macroPlan, AssemblyOnlinePlanRow, tempAOPR, tempAOPR.ProductionLine() = pl and tempAOPR.Type() = "2" and
    //                          exists( tempAOPR, AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc and tempAOPC.Value() <> "" ) );
    //      aopr  := minselect( aoprs, Elements.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc,
    //                          [Number]tempAOPC.Value().ReplaceAll( "#0", "" ) );
    //      cell  := select( macroPlan, AssemblyOnlinePlanRow.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanRow().ProductionLine() = pl and tempAOPC.AssemblyOnlinePlanColumn() = aopc and
    //                       tempAOPC.AssemblyOnlinePlanRow().Type() = "1" and tempAOPC.AssemblyOnlinePlanRow().ProductID() = aopr.AssemblyOnlinePlanRow().ProductID() );
    //      cell.Value( [String] ( [Number]cell.Value() + targetQuantity ) );
    //    }
    //  }
    //}
  *]
}