From 42df5dbdbe5b317fd9c68b8a18631dfa3911e290 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期五, 15 十一月 2024 16:49:35 +0800
Subject: [PATCH] 大连发动机物流报表取成本逻辑修改
---
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl | 136 +++++++++++++++------------
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl | 136 ++++++++++++---------------
2 files changed, 136 insertions(+), 136 deletions(-)
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
index 739089d..08be1c4 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
@@ -7,7 +7,8 @@
TextBody:
[*
// 鐢勫叞楦� Aug-12-2024 (created)
- //owner.DLEngineLogisticsCostReport( relflush );
+ // 鐢勫叞楦� Aug-12-2024 (created)
+ owner.DLEngineLogisticsCostReport( relflush );
produtparent := DLEngineLogisticsCostReport::GetDefaultProductParent();
name := DLEngineLogisticsCostReport::GetDefaultName();
allunit := DLEngineLogisticsCostReport::GetDefaultAllUnit();
@@ -17,19 +18,9 @@
startofplanning := owner.StartOfPlanning().Date();
startofnextyear := startofplanning.StartOfNextYear();
- table := selectobject(owner, DLEngineLogisticsCostReport, report, report.ID() = name );
- if( isnull( table ) ){
- table := owner.DLEngineLogisticsCostReport( relnew, ID := name, Name := name );
- }
- table.Column( relflush );
- table.Row( relflush );
- showname := name + 'Show';
- if( not exists( owner, DLEngineLogisticsCostReport, report, report.ID() = showname and report.IsShow() ) ){
- owner.DLEngineLogisticsCostReport( relnew, ID := name + 'Show', Name := name, IsShow := true );
- }
- if( isnull( owner.DLEngineLogisticsCostSearch() ) ){
- owner.DLEngineLogisticsCostSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit );
- }
+ table := owner.DLEngineLogisticsCostReport( relnew, ID := name, Name := name );
+ owner.DLEngineLogisticsCostReport( relnew, ID := name + 'Show', Name := name, IsShow := true );
+ owner.DLEngineLogisticsCostSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit );
products := construct( Product_MPs );
@@ -55,28 +46,40 @@
and pispip.Start().Date() < column.StartDate().StartOfNextMonth()
and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) );
cell := selectobject( row, Cell, cell, cell.Column() = column );
- entercost := 0.0;
- othercost := 0.0;
- outcost := 0.0;
- storecost := 0.0;
- transcost := 0.0;
+ newsupplyqty := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() );
+ plannedinvqty := sum( pispips, Elements, pispip, pispip.PlannedInventoryLevelEnd() );
if( isdltoccrent){
- othercost := Real::MaxReal();
- transset := selectset( transcosts, Elements, trans, trans.Origin() = '闀挎槬澶栫搴�' and trans.Destination() = '瀹㈡埛搴�' );
- column.CalcEngineCost( pispips, enginecosts, transset, ccfactory, entercost, othercost, outcost, storecost, transcost );
- cell.CCRentQty( cell.CCRentQty() + sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() ) );
+ //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
+ enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate() and engine.EndDate() >= column.StartDate()
+ and engine.Factory() = ccfactory );
+ cell.CCRentQty( cell.CCRentQty() + newsupplyqty );
+ //闀挎槬澶栫搴撳叆搴撹垂鐢細鍏ュ簱閲�/鍖呰瀹归噺*鍏ュ簱鍗曚环
+ entercost := ceil( newsupplyqty / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
+ //闀挎槬澶栫搴撳嚭搴撹垂鐢�: 鍑哄簱閲�/鍖呰瀹归噺*鍑哄簱鍗曚环
+ outcost := ceil( newsupplyqty / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
cell.CCRentInCost( cell.CCRentInCost() + entercost );
cell.CCRentOutOfCost( cell.CCRentOutOfCost() + outcost );
- cell.CCRentStorCost( cell.CCRentStorCost() + storecost );//闀挎槬澶栫搴撲粨鍌ㄨ垂鐢�
- cell.CCShorTransCost( cell.CCShorTransCost() + transcost );//闀挎槬鐭�旇繍杈撹垂鐢�
+ cost := ceil( plannedinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
+ cell.CCRentStorCost( cell.CCRentStorCost() + cost );//闀挎槬澶栫搴撲粨鍌ㄨ垂鐢�
+ transcost := selectobject( transcosts, Elements, trans, trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() and trans.Origin() = '闀挎槬澶栫搴�' and trans.Destination() = '瀹㈡埛搴�' );
+ if( not isnull( transcost ) ){
+ cost := ceil( ceil( newsupplyqty / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
+ cell.CCShorTransCost( cell.CCShorTransCost() + cost );//闀挎槬鐭�旇繍杈撹垂鐢�
+ }
} else {
- outcost := Real::MaxReal();
- transset := selectset( transcosts, Elements, trans, trans.Origin() = '澶ц繛鍘傚唴搴�' and trans.Destination() = '澶ц繛澶栫搴�' );
- column.CalcEngineCost( pispips, enginecosts, transset, dlfactory, entercost, othercost, outcost, storecost, transcost );
- cell.DLRentStorCost( cell.DLRentStorCost() + storecost );//澶ц繛澶栫搴撲粨鍌ㄨ垂鐢�
- cell.DLRentOtherCost( cell.DLRentOtherCost() + othercost );//澶ц繛澶栫搴撳叾浠栬垂鐢�
- cell.DLRentInCost( cell.DLRentInCost() + entercost );//澶ц繛澶栫搴撳叆搴撹垂鐢�
- cell.WerkToDLRentTransCost( cell.WerkToDLRentTransCost() + transcost );//鍘傚唴鍒板ぇ杩炲绉熷簱杩愯緭璐圭敤
+ //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
+ enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate() and engine.EndDate() >= column.StartDate()
+ and engine.Factory() = dlfactory );
+ if( not isnull( enginecost ) ){
+ cost := ceil( plannedinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
+ cell.DLRentStorCost( cell.DLRentStorCost() + cost );//澶ц繛澶栫搴撲粨鍌ㄨ垂鐢�
+ row.SetDLRentEnterCost( column, enginecost, newsupplyqty );//澶ц繛澶栫搴撳叆搴撹垂鐢�
+ transcost := selectobject( transcosts, Elements, trans, trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() and trans.Origin() = '澶ц繛鍘傚唴搴�' and trans.Destination() = '澶ц繛澶栫搴�' );
+ if( not isnull( transcost ) ){
+ cost := ceil( ceil( newsupplyqty / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
+ row.SetFactoryToRentTransCost( column, cost );
+ }
+ }
}
}
products.Add( pisp.Product_MP() );
@@ -92,26 +95,32 @@
isdl := laneleg.OriginStockingPointID().EndsWith( '鍘傚唴搴�' ) and ( laneleg.OriginStockingPointID().StartsWith( '澶ц繛' ) or laneleg.OriginStockingPointID().StartsWith( 'DL' ) );
//鐩殑鍦板簱瀛樼偣鏄惁鏄暱鏄ワ紙闀挎槬澶栫搴擄級
iscc := laneleg.DestinationStockingPointID() = '澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�';
- if( isdl and iscc ){
- allenginecosts := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Factory() = ccfactory );
- alltranscosts := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.Origin() = laneleg.OriginStockingPointID() and trans.Destination() = laneleg.DestinationStockingPointID() );
- if( allenginecosts.Size() > 0 and alltranscosts.Size() > 0 ){
- alltrips := selectset( laneleg, Trip, trip, exists( trip, ProductInTrip, pit, pit.Quantity() <> 0 and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ) ) );
- productids := selectuniquevalues( alltrips, Elements.ProductInTrip, pit, pit.Quantity() <> 0 and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ), pit.ProductID() );
- traverse( productids, Elements, productid ){
- product := selectobject( owner, Product_MP, product, product.ID() = productid );
- row := table.GetRow( productid );
- products.Add( product );
- producttrips := selectset( alltrips, Elements.ProductInTrip, pit, pit.Quantity() > 0 and pit.ProductID() = productid );
- enginecosts := selectset( allenginecosts, Elements, engine, engine.Generation().ToLower() = product.Generation().ToLower() and engine.MLB_MQB() = product.MQBMLB() );
- //鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
- transcosts := selectset( alltranscosts, Elements, trans, exists( product.GetAllParent(), Elements, e, ifexpr( trans.Product().FindString( '鍙戝姩鏈�', 0 ) >= 0, e.ID() = produtparent, e.ID() = trans.Product() ) ) );
- if( not isnull( enginecosts ) and enginecosts.Size() > 0 and not isnull( transcosts ) and transcosts.Size() > 0 ){
- traverse( table, Column, column){//, column.StartDate().Month() = 1
- columntrips := selectset( producttrips, Elements, pit, pit.Trip().Arrival().Date() < column.StartDate().StartOfNextMonth() and pit.Trip().Arrival().Date() >= column.StartDate() );
- cell := selectobject( row, Cell, cell, cell.Column() = column );
- cell.CCLongTransCost( column.CalcEngineCost( columntrips, enginecosts, transcosts ) );
- }
+ if( isdl and iscc ){
+ traverse( table, Column, column){//, column.StartDate().Month() = 1
+ alltrips := selectset( laneleg, Trip, trip, trip.Arrival().Date() < column.StartDate().StartOfNextMonth() and trip.Arrival().Date() >= column.StartDate() );
+ enginecosts := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.StartDate() <= column.StartDate() and engine.EndDate() >= column.StartDate() );
+ transcosts := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() );
+ if( not isnull( enginecosts ) and enginecosts.Size() > 0 and not isnull( transcosts ) and transcosts.Size() > 0 ){
+ producttrips := selectuniquevalues( alltrips, Elements.ProductInTrip, pit, pit.Quantity() <> 0 and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ), pit.ProductID() );
+ traverse( producttrips, Elements, producttrip ){//, producttrip = '6912'
+
+ row := table.GetRow( producttrip );
+ product := selectobject( owner, Product_MP, product, product.ID() = producttrip );
+ products.Add( product );
+ quantity := sum( alltrips, Elements.ProductInTrip, pit, pit.Product_MP() = product, pit.Quantity() );
+ enginecost := selectobject( enginecosts, Elements, engine, engine.Generation().ToLower() = product.Generation().ToLower()
+ and engine.MLB_MQB() = product.MQBMLB()
+ and engine.Factory() = ccfactory );
+ //鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
+ transcost := selectobject( transcosts, Elements, trans, trans.Origin() = laneleg.OriginStockingPointID()
+ and trans.Destination() = laneleg.DestinationStockingPointID()
+ and exists( product.GetAllParent(), Elements, e, ifexpr( trans.Product().FindString( '鍙戝姩鏈�', 0 ) >= 0, e.ID() = produtparent, e.ID() = trans.Product() ) ) );
+
+ if( not isnull( enginecost ) and not isnull( transcost ) ){
+ cost := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
+ cell := selectobject( row, Cell, cell, cell.Column() = column );
+ cell.CCLongTransCost( cell.CCLongTransCost() + cost )
+ }
}
}
}
@@ -190,19 +199,24 @@
// }
// }
//}
- traverse( dlproducts, Elements, productid){
+ traverse( dlproducts, Elements, ccproduct){
- row := table.GetRow( productid )
- product := selectobject( owner, Product_MP, product, product.ID() = productid );
- //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
- enginecosts := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower()
+ row := table.GetRow( ccproduct )
+ product := selectobject( owner, Product_MP, product, product.ID() = ccproduct );
+ //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
+ enginecosts := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower()
and engine.MLB_MQB() = product.MQBMLB()and engine.Factory() = dlfactory );
if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
- products.Add( product );
- allpsdips := selectset( dlforecasts, Elements.PlanningSalesDemandInPeriod, psdip, psdip.ProductID() = productid and psdip.Quantity() > 0 );
traverse( table, Column, column ){
- psdips := selectset( allpsdips, Elements, psdip, psdip.StartDate() <= column.EndDate() and psdip.StartDate() >= column.StartDate() );
- row.SetDLRentOutCost( column, column.CalcEngineCost( psdips, enginecosts ) );
+ allpsdips := selectset( dlforecasts, Elements.PlanningSalesDemandInPeriod, psdip, psdip.ProductID() = ccproduct and psdip.Quantity() > 0 and psdip.StartDate() < column.StartDate().StartOfNextMonth() and psdip.StartDate() >= column.StartDate() );
+ enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate() and engine.EndDate() >= column.StartDate() );
+ if( not isnull( enginecost ) ){
+ products.Add( product );
+ quantity := sum( allpsdips, Elements, psdip, psdip.Quantity() );// + psdip.FulfilledQuantity()
+
+ cost := ceil( quantity / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
+ row.SetDLRentOutCost( column, cost );
+ }
}
}
}
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
index 6bc14fb..c6f6787 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
@@ -6,8 +6,7 @@
{
TextBody:
[*
- // 鐢勫叞楦� Aug-12-2024 (created)
- owner.DLEngineLogisticsCostReport( relflush );
+ //owner.DLEngineLogisticsCostReport( relflush );
produtparent := DLEngineLogisticsCostReport::GetDefaultProductParent();
name := DLEngineLogisticsCostReport::GetDefaultName();
allunit := DLEngineLogisticsCostReport::GetDefaultAllUnit();
@@ -17,9 +16,19 @@
startofplanning := owner.StartOfPlanning().Date();
startofnextyear := startofplanning.StartOfNextYear();
- table := owner.DLEngineLogisticsCostReport( relnew, ID := name, Name := name );
- owner.DLEngineLogisticsCostReport( relnew, ID := name + 'Show', Name := name, IsShow := true );
- owner.DLEngineLogisticsCostSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit );
+ table := selectobject(owner, DLEngineLogisticsCostReport, report, report.ID() = name );
+ if( isnull( table ) ){
+ table := owner.DLEngineLogisticsCostReport( relnew, ID := name, Name := name );
+ }
+ table.Column( relflush );
+ table.Row( relflush );
+ showname := name + 'Show';
+ if( not exists( owner, DLEngineLogisticsCostReport, report, report.ID() = showname and report.IsShow() ) ){
+ owner.DLEngineLogisticsCostReport( relnew, ID := name + 'Show', Name := name, IsShow := true );
+ }
+ if( isnull( owner.DLEngineLogisticsCostSearch() ) ){
+ owner.DLEngineLogisticsCostSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit );
+ }
products := construct( Product_MPs );
@@ -45,40 +54,28 @@
and pispip.Start().Date() < column.StartDate().StartOfNextMonth()
and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) );
cell := selectobject( row, Cell, cell, cell.Column() = column );
- newsupplyqty := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() );
- plannedinvqty := sum( pispips, Elements, pispip, pispip.PlannedInventoryLevelEnd() );
+ entercost := 0.0;
+ othercost := 0.0;
+ outcost := 0.0;
+ storecost := 0.0;
+ transcost := 0.0;
if( isdltoccrent){
- //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
- enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate() and engine.EndDate() >= column.StartDate()
- and engine.Factory() = ccfactory );
- cell.CCRentQty( cell.CCRentQty() + newsupplyqty );
- //闀挎槬澶栫搴撳叆搴撹垂鐢細鍏ュ簱閲�/鍖呰瀹归噺*鍏ュ簱鍗曚环
- entercost := ceil( newsupplyqty / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
- //闀挎槬澶栫搴撳嚭搴撹垂鐢�: 鍑哄簱閲�/鍖呰瀹归噺*鍑哄簱鍗曚环
- outcost := ceil( newsupplyqty / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
+ othercost := Real::MaxReal();
+ transset := selectset( transcosts, Elements, trans, trans.Origin() = '闀挎槬澶栫搴�' and trans.Destination() = '瀹㈡埛搴�' );
+ column.CalcEngineCost( pispips, enginecosts, transset, ccfactory, entercost, othercost, outcost, storecost, transcost );
+ cell.CCRentQty( cell.CCRentQty() + sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() ) );
cell.CCRentInCost( cell.CCRentInCost() + entercost );
cell.CCRentOutOfCost( cell.CCRentOutOfCost() + outcost );
- cost := ceil( plannedinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
- cell.CCRentStorCost( cell.CCRentStorCost() + cost );//闀挎槬澶栫搴撲粨鍌ㄨ垂鐢�
- transcost := selectobject( transcosts, Elements, trans, trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() and trans.Origin() = '闀挎槬澶栫搴�' and trans.Destination() = '瀹㈡埛搴�' );
- if( not isnull( transcost ) ){
- cost := ceil( ceil( newsupplyqty / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
- cell.CCShorTransCost( cell.CCShorTransCost() + cost );//闀挎槬鐭�旇繍杈撹垂鐢�
- }
+ cell.CCRentStorCost( cell.CCRentStorCost() + storecost );//闀挎槬澶栫搴撲粨鍌ㄨ垂鐢�
+ cell.CCShorTransCost( cell.CCShorTransCost() + transcost );//闀挎槬鐭�旇繍杈撹垂鐢�
} else {
- //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
- enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate() and engine.EndDate() >= column.StartDate()
- and engine.Factory() = dlfactory );
- if( not isnull( enginecost ) ){
- cost := ceil( plannedinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
- cell.DLRentStorCost( cell.DLRentStorCost() + cost );//澶ц繛澶栫搴撲粨鍌ㄨ垂鐢�
- row.SetDLRentEnterCost( column, enginecost, newsupplyqty );//澶ц繛澶栫搴撳叆搴撹垂鐢�
- transcost := selectobject( transcosts, Elements, trans, trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() and trans.Origin() = '澶ц繛鍘傚唴搴�' and trans.Destination() = '澶ц繛澶栫搴�' );
- if( not isnull( transcost ) ){
- cost := ceil( ceil( newsupplyqty / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
- row.SetFactoryToRentTransCost( column, cost );
- }
- }
+ outcost := Real::MaxReal();
+ transset := selectset( transcosts, Elements, trans, trans.Origin() = '澶ц繛鍘傚唴搴�' and trans.Destination() = '澶ц繛澶栫搴�' );
+ column.CalcEngineCost( pispips, enginecosts, transset, dlfactory, entercost, othercost, outcost, storecost, transcost );
+ cell.DLRentStorCost( cell.DLRentStorCost() + storecost );//澶ц繛澶栫搴撲粨鍌ㄨ垂鐢�
+ cell.DLRentOtherCost( cell.DLRentOtherCost() + othercost );//澶ц繛澶栫搴撳叾浠栬垂鐢�
+ cell.DLRentInCost( cell.DLRentInCost() + entercost );//澶ц繛澶栫搴撳叆搴撹垂鐢�
+ cell.WerkToDLRentTransCost( cell.WerkToDLRentTransCost() + transcost );//鍘傚唴鍒板ぇ杩炲绉熷簱杩愯緭璐圭敤
}
}
products.Add( pisp.Product_MP() );
@@ -94,32 +91,26 @@
isdl := laneleg.OriginStockingPointID().EndsWith( '鍘傚唴搴�' ) and ( laneleg.OriginStockingPointID().StartsWith( '澶ц繛' ) or laneleg.OriginStockingPointID().StartsWith( 'DL' ) );
//鐩殑鍦板簱瀛樼偣鏄惁鏄暱鏄ワ紙闀挎槬澶栫搴擄級
iscc := laneleg.DestinationStockingPointID() = '澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�';
- if( isdl and iscc ){
- traverse( table, Column, column){//, column.StartDate().Month() = 1
- alltrips := selectset( laneleg, Trip, trip, trip.Arrival().Date() < column.StartDate().StartOfNextMonth() and trip.Arrival().Date() >= column.StartDate() );
- enginecosts := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.StartDate() <= column.StartDate() and engine.EndDate() >= column.StartDate() );
- transcosts := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() );
- if( not isnull( enginecosts ) and enginecosts.Size() > 0 and not isnull( transcosts ) and transcosts.Size() > 0 ){
- producttrips := selectuniquevalues( alltrips, Elements.ProductInTrip, pit, pit.Quantity() <> 0 and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ), pit.ProductID() );
- traverse( producttrips, Elements, producttrip ){//, producttrip = '6912'
-
- row := table.GetRow( producttrip );
- product := selectobject( owner, Product_MP, product, product.ID() = producttrip );
- products.Add( product );
- quantity := sum( alltrips, Elements.ProductInTrip, pit, pit.Product_MP() = product, pit.Quantity() );
- enginecost := selectobject( enginecosts, Elements, engine, engine.Generation().ToLower() = product.Generation().ToLower()
- and engine.MLB_MQB() = product.MQBMLB()
- and engine.Factory() = ccfactory );
- //鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
- transcost := selectobject( transcosts, Elements, trans, trans.Origin() = laneleg.OriginStockingPointID()
- and trans.Destination() = laneleg.DestinationStockingPointID()
- and exists( product.GetAllParent(), Elements, e, ifexpr( trans.Product().FindString( '鍙戝姩鏈�', 0 ) >= 0, e.ID() = produtparent, e.ID() = trans.Product() ) ) );
-
- if( not isnull( enginecost ) and not isnull( transcost ) ){
- cost := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
- cell := selectobject( row, Cell, cell, cell.Column() = column );
- cell.CCLongTransCost( cell.CCLongTransCost() + cost )
- }
+ if( isdl and iscc ){
+ allenginecosts := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Factory() = ccfactory );
+ alltranscosts := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.Origin() = laneleg.OriginStockingPointID() and trans.Destination() = laneleg.DestinationStockingPointID() );
+ if( allenginecosts.Size() > 0 and alltranscosts.Size() > 0 ){
+ alltrips := selectset( laneleg, Trip, trip, exists( trip, ProductInTrip, pit, pit.Quantity() <> 0 and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ) ) );
+ productids := selectuniquevalues( alltrips, Elements.ProductInTrip, pit, pit.Quantity() <> 0 and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ), pit.ProductID() );
+ traverse( productids, Elements, productid ){
+ product := selectobject( owner, Product_MP, product, product.ID() = productid );
+ row := table.GetRow( productid );
+ products.Add( product );
+ producttrips := selectset( alltrips, Elements.ProductInTrip, pit, pit.Quantity() > 0 and pit.ProductID() = productid );
+ enginecosts := selectset( allenginecosts, Elements, engine, engine.Generation().ToLower() = product.Generation().ToLower() and engine.MLB_MQB() = product.MQBMLB() );
+ //鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
+ transcosts := selectset( alltranscosts, Elements, trans, exists( product.GetAllParent(), Elements, e, ifexpr( trans.Product().FindString( '鍙戝姩鏈�', 0 ) >= 0, e.ID() = produtparent, e.ID() = trans.Product() ) ) );
+ if( not isnull( enginecosts ) and enginecosts.Size() > 0 and not isnull( transcosts ) and transcosts.Size() > 0 ){
+ traverse( table, Column, column){//, column.StartDate().Month() = 1
+ columntrips := selectset( producttrips, Elements, pit, pit.Trip().Arrival().Date() < column.StartDate().StartOfNextMonth() and pit.Trip().Arrival().Date() >= column.StartDate() );
+ cell := selectobject( row, Cell, cell, cell.Column() = column );
+ cell.CCLongTransCost( column.CalcEngineCost( columntrips, enginecosts, transcosts ) );
+ }
}
}
}
@@ -198,24 +189,19 @@
// }
// }
//}
- traverse( dlproducts, Elements, ccproduct){
+ traverse( dlproducts, Elements, productid){
- row := table.GetRow( ccproduct )
- product := selectobject( owner, Product_MP, product, product.ID() = ccproduct );
- //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
- enginecosts := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower()
+ row := table.GetRow( productid )
+ product := selectobject( owner, Product_MP, product, product.ID() = productid );
+ //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
+ enginecosts := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower()
and engine.MLB_MQB() = product.MQBMLB()and engine.Factory() = dlfactory );
if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
+ products.Add( product );
+ allpsdips := selectset( dlforecasts, Elements.PlanningSalesDemandInPeriod, psdip, psdip.ProductID() = productid and psdip.Quantity() > 0 );
traverse( table, Column, column ){
- allpsdips := selectset( dlforecasts, Elements.PlanningSalesDemandInPeriod, psdip, psdip.ProductID() = ccproduct and psdip.Quantity() > 0 and psdip.StartDate() < column.StartDate().StartOfNextMonth() and psdip.StartDate() >= column.StartDate() );
- enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate() and engine.EndDate() >= column.StartDate() );
- if( not isnull( enginecost ) ){
- products.Add( product );
- quantity := sum( allpsdips, Elements, psdip, psdip.Quantity() );// + psdip.FulfilledQuantity()
-
- cost := ceil( quantity / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
- row.SetDLRentOutCost( column, cost );
- }
+ psdips := selectset( allpsdips, Elements, psdip, psdip.StartDate() <= column.EndDate() and psdip.StartDate() >= column.StartDate() );
+ row.SetDLRentOutCost( column, column.CalcEngineCost( psdips, enginecosts ) );
}
}
}
--
Gitblit v1.9.3