| | |
| | | [* |
| | | // 甄兰鸽 Jun-24-2024 (created) |
| | | owner.FinancialProductionSource( relflush ); |
| | | startinventorydate := owner.StartOfPlanning() - Duration::Days( 1 ); |
| | | productparent := MachiningPipelineReport::GetDefaultProductParent(); |
| | | source := owner.MachiningPipelineSource( relnew, Name := MachiningPipelineReport::GetDefaultName() ); |
| | | table := source.Report( relnew, ID := source.Name(), Name := source.Name() ); |
| | |
| | | products := construct( Product_MPs ); |
| | | //初始化列 |
| | | table.GenerateColumn( owner, 'All', search.StartDate(), search.EndDate() ); |
| | | endperiod := maxobject( owner, Period_MP, period, not period.IsHistorical() and period.TimeUnit() = Translations::MP_GlobalParameters_Day(), period.StartDate() ); |
| | | //endperiod := maxobject( owner, Period_MP, period, not period.IsHistorical() and period.TimeUnit() = Translations::MP_GlobalParameters_Day(), period.StartDate() ); |
| | | |
| | | //生成装配(长内库)、生产(的DL和库存数据 |
| | | traverse( owner, StockingPoint_MP, stockingpoint ){ |
| | |
| | | if( iscc or isdl ){ |
| | | traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() and not pisp.IsSystem()// and pisp.ProductID() = '06K103011CM' |
| | | and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ) |
| | | and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 or pispip.DependentDemandAndSalesDemandQuantity() <> 0 ) ) ){ |
| | | and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.DependentDemandAndSalesDemandQuantity() <> 0 ) ) ){ |
| | | isccassemnly := stockingpoint.ID().EndsWith( pisp.Product_MP().ParentID() + '线边库' ) and ( stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID().StartsWith( '长春' ) ); |
| | | isdlassemnly := stockingpoint.ID().EndsWith( pisp.Product_MP().ParentID() ) and ( stockingpoint.ID().StartsWith( 'DL' ) or stockingpoint.ID().StartsWith( '大连' ) ); |
| | | pispips := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() |
| | | and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 or pispip.DependentDemandAndSalesDemandQuantity() <> 0 ), pispip.Start() ); |
| | | and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.DependentDemandAndSalesDemandQuantity() <> 0 ), pispip.Start() ); |
| | | products.Add( pisp.Product_MP() ); |
| | | row := table.GetRow( pisp.ProductID() ); |
| | | inventoryqty := sum( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start() = startinventorydate and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and pispip.ActualInventoryLevelEnd() <> 0, pispip.ActualInventoryLevelEnd() ); |
| | | if( iscc ){ |
| | | row.CCInventoryQty( inventoryqty ); |
| | | }else{ |
| | | row.DLInventoryQty( inventoryqty ); |
| | | traverse( pispips, Elements, pispip){//, pispip.Start().Month() = 1 and pispip.Start().Day() = 2 |
| | | products.Add( pisp.Product_MP() ); |
| | | |
| | | |
| | | //天 |
| | | daycolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() ); |
| | | //周 |
| | | weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), pispip.Start().Date() ); |
| | | |
| | | row := table.GetRow( pisp.ProductID() ); |
| | | |
| | | // weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), pispip.Start().Date() ); |
| | | |
| | | if( isccassemnly or isdlassemnly ){ |
| | | //装配线 |
| | | quantity := [Number]pispip.DependentDemandAndSalesDemandQuantity();//四舍五入 |
| | | row.SetAssemblyPlanValue( daycolumn, isccassemnly, [Real]quantity ); |
| | | row.SetAssemblyPlanValue( weekcolumn, isccassemnly, [Real]quantity ); |
| | | // row.SetAssemblyPlanValue( weekcolumn, isccassemnly, [Real]quantity ); |
| | | //生产 |
| | | supplyqty := [Number]pispip.NewSupplyQuantity();//四舍五入 |
| | | // info( '****************', quantity, supplyqty ); |
| | | row.SetCellProductionValue( daycolumn, isccassemnly, [Real]supplyqty ); |
| | | row.SetCellProductionValue( weekcolumn, isccassemnly, [Real]supplyqty ); |
| | | // row.SetCellProductionValue( weekcolumn, isccassemnly, [Real]supplyqty ); |
| | | } |
| | | |
| | | //库存 |
| | | if( iscc or isdl ){ |
| | | inventoryqty := [Number]pispip.PlannedInventoryLevelEnd();//四舍五入 |
| | | row.SetCellInventoryValue( daycolumn, iscc, [Real]inventoryqty ); |
| | | if( weekcolumn.EndDate() = pispip.Start().Date() or pispip.Period_MP() = endperiod ){ |
| | | row.SetCellInventoryValue( weekcolumn, iscc, [Real]inventoryqty ); |
| | | } |
| | | // if( iscc or isdl ){ |
| | | // inventoryqty := [Number]pispip.PlannedInventoryLevelEnd();//四舍五入 |
| | | // row.SetCellInventoryValue( daycolumn, iscc, [Real]inventoryqty ); |
| | | // if( weekcolumn.EndDate() = pispip.Start().Date() or pispip.Period_MP() = endperiod ){ |
| | | // row.SetCellInventoryValue( weekcolumn, iscc, [Real]inventoryqty ); |
| | | // } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //生成调拨数据 |
| | | traverse( owner, Unit.Lane.LaneLeg, laneleg ){ |
| | | originspid := laneleg.OriginStockingPointID(); |
| | | destinationspid := laneleg.DestinationStockingPointID(); |
| | | //CC to DL 长春厂内库到大连外租库 |
| | | iscctodl := originspid.EndsWith( '厂内库' ) and ( originspid.StartsWith( '长春' ) or originspid.StartsWith( 'CC' ) ) and destinationspid = '大连外租库'; |
| | | //DL to CC 大连厂内库到大连发动机的长春外租库 |
| | | isdltocc := originspid.EndsWith( '厂内库' ) and ( originspid.StartsWith( '大连' ) or originspid.StartsWith( 'DL' ) ) and destinationspid = '大连发动机的长春外租库'; |
| | | if( iscctodl and isdltocc ){ |
| | | 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() ) |
| | | or ( trip.Departure().Date() < column.StartDate().StartOfNextMonth() and trip.Departure().Date() >= column.StartDate() ) ); |
| | | producttrips := selectuniquevalues( alltrips, Elements.ProductInTrip, pit, pit.Quantity() <> 0 and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ), pit.ProductID() ); |
| | | traverse( producttrips, Elements, producttrip ){//, producttrip = '6912' |
| | | row := table.GetRow( producttrip ); |
| | | product := selectobject( owner, Product_MP, product, product.ID() = producttrip ); |
| | | products.Add( product ); |
| | | departureqty := sum( alltrips, Elements.ProductInTrip, pit, ( pit.Trip().Departure().Date() < column.StartDate().StartOfNextMonth() and pit.Trip().Departure().Date() >= column.StartDate() ) and pit.Product_MP() = product, pit.Quantity() ); |
| | | arrivalqty := sum( alltrips, Elements.ProductInTrip, pit, ( pit.Trip().Arrival().Date() < column.StartDate().StartOfNextMonth() and pit.Trip().Arrival().Date() >= column.StartDate() ) and pit.Product_MP() = product, pit.Quantity() ); |
| | | row.SetDepartureAndArrivalValue( column, iscctodl, departureqty, arrivalqty ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //生成调拨数据 |
| | | traverse( owner, TransferPlanRow, tprow ){ |
| | | product := selectobject( owner, Product_MP, product, product.ID() = tprow.ProductID() ); |
| | |
| | | //天 |
| | | daycolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), tpcell.TransferPlanColumn().ColumnDate() ); |
| | | //周 |
| | | weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), tpcell.TransferPlanColumn().ColumnDate() ); |
| | | // weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), tpcell.TransferPlanColumn().ColumnDate() ); |
| | | quantity := [Real]tpcell.Value();//四舍五入 |
| | | if( not isnull( daycolumn ) ){ |
| | | row.SetCellTransferValue( daycolumn, ( originiscc and destiisdl ), quantity ); |
| | | } |
| | | if( not isnull( weekcolumn ) ){ |
| | | row.SetCellTransferValue( weekcolumn, ( originiscc and destiisdl ), quantity ); |
| | | } |
| | | // if( not isnull( weekcolumn ) ){ |
| | | // row.SetCellTransferValue( weekcolumn, ( originiscc and destiisdl ), quantity ); |
| | | // } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | rows := selectsortedset( table, Row, row, row.Name() ); |
| | | i := 0; |
| | | traverse( rows, Elements, e ){ |
| | | e.RowNr( i ); |
| | | i := i + 1; |
| | | } |
| | | //rows := selectsortedset( table, Row, row, row.Name() ); |
| | | //i := 0; |
| | | //traverse( rows, Elements, e ){ |
| | | // e.RowNr( i ); |
| | | // i := i + 1; |
| | | //} |
| | | showtable.Generate( search, products ); |
| | | *] |
| | | } |