From 03f93088637930acbda3cd0b405114e0b00c13e4 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期一, 30 九月 2024 17:29:00 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev

---
 _Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl |   46 ++++++++++++++++++++++++----------------------
 1 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
index de5f0d3..ca7ed85 100644
--- a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
@@ -9,8 +9,8 @@
     // 鐢勫叞楦� Jun-24-2024 (created)
     owner.FinancialProductionSource( relflush );
     productparent             := MachiningPipelineReport::GetDefaultProductParent();
-    ccunit                    := MachiningPipelineReport::GetDefaultCCUnit();
-    dlunit                    := MachiningPipelineReport::GetDefaultDLUnit();
+    //ccunit                    := MachiningPipelineReport::GetDefaultCCUnit();
+    //dlunit                    := MachiningPipelineReport::GetDefaultDLUnit();
     //allunit                   := EnginePipelineReport::GetDefaultAllUnit();
     source                    := owner.MachiningPipelineSource( relnew, Name := MachiningPipelineReport::GetDefaultName() );
     table                     := source.Report( relnew, ID := source.Name(), Name := source.Name() );
@@ -32,19 +32,21 @@
       //鏄惁灞炰簬澶ц繛宸ュ巶
       isdl                    := stockingpoint.ID().StartsWith( 'DL' ) or unit.ID().StartsWith( 'DL' ) or exists( parentunits, Elements, punit, punit.ID().StartsWith( 'DL' ) );//unit.ID() = dlunit or exists( parentunits, Elements, punit, punit.ID() = dlunit );
       //鏄惁灞炰簬闀挎槬瑁呴厤绾緾C鍘傚唴搴�
-      isccassemnly            := stockingpoint.ID().EndsWith( '鍘傚唴搴�' ) and ( stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID().StartsWith( '闀挎槬' ) );//unit.ID() = MachiningPipelineReport::GetDefaultCCAssemnlyUnit() or exists( parentunits, Elements, punit, punit.ID() = MachiningPipelineReport::GetDefaultCCAssemnlyUnit() );
+    //  isccassemnly            := stockingpoint.ID().EndsWith( '鍘傚唴搴�' ) and ( stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID().StartsWith( '闀挎槬' ) );//unit.ID() = MachiningPipelineReport::GetDefaultCCAssemnlyUnit() or exists( parentunits, Elements, punit, punit.ID() = MachiningPipelineReport::GetDefaultCCAssemnlyUnit() );
       //鏄惁灞炰簬澶ц繛瑁呴厤绾緿L鍘傚唴搴�
-      isdlassemnly            := stockingpoint.ID().EndsWith( '鍘傚唴搴�' ) and ( stockingpoint.ID().StartsWith( 'DL' ) or stockingpoint.ID().StartsWith( '澶ц繛' ) );//unit.ID() = MachiningPipelineReport::GetDefaultDLAssemnlyUnit() or exists( parentunits, Elements, punit, punit.ID() = MachiningPipelineReport::GetDefaultDLAssemnlyUnit() );
+    //  isdlassemnly            := stockingpoint.ID().EndsWith( '鍘傚唴搴�' ) and ( stockingpoint.ID().StartsWith( 'DL' ) or stockingpoint.ID().StartsWith( '澶ц繛' ) );//unit.ID() = MachiningPipelineReport::GetDefaultDLAssemnlyUnit() or exists( parentunits, Elements, punit, punit.ID() = MachiningPipelineReport::GetDefaultDLAssemnlyUnit() );
       //鏄惁灞炰簬闀挎槬鏈哄姞浜х嚎
       isccproduction          := stockingpoint.ID().EndsWith( '绾胯竟搴�' ) and ( stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID().StartsWith( '闀挎槬' ) );//unit.ID() = MachiningPipelineReport::GetDefaultCCProductionUnit() or exists( parentunits, Elements, punit, punit.ID() = MachiningPipelineReport::GetDefaultCCProductionUnit() );
       //鏄惁灞炰簬澶ц繛鏈哄姞浜х嚎
       isdlproduction          := unit.ID().EndsWith( 'MoMo' ) and unit.ID().StartsWith( 'DL' );//unit.ID() = MachiningPipelineReport::GetDefaultDLProductionUnit() or exists( parentunits, Elements, punit, punit.ID() = MachiningPipelineReport::GetDefaultDLProductionUnit() );
       if( iscc or isdl ){
         traverse( stockingpoint, ProductInStockingPoint_MP, pisp,  pisp.Product_MP().IsLeaf() and not pisp.IsSystem() 
-    //              and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ) 
-                  and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) ) ){
+                  and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ) 
+                  and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 or pispip.DependentDemandAndSalesDemandQuantity() <> 0 ) ) ){
+          isccassemnly        := stockingpoint.ID().EndsWith( pisp.Product_MP().ParentID() + '绾胯竟搴�' ) and ( stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID().StartsWith( '闀挎槬' ) );
+          isdlassemnly        := stockingpoint.ID().EndsWith( pisp.Product_MP().ParentID() ) and ( stockingpoint.ID().StartsWith( 'DL' ) or stockingpoint.ID().StartsWith( '澶ц繛' ) );
           pispips             := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() 
-                                                  and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ), pispip.Start() );
+                                                  and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 or pispip.DependentDemandAndSalesDemandQuantity() <> 0 ), pispip.Start() );
           traverse( pispips, Elements, pispip ){
             supplyquantity    := [Number]pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
             //澶�
@@ -54,12 +56,13 @@
             
             //瑁呴厤绾�
             if( isccassemnly or isdlassemnly ){
+              quantity        := [Number]pispip.DependentDemandAndSalesDemandQuantity();//鍥涜垗浜斿叆
               if( isccassemnly ){
-                daycolumn.CCAssemblyPlanQty( daycolumn.CCAssemblyPlanQty() + supplyquantity );
-                weekcolumn.CCAssemblyPlanQty( weekcolumn.CCAssemblyPlanQty() + supplyquantity );
+                daycolumn.CCAssemblyPlanQty( daycolumn.CCAssemblyPlanQty() + quantity );
+                weekcolumn.CCAssemblyPlanQty( weekcolumn.CCAssemblyPlanQty() + quantity );
               } else {
-                daycolumn.DLAssemblyPlanQty( daycolumn.DLAssemblyPlanQty() + supplyquantity );
-                weekcolumn.DLAssemblyPlanQty( weekcolumn.DLAssemblyPlanQty() + supplyquantity );
+                daycolumn.DLAssemblyPlanQty( daycolumn.DLAssemblyPlanQty() + quantity );
+                weekcolumn.DLAssemblyPlanQty( weekcolumn.DLAssemblyPlanQty() + quantity );
               } 
             }
             
@@ -95,17 +98,17 @@
       productparents        := product.GetAllParent();
       if( exists( productparents, Elements, e, e.ID() = productparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
         //璧峰搴撳瓨鐐规槸鍚︽槸澶ц繛or闀挎槬
-        originsp              := selectobject( owner, StockingPoint_MP, sp, sp.ID() = tprow.SourceStockpoingPointID() );
-        originunit            := originsp.Unit();
-        originparentunits     := originunit.GetAllParent();
-        originiscc            := originsp.ID() = ccunit or originunit.ID() = ccunit or exists( originparentunits, Elements, punit, punit.ID() = ccunit );
-        originisdl            := originsp.ID() = dlunit or originunit.ID() = dlunit or exists( originparentunits, Elements, punit, punit.ID() = dlunit );
+    //    originsp              := selectobject( owner, StockingPoint_MP, sp, sp.ID() = tprow.SourceStockpoingPointID() );
+    //    originunit            := originsp.Unit();
+    //    originparentunits     := originunit.GetAllParent();
+        originiscc            := tprow.SourceStockpoingPointID() = 'CC';//originsp.ID() = ccunit or originunit.ID() = ccunit or exists( originparentunits, Elements, punit, punit.ID() = ccunit );
+        originisdl            := tprow.SourceStockpoingPointID() = 'DL';//originsp.ID() = dlunit or originunit.ID() = dlunit or exists( originparentunits, Elements, punit, punit.ID() = dlunit );
         //鐩殑鍦版槸鍚︽槸闀挎槬澶栫搴�
-        destisp               := selectobject( owner, StockingPoint_MP, sp, sp.ID() = tprow.TargetStockpoingPointID() );
-        destiunit             := destisp.Unit();
-        destiparentunits      := destiunit.GetAllParent();
-        destiiscc             := destisp.ID() = ccunit or destiunit.ID() = ccunit or exists( destiparentunits, Elements, punit, punit.ID() = ccunit );
-        destiisdl             := destisp.ID() = dlunit or destiunit.ID() = dlunit or exists( destiparentunits, Elements, punit, punit.ID() = dlunit );
+    //    destisp               := selectobject( owner, StockingPoint_MP, sp, sp.ID() = tprow.TargetStockpoingPointID() );
+    //    destiunit             := destisp.Unit();
+    //    destiparentunits      := destiunit.GetAllParent();
+        destiiscc             := tprow.TargetStockpoingPointID() = 'CC';//destisp.ID() = ccunit or destiunit.ID() = ccunit or exists( destiparentunits, Elements, punit, punit.ID() = ccunit );
+        destiisdl             := tprow.TargetStockpoingPointID() = 'DL';//destisp.ID() = dlunit or destiunit.ID() = dlunit or exists( destiparentunits, Elements, punit, punit.ID() = dlunit );
         if( ( originiscc and destiisdl ) or ( originisdl and destiiscc ) ){
           row := table.GetRow( tprow.ProductID() );
           traverse( tprow, TransferPlanCell, tpcell, tpcell.TransferPlanColumn().ColumnDate() <> Date::MinDate() ){
@@ -114,7 +117,6 @@
             //鍛�
             weekcolumn       := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), tpcell.TransferPlanColumn().ColumnDate() );
             quantity         := [Real]tpcell.Value();//鍥涜垗浜斿叆
-            
             if( not isnull( daycolumn ) ){
               row.SetCellTransferValue( daycolumn, ( originiscc and destiisdl ), quantity );
             }

--
Gitblit v1.9.3