| 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( "Start Initial" ); | 
|     macroPlan.InitialUnitAndStockingPoint(); | 
|      | 
|     // 单位-1 | 
|     UnitOfMeasure_MP::DoSync( macroPlan ); | 
|      | 
|     // 销售部门-2 | 
|     SalesSegment_MP::DoSync( macroPlan, businessTypes ); | 
|      | 
|     // 库存点-3 | 
|     info( "Sales Segment Finished, Start Get StockingPoint From Api" ) | 
|     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( "Get StockingPoint From Api Finished, Start Get CurrencyInfo From Api" ) | 
|     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( "Get CurrencyInfo From Api Finished, Start Get CurrencyRates From Api" ) | 
|     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( "Get CurrencyRates From Api Finished, Start Product Data Broker" ) | 
|     macroPlan.Broker_OTD_Product().Execute(); | 
|     info( "Product Data Broker Finished, Start Product Mapping" ); | 
|     //testproduct := construct( Strings ); | 
|     macroPlan.MappingProductData( businessTypes, isKeyProduct ); | 
|      | 
|     //单位转换-7 | 
|     BaseConversionFactor::DoSync( macroPlan ); | 
|      | 
|     // Unit-9  | 
|     // 与Operation一同处理 | 
|     info( "BaseConversionFactor Finished, Start Operation Data Broker" ); | 
|     macroPlan.Broker_OTD_Operation().Execute(); | 
|     info( "Operation Data Broker Finished, Start Unit Mapping" ); | 
|     macroPlan.MappingUnitData( businessTypes ); | 
|      | 
|     // 工艺路线 + BOM-9 | 
|     info( "Unit Finished, Start Operation Mapping" ); | 
|     macroPlan.MappingOperationData( businessTypes );   | 
|     info( "Operation Finished, Start BOM Data Broker" ); | 
|     macroPlan.Broker_OTD_BOM().Execute(); | 
|     info( "BOM Data Broker Finished, Start BOM Mapping" ); | 
|     macroPlan.MappingOperationBOMData( businessTypes, isKeyProduct, createPurchaseSupplyMaterial ); | 
|      | 
|     //车道信息-10 | 
|     info( "BOM Finished, Start Get Lanes From Api" ); | 
|     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( "Get Lanes From Api Finished, Start Get LaneLegs From Api" ); | 
|     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( "Get Lanelegs From Api Finished, Start ProductInLane Data Broker" ); | 
|     macroPlan.Broker_OTD_ProductInLane().Execute(); | 
|     info( "ProductInLane Data Broker Finished, Start ProductInLane Mapping" ); | 
|     macroPlan.MappingProductInLaneData(); | 
|      | 
|     // 在库库存数据-13 | 
|     info( "ProductInLane Finished, Start ActualPISPIP Data Broker" ); | 
|     macroPlan.Broker_OTD_ActualPISPIP().Execute(); | 
|     info( "ActualPISPIP Data Broker Finished, Start ActualPISPIP Mapping" ); | 
|     //macroPlan.MappingActualPISPIPData( businessTypes, true ); | 
|     macroPlan.MappingActualPISPIPData( businessTypes, isKeyProduct ); | 
|      | 
|     // 在途库存-14 | 
|     info( "ActualPISPIP Finished, Start ExternalSupply Data Broker" ); | 
|     macroPlan.Broker_OTD_ExternalSupply().Execute(); | 
|     //macroPlan.MappingExternalSupplyData( businessTypes, true ); | 
|     info( "ExternalSupply Data Broker Finished, Start ExternalSupply Mapping" ); | 
|     macroPlan.MappingExternalSupplyData( businessTypes, isKeyProduct ); | 
|      | 
|     // 库存成本-15 | 
|     InventoryValueAndCost::DoSync( macroPlan ); | 
|      | 
|     // todo 制造成本-16 | 
|     info( "InventoryCost Finished, Start OperationCost Mapping" ); | 
|     //macroPlan.MappingOperationCostData( businessTypes ); | 
|      | 
|     // 订单预测-17 | 
|     Forecast::DoSync( macroPlan, businessTypes ); | 
|      | 
|     // 订单需求-18 | 
|     CustomerOrder::DoSync( macroPlan, businessTypes ); | 
|      | 
|     //删除多余报错数据-19 | 
|     macroPlan.DeleteSnaityCheck(); | 
|      | 
|     //// todo 供应商能力 | 
|     //info( "ProviderCapacity::DoSync" ) | 
|      | 
|     //// todo 供应商回复 | 
|     //info( "ProviderReply::DoSync" ) | 
|   *] | 
| } |