From a8d5543b12a589d26556623e6df2eb9cd29fd2c2 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期一, 19 八月 2024 17:37:00 +0800
Subject: [PATCH] 发动机物流成本0行处理
---
_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl | 26 ++++++------
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl | 71 ++++++++++++++++-------------------
2 files changed, 45 insertions(+), 52 deletions(-)
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
index 40473ab..42c2471 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
@@ -30,15 +30,15 @@
traverse( owner, FinancialProductionSource, source, not source.IsImport() ){//璐㈠姟浜ч噺鎶ヨ〃闈炲鍏�
traverse( source, FinancialProductionReport, report, not report.IsShow() ){//璐㈠姟浜ч噺鎶ヨ〃涓嶆樉绀�
traverse( report, FinancialProductionRow, row, row.Unit() = ccunit and exists( row, FinancialProductionCell, cell, cell.Value() <> '0' ) ){//璐㈠姟浜ч噺鎶ヨ〃閲岀殑闀挎槬浜ч噺, 涓嶄负0
- ccrow := table.GetRow( row.Name() );
product := row.Product_MP();
productparents := product.GetAllParent();
if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
//鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
- enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation()
+ enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
and engine.MLB_MQB() = product.MQBMLB()
and engine.Factory() = ccunit );
if( not isnull( enginecost ) ){
+ ccrow := table.GetRow( row.Name() );
products.Add( product );
traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' ){
//鍏ュ簱閲�/鍖呰瀹归噺*鍏ュ簱鍗曚环锛屽叆搴撻噺绛変簬闀挎槬浜ч噺
@@ -56,15 +56,15 @@
traverse( owner, FinancialSalesSource, source, not source.IsImport() ){//璐㈠姟閿�閲忔姤琛ㄩ潪瀵煎叆
traverse( source, FinancialSalesReport, report, not report.IsShow() ){//璐㈠姟閿�閲忔姤琛ㄤ笉鏄剧ず
traverse( report, FinancialSalesRow, row, row.Unit() = ccunit and exists( row, FinancialSalesCell, cell, cell.Value() <> '0' ) ){//璐㈠姟閿�閲忔姤琛ㄩ噷鐨勯暱鏄ヤ骇閲�, 涓嶄负0
- ccrow := table.GetRow( row.Name() );
product := row.Product_MP();
productparents := product.GetAllParent();
if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
//鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
- enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation()
+ enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
and engine.MLB_MQB() = product.MQBMLB()
and engine.Factory() = ccunit );
if( not isnull( enginecost ) ){
+ ccrow := table.GetRow( row.Name() );
products.Add( product );
traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' ){
//鍑哄簱閲�/鍖呰瀹归噺*鍑哄簱鍗曚环锛屽叆搴撻噺绛変簬闀挎槬閿�閲�
@@ -92,20 +92,20 @@
periodname := periodtime.Format( "M2/D2/Y" );
column := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
- traverse( trip, ProductInTrip, pit, pit.Quantity() = 0 ){
- row := table.GetRow( pit.ProductID() );
+ traverse( trip, ProductInTrip, pit, pit.Quantity() <> 0 ){
product := pit.Product_MP();
productparents := product.GetAllParent();
if( exists( productparents, Elements, e, e.ID() = produtparent ) ){////鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
//鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
- enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation()
+ enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
and engine.MLB_MQB() = product.MQBMLB()
and engine.Factory() = ccunit );
//鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
transcost := selectobject( owner, LogisticsCostTransport, trans, trans.Origin() = ccline
and trans.Destination() = ccrent
- and exists( productparents, Elements, e, e.ID() = trans.Product() ) );
+ 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 ) ){
+ row := table.GetRow( pit.ProductID() );
products.Add( product );
//杩愯緭鏁伴噺/鍖呰瀹归噺/瑁呰浇瀹归噺*杩愯緭鍗曚环
quantity := ceil( ceil( [Number]pit.Quantity() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
@@ -122,21 +122,21 @@
//鏄惁灞炰簬闀挎槬澶栫搴�
isccrent := table.IsInUnit( stockingpoint, ccrent );
if( isccrent ){
- traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() ){
+ 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 ) ){
//鑾峰彇琛�
product := pisp.Product_MP();
productparents := product.GetAllParent();
- row := table.GetRow( pisp.ProductID() );
if( exists( productparents, Elements, e, e.ID() = produtparent ) ){////鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
//鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
- enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation()
+ enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
and engine.MLB_MQB() = product.MQBMLB()
and engine.Factory() = ccunit );
if( not isnull( enginecost ) ){
+ row := table.GetRow( pisp.ProductID() );
products.Add( product );
//褰損roduct planning鐨勬棩鏈熷尯闂村湪闇�瑕佺殑鏃ユ湡鍖洪棿鍐�
- traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear
- ){
+ traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.NewSupplyQuantity() <> 0 ){
periodtime := pispip.Start().StartOfMonth().Date();
periodname := periodtime.Format( "M2/D2/Y" );
quantity := ceil( [Number]pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
index bdd5f28..7df872f 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
@@ -46,17 +46,16 @@
periodname := periodtime.Format( "M2/D2/Y" );
column := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
- traverse( trip, ProductInTrip, pit, pit.Quantity() = 0 and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
+ 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();
if( isccrent ){//鐩殑鍦版槸闀挎槬澶栫搴�
//鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
- enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation()
+ enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
and engine.MLB_MQB() = product.MQBMLB()
- and engine.Factory() = ccunit
- and exists( productparents, Elements, e, e.ID() = engine.Product() ) );
+ and engine.Factory() = ccunit );
if( not isnull( enginecost ) ){
products.Add( product );
cell := selectobject( row, Cell, cell, cell.Column() = column );
@@ -71,14 +70,13 @@
}
if( isdlrent ){//鐩殑鍦版槸澶ц繛澶栫搴�
//鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
- enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation()
+ enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
and engine.MLB_MQB() = product.MQBMLB()
- and engine.Factory() = dlunit
- and exists( productparents, Elements, e, e.ID() = engine.Product() ) );
+ and engine.Factory() = dlunit );
//鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
- transcost := selectobject( owner, LogisticsCostTransport, trans, trans.Origin() = dlline
- and trans.Destination() = dlrent
- and exists( productparents, Elements, e, e.ID() = trans.Product() ) );
+ transcost := selectobject( owner, LogisticsCostTransport, 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 );
@@ -95,17 +93,16 @@
traverse( owner, FinancialProductionSource, source, not source.IsImport() ){//璐㈠姟浜ч噺鎶ヨ〃闈炲鍏�
traverse( source, FinancialProductionReport, report, not report.IsShow() ){//璐㈠姟浜ч噺鎶ヨ〃涓嶆樉绀�
traverse( report, FinancialProductionRow, row, row.Unit() = dlunit and exists( row, FinancialProductionCell, cell, cell.Value() <> '0' ) ){//璐㈠姟浜ч噺鎶ヨ〃閲岀殑澶ц繛浜ч噺, 涓嶄负0
- ccrow := table.GetRow( row.Name() );
product := row.Product_MP();
products.Add( product );
productparents := product.GetAllParent();
if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
//鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
- enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation()
+ enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
and engine.MLB_MQB() = product.MQBMLB()
- and engine.Factory() = dlunit
- and exists( productparents, Elements, e, e.ID() = engine.Product() ) );
+ and engine.Factory() = dlunit );
if( not isnull( enginecost ) ){
+ ccrow := table.GetRow( row.Name() );
traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' ){
column := selectobject( table, Column, column, column.Name() = cell.FinancialProductionColumn().Name() );
//澶ц繛澶栫搴撳叆搴撹垂鐢�
@@ -120,17 +117,16 @@
traverse( owner, FinancialSalesSource, source, not source.IsImport() ){//璐㈠姟閿�閲忔姤琛ㄩ潪瀵煎叆
traverse( source, FinancialSalesReport, report, not report.IsShow() ){//璐㈠姟閿�閲忔姤琛ㄤ笉鏄剧ず
traverse( report, FinancialSalesRow, row, row.Unit() = ccunit and exists( row, FinancialSalesCell, cell, cell.Value() <> '0' ) ){//璐㈠姟閿�閲忔姤琛ㄩ噷鐨勫ぇ杩炰骇閲�, 涓嶄负0
- ccrow := table.GetRow( row.Name() );
product := row.Product_MP();
productparents := product.GetAllParent();
if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
products.Add( product );
//鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
- enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation()
+ enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
and engine.MLB_MQB() = product.MQBMLB()
- and engine.Factory() = dlunit
- and exists( productparents, Elements, e, e.ID() = engine.Product() ) );
+ and engine.Factory() = dlunit );
if( not isnull( enginecost ) ){
+ ccrow := table.GetRow( row.Name() );
traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' ){
column := selectobject( table, Column, column, column.Name() = cell.FinancialSalesColumn().Name() );
//澶ц繛澶栫搴撳嚭搴撹垂鐢�
@@ -154,18 +150,17 @@
iscc := table.IsInUnit( destisp, ccunit );
if( isdl and iscc ){
//鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
- enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation()
+ enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
and engine.MLB_MQB() = product.MQBMLB()
- and engine.Factory() = ccunit
- and exists( productparents, Elements, e, e.ID() = engine.Product() ) );
+ and engine.Factory() = ccunit );
//鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
- transcost := selectobject( owner, LogisticsCostTransport, trans, trans.Origin() = dlline
- and trans.Destination() = dlrent
- and exists( productparents, Elements, e, e.ID() = trans.Product() ) );
+ transcost := selectobject( owner, LogisticsCostTransport, trans, trans.Origin() = tprow.SourceStockpoingPointID()
+ and trans.Destination() = tprow.TargetStockpoingPointID()
+ 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 ) ){
row := table.GetRow( product.ID() );
products.Add( product );
- traverse( tprow,TransferPlanCell, tpcell, tpcell.TransferPlanColumn().ColumnDate() <> Date::MinDate() ){
+ traverse( tprow,TransferPlanCell, tpcell, tpcell.TransferPlanColumn().ColumnDate() <> Date::MinDate() and [Number]tpcell.Value() > 0){
periodtime := tpcell.TransferPlanColumn().ColumnDate().StartOfMonth();
periodname := periodtime.Format( "M2/D2/Y" );
column := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
@@ -179,7 +174,7 @@
}
}
//闀挎槬鐭�旇繍杈撹垂鐢細瀹㈡埛闇�姹傛暟閲�/鍖呰瀹归噺/瑁呰浇瀹归噺*杩愯緭鍗曚环锛屽鎴烽渶姹傛暟閲忓彇鑷猣orecast閲宻ales segment涓洪暱鏄ョ殑鏁伴噺姹囨�伙紝鍐嶇敤鍏紡璁$畻锛屾湀搴﹁繘琛屾眹鎬伙紙鍙栧鎴烽渶姹傛暟閲忔崲绠楁垚杞︽锛�
- traverse( owner, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < startofnextyear ){
+ traverse( owner, SalesDemand.astype( Forecast ), forecast, forecast.Quantity() > 0 and not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < startofnextyear ){
salessegment := forecast.SalesSegment_MP();
parentsalessegments := salessegment.GetAllParent();
//鏄惁灞炰簬闀挎槬
@@ -188,16 +183,15 @@
product := forecast.Product_MP();
productparents := product.GetAllParent();
if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
- row := table.GetRow( forecast.ProductID() );
products.Add( forecast.Product_MP() );
//鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
- enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation()
+ enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
and engine.MLB_MQB() = product.MQBMLB()
- and engine.Factory() = ccunit
- and exists( productparents, Elements, e, e.ID() = engine.Product() ) );
+ and engine.Factory() = ccunit );
if( not isnull( enginecost ) ){
- traverse( forecast, PlanningSalesDemandInPeriod, psdip ){
+ row := table.GetRow( forecast.ProductID() );
+ traverse( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() > 0 ){
periodtime := psdip.StartDate().StartOfMonth();
periodname := periodtime.Format( "M2/D2/Y" );
// info( '-------------------------', periodname, periodtime );
@@ -220,14 +214,15 @@
//鏄惁灞炰簬澶ц繛澶栫搴�
isdlrent := stockingpoint.ID() = dlrent or unit.ID() = dlrent or exists( parentunits, Elements, punit, punit.ID() = dlrent );
if( isccrent or isdlrent ){
- traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() ){
+ 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 ) ){
//鑾峰彇琛�
product := pisp.Product_MP();
productparents := product.GetAllParent();
if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
row := table.GetRow( pisp.ProductID() );
products.Add( pisp.Product_MP() );
- traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear ){
+ traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.NewSupplyQuantity() <> 0 ){
periodtime := pispip.Start().StartOfMonth().Date();
periodname := periodtime.Format( "M2/D2/Y" );
column := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
@@ -235,20 +230,18 @@
if( isccrent ){
//鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
- enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation()
+ enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
and engine.MLB_MQB() = product.MQBMLB()
- and engine.Factory() = ccunit
- and exists( productparents, Elements, e, e.ID() = engine.Product() ) );
+ and engine.Factory() = ccunit );
if( not isnull( enginecost ) ){
cost := ceil( [Number]pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
cell.CCRentStorageCost( cell.CCRentStorageCost() + cost );
}
} else {
//鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
- enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation() = product.Generation()
+ enginecost := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
and engine.MLB_MQB() = product.MQBMLB()
- and engine.Factory() = dlunit
- and exists( productparents, Elements, e, e.ID() = engine.Product() ) );
+ and engine.Factory() = dlunit );
if( not isnull( enginecost ) ){
cost := ceil( [Number]pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
cell.DLRentStorageCost( cell.DLRentStorageCost() + cost );;
--
Gitblit v1.9.3