From 5ae534ab606e6f2ba5ea60914224d665b0447d5a Mon Sep 17 00:00:00 2001 From: Kevin Kok Khah Whey <khahwhey.kok@3ds.com> Date: 星期二, 07 十一月 2023 22:48:31 +0800 Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/TIANMA_JITUAN into dev_Kevin --- _Main/BL/Type_MacroPlan/Method_DoASyncMappingOperationBOMData.qbl | 29 +++++++++++++++++++++++++---- 1 files changed, 25 insertions(+), 4 deletions(-) diff --git a/_Main/BL/Type_MacroPlan/Method_DoASyncMappingOperationBOMData.qbl b/_Main/BL/Type_MacroPlan/Method_DoASyncMappingOperationBOMData.qbl index 8c1a8e4..37eb082 100644 --- a/_Main/BL/Type_MacroPlan/Method_DoASyncMappingOperationBOMData.qbl +++ b/_Main/BL/Type_MacroPlan/Method_DoASyncMappingOperationBOMData.qbl @@ -13,7 +13,7 @@ // yypsybs Aug-21-2023 (created) keyProductList := construct( Strings ); if( isKeyProduct ) { - keyProductList := selectuniquevalues( globalOTDTable, Global_MappingProduct_MP, item, item.ProductMajorType()="鎴愬搧" or item.ProductMajorType()="鍗婃垚鍝�", item.ID() ); + keyProductList := selectuniquevalues( globalOTDTable, Global_MappingProduct_MP, item, item.ProductMajorType()="鎴愬搧" or item.ProductMajorType()="鍗婃垚鍝�", item.ID() ); } bomList := selectsortedset( globalOTDTable, Global_MappingOperationBOM, item, ifexpr( isnull( businessTypes ) or businessTypes.Size() = 0, @@ -75,12 +75,33 @@ } } if( createPurchaseSupplyMaterial ) { - toCreateBomList := selectuniquevalues( bomList, Elements, item, + toCreateBomList := construct( Strings ); + alterCodes := construct( Strings ); + + if( isKeyProduct){ + toCreateBomList := selectuniquevalues( bomList, Elements, item, item.ComponentType() = "P" and keyProductList.Find( item.ComponentCode())>=0, item.OrganCode() + item.ComponentCode()); + + alterCodes := selectuniquevalues( bomList, Elements, item, + not item.AlternativeMaterialCode() = "" and item.AlternativeMaterialType() = "P" and keyProductList.Find( item.ComponentCode())>=0, item.OrganCode() + item.AlternativeMaterialCode()); + }else{ + toCreateBomList := selectuniquevalues( bomList, Elements, item, + item.ComponentType() = "P" , item.OrganCode() + item.ComponentCode()); + + alterCodes := selectuniquevalues( bomList, Elements, item, + not item.AlternativeMaterialCode() = "" and item.AlternativeMaterialType() = "P", item.OrganCode() + item.AlternativeMaterialCode()); + } + toCreateBomList := toCreateBomList.Union( alterCodes); traverse( toCreateBomList, Elements, key ) { boms := selectset( bomList, Elements, item, item.ComponentType() = "P" and item.OrganCode() + item.ComponentCode() = key ); - bom := boms.First(); - this.MappingOperationBOMDataSupplyPurchase( bom.OrganCode(), bom.ComponentCode(), bom.ComponentType()); + if( boms.Size()=0){ + boms := selectset( bomList, Elements, item, item.ComponentType() = "P" and item.OrganCode() + item.AlternativeMaterialCode() = key ); + } + if( boms.Size()>0){ + bom := boms.First(); + this.MappingOperationBOMDataSupplyPurchase( bom.OrganCode(), bom.ComponentCode(), bom.ComponentType()); + } + } } -- Gitblit v1.9.3