From f1de76007e7834e17d87712e3342efd84876c200 Mon Sep 17 00:00:00 2001 From: lihongji <3117313295@qq.com> Date: 星期六, 12 十月 2024 16:32:16 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- _Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl | 98 ++++++++++++++++++++---------------------------- 1 files changed, 41 insertions(+), 57 deletions(-) diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl index 3f5377f..572e04a 100644 --- a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl +++ b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl @@ -46,8 +46,8 @@ enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= cellcolumn.Period() and engine.EndDate() >= cellcolumn.Period() ); if( not isnull( enginecost ) ){ //鍏ュ簱閲�/鍖呰瀹归噺*鍏ュ簱鍗曚环锛屽叆搴撻噺绛変簬闀挎槬浜ч噺 - quantity := ceil( cell.Quantity() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice(); - column := selectobject( table, Column, column, column.Name() = cell.FinancialProductionColumn().Name() ); + quantity := ceil( cell.Quantity() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice(); + column := selectobject( table, Column, column, column.Name() = cell.FinancialProductionColumn().Name() ); //澶栫搴撳叆搴撹垂鐢� ccrow.SetRentEnterCost( column, quantity ); } @@ -96,34 +96,23 @@ destisp := selectobject( owner, StockingPoint_MP, sp, sp.ID() = laneleg.DestinationStockingPointID() ); isccrent := table.IsInUnit( destisp, ccrent ); if( isccspline and isccrent ){ - traverse( laneleg, Trip, trip, trip.Arrival().Date() < startofnextyear ){ - periodtime := trip.Arrival().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.Arrival().Date() and engine.EndDate() >= trip.Arrival().Date() ); - transcosts := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.StartDate() <= trip.Arrival().Date() and trans.EndDate() >= trip.Arrival().Date() ); + traverse( table, Column, column ){ + 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 ){ - traverse( trip, ProductInTrip, pit, pit.Quantity() <> 0 ){ - product := pit.Product_MP(); - productparents := product.GetAllParent(); - if( exists( productparents, Elements, e, e.ID() = produtparent ) ){////鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満 - //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺 - 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() = 'CC 鍘傚唴搴�' - and trans.Destination() = ccrent - 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();//鍥涜垗浜斿叆 - - row.SetFactoryToRentTransCost( column, quantity ); - } + 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 ){ + 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() = 'CC 鍘傚唴搴�' and trans.Destination() = ccrent 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();//鍥涜垗浜斿叆 + row.SetFactoryToRentTransCost( column, cost ); } } } @@ -131,36 +120,31 @@ } } //澶栫搴撲粨鍌ㄨ垂鐢細浠撳偍鏁伴噺/鍖呰瀹归噺*浠撳偍鍗曚环锛屽湪Actual inventories閲屽彇鍒伴暱鏄ュ绉熷簱璇ュ彂鍔ㄦ満鐨勪粨鍌ㄩ噺锛屾牴鎹彂鍔ㄦ満鍙锋壘鍒板搴旂殑Generation 鍜屾í绾靛埗锛屽湪鍙戝姩鏈烘垚鏈弬鏁拌〃閲屾壘鍒板搴旂殑浠撳偍鍗曚环鍜屽寘瑁呭閲忥紝鐢ㄥ叕寮忚绠楋紝鏈堝害杩涜姹囨�� - traverse( owner, StockingPoint_MP, stockingpoint ){ - //鏄惁灞炰簬闀挎槬澶栫搴� - isccrent := table.IsInUnit( stockingpoint, ccrent ); - if( isccrent ){ - 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 ) ){////鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満 - //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰 - 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 ); - if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){ - 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 and pispip.NewSupplyQuantity() <> 0 ){ - enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date() ); - if( not isnull( enginecost ) ){ - periodtime := pispip.Start().StartOfMonth().Date(); - periodname := periodtime.Format( "M2/D2/Y" ); - quantity := ceil( [Number]pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆 + traverse( owner, StockingPoint_MP, stockingpoint, table.IsInUnit( stockingpoint, ccrent ) ){//鏄惁灞炰簬闀挎槬澶栫搴� + traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent )//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満 + and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.PlannedInventoryLevelEnd() <> 0 ) ){ + //鑾峰彇琛� + product := pisp.Product_MP(); + //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰 + 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 ); + if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){ + row := table.GetRow( pisp.ProductID() ); + products.Add( product ); + //褰損roduct planning鐨勬棩鏈熷尯闂村湪闇�瑕佺殑鏃ユ湡鍖洪棿鍐� + // traverse( table, Column, column ){ + // pispips := selectset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.PlannedInventoryLevelEnd() <> 0 + // and pispip.Start().Date() < column.StartDate().StartOfNextMonth() and pispip.Start().Date() >= column.StartDate() ); + + traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.PlannedInventoryLevelEnd() <> 0 ){ + enginecost := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date() ); + if( not isnull( enginecost ) ){ + periodtime := pispip.Start().StartOfMonth().Date(); + periodname := periodtime.Format( "M2/D2/Y" ); + quantity := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆 - column := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime ); + column := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime ); - row.SetRentStorageCost( column, quantity ); - } - } + row.SetRentStorageCost( column, quantity ); } } } -- Gitblit v1.9.3