yunchai
2023-10-12 e8619d825e5f09daf129b4847bf2bf4e660d40c5
_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
@@ -15,11 +15,26 @@
    // 币种和币种汇率
    //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() );
          }
        }
      }
    if( organcodelist.Size() = 0 ){
      organcodelist := selectvalues( globalOTDTable, Global_MappingOperationBOM, bom,true, bom.OrganCode() );
      }
    info( "KeyProduct : " + [String]isKeyProduct )
    info( "Create purchase supply material : " + [String]createPurchaseSupplyMaterial )
    
@@ -38,7 +53,7 @@
    //info( "BaseConversionFactor Finished, Start Operation Data Broker" );
    //macroPlan.Broker_OTD_Operation().Execute();
    info( "Operation Data Broker Finished, Start Unit Mapping" );
    macroPlan.MappingUnitData( businessTypes ,globalOTDTable);
    macroPlan.MappingUnitData( businessTypes ,globalOTDTable, organcodelist);
    
    // 库存点-3
    info( "Sales Segment Finished, Start Get StockingPoint From Api" )
@@ -82,11 +97,11 @@
    
    // 工艺路线 + BOM-9
    info( "Unit Finished, Start Operation Mapping" );
    macroPlan.MappingOperationData( businessTypes ,globalOTDTable);
    macroPlan.MappingOperationData( businessTypes ,globalOTDTable, organcodelist );
    //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,globalOTDTable );
    macroPlan.MappingOperationBOMData( businessTypes, isKeyProduct, createPurchaseSupplyMaterial,globalOTDTable, organcodelist );
    
    //车道信息-10
    info( "BOM Finished, Start Get Lanes From Api" );
@@ -118,26 +133,26 @@
    //info( "ProductInLane Finished, Start ActualPISPIP Data Broker" );
    //macroPlan.Broker_OTD_ActualPISPIP().Execute();
    info( "ActualPISPIP Data Broker Finished, Start ActualPISPIP Mapping" );
    macroPlan.MappingActualPISPIPData( businessTypes, globalOTDTable,isKeyProduct );
    macroPlan.MappingActualPISPIPData( businessTypes, 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.MappingExternalSupplyData( businessTypes, isKeyProduct ,globalOTDTable);
    macroPlan.MappingExternalSupplyData( businessTypes, isKeyProduct ,globalOTDTable, organcodelist );
    
    // 库存成本-15
    InventoryValueAndCost::DoSync( macroPlan,globalOTDTable );
    
    // todo 制造成本-16
    info( "InventoryCost Finished, Start OperationCost Mapping" );
    macroPlan.MappingOperationCostData( globalOTDTable, businessTypes );
    macroPlan.MappingOperationCostData( globalOTDTable, businessTypes, organcodelist );
    
    // 订单预测-17
    Forecast::DoSync( macroPlan, businessTypes ,globalOTDTable);
    Forecast::DoSync( macroPlan, businessTypes, globalOTDTable, organcodelist );
    
    // 订单需求-18
    CustomerOrder::DoSync( macroPlan, businessTypes, globalOTDTable);
    CustomerOrder::DoSync( macroPlan, businessTypes, globalOTDTable, organcodelist );
    
    //删除多余报错数据-19
    macroPlan.DeleteSnaityCheck();