陈清红
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
Quintiq file version 2.0
#parent: #root
StaticMethod DispatchCC (
  const RecycleBin recycleBin
) as owning JSON
{
  TextBody:
  [*
    // Akari Oct-28-2024 (created)
    // 接口地址:172.18.1.12/PPPS/AddPlan ---长春地址
    address := "172.18.1.12";
    url := "/PPPS/AddPlan";
    
    datas := selectset( recycleBin,DispatchShiftSchedulingLine.DispatchShiftSchedulingProduct,object,object.DispatchShiftSchedulingLine().Fac() = "CC" );
    
    datas_Json := JSON::Array();
    traverse( datas,Elements,product ,product.DispatchShiftSchedulingDetail( relsize ) <> 0 ){
      line := product.DispatchShiftSchedulingLine();
      
      data_Json := JSON::Object();
      data_Json.Add( "LineName" , line.LineName() );
      data_Json.Add( "ProductionDate",line.ShiftDate().Format( "Y-M2-D2" ));
      data_Json.Add( "shiftCode" , line.ShiftName() );
      
      details_Json := JSON::Array();
      traverse( product,DispatchShiftSchedulingDetail,detail ){
        detail_Json := JSON::Object();
        detail_Json.Add( "ShiftName",detail.SingleShiftName() );
        detail_Json.Add( "Quantity",detail.ShiftVolume().Format( "N(Dec)" ) );
        detail_Json.Add( "ProductNo",detail.DispatchShiftSchedulingProduct().ProductID() );
        
        details_Json.Add( detail_Json );
      }
    
      data_Json.Add( "planItems",details_Json );
      datas_Json.Add( data_Json );
    }
    
    i := HTTPInterface::Create( address, 80 );
    i.URL( url );
    i.PostMethod( true );
    i.MediaType( "application/json" );
    i.TimeOut( Duration::Minutes( 5 ) );
    
    resultJson := JSON::Object();
    resultJson.Add( "jsonStr", datas_Json.Build().AsString() );
    
    json := resultJson.Build().AsString();
    
    LocalTool::WriteStringToFile( json );
    
    i.Call( json );
    
    htmlresult := i.Result();
    
    respJSON   := JSON::Parse( htmlresult );
    
    return &respJSON;
  *]
}