BPS order utilities. More...
#include <bpsorderutils.h>
Public Types | |
enum | OrderGenMode { OM_BPS , OM_ERP } |
Order generation modes. More... | |
enum | OuIndex { O_unknown , O_PU , O_CU , O_TU , O_LU } |
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... | |
enum | StockReasonIndex { SR_Unknown , SR_Manual , SR_ManualPlus , SR_ManualMinus , SR_Storage , SR_Withdraw , SR_SupplyIntake , SR_SupplyReturn , SR_PickReturn , SR_PickDraw , SR_StockOK , SR_StockPlus , SR_StockMinus , SR_Autosync } |
Stock change reason index. More... | |
Public Member Functions | |
void | addToStock (const QVariantMap &aParams) |
Adds (or subtracts) stock quantities and updates other stock fields. More... | |
Bps::Status | adoptLu (const QVariantMap &aParams) |
Adopt an orphaned new logistic unit. More... | |
bool | anyPicksOnLu (const QVariant &aKey) |
Check if there are any picks on the logistic unit. More... | |
bool | anyRobots () const |
Check if there are any active robots. More... | |
BpsOrderUtils (BpsDatastore *aDatastore, QObject *aParent=nullptr) | |
Constructor for the BpsOrderUtils objects. More... | |
void | cancelOrderPick (const QVariant &aPickKey) |
Cancel an existing pick by deleting the record in t_orderpicks. More... | |
QVariant | clearPackStock (const QVariant &aPackRecKey) |
Clear stock registration of a packing record. More... | |
QVariant | clearPurchaseDeliveryStock (const QVariant &aDeliveryKey) |
Clear stock registration of purchase delivery record. More... | |
QVariant | cloneArticle (const QVariant &aKey) |
Make an exact copy of the original article, with exception of the key. More... | |
QVariant | clonePartner (const QVariant &aKey) |
Make an exact copy of the original partner, with exception of the key. More... | |
QVariant | cloneRecord (const QVariant &aKey, const QString &aName) |
Make an exact copy of an arbitrary BPS record, with exception of the key. More... | |
QString | cprToString (const QVariant &aCpr) |
Convert a consumer price to string. More... | |
BpsDatastore * | datastore () const |
QString | dprToString (const QVariant &aDpr) |
Convert a dealer price to string. More... | |
BpsEpcis * | epcis () |
QVariantMap | finalizeLu (const QVariantMap &aParams) |
Finalize a logistic unit. More... | |
QVariantMap | findLockLu (const QVariantMap &aParams) |
Find and lock an orphaned new logistic unit. More... | |
QVariant | findLu (const QVariantMap &aParams) |
Find a new logistic unit. More... | |
QVariantMap | findOrMakeSharedLu (const QVariantMap &aParams) |
Find and lock an orphaned new logistic unit, or create a new one. More... | |
QVariantMap | finishOrderRow (const QVariantMap &aParams) |
Finish a order row. More... | |
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. More... | |
QVariantMap | getArticle (const QVariant &aArticleKey) |
Get article record. More... | |
QList< QPair< QString, QString > > | getDefaultStockReasons () |
Get the default stock reason types and names as a list. More... | |
QVariantMap | getPackjob (const QVariant &aPackjobKey) |
Get packing job record. More... | |
QVariantMap | getPartner (const QVariant &aPartnerKey) |
Get partner record. More... | |
QVariantMap | getProd (const QVariant &aProdKey) |
Get production record. More... | |
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. More... | |
QVariant | getStockReason (const QString &aType) |
Get the stock reason for a certain type from table t_stockreasons. More... | |
QVariant | getStockReason (StockReasonIndex aIndex) |
Get the stock reason for a certain stock reason index from table t_stockreasons. More... | |
QVariantMap | getTrip (const QVariant &aTripKey) |
Get trip record. More... | |
QVariantMap | getZone (const QVariant &aZoneKey) |
Get zone record. More... | |
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. More... | |
bool | isOrdercolLocked (const QVariant &aKey) |
Checks if the order column, the order trip, or any of the details belonging to the column are locked. More... | |
bool | isOrderitemLocked (const QVariant &aKey) |
Checks if the order detail or any parent record is locked. More... | |
bool | isOrderrowLocked (const QVariant &aKey) |
Checks if the order row, the order trip, the related columns or any of the details belonging to the row are locked. More... | |
bool | isOrdertripLocked (const QVariant &aKey) |
Checks if the order trip or any of the order rows, columns or details belonging to it are locked. More... | |
bool | isPackjobLocked (const QVariant &aKey, bool aExclusive=true) |
Checks if the packing job or the production it belongs to are locked. More... | |
bool | isPackprodLocked (const QVariant &aKey) |
Checks if the packing production or any of the jobs belonging to it are locked. More... | |
bool | isPurchaseItemLocked (const QVariant &aKey) |
Checks if the purchase order item or the parent purchase order record is locked. More... | |
bool | isPurchaseOrderLocked (const QVariant &aKey) |
Checks if the purchase order or any of the items belonging to the order are locked. More... | |
Bps::Status | lockLu (const QVariant &aKey, int aTimeout=0) |
Lock an logistic unit in table t_newlogisticunits. More... | |
Bps::Status | lockOrdercol (const QVariant &aKey, int aTimeout=0, bool aFullcheck=true) |
Lock an order column. More... | |
Bps::Status | lockOrderitem (const QVariant &aKey, int aTimeout=0, bool aFullcheck=true) |
Lock an order item. More... | |
Bps::Status | lockOrderrow (const QVariant &aKey, int aTimeout=0, bool aFullcheck=true) |
Lock an order row. More... | |
Bps::Status | lockOrdertrip (const QVariant &aKey, int aTimeout=0, bool aFullcheck=true) |
Lock an order trip. More... | |
Bps::Status | lockPackjob (const QVariant &aKey, bool aExclusive=true, int aTimeout=0, bool aFullcheck=true) |
Lock a packing job. More... | |
Bps::Status | lockPackprod (const QVariant &aKey, int aTimeout=0, bool aFullcheck=true) |
Lock an packing production. More... | |
Bps::Status | lockPurchaseItem (const QVariant &aKey, int aTimeout=0) |
Lock a purchase order item. More... | |
Bps::Status | lockPurchaseOrder (const QVariant &aKey, int aTimeout=0) |
Lock a purchase order. More... | |
QVariantList | makeErpOrders (const QList< QVariantMap > &aParams) |
Create ERP orders in table t_erporders and t_erporderitems. More... | |
QVariant | makeLu (const QVariantMap &aParams) |
Create a new logistic unit. More... | |
QVariantMap | makeOrderItem (const QVariantMap &aParams) |
Creates a new order item. More... | |
QVariant | makeOrderPick (const QVariantMap &aParams) |
Make an order pick. More... | |
QVariantMap | makePackJob (const QVariantMap &aParams) |
Creates or updates a packing job. More... | |
QVariant | makePackRec (const QVariantMap &aParams) |
Make a packing record. More... | |
QVariantMap | makePurchaseDelivery (const QVariantMap &aParams) |
Creates a new purchase order delivery. More... | |
QVariantMap | makePurchaseEntry (const QVariantMap &aParams) |
Registration of an entry on an existing purchase delivery. More... | |
QVariantMap | makePurchaseItem (const QVariantMap &aParams) |
Creates a new purchase order item. More... | |
QVariant | makeStock (const QVariantMap &aParams) |
Create a new stock. More... | |
OrderGenMode | orderGenMode (const QString &aTripid) |
Get the order generation mode for a given trip ID. More... | |
void | refreshLu (const QVariant &aKey) |
Refresh the timestamp of the logistic unit, in case it is locked by the current actor. More... | |
BpsRobot * | robot (const QVariant &aZone) const |
Get robot of a given zone. More... | |
QList< BpsRobot * > | robots () const |
Get a list of all active robot. More... | |
QVariant | saveZoneStock (const QVariantMap &aParams) |
Adds a quantity to an existing stock in the given zone, or creates a new stock in the zone when no existing stock was found. More... | |
void | setPurchaseDeliveryStock (const QVariant &aDeliveryKey, const QVariant &aStockKey=QVariant()) |
Register stock of purchase delivery record. More... | |
void | setStock (const QVariantMap &aParams) |
Set the absolute stock quantities and updates other fields on an existing stock. More... | |
QString | tripdateToString (const QVariant &aTripdate) |
Convert a order trip date to string. More... | |
void | unlockLu (const QVariant &aKey) |
Unlock the logistic unit, in case it is locked by the current actor. More... | |
void | unlockOrdercol (const QVariant &aKey) |
Unlock the order column, in case it was locked by the current actor. More... | |
void | unlockOrderitem (const QVariant &aKey) |
Unlock the order item. More... | |
void | unlockOrderitems (const QVariant &aKID) |
Unlock a list of order items held in table t_keyids. More... | |
void | unlockOrderitems (const QVariantList &aKeys) |
Unlock a list of order items. More... | |
void | unlockOrderrow (const QVariant &aKey) |
Unlock the order row, in case it was locked by the current actor. More... | |
void | unlockOrdertrip (const QVariant &aKey) |
Unlock the order trip, in case it was locked by the current actor. More... | |
void | unlockPackjob (const QVariant &aKey) |
Unlock the packing job, in case it was locked by the current actor. More... | |
void | unlockPackprod (const QVariant &aKey) |
Unlock the packing production, in case it was locked by the current actor. More... | |
void | unlockPurchaseItem (const QVariant &aKey) |
Unlock the purchase order item, in case it was locked by the current actor. More... | |
void | unlockPurchaseOrder (const QVariant &aKey) |
Unlock the purchase order, in case it was locked by the current actor. More... | |
![]() | |
bool | blockSignals (bool block) |
const QObjectList & | children () 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< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, 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 QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () 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 | |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
QObject (QObject *parent) | |
T | qobject_cast (const QObject *object) |
T | 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) |
QThread * | thread () const const |
Static Public Member Functions | |
static OuIndex | orderUnitIndex (const QVariant &aOu) |
Get the enumeration for a order unit code. More... | |
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"). More... | |
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. More... | |
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). More... | |
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. More... | |
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). More... | |
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). More... | |
static PuIndex | priceUnitIndex (const QVariant &aPu) |
Get the enumeration for a price unit code. More... | |
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). More... | |
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). More... | |
static StockModeIndex | stockModeIndex (const QVariant &aMode) |
Get the enumeration for a stock mode code. More... | |
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). More... | |
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). More... | |
![]() | |
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) |
Additional Inherited Members | |
![]() | |
typedef | QObjectList |
![]() | |
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 |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
![]() | |
objectName | |
BPS order utilities.
This class assembles a collection of utilities used for order processing.
Stock change reason index.
BpsOrderUtils::BpsOrderUtils | ( | BpsDatastore * | aDatastore, |
QObject * | aParent = nullptr |
||
) |
Constructor for the BpsOrderUtils objects.
aDatastore | Datastore to work on. |
aParent | Pointer to an optional parent object. |
void BpsOrderUtils::addToStock | ( | const QVariantMap & | aParams | ) |
Adds (or subtracts) stock quantities and updates other stock fields.
aParams | The 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_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 |
Bps::Status BpsOrderUtils::adoptLu | ( | const QVariantMap & | aParams | ) |
Adopt an orphaned new logistic unit.
The method tries to lock and the record with key c_luid in t_newlogisticunits. On success, it sets either c_orderrow or c_ordertrip, where c_orderrow has precedence if both are given and not NULL. It also sets c_zone and c_mergeclass if they are given and not NULL.
aParams | Parameters for the new LU. |
Key | Description | Mandatory | Default |
---|---|---|---|
c_luid | The ID of the LU. | yes | n.a. |
c_timeout | Seconds to wait for the lock. 0 = dont wait, -1 = wait endless. | no | 0 |
c_orderrow | Key of the new order row | no | Leave old order row alone. |
c_ordertrip | Key of the new order trip | no | Leave old order trip alone |
c_zone | Key of the new picking zone | no | Leave old zone alone. |
c_mergeclass | Key of the new merge class | no | leave old merge class alone |
If c_orderrow is given and not NULL, parameter c_ordertrip is ignored and set to NULL in the record. The the partner of the new order row must match the current record value, otherwise a BpsException is thrown.
If c_ordertrip is given and not NULL, but c_orderrow is not given or is NULL, c_orderrow is set NULL in the record.
bool BpsOrderUtils::anyPicksOnLu | ( | const QVariant & | aKey | ) |
Check if there are any picks on the logistic unit.
aKey | The primary key value (c_key) of the record in table t_newlogisticunits. |
bool BpsOrderUtils::anyRobots | ( | ) | const |
Check if there are any active robots.
Equivalent to !robots().isEmpty().
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.
aPickKey | Key of the record in t_orderpicks. |
Clear stock registration of a packing record.
If c_stock is already NULL or the packing production is archived (c_status = h) nothing happens. If c_stock is not NULL, the LU, TU and CU quantities are subtracted from the stock and c_stock is set to NULL.
aPackRecKey | Key of the record in table t_packrecs. |
Clear stock registration of purchase delivery record.
If c_stock is already NULL or the purchase order is archived (c_status = h) nothing happens. If c_stock is not NULL, the LU, TU and CU quantities are subtracted from the stock and c_stock is set to NULL.
aDeliveryKey | Key of the delivery in table t_purchasedeliveries. |
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.
aKey | Key of the original article record. |
BpsException | when original article does not exist. |
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.
aKey | Key of the original partner record. |
BpsException | when original partner does not exist. |
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_.
aKey | Key of the original record. |
aName | Name of the table and sequence, without prefixes. |
BpsException | when original record does not exist. |
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.
aCpr | The consumer price to convert. |
BpsDatastore* BpsOrderUtils::datastore | ( | ) | const |
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.
aDpr | The dealer price to convert. |
BpsEpcis* BpsOrderUtils::epcis | ( | ) |
QVariantMap BpsOrderUtils::finalizeLu | ( | const QVariantMap & | aParams | ) |
Finalize a logistic unit.
Completes a logistic unit making it ready for shipping. The LU must have a record in t_newlogisticunits and be locked for the current actor.
aParams | The parameters defining the finish action. |
Key | Description | Mandatory | Default |
---|---|---|---|
c_luid | ID of the LU (logistic unit) to finalize in t_ordertrips.c_luid | yes | n.a. |
c_finishdate | Finish timestamp (QDateTime) to set as t_ordertrips.c_finishdate | no | Current timestamp |
c_finishby | User key to set as t_ordertrips.c_finishby | no | Key of current user |
c_delivery | Delivery ID to set as t_ordertrips.c_delivery | no | Created from sequence s_deliveries |
c_delivdate | Delivery timestamp (QDateTime) to set as t_ordertrips.c_delivdate | no | Current timestamp |
c_delivby | User key to set as t_ordertrips.c_delivby | no | Key of current user |
c_sscc | The SSCC in EPCIS format to set | no | Generate from CSS/Labeling/LU:SSCC Prefix and sequence s_ssccval |
c_sscccond | Conditions for setting SSCC, depending on current values of c_sscc and c_grai in t_orderpicks: 0=Never set. 1=If current values of both c_sscc and c_grai are NULL. 2=If current value in c_sscc is NULL. Dont care about c_grai. 3=If c_grai is NULL. Dont care about current value of c_sscc. 4=Always set. Dont care about current values of c_sscc or c_grai. | no | 1 |
c_epciscond | Additional conditions for creating EPCIS events: 0=Never create. 1=Create a SSCC-event for each SSCC in the orderpicks of the LU. 2=Create a GRAI-event for each GRAI in the orderpicks of the LU. 3=Create a GRAI-event for each GRAI, and a SSCC-event for each SSCC in the orderpicks of the LU. | no | 1 |
Key | Description |
---|---|
c_status | Bps::OK if successful. Bps::Notfound Record was not found in t_newlogisticunits, or it contains no valid orderrow or ordertrip. Bps::Notlocked The LU was not locked for the current actor. Lock it before calling this method. |
c_ordertrip | Key of the order trip. |
c_sscc | The SSCC in EPCIS format, for example "7617007.3000999991". |
c_sscc18 | The SSCC in scanning format, for example "376170070009999913". |
QVariantMap BpsOrderUtils::findLockLu | ( | const QVariantMap & | aParams | ) |
Find and lock an orphaned new logistic unit.
Either c_orderrow or c_ordertrip+c_partner are used as conditions to find a matching record in t_newlogisticunits.
If c_orderrow is present and not NULL it has precedence, and parameters c_ordertrip+c_partner are ignored.
If c_zone and/or c_mergeclass are present, they are used as additional conditions (even when NULL).
aParams | Parameters for the new LU. |
Key | Description | Mandatory | Default |
---|---|---|---|
c_orderrow | Key of the order row | yes(*) | n.a. |
c_ordertrip | Key of the order trip | yes(*) | null |
c_partner | Key of the partner | yes if c_orderrow missing | Take from order row |
c_zone | Key of the picking zone | no | null |
c_mergeclass | Key of the merge class | no | null |
c_timeout | Seconds to wait for the lock. 0 = dont wait, -1 = wait endless. | no | 0 |
Key | Description |
---|---|
c_status | Bps::OK Record found and lock was successful. Bps::Notfound If record not found in t_newlogisticunits, or maybe deleted while waiting. Bps::Locked Record exists but it was already locked and stayed locked until timeout. |
c_luid | Key of the found record. |
QVariant BpsOrderUtils::findLu | ( | const QVariantMap & | aParams | ) |
Find a new logistic unit.
Either c_orderrow or c_ordertrip+c_partner are used as conditions to find a matching record in t_newlogisticunits.
If c_orderrow is present and not NULL it has precedence, and parameters c_ordertrip+c_partner are ignored.
If c_zone and/or c_mergeclass are present, they are used as additional conditions (even when NULL).
aParams | Parameters for the LU. |
Key | Description | Mandatory | Default |
---|---|---|---|
c_orderrow | Key of the order row | yes(*) | n.a. |
c_ordertrip | Key of the order trip | yes(*) | null |
c_partner | Key of the partner | yes if c_orderrow missing | Take from order row |
c_zone | Key of the picking zone | no | not used |
c_mergeclass | Key of the merge class | no | not used |
QVariantMap BpsOrderUtils::findOrMakeSharedLu | ( | const QVariantMap & | aParams | ) |
Find and lock an orphaned new logistic unit, or create a new one.
This is basically a combination of BpsOrderUtils::findLockLu(), and if no record exists create a new one with BpsOrderUtils::makeLu().
During the find/make process the table t_newlogistics is locked to avoid that two clients create each a new record at same time (hence "shared").
Use case is for example break bulk picking, where multiple clients pick onto a single LU - you don't want that two create a LU at same time.
This method may not be called within a database transaction.
aParams | Parameters for the LU to find or make. |
Key | Description | Mandatory | Default |
---|---|---|---|
c_orderrow | Key of the order row | yes(*) | n.a. |
c_ordertrip | Key of the order trip | yes(*) | NULL |
c_partner | Key of the partner | yes if c_orderrow missing | Take from order row |
c_zone | Key of the picking zone | no | Not used when searching, NULL when creating |
c_mergeclass | Key of the merge class | no | Not used when searching, NULL when creating |
c_timeout | Seconds to wait for the locks. 0 = dont wait, -1 = wait endless. | no | -1 |
Key | Description |
---|---|
c_status | Bps::OK Record found or created, and lock was successful. Bps::Locked Record exists but it was already locked and stayed locked until timeout. |
c_luid | Key of the found or created record. |
QVariantMap BpsOrderUtils::finishOrderRow | ( | const QVariantMap & | aParams | ) |
Finish a order row.
There are 2 modes of operation:
aParams | The 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 |
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:
aOrderKey | Key of the purchase order (t_purchaseorders.c_key) |
aLock | True = lock the order while processing. False = do not lock/unlock (because order was locked in advance). |
aTimeout | Locking time out in seconds. Special values: 0 = no wait, -1 = wait endless. |
BpsException | on sql errors. |
QVariantMap BpsOrderUtils::getArticle | ( | const QVariant & | aArticleKey | ) |
Get article record.
Subsequent queries of the same article are cached to minimize database access.
aArticleKey | Key of the article. |
BpsException | On database errors or when record not found. |
Get the default stock reason types and names as a list.
The names are not the names of the actual stock reason in table t_stockreasons, but the default names used when automatically creating records missing in t_stockreasons.
QVariantMap BpsOrderUtils::getPackjob | ( | const QVariant & | aPackjobKey | ) |
Get packing job record.
Subsequent queries of the same packing job are cached to minimize database access.
aPackjobKey | Key of the packing job. |
BpsException | On database errors or when record not found. |
QVariantMap BpsOrderUtils::getPartner | ( | const QVariant & | aPartnerKey | ) |
Get partner record.
Subsequent queries of the same partner are cached to minimize database access.
aPartnerKey | Key of the partner. |
BpsException | On database errors or when record not found. |
QVariantMap BpsOrderUtils::getProd | ( | const QVariant & | aProdKey | ) |
Get production record.
Subsequent queries of the same production are cached to minimize database access.
aProdKey | Key of the production. |
BpsException | On database errors or when record not found. |
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.
aArticleKey | The key of the article. |
aStart | The minimum starting date of the price to find. |
aDpr | The found dealer price as BpsDecimal. Invalid if not found. |
aCpr | The found consumer price as BpsDecimal. Invalid if not found. |
aCode | The found price code. 'n' if not found. |
Get the stock reason for a certain type from table t_stockreasons.
Returns the first reason if multiple exist, where the ordering is by id, name and key. Creates the stock reason with default values if it does not yet exist and aType is a known type. Typically this method is used to look up non-manual reasons.
aType | The reason type (i+, p- etc) . |
BpsException | thrown if no such reason exists. |
QVariant BpsOrderUtils::getStockReason | ( | StockReasonIndex | aIndex | ) |
Get the stock reason for a certain stock reason index from table t_stockreasons.
Returns the first reason if multiple exist, where the ordering is by id, name and key. Creates the stock reason with default values if it does not yet exist and aIndex is not SR_Unknown. Typically this method is used to look up non-manual reasons.
aIndex | The reason index (for example SR_StockOK). |
BpsException | thrown if no such reason exists. |
QVariantMap BpsOrderUtils::getTrip | ( | const QVariant & | aTripKey | ) |
Get trip record.
Subsequent queries of the same trip are cached to minimize database access.
aTripKey | Key of the trip. |
BpsException | On database errors or when record not found. |
QVariantMap BpsOrderUtils::getZone | ( | const QVariant & | aZoneKey | ) |
Get zone record.
Subsequent queries of the same zone are cached to minimize database access.
aZoneKey | Key of the zone. |
BpsException | On database errors or when record 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:
Order | Trip Class | Article Class | Partner Class |
---|---|---|---|
1 | * | * | * |
2 | * | * | null |
3 | * | null | * |
4 | * | null | null |
5 | null | * | * |
6 | null | * | null |
7 | null | null | * |
8 | null | null | null |
aTripclassKey | The key of the trip class. |
aArticleclassKey | The key of the article class. |
aPartnerclassKey | The key of the partner class. |
aZoneKey | Key of the zone found. |
aMergeclassKey | Key of the mergeclass found. |
bool BpsOrderUtils::isOrdercolLocked | ( | const QVariant & | aKey | ) |
Checks if the order column, the order trip, or any of the details belonging to the column are locked.
aKey | The primary key value (c_key) of the record in table t_ordercols. |
bool BpsOrderUtils::isOrderitemLocked | ( | const QVariant & | aKey | ) |
Checks if the order detail or any parent record is locked.
aKey | The primary key value (c_key) of the record in table t_orderitems. |
bool BpsOrderUtils::isOrderrowLocked | ( | const QVariant & | aKey | ) |
Checks if the order row, the order trip, the related columns or any of the details belonging to the row are locked.
aKey | The primary key value (c_key) of the record in table t_orderrows. |
bool BpsOrderUtils::isOrdertripLocked | ( | const QVariant & | aKey | ) |
Checks if the order trip or any of the order rows, columns or details belonging to it are locked.
aKey | The primary key value (c_key) of the record in table t_ordertrips. |
bool BpsOrderUtils::isPackjobLocked | ( | const QVariant & | aKey, |
bool | aExclusive = true |
||
) |
Checks if the packing job or the production it belongs to are locked.
aKey | The primary key value (c_key) of the record in table t_packjobs. |
aExclusive | Allow other workers on the same job (check production only). |
bool BpsOrderUtils::isPackprodLocked | ( | const QVariant & | aKey | ) |
Checks if the packing production or any of the jobs belonging to it are locked.
aKey | The primary key value (c_key) of the record in table t_packprods. |
bool BpsOrderUtils::isPurchaseItemLocked | ( | const QVariant & | aKey | ) |
Checks if the purchase order item or the parent purchase order record is locked.
aKey | The primary key value (c_key) of the record in table t_purchaseitems. |
bool BpsOrderUtils::isPurchaseOrderLocked | ( | const QVariant & | aKey | ) |
Checks if the purchase order or any of the items belonging to the order are locked.
aKey | The primary key value (c_key) of the record in table t_purchaseorders. |
Bps::Status BpsOrderUtils::lockLu | ( | const QVariant & | aKey, |
int | aTimeout = 0 |
||
) |
Lock an logistic unit in table t_newlogisticunits.
aKey | The ID of the LU, which is the primary key value (c_key) in table t_newlogisticunits. |
aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
Bps::Status BpsOrderUtils::lockOrdercol | ( | const QVariant & | aKey, |
int | aTimeout = 0 , |
||
bool | aFullcheck = true |
||
) |
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.
aKey | The primary key value (c_key) of the record in table t_ordercols. |
aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
aFullcheck | Check for locks in related objects (ordertrip, orderrows, orderitems) |
Bps::Status BpsOrderUtils::lockOrderitem | ( | const QVariant & | aKey, |
int | aTimeout = 0 , |
||
bool | aFullcheck = true |
||
) |
Lock an order item.
This lock will only succeed when no other actor has locked the detail record.
aKey | The primary key value (c_key) of the record in table t_orderitems. |
aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
aFullcheck | Check for locks in related objects (ordertrip, orderrows, ordercols) |
Bps::Status BpsOrderUtils::lockOrderrow | ( | const QVariant & | aKey, |
int | aTimeout = 0 , |
||
bool | aFullcheck = true |
||
) |
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.
aKey | The primary key value (c_key) of the record in table t_orderrows. |
aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
aFullcheck | Check for locks in related objects (ordertrip, ordercols, orderitems) |
Bps::Status BpsOrderUtils::lockOrdertrip | ( | const QVariant & | aKey, |
int | aTimeout = 0 , |
||
bool | aFullcheck = true |
||
) |
Lock an order trip.
This lock will only succeed when no other actor has locked the order trip or any of the order rows, columns and details belonging to the order trip.
aKey | The primary key value (c_key) of the record in table t_ordertrips. |
aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
aFullcheck | Check for locks in related objects (orderrows, ordercols, orderitems) |
Bps::Status BpsOrderUtils::lockPackjob | ( | const QVariant & | aKey, |
bool | aExclusive = true , |
||
int | aTimeout = 0 , |
||
bool | aFullcheck = true |
||
) |
Lock a packing job.
This lock will only succeed when no other actor has locked the packing job or the production it belongs to.
aKey | The primary key value (c_key) of the record in table t_packjobs. |
aExclusive | Allow other workers on the same job. |
aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
aFullcheck | Check for lock in related packprod |
Bps::Status BpsOrderUtils::lockPackprod | ( | const QVariant & | aKey, |
int | aTimeout = 0 , |
||
bool | aFullcheck = true |
||
) |
Lock an packing production.
This lock will only succeed when no other actor has locked the packing production or any of the packing jobs belonging to it.
aKey | The primary key value (c_key) of the record in table t_packprods. |
aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
aFullcheck | Check for locks in related packjobs |
Bps::Status 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.
aKey | The primary key value (c_key) of the record in table t_purchaseitems. |
aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
Bps::Status 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.
aKey | The primary key value (c_key) of the record in table t_purchaseorders. |
aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
QVariantList BpsOrderUtils::makeErpOrders | ( | const QList< QVariantMap > & | aParams | ) |
Create ERP orders in table t_erporders and t_erporderitems.
aParams | A list of parameters defining the items. |
Key | Description | Mandatory | Default |
---|---|---|---|
c_date | Delivery date | yes | n.a. |
c_trip | Key of trip in t_trips | yes | n.a. |
c_partner | Key of partner in t_partners | yes | n.a. |
c_article | Key of article in t_articles | yes | n.a. |
c_quantity | Number of units to order | yes | n.a. |
c_prcd | Price code | no | t_articleprices.c_code |
c_ou | Order unit | no | t_articles.c_ou |
c_tu_lu | Number of TU in one LU | no | t_articles.c_tu_lu |
c_cu_tu | Number of CU in one TU | no | t_articles.c_cu_tu |
c_pu_cu | PU quantity in one CU | no | t_articles.c_pu_cu |
c_remarks | Remarks to set (gets simplified and truncated to fit in t_erporderitems) | no | null |
c_olditem | Key of old order item in t_orderitems. Used for reordering (order type "r"). | no | Omit old order info |
c_containers | QStringList with GRAI codes in EPCIS format used when creating picks later after the ERP order is created. Used for customer order (order type "c") - provide an empty list to identify customer order without GRAI's. | no | No GRAI list = no customer order |
QVariant BpsOrderUtils::makeLu | ( | const QVariantMap & | aParams | ) |
Create a new logistic unit.
The parameters of the new LU are saved in t_newlogisticunits, and the record is locked for the current actor.
aParams | Parameters for the new LU. |
Key | Description | Mandatory | Default |
---|---|---|---|
c_orderrow | Key of the order row | yes(*) | n.a. |
c_ordertrip | Key of the order trip | yes(*) | null |
c_partner | Key of the partner | yes if c_orderrow missing | Take from order row |
c_zone | Key of the picking zone | no | NULL |
c_mergeclass | Key of the merge class | no | NULL |
(*) Either t_orderrow, or c_ordertrip must be present and valid. If c_orderrow is present and valid, the inputs c_ordertrip and c_partner are ignored.
QVariantMap BpsOrderUtils::makeOrderItem | ( | const QVariantMap & | aParams | ) |
Creates a new order item.
aParams | The 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 | ||||||||||||||
orderitems_readonly | Order item is readonly in ordertrips app ('y', 'n') | no | 'n' | ||||||||||||||
orderitems_robotsplit | Perform robot splitting if applicable ('y', 'n') | no | 'y' | ||||||||||||||
orderitems_existmode | How to handle the case where a similar order item exists already:
Upper case: c_orderid, c_originfo, c_zone, c_mergeclass, c_remarks, c_readonly must be equal. | no | 'c' |
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 last order item in table t_orderitems. Multiple items may have been created in case of robot splitting and newitem=true. |
itemkeys | Key of all order item in table t_orderitems. Multiple items may have been created in case of robot splitting and newitem=true. |
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. |
newitem | True if new order item(s) was/were created, false if it already existed before. |
QVariant BpsOrderUtils::makeOrderPick | ( | const QVariantMap & | aParams | ) |
Make an order pick.
aParams | The parameters defining the pick action.
|
QVariantMap BpsOrderUtils::makePackJob | ( | const QVariantMap & | aParams | ) |
Creates or updates a packing job.
aParams | The parameters defining the packing job. |
Key | Description | Mandatory | Default |
---|---|---|---|
packprods_date | Date of the packing production | yes | n.a. |
packprods_prod | Production key | yes | n.a. |
packjobs_article | Article key | yes | n.a. |
packjobs_quantity | Quantity to pack | yes | n.a. |
packjobs_packunit | Packed units | no | t_articles.c_stock_unit |
packjobs_tu_lu | Traded units per logistic unit | no | t_articles.c_tu_lu |
packjobs_cu_tu | Consumer units per traded unit | no | t_articles.c_cu_tu |
packjobs_pu_cu | Price units per ordered unit | no | t_articles.c_pu_cu |
packjobs_cpr | Consumer price (printed on goods) | no | t_articleprices.c_cpr |
packjobs_prcd | Price code | no | t_articleprices.c_code |
packjobs_selldays | Number of selling days, counted from production/labeling date | no | t_articles.c_selldays |
packjobs_expiredays | Expires this number days after selling days | no | t_articles.c_expiredays |
packjobs_remarks | Order column remarks | no | null |
packjobs_update | "yes": If there already exists one or more matching jobs, but the sum quantity of the jobs is below packjobs_quantity, the quantity of the newest job is increased so the total quantity reaches packjobs_quantity. If no matching job exists, a new one is created with quantity = packjobs_quantity. "no": A new job is created with quantity = packjobs_quantity, no matter if there already exists one or more matching jobs. | no | "no" |
lockmode | 0: Do not lock existing packing production or job. 1: Lock existing packjob or packprod in not full mode (see lockPackjob/lockPackprod) 2: Lock existing packjob or packprod in full mode (see lockPackjob/lockPackprod) | no | 2 |
Key | Description |
---|---|
prodkey | Key of the packing production in table t_packprods. |
jobkey | Key of the packing job in table t_packjobs. |
newprod | True if a new packing production was created, false if it already existed before. |
newjob | True if a new packing job was created, false if packjobs_update was "yes" and an existing packing job was found. |
updatedjob | True if the quantity of an existing packing job was updated. |
QVariant BpsOrderUtils::makePackRec | ( | const QVariantMap & | aParams | ) |
Make a packing record.
Stock registration happens according to the settings in Central System Settings/GuiConfig/Production/Putaway
.
aParams | The parameters defining the pack action. |
Key | Description | Mandatory | Default |
---|---|---|---|
packjobs_key | Packing job key. | yes | n.a. |
packrecs_packline | Packing line number. | yes | n.a. |
packrecs_targetzone | Key of the target zone where the packed quantities are stocked to. | yes | n.a. |
packrecs_luid | Logistic unit ID. | no | null |
packrecs_grai | GRAI of the packed container. | no | null |
packrecs_lotid | Lot ID. | no | null |
packrecs_origin | Origin key. | no | null |
packrecs_producer | Producer key. | no | null |
packrecs_method | Production method key. | no | null |
packrecs_tu_lu | Traded units in one logistic unit. (integer) | no | t_packjobs.c_tu_lu |
packrecs_cu_tu | Consumer units in one traded. (integer). | no | t_packjobs.c_cu_tu |
packrecs_lus | # of whole logistic units packed. (integer) | no | null |
packrecs_tus | # of whole traded units packed. (integer) | no | null |
packrecs_cus | # of whole consumer units packed. (integer) | no | null |
packrecs_pus | Total quantity of price units packed in all given LU's, TU's and CU's. (floating point, precision 3) | no | calculated |
QVariantMap BpsOrderUtils::makePurchaseDelivery | ( | const QVariantMap & | aParams | ) |
Creates a new purchase order delivery.
aParams | The parameters defining the purchase order delivery: |
Key | Description | Mandatory | Default |
---|---|---|---|
purchaseitems_key | Key of the purchase item. | yes | n.a. |
purchasedeliveries_blocked | Block state | no | false |
purchasedeliveries_shipdate | Shipping date/time | no | Arrival date/time |
purchasedeliveries_deliverydate | Estimated delivery date/time | no | t_purchaseorders.c_deliverydate |
purchasedeliveries_deliveryid | Delivery ID (to be found on the receipt) | no | NULL |
purchasedeliveries_arrivaldate | Arrival date/time | no | Entry date/time |
purchasedeliveries_arrivalby | Key of user processing the arrival | no | Current user if arrival date is not NULL, else NULL |
purchasedeliveries_entrydate | Entry date/time | no | NULL |
purchasedeliveries_entryby | Key of user processing the entry | no | >Current user if entry date is not null, else NULL |
purchasedeliveries_targetzone | The target zone to save stock changes to if entry date is not NULL. | no | Do not save stock changes |
purchasedeliveries_carrier | Name of final carrier or vehicle ID bringing the delivery | no | NULL |
purchasedeliveries_sscc | Comma separated list of SSCC's involved (usually one per hierarchical level) | no | NULL |
purchasedeliveries_lotid | Comma separated list of lot ID's | no | NULL |
purchasedeliveries_tu_lu | Factor TU/LU | no | t_purchaseitems.c_tu_lu |
purchasedeliveries_cu_tu | Factor CU/TU | no | t_purchaseitems.c_cu_tu |
purchasedeliveries_lus | # of whole logistic units | no | Open quantity or NULL (1) |
purchasedeliveries_tus | # of whole traded units not included in LU's above | no | Open quantity or NULL (1) |
purchasedeliveries_cus | # of whole consumer units not included in LU's or TU's above | no | Open quantity or NULL (1) |
purchasedeliveries_pus | Total quantity of price units in all LU's, TU's and CU's above | no | Calculated from LU's, TU's, CU's, TU/LU, CU/TU and t_purchaseitems.c_pu_cu |
purchasedeliveries_deduction | Deduction in price units (delivered, but not accepted PU's) | no | NULL |
purchasedeliveries_retention | Retention in percent | no | NULL |
purchasedeliveries_remarks | Delivery remarks | no | NULL |
purchaseweighings | List of weighing records to save (see table in makePurchaseEntry) | no | No weighings saved |
(1) If none of LU's, TU's, CU's or PU's is given, then the open quantity of this item is used. The open quantity is calculated by subtracting all existing delivery quantities from the ordered or confirmed quantity respectively.
Key | Description |
---|---|
orderkey | Key of the order in table t_purchaseorders. |
itemkey | Key of the item in table t_purchaseitems. |
deliverykey | Key of the new created delivery in table t_purchasedeliveries. NULL if no delivery created because no quantities were given, and there is no more open quantity. |
articlekey | Key of the article as in table t_purchaseitems. |
stockkey | Key of the stock as in table t_purchasedeliveries. |
QVariantMap BpsOrderUtils::makePurchaseEntry | ( | const QVariantMap & | aParams | ) |
Registration of an entry on an existing purchase delivery.
aParams | The parameters list: |
Key | Description | Mandatory | Default |
---|---|---|---|
purchasedeliveries_key | Key of existing purchase delivery in t_purchasedeliveries. | yes | n.a. |
purchasedeliveries_blocked | Block state | no | false |
purchasedeliveries_shipdate | Shipping date/time | no | Unchanged if current value not NULL, arrival date/time otherwise |
purchasedeliveries_deliverydate | Estimated delivery date/time | no | Unchanged if current value not NULL, entry date/time otherwise |
purchasedeliveries_deliveryid | Delivery ID (to be found on the receipt) | no | Current value unchanged |
purchasedeliveries_arrivaldate | Arrival date/time | no | Unchanged if current value not NULL, entry date/time otherwise |
purchasedeliveries_arrivalby | Key of user processing the arrival | no | Unchanged if current value not NULL, entry user key otherwise |
purchasedeliveries_entrydate | Entry date/time | no | Current date/time |
purchasedeliveries_entryby | Key of user processing the entry | no | Current user |
purchasedeliveries_targetzone | The target zone to save stock changes to. | no | Do not save stock changes |
purchasedeliveries_carrier | Name of final carrier or vehicle ID bringing the delivery | no | Current value unchanged |
purchasedeliveries_sscc | Comma separated list of SSCC's involved (usually one per hierarchical level) | no | Current value unchanged |
purchasedeliveries_lotid | Comma separated list of lot ID's | no | Current value unchanged |
purchaseitems_tu_lu | Traded units per logistic unit | no | Current value unchanged |
purchaseitems_cu_tu | Consumer units per traded unit | no | Current value unchanged |
purchasedeliveries_lus | # of whole logistic units | no | 0 or leave unchanged (2) |
purchasedeliveries_tus | # of whole traded units not included in LU's | no | 0 or leave unchanged (2) |
purchasedeliveries_cus | # of whole consumer units not included in LU's or TU's | no | 0 or leave unchanged (2) |
purchasedeliveries_pus | Total quantity of price units in all LU's, TU's and CU's | no | 0 or leave unchanged (2) |
purchasedeliveries_deduction | Deduction in price units (delivered, but not accepted PU's) | no | Current value unchanged |
purchasedeliveries_retention | Retention in percent | no | Current value unchanged |
purchasedeliveries_remarks | Delivery remarks | no | Current value unchanged |
purchaseweighings | List of new weighing records to save (see next table) | no | No weighings saved |
Weighing record:
Key | Description | Mandatory | Default |
---|---|---|---|
purchaseweighings_timestamp | Date/time of weighing | yes | n.a. |
purchaseweighings_id | ID info such as animal number, ear mark etc. | no | NULL |
purchaseweighings_lus | # of whole logistic units | no | NULL |
purchaseweighings_tus | # of whole traded units not included in LU's | no | NULL |
purchaseweighings_cus | # of whole consumer units not included in LU's or TU's | no | NULL |
purchaseweighings_net | Net weight in kg | yes | n.a. |
purchaseweighings_tare | Total tare in kg | no | NULL |
purchaseweighings_deduction | Deduction in percent of net weight | no | NULL |
purchaseweighings_weighed | False = Manual entry, True = Weight from scales | no | True |
purchaseweighings_quality | Quality codes and remarks | no | NULL |
purchaseweighings_temp | Comma separated list of temperatures measured | no | NULL |
purchaseweighings_ph | Comma separated list of pH values measured | no | NULL |
purchasepackages | List of packages in this weighing (see next table) | no | No packages |
Package record:
Key | Description | Mandatory | Default |
---|---|---|---|
purchasepackages_package | Key of a package in table t_packages. | yes | n.a. |
purchasepackages_quantity | Integer number of packages. | yes | n.a. |
Key | Description |
---|---|
orderkey | Key of the order in table t_purchaseorders. |
itemkey | Key of the item in table t_purchaseitems. |
deliverykey | Key of the delivery in table t_purchasedeliveries. |
articlekey | Key of the article as in table t_purchaseitems. |
stockkey | Key of the stock as in table t_purchasedeliveries. |
QVariantMap BpsOrderUtils::makePurchaseItem | ( | const QVariantMap & | aParams | ) |
Creates a new purchase order item.
aParams | The 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 |
Key | Description |
---|---|
orderkey | Key of the new created order in table t_purchaseorders. |
itemkey | Key of the new created item in table t_purchaseitems. |
QVariant BpsOrderUtils::makeStock | ( | const QVariantMap & | aParams | ) |
Create a new stock.
In case of virtual stocks, quantities are recalculated for best human readability: The stock is represented in the leading stock unit of the article as far as possible, e.g. higher units all set to 0, lower units will represent any rest smaller than one leading stock unit. Additionally, the quantities are normalized in respect of the sign, so there will either be only values>=0, or only values<=0.
In case of physical stock, the quantities will automatically break up higher units to eliminate any negative TU or CU value, unless the higher up units are of equal size (factor 1).
aParams | The parameters defining the stock action. |
Key | Description | Mandatory | Default |
---|---|---|---|
stock_reason | The change reason, a key from t_stockreasons | yes | n.a. |
stock_article | The article key in t_articles | yes | n.a. |
stock_location | The stock location key in t_stocklocations | yes | n.a. |
stock_prio | Priority | no | t_stock validator value c_prio.default |
stock_status | Status | no | t_stock validator value c_status.default |
stock_type | Type | no | t_stock validator value c_type.default |
stock_indate | In date | no | NULL |
stock_expdate | Expire date | no | NULL |
stock_cpr | Consumer price | no | NULL |
stock_lotid | Lot ID | no | NULL |
stock_lus | Quantity for logical units | no | 0 |
stock_tus | Quantity for traded units | no | 0 |
stock_cus | Quantity for consumer units | no | 0 |
stock_tu_lu | Factor tu/lu | no | Inherit from article |
stock_cu_tu | Factor cu/tu | no | Inherit from article |
stock_pu_cu | Factor pu/cu | no | Inherit from article |
stock_remarks | Remarks | no | None |
OrderGenMode BpsOrderUtils::orderGenMode | ( | const QString & | aTripid | ) |
Get the order generation mode for a given trip ID.
aTripid | The id of the trip to check for erp exceptions. Empty string if not to be checked. |
Get the enumeration for a order unit code.
aOu | The order unit code |
Get the human readable and translated order unit name (LU, TU, CU, PU) from a order unit code ("L", "T", "C", "P").
aOu | The order unit code. |
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.
aOu | The order unit code. |
aPu | The price unit code, only used when aOu == "P". |
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).
aOu | The order unit index. |
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.
aOu | The order unit index. |
aPu | The price unit index, only used if aOu == O_PU. |
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).
aPu | The price unit code. |
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).
aPu | The price unit index. |
Get the enumeration for a price unit code.
aPu | The price unit code |
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).
aPu | The price unit code. |
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).
aPu | The price unit index. |
void BpsOrderUtils::refreshLu | ( | const QVariant & | aKey | ) |
Refresh the timestamp of the logistic unit, in case it is locked by the current actor.
aKey | The primary key value (c_key) of the record in table t_newlogisticunits. |
Get robot of a given zone.
aZone | Key of the zone. |
Get a list of all active robot.
QVariant BpsOrderUtils::saveZoneStock | ( | const QVariantMap & | aParams | ) |
Adds a quantity to an existing stock in the given zone, or creates a new stock in the zone when no existing stock was found.
VIRTUAL STOCKS
Virtual stocks are matched according to the leading stock unit of the article (t_articles.c_stock_unit). For example when the leading stock unit is TU, the factors CU/TU and PU/CU must match, but the factor TU/LU may differ.
Quantities are recalculated for best human readability: The stock is represented in the leading stock unit of the article as far as possible, e.g. higher units all set to 0, lower units will represent any rest smaller than one leading stock unit. Additionally, the quantities are normalized in respect of the sign, so there will either be only values>=0, or only values<=0.
PHYSICAL STOCKS
Physical stocks must match in all factors TU/LU, CU/TU and PU/CU.
Quantities will automatically break up higher units to eliminate any negative TU or CU value, unless the higher up units are of equal size (factor 1).
GENERAL MATCHING RULES (FOR BOTH, VIRTUAL AND PHYSICAL STOCKS)
NEW STOCK CREATION
aParams | The parameters defining the stock operation. |
Key | Description | Mandatory | Default |
---|---|---|---|
stock_zone | The zone key in t_zones | yes | n.a. |
stock_article | The article key in t_articles | yes | n.a. |
stock_reason | The (default) change reason. A key from t_stockreasons | yes | n.a. |
stock_status | Stock status to search and to use in case for new stock. | no | Search only free stocks. In case a new stock is created, use t_stock validator value c_status.default. |
stock_prio | Stock priority: used only when a new stock is created | no | t_stock validator value c_prio.default |
stock_type | Stock type: Used only when creating new stocks. | no | In case a new stock is created, t_stock validator value c_type.default |
stock_indate | In date | no | null |
stock_expdate | Expire date | no | null |
stock_cpr | Consumer price | no | null |
stock_lotid | Lot ID | no | null |
stock_lus | Quantity of logistic units | no | 0 |
stock_tus | Quantity of traded units | no | 0 |
stock_cus | Quantity of consumer units | no | 0 |
stock_tu_lu | Factor TU/LU | no | Use factor of article |
stock_cu_tu | Factor CU/TU | no | Use factor of article |
stock_pu_cu | Factor PU/CU | no | Use factor of article |
void BpsOrderUtils::setPurchaseDeliveryStock | ( | const QVariant & | aDeliveryKey, |
const QVariant & | aStockKey = QVariant() |
||
) |
Register stock of purchase delivery record.
If c_stock is not NULL or the purchase order is archived (c_status = h) nothing happens. If aStockKey and c_stock are NULL, a stock is searched and in case created as configures in Central System Settings/GuiConfig/Goods Entry/Putaway. The LU, TU and CU quantities are added to the stock and c_stock is set to the stock key.
aDeliveryKey | Key of the delivery in table t_purchasedeliveries. |
aStockKey | Key of the stock in table t_stock. |
void BpsOrderUtils::setStock | ( | const QVariantMap & | aParams | ) |
Set the absolute stock quantities and updates other fields on an existing stock.
In case of virtual stocks, quantities are recalculated for best human readability: The stock is represented in the leading stock unit of the article as far as possible, e.g. higher units all set to 0, lower units will represent any rest smaller than one leading stock unit. Additionally, the quantities are normalized in respect of the sign, so there will either be only values>=0, or only values<=0.
In case of physical stock, the quantities will automatically break up higher units to eliminate any negative TU or CU value, unless the higher up units are of equal size (factor 1).
aParams | The parameters defining the stock action. |
Key | Description | Mandatory | Default |
---|---|---|---|
stock_key | The stock key in t_stock | yes | n.a. |
stock_reason | The (default) change reason. A key from t_stockreasons | yes | n.a. |
stock_prio | Stock 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 |
Get the enumeration for a stock mode code.
aMode | The stock mode code (r, f, q) |
Get the human readable and translated stock mode name (Regular, FIFO, Quick) from a price unit code (r, f, q).
aMode | The stock mode code. |
|
static |
Get the human readable and translated stock mode name (Regular, FIFO, Quick) from a stock mode index (SM_Regular, SM_FIFO, SM_Quick).
aMode | The stock mode index. |
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.
aTripdate | The date to convert. |
void BpsOrderUtils::unlockLu | ( | const QVariant & | aKey | ) |
Unlock the logistic unit, in case it is locked by the current actor.
aKey | The primary key value (c_key) of the record in table t_newlogisticunits. |
void BpsOrderUtils::unlockOrdercol | ( | const QVariant & | aKey | ) |
Unlock the order column, in case it was locked by the current actor.
aKey | The primary key value (c_key) of the record in table t_ordercols. |
void BpsOrderUtils::unlockOrderitem | ( | const QVariant & | aKey | ) |
Unlock the order item.
aKey | The 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).
aKID | ID of the list of locked order item keys in table t_keys. |
void BpsOrderUtils::unlockOrderitems | ( | const QVariantList & | aKeys | ) |
Unlock a list of order items.
aKeys | The 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.
aKey | The primary key value (c_key) of the record in table t_orderrows. |
void BpsOrderUtils::unlockOrdertrip | ( | const QVariant & | aKey | ) |
Unlock the order trip, in case it was locked by the current actor.
aKey | The primary key value (c_key) of the record in table t_ordertrips. |
void BpsOrderUtils::unlockPackjob | ( | const QVariant & | aKey | ) |
Unlock the packing job, in case it was locked by the current actor.
aKey | The primary key value (c_key) of the record in table t_packjobs. |
void BpsOrderUtils::unlockPackprod | ( | const QVariant & | aKey | ) |
Unlock the packing production, in case it was locked by the current actor.
aKey | The primary key value (c_key) of the record in table t_packprods. |
void BpsOrderUtils::unlockPurchaseItem | ( | const QVariant & | aKey | ) |
Unlock the purchase order item, in case it was locked by the current actor.
aKey | The primary key value (c_key) of the record in table t_purchaseitems. |
void BpsOrderUtils::unlockPurchaseOrder | ( | const QVariant & | aKey | ) |
Unlock the purchase order, in case it was locked by the current actor.
aKey | The primary key value (c_key) of the record in table t_purchaseorders. |