lazhen
2024-10-29 4419b51e5cfed824ca592ae5cba7654994ee005d
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
Quintiq file version 2.0
#parent: #root
StaticMethod DispatchCC (
  const RecycleBin recycleBin
) as String
{
  TextBody:
  [*
    // Akari Oct-28-2024 (created)
    // 接口地址:172.18.1.12/PPPS/AddPlan ---长春地址
    url := "http://172.18.1.12/PPPS/AddPlan";
    
    datas := selectset( recycleBin,DispatchShiftSchedulingLine.DispatchShiftSchedulingProduct,object,object.DispatchShiftSchedulingLine().Fac() = "CC" );
    
    datas_Json := JSON::Array();
    
    traverse( datas,Elements,product ){
      line := product.DispatchShiftSchedulingLine();
      
      data_Json := JSON::Object();
      datas_Json.Add( data_Json );
      
      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();
      data_Json.Add( "planItems",details_Json );
      traverse( product,DispatchShiftSchedulingDetail,detail ){
        detail_Json := JSON::Object();
        details_Json.Add( detail_Json );
        detail_Json.Add( "ShiftName",detail.SingleShiftName() );
        detail_Json.Add( "Quantity",detail.ShiftVolume() );
        detail_Json.Add( "ProductNo",detail.DispatchShiftSchedulingProduct().ProductID() );
      }
    }
    
    info( datas_Json.AsString() );
    
    i := HTTPInterface::Create( url, 80 );
    i.URL( url );
    i.PostMethod( true );
    i.MediaType( "application/json" );
    i.TimeOut( Duration::Minutes( 5 ) );
    
    i.Call( datas_Json.AsString() );
      
    htmlresult := i.Result();
      
    respJSON   := JSON::Parse( htmlresult );
    
    return respJSON.Get( "Message" ).AsString();
  *]
}