Documents > BPS V2 C++ API

BPS order utilities. More...

#include <bpsorderutils.h>

List of all members.

Public Types

enum  OuIndex {
  O_unknown,
  O_LU,
  O_TU,
  O_CU,
  O_PU
}
 Order unit enumeration. More...
enum  PuIndex {
  P_unknown,
  P_Piece,
  P_Kilo,
  P_Liter,
  P_Meter,
  P_SquareMeter,
  P_CubicMeter
}
 Price unit enumeration. More...
enum  StockModeIndex {
  SM_unknown,
  SM_Regular,
  SM_FIFO,
  SM_Quick
}
 Stock handling modes. More...

Public Member Functions

void addToStock (const QVariantMap &aParams)
 Adds or subtracts stock quantities and updates other stock fields.
 BpsOrderUtils (BpsDatastore *aDatastore, QObject *aParent=0)
 Constructor for the BpsOrderUtils objects.
void cancelOrderPick (const QVariant &aPickKey)
 Cancel an existing pick by deleting the record in t_orderpicks.
QVariant cloneArticle (const QVariant &aKey)
 Make an exact copy of the original article, with exception of the key.
QVariant clonePartner (const QVariant &aKey)
 Make an exact copy of the original partner, with exception of the key.
QVariant cloneRecord (const QVariant &aKey, const QString &aName)
 Make an exact copy of an arbitrary BPS record, with exception of the key.
QString cprToString (const QVariant &aCpr)
 Convert a consumer price to string.
BpsDatastoredatastore () const
QString dprToString (const QVariant &aDpr)
 Convert a dealer price to string.
QVariantMap finishOrderRow (const QVariantMap &aParams)
 Finish a order row.
bool finishPurchaseOrder (const QVariant &aOrderKey, bool aLock=false, int aTimeout=0)
 Finishes a purchase order having the status ready, active or completed, and not having any blocked deliveries.
bool getSellPrices (const QVariant &aArticleKey, const QDateTime &aStart, QVariant &aDpr, QVariant &aCpr, QVariant &aCode)
 Find the prices for a certain article and starting date/time.
bool getZoneMergeclass (const QVariant &aTripclassKey, const QVariant &aArticleclassKey, const QVariant &aPartnerclassKey, QVariant &aZoneKey, QVariant &aMergeclassKey)
 Get the zone and merge class for a combination of trip, article and partner class.
bool isOrdercolLocked (const QVariant &aKey)
 Checks if the order column, the open trip, or any of the details belonging to the column are locked.
bool isOrderitemLocked (const QVariant &aKey)
 Checks if the order detail or any parent record is locked.
bool isOrderrowLocked (const QVariant &aKey)
 Checks if the order row, the open trip, the related columns or any of the details belonging to the row are locked.
bool isOrdertripLocked (const QVariant &aKey)
 Checks if the open trip or any of the order rows, columns or details belonging to it are locked.
bool isPurchaseItemLocked (const QVariant &aKey)
 Checks if the purchase order item or the parent purchase order record is locked.
bool isPurchaseOrderLocked (const QVariant &aKey)
 Checks if the purchase order or any of the items belonging to the order are locked.
bool isRobotLocked (const QVariant &aKey)
 Checks if the zone is currently robot-locked.
bool lockAllOrderitems (const QVariant &aKID, int aTimeout=0)
 Lock a list of order items.
bool lockAllOrderitems (const QVariantList &aKeys, int aTimeout=0)
 Lock a list of order items.
bool lockOrdercol (const QVariant &aKey, int aTimeout=0)
 Lock an order column.
bool lockOrderitem (const QVariant &aKey, int aTimeout=0)
 Lock an order item.
QVariantList lockOrderitems (const QVariantList &aKeys, int aTimeout=0)
 Lock a list of order items.
bool lockOrderrow (const QVariant &aKey, int aTimeout=0)
 Lock an order row.
bool lockOrdertrip (const QVariant &aKey, int aTimeout=0)
 Lock an open trip.
bool lockPurchaseItem (const QVariant &aKey, int aTimeout=0)
 Lock a purchase order item.
QVariantList lockPurchaseItems (const QVariantList &aKeys, int aTimeout=0)
 Lock a list of purchase order items.
bool lockPurchaseOrder (const QVariant &aKey, int aTimeout=0)
 Lock a purchase order.
bool lockRobot (const QVariant &aKey, int aTimeout=0)
 Lock a zone for exclusive robot access.
QVariantMap makeOrderItem (const QVariantMap &aParams)
 Creates a new order item.
QVariant makeOrderPick (const QVariantMap &aParams)
 Make an order pick.
QVariantMap makePurchaseItem (const QVariantMap &aParams)
 Creates a new purchase order item.
void setStock (const QVariantMap &aParams)
 Set the absolute stock quantities and updates other fields.
QString tripdateToString (const QVariant &aTripdate)
 Convert a order trip date to string.
void unlockOrdercol (const QVariant &aKey)
 Unlock the order column, in case it was locked by the current actor.
void unlockOrderitem (const QVariant &aKey)
 Unlock the order item.
void unlockOrderitems (const QVariant &aKID)
 Unlock a list of order items held in table t_keyids.
void unlockOrderitems (const QVariantList &aKeys)
 Unlock a list of order items.
void unlockOrderrow (const QVariant &aKey)
 Unlock the order row, in case it was locked by the current actor.
void unlockOrdertrip (const QVariant &aKey)
 Unlock the open trip, in case it was locked by the current actor.
void unlockPurchaseItem (const QVariant &aKey)
 Unlock the purchase order item, in case it was locked by the current actor.
void unlockPurchaseItems (const QVariantList &aKeys)
 Unlock a list of purchase order items, in case they were locked by the current actor.
void unlockPurchaseOrder (const QVariant &aKey)
 Unlock the purchase order, in case it was locked by the current actor.
void unlockRobot (const QVariant &aKey)
 Unlock the zone, in case it was locked by the current actor.

Static Public Member Functions

static OuIndex orderUnitIndex (const QVariant &aOu)
 Get the enumeration for a order unit code.
static QString orderUnitName (OuIndex aOu)
 Get the human readable and translated order unit name (LU, TU, CU, PU) from a order unit index (O_LU, O_TU, O_CU, O_PU).
static QString orderUnitName (OuIndex aOu, PuIndex aPu)
 Get the human readable and translated order unit name (LU, TU, CU, Piece, Kilo, Liter, Meter, M2, M3) from a order unit index and price unit index.
static QString orderUnitName (const QVariant &aOu)
 Get the human readable and translated order unit name (LU, TU, CU, PU) from a order unit code ("L", "T", "C", "P").
static QString orderUnitName (const QVariant &aOu, const QVariant &aPu)
 Get the human readable and translated order unit name (LU, TU, CU, Piece, Kilo, Liter, Meter, M2, M3) from a order unit index and price unit index.
static QString priceUnitAbbreviation (PuIndex aPu)
 Get the abbreviated, maximum 3 character price unit name (PCS, KG, L, M, M2, M3) from a price unit index (P_Piece, P_Kilo, P_Liter, P_Meter, P_SquareMeter, P_CubicMeter).
static QString priceUnitAbbreviation (const QVariant &aPu)
 Get the abbreviated, maximum 3 character price unit name (PCS, KG, L, M, M2, M3) from a price unit code (p, k, l, m, s, c).
static PuIndex priceUnitIndex (const QVariant &aPu)
 Get the enumeration for a price unit code.
static QString priceUnitName (PuIndex aPu)
 Get the human readable and translated price unit name (Piece, Kilo, Liter, Meter, M2, M3) from a price unit index (P_Piece, P_Kilo, P_Liter, P_Meter, P_SquareMeter, P_CubicMeter).
static QString priceUnitName (const QVariant &aPu)
 Get the human readable and translated price unit name (Piece, Kilo, Liter, Meter, M2, M3) from a price unit code (p, k, l, m, s, c).
static StockModeIndex stockModeIndex (const QVariant &aMode)
 Get the enumeration for a stock mode code.
static QString stockModeName (StockModeIndex aMode)
 Get the human readable and translated stock mode name (Regular, FIFO, Quick) from a stock mode index (SM_Regular, SM_FIFO, SM_Quick).
static QString stockModeName (const QVariant &aMode)
 Get the human readable and translated stock mode name (Regular, FIFO, Quick) from a price unit code (r, f, q).

Detailed Description

BPS order utilities.

This class assembles a collection of utilities used for order processing.


Member Enumeration Documentation

Order unit enumeration.

Enumerator:
O_unknown 

Unknown unit.

O_LU 

Logistic unit.

O_TU 

Traded unit.

O_CU 

Consumer unit.

O_PU 

Price unit.

Price unit enumeration.

Enumerator:
P_unknown 

Unknown unit.

P_Piece 

Pieces.

P_Kilo 

Kilos.

P_Liter 

Liters.

P_Meter 

Meters.

P_SquareMeter 

Square meters.

P_CubicMeter 

Cubic meters.

Stock handling modes.

Enumerator:
SM_unknown 

Unknown stock mode.

SM_Regular 

Regular stock mode.

SM_FIFO 

Regular stock mode.

SM_Quick 

Regular stock mode.


Constructor & Destructor Documentation

BpsOrderUtils::BpsOrderUtils ( BpsDatastore aDatastore,
QObject *  aParent = 0 
)

Constructor for the BpsOrderUtils objects.

Parameters:
aDatastoreDatastore to work on.
aParentPointer to an optional parent object.

Member Function Documentation

void BpsOrderUtils::addToStock ( const QVariantMap &  aParams)

Adds or subtracts stock quantities and updates other stock fields.

Lus, tus and cus are normalized in the stock, e.g. recalculated according to the factors tu/lu and cu/tu for better human readability.

Parameters:
[in]aParamsThe parameters defining the stock action.
Key Description Mandatory Default
stock_key The stock key in t_stock yes n.a.
stock_reason The change reason, a key from t_stockreasons yes n.a.
stock_prio New priority no Keep old priority
stock_status New status no Keep old status
stock_type New type no Keep old type
stock_indate New in date no Keep old in date
stock_expdate New expire date no Keep old expire date
stock_cpr New consumer price no Keep old consumer price
stock_lotid New lot ID no Keep old lot ID
stock_lus Logical units delta (+/-) to the existing stock no 0
stock_tus Traded units delta (+/-) to the existing stock no 0
stock_cus Consumer units delta (+/-) to the existing stock no 0
stock_tu_lu New factor tu/lu no Keep existing factor
stock_cu_tu New factor cu/tu no Keep existing factor
stock_pu_cu New factor pu/cu no Keep existing factor
stock_remarks New remarks no Keep existing remarks
void BpsOrderUtils::cancelOrderPick ( const QVariant &  aPickKey)

Cancel an existing pick by deleting the record in t_orderpicks.

If the pick was taken from stock, this operation will also add the picked quantities back to the stock in the same transaction.

Parameters:
[in]aPickKeyKey of the record in t_orderpicks.
QVariant BpsOrderUtils::cloneArticle ( const QVariant &  aKey)

Make an exact copy of the original article, with exception of the key.

Copies also all subtables of the article record like prices, bar codes, fields and whatever new subtables may come in future releases of BPS.

Stock records are excluded, although in the workplace they are found in the article master data for convenience, they do not really belong to master data but are more like transaction data.

Parameters:
[in]aKeyKey of the original article record.
Returns:
Key of the new article record.
Exceptions:
BpsExceptionwhen original article does not exist.
QVariant BpsOrderUtils::clonePartner ( const QVariant &  aKey)

Make an exact copy of the original partner, with exception of the key.

Copies also all subtables of the partner record like attributes, departments and whatever new subtables may come in future releases of BPS.

Parameters:
[in]aKeyKey of the original partner record.
Returns:
Key of the new partner record.
Exceptions:
BpsExceptionwhen original partner does not exist.
QVariant BpsOrderUtils::cloneRecord ( const QVariant &  aKey,
const QString &  aName 
)

Make an exact copy of an arbitrary BPS record, with exception of the key.

The record must have a primary column c_key, the table must be the given name with prefix t_, and there must exist a sequence with the given name and prefix s_.

 // clone a resource in update safe manner
 QVariant key = utils->cloneRecord(oldKey, bStr("resources"));
Parameters:
[in]aKeyKey of the original record.
[in]aNameName of the table and sequence, without prefixes.
Returns:
Key of the new article record.
Exceptions:
BpsExceptionwhen original record does not exist.
QString BpsOrderUtils::cprToString ( const QVariant &  aCpr)

Convert a consumer price to string.

The mask is taken from the validator for t_articleprices.c_cpr. Null values are converted to an empty string.

Parameters:
[in]aCprThe consumer price to convert.
Returns:
The string representation.
BpsDatastore* BpsOrderUtils::datastore ( ) const
Returns:
The datastore worked on.
QString BpsOrderUtils::dprToString ( const QVariant &  aDpr)

Convert a dealer price to string.

The mask is taken from the validator for t_articleprices.c_dpr. Null values are converted to an empty string.

Parameters:
[in]aDprThe dealer price to convert.
Returns:
The string representation.
QVariantMap BpsOrderUtils::finishOrderRow ( const QVariantMap &  aParams)

Finish a order row.

There are 2 modes of operation:

  • Final delivery mode
    • All items are processed.
    • Not yet picked items are moved completely to the new trip when reordering. When not reordering they are shortened to 0 and a zero picking record is added.
    • Underdelivered items get shortened to the picked quantity. The missing quantity is reordered in the new trip in case.
  • Partial delivery mode
    • Only picked items are processed.
    • Not yet picked items are left untouched.
    • Underdelivered items get shortened to the picked quantity. The missing quantity is reordered in the same trip in case.
Parameters:
[in]aParamsThe parameters defining the finish action.
Key Description Mandatory Default
orderrows_key Key of the order row to process yes n.a.
orderpicks_delivery Delivery ID no Created from sequence s_deliveries
orderpicks_delivdate Delivery date no Current timestamp
mode 0=partial delivery, 1=final delivery no 0
underdelivery_tolerance Tolerance in percent (0...100) that the picked PU may be below the ordered quantity (which is 100%) without the being considered as underdelivered. no 0
new_trip Final delivery mode: Key of t_trips used for reordering. Partial delivery mode: Any non-null value will enable subsequent deliveries to the same trip. If not present no reordering happens. no n.a.
new_tripdate Date for new t_ordertrips in final delivery mode. If not present in final delivery mode, no reordering happens. no n.a.
new_articles List of article keys to be reordered. If not present, all articles are reordered. no n.a.
short_remarks Remarks for shortened items not getting reordered. no Leave remarks unchanged
orig_remarks Remarks for shortened items getting reordered. no Leave remarks unchanged
new_remarks Remarks for new article orders created for the reorders. no Remarks of original article order
Returns:
Map with informations about the operation:
Key Description
orderpicks_delivery The delivery ID used.
new_ordertrips Keys of the new created order trips in table t_ordertrips.
new_orderrows Keys of the new created partner orders in table t_orderrows.
new_ordercols Keys of the new created article orders in table t_ordercols.
new_orderitems Keys of the new created order items in table t_orderitems.
bool BpsOrderUtils::finishPurchaseOrder ( const QVariant &  aOrderKey,
bool  aLock = false,
int  aTimeout = 0 
)

Finishes a purchase order having the status ready, active or completed, and not having any blocked deliveries.

The following tasks are performed:

  • Set order status to completed
  • Set all item status to completed
  • Deliveries not yet entered get arrival and entry by and date set, and quantities set to zero.
  • Items not having any deliveries get a zero delivery appended.
Parameters:
[in]aOrderKeyKey of the purchase order (t_purchaseorders.c_key)
[in]aLockTrue = lock the order while processing. False = do not lock/unlock (because order was locked in advance).
[in]aTimeoutLocking time out in seconds. Special values: 0 = no wait, -1 = wait endless.
Returns:
True when operation successfully completed. False when not executable because aLock is true and order already locked, or order status not as required, or any blocked deliveries.
Exceptions:
BpsExceptionon sql errors.
bool BpsOrderUtils::getSellPrices ( const QVariant &  aArticleKey,
const QDateTime &  aStart,
QVariant &  aDpr,
QVariant &  aCpr,
QVariant &  aCode 
)

Find the prices for a certain article and starting date/time.

Parameters:
[in]aArticleKeyThe key of the article.
[in]aStartThe minimum starting date of the price to find.
[in]aDprThe found dealer price. Invalid if not found.
[in]aCprThe found consumer price. Invalid if not found.
[in]aCodeThe found price code. 'n' if not found.
Returns:
True if prices found, false if not found.
bool BpsOrderUtils::getZoneMergeclass ( const QVariant &  aTripclassKey,
const QVariant &  aArticleclassKey,
const QVariant &  aPartnerclassKey,
QVariant &  aZoneKey,
QVariant &  aMergeclassKey 
)

Get the zone and merge class for a combination of trip, article and partner class.

In case no record is found, the method retries possible combinations in the order below and just returns false if none succeeded:

OrderTrip ClassArticle ClassPartner Class
1***
2**null
3*null*
4*nullnull
5null**
6null*null
7nullnull*
8nullnullnull
Parameters:
[in]aTripclassKeyThe key of the trip class.
[in]aArticleclassKeyThe key of the article class.
[in]aPartnerclassKeyThe key of the partner class.
[in]aZoneKeyKey of the zone found.
[in]aMergeclassKeyKey of the mergeclass found.
Returns:
True if zone and mergeclass found, false if not found.
bool BpsOrderUtils::isOrdercolLocked ( const QVariant &  aKey)

Checks if the order column, the open trip, or any of the details belonging to the column are locked.

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_ordercols.
Returns:
True if any locks are present, false if not.
bool BpsOrderUtils::isOrderitemLocked ( const QVariant &  aKey)

Checks if the order detail or any parent record is locked.

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_orderitems.
Returns:
True if any locks are present, false if not.
bool BpsOrderUtils::isOrderrowLocked ( const QVariant &  aKey)

Checks if the order row, the open trip, the related columns or any of the details belonging to the row are locked.

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_orderrows.
Returns:
True if any locks are present, false if not.
bool BpsOrderUtils::isOrdertripLocked ( const QVariant &  aKey)

Checks if the open trip or any of the order rows, columns or details belonging to it are locked.

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_ordertrips.
Returns:
True if any locks are present, false if not.
bool BpsOrderUtils::isPurchaseItemLocked ( const QVariant &  aKey)

Checks if the purchase order item or the parent purchase order record is locked.

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_purchaseitems.
Returns:
True if any locks are present, false if not.
bool BpsOrderUtils::isPurchaseOrderLocked ( const QVariant &  aKey)

Checks if the purchase order or any of the items belonging to the order are locked.

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_purchaseorders.
Returns:
True if any locks are present, false if not.
bool BpsOrderUtils::isRobotLocked ( const QVariant &  aKey)

Checks if the zone is currently robot-locked.

Parameters:
[in]aKeyThe primary key value (c_key) in table t_zones.
Returns:
True if any locks are present, false if not.
bool BpsOrderUtils::lockAllOrderitems ( const QVariant &  aKID,
int  aTimeout = 0 
)

Lock a list of order items.

The method will lock all order items if possible, and none otherwise.

Parameters:
[in]aKIDID of the list of locked order item keys in table t_keys.
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
Returns:
True if all order items are locked (except no more existing items), false if any of the items was already locked.
bool BpsOrderUtils::lockAllOrderitems ( const QVariantList &  aKeys,
int  aTimeout = 0 
)

Lock a list of order items.

The method will lock all order items if possible, and none otherwise.

Parameters:
[in]aKeysThe list of primary key values (c_key) of the records in table t_orderitems.
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
Returns:
True if all order items are locked (except no more existing items), false if locking failed because any of the items is already locked.
bool BpsOrderUtils::lockOrdercol ( const QVariant &  aKey,
int  aTimeout = 0 
)

Lock an order column.

This lock will only succeed when no other actor has locked the column or any of the details belonging to it.

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_ordercols.
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
Returns:
True if the lock was successful, false if not.
bool BpsOrderUtils::lockOrderitem ( const QVariant &  aKey,
int  aTimeout = 0 
)

Lock an order item.

This lock will only succeed when no other actor has locked the detail record.

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_orderitems.
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
Returns:
True if the lock was successful, false if not.
QVariantList BpsOrderUtils::lockOrderitems ( const QVariantList &  aKeys,
int  aTimeout = 0 
)

Lock a list of order items.

The method will lock as many of the order items as possible.

Parameters:
[in]aKeysThe list of primary key values (c_key) of the records in table t_orderitems.
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
Returns:
List of the actually locked items.
bool BpsOrderUtils::lockOrderrow ( const QVariant &  aKey,
int  aTimeout = 0 
)

Lock an order row.

This lock will only succeed when no other actor has locked the row or any of the details belonging to it.

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_orderrows.
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
Returns:
True if the lock was successful, false if not.
bool BpsOrderUtils::lockOrdertrip ( const QVariant &  aKey,
int  aTimeout = 0 
)

Lock an open trip.

This lock will only succeed when no other actor has locked the open trip or any of the order rows, columns and details belonging to the open trip.

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_ordertrips.
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
Returns:
True if the lock was successful, false if not.
bool BpsOrderUtils::lockPurchaseItem ( const QVariant &  aKey,
int  aTimeout = 0 
)

Lock a purchase order item.

This lock will only succeed when no other actor has locked the item or the parent purchase order.

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_purchaseitems.
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
Returns:
True if the lock was successful, false if not.
QVariantList BpsOrderUtils::lockPurchaseItems ( const QVariantList &  aKeys,
int  aTimeout = 0 
)

Lock a list of purchase order items.

This lock will only succeed when no other actor has locked the item or the parent purchase order.

Parameters:
[in]aKeysThe list of primary key values (c_key) of the records in table t_purchaseitems.
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
Returns:
List of the actually locked items.
bool BpsOrderUtils::lockPurchaseOrder ( const QVariant &  aKey,
int  aTimeout = 0 
)

Lock a purchase order.

This lock will only succeed when no other actor has locked the order or any of the items belonging to it.

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_purchaseorders.
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
Returns:
True if the lock was successful, false if not.
bool BpsOrderUtils::lockRobot ( const QVariant &  aKey,
int  aTimeout = 0 
)

Lock a zone for exclusive robot access.

This lock will only succeed when no other actor has locked the robot.

Parameters:
[in]aKeyThe primary key value (c_key) in table t_zones.
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
Returns:
True if the lock was successful, false if not.
QVariantMap BpsOrderUtils::makeOrderItem ( const QVariantMap &  aParams)

Creates a new order item.

Parameters:
[in]aParamsThe parameters defining the order item.
Key Description Mandatory Default
ordertrips_date Trip date yes n.a.
ordertrips_trip Trip key yes n.a.
orderrows_partner Partner key yes n.a.
orderrows_ordercd Order code no 'n'
orderrows_orderid Order row ID no null
orderrows_origin Origin system name no null
orderrows_originfo Origin system information data no null
orderrows_remarks Order row remarks no null
ordercols_article Article key yes n.a.
ordercols_dpr Dealer price (charged to partner) no t_articleprices.c_dpr
ordercols_cpr Consumer price (printed on goods) no t_articleprices.c_cpr
ordercols_prcd Price code no t_articleprices.c_code
ordercols_ou Ordered units no t_articles.c_stock_unit
ordercols_tu_lu Traded units per logistic unit no t_articles.c_tu_lu
ordercols_cu_tu Consumer units per traded unit no t_articles.c_cu_tu
ordercols_pu_cu Price units per ordered unit no t_articles.c_pu_cu
ordercols_selldays Number of selling days, counted from production/labeling date no t_articles.c_selldays
ordercols_expiredays Expires this number days after selling days no t_articles.c_expiredays
ordercols_remarks Order column remarks no null
orderitems_ordered Ordered quantity yes n.a.
orderitems_planned Planned quantity no Ordered quantity
orderitems_orderid Order item ID no null
orderitems_originfo Origin system information data no null
orderitems_zone Zone no t_pickmatrix.c_zone
orderitems_mergeclass Merge class no t_pickmatrix.c_mergeclass
orderitems_remarks Order item remarks no null
Returns:
Map with informations about the operation:
Key Description
tripkey Key of the order trip in table t_ordertrips.
rowkey Key of the partner order in table t_orderrows.
colkey Key of the article order in table t_ordercols.
itemkey Key of the order item in table t_orderitems.
newtrip True if the order trip was created, false if it already existed before.
newrow True if the partner order was created, false if it already existed before.
newcol True if the article order was created, false if it already existed before.
QVariant BpsOrderUtils::makeOrderPick ( const QVariantMap &  aParams)

Make an order pick.

Parameters:
[in]aParamsThe parameters defining the pick action.
Key Description Mandatory Default
orderitems_key Order item key. yes n.a.
orderpicks_luid Logistic unit ID. no null
orderpicks_rfid RF ID. no null
orderpicks_lotid Lot ID. no t_stock.c_lotid if stock_key given, NULL otherwise.
orderpicks_lus # of logistic units picked. (integer) no null
orderpicks_tus # of traded units picked. (integer) no null
orderpicks_cus # of consumer units picked. (integer) no null
orderpicks_pus Quantity of price units picked. (floating point, precision 3) no calculated
orderpicks_tu_lu

Traded units in one logistic unit picked. (integer)

May cause a stock splitting if it differs from t_stock.c_tu_lu.

no t_stock.c_tu_lu (t_ordercol.c_tu_lu when no stock)
orderpicks_cu_tu

Consumer units in one traded unit picked. (integer).

May cause a stock splitting if it differs from t_stock.c_cu_tu.

no t_stock.c_cu_tu (t_ordercol.c_cu_tu when no stock)
orderpicks_pu_cu

Nominal price units in one consumer unit picked. (integer).

May cause a stock splitting if it differs from t_stock.c_pu_cu.

no t_stock.c_pu_cu (t_ordercol.c_pu_cu when no stock)
stock_key

The stock to take the picked amounts from.

If a value is given, the stock update will happen in the same transaction as the pick record gets created.

The parameter is taken as the key of the desired stock in table t_stock. The stock must have the status free and be for the same article as the order column.

If registration on the given stock is not possible because of factor mismatch (tu_lu, cu_tu), the function may search and use another free stock for the same article on the same stock location where the factors are matching. If finally no such stock is found, the function will create a new stock cloning the original stock, but with the factors of the pick (automatic stock splitting).

This parameter has precedence over stock_auto.

no null
stock_auto

Automatically select a stock if this parameter is given as string "yes".

Only used when stock_key is not given.

An existing stock is searched as:

  • In the zone of the item
  • With status free
  • On a stock location with status open or drawing

Order the found stocks first by stock priority and second by stock location, then take the first stock.
If no such stock is found, the pick will be done without any stock operation.

no "no"
Returns:
The key of the new record as t_orderpicks.c_key
QVariantMap BpsOrderUtils::makePurchaseItem ( const QVariantMap &  aParams)

Creates a new purchase order item.

Parameters:
[in]aParamsThe parameters defining the purchase order item.
Key Description Mandatory Default
purchaseorders_zone Entry zone no t_articles.c_entryzone if not null, otherwise throw exception
purchaseorders_orderid Own order ID no null
purchaseorders_deliverydate Target delivery date/time yes n.a.
purchaseorders_seller Partner key of seller yes n.a.
purchaseorders_selleroid Order ID of seller no null
purchaseorders_sellerom Order mode for seller no 'n' (none)
purchaseorders_selleros Order status of seller no 'u' (unsent)
purchaseorders_sellerod Order date/time of seller no current timestamp when order status='s', null otherwise
purchaseorders_distributor Partner key of distributor no null
purchaseorders_distributoroid Order ID of distributor no null
purchaseorders_distributorom Order mode for distributor no 'n' (none)
purchaseorders_distributoros Order status of distributor no 'u' (unsent)
purchaseorders_distributorod Order date/time of distributor no current timestamp when order status='s', null otherwise
purchaseorders_remarks Order remarks no null
purchaseorders_origin Origin system name no null
purchaseorders_originfo Origin system order information data no null
purchaseitems_itemid Own item ID no null
purchaseitems_selleriid Item ID of seller no null
purchaseitems_distributoriid Item ID of distributor no null
purchaseitems_article Article key yes n.a.
purchaseitems_prcd Price code for consumer price labeling no t_articleprices.c_code
purchaseitems_cpr Consumer price for price labeling no t_articleprices.c_cpr
purchaseitems_bpr Buying price per price unit no null
purchaseitems_ordered Ordered quantity in OU yes n.a.
purchaseitems_confirmed Confirmed quantity in OU no null
purchaseitems_confirmdate Confirm date/time no current timestamp when confirmed not null, null otherwise
purchaseitems_ou Ordered units (L)U (T)U (C)U (P)U no t_articles.c_stock_unit
purchaseitems_pu Price unit (p)iece (k)g (l)iter (m)eter (s)quare meter (c)ubic meter no t_articles.c_pu
purchaseitems_tu_lu Traded units per logistic unit no t_articles.c_tu_lu
purchaseitems_cu_tu Consumer units per traded unit no t_articles.c_cu_tu
purchaseitems_pu_cu Price units per ordered unit no t_articles.c_pu_cu
purchaseitems_remarks Item remarks no null
purchaseitems_originfo Origin system item information data no null
Returns:
Map with informations about the operation:
Key Description
orderkey Key of the new created order in table t_purchaseorders.
itemkey Key of the new created item in table t_purchaseitems.
static OuIndex BpsOrderUtils::orderUnitIndex ( const QVariant &  aOu) [static]

Get the enumeration for a order unit code.

Parameters:
[in]aOuThe order unit code
Returns:
The enumeration
static QString BpsOrderUtils::orderUnitName ( OuIndex  aOu) [static]

Get the human readable and translated order unit name (LU, TU, CU, PU) from a order unit index (O_LU, O_TU, O_CU, O_PU).

Note:
It is common to use the English abbreviations LU, TU, CU and PU also in the other languages.
Parameters:
[in]aOuThe order unit index.
Returns:
The human readable order unit name, or an empty string for O_unknown.
static QString BpsOrderUtils::orderUnitName ( OuIndex  aOu,
PuIndex  aPu 
) [static]

Get the human readable and translated order unit name (LU, TU, CU, Piece, Kilo, Liter, Meter, M2, M3) from a order unit index and price unit index.

Parameters:
[in]aOuThe order unit index.
[in]aPuThe price unit index, only used if aOu == O_PU.
Returns:
The human readable order unit name, or an empty string for O_unknown.
static QString BpsOrderUtils::orderUnitName ( const QVariant &  aOu) [static]

Get the human readable and translated order unit name (LU, TU, CU, PU) from a order unit code ("L", "T", "C", "P").

Note:
It is common to use the English abbreviations LU, TU, CU and PU also in the other languages.
Parameters:
[in]aOuThe order unit code.
Returns:
The human readable order unit name, or an empty string if none of "L", "T", "C", "P".
static QString BpsOrderUtils::orderUnitName ( const QVariant &  aOu,
const QVariant &  aPu 
) [static]

Get the human readable and translated order unit name (LU, TU, CU, Piece, Kilo, Liter, Meter, M2, M3) from a order unit index and price unit index.

Parameters:
[in]aOuThe order unit code.
[in]aPuThe price unit code, only used when aOu == "P".
Returns:
The human readable order unit name, or an empty string if order unit is none of "L", "T", "C", "P".
static QString BpsOrderUtils::priceUnitAbbreviation ( PuIndex  aPu) [static]

Get the abbreviated, maximum 3 character price unit name (PCS, KG, L, M, M2, M3) from a price unit index (P_Piece, P_Kilo, P_Liter, P_Meter, P_SquareMeter, P_CubicMeter).

Parameters:
[in]aPuThe price unit index.
Returns:
The price unit abbreviation.
static QString BpsOrderUtils::priceUnitAbbreviation ( const QVariant &  aPu) [static]

Get the abbreviated, maximum 3 character price unit name (PCS, KG, L, M, M2, M3) from a price unit code (p, k, l, m, s, c).

Parameters:
[in]aPuThe price unit code.
Returns:
The price unit abbreviation.
static PuIndex BpsOrderUtils::priceUnitIndex ( const QVariant &  aPu) [static]

Get the enumeration for a price unit code.

Parameters:
[in]aPuThe price unit code
Returns:
The enumeration
static QString BpsOrderUtils::priceUnitName ( PuIndex  aPu) [static]

Get the human readable and translated price unit name (Piece, Kilo, Liter, Meter, M2, M3) from a price unit index (P_Piece, P_Kilo, P_Liter, P_Meter, P_SquareMeter, P_CubicMeter).

Parameters:
[in]aPuThe price unit index.
Returns:
The human readable price unit name.
static QString BpsOrderUtils::priceUnitName ( const QVariant &  aPu) [static]

Get the human readable and translated price unit name (Piece, Kilo, Liter, Meter, M2, M3) from a price unit code (p, k, l, m, s, c).

Parameters:
[in]aPuThe price unit code.
Returns:
The human readable price unit name.
void BpsOrderUtils::setStock ( const QVariantMap &  aParams)

Set the absolute stock quantities and updates other fields.

LU's, TU's and CU's are normalized in the stock, e.g. recalculated according to the factors TU/LU and CU/TU for better human readability.

Parameters:
[in]aParamsThe parameters defining the stock action.
Key Description Mandatory Default
stock_key The stock key in t_stock yes n.a.
stock_reason The change reason, a key from t_stockreasons yes n.a.
stock_prio New priority no Keep old priority
stock_status New status no Keep old status
stock_type New type no Keep old type
stock_indate New in date no Keep old in date
stock_expdate New expire date no Keep old expire date
stock_cpr New consumer price no Keep old consumer price
stock_lotid New lot ID no Keep old lot ID
stock_lus New quantity for logical units no 0
stock_tus New quantity for traded units no 0
stock_cus New quantity for consumer units no 0
stock_tu_lu New factor tu/lu no Keep existing factor
stock_cu_tu New factor cu/tu no Keep existing factor
stock_pu_cu New factor pu/cu no Keep existing factor
stock_remarks New remarks no Keep existing remarks
static StockModeIndex BpsOrderUtils::stockModeIndex ( const QVariant &  aMode) [static]

Get the enumeration for a stock mode code.

Parameters:
[in]aModeThe stock mode code (r, f, q)
Returns:
The enumeration
static QString BpsOrderUtils::stockModeName ( StockModeIndex  aMode) [static]

Get the human readable and translated stock mode name (Regular, FIFO, Quick) from a stock mode index (SM_Regular, SM_FIFO, SM_Quick).

Parameters:
[in]aModeThe stock mode index.
Returns:
The human readable stock mode name.
static QString BpsOrderUtils::stockModeName ( const QVariant &  aMode) [static]

Get the human readable and translated stock mode name (Regular, FIFO, Quick) from a price unit code (r, f, q).

Parameters:
[in]aModeThe stock mode code.
Returns:
The human readable stock mode name.
QString BpsOrderUtils::tripdateToString ( const QVariant &  aTripdate)

Convert a order trip date to string.

The format is taken from the validator for t_ordertrips.c_date. Null values are converted to an empty string.

Parameters:
[in]aTripdateThe date to convert.
Returns:
The string representation.
void BpsOrderUtils::unlockOrdercol ( const QVariant &  aKey)

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

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_ordercols.
void BpsOrderUtils::unlockOrderitem ( const QVariant &  aKey)

Unlock the order item.

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_orderitems.
void BpsOrderUtils::unlockOrderitems ( const QVariant &  aKID)

Unlock a list of order items held in table t_keyids.

See BpsDatastore::setKeys(const QVariantList& aKeys).

Parameters:
[in]aKIDID of the list of locked order item keys in table t_keys.
void BpsOrderUtils::unlockOrderitems ( const QVariantList &  aKeys)

Unlock a list of order items.

Parameters:
[in]aKeysThe list of primary key values (c_key) of the records in table t_orderitems.
void BpsOrderUtils::unlockOrderrow ( const QVariant &  aKey)

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

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_orderrows.
void BpsOrderUtils::unlockOrdertrip ( const QVariant &  aKey)

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

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_ordertrips.
void BpsOrderUtils::unlockPurchaseItem ( const QVariant &  aKey)

Unlock the purchase order item, in case it was locked by the current actor.

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_purchaseitems.
void BpsOrderUtils::unlockPurchaseItems ( const QVariantList &  aKeys)

Unlock a list of purchase order items, in case they were locked by the current actor.

Parameters:
[in]aKeysThe list of primary key values (c_key) of the records in table t_purchaseitems.
void BpsOrderUtils::unlockPurchaseOrder ( const QVariant &  aKey)

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

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_purchaseorders.
void BpsOrderUtils::unlockRobot ( const QVariant &  aKey)

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

Parameters:
[in]aKeyThe primary key value (c_key) in table t_zones.

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