Sepasoft MES Module Suite
acknowledgeMessage(batchMessage)
Acknowledges a batch message that requires operator acknowledgement after it has been shown to users. Set the acknowledging user on the BatchMessage first, then call this function to validate the active message and notify batch execution so the recipe can continue. Use it with BatchMessage instances returned from system.mes.batch.queue.getMessages().
Syntax
Python |
system.mes.batch.queue.acknowledgeMessage(batchMessage) |
Parameters
Parameter | Type | Required | Description |
|---|---|---|---|
batchMessage | BatchMessage | Required | The batch message to acknowledge. Must include a valid step path, batch identity, and ackBy value, typically set with setAckBy(userName). |
Returns
Type | Description |
|---|---|
None | Validates the acknowledgement and sends a MESSAGE_ACKNOWLEDGED notification to batch execution; no value is returned. |
Scope / Availability
Registered on the system.mes.batch.queue script module (Sepasoft Batch / MES).
Gateway: Executes on the local gateway against the running batch queue.
Designer / Client: The same API is available; execution is delegated to the connected gateway via RPC (BatchClientQueueScript proxy).
Excluded / Edge Cases
Step path required — If batchMessage has no path to a logic step, the gateway raises an Exception.
Running batch only — The manager resolves a running queue entry whose batch ID matches batchMessage.getBatchID(). If none exists, or the phase is not in a running state, an IllegalStateException is raised with a descriptive message.
Validation on the step — The controller validates that the step exists, the message is active (message date/time parameter is set), the message is not already complete, and ackBy is a non-blank string identifying the acknowledging user. Failures raise BatchMessageStepException with step context.
Equipment messages — Equipment message acknowledgement uses separate runtime validation; this script function targets standard batch user messages.
MES runtime — The MES system must be started; otherwise gateway checks fail before queue processing.
Example Usage
Minimal Example
Python |
msgs = system.mes.batch.queue.getMessages(batchQueueEntry) for m in msgs: if m.getRequiresAcknowledgement() and not m.isAcknowledged(): m.setAckBy(system.security.getUsername()) system.mes.batch.queue.acknowledgeMessage(m) break |
Complex Example
Python |
unitPath = "Enterprise\\Site\\Area\\Process Cell\\Unit" messages = system.mes.batch.queue.getMessages(unitPath) currentUser = system.security.getUsername() for msg in messages: if msg.getRequiresAcknowledgement() and not msg.isAcknowledged(): msg.setAckBy(currentUser) try: system.mes.batch.queue.acknowledgeMessage(msg) except Exception, ex: system.util.getLogger("BatchMessages").error( "Ack failed for batch %s step %s: %s" % (msg.getBatchID(), msg.getStepName(), ex) ) |
Acknowledge Message
Sets acknowledgement on Value Prompt Phase and User Message Phase.
Python |
batchID = 'batch123' bqe = system.mes.batch.queue.getEntry(batchID) msgs = system.mes.batch.queue.getMessages(bqe) for m in msgs: # P2 is a Value Prompt step if m.stepName=='P2' and m.isAcknowledged() == False: x = m.assignValue(9,'admin') system.mes.batch.queue.assignMessageValue(m) # P8 is a User Message step if m.stepName=='P8' and m.isAcknowledged() == False: m.setAckBy('admin') system.mes.batch.queue.acknowledgeMessage(m) |
Related Functions
system.mes.batch.queue.getMessages(unitFilter) — Returns messages for units matching a path/filter regex.
system.mes.batch.queue.getMessages(batchQueueEntry) — Returns messages for a specific queue entry.
system.mes.batch.queue.assignMessageValue(batchMessage) — Submits a value for messages that prompt for input instead of simple acknowledgement.
Sepasoft MES Module Suite