From 84164725476db1befaa4aa2b837a79b6247a0ab6 Mon Sep 17 00:00:00 2001
From: lihongji <3117313295@qq.com>
Date: 星期四, 17 十月 2024 20:23:56 +0800
Subject: [PATCH] 机加物流成本报表优化
---
_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_pHeader_bRefresh_OnClick.def | 2
_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl | 52 ++++++++++++++++++++------
_Main/BL/Type_MachineLogisticsCostReportRow/Method_Filter.qbl | 8 ++++
_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_MatrixEditor912.def | 2 +
4 files changed, 51 insertions(+), 13 deletions(-)
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl
index a347a1c..98564c2 100644
--- a/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl
@@ -1,8 +1,7 @@
Quintiq file version 2.0
#parent: #root
StaticMethod CreateData (
- MacroPlan macroPlan,
- String factory
+ MacroPlan macroPlan
)
{
TextBody:
@@ -36,15 +35,24 @@
and tempLCM.StartDate() <= mlcrc.StartDate() and tempLCM.EndDate() >= mlcrc.StartDate().StartOfNextMonth() );
// 杩愯緭鎴愭湰鍙傛暟
- lct := select( macroPlan, LogisticsCostTransport, tempLCT, tempLCT.Product() = mlcrr.Category() and
- tempLCT.Origin() = "闀挎槬澶栫搴�" and tempLCT.Destination() = "CC 鍘傚唴搴�" );
+ lct := select( macroPlan, LogisticsCostTransport, tempLCT,
+ tempLCT.Product() = mlcrr.Category() and
+ tempLCT.Origin() = ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "闀挎槬澶栫搴�", "澶ц繛鍘傚唴搴�" ) and
+ tempLCT.Destination() = ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "澶ц繛鍦哄唴搴�", "闀挎槬澶栫搴�" ) );
+ lct1 := select( macroPlan, LogisticsCostTransport, tempLCT,
+ tempLCT.Product() = mlcrr.Category() and
+ tempLCT.Origin() = ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "澶ц繛鍘傚唴搴�", "CC 鍘傚唴搴�" ) and
+ tempLCT.Destination() = ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "澶ц繛澶栫搴�", "闀挎槬澶栫搴�" ) );
+
+ // 褰撳墠鏈堟湯鏈�鍚庝竴澶╂棩鏈�
+ lastDayOfThisMonth := mlcrc.StartDate().StartOfNextMonth() - 1;
cell := mlcrr.MachineLogisticsCostReportCell( relnew );
// 璁剧疆鍖呰璐圭敤锛堝寘瑁呴噺 * 鍖呰鍗曚环锛�
packageQuantity := sum( macroPlan, PackagingPlanRow.PackagingPlanCell, tempPPC,
tempPPC.PackagingPlanRow().Category() = mlcrr.Category() and
- tempPPC.PackagingPlanRow().Factory() = factory and
+ tempPPC.PackagingPlanRow().Factory() = mlcrr.Factory() and
tempPPC.PackagingPlanColumn().StartDate().Year() = mlcrc.StartDate().Year() and
tempPPC.PackagingPlanColumn().StartDate().Month() = mlcrc.StartDate().Month(),
tempPPC.Package() );
@@ -53,7 +61,7 @@
// 璁剧疆鎷嗗寘璐圭敤锛堟媶鍖呴噺 * 鎷嗗寘鍗曚环锛�
unpackingQuantity := sum( macroPlan, PackagingPlanRow.PackagingPlanCell, tempPPC,
tempPPC.PackagingPlanRow().Category() = mlcrr.Category() and
- tempPPC.PackagingPlanRow().Factory() = factory and
+ tempPPC.PackagingPlanRow().Factory() = mlcrr.Factory() and
tempPPC.PackagingPlanColumn().StartDate().Year() = mlcrc.StartDate().Year() and
tempPPC.PackagingPlanColumn().StartDate().Month() = mlcrc.StartDate().Month(),
tempPPC.Unpacking() );
@@ -67,20 +75,40 @@
// 璁剧疆璋冩嫧璐圭敤锛堣皟鎷ㄦ暟閲� / 鍖呰瀹归噺 / 瑁呰浇瀹归噺 * 杩愯緭鍗曚环锛�
transferQuantity := sum( macroPlan, TransferPlanRow.TransferPlanCell, tempTPC,
- tempTPC.TransferPlanRow().Category() = mlcrr.Category() and
- tempTPC.TransferPlanRow().Name() = ifexpr( factory = "澶ц繛宸ュ巶", "CC to DL", "DL to CC" ) and
- tempTPC.TransferPlanColumn().ColumnDate().Year() = mlcrc.StartDate().Year() and
- tempTPC.TransferPlanColumn().ColumnDate().Month() = mlcrc.StartDate().Month(),
+ tempTPC.TransferPlanRow().Category() = mlcrr.Category() and
+ tempTPC.TransferPlanRow().Name() = ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "CC to DL", "DL to CC" ) and
+ guard( tempTPC.TransferPlanColumn().ColumnDate().Year() = mlcrc.StartDate().Year(), false ) and
+ guard( tempTPC.TransferPlanColumn().ColumnDate().Month() = mlcrc.StartDate().Month(), false ),
[Number]tempTPC.Value() );
cell.TransferCost( transferQuantity / guard( lcm.PackagingCapacity(), 1 ) / guard( lct.LoadingCapacity(), 1 ) * guard( lct.TransportPrice(), 1 ) );
// 澶栫搴撳叆搴撹垂鐢紙鍏ュ簱閲廩鍖呰閲廬 / 鍖呰瀹归噺 * 鍏ュ簱鍗曚环锛�
- // cell.StorageFeesForRentedWarehouses( packageQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.WarehousingPrice(), 1 ) );
+ cell.StorageFeesForRentedWarehouses( packageQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.WarehousingPrice(), 1 ) );
// 澶栫搴撳嚭搴撹垂鐢紙鍑哄簱閲廩鎷嗗寘閲廬 / 鍖呰瀹归噺 * 鍑哄簱鍗曚环锛�
- // cell.OutboundExpensesForRentedWarehouses( unpackingQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.OutboundPrice(), 1 ) );
+ cell.OutboundExpensesForRentedWarehouses( unpackingQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.OutboundPrice(), 1 ) );
// 澶栫搴撹繍杈撹垂鐢紙杩愯緭鏁伴噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺 * 杩愯緭鍗曚环锛�
+ transportationQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
+ tempPIT.Product_MP().ParentID() = mlcrr.Category() and
+ tempPIT.Trip().Departure().Date() >= mlcrc.StartDate() and
+ tempPIT.Trip().Arrival().Date() <= lastDayOfThisMonth and
+ tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID() = "CC 鍘傚唴搴�" and
+ tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() = "闀挎槬澶栫搴�",
+ tempPIT.Quantity()
+ );
+ cell.ExternalRentalWarehouseTransportationCosts( transportationQuantity / guard( lcm.PackagingCapacity(), 1 ) / guard( lct1.LoadingCapacity(), 1 ) * guard( lct1.TransportPrice(), 1 ) );
+
+ // 澶栫搴撲粨鍌ㄨ垂鐢細浠撳偍鏁伴噺/鍖呰瀹归噺*浠撳偍鍗曚环
+ 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().Product_MP().ParentID() = mlcrr.Category() and
+ tempPISPIP.Start().Date() >= mlcrc.StartDate() and
+ tempPISPIP.End().Date() <= lastDayOfThisMonth and
+ tempPISPIP.ProductInStockingPoint_MP().StockingPointID() = ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "澶ц繛澶栫搴�", "闀挎槬澶栫搴�" ),
+ tempPISPIP.PlannedInventoryLevelEnd() );
+ cell.RentalWarehouseStorageFees( plannedInventory / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.StoragePrice(), 1 ) );
cell.MachineLogisticsCostReportColumn( relset, mlcrc );
}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportRow/Method_Filter.qbl b/_Main/BL/Type_MachineLogisticsCostReportRow/Method_Filter.qbl
new file mode 100644
index 0000000..4ad4649
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportRow/Method_Filter.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Method Filter (
+ String factory
+) declarative remote as Boolean
+{
+ TextBody: 'return this.Factory() = factory;'
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_MatrixEditor912.def b/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_MatrixEditor912.def
index dcc3160..bae3842 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_MatrixEditor912.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_MatrixEditor912.def
@@ -45,6 +45,8 @@
Properties:
[
DataType: 'MacroPlan'
+ FilterArguments: 'factory:QLibMacroPlannerWebUI::ApplicationMacroPlanner.dhSelectedFactoryMCRR'
+ FixedFilter: 'object.Filter( factory )'
Source: 'MacroPlan'
Taborder: 0
Transformation: 'MachineLogisticsCostReportRow'
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_pHeader_bRefresh_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_pHeader_bRefresh_OnClick.def
index c02e5b9..fd71984 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_pHeader_bRefresh_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_pHeader_bRefresh_OnClick.def
@@ -13,7 +13,7 @@
{
Body:
[*
- MachineLogisticsCostReportCell::CreateData( MacroPlan, ddslFactory.Text() );
+ MachineLogisticsCostReportCell::CreateData( MacroPlan );
WebMessageBox::Success( Translations::A_VWED_Success() );
*]
--
Gitblit v1.9.3