From 769152ad8cd980ac8ef70e3ba2868cb9f6446738 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期四, 14 十一月 2024 11:07:41 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev

---
 _Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
index 85c9da7..7d6e205 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
@@ -40,48 +40,48 @@
             enginecosts       := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower() and engine.MLB_MQB() = product.MQBMLB() );
             transcosts        := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '鍙戝姩鏈�', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
             if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
-              products.Add( pisp.Product_MP() );
-              traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear 
-                        and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) ){
-                periodtime    := pispip.Start().StartOfMonth().Date();
-                periodname    := periodtime.Format( "M2/D2/Y" );
-                column        := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
+              traverse( table, Column, column ){
+                pispips       := selectset( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start().Date() >= column.StartDate() 
+                                            and pispip.Start().Date() < column.StartDate().StartOfNextMonth() 
+                                            and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) );
                 cell          := selectobject( row, Cell, cell, cell.Column() = column );
-                
+                newsupplyqty  := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() );
+                plannedinvqty := sum( pispips, Elements, pispip, pispip.PlannedInventoryLevelEnd() );
                 if( isdltoccrent){
                   //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
-                  enginecost  := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date()
+                  enginecost  := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate()  and engine.EndDate() >= column.StartDate() 
                                                      and engine.Factory() = ccfactory );
-                  cell.CCRentQty( cell.CCRentQty() + pispip.NewSupplyQuantity() );
+                  cell.CCRentQty( cell.CCRentQty() + newsupplyqty );
                   //闀挎槬澶栫搴撳叆搴撹垂鐢細鍏ュ簱閲�/鍖呰瀹归噺*鍏ュ簱鍗曚环 
-                  entercost   := ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
+                  entercost   := ceil( newsupplyqty / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
                   //闀挎槬澶栫搴撳嚭搴撹垂鐢�: 鍑哄簱閲�/鍖呰瀹归噺*鍑哄簱鍗曚环
-                  outcost     := ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
+                  outcost     := ceil( newsupplyqty / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
                   cell.CCRentInCost( cell.CCRentInCost() + entercost );
                   cell.CCRentOutOfCost( cell.CCRentOutOfCost() + outcost );
-                  cost        := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
+                  cost        := ceil( plannedinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
                   cell.CCRentStorCost( cell.CCRentStorCost() + cost );//闀挎槬澶栫搴撲粨鍌ㄨ垂鐢�
                   transcost   := selectobject( transcosts, Elements, trans, trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() and trans.Origin() = '闀挎槬澶栫搴�' and trans.Destination() = '瀹㈡埛搴�' );
                   if( not isnull( transcost ) ){
-                    cost      := ceil( ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
+                    cost      := ceil( ceil( newsupplyqty / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
                     cell.CCShorTransCost( cell.CCShorTransCost() + cost );//闀挎槬鐭�旇繍杈撹垂鐢�
                   }
                 } else {
                   //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
-                  enginecost  := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date()
+                  enginecost  := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate()  and engine.EndDate() >= column.StartDate() 
                                                      and engine.Factory() = dlfactory  );
                   if( not isnull( enginecost ) ){
-                    cost      := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
+                    cost      := ceil( plannedinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
                     cell.DLRentStorCost( cell.DLRentStorCost() + cost );//澶ц繛澶栫搴撲粨鍌ㄨ垂鐢�
-                    row.SetDLRentEnterCost( column, enginecost, pispip.NewSupplyQuantity() );//澶ц繛澶栫搴撳叆搴撹垂鐢�
-                    transcost := selectobject( transcosts, Elements, trans, trans.StartDate() <= pispip.Start().Date() and trans.EndDate() >= pispip.Start().Date() and trans.Origin() = '澶ц繛鍘傚唴搴�' and trans.Destination() = '澶ц繛澶栫搴�' );
+                    row.SetDLRentEnterCost( column, enginecost, newsupplyqty );//澶ц繛澶栫搴撳叆搴撹垂鐢�
+                    transcost := selectobject( transcosts, Elements, trans, trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() and trans.Origin() = '澶ц繛鍘傚唴搴�' and trans.Destination() = '澶ц繛澶栫搴�' );
                     if( not isnull( transcost ) ){
-                      cost    := ceil( ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
+                      cost    := ceil( ceil( newsupplyqty / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
                       row.SetFactoryToRentTransCost( column, cost );
                     }
                   }
                 }
-              }   
+              }
+              products.Add( pisp.Product_MP() );
             }
           }
         }

--
Gitblit v1.9.3