Pause According to the Current Time

Set up a pause task to temporarily stop an orchestration process from running according to the time on the system clock.

If the current time is.

  • Before 1:10:10 PM. Pause all fulfillment lines until 1:10:10 PM of the current day, then release them.

  • On or after 1:10:10 PM. Pause all fulfillment lines until 1:10:10 PM of the next day, then release them.

Here's the rule.

Assume you must pause all lines according to the current time.

Note

Code

Description

Header is a DOOSeededOrchestrationRules.DOOHeader

Declare the Header variable, then store attributes of the order header that the orchestration process is currently processing into this variable.

currentdate is a DOOSeededOrchestrationRules.Timestamp

Declare the currentdate variable, then store the current time stamp from the Oracle server into this variable.

Assign new DooSeededOrchestrationRules.SacResult SAC = new DooSeededOrchestrationRules.SacResult()

Create a new variable named SAC and set it to the SacResult type in the DooSeededOrchestrationRules method.

Assign Header.sacResult = SAC

Set the value of the sacResult object on the order header to the value that SAC contains.

Assign Header.sacResult.sacType = DooSeededOrchestrationRules.SacResult.SAC_TYPE_TIMER

Specify the type of pause as a timer.

Assign new DooSeededOrchestrationRules.Timestamp cdate = Header.current_date

Declare the cdate variable and set its value to the current system time stamp of the Oracle server.

Assign cdate.hours = 13

Set the hours of the cdate variable to 1PM in the time zone of the Oracle server.

Note that the rule uses a 24 hour clock.

Assign cdate.minutes = 10

Set the minutes of the cdate variable to 10.

Assign cdate.seconds = 10

Set the seconds of the cdate variable to 10.

cdate now contains 13:10:10.

Assign Header.sacResult.waitDateTime = cdate

Store the value of the cdate variable in the waitDateTime parameter of the sacResult object on the order header.

If cdate.before(currentdate) is true

If the value in the cdate attribute happens before the value of the currentdate attribute.

Assign cdate = Header.getAdjustedDate(cdate,1)

set the value of cdate to cdate plus 1 day.

The getAdjustedDate function adds the value of the second parameter as the number of days to the first parameter, which is cdate.

Assign Header.sacResult.waitDateTime = cdate

Store the value of the cdate variable in the waitDateTime parameter of the sacResult object on the order header.

Let's consider an example. Assume the current time is 12:00:00, noon.

Code

Example Value

currentdate is a DOOSeededOrchestrationRules.Timestamp

Timestamp equals 12:00:00, using format HH:MM:SS on a 24 hour clock.

currentdate equals 12:00:00.

Assign new DooSeededOrchestrationRules.Timestamp cdate = Header.current_date

cdate equals 12:00:00.

Assign cdate.hours = 13

cdate equals 13:00:00.

Assign cdate.minutes = 10

cdate equals 13:10:00.

Assign cdate.seconds = 10

cdate equals 13:10:10.

Assign Header.sacResult.waitDateTime = cdate

waitDateTime equals 13:10:10.

If cdate.before(currentdate) is true

cdate contains 13:10:10 and currentdate contains 12:00:00, so the condition evaluates to false.

The rule doesn't proceed to the Then clause of this If statement. Instead, the rule pauses all fulfillment lines until 13:10:10 PM of the current day, then releases them.

Assume the current time is 14:00:00, or 2 PM.

Code

Example Value

currentdate is a DOOSeededOrchestrationRules.Timestamp

Timestamp equals 14:00:00, using format HH:MM:SS on a 24 hour clock.

currentdate equals 14:00:00.

Assign new DooSeededOrchestrationRules.Timestamp cdate = Header.current_date

cdate equals 14:00:00.

Assign cdate.hours = 13

cdate equals 13:00:00.

Assign cdate.minutes = 10

cdate equals 13:10:00.

Assign cdate.seconds = 10

cdate equals 13:10:10.

Assign Header.sacResult.waitDateTime = cdate

waitDateTime equals 13:10:10.

If cdate.before(currentdate) is true

cdate contains 13:10:10 and currentdate contains 14:00:00, so the condition evaluates to True.

The rule proceeds to the Then clause of this If statement.

Assign cdate = Header.getAdjustedDate(cdate,1)

cdate equals 13:10:10 plus 1 day.

Assign Header.sacResult.waitDateTime = cdate

waitDateTime equals 13:10:10 plus 1 day.

The rule pauses all fulfillment lines until 13:10:10 PM of the next day, then releases them.