lazhen
2024-08-26 2d107a69e5d84532a7dd5defe3196280b23b4d1f
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
Quintiq file version 2.0
#parent: #root
StaticMethod GenerateData (
  InterfaceDataset owner,
  String werk,
  const MacroPlan macroplan,
  Date startdate,
  Date enddate,
  String executor
)
{
  TextBody:
  [*
    // 甄兰鸽 Aug-23-2024 (created)
    cdlast                 := maxobject( owner, AOnlineAndMOfflinePlanPIR, cd, cd.StartDate(), cd.EndDate(), cd.Werk() );
    if( not isnull( cdlast ) ){
      loginfo              := cdlast.InterfaceLoginfo();
      if( not loginfo.IsShow() ){
        loginfo.Delete();
      }else{
        loginfo.Last( false );
      }
      owner.AOnlineAndMOfflinePlanPIR( relflush );
    }
    nowdate                := DateTime::ActualTime();
    loginfo                := owner.InterfaceLoginfo( relnew, ExecuteUser := executor
                                                      , Name := Translations::InterfaceDataset_AOnlineAndMOfflinePlanPIR_Name()
                                                      , InterfaceDateTime := nowdate
                                                      , Message := '装配上线计划 + 机加下线计划 - PIR'
                                                      , IsShow := false
                                                      , Last := true
                                                      , ReturnSuccess := true
                                                      , ReturnMsg := 'Success'
                                                      , Success := true
                                                      );
    pir                    := owner.AOnlineAndMOfflinePlanPIR( relnew, Werk := werk, Version := macroplan.ScenarioName(), StartDate := startdate, EndDate := enddate );
    loginfo.AOnlineAndMOfflinePlanPIR( relinsert, pir );
    traverse( macroplan, AssemblyOnlinePlanColumn, column ){
      traverse( column, AssemblyOnlinePlanCell, cell, cell.Value() <> '' and cell.AssemblyOnlinePlanRow().RowNr() = '1' ){
        quantityrow        := cell.AssemblyOnlinePlanRow();
    
        pir.PIRData( relnew, Product           := quantityrow.ProductID()
                     , PlanningDate            := column.ColumnDate()
                     , PlanningQty             := [Number]cell.Value());
      }
    }
    
    traverse( macroplan, OfflinePlanTable, table ){
      traverse( table, OfflinePlanColumn, column ){
        traverse( column, OfflinePlanCell, cell, cell.Value() <> '' 
                  and ( cell.OfflinePlanRow().ProductionLine() <> 'DL_MOMO' or cell.OfflinePlanRow().ProductionLine() <> 'CC_MOMO' ) ){
          row              := cell.OfflinePlanRow();
          
          pir.PIRData( relnew, Product         := row.ProductID()
                     , PlanningDate            := column.ColumnDate()
                     , PlanningQty             := [Number]cell.Value());
        }
      }
    }
    loginfo.TotalRow( pir.PIRData( relsize ) );
  *]
}