| | |
| | | TextBody: |
| | | [* |
| | | // 甄兰鸽 Aug-12-2024 (created) |
| | | owner.CCEngineLogisticsCostReport( relflush ); |
| | | //owner.CCEngineLogisticsCostReport( relflush ); |
| | | produtparent := CCEngineLogisticsCostReport::GetDefaultProductParent(); |
| | | name := CCEngineLogisticsCostReport::GetDefaultName(); |
| | | allunit := CCEngineLogisticsCostReport::GetDefaultAllUnit(); |
| | |
| | | //startofyear := startofplanning.StartOfYear(); |
| | | startofnextyear := startofplanning.StartOfNextYear(); |
| | | |
| | | table := owner.CCEngineLogisticsCostReport( relnew, ID := name, Name := name ); |
| | | owner.CCEngineLogisticsCostReport( relnew, ID := name + 'Show', Name := name, IsShow := true ); |
| | | owner.CCEngineLogisticsCostSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit ); |
| | | table := selectobject(owner, CCEngineLogisticsCostReport, report, report.ID() = name ); |
| | | if( isnull( table ) ){ |
| | | owner.CCEngineLogisticsCostReport( relnew, ID := name, Name := name ); |
| | | } |
| | | showname := name + 'Show'; |
| | | if( exists( owner, CCEngineLogisticsCostReport, report, report.ID() = showname and report.IsShow() ) ){ |
| | | owner.CCEngineLogisticsCostReport( relnew, ID := showname, Name := name, IsShow := true ); |
| | | } |
| | | if( isnull( owner.CCEngineLogisticsCostSearch() ) ){ |
| | | owner.CCEngineLogisticsCostSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit ); |
| | | } |
| | | |
| | | products := construct( Product_MPs ); |
| | | |
| | |
| | | if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){ |
| | | row := table.GetRow( pisp.ProductID() ); |
| | | products.Add( product ); |
| | | //当product 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( table, Column, column ){ |
| | | |
| | | 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 ); |
| | | |
| | | row.SetRentStorageCost( column, quantity ); |
| | | } |
| | | pispips := selectset( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start().Date() >= column.StartDate() |
| | | and pispip.Start().Date() < column.StartDate().StartOfNextMonth() |
| | | and pispip.PlannedInventoryLevelEnd() <> 0 ); |
| | | cost := column.CalcEngineCost( pispips, enginecosts ); |
| | | row.SetRentStorageCost( column, cost ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //rows := selectsortedset( table, Row, row, row.Name() ); |
| | | //i := 0; |
| | | //traverse( rows, Elements, e ){ |
| | | // e.RowNr( i ); |
| | | // i := i + 1; |
| | | //} |
| | | // |
| | | //showtable.Generate( search, products ); |
| | | *] |
| | | } |