| | |
| | | TextBody: |
| | | [* |
| | | // 甄兰鸽 Aug-12-2024 (created) |
| | | owner.DLEngineLogisticsCostReport( relflush ); |
| | | //owner.DLEngineLogisticsCostReport( relflush ); |
| | | produtparent := DLEngineLogisticsCostReport::GetDefaultProductParent(); |
| | | name := DLEngineLogisticsCostReport::GetDefaultName(); |
| | | allunit := DLEngineLogisticsCostReport::GetDefaultAllUnit(); |
| | |
| | | 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 ); |
| | | |
| | |
| | | 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 ) ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | // } |
| | | // } |
| | | //} |
| | | 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 ) ); |
| | | } |
| | | } |
| | | } |