Fix Organcode filter
添加了场景名称做筛选的情况下事业部为空及组织编码为空等情况的代码处理,目前:
①事业部非空组织编码非空:按事业部、维护的组织编码筛选
②事业部非空组织编码空:按事业部、BOM中所有组织编码筛选
③事业部空组织编码非空:按全事业部、维护的组织编码筛选
④事业部空组织编码空:按全事业部、BOM中所有组织编码筛选
| | |
| | | StaticMethod DoSync ( |
| | | MacroPlan macroPlan, |
| | | Strings businessTypes, |
| | | GlobalOTDTable globalOTDTable |
| | | GlobalOTDTable globalOTDTable, |
| | | Strings organcodelist |
| | | ) |
| | | { |
| | | TextBody: |
| | |
| | | //info( "Forecast Finished, Start CustomerOrder Data Broker" ); |
| | | //macroPlan.Broker_OTD_CustomerOrder().Execute(); |
| | | info( "CustomerOrder Data Broker Finished, Start CustomerOrder Mapping" ); |
| | | macroPlan.MappingCustomerOrderData( businessTypes,globalOTDTable ); |
| | | macroPlan.MappingCustomerOrderData( businessTypes,globalOTDTable, organcodelist ); |
| | | *] |
| | | } |
| | |
| | | StaticMethod DoSync ( |
| | | MacroPlan macroPlan, |
| | | Strings businessTypes, |
| | | GlobalOTDTable globalOTDTable |
| | | GlobalOTDTable globalOTDTable, |
| | | Strings organcodelist |
| | | ) |
| | | { |
| | | TextBody: |
| | |
| | | //info( "OperationCost Finished, Start Forecast Data Broker" ); |
| | | //macroPlan.Broker_OTD_Forecast().Execute(); |
| | | info( "Forecast Data Broker Finished, Start Forecast Mapping" ); |
| | | macroPlan.MappingForecastData( businessTypes,globalOTDTable ); |
| | | macroPlan.MappingForecastData( businessTypes,globalOTDTable, organcodelist ); |
| | | *] |
| | | } |
| | |
| | | if ( isStockingPoint_MP ) { |
| | | this.Global_MappingStockingPoint_MP( relflush ); |
| | | Global_BrokerExecuteLog::CreateInOperation( this, "StockingPoint_MP", executionUser ); |
| | | this -> Global_MappingStockingPoint_MP::CreateByAPI() -> Exception() -> Global_MappingStockingPoint_MP::OnException( this ); |
| | | // this -> Global_MappingStockingPoint_MP::CreateByAPI() -> Exception() -> Global_MappingStockingPoint_MP::OnException( this ); |
| | | } |
| | | |
| | | if ( isCurrency_MP ) { |
| | | this.Global_MappingCurrency_MP( relflush ); |
| | | Global_BrokerExecuteLog::CreateInOperation( this, "Currency_MP", executionUser ); |
| | | this -> Global_MappingCurrency_MP::CreateByAPI() -> Exception() -> Global_MappingCurrency_MP::OnException( this ); |
| | | // this -> Global_MappingCurrency_MP::CreateByAPI() -> Exception() -> Global_MappingCurrency_MP::OnException( this ); |
| | | } |
| | | |
| | | if ( isCurrencyRate_MP ) { |
| | | this.Global_MappingCurrencyRate_MP( relflush ); |
| | | Global_BrokerExecuteLog::CreateInOperation( this, "CurrencyRate_MP", executionUser ); |
| | | this -> Global_MappingCurrencyRate_MP::CreateByAPI() -> Exception() -> Global_MappingCurrencyRate_MP::OnException( this ); |
| | | // this -> Global_MappingCurrencyRate_MP::CreateByAPI() -> Exception() -> Global_MappingCurrencyRate_MP::OnException( this ); |
| | | } |
| | | |
| | | if ( isLane ) { |
| | | this.Global_MappingLane( relflush ); |
| | | Global_BrokerExecuteLog::CreateInOperation( this, "Lane", executionUser ); |
| | | this -> Global_MappingLane::CreateByAPI() -> Exception() -> Global_MappingLane::OnException( this ); |
| | | // this -> Global_MappingLane::CreateByAPI() -> Exception() -> Global_MappingLane::OnException( this ); |
| | | } |
| | | |
| | | if ( isLaneLeg ) { |
| | | this.Global_MappingLaneLeg( relflush ); |
| | | Global_BrokerExecuteLog::CreateInOperation( this, "LaneLeg", executionUser ); |
| | | this -> Global_MappingLaneLeg::CreateByAPI() -> Exception() -> Global_MappingLaneLeg::OnException( this ); |
| | | // this -> Global_MappingLaneLeg::CreateByAPI() -> Exception() -> Global_MappingLaneLeg::OnException( this ); |
| | | } |
| | | *] |
| | | } |
| | |
| | | Method MappingActualPISPIPData ( |
| | | Strings businessTypes, |
| | | GlobalOTDTable globalOTDTable, |
| | | Boolean nuclear |
| | | Boolean nuclear, |
| | | Strings organcodelist |
| | | ) |
| | | { |
| | | TextBody: |
| | | [* |
| | | // renhao Aug-14-2023 (created) |
| | | organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); |
| | | listtodeal := selectset( globalOTDTable, |
| | | Global_MappingActualProductInStockingPointInPeriod, |
| | | actual, |
| | |
| | | #parent: #root |
| | | Method MappingCustomerOrderData ( |
| | | Strings businessTypes, |
| | | GlobalOTDTable globalOTDTable |
| | | GlobalOTDTable globalOTDTable, |
| | | Strings organcodelist |
| | | ) |
| | | { |
| | | Description: 'ETL订单预测' |
| | |
| | | if( isnull( businessTypes ) or businessTypes.Size() = 0 ) { |
| | | listToDeal := selectset( globalOTDTable, Global_MappingCustomOrder, item, true ); |
| | | } else { |
| | | organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); |
| | | listToDeal := selectset( globalOTDTable, |
| | | Global_MappingCustomOrder, |
| | | item, |
| | |
| | | Method MappingExternalSupplyData ( |
| | | Strings businessTypes, |
| | | Boolean nuclear, |
| | | GlobalOTDTable globalOTDTable |
| | | GlobalOTDTable globalOTDTable, |
| | | Strings organcodelist |
| | | ) |
| | | { |
| | | TextBody: |
| | |
| | | // renhao Aug-14-2023 (created) |
| | | queryStartDate := guard( min( this, Period_MP, item, true, item.StartDate() ) - Duration::Days( 30 ), DateTime::MinDateTime() ).Date(); |
| | | queryEndDate := guard( max( this, Period_MP, item, true, item.EndDate() ), Date::MaxDate() ); |
| | | organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); |
| | | listtodeal := selectset( globalOTDTable, |
| | | Global_MappingInventorySupply, |
| | | externalSupply, |
| | |
| | | #parent: #root |
| | | Method MappingForecastData ( |
| | | Strings businessTypes, |
| | | GlobalOTDTable globalOTDTable |
| | | GlobalOTDTable globalOTDTable, |
| | | Strings organcodelist |
| | | ) |
| | | { |
| | | Description: 'ETL订单预测' |
| | |
| | | if( isnull( businessTypes ) or businessTypes.Size() = 0 ) { |
| | | listToDeal := selectset( globalOTDTable, Global_MappingForecast, item, item.Quantity() > 0 ); |
| | | } else { |
| | | organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); |
| | | listToDeal := selectset( globalOTDTable, |
| | | Global_MappingForecast, |
| | | item, |
| | |
| | | Strings businessTypes, |
| | | Boolean isKeyProduct, |
| | | Boolean createPurchaseSupplyMaterial, |
| | | GlobalOTDTable globalOTDTable |
| | | GlobalOTDTable globalOTDTable, |
| | | Strings organcodelist |
| | | ) |
| | | { |
| | | TextBody: |
| | |
| | | if( isKeyProduct ) { |
| | | keyProductList := selectuniquevalues( globalOTDTable, Global_MappingProduct_MP, item, item.ProductMajorType()="成品" or item.ProductMajorType()="半成品", item.ID() ); |
| | | } |
| | | organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); |
| | | bomList := selectsortedset( globalOTDTable, Global_MappingOperationBOM, item, |
| | | ifexpr( isnull( businessTypes ) or businessTypes.Size() = 0, |
| | | true, |
| | |
| | | #parent: #root |
| | | Method MappingOperationCostData ( |
| | | GlobalOTDTable globalOTDTable, |
| | | Strings businesstypes |
| | | Strings businesstypes, |
| | | Strings organcodelist |
| | | ) |
| | | { |
| | | Description: 'Get operation cost data from operation mapping' |
| | |
| | | if( isnull( businesstypes ) or businesstypes.Size() = 0 ) { |
| | | listtodeal := selectset( globalOTDTable, Global_MappingOperation, item, true ); |
| | | } else { |
| | | organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businesstypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); |
| | | listtodeal := selectset( globalOTDTable, Global_MappingOperation, |
| | | item, |
| | | ( businesstypes.Find( item.BusinessType() ) <> -1 ) and |
| | |
| | | #parent: #root |
| | | Method MappingOperationData ( |
| | | Strings businessTypes, |
| | | GlobalOTDTable globalOTDTable |
| | | GlobalOTDTable globalOTDTable, |
| | | Strings organcodelist |
| | | ) |
| | | { |
| | | TextBody: |
| | |
| | | // 获取有序的待处理记录 |
| | | toDealList := construct( Global_MappingOperations ) ; |
| | | if( not isnull( businessTypes ) and businessTypes.Size() > 0 ) { |
| | | organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); |
| | | toDealList := selectsortedset( globalOTDTable, Global_MappingOperation, item, |
| | | ( businessTypes.Find( item.BusinessType() ) >= 0 ) and |
| | | ( organcodelist.Find( item.OrganCode() ) >= 0 ), |
| | |
| | | #parent: #root |
| | | Method MappingUnitData ( |
| | | Strings businesstypes, |
| | | GlobalOTDTable globalOTDTable |
| | | GlobalOTDTable globalOTDTable, |
| | | Strings organcodelist |
| | | ) |
| | | { |
| | | Description: 'Get unit data from operation mapping' |
| | |
| | | if( isnull( businesstypes ) or businesstypes.Size() = 0 ) { |
| | | listtodeal := selectset( globalOTDTable, Global_MappingOperation, item, true ); |
| | | } else { |
| | | organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businesstypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); |
| | | listtodeal := selectset( globalOTDTable, Global_MappingOperation, item, |
| | | // businesstypes.Difference( businesstypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0 |
| | | ( businesstypes.Find( item.BusinessType() ) >= 0 ) and |
| | |
| | | // 币种和币种汇率 |
| | | //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 ) |
| | | |
| | |
| | | //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" ) |
| | |
| | | |
| | | // 工艺路线 + 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" ); |
| | |
| | | //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(); |