| | |
| | | StaticMethod GenerateData ( |
| | | InterfaceDataset owner, |
| | | String werk, |
| | | const MacroPlan macroplan, |
| | | String version, |
| | | Date startdate, |
| | | Date enddate, |
| | | String executor |
| | |
| | | , ReturnMsg := 'Success' |
| | | , Success := true |
| | | ); |
| | | pir := owner.AOnlineAndMOfflinePlanPIR( relnew, ZPPPSCode := OS::GenerateGUIDAsString(), Werk := werk, Version := macroplan.ScenarioName(), StartDate := startdate, EndDate := enddate ); |
| | | pir := owner.AOnlineAndMOfflinePlanPIR( relnew, ZPPPSCode := OS::GenerateGUIDAsString(), Werk := werk, Version := version, StartDate := startdate, EndDate := enddate ); |
| | | loginfo.AOnlineAndMOfflinePlanPIR( relinsert, pir ); |
| | | traverse( macroplan, AssemblyOnlinePlanColumn, column, column.ColumnDate() >= startdate and column.ColumnDate() <= enddate ){ |
| | | traverse( column, AssemblyOnlinePlanCell, cell, ( werk = 'All' or cell.AssemblyOnlinePlanRow().ProductionLine().FindString( werk, 0 ) > -1 ) |
| | | and cell.AssemblyOnlinePlanRow().Type() = '1' ){ |
| | | quantityrow := cell.AssemblyOnlinePlanRow(); |
| | | if( not exists( productids, Elements, e, e = quantityrow.ProductID() ) ){ |
| | | productids.Add( quantityrow.ProductID() ); |
| | | } |
| | | |
| | | pir.PIRData( relnew, Product := quantityrow.ProductID() |
| | | , PlanningDate := column.ColumnDate() |
| | | , PlanningQty := [Number]cell.Value()); |
| | | } |
| | | } |
| | | |
| | | traverse( macroplan, OfflinePlanTable, table ){ |
| | | traverse( table, OfflinePlanColumn, column, column.ColumnDate() >= startdate and column.ColumnDate() <= enddate ){ |
| | | traverse( column, OfflinePlanCell, cell, ( werk = 'All' or cell.OfflinePlanRow().ProductionLine().FindString( werk, 0 ) > -1 ) |
| | | and ( cell.OfflinePlanRow().ProductionLine() <> 'DL_MOMO' or cell.OfflinePlanRow().ProductionLine() <> 'CC_MOMO' ) |
| | | and cell.OfflinePlanRow().Type() = '1' ){ |
| | | row := cell.OfflinePlanRow(); |
| | | if( not exists( productids, Elements, e, e = row.ProductID() ) ){ |
| | | productids.Add( row.ProductID() ); |
| | | traverse( owner, AssemblyOnlinePlanVersion, verison, not verison.IsShow() ){ |
| | | traverse( verison, Column, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.StartDate() >= startdate and column.StartDate() <= enddate ){ |
| | | traverse( column, Cell, cell, ( werk = 'All' or cell.Row().ProductionLine().FindString( werk, 0 ) > -1 ) |
| | | and cell.Row().Type() = '1' ){ |
| | | quantityrow := cell.Row(); |
| | | if( not exists( productids, Elements, e, e = quantityrow.ProductID() ) ){ |
| | | productids.Add( quantityrow.ProductID() ); |
| | | } |
| | | pirdata := selectobject( pir, PIRData, pirdata, pirdata.Product() = row.ProductID() and pirdata.PlanningDate() = column.ColumnDate() ); |
| | | if( isnull( pirdata ) ){ |
| | | pirdata := pir.PIRData( relnew, Product := row.ProductID() |
| | | , PlanningDate := column.ColumnDate() |
| | | , PlanningQty := 0 ); |
| | | } |
| | | pirdata.PlanningQty( pirdata.PlanningQty() + [Number]cell.Value() ); |
| | | |
| | | pir.PIRData( relnew, Product := quantityrow.ProductID() |
| | | , PlanningDate := column.StartDate() |
| | | , PlanningQty := [Number]cell.Value()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //traverse( version, OfflinePlanTable, table ){ |
| | | // traverse( table, OfflinePlanColumn, column, column.ColumnDate() >= startdate and column.ColumnDate() <= enddate ){ |
| | | // traverse( column, OfflinePlanCell, cell, ( werk = 'All' or cell.OfflinePlanRow().ProductionLine().FindString( werk, 0 ) > -1 ) |
| | | // and ( cell.OfflinePlanRow().ProductionLine() <> 'DL_MOMO' or cell.OfflinePlanRow().ProductionLine() <> 'CC_MOMO' ) |
| | | // and cell.OfflinePlanRow().Type() = '1' ){ |
| | | // row := cell.OfflinePlanRow(); |
| | | // if( not exists( productids, Elements, e, e = row.ProductID() ) ){ |
| | | // productids.Add( row.ProductID() ); |
| | | // } |
| | | // pirdata := selectobject( pir, PIRData, pirdata, pirdata.Product() = row.ProductID() and pirdata.PlanningDate() = column.ColumnDate() ); |
| | | // if( isnull( pirdata ) ){ |
| | | // pirdata := pir.PIRData( relnew, Product := row.ProductID() |
| | | // , PlanningDate := column.ColumnDate() |
| | | // , PlanningQty := 0 ); |
| | | // } |
| | | // pirdata.PlanningQty( pirdata.PlanningQty() + [Number]cell.Value() ); |
| | | // } |
| | | // } |
| | | //} |
| | | traverse( productids, Elements, e ){ |
| | | for( date := startdate.StartOfWeek(); date <= enddate; date := ( date + Duration::Days( 1 ) ).Date() ){ |
| | | if( not exists( pir, PIRData, pirdata, pirdata.Product() = e and pirdata.PlanningDate() = date ) ){ |