BPS C++ API  2.24.4
BpsRobot Class Reference

Pick robot interface. More...

#include <bpsrobot.h>

+ Inheritance diagram for BpsRobot:

Public Types

enum  Feature {
  CanLoadTrip , CanSyncTrips , CanSyncRows , CanSyncCols , CanSyncItems , CanSyncChanged , CanRevokeTrips , CanRevokeRows , CanRevokeCols , CanRevokeItems ,
  CanFinishTrips , CanFinishRows , CanFinishCols , CanFinishItems , CanHandleSubjobs , CanSyncStock
}
 Feature identifiers. More...
 
enum  OrderSyncMode { SyncInvalid = 0 , SyncAll = 1 , SyncNew = 2 , SyncUpdate = 3 }
 Order items synchronize modes. More...
 
enum  OrderType { TypeInvalid = 0 , TypeTrips = 1 , TypeRows = 2 , TypeCols = 3 , TypeItems = 4 }
 Type of the key/keys to process. More...
 

Signals

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

Public Member Functions

 BpsRobot (BpsDatastore *aDatastore, const QVariant &aZone, QObject *aParent=0)
 
virtual void control (int aOp, const QVariantMap &aInput, QVariantMap &aOutput, volatile bool *aCancelFlag=nullptr)
 Execute robot specific operations. More...
 
BpsDatastoredatastore () const
 
virtual void finishOrders (OrderType aOrderType, const QVariantList &aKeys, volatile bool *aCancelFlag=nullptr)
 Finish order processing. More...
 
QVariantMap getOrdertripRobot (const QVariant &aOrdertrip) const
 Get the robot status record for order trip. More...
 
virtual bool hasFeature (Feature aFeature)
 Query information about available features. More...
 
bool isLocked ()
 Check if robot is locked. More...
 
virtual void loadOrdertrip (const QVariant &aOrdertripKey, volatile bool *aCancelFlag=nullptr)
 Load order trip into robot. More...
 
bool lock (int aTimeout, volatile bool *aCancelFlag=nullptr)
 Lock the zone for exclusive robot access. More...
 
QString pickMode () const
 Get the picking mode of this robots zone (robot.mifa, robot.geko, robot.tako, robot.osiris, ...) More...
 
virtual void revokeOrders (OrderType aOrderType, const QVariantList &aKeys, volatile bool *aCancelFlag=nullptr)
 Revoke orders from the robot. More...
 
virtual void sendSubjobLu (const QVariant &aOrdertrip, const QVariant &aLuid, volatile bool *aCancelFlag=nullptr)
 Send back a subjob after a LU got finalized. More...
 
void showProgressMessage (const QString &aMessage)
 Emit signals to show a progress message with undefined running length. More...
 
virtual QString subjobItemCondition (const QString &aPrefix=QString())
 Get the orderitem selecting condition for subjobs created by this robot. More...
 
virtual void syncOrders (OrderType aOrderType, const QVariantList &aKeys, OrderSyncMode aSyncMode, volatile bool *aCancelFlag=nullptr)
 Synchronize orders to the robot. More...
 
virtual void syncStock (volatile bool *aCancelFlag=nullptr)
 Import all robot stocks into the BPS stock. More...
 
void unlock ()
 Unlock the zone, in case it was locked by the current actor. More...
 
QVariant zone () const
 
QString zoneName () const
 
virtual ~BpsRobot ()
 Virtual default destructor.
 
- Public Member Functions inherited from QObject
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
 QObject (QObject *parent)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Pick robot interface.

Member Enumeration Documentation

◆ Feature

Feature identifiers.

Enumerator
CanLoadTrip 

Supports loading an order trip with loadOrdertrip().

CanSyncTrips 

Supports syncing order trips with syncOrders().

CanSyncRows 

Supports syncing order rows with syncOrders().

CanSyncCols 

Supports syncing order cols with syncOrders().

CanSyncItems 

Supports syncing order items with syncOrders().

CanSyncChanged 

Supports syncing of changed items.

CanRevokeTrips 

Supports revoking order trips with syncOrders().

CanRevokeRows 

Supports revoking order rows with syncOrders().

CanRevokeCols 

Supports revoking order cols with syncOrders().

CanRevokeItems 

Supports revoking order items with syncOrders().

CanFinishTrips 

Supports finishing order trips with syncOrders().

CanFinishRows 

Supports finishing order rows with syncOrders().

CanFinishCols 

Supports finishing order cols with syncOrders().

CanFinishItems 

Supports finishing order items with syncOrders().

CanHandleSubjobs 

The robot may send create subjobs for manual picking and receive back the finalized lu's.

CanSyncStock 

Supports syncStock().

◆ OrderSyncMode

Order items synchronize modes.

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

Enumerator
SyncInvalid 

Invalid sync mode.

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.

◆ OrderType

Type of the key/keys to process.

Enumerator
TypeInvalid 

Invalid key type.

TypeTrips 

A list of keys of t_ordertrips.

TypeRows 

A list of keys of t_orderrows.

TypeCols 

A list of keys of t_ordercols.

TypeItems 

A list of keys of t_orderitems.

Constructor & Destructor Documentation

◆ BpsRobot()

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

Member Function Documentation

◆ control()

virtual void BpsRobot::control ( int  aOp,
const QVariantMap &  aInput,
QVariantMap &  aOutput,
volatile bool *  aCancelFlag = nullptr 
)
virtual

Execute robot specific operations.

See documentation of the respective robot interface for details. The default implementation does nothing.

Parameters
aOpOperation command.
aInputInput data.
aOutputOutput data.
aCancelFlagIf the cancel flag becomes false during operation, the operation will stop and throw a BpsException.
Exceptions
BpsExceptionon errors or when operation is canceled.

◆ datastore()

BpsDatastore* BpsRobot::datastore ( ) const
Returns
The datastore object.

◆ finishOrders()

virtual void BpsRobot::finishOrders ( OrderType  aOrderType,
const QVariantList &  aKeys,
volatile bool *  aCancelFlag = nullptr 
)
virtual

Finish order processing.

Depending on the implementation the robot can continue picking until all pending jobs are completed.

In case of aOrderType==Trips, the order trip robot status shall either be finished ('f') after successful command transmission to the robot, or the robot shall update the status after completion later in case it has an asynchronous interface (for example a regular executed batch receiving data from robot).

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.

The default implementation does nothing.

Parameters
aOrderTypeType of the records addressed by aKeys.
aKeysList of keys to process. Only keys belonging to a single trip are included.
aCancelFlagIf the cancel flag becomes false during operation, revokeOrders will stop and throw a BpsException.
Exceptions
BpsExceptionThrown when finishing failed or was aborted.

◆ getOrdertripRobot()

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
aOrdertripKey of the order trip.
Exceptions
BpsExceptionThrown on database errors.

◆ hasFeature()

virtual bool BpsRobot::hasFeature ( Feature  aFeature)
virtual

Query information about available features.

The default implementation returns false for any feature. Overload this method to return true in case.

Parameters
aFeatureThe feature to check.
Returns
True if robot has the feature.

◆ hideProgress

void BpsRobot::hideProgress ( )
signal

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

The progress indicator should get hidden.

◆ isLocked()

bool BpsRobot::isLocked ( )

Check if robot is locked.

Returns
True if the robot is locked, false if not.

◆ itemRejected

void BpsRobot::itemRejected ( const QVariant aKey)
signal

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

Parameters
aKeyKey of the order item.

◆ itemSynced

void BpsRobot::itemSynced ( const QVariant aKey)
signal

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

accepted by robot.

Parameters
aKeyKey of the order item.

◆ loadOrdertrip()

virtual void BpsRobot::loadOrdertrip ( const QVariant aOrdertripKey,
volatile bool *  aCancelFlag = nullptr 
)
virtual

Load order trip into robot.

In case the order trip was already loaded before nothing happens. On success the method sets the order trip status to active.

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.

The default implementation does nothing.

Parameters
aOrdertripKeyKey of the order trip to load.
aCancelFlagIt the cancel flag becomes false during operation, lockRobot will stop and throw a BpsException.
Exceptions
BpsExceptionThrown when loading the order trip failed or was aborted.

◆ lock()

bool BpsRobot::lock ( int  aTimeout,
volatile bool *  aCancelFlag = nullptr 
)

Lock the zone for exclusive robot access.

Parameters
aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
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).

◆ pickMode()

QString BpsRobot::pickMode ( ) const

Get the picking mode of this robots zone (robot.mifa, robot.geko, robot.tako, robot.osiris, ...)

Returns
The picking mode.

◆ revokeOrders()

virtual void BpsRobot::revokeOrders ( OrderType  aOrderType,
const QVariantList &  aKeys,
volatile bool *  aCancelFlag = nullptr 
)
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.

The default implementation does nothing.

Parameters
aOrderTypeType of the records addressed by aKeys.
aKeysList of keys to process. Only keys belonging to a single trip are included.
aCancelFlagIf the cancel flag becomes false during operation, revokeOrders will stop and throw a BpsException.
Exceptions
BpsExceptionThrown when revoking failed or was aborted.

◆ robotEvent

void BpsRobot::robotEvent ( int  aEvt,
const QVariantMap &  aData 
)
signal

Emitted when a spontaneous robot specific event happens.

See documentation of the respective robot interface for details.

Parameters
aEvtEvent type identifier.
aDataData record.

◆ sendSubjobLu()

virtual void BpsRobot::sendSubjobLu ( const QVariant aOrdertrip,
const QVariant aLuid,
volatile bool *  aCancelFlag = nullptr 
)
virtual

Send back a subjob after a LU got finalized.

Parameters
aOrdertripKey of the order trip.
aLuidThe id of the logistic unit that was finalized.
aCancelFlagIt the cancel flag becomes false during operation, sendSubjobLu will stop and throw a BpsException.

◆ showProgress

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
aMaximumHighest tick value, usually the number of processed items.
aLabelLabel to display in the progress indicator. Use QString() to display no label.

◆ showProgressMessage()

void BpsRobot::showProgressMessage ( const QString aMessage)

Emit signals to show a progress message with undefined running length.

Parameters
aMessageThe message to display.

◆ subjobItemCondition()

virtual QString BpsRobot::subjobItemCondition ( const QString aPrefix = QString())
virtual

Get the orderitem selecting condition for subjobs created by this robot.

For example a subjobItemCondition(bStr("c.")) might return something like "c.c_originfo like 'Osiris;%'".

Parameters
aPrefixPrefix to use for the columns of t_orderitems.
Returns
The condition to select subjobs.

◆ syncOrders()

virtual void BpsRobot::syncOrders ( OrderType  aOrderType,
const QVariantList &  aKeys,
OrderSyncMode  aSyncMode,
volatile bool *  aCancelFlag = nullptr 
)
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.

The default implementation does nothing.

Parameters
aOrderTypeType of the records addressed by aKeys.
aKeysList of keys to process. Only keys belonging to a single trip are to be included.
aSyncModeSynchronizing mode.
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.

◆ syncStock()

virtual void BpsRobot::syncStock ( volatile bool *  aCancelFlag = nullptr)
virtual

Import all robot stocks into the BPS stock.

The default implementation does nothing.

Parameters
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.

◆ unlock()

void BpsRobot::unlock ( )

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

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

Exceptions
BpsExceptionthrown on SQL errors.

◆ updateProgressLabel

void BpsRobot::updateProgressLabel ( const QString aLabel)
signal

Emitted to update the progress label text.

Parameters
aLabelNew label text to display in the progress indicator.

◆ updateProgressMaximum

void BpsRobot::updateProgressMaximum ( int  aMaximum)
signal

Emitted to change the highest tick value.

Parameters
aMaximumHighest tick value, usually the number of processed items.

◆ updateProgressValue

void BpsRobot::updateProgressValue ( int  aValue)
signal

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

Parameters
aValueThe value tick reached in the range 1...aMaximum, see showProgress().

◆ zone()

QVariant BpsRobot::zone ( ) const
Returns
The zone handled by this robot.

◆ zoneName()

QString BpsRobot::zoneName ( ) const
Returns
The zone name.

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