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
Quintiq file version 2.0
#parent: #root
StaticMethod GenerateData (
  InterfaceDataset interfaceDataset,
  const MacroPlan macroplan,
  Boolean iscc,
  Boolean isdl,
  String executor
)
{
  Description: '生成可以下发的客户需求(PPA+IDS)数据'
  TextBody:
  [*
    // 甄兰鸽 Aug-20-2024 (created)
    loginfo                := maxobject(  interfaceDataset, InterfaceLoginfo, loginfo, loginfo.Name() = Translations::InterfaceDataset_CustomerDemandPPAIDS_Name(), loginfo.InterfaceDateTime() );
    if( not isnull( loginfo ) ){
      if( not loginfo.IsShow() ){
        loginfo.Delete();
      }else{
        loginfo.Last( false );
      }
      interfaceDataset.CustomerDemandPPAIDS( relflush );
    }
    nowdate                := DateTime::ActualTime();
    loginfo                := interfaceDataset.InterfaceLoginfo( relnew, ExecuteUser         := executor
                                                                 , Name                      := Translations::InterfaceDataset_CustomerDemandPPAIDS_Name()
                                                                 , InterfaceDateTime         := nowdate
                                                                 , Message                   := '客户需求(PPA+IDS)数据推送'
                                                                 , Last                      := true
                                                                  );
    traverse( interfaceDataset, CustomerDemandIDS.Row, row, ( iscc and row.Factory() = FinancialProductionReport::GetDefaultCCUnit() )
              or ( isdl and row.Factory() = FinancialProductionReport::GetDefaultDLUnit() ) ){
      traverse( row, Cell, cell ){
        cd                  :=interfaceDataset.CustomerDemandPPAIDS( relnew, Product           := row.Name()
                                                                     , DemandDate              := cell.Column().StartDate()
                                                                     , DemandQty               := [Number]cell.Value()
                                                                     , VersionName             := macroplan.ScenarioName()
                                                                     , InterfaceTime           := nowdate
                                                                     , FactoryName             := row.Factory()
                                                                     , Fac                     := ifexpr( row.Factory() = FinancialProductionReport::GetDefaultCCUnit(), 'CC', 'DL' )  
    //                                                                 , VersionFlag             := versionflag
                                                                     );
        loginfo.CustomerDemandPPAIDS( relinsert, cd );
      }
    }
    loginfo.TotalRow( loginfo.CustomerDemandPPAIDS( relsize ) );
    CustomerDemandPPAIDS::Publish( interfaceDataset, loginfo );
  *]
}