Process Order Quantity

By default, Process Orders quantities are calculated by the Schedule Manager service using the Production_Plan_Starts table. Using the start and end times for each unit the process order was run on, the Schedule Manager will summarize the relevant production data for all units in the Execution Path where the Production Point has been set to True. The type of production data summarized depends on the Production Metrics properties for each unit.

The Production Metrics settings are as follows:

The selection is stored in the Prod_Units table in the Production_Type field. The functionality of the two options is as follows:

Option Production_Type Value Description
Production is Accumulated From Event Dimensions 0, NULL Summarizes all the Event_Details.Initial_Dimension_X fields for units where the Execution Path Production Point has been set to True and the time stamp of the event falls within the start and end time of the Production_Plan_Starts record. In addition, Schedule Manager also includes all events where the PP_Id is filled out in the Event_Details table.
Production is Accumulated From a Variable 1 For all units where the Execution Path Production Point has been set to True, summarizes all the result values for the defined Variable where the result time stamp falls within the start and end time of the Production_Plan_Starts record. The variable is stored in the Production_Variable field.

For accumulating quantity from the event details the query would be as follows:


SELECT	pp.Process_Order, 
        SUM(ed.Initial_Dimension_X)
FROM Production_Plan_Starts pps
        JOIN Production_Plan pp ON	pps.PP_Id = pp.PP_Id 
                JOIN dbo.Prod_Units pu ON pps.PU_Id = pu.PU_Id
                                          AND (	Production_Type IS NULL 
                                          OR Production_Type = 0)
                        JOIN dbo.Prdexec_Path_Units ppu ON ppu.PU_Id = pu.PU_Id
                                                    AND	          ppu.Is_Production_Point = 1                                  JOIN dbo.Events e ON	e.PU_Id = ppu.PU_Id
                                                        AND e.TimeStamp >= pps.Start_Time 
                                                        AND (	e.TimeStamp < pps.End_Time
                                                                OR pps.End_Time IS NULL) 
                                 JOIN dbo.Event_Details ed ON e.Event_Id = ed.Event_Id
WHERE	pps.PP_Id @@PPId 
GROUP BY pps.PP_Id

If the PP_Id is filled out in the Event_Details table, the Schedule Manager will exclude it from it is standard query using the Production_Plan_Starts timestamps. However, if the event is on a unit that is a production point in the path and that unit has been active (for example, it has at least one record in the Production_Plan_Starts table), it will be include it in the quantity total regardless of the timestamps. The functionality is primarily for allocating production events to different patterns associated with a process order.

For accumulating quantity from a variable the query would be as follows:


SELECT	pp.Process_Order, 
        SUM(isnull(convert(real, t.Result), 0))
FROM dbo.Production_Plan_Starts pps
     JOIN dbo.Production_Plan pp ON pps.PP_Id = pp.PP_Id 
     JOIN dbo.Prod_Units pu ON pps.PU_Id = pu.PU_Id
                               AND Production_Type = 1
JOIN dbo.Prdexec_Path_Units ppu ON ppu.PU_Id = pu.PU_Id
                            AND	ppu.Is_Production_Point = 1 
JOIN dbo.Tests t ON	t.Var_Id = pu.Production_Variable
                        AND t.Result_On >= pps.Start_Time 
                        AND (	t.Result_On < pps.End_Time 
                        OR pps.End_Time IS NULL)
WHERE pps.PP_Id = 1
GROUP BY	pp.Process_Order