From b8c4a8d6f7fc23f0206cf66d96a712c0013c4ad2 Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期四, 07 十一月 2024 16:36:10 +0800
Subject: [PATCH] 料架报表优化

---
 _Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl |   28 ++++++++++++++++++----------
 _Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl |   16 ++++++++--------
 2 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
index 27b05ec..64f8ba1 100644
--- a/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
@@ -60,17 +60,21 @@
         
         // 绌烘枡鏋舵暟閲忥細銆�350bar MQB鏂欐灦鎬绘暟閲� - 鎵�鏈�350bar MQB鎬诲簱瀛� / 鍖呰瀹归噺-瀹㈡埛搴撴枡鏋舵暟閲忋��* 闀挎槬澶栫搴撶┖鏂欐灦姣斾緥
         plannedInventory := sum( macroPlan, Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriod, tempPISPIP,
-                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().IsLeaf()                                                                 and
-                                 exists( tempPISPIP.ProductInStockingPoint_MP().Product_MP(), AllParent.AsParent, tempPMP, tempPMP.ID() =  "鍙戝姩鏈�" )         and
-                                 tempPISPIP.ProductInStockingPoint_MP().StockingPointID()                                               =  "闀挎槬澶栫搴�"       and
-                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().Generation()                                       =  ccerr.Generation() and
-                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().MQBMLB()                                           =  ccerr.MLB_MQB()    and
-                                 tempPISPIP.Start().Date()                                                                              >= ccerc.StartDate()  and
-                                 tempPISPIP.End().Date()                                                                                <= lastDayOfThisMonth,
-                                 tempPISPIP.PlannedInventoryLevelEnd() );
+                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().IsLeaf()                                                                       and
+                                 exists( tempPISPIP.ProductInStockingPoint_MP().Product_MP(), AllParent.AsParent, tempPMP, tempPMP.ID() = "鍙戝姩鏈�" )                and
+                                 //tempPISPIP.ProductInStockingPoint_MP().StockingPointID()                                             = "澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�"  and
+                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().Generation()                                       = ccerr.Generation()        and
+                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().MQBMLB()                                           = ccerr.MLB_MQB()           and
+                                 tempPISPIP.Start().Date().Year()                                                                       = ccerc.StartDate().Year()  and 
+                                 tempPISPIP.Start().Date().Month()                                                                      = ccerc.StartDate().Month(),
+                                 tempPISPIP.PlannedInventoryLevelEnd() ) / ( ccerc.StartDate().StartOfNextMonth() - ccerc.StartDate() );
         cell.PackagingCapacity( guard( lce.PackagingCapacity(), 1 ) );
         cell.PlannedInventory( plannedInventory );
-        cell.NumberOfEmptyShelves( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - ( plannedInventory / lce.PackagingCapacity() ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ), 0 ) );
+        if ( ccerr.Generation() = "350bar" and ccerr.MLB_MQB() = "MQB" ) {
+          cell.NumberOfEmptyShelves( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - ( plannedInventory / lce.PackagingCapacity() ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ), 0 ) );
+        } else {
+          cell.NumberOfEmptyShelves( [Number] guard( cell.TotalQuantityOfMaterialRacks() - ( plannedInventory / lce.PackagingCapacity() ), 0 ) );
+        }
         
         // 澶栫搴撳叆搴撹垂鐢紙鍙戝姩鏈洪攢閲� / 鍖呰瀹归噺[鍚戜笂鍙栨暣] * 鏂欐灦鍏ュ簱鍗曚环锛�
         engineSales := sum( macroPlan, FSImportData, tempFSID, 
@@ -107,7 +111,11 @@
              
         // 澶栫搴撲粨鍌ㄨ垂鐢細銆�350bar MQB鏂欐灦鎬绘暟閲� - 鎵�鏈�350bar MQB鎬诲簱瀛� / 鍖呰瀹归噺 - 瀹㈡埛搴撴枡鏋舵暟閲忋��* 闀挎槬澶栫搴撶┖鏂欐灦姣斾緥*鏂欐灦浠撳偍鍗曚环銆傚彂鍔ㄦ満搴撳瓨鍙朅ctual inventories閲屽彇鍒伴暱鏄ュ绉熷簱璇ュ彂鍔ㄦ満鐨勪粨鍌ㄩ噺锛屾枡鏋舵�绘暟閲忛渶瑕佹墜鍔ㄧ淮鎶ゃ��
         cell.UnitPriceOfEmptyShelfStorage( lcmr.StoragePrice() );
-        cell.RentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - [Number]( plannedInventory / lce.PackagingCapacity() ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ) * lcmr.StoragePrice(), 0 ) );
+        if ( ccerr.Generation() = "350bar" and ccerr.MLB_MQB() = "MQB" ) {
+          cell.RentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - ceil( plannedInventory / lce.PackagingCapacity() ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ) * lcmr.StoragePrice() * ( ccerc.StartDate().StartOfNextMonth() - ccerc.StartDate() ), 0 ) );
+        } else {
+          cell.RentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - ceil( plannedInventory / lce.PackagingCapacity() ) ) * lcmr.StoragePrice()* ( ccerc.StartDate().StartOfNextMonth() - ccerc.StartDate() ), 0 ) );
+        }
         
         // 娓呮礂璐圭敤锛氬彂鍔ㄦ満鍏ュ簱閲� / 鍖呰瀹归噺 * 鏂欐灦娓呮礂鍗曚环銆傚彂鍔ㄦ満鍏ュ簱閲忓彇鍙戝姩鏈洪攢閲忥紝鍖呰瀹归噺鍙栬嚜鍙戝姩鏈烘垚鏈〃銆傛枡鏋舵竻娲楀崟浠峰彇鏂欐灦鎴愭湰琛ㄣ��
         cell.CleaningCost( [Number] ( engineProductions / guard( lce.PackagingCapacity(), 1 ) * lcmr.CleanPrice() ) );
diff --git a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
index 7a0a699..25bb40e 100644
--- a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
@@ -159,19 +159,19 @@
         
         // DL澶栫搴撴竻娲楄垂鐢細鍙戝姩鏈哄叆搴撻噺 / 鍖呰瀹归噺 * 鏂欐灦娓呮礂鍗曚环銆傚彂鍔ㄦ満鍏ュ簱閲忓彇鍙戝姩鏈洪攢閲忥紝鍖呰瀹归噺鍙栬嚜鍙戝姩鏈烘垚鏈〃銆傛枡鏋舵竻娲楀崟浠峰彇鏂欐灦鎴愭湰琛ㄣ��
         cell.CleaningCost( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrDL.CleanPrice(), 1 ) ) );
-        
-        // 棰勮鎬昏垂鐢�
-        cell.EstimatedTotalCost( cell.CCStorageFeesForRentedWarehouses() + cell.CCOutboundExpensesForRentedWarehouses() + cell.CCRentalWarehouseStorageFees() + cell.CCLineHaulCost() + 
-                                 cell.CCShortDistanceTransportationCosts() + cell.DLStorageFeesForRentedWarehouses() + cell.DLOutboundExpensesForRentedWarehouses() +
-                                 cell.DLExternalRentalWarehouseTransportationCosts() + cell.DLRentalWarehouseStorageFees() + cell.CleaningCost() );
-        
+          
         // 澶ц繛澶栫搴撴枡鏋惰垂鐢�
         cell.DLRentalWarehouseMaterialRackCost( cell.DLStorageFeesForRentedWarehouses() + cell.DLOutboundExpensesForRentedWarehouses() +
-                                                cell.DLExternalRentalWarehouseTransportationCosts() );
+                                                cell.DLExternalRentalWarehouseTransportationCosts() + cell.DLRentalWarehouseStorageFees() + cell.CleaningCost() );
         
         // CC澶栫搴揇L鏂欐灦璐圭敤
         cell.CCExternalRentalWarehouseDLMaterialRackCost( cell.CCStorageFeesForRentedWarehouses() + cell.CCOutboundExpensesForRentedWarehouses() +
-                                                          cell.CCRentalWarehouseStorageFees() + cell.CCShortDistanceTransportationCosts() );
+                                                          cell.CCShortDistanceTransportationCosts() + cell.CCCleaningCost() );
+        
+        // 棰勮鎬昏垂鐢�
+        cell.EstimatedTotalCost( cell.CCStorageFeesForRentedWarehouses() + cell.CCOutboundExpensesForRentedWarehouses() + cell.CCLineHaulCost() + cell.CCCleaningCost() +
+                                 cell.CCShortDistanceTransportationCosts() + cell.DLStorageFeesForRentedWarehouses() + cell.DLOutboundExpensesForRentedWarehouses() +
+                                 cell.DLExternalRentalWarehouseTransportationCosts() + cell.DLRentalWarehouseStorageFees() + cell.CleaningCost() );
         
         // 绯绘暟
         cell.Coefficient( 1.05 );

--
Gitblit v1.9.3