lihongji
2024-11-07 10b3be5622ad46e4e37a6a2ce11aafcfa565c36d
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
Quintiq file version 2.0
#parent: #root
StaticMethod PushPlanInventoryData (
  const MacroPlan macroPlan,
  InterfaceDataset interfaceDataset
)
{
  Description: '发送计划库存数据接口'
  TextBody:
  [*
    table         := selectobject( interfaceDataset, InventoryPlanArchiveVersion, version, not version.IsShow() );
    
    interfaceTime := DateTime::ActualTime().Format( "Y-M2-D2 h2:m:s" );
    
    jsonarray     := JSON::Array();
    
    traverse ( table, Row, r ){
      traverse ( table, Column, c, c.TimeUnit() = Translations::MP_GlobalParameters_Day() ) {
        cell := select( r, Cell, tempC, tempC.Column() = c );
        
        if ( not isnull( cell ) ) {
          idsjson := JSON::Object().Add( "product", r.ProductID() )       
                                   .Add( "inventoryDate", c.StartDate().Format( 'Y-M2-D2' ) )
                                   .Add( "planningInventory", cell.PlanQuantity() )
                                   .Add( "versionName", macroPlan.ScenarioName() )
                                   .Add( "factoryName", ifexpr( r.Unit().Regex( "CC" ), "长春工厂", "大连工厂" ) )
                                   .Add( "fac", ifexpr( r.Unit().Regex( "CC" ), "CC", "DL" ) )
                                   .Add( "interfaceTime", interfaceTime ).Build();
          jsonarray.Add( idsjson );
        }
      }
    }
    
    requestbody := jsonarray.Build().AsString();
    info(  requestbody );
    //loginfo := owner.InterfaceLoginfo( relnew, ExecuteUser := executor
    //                                   , Name := Translations::InterfaceDataset_CustomerDemandPPAIDS_Name()
    //                                   , InterfaceDateTime := DateTime::ActualTime()
    //                                   , Message := '客户需求(PPA+IDS)'
    //                                   , RequestBody := requestbody);
    ////error( '--------------------', requestbody );
    //data     := InterfaceLoginfo::CallInterfaceForDataCenter( owner, loginfo );
    //info( '----------------', data.AsString() );
  *]
}