Documents > BPS V2 C++ API
BpsRobot Class Reference

Pick robot interface. More...

#include <bpsrobot.h>

List of all members.

Public Types

enum  OrderSyncMode {
  SyncAll = 0,
  SyncNew = 1,
  SyncUpdate = 2
}
 Order items synchronize modes. More...
enum  OrderType {
  Trips = 0,
  Rows = 1,
  Columns = 2,
  Items = 3
}
 Type of the key/keys to process. More...

Signals

void hideProgress ()
 Emitted after the operation is completed (or failed or was aborted).
void itemRejected (const QVariant &aKey)
 Emitted when a item was rejected by robot or because of data constraints.
void itemSynced (const QVariant &aKey)
 Emitted when a item was successfully synced, e.g.
void showProgress (int aMaximum, const QString &aLabel)
 Emitted at start of operation to begin showing the progress indicator.
void updateProgressLabel (const QString &aLabel)
 Emitted to update the progress label text.
void updateProgressMaximum (int aMaximum)
 Emitted to change the highest tick value.
void updateProgressValue (int aValue)
 Emitted when progress reaches next value to update the progress indicator.

Public Member Functions

 BpsRobot (BpsDatastore *aDatastore, const QVariant &aZone, QObject *aParent=0)
BpsDatastoredatastore () const
QVariantMap getOrdertripRobot (const QVariant &aOrdertrip) const
 Get the robot status record for order trip.
bool lockRobot (int aTimeout, volatile bool *aCancelFlag=0)
 Lock the zone for exclusive robot access.
virtual void revokeOrders (OrderType aOrderType, const QVariantList &aKeys, volatile bool *aCancelFlag=0)=0
 Revoke orders from the robot.
virtual void syncOrders (OrderType aOrderType, const QVariantList &aKeys, OrderSyncMode aSyncMode, volatile bool *aCancelFlag=0)=0
 Synchronize orders to the robot.
virtual void syncStock (volatile bool *aCancelFlag=0)=0
 Import all robot stocks into the BPS stock.
void unlockRobot ()
 Unlock the zone, in case it was locked by the current actor.
BpsOrderUtilsutils () const
QVariant zone () const
QString zoneName () const
virtual ~BpsRobot ()
 Virtual default destructor.

Detailed Description

Pick robot interface.


Member Enumeration Documentation

Order items synchronize modes.

Basic condition for all sync operations is that the order trip status must be active.

Enumerator:
SyncAll 

Sync unsent and changed items if robot trip status is unsent, sent or active.

SyncNew 

Sync unsent items if robot trip status is sent or active and t_trips.c_robotupdt is fullfilled.

SyncUpdate 

Sync unsent and changed items if robot trip status is sent or active.

Type of the key/keys to process.

Enumerator:
Trips 

A list of keys of t_ordertrips.

Rows 

A list of keys of t_orderrows.

Columns 

A list of keys of t_ordercols.

Items 

A list of keys of t_orderitems.


Constructor & Destructor Documentation

BpsRobot::BpsRobot ( BpsDatastore aDatastore,
const QVariant &  aZone,
QObject *  aParent = 0 
)
Parameters:
[in]aDatastoreThe datastore to use.
[in]aZoneThe key of the zone to handle by this robot.
[in]aParentThe parent object.

Member Function Documentation

BpsDatastore* BpsRobot::datastore ( ) const
Returns:
The datastore object.
QVariantMap BpsRobot::getOrdertripRobot ( const QVariant &  aOrdertrip) const

Get the robot status record for order trip.

In case no record yet exists, a new one is created with status "unsent".

Parameters:
[in]aOrdertripKey of the order trip.
Exceptions:
BpsExceptionThrown on database errors.
void BpsRobot::hideProgress ( ) [signal]

Emitted after the operation is completed (or failed or was aborted).

The progress indicator should get hidden.

void BpsRobot::itemRejected ( const QVariant &  aKey) [signal]

Emitted when a item was rejected by robot or because of data constraints.

Parameters:
[in]aKeyKey of the order item.
void BpsRobot::itemSynced ( const QVariant &  aKey) [signal]

Emitted when a item was successfully synced, e.g.

accepted by robot.

Parameters:
[in]aKeyKey of the order item.
bool BpsRobot::lockRobot ( int  aTimeout,
volatile bool *  aCancelFlag = 0 
)

Lock the zone for exclusive robot access.

Parameters:
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
[in]aCancelFlagIt the cancel flag becomes false during operation, lockRobot will stop and throw a BpsException.
Returns:
True if the lock was successful, false if not (timed out).
virtual void BpsRobot::revokeOrders ( OrderType  aOrderType,
const QVariantList &  aKeys,
volatile bool *  aCancelFlag = 0 
) [pure virtual]

Revoke orders from the robot.

The method tries to revoke as many items as possible as long as no fatal error or cancel happens, and only throws an exception about the robot unable to revoke certain items at the end.

  • When revoking of an item succeeds, the robot status of the item is deleted.
  • When revoking of any items is rejected or aborted, the robot status of the affected items remain unchanged.

In case of aborting (cancel or fatal error) in a critical communication phase, the status BPS knows about the robot may be inaccurate and have to be cleared manually by the user. The message of the thrown exception will in such a case include information about that fact.

Parameters:
[in]aOrderTypeType of the records addressed by aKeys.
[in]aKeysList of keys to process.
[in]aCancelFlagIf the cancel flag becomes false during operation, revokeOrders will stop and throw a BpsException.
Exceptions:
BpsExceptionThrown when revoking the trip failed or was aborted.
void BpsRobot::showProgress ( int  aMaximum,
const QString &  aLabel 
) [signal]

Emitted at start of operation to begin showing the progress indicator.

The indicator should have value ticks from 0 to aMaximum, and be set initially to 0.

Parameters:
[in]aMaximumHighest tick value, usually the number of processed items.
[in]aLabelLabel to display in the progress indicator. Use QString() to display no label.
virtual void BpsRobot::syncOrders ( OrderType  aOrderType,
const QVariantList &  aKeys,
OrderSyncMode  aSyncMode,
volatile bool *  aCancelFlag = 0 
) [pure virtual]

Synchronize orders to the robot.

The method tries to synchronize as many items as possible as long as no fatal error or abort happens, and only throws an exception about rejects at the end.

  • When sending of a yet unsent order item is rejected, the order item remains unchanged.
  • When sending updates for a item is rejected, the item is reverted to the known robot status.
  • When sending is aborted, fails fatal or items are locked, the order items remain unchanged.

In case of aborting (cancel or fatal error) in a critical communication phase, the status BPS knows about the robot may be inaccurate and have to be cleared manually by the user. The message of the thrown exception will in such a case include information about that fact.

Parameters:
[in]aOrderTypeType of the records addressed by aKeys.
[in]aKeysList of keys to process.
[in]aSyncModeSynchronizing mode.
[in]aCancelFlagIf the cancel flag becomes false during operation, syncOrders will stop and throw a BpsException.
Exceptions:
BpsExceptionThrown when sending the trip failed or was aborted.
virtual void BpsRobot::syncStock ( volatile bool *  aCancelFlag = 0) [pure virtual]

Import all robot stocks into the BPS stock.

Parameters:
[in]aCancelFlagIt the cancel flag becomes false during operation, syncStock will stop and throw a BpsException.
Exceptions:
BpsExceptionThrown when querying the stock levels failed or was aborted.
void BpsRobot::unlockRobot ( )

Unlock the zone, in case it was locked by the current actor.

Equivalent to utils()->unlockRobot(zone()).

Exceptions:
BpsExceptionthrown on SQL errors.
void BpsRobot::updateProgressLabel ( const QString &  aLabel) [signal]

Emitted to update the progress label text.

Parameters:
[in]aLabelNew label text to display in the progress indicator.
void BpsRobot::updateProgressMaximum ( int  aMaximum) [signal]

Emitted to change the highest tick value.

Parameters:
[in]aMaximumHighest tick value, usually the number of processed items.
void BpsRobot::updateProgressValue ( int  aValue) [signal]

Emitted when progress reaches next value to update the progress indicator.

Parameters:
[in]aValueThe value tick reached in the range 1...aMaximum, see showProgress().
BpsOrderUtils* BpsRobot::utils ( ) const
Returns:
Order utility object.
QVariant BpsRobot::zone ( ) const
Returns:
The zone handled by this robot.
QString BpsRobot::zoneName ( ) const
Returns:
The zone name.

The documentation for this class was generated from the following file: