From 3cb5a54def670d97301f07170fcaad213bfc54f2 Mon Sep 17 00:00:00 2001
From: yypsybs <yypsybs@foxmail.com>
Date: 星期六, 09 九月 2023 15:30:46 +0800
Subject: [PATCH] 同步逻辑由MacroPlan移到MPSync

---
 _Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting#576.qbl |  162 +++++++++++++++++++++++++++---------------------------
 1 files changed, 81 insertions(+), 81 deletions(-)

diff --git "a/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting\043576.qbl" "b/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting\043576.qbl"
index 03a3858..3eb9f87 100644
--- "a/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting\043576.qbl"
+++ "b/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting\043576.qbl"
@@ -9,87 +9,87 @@
 {
   TextBody:
   [*
-    // yypsybs Aug-21-2023 (created)
-    
-    // 鏍规嵁宸ヨ壓娈垫眹鎬诲鐞�
-    processSections := selectuniquevalues( routingRows, Elements, row, true, row.ProcessSection() );
-    traverse( processSections, Elements, processSection ) {
-        rows := selectset( routingRows, Elements, row, row.ProcessSection() = processSection );
-        firstRow := rows.Element( 0 );
-        // 鎵緊rgCode/productId/processSection鍖归厤涓攕equence鏈�灏忕殑涓�缁勬暟鎹�
-        minSeq := MappingOperation::FindMinSeq( this, firstRow.OrganCode(), firstRow.ProductCode(), processSection );
-        routingStepId := processSection + "_" + [String]minSeq;
-        // 鎵惧搴攔outingStep
-        routingStep := RoutingStep::FindByName( routing, routingStepId );
-        if( not isnull( routingStep ) ) {
-    //        error( "routing step : " + routing.ID() + "|" + routingStepId + " not found" );  
-        // 浠呬富鏂欙紝缁熶竴澶勭悊
-          noAlterRows := selectset( rows, Elements, noAlterRow, noAlterRow.AlternativeMaterialCode() = "" );
-          traverse( noAlterRows, Elements, noAlterRow ) {
-              traverse( routingStep, Operation, toLink ) {
-                  // 妫�鏌ヤ富鏂�
-                  component := Product_MP::FindById( this, noAlterRow.ComponentCode() );
-                  if( not isnull( component ) ) {
-    //                  error( "component : " + noAlterRow.ComponentCode() + " not found" );
-                  // 杩炴帴浜у搧涓巓peration
-                  pisp := ProductInStockingPoint_MP::CreateIfNotFound( component, stockingPoint );
-                  trash := construct( OperationBOMs );
-                  operationBOM := toLink.LinkProduct( component, true, BaseOperationLink::GetGroupID( toLink, true, false ), pisp, 
-                                                      true, trash );
-                  operationBOM.MinQuantityInGroup( 0 );
-                  operationBOM.Quantity( noAlterRow.UnitUsageOfComponents() / noAlterRow.ComponentOutputRate() );
-                  operationBOM.MaxQuantityInGroup( noAlterRow.UnitUsageOfComponents() / noAlterRow.ComponentOutputRate() );
-                  }
-              }
-          }
-          // 鏇挎崲鏂欙紝鎸変富鏂欏垎缁勫鐞�
-          alterComponentIds := selectuniquevalues( rows, Elements, row, row.AlternativeMaterialCode() <> "", row.ComponentCode() );
-          traverse( alterComponentIds, Elements, alterComponentId ) {
-              alterRows := selectset( rows, Elements, row, row.ComponentCode() = alterComponentId );
-              firstAlterRow := alterRows.Element( 0 );
-              // 妫�鏌ヤ富鏂�
-              component := Product_MP::FindById( this, firstAlterRow.ComponentCode() );
-              if( not isnull( component ) ) {
-    //              error( "component : " + firstAlterRow.ComponentCode() + " not found" );
+    //// yypsybs Aug-21-2023 (created)
+    //
+    //// 鏍规嵁宸ヨ壓娈垫眹鎬诲鐞�
+    //processSections := selectuniquevalues( routingRows, Elements, row, true, row.ProcessSection() );
+    //traverse( processSections, Elements, processSection ) {
+    //    rows := selectset( routingRows, Elements, row, row.ProcessSection() = processSection );
+    //    firstRow := rows.Element( 0 );
+    //    // 鎵緊rgCode/productId/processSection鍖归厤涓攕equence鏈�灏忕殑涓�缁勬暟鎹�
+    //    minSeq := MappingOperation::FindMinSeq( this, firstRow.OrganCode(), firstRow.ProductCode(), processSection );
+    //    routingStepId := processSection + "_" + [String]minSeq;
+    //    // 鎵惧搴攔outingStep
+    //    routingStep := RoutingStep::FindByName( routing, routingStepId );
+    //    if( not isnull( routingStep ) ) {
+    ////        error( "routing step : " + routing.ID() + "|" + routingStepId + " not found" );  
+    //    // 浠呬富鏂欙紝缁熶竴澶勭悊
+    //      noAlterRows := selectset( rows, Elements, noAlterRow, noAlterRow.AlternativeMaterialCode() = "" );
+    //      traverse( noAlterRows, Elements, noAlterRow ) {
+    //          traverse( routingStep, Operation, toLink ) {
+    //              // 妫�鏌ヤ富鏂�
+    //              component := Product_MP::FindById( this, noAlterRow.ComponentCode() );
+    //              if( not isnull( component ) ) {
+    ////                  error( "component : " + noAlterRow.ComponentCode() + " not found" );
+    //              // 杩炴帴浜у搧涓巓peration
+    //              pisp := ProductInStockingPoint_MP::CreateIfNotFound( component, stockingPoint );
+    //              trash := construct( OperationBOMs );
+    //              operationBOM := toLink.LinkProduct( component, true, BaseOperationLink::GetGroupID( toLink, true, false ), pisp, 
+    //                                                  true, trash );
+    //              operationBOM.MinQuantityInGroup( 0 );
+    //              operationBOM.Quantity( noAlterRow.UnitUsageOfComponents() / noAlterRow.ComponentOutputRate() );
+    //              operationBOM.MaxQuantityInGroup( noAlterRow.UnitUsageOfComponents() / noAlterRow.ComponentOutputRate() );
+    //              }
     //          }
-                traverse( routingStep, Operation, toLink ) {
-                    // 杩炴帴浜у搧涓巓peration
-                    pisp := ProductInStockingPoint_MP::CreateIfNotFound( component, stockingPoint );
-                    trash := construct( OperationBOMs );
-                    mainBOM := toLink.LinkProduct( component, true, BaseOperationLink::GetGroupID( toLink, true, false ), pisp, 
-                                                        true, trash );
-                    mainBOM.Quantity( firstAlterRow.UnitUsageOfComponents() / firstAlterRow.ComponentOutputRate() );
-                    mainBOM.MaxQuantityInGroup( firstAlterRow.UnitUsageOfComponents() / firstAlterRow.ComponentOutputRate() );
-                    mainQty := mainBOM.Quantity();
-                    Transaction::Transaction().Propagate();
-                    // 娣诲姞杈呮枡
-                    traverse( alterRows, Elements, alterRow ) {
-                        alterProd := Product_MP::FindById( this, alterRow.AlternativeMaterialCode() );
-                        if( not isnull( alterProd ) ) {
-        //                    error( "alterProd : " + alterRow.AlternativeMaterialCode() + " not found" );
-                          stockingPointIdAlter := alterRow.OrganCode()  + "_" + alterRow.ProductType() + "_STOCK";
-                          stockingPointAlter := StockingPoint_MP::FindById( this, stockingPointIdAlter );
-                          if( isnull( stockingPointAlter ) ) {
-                              error( "stockingPoint : " + stockingPointIdAlter + " not found" );
-                          }
-                          pispAlter := ProductInStockingPoint_MP::CreateIfNotFound( alterProd, stockingPointAlter );
-                          mainInput := toLink.LastOperationInput();
-                          trash := construct( OperationBOMs );
-                          if( not isnull( mainInput ) ) {
-                              alterBom := mainInput.Operation().LinkPISP( pispAlter, true, mainInput.OperationLinkGroupID(), trash );
-                              alterBom.Quantity( mainBOM.MaxQuantityInGroup() * alterRow.AlternativeRate() );
-                              alterBom.MaxQuantityInGroup( mainBOM.MaxQuantityInGroup() );
-    //                          info( "Quantity" + [String]alterBom.Quantity() )
-    //                          info( "MaxQuantityInGroup" + [String]alterBom.MaxQuantityInGroup() )
-                              mainQty := mainQty - alterBom.Quantity();
-                          }
-                      }
-                      mainBOM.Quantity( mainQty );
-                   }
-                }
-              }
-          }
-       }
-    }
+    //      }
+    //      // 鏇挎崲鏂欙紝鎸変富鏂欏垎缁勫鐞�
+    //      alterComponentIds := selectuniquevalues( rows, Elements, row, row.AlternativeMaterialCode() <> "", row.ComponentCode() );
+    //      traverse( alterComponentIds, Elements, alterComponentId ) {
+    //          alterRows := selectset( rows, Elements, row, row.ComponentCode() = alterComponentId );
+    //          firstAlterRow := alterRows.Element( 0 );
+    //          // 妫�鏌ヤ富鏂�
+    //          component := Product_MP::FindById( this, firstAlterRow.ComponentCode() );
+    //          if( not isnull( component ) ) {
+    ////              error( "component : " + firstAlterRow.ComponentCode() + " not found" );
+    ////          }
+    //            traverse( routingStep, Operation, toLink ) {
+    //                // 杩炴帴浜у搧涓巓peration
+    //                pisp := ProductInStockingPoint_MP::CreateIfNotFound( component, stockingPoint );
+    //                trash := construct( OperationBOMs );
+    //                mainBOM := toLink.LinkProduct( component, true, BaseOperationLink::GetGroupID( toLink, true, false ), pisp, 
+    //                                                    true, trash );
+    //                mainBOM.Quantity( firstAlterRow.UnitUsageOfComponents() / firstAlterRow.ComponentOutputRate() );
+    //                mainBOM.MaxQuantityInGroup( firstAlterRow.UnitUsageOfComponents() / firstAlterRow.ComponentOutputRate() );
+    //                mainQty := mainBOM.Quantity();
+    //                Transaction::Transaction().Propagate();
+    //                // 娣诲姞杈呮枡
+    //                traverse( alterRows, Elements, alterRow ) {
+    //                    alterProd := Product_MP::FindById( this, alterRow.AlternativeMaterialCode() );
+    //                    if( not isnull( alterProd ) ) {
+    //    //                    error( "alterProd : " + alterRow.AlternativeMaterialCode() + " not found" );
+    //                      stockingPointIdAlter := alterRow.OrganCode()  + "_" + alterRow.ProductType() + "_STOCK";
+    //                      stockingPointAlter := StockingPoint_MP::FindById( this, stockingPointIdAlter );
+    //                      if( isnull( stockingPointAlter ) ) {
+    //                          error( "stockingPoint : " + stockingPointIdAlter + " not found" );
+    //                      }
+    //                      pispAlter := ProductInStockingPoint_MP::CreateIfNotFound( alterProd, stockingPointAlter );
+    //                      mainInput := toLink.LastOperationInput();
+    //                      trash := construct( OperationBOMs );
+    //                      if( not isnull( mainInput ) ) {
+    //                          alterBom := mainInput.Operation().LinkPISP( pispAlter, true, mainInput.OperationLinkGroupID(), trash );
+    //                          alterBom.Quantity( mainBOM.MaxQuantityInGroup() * alterRow.AlternativeRate() );
+    //                          alterBom.MaxQuantityInGroup( mainBOM.MaxQuantityInGroup() );
+    ////                          info( "Quantity" + [String]alterBom.Quantity() )
+    ////                          info( "MaxQuantityInGroup" + [String]alterBom.MaxQuantityInGroup() )
+    //                          mainQty := mainQty - alterBom.Quantity();
+    //                      }
+    //                  }
+    //                  mainBOM.Quantity( mainQty );
+    //               }
+    //            }
+    //          }
+    //      }
+    //   }
+    //}
   *]
 }

--
Gitblit v1.9.3