| | |
| | | #parent: #root |
| | | StaticMethod DoASync ( |
| | | MacroPlan macroPlan, |
| | | Strings businessTypes, |
| | | const BusinessType businessType, |
| | | Boolean isKeyProduct, |
| | | Boolean createPurchaseSupplyMaterial, |
| | | const GlobalOTDTable globalOTDTable |
| | | ) |
| | | ) as stream[MacroPlan] |
| | | { |
| | | Description: '单次同步' |
| | | TextBody: |
| | |
| | | //Currency_MP::CreateCurrencyFromJson( macroPlan, jsonDataRow ); |
| | | info( "Prepare to do sync" ) |
| | | info( "Get organ code list" ) |
| | | organcodelist := selectvalues( globalOTDTable, Global_MappingOperationBOM, bom,true, bom.OrganCode() ); |
| | | if( not isnull( businessTypes ) and businessTypes.Size() > 0 ) { |
| | | traverse( businessTypes, Elements, item ) { |
| | | info( "Business type : " + item ) |
| | | } |
| | | organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); |
| | | } |
| | | else{ |
| | | if( businessTypes.Size() = 0 ){ |
| | | if( not isnull( selectset( globalOTDTable, BusinessType, b, b.BusinessTypeName() = "" ) ) ){ |
| | | organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, organ.BusinessType().BusinessTypeName() = "", organ.OrganCodeName() ); |
| | | } |
| | | } |
| | | } |
| | | businessTypeName := businessType.BusinessTypeName().Tokenize( "," ); |
| | | macroPlan.BusinessType( businessType.BusinessTypeName() ); |
| | | |
| | | organcodelist := selectvalues( businessType, OrganCode, organ, true, organ.OrganCodeName() ); |
| | | |
| | | if( organcodelist.Size() = 0 ){ |
| | | organcodelist := selectvalues( globalOTDTable, Global_MappingOperationBOM, bom,true, bom.OrganCode() ); |
| | | organcodelist := selectuniquevalues( globalOTDTable, Global_MappingOperationBOM, bom,true, bom.OrganCode() ); |
| | | } |
| | | |
| | | info( "Organcode list : " + organcodelist.ToString( "-" ) ); |
| | | info( "KeyProduct : " + [String]isKeyProduct ) |
| | | info( "Create purchase supply material : " + [String]createPurchaseSupplyMaterial ) |
| | | |
| | |
| | | UnitOfMeasure_MP::DoASync( globalOTDTable, macroPlan ); |
| | | |
| | | // 销售部门-2 |
| | | SalesSegment_MP::DoASync( macroPlan, businessTypes,globalOTDTable ); |
| | | SalesSegment_MP::DoASync( macroPlan, businessTypeName,globalOTDTable ); |
| | | |
| | | // Unit-9 |
| | | // 与Operation一同处理 |
| | | //info( "BaseConversionFactor Finished, Start Operation Data Broker" ); |
| | | //macroPlan.Broker_OTD_Operation().Execute(); |
| | | info( "Operation Data Broker Finished, Start Unit Mapping" ); |
| | | macroPlan.DoASyncMappingUnitData( businessTypes ,globalOTDTable, organcodelist); |
| | | macroPlan.DoASyncMappingUnitData( businessTypeName ,globalOTDTable, organcodelist); |
| | | |
| | | // 库存点-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 ); |
| | | info( "Sales Segment Finished, Start Get StockingPoint From Mapping" ) |
| | | StockingPoint_MP::CreateFromMapping( globalOTDTable, macroPlan ); |
| | | //parameter := select( globalOTDTable, GlobalParameters, param, param.AttributeName() = "StockingPoint" ); |
| | | //postrequestbody := parameter.PostRequestBody(); |
| | | //address := parameter.Address(); |
| | | //url := parameter.AttributeValue(); |
| | | //port := [Number]parameter.Port(); |
| | | //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 ); |
| | | info( "Get StockingPoint From Api Finished, Start Get CurrencyInfo From Mapping" ) |
| | | Currency_MP::CreateFromMapping( globalOTDTable, macroPlan ); |
| | | |
| | | //货币汇率信息-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 ); |
| | | info( "Get CurrencyInfo From Api Finished, Start Get CurrencyRates From Mapping" ) |
| | | CurrencyRate_MP::CreateFromMapping( globalOTDTable, macroPlan ); |
| | | |
| | | // 产品物料-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.DoASyncMappingProductData( businessTypes, globalOTDTable,isKeyProduct ); |
| | | macroPlan.DoASyncMappingProductData( businessTypeName, globalOTDTable,isKeyProduct ); |
| | | |
| | | //单位转换-7 |
| | | BaseConversionFactor::DoASync( macroPlan ,globalOTDTable); |
| | | |
| | | // 工艺路线 + BOM-9 |
| | | info( "Unit Finished, Start Operation Mapping" ); |
| | | macroPlan.DoASyncMappingOperationData( businessTypes ,globalOTDTable, organcodelist ); |
| | | macroPlan.DoASyncMappingOperationData( businessTypeName ,globalOTDTable, organcodelist ); |
| | | //info( "Operation Finished, Start BOM Data Broker" ); |
| | | //macroPlan.Broker_OTD_BOM().Execute(); |
| | | info( "BOM Data Broker Finished, Start BOM Mapping" ); |
| | | macroPlan.DoASyncMappingOperationBOMData( businessTypes, isKeyProduct, createPurchaseSupplyMaterial,globalOTDTable, organcodelist ); |
| | | macroPlan.DoASyncMappingOperationBOMData( businessTypeName, isKeyProduct, createPurchaseSupplyMaterial,globalOTDTable, organcodelist ); |
| | | |
| | | //车道信息-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 ); |
| | | info( "BOM Finished, Start Get Lanes From Mapping" ); |
| | | Lane::CreasteFromMapping( globalOTDTable, macroPlan ); |
| | | |
| | | //车道运输段-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 ); |
| | | info( "Get Lanes From Api Finished, Start Get LaneLegs From Mapping" ); |
| | | LaneLeg::CreateFromMapping( globalOTDTable, macroPlan ); |
| | | |
| | | // 供应网络(车道)-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.DoASyncMappingProductInLaneData(globalOTDTable); |
| | | macroPlan.DoASyncMappingProductInLaneData( globalOTDTable,businessTypeName ); |
| | | |
| | | // 在库库存数据-13 |
| | | //info( "ProductInLane Finished, Start ActualPISPIP Data Broker" ); |
| | | //macroPlan.Broker_OTD_ActualPISPIP().Execute(); |
| | | info( "ActualPISPIP Data Broker Finished, Start ActualPISPIP Mapping" ); |
| | | macroPlan.DoASyncMappingActualPISPIPData( businessTypes, globalOTDTable,isKeyProduct, organcodelist ); |
| | | macroPlan.DoASyncMappingActualPISPIPData( businessTypeName, globalOTDTable,isKeyProduct, organcodelist ); |
| | | |
| | | // 在途库存-14 |
| | | //info( "ActualPISPIP Finished, Start ExternalSupply Data Broker" ); |
| | | //macroPlan.Broker_OTD_ExternalSupply().Execute(); |
| | | info( "ExternalSupply Data Broker Finished, Start ExternalSupply Mapping" ); |
| | | macroPlan.DoASyncMappingExternalSupplyData( businessTypes, isKeyProduct ,globalOTDTable, organcodelist ); |
| | | macroPlan.DoASyncMappingExternalSupplyData( businessTypeName, isKeyProduct ,globalOTDTable, organcodelist ); |
| | | |
| | | // 库存成本-15 |
| | | InventoryValueAndCost::DoASync( macroPlan,globalOTDTable ); |
| | | InventoryValueAndCost::DoASync( macroPlan,globalOTDTable,businessTypeName ); |
| | | |
| | | // todo 制造成本-16 |
| | | info( "InventoryCost Finished, Start OperationCost Mapping" ); |
| | | macroPlan.DoASyncMappingOperationCostData( globalOTDTable, businessTypes, organcodelist ); |
| | | macroPlan.DoASyncMappingOperationCostData( globalOTDTable, businessTypeName, organcodelist ); |
| | | |
| | | // 订单预测-17 |
| | | Forecast::DoASync( macroPlan, businessTypes, globalOTDTable, organcodelist ); |
| | | Forecast::DoASync( macroPlan, businessTypeName, globalOTDTable, organcodelist ); |
| | | |
| | | // 订单需求-18 |
| | | CustomerOrder::DoASync( macroPlan, businessTypes, globalOTDTable, organcodelist ); |
| | | CustomerOrder::DoASync( macroPlan, businessTypeName, globalOTDTable, organcodelist ); |
| | | |
| | | //删除多余报错数据-19 |
| | | macroPlan.DeleteSnaityCheck(); |
| | |
| | | |
| | | //// todo 供应商回复 |
| | | //info( "ProviderReply::DoSync" ) |
| | | |
| | | return emit( macroPlan ); |
| | | *] |
| | | } |