¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | StaticMethod InitializeNew ( |
| | | MacroPlan owner |
| | | ) |
| | | { |
| | | Description: 'åå§å' |
| | | TextBody: |
| | | [* |
| | | // çå
°é¸½ Jun-24-2024 (created) |
| | | owner.FinancialSalesSource( relflush ); |
| | | products := construct( Product_MPs ); |
| | | allunit := FinancialSalesReport::GetDefaultAllUnit(); |
| | | ccunit := FinancialSalesReport::GetDefaultCCUnit(); |
| | | dlunit := FinancialSalesReport::GetDefaultDLUnit(); |
| | | ccsalessegment := FinancialSalesReport::GetSalesSegmentCC(); |
| | | //tjsalessegment := FinancialSalesReport::GetSalesSegmentTJ(); |
| | | //fssalessegment := FinancialSalesReport::GetSalesSegmentFS(); |
| | | //ccspline := FinancialSalesReport::GetStockingPointCCLine(); |
| | | //dlspline := FinancialSalesReport::GetStockingPointDLLine(); |
| | | //ccrent := FinancialSalesReport::GetStockingPointCCRent(); |
| | | |
| | | source := owner.FinancialSalesSource( relnew, IsImport := false, Name := FinancialSalesReport::GetDefaultName() ); |
| | | table := source.FinancialSalesReport( relnew, ID := source.Name(), Name := source.Name(), IsImport := false ); |
| | | showtable := source.FinancialSalesReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsImport := false, IsShow := true ); |
| | | startofplanning := owner.StartOfPlanning().Date(); |
| | | //startofyear := startofplanning.StartOfYear(); |
| | | startofnextyear := startofplanning.StartOfNextYear(); |
| | | |
| | | search := owner.FinancialSalesSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit ); |
| | | |
| | | table.GenerateColumn( owner ); |
| | | |
| | | //é¦å
å¨forecastç颿¥æ¾sales segmentä¸ºé¿æ¥çææéæ±ï¼è¯å«åºMLBçææäº§åï¼æ¯ä¸ªäº§åæææ±æ»éæ±æ°é |
| | | traverse( owner, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < startofnextyear and forecast.Quantity() <> 0 |
| | | and exists( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() <> 0 ) ){ |
| | | salessegment := forecast.SalesSegment_MP(); |
| | | parentsalessegments := salessegment.GetAllParent(); |
| | | stockingpoint := forecast.StockingPointID(); |
| | | product := forecast.Product_MP(); |
| | | //æ¯å¦å±äºé¿æ¥ |
| | | iscc := salessegment.Name().StartsWith( ccsalessegment ) or exists( parentsalessegments, Elements, psalessegment, psalessegment.Name().StartsWith( ccsalessegment ) ); |
| | | isccrent := iscc and stockingpoint.EndsWith( 'å¤ç§åº' ) and ( stockingpoint.StartsWith( 'CC' ) or stockingpoint.StartsWith( 'é¿æ¥' ) ); |
| | | //ForecastçSales Segmentä¸ºé¿æ¥ï¼è¯å«åºMLBçææäº§åæ±æ» |
| | | //大è¿è´¢å¡ééï¼é¦å
å¨forecastç颿¥æ¾Sales Segmentæ¯å¤©æ´¥åä½å±±çææéæ±ï¼æ¯ä¸ªäº§åæææ±æ»éæ±æ°é and forecast.Product_MP().MQBMLB() = 'MLB' ) |
| | | if( ( iscc and product.MQBMLB() = 'MLB' ) or ( isccrent and product.MQBMLB() = 'MQB' ) ){ |
| | | |
| | | //è·ååè®¡è¡ |
| | | allrow := table.GetRow( allunit, product ); |
| | | //è·åå·¥åè¡ |
| | | factoryrow := table.GetRow( ccunit, product ); |
| | | |
| | | products.Add( product ); |
| | | traverse( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() <> 0 ){ |
| | | dayperiodtime := psdip.StartDate(); |
| | | dayperiodname := dayperiodtime.Format( "M2/D2/Y" ); |
| | | periodtime := psdip.StartDate().StartOfMonth(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | // info( '-------------------------', periodname, periodtime ); |
| | | daycolumn := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime and column.IsDay() ); |
| | | column := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime and not column.IsDay() ); |
| | | // info( '-------------------------', column.Name() ); |
| | | quantity := [Number]psdip.Quantity();//åèäºå
¥ |
| | | |
| | | factoryrow.Initialize( column, quantity ); |
| | | factoryrow.Initialize( daycolumn, quantity ); |
| | | allrow.Initialize( column, quantity ); |
| | | } |
| | | } |
| | | } |
| | | //ä»Product planningæ¥æ¾åºåç¹ä¸ºå¤§è¿å卿ºçé¿æ¥å¤ç§åºï¼åNew supplyåæ®µæææ±æ»éæ±æ°é |
| | | traverse( owner, StockingPoint_MP, stockingpoint, stockingpoint.ID() = '大è¿å卿ºçé¿æ¥å¤ç§åº' ){ |
| | | 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.DependentDemandAndSalesDemandQuantity() <> 0 or pispip.NewSupplyQuantity() <> 0 ) ) ){//产å为MQB |
| | | product := pisp.Product_MP(); |
| | | allrow := table.GetRow( allunit, product ); |
| | | factoryrow := table.GetRow( dlunit, product ); |
| | | products.Add( product ); |
| | | traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() |
| | | and pispip.Period_MP().StartDate() < startofnextyear |
| | | and ( pispip.DependentDemandAndSalesDemandQuantity() <> 0 or pispip.NewSupplyQuantity() <> 0 ) ){ |
| | | dayperiodtime := pispip.Start().Date(); |
| | | dayperiodname := dayperiodtime.Format( "M2/D2/Y" ); |
| | | periodtime := pispip.Start().StartOfMonth().Date(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | daycolumn := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime and column.IsDay() ); |
| | | column := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime and not column.IsDay() ); |
| | | quantity := [Number]pispip.NewSupplyQuantity();//åèäºå
¥ |
| | | |
| | | factoryrow.Initialize( column, quantity );//åTotal Demandåæ®µæææ±æ»éæ±æ°é |
| | | factoryrow.Initialize( daycolumn, quantity ); |
| | | allrow.Initialize( column, quantity ); |
| | | } |
| | | } |
| | | // } |
| | | } |
| | | //startofnextyearlead := startofplanning.StartOfNextYear() + FinancialSalesReport::GetDefaultTripLeadingTime(); |
| | | //大è¿è´¢å¡ééï¼é¿æ¥çéæ±éè¦å¨trip plané颿¾å°èµ·å§åºåç¹ä¸ºå¤§è¿è£
é
线边åºï¼ç®çå°ä¸ºé¿æ¥å¤ç§åºç产åï¼ç±äºéè¦èè产åè¿è¾lead timeï¼æ¯ä¸ªæçæ±æ»æ°æ®éè¦æ¨è¿ä¸¤å¤©è¿è¡è®¡ç® |
| | | //traverse( owner, Unit.Lane.LaneLeg, laneleg ){ |
| | | // //èµ·å§åºåç¹æ¯å¦æ¯å¤§è¿è£
é
çº¿è¾¹åº |
| | | // originsp := selectobject( owner, StockingPoint_MP, sp, sp.ID() = laneleg.OriginStockingPointID() ); |
| | | // isdlspline := table.IsInUnit( originsp, dlspline ); |
| | | // //ç®çå°æ¯å¦æ¯é¿æ¥å¤ç§åº |
| | | // destisp := selectobject( owner, StockingPoint_MP, sp, sp.ID() = laneleg.DestinationStockingPointID() ); |
| | | // isccrent := table.IsInUnit( destisp, ccrent ); |
| | | // if( isdlspline and isccrent ){ |
| | | // traverse( laneleg, Trip, trip, trip.Arrival() < startofnextyearlead and exists( trip, ProductInTrip, pit, pit.Quantity() <> 0 ) ){ |
| | | //// periodtime := ( trip.Arrival() - FinancialSalesReport::GetDefaultTripLeadingTime() ).StartOfMonth().Date(); |
| | | // dayperiodtime := trip.Departure().Date(); |
| | | // dayperiodname := dayperiodtime.Format( "M2/D2/Y" ); |
| | | // periodtime := trip.Departure().StartOfMonth().Date(); |
| | | // periodname := periodtime.Format( "M2/D2/Y" ); |
| | | // |
| | | // daycolumn := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime and column.IsDay() ); |
| | | // column := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime and not column.IsDay() ); |
| | | // if( not isnull( column ) ){ |
| | | // traverse( trip, ProductInTrip, pit, pit.Quantity() <> 0 ){ |
| | | // product := pit.Product_MP(); |
| | | // products.Add( product ); |
| | | // quantity := [Number]pit.Quantity();//åèäºå
¥ |
| | | // dlrow := table.GetRow( dlunit, pit.Product_MP() ); |
| | | // dlrow.Initialize( column, quantity );//æ±æ»æ°é |
| | | // dlrow.Initialize( daycolumn, quantity ); |
| | | // |
| | | // allrow := table.GetRow( allunit, pit.Product_MP() ); |
| | | // allrow.Initialize( column, quantity ); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | //} |
| | | |
| | | rows := selectsortedset( table, FinancialSalesRow, row, row.Name() ); |
| | | i := 0; |
| | | traverse( rows, Elements, e ){ |
| | | e.RowNr( i ); |
| | | i := i + 1; |
| | | } |
| | | showtable.Generate( search, products ); |
| | | *] |
| | | } |