The OrderUtils class holds a number of utility methods for order processing. More...
Public Member Functions | |
void | addToStock (Object aParams) |
Adds or subtracts stock quantities and updates other stock fields. More... | |
Number | adoptLu (Object aParams) |
Adopt an orphaned new logistic unit. More... | |
Boolean | anyPicksOnLu (Number aKey) |
Check if there are any picks on the logistic unit. More... | |
void | cancelOrderPick (Number aPickKey) |
Cancel an existing pick by deleting the record in t_orderpicks. More... | |
Number | clearPackStock (Number aPackRecKey) |
Clear stock registration of a packing record. More... | |
Number | clearPurchaseDeliveryStock (Number aDeliveryKey) |
Clear stock registration of purchase delivery record. More... | |
Number | cloneArticle (Number aKey) |
Make an exact copy of the original article, with exception of the key. More... | |
Number | clonePartner (Number aKey) |
Make an exact copy of the original partner, with exception of the key. More... | |
Number | cloneRecord (Number aKey, String aName) |
Make an exact copy of an arbitrary BPS record, with exception of the key. More... | |
String | cprToString (Number aCpr) |
Convert a consumer price to string. More... | |
String | dprToString (Number aDpr) |
Convert a dealer price to string. More... | |
Object | finalizeLu (Object aParams) |
Finalize a logistic unit. More... | |
Object | findLockLu (Object aParams) |
Find and lock an orphaned new logistic unit. More... | |
Number | findLu (Object aParams) |
Find a new logistic unit. More... | |
Object | findOrMakeSharedLu (Object aParams) |
Find and lock an orphaned new logistic unit, or create a new one. More... | |
Number | finishOrderRow (Object aParams) |
Finish a order row (depreciated). More... | |
Object | finishOrderRowEx (Object aParams) |
Finish a order row. More... | |
Boolean | finishPurchaseOrder (Number aOrderKey, Boolean aLock=false, Number aTimeout=0) |
Finishes a purchase order having the status ready, active or completed, and not having any blocked deliveries. More... | |
Object | getSellPrices (Number aArticleKey, Date aStartDateTime) |
Find the prices for a certain article and starting date/time. More... | |
Number | getStockReason (String aType) |
Get the stock reason for a certain type from table t_stockreasons. More... | |
Object | getZoneMergeclass (Number aTripClassKey, Number aArticleClassKey, Number aPartnerClassKey) |
Get the zone and merge class for a combination of trip class, article class and partner class. More... | |
Boolean | isOrdercolLocked (Number aKey) |
Checks if the order column, the order trip, or any of the details belonging to the column are locked. More... | |
Boolean | isOrderitemLocked (Number aKey) |
Checks if the order detail or any parent record is locked. More... | |
Boolean | isOrderrowLocked (Number aKey) |
Checks if the order row, the order trip or any of the details belonging to the row are locked. More... | |
Boolean | isOrdertripLocked (Number aKey) |
Checks if the order trip or any of the order rows, columns or details belonging to it are locked. More... | |
Boolean | isPackjobLocked (Number aKey) |
Checks if the packing job or the production it belongs to are locked. More... | |
Boolean | isPackprodLocked (Number aKey) |
Checks if the packing production or any of the jobs belonging to it are locked. More... | |
Boolean | isPurchaseItemLocked (Number aKey) |
Checks if the purchase order item or the parent purchase order record is locked. More... | |
Boolean | isPurchaseOrderLocked (Number aKey) |
Checks if the purchase order or any of the items belonging to the order are locked. More... | |
Boolean | isRobotLocked (Number aKey) |
Checks if the zone is currently robot-locked. More... | |
Boolean | lockOrdercol (Number aKey, Number aTimeout=0) |
Lock an order column. More... | |
Boolean | lockOrderitem (Number aKey, Number aTimeout=0) |
Lock an order detail. More... | |
Boolean | lockOrderrow (Number aKey, Number aTimeout=0) |
Lock an order row. More... | |
Boolean | lockOrdertrip (Number aKey, Number aTimeout=0) |
Lock an order trip. More... | |
Boolean | lockPackjob (Number aKey, Boolean aExclusive=true, int aTimeout=0) |
Lock a packing job. More... | |
Boolean | lockPackprod (Number aKey, Number aTimeout=0) |
Lock an packing production. More... | |
Boolean | lockPurchaseItem (Number aKey, Number aTimeout=0) |
Lock a purchase order item. More... | |
Boolean | lockPurchaseOrder (Number aKey, Number aTimeout=0) |
Lock a purchase order. More... | |
Boolean | lockRobot (Number aKey, Number aTimeout=0) |
Lock a zone for exclusive robot access. More... | |
Array | makeErpOrders (Array aListOfParams) |
Create ERP orders in table t_erporders and t_erporderitems. More... | |
Number | makeLu (Object aParams) |
Create a new logistic unit. More... | |
Number | makeOrderItem (Object aParams) |
Creates a new order item (depreciated). More... | |
Object | makeOrderItemEx (Object aParams) |
Creates a new order item. More... | |
Number | makeOrderPick (Object aParams) |
Make an order pick. More... | |
Object | makePackJob (Object aParams) |
Creates a new packing job. More... | |
Number | makePackRec (Object aParams) |
Make a packing record. More... | |
Object | makePurchaseDelivery (Object aParams) |
Creates a new purchase order delivery. More... | |
Object | makePurchaseEntry (Object aParams) |
Registration of an entry on an existing purchase delivery. More... | |
Object | makePurchaseItem (Object aParams) |
Creates a new purchase order item. More... | |
String | makeSSCC () |
Create a SSCC from the prefix stored in the settings and sequence s_ssccval as serial number. More... | |
Number | makeStock (Object aParams) |
Create a new stock. More... | |
OrderUtils (Datastore aDatastore) | |
void | refreshLu (Number aKey) |
Refresh the timestamp of the logistic unit, in case it is locked by the current actor. More... | |
void | setStock (Object aParams) |
Set the absolute stock quantities and updates other fields on an existing stock. More... | |
String | SSCC18toSSCC (String aSscc18, Number aGcpSize=0) |
Convert a scanned SSCC18 to the format used in EPCIS. More... | |
String | SSCCtoSSCC18 (String aSscc) |
Convert a SSCC from EPCIS to scanner format (SSCC18). More... | |
String | tripdateToString (Date aTripdate) |
Convert a order trip date to string. More... | |
void | unlockLu (Number aKey) |
Unlock the logistic unit, in case it is locked by the current actor. More... | |
void | unlockOrdercol (Number aKey) |
Unlock the order column, in case it was locked by the current actor. More... | |
void | unlockOrderitem (Number aKey) |
Unlock the order detail, in case it was locked by the current actor. More... | |
void | unlockOrderrow (Number aKey) |
Unlock the order row, in case it was locked by the current actor. More... | |
void | unlockOrdertrip (Number aKey) |
Unlock the order trip, in case it was locked by the current actor. More... | |
void | unlockPackjob (Number aKey) |
Unlock the packing job, in case it was locked by the current actor. More... | |
void | unlockPackprod (Number aKey) |
Unlock the packing production, in case it was locked by the current actor. More... | |
void | unlockPurchaseItem (Number aKey) |
Unlock the purchase order item, in case it was locked by the current actor. More... | |
void | unlockPurchaseOrder (Number aKey) |
Unlock the purchase order, in case it was locked by the current actor. More... | |
void | unlockRobot (Number aKey) |
Unlock the zone, in case it was locked by the current actor. More... | |
Static Public Member Functions | |
static String | orderUnitName (String 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 String | priceUnitAbbreviation (String 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 String | priceUnitName (String 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 String | stockModeName (String aMode) |
Get the human readable and translated stock mode name (Regular, FIFO, Quick) from a price unit code (r, f, q). More... | |
The OrderUtils class holds a number of utility methods for order processing.
Example:
bps::OrderUtils::OrderUtils | ( | Datastore | aDatastore | ) |
aDatastore | The datastore connection to use. |
void bps::OrderUtils::addToStock | ( | Object | aParams | ) |
Adds or subtracts stock quantities and updates other stock fields.
[in] | aParams | The parameters defining the stock action.
|
Number bps::OrderUtils::adoptLu | ( | Object | 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.
Boolean bps::OrderUtils::anyPicksOnLu | ( | Number | 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. |
void bps::OrderUtils::cancelOrderPick | ( | Number | 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.
[in] | aPickKey | Key of the record in t_orderpicks. |
Number bps::OrderUtils::clearPackStock | ( | Number | aPackRecKey | ) |
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. |
Number bps::OrderUtils::clearPurchaseDeliveryStock | ( | Number | aDeliveryKey | ) |
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. |
Number bps::OrderUtils::cloneArticle | ( | Number | 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.
[in] | aKey | Key of the original article record. |
When | original article does not exist. |
Number bps::OrderUtils::clonePartner | ( | Number | 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.
[in] | aKey | Key of the original partner record. |
When | original partner does not exist. |
Number bps::OrderUtils::cloneRecord | ( | Number | aKey, |
String | 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_.
[in] | aKey | Key of the original record. |
[in] | aName | Name of the table and sequence, without prefixes. |
When | original record does not exist. |
String bps::OrderUtils::cprToString | ( | Number | 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.
[in] | aCpr | The consumer price to convert. |
String bps::OrderUtils::dprToString | ( | Number | 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.
[in] | aDpr | The dealer price to convert. |
Object bps::OrderUtils::finalizeLu | ( | Object | 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". |
Object bps::OrderUtils::findLockLu | ( | Object | 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. |
Number bps::OrderUtils::findLu | ( | Object | 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 |
Object bps::OrderUtils::findOrMakeSharedLu | ( | Object | 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. |
Number bps::OrderUtils::finishOrderRow | ( | Object | aParams | ) |
Finish a order row (depreciated).
Kept for backward compatibility to older scripts. Use finishOrderRowEx for new developments.
[in] | aParams | The parameters defining the finish action. |
Object bps::OrderUtils::finishOrderRowEx | ( | Object | aParams | ) |
Finish a order row.
There are 2 modes of operation:
[in] | aParams | The parameters defining the finish action.
|
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. |
Boolean bps::OrderUtils::finishPurchaseOrder | ( | Number | aOrderKey, |
Boolean | aLock = false , |
||
Number | aTimeout = 0 |
||
) |
Finishes a purchase order having the status ready, active or completed, and not having any blocked deliveries.
The following tasks are performed:
[in] | aOrderKey | Key of the purchase order (t_purchaseorders.c_key) |
[in] | aLock | True = lock the order while processing. False = do not lock/unlock (because order was locked in advance). |
[in] | aTimeout | Locking time out in seconds. Special values: 0 = no wait, -1 = wait endless. |
Object bps::OrderUtils::getSellPrices | ( | Number | aArticleKey, |
Date | aStartDateTime | ||
) |
Find the prices for a certain article and starting date/time.
[in] | aArticleKey | Key of the article. |
[in] | aStartDateTime | Date and time from when on the price is valid. |
Property | Description | Type |
---|---|---|
dpr | Dealer price found | bps.Decimal |
cpr | Consumer price found | bps.Decimal |
code | Price code found | String |
Number bps::OrderUtils::getStockReason | ( | String | aType | ) |
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. Typically this method is used to look up non-manual reasons.
[in] | aType | The reason type (i+, p- etc) . |
If | no such reason exists. |
Object bps::OrderUtils::getZoneMergeclass | ( | Number | aTripClassKey, |
Number | aArticleClassKey, | ||
Number | aPartnerClassKey | ||
) |
Get the zone and merge class for a combination of trip class, article class and partner class.
The method tries possible combinations in the order below and returns an empty object if none found (* = match with given key):
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 |
Example:
aTripClassKey | Key of the trip class. |
aArticleClassKey | Key of the article class. |
aPartnerClassKey | Key of the partner class. |
Property | Description | Type |
---|---|---|
zone | Zone key found | Number |
mergeclass | Merge class key found | Number |
Boolean bps::OrderUtils::isOrdercolLocked | ( | Number | aKey | ) |
Checks if the order column, the order trip, or any of the details belonging to the column are locked.
[in] | aKey | The primary key value (c_key) of the record in table t_ordercols. |
Boolean bps::OrderUtils::isOrderitemLocked | ( | Number | aKey | ) |
Checks if the order detail or any parent record is locked.
[in] | aKey | The primary key value (c_key) of the record in table t_orderitems. |
Boolean bps::OrderUtils::isOrderrowLocked | ( | Number | aKey | ) |
Checks if the order row, the order trip or any of the details belonging to the row are locked.
[in] | aKey | The primary key value (c_key) of the record in table t_orderrows. |
Boolean bps::OrderUtils::isOrdertripLocked | ( | Number | aKey | ) |
Checks if the order trip or any of the order rows, columns or details belonging to it are locked.
[in] | aKey | The primary key value (c_key) of the record in table t_ordertrips. |
Boolean bps::OrderUtils::isPackjobLocked | ( | Number | aKey | ) |
Checks if the packing job or the production it belongs to are locked.
[in] | aKey | The primary key value (c_key) of the record in table t_packjobs. |
Boolean bps::OrderUtils::isPackprodLocked | ( | Number | aKey | ) |
Checks if the packing production or any of the jobs belonging to it are locked.
[in] | aKey | The primary key value (c_key) of the record in table t_packprods. |
Boolean bps::OrderUtils::isPurchaseItemLocked | ( | Number | aKey | ) |
Checks if the purchase order item or the parent purchase order record is locked.
[in] | aKey | The primary key value (c_key) of the record in table t_purchaseitems. |
Boolean bps::OrderUtils::isPurchaseOrderLocked | ( | Number | aKey | ) |
Checks if the purchase order or any of the items belonging to the order are locked.
[in] | aKey | The primary key value (c_key) of the record in table t_purchaseorders. |
Boolean bps::OrderUtils::isRobotLocked | ( | Number | aKey | ) |
Checks if the zone is currently robot-locked.
[in] | aKey | The primary key value (c_key) in table t_zones. |
Boolean bps::OrderUtils::lockOrdercol | ( | Number | aKey, |
Number | 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.
[in] | aKey | The primary key value (c_key) of the record in table t_ordercols. |
[in] | aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
Boolean bps::OrderUtils::lockOrderitem | ( | Number | aKey, |
Number | aTimeout = 0 |
||
) |
Lock an order detail.
This lock will only succeed when no other actor has locked the detail record.
[in] | aKey | The primary key value (c_key) of the record in table t_orderitems. |
[in] | aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
Boolean bps::OrderUtils::lockOrderrow | ( | Number | aKey, |
Number | 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.
[in] | aKey | The primary key value (c_key) of the record in table t_orderrows. |
[in] | aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
Boolean bps::OrderUtils::lockOrdertrip | ( | Number | aKey, |
Number | aTimeout = 0 |
||
) |
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.
[in] | aKey | The primary key value (c_key) of the record in table t_ordertrips. |
[in] | aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
Boolean bps::OrderUtils::lockPackjob | ( | Number | aKey, |
Boolean | aExclusive = true , |
||
int | aTimeout = 0 |
||
) |
Lock a packing job.
This lock will only succeed when no other actor has locked the packing job or the production it belongs to.
[in] | aKey | The primary key value (c_key) of the record in table t_packjobs. |
[in] | aExclusive | Allow other workers on the same job. |
[in] | aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
Boolean bps::OrderUtils::lockPackprod | ( | Number | aKey, |
Number | aTimeout = 0 |
||
) |
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.
[in] | aKey | The primary key value (c_key) of the record in table t_packprods. |
[in] | aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
Boolean bps::OrderUtils::lockPurchaseItem | ( | Number | aKey, |
Number | 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.
[in] | aKey | The primary key value (c_key) of the record in table t_purchaseitems. |
[in] | aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
Boolean bps::OrderUtils::lockPurchaseOrder | ( | Number | aKey, |
Number | 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.
[in] | aKey | The primary key value (c_key) of the record in table t_purchaseorders. |
[in] | aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
Boolean bps::OrderUtils::lockRobot | ( | Number | aKey, |
Number | aTimeout = 0 |
||
) |
Lock a zone for exclusive robot access.
This lock will only succeed when no other actor has locked the robot.
[in] | aKey | The primary key value (c_key) in table t_zones. |
[in] | aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
Array bps::OrderUtils::makeErpOrders | ( | Array | aListOfParams | ) |
Create ERP orders in table t_erporders and t_erporderitems.
aListOfParams | 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_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 |
Number bps::OrderUtils::makeLu | ( | Object | 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.
Number bps::OrderUtils::makeOrderItem | ( | Object | aParams | ) |
Creates a new order item (depreciated).
Kept for backward compatibility to older scripts. Use makeOrderItemEx for new developments.
aParams | Object with the parameters defining the order item (see makeOrderItemEx). |
Object bps::OrderUtils::makeOrderItemEx | ( | Object | aParams | ) |
Creates a new order item.
aParams | Object with the parameters defining the order item.
|
Property | 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. |
Number bps::OrderUtils::makeOrderPick | ( | Object | aParams | ) |
Make an order pick.
aParams | The parameters defining the pick action.
|
Object bps::OrderUtils::makePackJob | ( | Object | aParams | ) |
Creates a new packing job.
[in] | aParams | The parameters defining the packing job.
|
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. |
Number bps::OrderUtils::makePackRec | ( | Object | 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 |
Object bps::OrderUtils::makePurchaseDelivery | ( | Object | 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. |
Object bps::OrderUtils::makePurchaseEntry | ( | Object | 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. |
Object bps::OrderUtils::makePurchaseItem | ( | Object | aParams | ) |
Creates a new purchase order item.
[in] | aParams | The parameters defining the purchase order item.
|
Property | Description |
---|---|
orderkey | Key of the new created order in table t_purchaseorders. |
itemkey | Key of the new created item in table t_purchaseitems. |
String bps::OrderUtils::makeSSCC | ( | ) |
Create a SSCC from the prefix stored in the settings and sequence s_ssccval as serial number.
The prefix should be the GS1 Company Prefix (4 to 12 digits), followed by a dot and more optional fixed digits identifying this BPS system in case you have multiple systems creating SSCC's. The total size of the prefix should not exceed 13 characters, leaving at least 5 for the running number.
The prefix is stored in the value EPCIS/SsccPrefix in the Central System Settings.
Number bps::OrderUtils::makeStock | ( | Object | 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).
[in] | aParams | The parameters defining the stock action.
|
Get the human readable and translated order unit name (LU, TU, CU, PU) from a order unit code (L, T, C, P).
[in] | aOu | The order unit code. |
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).
[in] | 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).
[in] | aPu | The price unit code. |
void bps::OrderUtils::refreshLu | ( | Number | 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. |
void bps::OrderUtils::setStock | ( | Object | 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).
[in] | aParams | The parameters defining the stock action.
|
Convert a scanned SSCC18 to the format used in EPCIS.
The partitioning depends on the size of the company ID assigned by GS1. If the value given in aIdSize is not in the valid range, it is taken from SSCC prefix in the Central System Settings in EPCIS/SsccPrefix.
[in] | aSscc18 | The SSCC to convert. Example: "376170070009999913" |
aGcpSize | Size of the GS1 Company Prefix. Valid range is 4 to 12. |
Convert a SSCC from EPCIS to scanner format (SSCC18).
[in] | aSscc | The SSCC in EPCIS format to convert. Example: "7617007.3000999991" |
Get the human readable and translated stock mode name (Regular, FIFO, Quick) from a price unit code (r, f, q).
[in] | aMode | The stock mode code. |
String bps::OrderUtils::tripdateToString | ( | Date | 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.
[in] | aTripdate | The date to convert. |
void bps::OrderUtils::unlockLu | ( | Number | 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 bps::OrderUtils::unlockOrdercol | ( | Number | aKey | ) |
Unlock the order column, in case it was locked by the current actor.
[in] | aKey | The primary key value (c_key) of the record in table t_ordercols. |
void bps::OrderUtils::unlockOrderitem | ( | Number | aKey | ) |
Unlock the order detail, in case it was locked by the current actor.
[in] | aKey | The primary key value (c_key) of the record in table t_orderitems. |
void bps::OrderUtils::unlockOrderrow | ( | Number | aKey | ) |
Unlock the order row, in case it was locked by the current actor.
[in] | aKey | The primary key value (c_key) of the record in table t_orderrows. |
void bps::OrderUtils::unlockOrdertrip | ( | Number | aKey | ) |
Unlock the order trip, in case it was locked by the current actor.
[in] | aKey | The primary key value (c_key) of the record in table t_ordertrips. |
void bps::OrderUtils::unlockPackjob | ( | Number | aKey | ) |
Unlock the packing job, in case it was locked by the current actor.
[in] | aKey | The primary key value (c_key) of the record in table t_packjobs. |
void bps::OrderUtils::unlockPackprod | ( | Number | aKey | ) |
Unlock the packing production, in case it was locked by the current actor.
[in] | aKey | The primary key value (c_key) of the record in table t_packprods. |
void bps::OrderUtils::unlockPurchaseItem | ( | Number | aKey | ) |
Unlock the purchase order item, in case it was locked by the current actor.
[in] | aKey | The primary key value (c_key) of the record in table t_purchaseitems. |
void bps::OrderUtils::unlockPurchaseOrder | ( | Number | aKey | ) |
Unlock the purchase order, in case it was locked by the current actor.
[in] | aKey | The primary key value (c_key) of the record in table t_purchaseorders. |
void bps::OrderUtils::unlockRobot | ( | Number | aKey | ) |
Unlock the zone, in case it was locked by the current actor.
[in] | aKey | The primary key value (c_key) in table t_zones. |