From c6e8187d8a90489b985609fe7d94d4996ecee491 Mon Sep 17 00:00:00 2001
From: lihongji <3117313295@qq.com>
Date: 星期五, 15 十一月 2024 16:53:26 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 _Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl |   49 +++++++++++++++++++++++++++++++------------------
 1 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
index c8d0617..08be1c4 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
@@ -7,6 +7,7 @@
   TextBody:
   [*
     // 鐢勫叞楦� Aug-12-2024 (created)
+    // 鐢勫叞楦� Aug-12-2024 (created)
     owner.DLEngineLogisticsCostReport( relflush );
     produtparent              := DLEngineLogisticsCostReport::GetDefaultProductParent();
     name                      := DLEngineLogisticsCostReport::GetDefaultName();
@@ -45,28 +46,40 @@
                                             and pispip.Start().Date() < column.StartDate().StartOfNextMonth() 
                                             and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) );
                 cell          := selectobject( row, Cell, cell, cell.Column() = column );
-                entercost     := 0.0;
-                othercost     := 0.0;
-                outcost       := 0.0;
-                storecost     := 0.0;
-                transcost     := 0.0;
+                newsupplyqty  := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() );
+                plannedinvqty := sum( pispips, Elements, pispip, pispip.PlannedInventoryLevelEnd() );
                 if( isdltoccrent){
-                  othercost   := Real::MaxReal();
-                  transset    := selectset( transcosts, Elements, trans, trans.Origin() = '闀挎槬澶栫搴�' and trans.Destination() = '瀹㈡埛搴�' );
-                  column.CalcEngineCost( pispips, enginecosts, transset, ccfactory, entercost, othercost, outcost, storecost, transcost );
-                  cell.CCRentQty( cell.CCRentQty() + sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() ) );
+                  //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
+                  enginecost  := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate()  and engine.EndDate() >= column.StartDate() 
+                                                     and engine.Factory() = ccfactory );
+                  cell.CCRentQty( cell.CCRentQty() + newsupplyqty );
+                  //闀挎槬澶栫搴撳叆搴撹垂鐢細鍏ュ簱閲�/鍖呰瀹归噺*鍏ュ簱鍗曚环 
+                  entercost   := ceil( newsupplyqty / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
+                  //闀挎槬澶栫搴撳嚭搴撹垂鐢�: 鍑哄簱閲�/鍖呰瀹归噺*鍑哄簱鍗曚环
+                  outcost     := ceil( newsupplyqty / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
                   cell.CCRentInCost( cell.CCRentInCost() + entercost );
                   cell.CCRentOutOfCost( cell.CCRentOutOfCost() + outcost );
-                  cell.CCRentStorCost( cell.CCRentStorCost() + storecost );//闀挎槬澶栫搴撲粨鍌ㄨ垂鐢�
-                  cell.CCShorTransCost( cell.CCShorTransCost() + transcost );//闀挎槬鐭�旇繍杈撹垂鐢�
+                  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( newsupplyqty / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
+                    cell.CCShorTransCost( cell.CCShorTransCost() + cost );//闀挎槬鐭�旇繍杈撹垂鐢�
+                  }
                 } else {
-                  outcost     := Real::MaxReal();
-                  transset    := selectset( transcosts, Elements, trans, trans.Origin() = '澶ц繛鍘傚唴搴�' and trans.Destination() = '澶ц繛澶栫搴�' );
-                  column.CalcEngineCost( pispips, enginecosts, transset, dlfactory, entercost, othercost, outcost, storecost, transcost );
-                  cell.DLRentStorCost( cell.DLRentStorCost() + storecost );//澶ц繛澶栫搴撲粨鍌ㄨ垂鐢�
-                  cell.DLRentOtherCost( cell.DLRentOtherCost() + othercost );//澶ц繛澶栫搴撳叾浠栬垂鐢�
-                  cell.DLRentInCost( cell.DLRentInCost() + entercost );//澶ц繛澶栫搴撳叆搴撹垂鐢�
-                  cell.WerkToDLRentTransCost( cell.WerkToDLRentTransCost() + transcost );//鍘傚唴鍒板ぇ杩炲绉熷簱杩愯緭璐圭敤
+                  //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
+                  enginecost  := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate()  and engine.EndDate() >= column.StartDate() 
+                                                     and engine.Factory() = dlfactory  );
+                  if( not isnull( enginecost ) ){
+                    cost      := ceil( plannedinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
+                    cell.DLRentStorCost( cell.DLRentStorCost() + cost );//澶ц繛澶栫搴撲粨鍌ㄨ垂鐢�
+                    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( newsupplyqty / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
+                      row.SetFactoryToRentTransCost( column, cost );
+                    }
+                  }
                 }
               }
               products.Add( pisp.Product_MP() );

--
Gitblit v1.9.3