From d03861b11b193439353fa5d9b92eb6ee1e6458e2 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期六, 12 十月 2024 17:33:03 +0800
Subject: [PATCH] 库存汇总报表查询条件格式修改,发动机物流成本报表系数,汇总添加
---
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl | 255 +++++++++++++++-----------------------------------
1 files changed, 78 insertions(+), 177 deletions(-)
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
index cff8bf9..08b0f6f 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
@@ -11,16 +11,10 @@
produtparent := DLEngineLogisticsCostReport::GetDefaultProductParent();
name := DLEngineLogisticsCostReport::GetDefaultName();
allunit := DLEngineLogisticsCostReport::GetDefaultAllUnit();
- ccunit := DLEngineLogisticsCostReport::GetDefaultCCUnit();
- dlunit := DLEngineLogisticsCostReport::GetDefaultDLUnit();
ccfactory := DLEngineLogisticsCostReport::GetCCFactory();
dlfactory := DLEngineLogisticsCostReport::GetDLFactory();
- //dlline := DLEngineLogisticsCostReport::GetStockingPointDLLine();
- //ccrent := DLEngineLogisticsCostReport::GetStockingPointCCRent();
- //dlrent := DLEngineLogisticsCostReport::GetStockingPointCCRent();
startofplanning := owner.StartOfPlanning().Date();
- //startofyear := startofplanning.StartOfYear();
startofnextyear := startofplanning.StartOfNextYear();
table := owner.DLEngineLogisticsCostReport( relnew, ID := name, Name := name );
@@ -33,15 +27,8 @@
//澶栫搴撲粨鍌ㄨ垂鐢細浠撳偍鏁伴噺/鍖呰瀹归噺*浠撳偍鍗曚环锛屽湪Actual inventories閲屽彇鍒伴暱鏄ュ绉熷簱/澶ц繛澶栫搴撹鍙戝姩鏈虹殑浠撳偍閲忥紝鏍规嵁鍙戝姩鏈哄彿鎵惧埌瀵瑰簲鐨凣eneration 鍜屾í绾靛埗锛屽湪鍙戝姩鏈烘垚鏈弬鏁拌〃閲屾壘鍒板搴旂殑浠撳偍鍗曚环鍜屽寘瑁呭閲忥紝鐢ㄥ叕寮忚绠楋紝鏈堝害杩涜姹囨��
//闀挎槬澶栫搴撳叆搴�/鍑哄簱璐圭敤锛屽ぇ杩炲彂鍔ㄦ満鐨勯暱鏄ュ绉熷簱鐨凬ew supply
traverse( owner, StockingPoint_MP, stockingpoint, stockingpoint.ID().EndsWith( '澶栫搴�' ) ){
- // unit := stockingpoint.Unit();
- // parentunits := unit.GetAllParent();
- //鏄惁灞炰簬闀挎槬澶栫搴撶敤浜庨暱鏄ュ绉熷簱浠撳偍璐圭敤
- // isccrent := stockingpoint.ID().StartsWith( '闀挎槬' ) or stockingpoint.ID().StartsWith( 'CC' );
- //鏄惁灞炰簬澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴撶敤浜庨暱鏄ュ叆搴�/鍑哄簱璐圭敤
isdltoccrent := stockingpoint.ID().StartsWith( '澶ц繛鍙戝姩鏈虹殑闀挎槬' );
- //鏄惁灞炰簬澶ц繛澶栫搴撶敤浜庡ぇ杩炲绉熷簱浠撳偍璐圭敤
isdlrent := not isdltoccrent and stockingpoint.ID().StartsWith( '澶ц繛' ) or stockingpoint.ID().StartsWith( 'DL' );
- // info( '--------------', isccrent, isdltoccrent, isdlrent );
if( isdlrent or isdltoccrent){
traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf()
and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) ) ){
@@ -51,9 +38,7 @@
if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
row := table.GetRow( pisp.ProductID() );
enginecosts := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower() and engine.MLB_MQB() = product.MQBMLB() );
- transcosts := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.Origin() = '澶ц繛鍘傚唴搴�'
- and trans.Destination() = '澶ц繛澶栫搴�'
- and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '鍙戝姩鏈�', 0 ) >= 0, e.ID() = produtparent, e.ID() = trans.Product() ) ) );
+ transcosts := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '鍙戝姩鏈�', 0 ) >= 0, e.ID() = produtparent, e.ID() = trans.Product() ) ) );
if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
products.Add( pisp.Product_MP() );
traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear
@@ -67,30 +52,34 @@
//鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date()
and engine.Factory() = ccfactory );
- cell.CCRentQty( cell.CCRentQty() + pispip.NewSupplyQuantity() );
- //闀挎槬澶栫搴撳叆搴撹垂鐢細鍏ュ簱閲�/鍖呰瀹归噺*鍏ュ簱鍗曚环
- entercost := ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
- //闀挎槬澶栫搴撳嚭搴撹垂鐢�: 鍑哄簱閲�/鍖呰瀹归噺*鍑哄簱鍗曚环
- outcost := ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
- cell.CCRentInCost( cell.CCRentInCost() + entercost );
- cell.CCRentOutOfCost( cell.CCRentOutOfCost() + outcost );
- cost := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
- cell.CCRentStorCost( cell.CCRentStorCost() + cost );//闀挎槬澶栫搴撲粨鍌ㄨ垂鐢�
+ cell.CCRentQty( cell.CCRentQty() + pispip.NewSupplyQuantity() );
+ //闀挎槬澶栫搴撳叆搴撹垂鐢細鍏ュ簱閲�/鍖呰瀹归噺*鍏ュ簱鍗曚环
+ entercost := ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
+ //闀挎槬澶栫搴撳嚭搴撹垂鐢�: 鍑哄簱閲�/鍖呰瀹归噺*鍑哄簱鍗曚环
+ outcost := ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
+ cell.CCRentInCost( cell.CCRentInCost() + entercost );
+ cell.CCRentOutOfCost( cell.CCRentOutOfCost() + outcost );
+ cost := ceil( pispip.PlannedInventoryLevelEnd() / 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( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
+ cell.CCShorTransCost( cell.CCShorTransCost() + cost );//闀挎槬鐭�旇繍杈撹垂鐢�
+ }
} else {
//鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
- enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date()
+ enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date()
and engine.Factory() = dlfactory );
- if( not isnull( enginecost ) ){
- cost := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
- cell.DLRentStorCost( cell.DLRentStorCost() + cost );//澶ц繛澶栫搴撲粨鍌ㄨ垂鐢�
- // info( '**********************', pispip.NewSupplyQuantity() );
- row.SetDLRentEnterCost( column, enginecost, pispip.NewSupplyQuantity() );//澶ц繛澶栫搴撳叆搴撹垂鐢�
- transcost := selectobject( transcosts, Elements, trans, trans.StartDate() <= pispip.Start().Date() and trans.EndDate() >= pispip.Start().Date() );
- if( not isnull( transcost ) ){
- cost := ceil( ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
- row.SetFactoryToRentTransCost( column, cost );
- }
- }
+ if( not isnull( enginecost ) ){
+ cost := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
+ cell.DLRentStorCost( cell.DLRentStorCost() + cost );//澶ц繛澶栫搴撲粨鍌ㄨ垂鐢�
+ row.SetDLRentEnterCost( column, enginecost, pispip.NewSupplyQuantity() );//澶ц繛澶栫搴撳叆搴撹垂鐢�
+ transcost := selectobject( transcosts, Elements, trans, trans.StartDate() <= pispip.Start().Date() and trans.EndDate() >= pispip.Start().Date() and trans.Origin() = '澶ц繛鍘傚唴搴�' and trans.Destination() = '澶ц繛澶栫搴�' );
+ if( not isnull( transcost ) ){
+ cost := ceil( ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
+ row.SetFactoryToRentTransCost( column, cost );
+ }
+ }
}
}
}
@@ -98,123 +87,37 @@
}
}
}
- //鍦� trip plan閲屾壘鍒板ぇ杩炶閰嶇嚎杈瑰簱鍒板ぇ杩炲绉熷簱鐨勮繍杈撴暟閲�//澶ц繛鍘傚唴搴撳埌澶栫搴�
- //traverse( owner, Unit.Lane.LaneLeg, laneleg ){
- // isdlspline := laneleg.OriginStockingPointID().EndsWith( '鍘傚唴搴�' ) and ( laneleg.OriginStockingPointID().StartsWith( '澶ц繛' ) or laneleg.OriginStockingPointID().StartsWith( 'DL' ) );
- // //鐩殑鍦版槸鍚︽槸澶ц繛澶栫搴�
- // isdlrent := laneleg.DestinationStockingPointID().EndsWith( '澶ц繛澶栫搴�' );
- // if( isdlspline and isdlrent ){
- // traverse( table, Column, column ){
- // alltrips := selectset( laneleg, Trip, trip, trip.Arrival().Date() < column.StartDate().StartOfNextMonth() and trip.Arrival().Date() >= column.StartDate() );
- //// info( '--------------------', alltrips.Size(), 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() );
- //// info( '--------------2---------------', producttrips.Size() );
- // traverse( producttrips, Elements, producttrip ){
- //
- // 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() ) ) );
- //// info( '-------------------', not isnull( enginecost ) and not isnull( transcost ), isnull( transcost ), product.ID() );
- // if( not isnull( enginecost ) and not isnull( transcost ) ){
- //// info( '-------------------', product.ID(), transcost.LoadingCapacity() );
- // cost := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
- // info( quantity, ceil( quantity / enginecost.PackagingCapacity() ), ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) );
- // row.SetFactoryToRentTransCost( column, cost );
- // }
- // }
- // }
- // }
- //traverse( owner, Unit.Lane.LaneLeg, laneleg ){
- // //璧峰搴撳瓨鐐规槸鍚︽槸澶ц繛瑁呴厤绾胯竟搴�
- // isdlspline := laneleg.OriginStockingPointID().EndsWith( '鍘傚唴搴�' ) and ( laneleg.OriginStockingPointID().StartsWith( '澶ц繛' ) or laneleg.OriginStockingPointID().StartsWith( 'DL' ) );
- // //鐩殑鍦版槸鍚︽槸澶ц繛澶栫搴�
- // isdlrent := laneleg.DestinationStockingPointID().EndsWith( '澶栫搴�' ) and ( laneleg.DestinationStockingPointID().StartsWith( '澶ц繛' ) or laneleg.DestinationStockingPointID().StartsWith( 'DL' ) );
- // if( isdlspline and isdlrent ){
- // traverse( laneleg, Trip, trip, trip.Departure().Date() < startofnextyear ){//鐢变簬闇�瑕佽�冭檻浜у搧杩愯緭lead time锛屾瘡涓湀鐨勬眹鎬绘暟鎹渶瑕佹帹杩熶袱澶╄繘琛岃绠�
- // periodtime := trip.Departure().StartOfMonth().Date();
- // periodname := periodtime.Format( "M2/D2/Y" );
- //
- // column := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
- // enginecosts := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.StartDate() <= trip.Departure().Date() and engine.EndDate() >= trip.Departure().Date() );
- // transcosts := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.StartDate() <= trip.Departure().Date() and trans.EndDate() >= trip.Departure().Date() );
- // if( not isnull( enginecosts ) and enginecosts.Size() > 0 and not isnull( transcosts ) and transcosts.Size() > 0 ){
- // traverse( trip, ProductInTrip, pit, pit.Quantity() <> 0 and not isnull( column ) and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
- // quantity := [Number]pit.Quantity();
- // row := table.GetRow( pit.ProductID() );
- // product := pit.Product_MP();
- // productparents := product.GetAllParent();
- //
- // //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
- // enginecost := selectobject( enginecosts, Elements, engine, engine.Generation().ToLower() = product.Generation().ToLower()
- // and engine.MLB_MQB() = product.MQBMLB()
- // and engine.Factory() = dlfactory );
- // //鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
- // transcost := selectobject( transcosts, Elements, trans, trans.Origin() = laneleg.OriginStockingPointID()
- // and trans.Destination() = laneleg.DestinationStockingPointID()
- // and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '鍙戝姩鏈�', 0 ) >= 0, e.ID() = produtparent, e.ID() = trans.Product() ) ) );
- // if( not isnull( enginecost ) and not isnull( transcost ) ){
- // products.Add( product );
- // cell := selectobject( row, Cell, cell, cell.Column() = column );
- // //杩愯緭鏁伴噺/鍖呰瀹归噺/瑁呰浇瀹归噺*杩愯緭鍗曚环
- // cost := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
- // cell.WerkToDLRentTransCost( cell.WerkToDLRentTransCost() + cost );
- // }
- // }
- // }
- // }
- // }
- //}
//闀挎槬闀块�旇繍杈撹垂鐢細璋冩嫧鏁伴噺/鍖呰瀹归噺/瑁呰浇瀹归噺*杩愯緭鍗曚环锛岃皟鎷ㄨ鍒掗噷鎵惧埌璇ヤ骇鍝佷粠DL鍒癈C鐨勮皟鎷ㄦ暟閲忥紝鍗宠捣濮嬪湴澶ц繛瑁呴厤绾胯竟搴擄紝鐩殑鍦颁负闀挎槬澶栫搴撳搴旂殑杩愯緭鏁伴噺锛屽湪鍙戝姩鏈烘垚鏈弬鏁拌〃鎵惧埌瀵瑰簲鐨勫寘瑁呭閲忥紝鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲忥紝鐢ㄥ叕寮忚绠楀緱鍑虹粨鏋滐紝鏈堝害杩涜姹囨��
traverse( owner, Unit.Lane.LaneLeg, laneleg ){
- // isdlspline := laneleg.OriginStockingPointID().EndsWith( '鍘傚唴搴�' ) and ( laneleg.OriginStockingPointID().StartsWith( '澶ц繛' ) or laneleg.OriginStockingPointID().StartsWith( 'DL' ) );
- // //鐩殑鍦版槸鍚︽槸澶ц繛澶栫搴�
- // isdlrent := laneleg.DestinationStockingPointID().EndsWith( '澶ц繛澶栫搴�' );
//璧峰搴撳瓨鐐规槸鍚︽槸澶ц繛(澶ц繛鍘傚唴搴擄級
- isdl := laneleg.OriginStockingPointID().EndsWith( '鍘傚唴搴�' ) and ( laneleg.OriginStockingPointID().StartsWith( '澶ц繛' ) or laneleg.OriginStockingPointID().StartsWith( 'DL' ) );
+ isdl := laneleg.OriginStockingPointID().EndsWith( '鍘傚唴搴�' ) and ( laneleg.OriginStockingPointID().StartsWith( '澶ц繛' ) or laneleg.OriginStockingPointID().StartsWith( 'DL' ) );
//鐩殑鍦板簱瀛樼偣鏄惁鏄暱鏄ワ紙闀挎槬澶栫搴擄級
- iscc := laneleg.DestinationStockingPointID() = '澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�';
+ iscc := laneleg.DestinationStockingPointID() = '澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�';
if( isdl and iscc ){
- // if( isdlspline and isdlrent ){
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() );
- // info( '--------------------', alltrips.Size(), 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() );
+ 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() );
- // info( '--------------2---------------', producttrips.Size() );
traverse( producttrips, Elements, producttrip ){//, producttrip = '6912'
- row := table.GetRow( producttrip );
+ 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()
+ 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()
+ 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() ) ) );
- // info( '-------------------', not isnull( enginecost ) and not isnull( transcost ), isnull( transcost ), product.ID() );
+
if( not isnull( enginecost ) and not isnull( transcost ) ){
- // info( '-------------------', product.ID(), transcost.LoadingCapacity() );
- cost := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
- // info( quantity, ceil( quantity / enginecost.PackagingCapacity() ), ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) );
- // row.SetFactoryToRentTransCost( column, cost );
- cell := selectobject( row, Cell, cell, cell.Column() = column );
+ cost := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
+ cell := selectobject( row, Cell, cell, cell.Column() = column );
cell.CCLongTransCost( cell.CCLongTransCost() + cost )
}
}
@@ -259,62 +162,60 @@
}
}
//闀挎槬鐭�旇繍杈撹垂鐢細瀹㈡埛闇�姹傛暟閲�/鍖呰瀹归噺/瑁呰浇瀹归噺*杩愯緭鍗曚环锛屽鎴烽渶姹傛暟閲忓彇鑷猣orecast閲宻ales segment涓洪暱鏄ョ殑鏁伴噺姹囨�伙紝鍐嶇敤鍏紡璁$畻锛屾湀搴﹁繘琛屾眹鎬伙紙鍙栧鎴烽渶姹傛暟閲忔崲绠楁垚杞︽锛�
- allforecast := selectset( owner, SalesDemand.astype( Forecast ), forecast, forecast.Quantity() > 0 and not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < startofnextyear and //forecast.ProductID() = '6912' and forecast.StartDate().Month() = 1 and
- ( forecast.SalesSegment_MP().Name().StartsWith( 'Changchun' ) or exists( forecast.SalesSegment_MP().GetAllParent(), Elements, psalessegment, psalessegment.Name().StartsWith( 'Changchun' ) ) or forecast.SalesSegment_MP().Name().StartsWith( 'Foshan' ) or forecast.SalesSegment_MP().Name().StartsWith( 'Tianjin' )
+ allforecast := selectset( owner, SalesDemand.astype( Forecast ), forecast, forecast.Quantity() > 0 and not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < startofnextyear and //forecast.ProductID() = '6912' and forecast.StartDate().Month() = 1 and
+ // ( forecast.SalesSegment_MP().Name().StartsWith( 'Changchun' ) or exists( forecast.SalesSegment_MP().GetAllParent(), Elements, psalessegment, psalessegment.Name().StartsWith( 'Changchun' ) ) or
+ ( forecast.SalesSegment_MP().Name().StartsWith( 'Foshan' ) or forecast.SalesSegment_MP().Name().StartsWith( 'Tianjin' )
or exists( forecast.SalesSegment_MP().GetAllParent(), Elements, psalessegment, psalessegment.Name().StartsWith( 'Foshan' ) or psalessegment.Name().StartsWith( 'Tianjin' ) ) )
and exists( forecast.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ) );
- ccforecasts := selectset( allforecast, Elements, forecast, forecast.SalesSegment_MP().Name().StartsWith( 'Changchun' ) or exists( forecast.SalesSegment_MP().GetAllParent(), Elements, psalessegment, psalessegment.Name().StartsWith( 'Changchun' ) ) );
- ccproducts := selectuniquevalues( ccforecasts, Elements, forecast, forecast.ProductID() );
- dlforecasts := selectset( allforecast, Elements, forecast, forecast.SalesSegment_MP().Name().StartsWith( 'Foshan' ) or forecast.SalesSegment_MP().Name().StartsWith( 'Tianjin' )
+ //ccforecasts := selectset( allforecast, Elements, forecast, forecast.SalesSegment_MP().Name().StartsWith( 'Changchun' ) or exists( forecast.SalesSegment_MP().GetAllParent(), Elements, psalessegment, psalessegment.Name().StartsWith( 'Changchun' ) ) );
+ //ccproducts := selectuniquevalues( ccforecasts, Elements, forecast, forecast.ProductID() );
+ dlforecasts := selectset( allforecast, Elements, forecast, forecast.SalesSegment_MP().Name().StartsWith( 'Foshan' ) or forecast.SalesSegment_MP().Name().StartsWith( 'Tianjin' )
or exists( forecast.SalesSegment_MP().GetAllParent(), Elements, psalessegment, psalessegment.Name().StartsWith( 'Foshan' ) or psalessegment.Name().StartsWith( 'Tianjin' ) ) );
- dlproducts := selectuniquevalues( dlforecasts, Elements, forecast, forecast.ProductID() );;
- traverse( ccproducts, Elements, ccproduct){
- product := selectobject( owner, Product_MP, product, product.ID() = ccproduct );
- // info( '************', product.ID(), exists( ccforecasts, Elements, forecast, forecast.Quantity() > 0 ));
- //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
- enginecosts := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower()
- and engine.MLB_MQB() = product.MQBMLB()and engine.Factory() = ccfactory );
- //鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
- transcosts := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.Origin() = '闀挎槬澶栫搴�'
- and trans.Destination() = '瀹㈡埛搴�'
- and 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 ){
- row := table.GetRow( ccproduct )
- products.Add( product );
- traverse( table, Column, column ){
- allpsdips := selectset( ccforecasts, 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() );
- transcost := selectobject( transcosts, Elements, trans, trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() );
- if( not isnull( enginecost ) and not isnull( transcost ) ){
- quantity := sum( allpsdips, Elements, psdip, psdip.Quantity() );
- cost := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
- cell := selectobject( row, Cell, cell, cell.Column() = column );
- cell.CCShorTransCost( cell.CCShorTransCost() + cost );
- }
- }
- }
- }
- //info( '***********1********', dlforecasts.Size() );
+ dlproducts := selectuniquevalues( dlforecasts, Elements, forecast, forecast.ProductID() );;
+ //traverse( ccproducts, Elements, ccproduct){
+ // product := selectobject( owner, Product_MP, product, product.ID() = ccproduct );
+ //// info( '************', product.ID(), exists( ccforecasts, Elements, forecast, forecast.Quantity() > 0 ));
+ // //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
+ // enginecosts := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower()
+ // and engine.MLB_MQB() = product.MQBMLB()and engine.Factory() = ccfactory );
+ // //鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
+ // transcosts := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.Origin() = '闀挎槬澶栫搴�'
+ // and trans.Destination() = '瀹㈡埛搴�'
+ // and 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 ){
+ // row := table.GetRow( ccproduct )
+ // products.Add( product );
+ // traverse( table, Column, column ){
+ // allpsdips := selectset( ccforecasts, 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() );
+ // transcost := selectobject( transcosts, Elements, trans, trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() );
+ // if( not isnull( enginecost ) and not isnull( transcost ) ){
+ // quantity := sum( allpsdips, Elements, psdip, psdip.Quantity() );
+ // cost := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
+ // cell := selectobject( row, Cell, cell, cell.Column() = column );
+ // cell.CCShorTransCost( cell.CCShorTransCost() + cost );
+ // }
+ // }
+ // }
+ //}
traverse( dlproducts, Elements, ccproduct){
- row := table.GetRow( ccproduct )
+ 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 ){
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() );
+ 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() );
+ quantity := sum( allpsdips, Elements, psdip, psdip.Quantity() );
- cost := ceil( quantity / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
- // info( '******************', quantity, cost );
- // cell := selectobject( row, Cell, cell, cell.Column() = column );
- row.SetDLRentOutCost( column, cost );
- }
+ cost := ceil( quantity / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
+ row.SetDLRentOutCost( column, cost );
+ }
}
}
}
--
Gitblit v1.9.3