Result Set 15 - Production Plan

The following table lists the parameters used in a Production Plan Result Set.

Order

Field Name

Req

Values/Table Reference

0

Result Set Type

X

15

1

Pre DB

X

1 - Pre-update. Database Manager writes to database and sends to client.

0 - Post-update. Data already in database and sent to clients only.

2

TransType

X

1 - Add, 2 - Update, 3 - Delete

3

TransNum

X

0 - Coalesce: replace any null values in the result set with values for the record being updated from the Production Plan table.

1 - Comment update only

2 - Do not Coalesce: use the null values sent in with the result set to replace values of the specified record in the Production Plan table.

91 - Return the specified Child process order to Parent process order

92 - Create Child process order based on Start Time. Important: set the Misc1 value for rows with this transaction number to the appropriate Parent_PP_Setup_Id.

93 - Create Child process order before Process Order. Important: set the Misc1 value for rows with this transaction number to the appropriate Parent_PP_Setup_Id.

94 - Create Child process order after Process Order Important: set the Misc1 value for rows with this transaction number to the appropriate Parent_PP_Setup_Id.

95 - Rework process order

96 - Either bind or unbind process order based on the current value of the specified record.

97 - Process order status transition

98 - Move process order back

99 - Move process order forward

4

PathId

X

Prdexec_Paths (Path_Id)

Production_Plan (Path_Id)

Production_Plan_Status (Path_Id)

5

PPId

 

Production_Plan (PP_Id)

6

CommentId

 

Production_Plan (Comment_Id)

Comments (Comment_Id)

7

ProdId

X

Production_Plan (Prod_Id)

Products (Prod_Id)

8

ImpliedSequence

 

Production_Plan (Implied_Sequence)

9

PPStatusId

X

Production_Plan (PP_Status_Id)

Production_Plan_Statuses (PP_Status_Id)

10

PPTypeId

 

Production_Plan (PP_Type_Id)

Production_Plan_Types (PP_Type_Id)

11

SourcePPId

 

Production_Plan (Source_PP_Id)

12

UserId

X

Production_Plan (User_id)

Users (User_Id)

13

ParentPPId

 

Production_Plan (Parent_PP_Id)

14

ControlType

 

Production_Plan (Control_Type)

Control_Types (Control_Type_Id)

15

ForecastStartTime

X

Production_Plan (Forecast_Start_Date)

16

ForecastEndTime

X

Production_Plan (Forecast_End_Date)

17

EntryOn

 

Production_Plan (Entry On)

18

ForecastQuantity

X

Production_Plan (Forecast_Quantity)

19

ProductionRate

 

Production_Plan (Production_Rate)

20

AdjustedQuantity

 

Production_Plan (Adjusted_Quantity)

21

BlockNumber

 

Production_Plan (Block_Number)

22

ProcessOrder

 

Production_Plan (Process_Order)

23

TransactionTime

 

 

24

Misc1

 

Use depends on other values in the row.

If transaction number is 92, 93, or 94 the Parent_PP_Setup_Id should be placed in this value.

25

Misc2

 

Currently unused.

26

Misc3

 

Currently unused.

27

Misc4

 

Currently unused.

28

BOMFormulationId

 

Production_Plan (BOM_Formulation_ID)

See Also

Partial Example Code for Using Result Set 15

--Declare the SQL variables used

Declare

@PreDB tinyint,

@TransType int,

@TransNum int,

@PathId int,

@PPId int,

@CommentId int,

@ProdId int,

@ImpliedSequence int,

@PPStatusId int,

@PPTypeId int,

@SourcePPId int,

@UserId int,

@ParentPPId int,

@ControlType tinyint,

@ForecastStartTime datetime,

@ForecastEndTime datetime,

@EntryOn datetime,

@ForecastQuantity float,

@ProductionRate float,

@AdjustedQuantity float,

@BlockNumber varchar(50),

@ProcessOrder varchar(50),

@TransactionTime datetime,

@Misc1 varchar(50),

@Misc2 varchar(50),

@Misc3 varchar(50),

@Misc4 varchar(50)

 

--Create a temporary table to hold all variable result set rows

CREATE TABLE #ProductionPlanUpdates (

    PreDB tinyint,

    TransType int,

    TransNum int,

    PathId int,

    PPId int,

    CommentId int,

    ProdId int,

    ImpliedSequence int,

    PPStatusId int,

    PPTypeId int,

    SourcePPId int,

    UserId int,

    ParentPPId int,

    ControlType tinyint,

    ForecastStartTime datetime,

    ForecastEndTime datetime,

    EntryOn datetime,

    ForecastQuantity float,

    ProductionRate float,

    AdjustedQuantity float,

    BlockNumber varchar(50),

    ProcessOrder varchar(50),

    TransactionTime datetime,

    Misc1 varchar(50),

    Misc2 varchar(50),

    Misc3 varchar(50),

    Misc4 varchar(50))

 

--Set Result Set Variables to values retrieved in your custom code.  No

--specific custom code is being show.

Select @Var_Id = Var_Id

  from Variables where PU_Id = @PU_Id And Var_Desc Like '%Remaining%'

Select @PU_Id = @PU_Id

Select @User_Id = 0

Select @Canceled = 0

Select @Result = @Value

Select @Result_On = @Timestamp

Select @Transaction_Type = 1

Select @PostUpdate = 0

Select @PreDB =  0

Select @TransType = 1

Select @TransNum = 0

Select @PathId = @IncomingPathId

Select @PPId = @IncomingPPId

Select @ProdId = @IncomingProdId

Select @PPStatusId = PP_Status_Id from Production_Plan_Sstatuses

Where PP_Status_Desc = 'pending'

Select @PPTypeId = 1 --Scheduled

Select @SourcePPId = NULL

Select @UserId = 0

Select @ParentPPId = NULL

Select @ControlType = 1 --Duration

Select @ForecastStartTime = getdate()

Select @ForecastEndTime = dateadd(mi,15,getdate())

Select @EntryOn = getdate()

Select @ForecastQuantity = 5000

Select @ProcessOrder = '12345678'

Select @TransactionTime = getdate()

Select @Misc1 = NULL

Select @Misc2 = NULL

Select @Misc3 = NULL

Select @Misc4 = NULL

 

 

Insert into #ProductionPlanUpdates (PreDB,

    TransType,

    TransNum,

    PathId,

    PPId,

    CommentId,

    ProdId,

    ImpliedSequence,

    PPStatusId,

    PPTypeId,

    SourcePPId,

    UserId,

    ParentPPId,

    ControlType,

    ForecastStartTime,

    ForecastEndTime,

    EntryOn,

    ForecastQuantity,

    ProductionRate,

    AdjustedQuantity,

    BlockNumber,

    ProcessOrder,

    TransactionTime,

    Misc1,

    Misc2,

    Misc3,

    Misc4)

Values(@PreDB,

    @TransType,

    @TransNum,

    @PathId,

    @PPId,

    @CommentId,

    @ProdId,

    @ImpliedSequence,

    @PPStatusId,

    @PPTypeId,

    @SourcePPId,

    @UserId,

    @ParentPPId,

    @ControlType,

    @ForecastStartTime,

    @ForecastEndTime,

    @EntryOn,

    @ForecastQuantity,

    @ProductionRate,

    @AdjustedQuantity,

    @BlockNumber,

    @ProcessOrder,

    @TransactionTime,

    @Misc1,

    @Misc2,

    @Misc3,

    @Misc4)

 

-- Since the table was created in the same order as the result set

-- we can just place the 15 in front of the output of a "select *"

If (Select Count(*) From #ProductionPlanUpdates) > 0

  Select 15,* from # ProductionPlanUpdates