system.mes.batch.queue.assignMessageValue(batchMessage)

Sepasoft MES Module Suite

assignMessageValue(...)

Submits a user-entered value for a batch Value Prompt message so the configured batch parameter can be updated and execution can continue. Set the value (and operator identity) on the BatchMessage with assignValue() before calling this function. Use it with BatchMessage instances from system.mes.batch.queue.getMessages() that require value entry (they expose a parameter path for the prompt).

Syntax

Python
system.mes.batch.queue.assignMessageValue(batchMessage)

Parameters

Parameter

Type

Required

Description

batchMessage

BatchMessage

Required

The message object including a valid step path, batch identity, the entered value, and who entered it (see Excluded / Edge Cases).

Return Value

Type

Description

None

Validates the submission and sends a VALUE_ENTERED notification to batch execution; no return value.

Scope / Availability

  • Registered on the system.mes.batch.queue script module (Sepasoft Batch / MES).

  • Gateway: Runs on the local gateway against the running batch queue.

  • Designer / Client: Same API; execution is delegated to the connected gateway via RPC.

Excluded / Edge Cases

  • Step path required — If the message has no path to a logic step, the gateway raises an Exception.

  • Value required before call — If no batch parameter value was set on the message (hasValue() is false), the gateway raises an Exception before queue lookup. Additional validation may raise BatchMessageStepException if the value is missing at the step.

  • Running batch only — A running queue entry must match batchMessage.getBatchID() and the phase must be in a running state. Otherwise an IllegalStateException is raised (no matching entry / step).

  • ackBy required — validateMessageValueEntry requires a non-blank ackBy (who entered the value), typically set via assignValue(value, userName) or setAckBy(userName).

  • Step and prompt state — The step must exist, the prompt must not already be complete (PROMPT_COMPLETE), and the recipe must still expose a valid PROMPT_PARAMETER_PATH for the step.

  • Min/max — If the target parameter defines min/max, the submitted value is compared; out-of-range values cause BatchMessageStepException with the parameter path and limits.

  • MES runtime — The MES system must be started; gateway checks fail otherwise.

Example Usage

Minimal Example

Python
msgs = system.mes.batch.queue.getMessages(batchQueueEntry)
for m in msgs:
	if m.requiresValueEntry() and not m.isComplete():
		m.assignValue(100, system.security.getUsername())
		system.mes.batch.queue.assignMessageValue(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.requiresValueEntry() and not msg.isComplete():
		try:
			msg.assignValue(42.5, currentUser)
			system.mes.batch.queue.assignMessageValue(msg)
		except Exception, ex:
			system.util.getLogger("BatchMessages").error(
				"Value submit failed for batch %s step %s: %s" % (msg.getBatchID(), msg.getStepName(), ex)
			)
		break

Python
msgs = system.mes.batch.queue.getMessages(batchQueueEntry)
for m in msgs:
	if m.requiresValueEntry() and not m.isComplete():
		m.assignValue(100, system.security.getUsername())
		system.mes.batch.queue.assignMessageValue(m)
		break

Related Functions

  • system.mes.batch.queue.getMessages(unitFilter) — Lists messages for units matching a path/filter.

  • system.mes.batch.queue.getMessages(batchQueueEntry) — Lists messages for a specific queue entry.

  • system.mes.batch.queue.acknowledgeMessage(batchMessage) — Acknowledges messages that only require acknowledgement, not a typed value.


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)


Sepasoft MES Module Suite