From 58099609ea32d8644da535fcd631229a3074655c Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期二, 29 十月 2024 19:24:29 +0800
Subject: [PATCH] 大连料架报表优化
---
_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl | 42 +++++++++++++++++++++++-------------------
1 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
index 1eae1e9..14c6378 100644
--- a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
@@ -30,23 +30,25 @@
info( "褰撳墠閬嶅巻鐨勮锛�", dlerr.Generation(), " ", dlerr.MLB_MQB() );
traverse ( macroPlan, DL_EngineRackColumn, dlerc ) { // 寰幆鍒�
// 鍙戝姩鏈烘垚鏈弬鏁�
- lce := select( macroPlan, LogisticsCostEngine, tempLCE, tempLCE.Generation() = dlerr.Generation() and tempLCE.MLB_MQB() = dlerr.MLB_MQB() and tempLCE.Factory() = "澶ц繛宸ュ巶"
+ lce := select( macroPlan, LogisticsCostEngine, tempLCE, tempLCE.Generation() = dlerr.Generation() and tempLCE.MLB_MQB() = dlerr.MLB_MQB() and tempLCE.Factory() = "澶ц繛宸ュ巶"
and tempLCE.StartDate() <= dlerc.StartDate() and tempLCE.EndDate() >= dlerc.StartDate().StartOfNextMonth() );
// 鏂欐灦鎴愭湰鍙傛暟
- lcmr := select( macroPlan, LogisticsCostMaterialRack, tempLCMR, tempLCMR.Factory() = "澶ц繛宸ュ巶"
+ lcmrDL := select( macroPlan, LogisticsCostMaterialRack, tempLCMR, tempLCMR.Factory() = "澶ц繛宸ュ巶"
and tempLCMR.StartDate() <= dlerc.StartDate() and tempLCMR.EndDate() >= dlerc.StartDate().StartOfNextMonth() );
-
+ lcmrCC := select( macroPlan, LogisticsCostMaterialRack, tempLCMR, tempLCMR.Factory() = "闀挎槬宸ュ巶"
+ and tempLCMR.StartDate() <= dlerc.StartDate() and tempLCMR.EndDate() >= dlerc.StartDate().StartOfNextMonth() );
+
// 杩愯緭鎴愭湰鍙傛暟
- lct1 := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = "鍙戝姩鏈烘枡鏋�" and tempLCT.Origin() = "澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�" and tempLCT.Destination() = "澶ц繛鍘傚唴搴�" );
- lct2 := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = "鍙戝姩鏈烘枡鏋�" and tempLCT.Origin() = "澶ц繛澶栫搴�" and tempLCT.Destination() = "澶ц繛鍘傚唴搴�" );
- lct3 := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = "鍙戝姩鏈烘枡鏋�" and tempLCT.Origin() = "CC 瀹㈡埛搴�" and tempLCT.Destination() = "CC 澶栫搴�" );
+ lct1 := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = "鍙戝姩鏈烘枡鏋�" and tempLCT.Origin() = "澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�" and tempLCT.Destination() = "澶ц繛鍘傚唴搴�" );
+ lct2 := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = "鍙戝姩鏈烘枡鏋�" and tempLCT.Origin() = "澶ц繛澶栫搴�" and tempLCT.Destination() = "澶ц繛鍘傚唴搴�" );
+ lct3 := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = "鍙戝姩鏈烘枡鏋�" and tempLCT.Origin() = "CC 瀹㈡埛搴�" and tempLCT.Destination() = "CC 澶栫搴�" );
// 绌烘枡鏋舵瘮渚�
- mrpc := select( macroPlan, MaterialRackProportionRow.MaterialRackProportionCell, tempMRPCell, tempMRPCell.MaterialRackProportionRow().Generation() = "澶ц繛澶栫搴�" and tempMRPCell.MaterialRackColumn().Month() = dlerc.StartDate().Month() );
+ mrpc := select( macroPlan, MaterialRackProportionRow.MaterialRackProportionCell, tempMRPCell, tempMRPCell.MaterialRackProportionRow().Generation() = "澶ц繛澶栫搴�" and tempMRPCell.MaterialRackColumn().Month() = dlerc.StartDate().Month() );
// 瀹㈡埛搴撴枡鏋舵�绘暟閲�
- mrcc := select( macroPlan, MaterialRackCustomRow.MaterialRackCustomCell, tempMRCCell, tempMRCCell.MaterialRackCustomRow().Generation() = dlerr.Generation() and tempMRCCell.MaterialRackCustomRow().MLB_MQB() = dlerr.MLB_MQB() and tempMRCCell.MaterialRackColumn().Month() = dlerc.StartDate().Month() );
+ mrcc := select( macroPlan, MaterialRackCustomRow.MaterialRackCustomCell, tempMRCCell, tempMRCCell.MaterialRackCustomRow().Generation() = dlerr.Generation() and tempMRCCell.MaterialRackCustomRow().MLB_MQB() = dlerr.MLB_MQB() and tempMRCCell.MaterialRackColumn().Month() = dlerc.StartDate().Month() );
// 褰撳墠鏈堟湯鏈�鍚庝竴澶╂棩鏈�
lastDayOfThisMonth := dlerc.StartDate().StartOfNextMonth() - 1;
@@ -79,16 +81,18 @@
tempF.Product_MP().Generation() = dlerr.Generation() and
tempF.Product_MP().MQBMLB() = dlerr.MLB_MQB() and
tempF.StockingPointID() = "澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�" and
- tempF.StartDate() >= dlerc.StartDate() and
- tempF.EndDate() <= lastDayOfThisMonth,
+ tempF.StartDate().Year() = dlerc.StartDate().Year() and
+ tempF.StartDate().Month() = dlerc.StartDate().Month(),
tempF.FulfilledQuantity() );
- cell.CCStorageFeesForRentedWarehouses( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * lcmr.WarehousingPrice() ) );
+ info( "鏃堕棿锛�", dlerc.StartDate().Format( "Y-M2-D2" ), " 鍏ュ簱鏁伴噺锛�", transportationQuantity1, " 鍖呰瀹归噺锛�", guard( lce.PackagingCapacity(), 0 ),
+ " 鍏ュ簱鍗曚环锛�", guard( lcmrCC.WarehousingPrice(), 0 ) ); // 娴嬭瘯杈撳嚭
+ cell.CCStorageFeesForRentedWarehouses( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * lcmrCC.WarehousingPrice() ) );
// CC澶栫搴撳嚭搴撹垂鐢細鍙戝姩鏈洪攢閲� / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級* 鏂欐灦鍑哄簱鍗曚环
- cell.CCOutboundExpensesForRentedWarehouses( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * lcmr.OutboundPrice() ) );
+ cell.CCOutboundExpensesForRentedWarehouses( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * lcmrCC.OutboundPrice() ) );
// CC澶栫搴撲粨鍌ㄨ垂鐢細鏂欐灦鎬绘暟閲� - 鍙戝姩鏈哄簱瀛� / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級 * 鏂欐灦浠撳偍鍗曚环
- cell.CCRentalWarehouseStorageFees( [Number] ( ( cell.TotalQuantityOfMaterialRacks() - guard( plannedInventory / lce.PackagingCapacity(), 0 ) ) * lcmr.StoragePrice() ) );
+ cell.CCRentalWarehouseStorageFees( [Number] ( ( cell.TotalQuantityOfMaterialRacks() - guard( plannedInventory / lce.PackagingCapacity(), 0 ) ) * lcmrCC.StoragePrice() ) );
// CC闀块�旇繍杈撹垂鐢細璋冩嫧鏁伴噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺 * 鏂欐灦杩愯緭鍗曚环
transportationQuantity2 := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
@@ -114,8 +118,8 @@
tempF.StartDate() <= ( lastDayOfThisMonth - 2 ),
tempF.FulfilledQuantity() );
// info( "鏃堕棿锛�", dlerc.StartDate().Format( "Y-M2-D2" ), " 鍏ュ簱鏁伴噺锛�", inventoryQuantity, " 鍖呰瀹归噺锛�", guard( lce.PackagingCapacity(), 0 ),
- // " 瑁呰浇瀹归噺锛�", guard( lct1.LoadingCapacity(), 0 ) ); // 娴嬭瘯杈撳嚭
- cell.DLStorageFeesForRentedWarehouses( [Number] ( guard( inventoryQuantity / lce.PackagingCapacity(), 0 ) * guard( lce.WarehousingPrice(), 1 ) ) );
+ // " 鍏ュ簱鍗曚环锛�", guard( lcmr.WarehousingPrice(), 0 ) ); // 娴嬭瘯杈撳嚭
+ cell.DLStorageFeesForRentedWarehouses( [Number] ( guard( inventoryQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrDL.WarehousingPrice(), 1 ) ) );
// DL澶栫搴撳嚭搴撹垂鐢細鍙戝姩鏈哄嚭搴撻噺 / 鏂欐灦瀹归噺锛堝悜涓婂彇鏁达級* 鏂欐灦鍑哄簱鍗曚环
outboundQuantity := sum( macroPlan, Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), tempPISPIPPL,
@@ -126,7 +130,7 @@
tempPISPIPPL.End().Date() <= lastDayOfThisMonth,
tempPISPIPPL.NewSupplyQuantity() );
// info( "鏁伴噺锛�", outboundQuantity, " 鍖呰铻嶅垱锛�", guard( lce.PackagingCapacity(), 0 ), " 鍑哄簱鍗曚环锛�", guard( lcmr.OutboundPrice(), 0 ) );
- cell.DLOutboundExpensesForRentedWarehouses( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmr.OutboundPrice(), 1 ) ) );
+ cell.DLOutboundExpensesForRentedWarehouses( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrDL.OutboundPrice(), 1 ) ) );
// DL澶栫搴撹繍杈撹垂鐢細鍙戝姩鏈鸿繍杈撻噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺锛堝悜涓婂彇鏁达級* 鏂欐灦杩愯緭鍗曚环
cell.DLExternalRentalWarehouseTransportationCosts( [Number] ( guard( inventoryQuantity / lce.PackagingCapacity() / lct2.LoadingCapacity(), 0 ) * guard( lct2.TransportPrice(), 1 ) ) );
@@ -142,7 +146,7 @@
tempPISPIP.Start().Date() >= dlerc.StartDate() and
tempPISPIP.End().Date() <= lastDayOfThisMonth,
tempPISPIP.PlannedInventoryLevelEnd() );
- cell.DLRentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - guard( plannedInventory1 / lce.PackagingCapacity(), 0 ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ) * guard( lcmr.StoragePrice(), 1 ), 0 ) );
+ cell.DLRentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - guard( plannedInventory1 / lce.PackagingCapacity(), 0 ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ) * guard( lcmrDL.StoragePrice(), 1 ), 0 ) );
// CC澶栫搴撴竻娲楄垂鐢細鍙戝姩鏈哄叆搴撻噺 / 鍖呰瀹归噺 * 鏂欐灦娓呮礂鍗曚环銆傚彂鍔ㄦ満鍏ュ簱閲忓彇鍙戝姩鏈洪攢閲忥紝鍖呰瀹归噺鍙栬嚜鍙戝姩鏈烘垚鏈〃銆傛枡鏋舵竻娲楀崟浠峰彇鏂欐灦鎴愭湰琛ㄣ��
clearnQuantity := sum( macroPlan, SalesDemand.astype( Forecast ), tempF,
@@ -153,10 +157,10 @@
tempF.StartDate().Month() = dlerc.StartDate().Month(),
tempF.Quantity() );
// info( "鏁伴噺锛�", clearnQuantity, " 鍖呰瀹归噺锛�", guard( lce.PackagingCapacity(), 0 ), " 娓呮礂鍗曚环锛�", guard( lcmr.CleanPrice(), 0 ) );
- cell.CCCleaningCost( [Number] ( guard( clearnQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmr.CleanPrice(), 1 ) ) );
+ cell.CCCleaningCost( [Number] ( guard( clearnQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrCC.CleanPrice(), 1 ) ) );
// DL澶栫搴撴竻娲楄垂鐢細鍙戝姩鏈哄叆搴撻噺 / 鍖呰瀹归噺 * 鏂欐灦娓呮礂鍗曚环銆傚彂鍔ㄦ満鍏ュ簱閲忓彇鍙戝姩鏈洪攢閲忥紝鍖呰瀹归噺鍙栬嚜鍙戝姩鏈烘垚鏈〃銆傛枡鏋舵竻娲楀崟浠峰彇鏂欐灦鎴愭湰琛ㄣ��
- cell.CleaningCost( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmr.CleanPrice(), 1 ) ) );
+ cell.CleaningCost( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrDL.CleanPrice(), 1 ) ) );
// 棰勮鎬昏垂鐢�
cell.EstimatedTotalCost( cell.CCStorageFeesForRentedWarehouses() + cell.CCOutboundExpensesForRentedWarehouses() + cell.CCRentalWarehouseStorageFees() + cell.CCLineHaulCost() +
--
Gitblit v1.9.3