hongjli
2023-09-05 c70ff9aa94e34f968851e813a0b80a25a7b4ea74
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
Quintiq file version 2.0
#parent: #root
StaticMethod DoSync (
  MacroPlan macroPlan,
  Strings businessTypes,
  Boolean isKeyProduct,
  Boolean createPurchaseSupplyMaterial
)
{
  Description: '单次同步'
  TextBody:
  [*
    // yypsybs Aug-17-2023 (created)
    // 币种和币种汇率
    //Currency_MP::CreateCurrencyFromJson( macroPlan, jsonDataRow );
    info( "Prepare to do sync" )
    if( not isnull( businessTypes ) and businessTypes.Size() > 0 ) {
        traverse( businessTypes, Elements, item ) {
            info( "Business type : " + item )  
        }
    }
    info( "KeyProduct : " + [String]isKeyProduct )
    info( "Create purchase supply material : " + [String]createPurchaseSupplyMaterial )
    // 初始换-0
    info( "Initial" );
    macroPlan.InitialUnitAndStockingPoint();
    // 单位-1
    info( "UnitOfMeasure_MP::DoSync" )
    UnitOfMeasure_MP::DoSync( macroPlan );
    // 销售部门-2
    info( "SalesSegment::DoSync" )
    SalesSegment_MP::DoSync( macroPlan, businessTypes );
    // 库存点-3
    info( "StockingPoint::DoSync" )
    bodynumber := "2";
    postrequestbody := macroPlan.ApiBuildPostRequestBody( bodynumber );
    address := "api-uat-sgc.tianma.cn";
    url := "/otdService/https/GetStockingPointsInfo";
    port := 443;
    data := macroPlan.ApiResponesCheck( address, url, port, postrequestbody );
    macroPlan.ApiStockingPointData( data );
    // 货币信息-4
    info( "Currencies::DoSync" )
    bodynumber := "1";
    postrequestbody := macroPlan.ApiBuildPostRequestBody( bodynumber );
    address := "api-uat-sgc.tianma.cn";
    url := "/otdService/https/GetCurrenciesInfo";
    port := 443;
    data := macroPlan.ApiResponesCheck( address, url, port, postrequestbody );
    macroPlan.ApiCurenciesData( data );
    //货币汇率信息-5
    info( "CurrencyRates::DoSync" )
    bodynumber := "5";
    postrequestbody := macroPlan.ApiBuildPostRequestBody( bodynumber );
    address := "api-uat-sgc.tianma.cn";
    url := "/otdService/https/GetCurrencyRatesInfo";
    port := 443;
    data := macroPlan.ApiResponesCheck( address, url, port, postrequestbody );
    macroPlan.ApiCurencyRatesData( data );
    
    // 产品物料-6
    info( "Product::DoSync" )
    //todo: 数据有重复,先略过
    macroPlan.Broker_OTD_Product().Execute();
    info( "Start data mapping of product" );
    testproduct := construct( Strings );
    macroPlan.MappingProductData( testproduct, false );
    //单位转换-7
    info( "BaseConversionFactor::DoSync" )
    BaseConversionFactor::DoSync( macroPlan );
    // Unit-9 
    // 与Operation一同处理
    info( "Unit::DoSync" )
    info( "Start data broker of operation" );
    macroPlan.Broker_OTD_Operation().Execute();
    macroPlan.MappingUnitData( businessTypes );
    // 工艺路线 + BOM-9
    info( "Operation&BOM::DoSync" )
    info( "Start data mapping of operation" );
    macroPlan.MappingOperationData( businessTypes );  
    macroPlan.Broker_OTD_BOM().Execute();
    macroPlan.MappingOperationBOMData( businessTypes, isKeyProduct, createPurchaseSupplyMaterial );
    //车道信息-10
    info( "Lanes::DoSync" )
    bodynumber := "3";
    postrequestbody := macroPlan.ApiBuildPostRequestBody( bodynumber );
    address := "api-uat-sgc.tianma.cn";
    url := "/otdService/https/GetLanesInfo";
    port := 443;
    data := macroPlan.ApiResponesCheck( address, url, port, postrequestbody );
    macroPlan.ApiLanesData( data );
    //车道运输段-11
    info( "LaneLegs::DoSync" )
    bodynumber := "4";
    postrequestbody := macroPlan.ApiBuildPostRequestBody( bodynumber );
    address := "api-uat-sgc.tianma.cn";
    url := "/otdService/https/GetLaneLegsInfo";
    port := 443;
    data := macroPlan.ApiResponesCheck( address, url, port, postrequestbody );
    macroPlan.ApiLaneLegsData( data );
    //// 供应网络(车道)-12
    //info( "ProductInLane::DoSync" )
    //macroPlan.Broker_OTD_ProductInLane().Execute();
    //macroPlan.MappingProductInLaneData();
    // 在库库存数据-13
    info( "ActualPISPIP::DoSync" )
    macroPlan.Broker_OTD_ActualPISPIP().Execute();
    //macroPlan.MappingActualPISPIPData( businessTypes, true );
    macroPlan.MappingActualPISPIPData( businessTypes, false );
    //// 在途库存-14
    //info( "ExternalSupply::DoSync" )
    //info( "Start data broker of External supply" );
    //macroPlan.Broker_OTD_ExternalSupply().Execute();
    ////macroPlan.MappingExternalSupplyData( businessTypes, true );
    //info( "Start data mapping of External supply" );
    //macroPlan.MappingExternalSupplyData( businessTypes, false );
    //// 库存成本-15
    //info( "InventoryCost::DoSync" );
    //InventoryValueAndCost::DoSync( macroPlan );
    //// todo 制造成本-16
    //info( "OperationCost::DoSync" );
    //macroPlan.MappingOperationCostData( businessTypes );
    // 订单预测-17
    info( "Forecast::DoSync" );
    Forecast::DoSync( macroPlan, businessTypes );
    // 订单需求-18
    info( "CustomerOrder::DoSync" );
    CustomerOrder::DoSync( macroPlan, businessTypes );
    //// todo 供应商能力
    //info( "ProviderCapacity::DoSync" )
    //// todo 供应商回复
    //info( "ProviderReply::DoSync" )
  *]
}