From 3a871621096a949fe8c897b89d9a66d1adb8e110 Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期五, 25 十月 2024 13:20:00 +0800
Subject: [PATCH] 料架总数优化

---
 _Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
index fcff038..128058b 100644
--- a/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
@@ -40,12 +40,25 @@
         // 杩愯緭鎴愭湰鍙傛暟
         lct  := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = "鍙戝姩鏈烘枡鏋�" and tempLCT.Origin() = "闀挎槬澶栫搴�" and tempLCT.Destination() = "CC 鍘傚唴搴�" );
         
+        // 绌烘枡鏋舵瘮渚�
+        mrpc := select( macroPlan, MaterialRackProportionRow.MaterialRackProportionCell, tempMRPCell, tempMRPCell.MaterialRackProportionRow().Generation() = "闀挎槬澶栫搴�" and tempMRPCell.MaterialRackColumn().Month() = ccerc.StartDate().Month() );
+        
+        // 瀹㈡埛搴撴枡鏋舵�绘暟閲�
+        mrcc := select( macroPlan, MaterialRackCustomRow.MaterialRackCustomCell, tempMRCCell, tempMRCCell.MaterialRackCustomRow().Generation() = ccerr.Generation() and tempMRCCell.MaterialRackCustomRow().MLB_MQB() = ccerr.MLB_MQB() and tempMRCCell.MaterialRackColumn().Month() = ccerc.StartDate().Month() );
+        
         // 褰撳墠鏈堟湯鏈�鍚庝竴澶╂棩鏈�                
         lastDayOfThisMonth := ccerc.StartDate().StartOfNextMonth() - 1; 
         
         cell := ccerr.CC_EngineRackCell( relnew );
         
-        // 绌烘枡鏋舵暟閲忥紙闀挎槬鍘傝浜у搧鐨勬枡鏋舵�绘暟閲� - 鍙戝姩鏈哄簱瀛� / 鍖呰瀹归噺 锛�
+        // 鏂欐灦鎬绘暟閲�
+        mrtcell := select( macroPlan, MaterialRackTotalRow.MaterialRackTotalCell, tempMRTCell, 
+                           tempMRTCell.MaterialRackTotalRow().Generation() = ccerr.Generation()        and
+                           tempMRTCell.MaterialRackTotalRow().MLB_MQB()    = ccerr.MLB_MQB()           and
+                           tempMRTCell.MaterialRackColumn().Month()        = ccerc.StartDate().Month() );
+        cell.TotalQuantityOfMaterialRacks( mrtcell.Quantity() );
+        
+        // 绌烘枡鏋舵暟閲忥細銆�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
@@ -57,7 +70,7 @@
                                  tempPISPIP.PlannedInventoryLevelEnd() );
         cell.PackagingCapacity( guard( lce.PackagingCapacity(), 1 ) );
         cell.PlannedInventory( plannedInventory );
-        cell.NumberOfEmptyShelves( guard( [Number] ( cell.TotalQuantityOfMaterialRacks() - ( plannedInventory / lce.PackagingCapacity() ) ), 0 ) );
+        cell.NumberOfEmptyShelves( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - ( plannedInventory / lce.PackagingCapacity() ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ), 0 ) );
         
         // 澶栫搴撳叆搴撹垂鐢紙鍙戝姩鏈洪攢閲� / 鍖呰瀹归噺[鍚戜笂鍙栨暣] * 鏂欐灦鍏ュ簱鍗曚环锛�
         engineSales := sum( macroPlan, FSImportData, tempFSID, 
@@ -92,9 +105,9 @@
     //    info( "鏃堕棿锛�", ccerc.StartDate().Format( "Y-M2-D2" ), "    杩愯緭鏁版嵁锛�", transportationQuantity, "     杩愯緭鍗曚环锛�", lct.TransportPrice() );
         cell.ExternalRentalWarehouseTransportationCosts( [Number] ( transportationQuantity / guard( lce.PackagingCapacity(), 1 ) / guard( lct.LoadingCapacity(), 1 ) * guard( lct.TransportPrice(), 1 ) ) );
              
-        // 澶栫搴撲粨鍌ㄨ垂鐢細鏂欐灦鎬绘暟閲� - 鍙戝姩鏈哄簱瀛� / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級锛屽啀涔樹互绌烘枡鏋朵粨鍌ㄥ崟浠峰緱鍒扮┖鏂欐灦浠撳偍璐圭敤銆傚彂鍔ㄦ満搴撳瓨鍙朅ctual inventories閲屽彇鍒伴暱鏄ュ绉熷簱璇ュ彂鍔ㄦ満鐨勪粨鍌ㄩ噺锛屾枡鏋舵�绘暟閲忛渶瑕佹墜鍔ㄧ淮鎶ゃ��
+        // 澶栫搴撲粨鍌ㄨ垂鐢細銆�350bar MQB鏂欐灦鎬绘暟閲� - 鎵�鏈�350bar MQB鎬诲簱瀛� / 鍖呰瀹归噺 - 瀹㈡埛搴撴枡鏋舵暟閲忋��* 闀挎槬澶栫搴撶┖鏂欐灦姣斾緥*鏂欐灦浠撳偍鍗曚环銆傚彂鍔ㄦ満搴撳瓨鍙朅ctual inventories閲屽彇鍒伴暱鏄ュ绉熷簱璇ュ彂鍔ㄦ満鐨勪粨鍌ㄩ噺锛屾枡鏋舵�绘暟閲忛渶瑕佹墜鍔ㄧ淮鎶ゃ��
         cell.UnitPriceOfEmptyShelfStorage( lcmr.StoragePrice() );
-        cell.RentalWarehouseStorageFees( [Number] ( guard( ( cell.TotalQuantityOfMaterialRacks() - [Number]( plannedInventory / lce.PackagingCapacity() ) ) * lcmr.StoragePrice(), 0 ) ) );
+        cell.RentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - [Number]( plannedInventory / lce.PackagingCapacity() ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ) * lcmr.StoragePrice(), 0 ) );
         
         // 娓呮礂璐圭敤锛氬彂鍔ㄦ満鍏ュ簱閲� / 鍖呰瀹归噺 * 鏂欐灦娓呮礂鍗曚环銆傚彂鍔ㄦ満鍏ュ簱閲忓彇鍙戝姩鏈洪攢閲忥紝鍖呰瀹归噺鍙栬嚜鍙戝姩鏈烘垚鏈〃銆傛枡鏋舵竻娲楀崟浠峰彇鏂欐灦鎴愭湰琛ㄣ��
         cell.CleaningCost( [Number] ( engineProductions / guard( lce.PackagingCapacity(), 1 ) * lcmr.CleanPrice() ) );

--
Gitblit v1.9.3