From 2330d95eb90e79163563fcecc50930bba9ea180f Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期五, 11 十月 2024 12:48:29 +0800
Subject: [PATCH] 大连料架优化
---
_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl | 21 +++---
_Main/UI/MacroPlannerWebApp/Component_FormDL_EngineRackReport/Response_pHeader_bRefresh_OnClick.def | 2
_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl | 98 ++++++++++++++++++++++++++++++--
3 files changed, 105 insertions(+), 16 deletions(-)
diff --git a/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
index aa152d7..180d987 100644
--- a/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
@@ -56,12 +56,13 @@
// 绌烘枡鏋舵暟閲忥紙闀挎槬鍘傝浜у搧鐨勬枡鏋舵�绘暟閲� - 鍙戝姩鏈哄簱瀛� / 鍖呰瀹归噺 锛�
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() = lastDayOfThisMonth,
+ 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() );
cell.PackagingCapacity( guard( lce.PackagingCapacity(), 1 ) );
cell.PlannedInventory( plannedInventory );
@@ -101,16 +102,16 @@
tempPIT.Quantity()
);
// info( "鏃堕棿锛�", ccerc.StartDate().Format( "Y-M2-D2" ), " 杩愯緭鏁版嵁锛�", transportationQuantity, " 杩愯緭鍗曚环锛�", lct.TransportPrice() );
- cell.ExternalRentalWarehouseTransportationCosts( transportationQuantity / guard( lce.PackagingCapacity(), 1 ) / guard( lct.LoadingCapacity(), 1 ) * guard( lct.TransportPrice(), 1 ) );
+ cell.ExternalRentalWarehouseTransportationCosts( [Number] ( transportationQuantity / guard( lce.PackagingCapacity(), 1 ) / guard( lct.LoadingCapacity(), 1 ) * guard( lct.TransportPrice(), 1 ) ) );
sumExternalRentalWarehouseTransportationCosts := sumExternalRentalWarehouseTransportationCosts + cell.ExternalRentalWarehouseTransportationCosts();
// 澶栫搴撲粨鍌ㄨ垂鐢細鏂欐灦鎬绘暟閲� - 鍙戝姩鏈哄簱瀛� / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級锛屽啀涔樹互绌烘枡鏋朵粨鍌ㄥ崟浠峰緱鍒扮┖鏂欐灦浠撳偍璐圭敤銆傚彂鍔ㄦ満搴撳瓨鍙朅ctual inventories閲屽彇鍒伴暱鏄ュ绉熷簱璇ュ彂鍔ㄦ満鐨勪粨鍌ㄩ噺锛屾枡鏋舵�绘暟閲忛渶瑕佹墜鍔ㄧ淮鎶ゃ��
cell.UnitPriceOfEmptyShelfStorage( lcmr.StoragePrice() );
- cell.RentalWarehouseStorageFees( guard( ( cell.TotalQuantityOfMaterialRacks() - [Number]( plannedInventory / lce.PackagingCapacity() ) ) * lcmr.StoragePrice(), 0 ) );
+ cell.RentalWarehouseStorageFees( [Number] ( guard( ( cell.TotalQuantityOfMaterialRacks() - [Number]( plannedInventory / lce.PackagingCapacity() ) ) * lcmr.StoragePrice(), 0 ) ) );
sumRentalWarehouseStorageFees := sumRentalWarehouseStorageFees + cell.RentalWarehouseStorageFees();
// 娓呮礂璐圭敤锛氬彂鍔ㄦ満鍏ュ簱閲� / 鍖呰瀹归噺 * 鏂欐灦娓呮礂鍗曚环銆傚彂鍔ㄦ満鍏ュ簱閲忓彇鍙戝姩鏈洪攢閲忥紝鍖呰瀹归噺鍙栬嚜鍙戝姩鏈烘垚鏈〃銆傛枡鏋舵竻娲楀崟浠峰彇鏂欐灦鎴愭湰琛ㄣ��
- cell.CleaningCost( engineSales / guard( lce.PackagingCapacity(), 1 ) * lcmr.CleanPrice() );
+ cell.CleaningCost( [Number] ( engineProductions / guard( lce.PackagingCapacity(), 1 ) * lcmr.CleanPrice() ) );
sumCleaningCost := sumCleaningCost + cell.CleaningCost();
// 棰勮鎬昏垂鐢�
@@ -123,7 +124,7 @@
sumEstimatedTotalCost := sumEstimatedTotalCost + cell.EstimatedTotalCost();
// 绯绘暟
- cell.Coefficient( 1 );
+ cell.Coefficient( 1.05 );
// 鎬昏垂鐢�
cell.TotalCost( cell.EstimatedTotalCost() * cell.Coefficient() );
diff --git a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
index f46648f..122f650 100644
--- a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
@@ -32,6 +32,14 @@
// 鍙戝姩鏈烘垚鏈弬鏁�
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() = "澶ц繛宸ュ巶"
+ and tempLCMR.StartDate() <= dlerc.StartDate() and tempLCMR.EndDate() >= dlerc.StartDate().StartOfNextMonth() );
+
+ // 杩愯緭鎴愭湰鍙傛暟
+ lct1 := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = "鍙戝姩鏈烘枡鏋�" and tempLCT.Origin() = "闀挎槬澶栫搴�" and tempLCT.Destination() = "DL 鍘傚唴搴�" );
+ lct2 := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = "鍙戝姩鏈烘枡鏋�" and tempLCT.Origin() = "澶ц繛澶栫搴�" and tempLCT.Destination() = "DL 鍘傚唴搴�" );
// 褰撳墠鏈堟湯鏈�鍚庝竴澶╂棩鏈�
lastDayOfThisMonth := dlerc.StartDate().StartOfNextMonth() - 1;
@@ -40,20 +48,98 @@
// 绌烘枡鏋舵暟閲忥細澶ц繛鍘傝浜у搧鐨勬枡鏋舵�绘暟閲� - 鍙戝姩鏈哄簱瀛� / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級
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() = dlerr.Generation() and
- tempPISPIP.ProductInStockingPoint_MP().Product_MP().MQBMLB() = dlerr.MLB_MQB() and
- tempPISPIP.Start().Date() = lastDayOfThisMonth,
+ 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() = dlerr.Generation() and
+ tempPISPIP.ProductInStockingPoint_MP().Product_MP().MQBMLB() = dlerr.MLB_MQB() and
+ tempPISPIP.Start().Date() >= dlerc.StartDate() and
+ tempPISPIP.End().Date() <= lastDayOfThisMonth,
tempPISPIP.PlannedInventoryLevelEnd() );
cell.PackagingCapacity( guard( lce.PackagingCapacity(), 1 ) );
cell.PlannedInventory( plannedInventory );
// CC澶栫搴撳叆搴撹垂鐢細鍙戝姩鏈洪攢閲� / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級* 鏂欐灦鍏ュ簱鍗曚环
+ transportationQuantity1 := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
+ tempPIT.Product_MP().Generation() = dlerr.Generation() and
+ tempPIT.Product_MP().MQBMLB() = dlerr.MLB_MQB() and
+ tempPIT.Trip().Departure().Date() >= dlerc.StartDate() and
+ tempPIT.Trip().Arrival().Date() <= lastDayOfThisMonth and
+ tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID() = "DL 鍘傚唴搴�" and
+ tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() = "闀挎槬澶栫搴�",
+ tempPIT.Quantity()
+ );
+ cell.CCStorageFeesForRentedWarehouses( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * lcmr.WarehousingPrice() ) );
// CC澶栫搴撳嚭搴撹垂鐢細鍙戝姩鏈洪攢閲� / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級* 鏂欐灦鍑哄簱鍗曚环
+ cell.CCOutboundExpensesForRentedWarehouses( [Number] ( guard( transportationQuantity1 / lce.PackagingCapacity(), 0 ) * lcmr.OutboundPrice() ) );
+ // CC澶栫搴撲粨鍌ㄨ垂鐢細鏂欐灦鎬绘暟閲� - 鍙戝姩鏈哄簱瀛� / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級
+ cell.CCRentalWarehouseStorageFees( [Number] ( cell.TotalQuantityOfMaterialRacks() - guard( plannedInventory / lce.PackagingCapacity(), 0 ) ) );
+
+ // CC闀块�旇繍杈撹垂鐢細璋冩嫧鏁伴噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺 * 鏂欐灦杩愯緭鍗曚环
+ transportationQuantity2 := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
+ tempPIT.Product_MP().Generation() = dlerr.Generation() and
+ tempPIT.Product_MP().MQBMLB() = dlerr.MLB_MQB() and
+ tempPIT.Trip().Departure().Date() >= dlerc.StartDate() and
+ tempPIT.Trip().Arrival().Date() <= lastDayOfThisMonth and
+ tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID() = "闀挎槬澶栫搴�" and
+ tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() = "DL 鍘傚唴搴�",
+ tempPIT.Quantity()
+ );
+ cell.CCLineHaulCost( [Number] ( guard( transportationQuantity2 / lce.PackagingCapacity() / lct1.LoadingCapacity(), 0 ) * guard( lct1.TransportPrice(), 1 ) ) );
+
+ // CC鐭�旇繍杈撹垂鐢細CC瀹㈡埛鍒癈C澶栫搴�
+
+ // DL澶栫搴撳叆搴撹垂鐢細鍙戝姩鏈哄叆搴撻噺 / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級* 鏂欐灦鍏ュ簱鍗曚环
+ engineProductions := sum( macroPlan, FPImportData, tempFPID,
+ tempFPID.Unit() = FinancialProductionReport::GetDefaultDLUnit() and
+ tempFPID.Generation() = dlerr.Generation() and
+ tempFPID.MqbMlb() = dlerr.MLB_MQB() and
+ tempFPID.StartDate().Year() = dlerc.StartDate().Year() and
+ tempFPID.StartDate().Month() = dlerc.StartDate().Month(),
+ tempFPID.Quantity() );
+ cell.DLStorageFeesForRentedWarehouses( [Number] ( guard( ( engineProductions - transportationQuantity1 ) / lce.PackagingCapacity(), 0 ) * guard( lcmr.WarehousingPrice(), 1 ) ) );
+
+ // DL澶栫搴撳嚭搴撹垂鐢細鍙戝姩鏈哄嚭搴撻噺 / 鏂欐灦瀹归噺锛堝悜涓婂彇鏁达級* 鏂欐灦鍑哄簱鍗曚环
+ engineSales := sum( macroPlan, FSImportData, tempFSID,
+ tempFSID.Unit() = FinancialProductionReport::GetDefaultCCUnit() and
+ tempFSID.Generation() = dlerr.Generation() and
+ tempFSID.MqbMlb() = dlerr.MLB_MQB() and
+ tempFSID.StartDate().Year() = dlerc.StartDate().Year() and
+ tempFSID.StartDate().Month() = dlerc.StartDate().Month(),
+ tempFSID.Quantity() );
+ cell.DLOutboundExpensesForRentedWarehouses( [Number] ( guard( ( engineSales - transportationQuantity1 ) / lce.PackagingCapacity(), 0 ) * guard( lcmr.OutboundPrice(), 1 ) ) );
+
+ // DL澶栫搴撹繍杈撹垂鐢細鍙戝姩鏈鸿繍杈撻噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺锛堝悜涓婂彇鏁达級* 鏂欐灦杩愯緭鍗曚环
+ transportationQuantity3 := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
+ tempPIT.Product_MP().Generation() = dlerr.Generation() and
+ tempPIT.Product_MP().MQBMLB() = dlerr.MLB_MQB() and
+ tempPIT.Trip().Departure().Date() >= dlerc.StartDate() and
+ tempPIT.Trip().Arrival().Date() <= lastDayOfThisMonth and
+ tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID() = "澶ц繛澶栫搴�" and
+ tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() = "DL 鍘傚唴搴�",
+ tempPIT.Quantity()
+ );
+ cell.DLExternalRentalWarehouseTransportationCosts( [Number] ( guard( transportationQuantity3 / lce.PackagingCapacity() / lct2.LoadingCapacity(), 0 ) * guard( lct2.TransportPrice(), 1 ) ) );
+
+ // DL澶栫搴撲粨鍌ㄨ垂鐢細鏂欐灦鎬绘暟閲� - 鍙戝姩鏈哄簱瀛� / 鍖呰瀹归噺锛堝悜涓婂彇鏁达級* 绌烘枡鏋朵粨鍌ㄥ崟浠�
+ cell.DLRentalWarehouseStorageFees( [Number] ( guard( ( cell.TotalQuantityOfMaterialRacks() - plannedInventory ) / lce.PackagingCapacity(), 0 ) * guard( lcmr.StoragePrice(), 1 ) ) );
+
+ //娓呮礂璐圭敤锛氬彂鍔ㄦ満鍏ュ簱閲� / 鍖呰瀹归噺 * 鏂欐灦娓呮礂鍗曚环銆傚彂鍔ㄦ満鍏ュ簱閲忓彇鍙戝姩鏈洪攢閲忥紝鍖呰瀹归噺鍙栬嚜鍙戝姩鏈烘垚鏈〃銆傛枡鏋舵竻娲楀崟浠峰彇鏂欐灦鎴愭湰琛ㄣ��
+ cell.CleaningCost( [Number] ( guard( engineSales / lce.PackagingCapacity(), 0 ) * guard( lcmr.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.Coefficient( 1.05 );
+
+ // 鎬昏垂鐢�
+ cell.TotalCost( cell.EstimatedTotalCost() * cell.Coefficient() );
+
cell.DL_EngineRackColumn( relset, dlerc );
}
}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDL_EngineRackReport/Response_pHeader_bRefresh_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormDL_EngineRackReport/Response_pHeader_bRefresh_OnClick.def
index 198ae43..b6158bf 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormDL_EngineRackReport/Response_pHeader_bRefresh_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDL_EngineRackReport/Response_pHeader_bRefresh_OnClick.def
@@ -14,6 +14,8 @@
Body:
[*
DL_EngineRackCell::CreateData( MacroPlan );
+
+ WebMessageBox::Success( Translations::A_VWED_Success() );
*]
GroupServerCalls: false
}
--
Gitblit v1.9.3