BPS Script API  2.24.4
bps::OrderUtils Class Reference

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

Detailed Description

The OrderUtils class holds a number of utility methods for order processing.

Example:

var ds = new bps.Datastore;
with (ds) {
connection = 'lu_buv';
username = 'lu_buv';
password = 'lu_buv1';
if (!loadConnection())
throw Error("Invalid connection.\nKnown connections are: "+bps.Datastore.connections);
connect();
purgeActors();
checkin(0, "batch", "stocktest");
}
var utl = new bps.OrderUtils(ds);
utl.setStock({
stock_key: 605,
stock_reason: 0,
stock_lus: 3,
stock_tus: 5,
stock_cus: 2,
stock_tu_lu: 24,
stock_cu_tu: 10
});
ds.checkout();
ds.disconnect();
void importExtension(String aExtensionName)
Imports the named extension into the script engine.
The datastore class is used to access the BPS databases.
Definition: bps.Datastore.js:10
Array connections
A list of all connections that have been declared in the BPS configuration program.
Definition: bps.Datastore.js:147
The OrderUtils class holds a number of utility methods for order processing.
Definition: bps.OrderUtils.js:39
void setStock(Object aParams)
Set the absolute stock quantities and updates other fields on an existing stock.
The bps extension is a namespace assembling general BPS properties and functions.
Definition: bps.AsyncIO.js:1
@ Error
Some unspecified error happened.
Definition: bps.js:26

Constructor & Destructor Documentation

◆ OrderUtils()

bps::OrderUtils::OrderUtils ( Datastore  aDatastore)
Parameters
aDatastoreThe datastore connection to use.

Member Function Documentation

◆ addToStock()

void bps::OrderUtils::addToStock ( Object  aParams)

Adds or subtracts stock quantities and updates other stock fields.

Parameters
[in]aParamsThe parameters defining the stock action.
Key Description Mandatory Default
stock_key The stock key in t_stock yes n.a.
stock_reason The (default) 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

◆ adoptLu()

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.

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

Returns
Status as:
  • bps.OK if the adopting was successful and record is locked.
  • bps.Notfound If record not found in t_newlogisticunits, or maybe it was deleted while waiting.
  • bps.Locked Record exists but it was already locked and stayed locked until timeout.

◆ anyPicksOnLu()

Boolean bps::OrderUtils::anyPicksOnLu ( Number  aKey)

Check if there are any picks on the logistic unit.

Parameters
aKeyThe primary key value (c_key) of the record in table t_newlogisticunits.
Returns
True if there are any picks, false if not.

◆ cancelOrderPick()

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.

Parameters
[in]aPickKeyKey of the record in t_orderpicks.

◆ clearPackStock()

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.

Parameters
aPackRecKeyKey of the record in table t_packrecs.
Returns
Value of c_stock before clearing.

◆ clearPurchaseDeliveryStock()

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.

Parameters
aDeliveryKeyKey of the delivery in table t_purchasedeliveries.
Returns
Value of c_stock before clearing.

◆ cloneArticle()

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.

Parameters
[in]aKeyKey of the original article record.
Returns
Key of the new article record.
Exceptions
Whenoriginal article does not exist.

◆ clonePartner()

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.

Parameters
[in]aKeyKey of the original partner record.
Returns
Key of the new partner record.
Exceptions
Whenoriginal partner does not exist.

◆ cloneRecord()

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

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

◆ cprToString()

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.

Parameters
[in]aCprThe consumer price to convert.
Returns
The string representation.

◆ dprToString()

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.

Parameters
[in]aDprThe dealer price to convert.
Returns
The string representation.

◆ finalizeLu()

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.

  • Sets t_orderpicks.c_finishby and c_finishdate
  • Sets t_orderpicks.c_delivery, c_delivby and c_delivdate where c_delivery is null and any of
    • t_partner.c_billmode = 'l' (billing mode = LU)
    • Central System Settings/GuiConfig/Finalize LU:ForceDelivery = "yes"
  • Optionally add SSCC to the order picks.
  • Optionally create EPCIS events for the LU. Basic condition is BpsEpcis::isEnabled() returns true.
  • Send finalized LU back to robot when items belong to a robot subjob.
  • Delete record from t_newlogisticunits.
Parameters
aParamsThe 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
Returns
Map with informations about the operation:
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".

◆ findLockLu()

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

Parameters
aParamsParameters 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
Returns
Map with informations about the operation:
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.

◆ findLu()

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

Parameters
aParamsParameters 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
Returns
Key of the found record (luid). -1 if not found.

◆ findOrMakeSharedLu()

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.

Parameters
aParamsParameters 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
Returns
Map with informations about the operation:
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.

◆ finishOrderRow()

Number bps::OrderUtils::finishOrderRow ( Object  aParams)

Finish a order row (depreciated).

Kept for backward compatibility to older scripts. Use finishOrderRowEx for new developments.

Parameters
[in]aParamsThe parameters defining the finish action.
Returns
Delivery ID

◆ finishOrderRowEx()

Object bps::OrderUtils::finishOrderRowEx ( Object  aParams)

Finish a order row.

There are 2 modes of operation:

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

◆ finishPurchaseOrder()

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:

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

◆ getSellPrices()

Object bps::OrderUtils::getSellPrices ( Number  aArticleKey,
Date  aStartDateTime 
)

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

var utl = new bps.OrderUtils(ds);
var key = 18;
var start = new Date(2011,05,17);
var prices = utl.getSellPrices(key, start);
if (prices.hasOwnProperty('code'))
print(bps.dump(prices));
else
print('Sorry, no such prices found.');
void print(...)
Print the expressions (applying toString() if necessary) to the console standard output (stdout),...
Parameters
[in]aArticleKeyKey of the article.
[in]aStartDateTimeDate and time from when on the price is valid.
Returns
Object with the found data. If no prices found, an empty object is returned:
PropertyDescriptionType
dprDealer price foundbps.Decimal
cprConsumer price foundbps.Decimal
codePrice code foundString

◆ getStockReason()

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.

Parameters
[in]aTypeThe reason type (i+, p- etc) .
Returns
Key of the first found reason record.
Exceptions
Ifno such reason exists.

◆ getZoneMergeclass()

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):

OrderTrip ClassArticle ClassPartner Class
1***
2**null
3*null*
4*nullnull
5null**
6null*null
7nullnull*
8nullnullnull

Example:

var utl = new bps.OrderUtils(ds);
var tripClassKey = 5;
var artClassKey = 1;
var pnrClassKey = 0;
var mz = utl.getZoneMergeclass(tripClassKey, artClassKey, pnrClassKey);
if (mz.hasOwnProperty('zone'))
print(bps.dump(mz));
else
print('Sorry, no such merge class and picking zone found.');
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.
Parameters
aTripClassKeyKey of the trip class.
aArticleClassKeyKey of the article class.
aPartnerClassKeyKey of the partner class.
Returns
Object with the found data. If no zone and mergeclass found, an empty object is returned:
PropertyDescriptionType
zoneZone key foundNumber
mergeclassMerge class key foundNumber

◆ isOrdercolLocked()

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.

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_ordercols.
Returns
True if any locks are present, false if not.

◆ isOrderitemLocked()

Boolean bps::OrderUtils::isOrderitemLocked ( Number  aKey)

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

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_orderitems.
Returns
True if any locks are present, false if not.

◆ isOrderrowLocked()

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.

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_orderrows.
Returns
True if any locks are present, false if not.

◆ isOrdertripLocked()

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.

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_ordertrips.
Returns
True if any locks are present, false if not.

◆ isPackjobLocked()

Boolean bps::OrderUtils::isPackjobLocked ( Number  aKey)

Checks if the packing job or the production it belongs to are locked.

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_packjobs.
Returns
True if locked, false if not.

◆ isPackprodLocked()

Boolean bps::OrderUtils::isPackprodLocked ( Number  aKey)

Checks if the packing production or any of the jobs belonging to it are locked.

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_packprods.
Returns
True if any locks are present, false if not.

◆ isPurchaseItemLocked()

Boolean bps::OrderUtils::isPurchaseItemLocked ( Number  aKey)

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

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_purchaseitems.
Returns
True if any locks are present, false if not.

◆ isPurchaseOrderLocked()

Boolean bps::OrderUtils::isPurchaseOrderLocked ( Number  aKey)

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

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_purchaseorders.
Returns
True if any locks are present, false if not.

◆ isRobotLocked()

Boolean bps::OrderUtils::isRobotLocked ( Number  aKey)

Checks if the zone is currently robot-locked.

Parameters
[in]aKeyThe primary key value (c_key) in table t_zones.
Returns
True if any locks are present, false if not.

◆ lockOrdercol()

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.

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

◆ lockOrderitem()

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.

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

◆ lockOrderrow()

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.

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

◆ lockOrdertrip()

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.

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

◆ lockPackjob()

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.

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_packjobs.
[in]aExclusiveAllow other workers on the same job.
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
Returns
True if the lock was successful, false if not.

◆ lockPackprod()

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.

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_packprods.
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
Returns
True if the lock was successful, false if not.

◆ lockPurchaseItem()

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.

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

◆ lockPurchaseOrder()

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.

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

◆ lockRobot()

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.

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

◆ makeErpOrders()

Array bps::OrderUtils::makeErpOrders ( Array  aListOfParams)

Create ERP orders in table t_erporders and t_erporderitems.

Parameters
aListOfParamsA 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
Returns
Keys of the records created in t_erporders

◆ makeLu()

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.

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

Returns
Key of the new LU.

◆ makeOrderItem()

Number bps::OrderUtils::makeOrderItem ( Object  aParams)

Creates a new order item (depreciated).

Kept for backward compatibility to older scripts. Use makeOrderItemEx for new developments.

Parameters
aParamsObject with the parameters defining the order item (see makeOrderItemEx).
Returns
The key of the new record as t_orderitems.c_key

◆ makeOrderItemEx()

Object bps::OrderUtils::makeOrderItemEx ( Object  aParams)

Creates a new order item.

Parameters
aParamsObject with 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:
'c'Create a new item anyway.
'u'Update the existing item with the new values. Leave existing picks alone.
'a'/'A'Add the new ordered and planned quantities. Leave the rest alone.
'd'/'D'If the the new ordered quantity is not equal, add/subtract the difference to/from both ordered and planned. Don't let c_planned go below 0. Leave the rest alone.
'p'/'P'If the delta of the new ordered quantity is positive, add it to both ordered and planned. Leave the rest alone.
'i'/'I'Ignore the new item data und leave the item completely alone.
'r'/'R'Reject the new item by throwing a BpsException.
Lower case (except 'c'): c_orderid and c_originfo must equal, and c_orderid must not be empty.
Upper case: c_orderid, c_originfo, c_zone, c_mergeclass, c_remarks, c_readonly must be equal.
no 'c'
Returns
Object with informations about the operation:
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.

◆ makeOrderPick()

Number bps::OrderUtils::makeOrderPick ( Object  aParams)

Make an order pick.

Parameters
aParamsThe parameters defining the pick action.
Key Description Mandatory Default
orderitems_key Order item key. yes n.a.
orderpicks_luid Logistic unit ID. no null
orderpicks_sscc SSCC of the shipped container. no null
orderpicks_grai GRAI of the picked container. no null
orderpicks_lotid Lot ID. no t_stock.c_lotid if stock_key given, NULL otherwise.
orderpicks_packline Packing line number. no null
orderpicks_lus # of logistic units picked. (integer) no null
orderpicks_tus # of traded units picked. (integer) no null
orderpicks_cus # of consumer units picked. (integer) no null
orderpicks_pus Quantity of price units picked. (floating point, precision 3) no calculated
orderpicks_tu_lu Traded units in one logistic unit picked. (integer)
May cause a stock splitting if it differs from t_stock.c_tu_lu.
no t_stock.c_tu_lu (t_ordercol.c_tu_lu when no stock)
orderpicks_cu_tu Consumer units in one traded unit picked. (integer).
May cause a stock splitting if it differs from t_stock.c_cu_tu.
no t_stock.c_cu_tu (t_ordercol.c_cu_tu when no stock)
orderpicks_pu_cu Nominal price units in one consumer unit picked. (integer).
May cause a stock splitting if it differs from t_stock.c_pu_cu.
no t_stock.c_pu_cu (t_ordercol.c_pu_cu when no stock)
stock_key The stock to take the picked amounts from.
If a value is given, the stock update will happen in the same transaction as the pick record gets created.
The parameter is taken as the key of the desired stock in table t_stock. The stock must have the status free and be for the same article as the order column.
If registration on the given stock is not possible because of factor mismatch (tu_lu, cu_tu), the function may search and use another free stock for the same article on the same stock location where the factors are matching. If finally no such stock is found, the function will create a new stock cloning the original stock, but with the factors of the pick (automatic stock splitting).
This parameter has precedence over stock_auto.
no null
stock_auto Automatically select a stock if this parameter is given as string "yes".
Only used when stock_key is not given.
An existing stock is searched as:
  • In the zone of the item
  • With status free
  • On a stock location with status open or drawing
Order the found stocks first by stock priority and second by stock location, then take the first stock.
If no such stock is found, the pick will be done without any stock operation.
no "no"
Returns
The key of the new record as t_orderpicks.c_key

◆ makePackJob()

Object bps::OrderUtils::makePackJob ( Object  aParams)

Creates a new packing job.

Parameters
[in]aParamsThe 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

If this parameter is given as "yes", a new job is only created if there exists no similar job yet (except for key, quantity, remarks and shadow sums). When such jobs exist already and the new quantity is bigger that the sum of existing quantities, the newest job is increased by the delta quantity.

If this parameter is "no" (the default), or there exist no similar jobs, a new job is created.

no "no"
Returns
Map with informations about the operation:
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.

◆ makePackRec()

Number bps::OrderUtils::makePackRec ( Object  aParams)

Make a packing record.

Stock registration happens according to the settings in Central System Settings/GuiConfig/Production/Putaway.

Parameters
aParamsThe 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
Returns
The key of the new record as t_packrecs.c_key

◆ makePurchaseDelivery()

Object bps::OrderUtils::makePurchaseDelivery ( Object  aParams)

Creates a new purchase order delivery.

  • In case the PU quantity is smaller/equal 0 or is NULL, or the purchase order is archived (c_status = h), no delivery is created.
Parameters
aParamsThe 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.

Returns
Map with informations about the operation:
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.

◆ makePurchaseEntry()

Object bps::OrderUtils::makePurchaseEntry ( Object  aParams)

Registration of an entry on an existing purchase delivery.

  • Nothing is done when the purchase order is archived (c_status = h).
  • Existing old weighings and packages are deleted in advance.
  • Existing old stock registrations are subtracted in advance.
Parameters
aParamsThe 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.
  • (2) The current value is unchanged if no LU, TU, CU or PU quantity given, to confirm entry of the planned quantities. The value is set to NULL if any of the LU, TU, CU or PU quantities was given.
Returns
Map with informations about the operation:
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.

◆ makePurchaseItem()

Object bps::OrderUtils::makePurchaseItem ( Object  aParams)

Creates a new purchase order item.

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

◆ makeSSCC()

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.

Returns
The created SSCC in EPCIS format. Example: "7617007.3000999991"

◆ makeStock()

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

Parameters
[in]aParamsThe parameters defining the stock action.
Key Description Mandatory Default
article_key The article key in t_articles yes n.a.
location_key The stock location key in t_stocklocations yes n.a.
stock_reason The change reason, a key from t_stockreasons yes n.a.
stock_prio Priority no Validator value c_prio.default
stock_status Status no Validator value c_status.default
stock_type Type no 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
Returns
Key of the new stock in table t_stock.

◆ orderUnitName()

static String bps::OrderUtils::orderUnitName ( String  aOu)
static

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

static String orderUnitName(String aOu)
Get the human readable and translated order unit name (LU, TU, CU, PU) from a order unit code (L,...
Note
It is common to use the English abbreviations LU, TU, CU and PU also in the other languages.
Parameters
[in]aOuThe order unit code.
Returns
The human readable translated order unit name.

◆ priceUnitAbbreviation()

static String bps::OrderUtils::priceUnitAbbreviation ( String  aPu)
static

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

print( bps.OrderUtils.priceUnitAbbreviation('p') ); // PCS, STK, PEZ - depending on current language
static String priceUnitAbbreviation(String aPu)
Get the abbreviated, maximum 3 character price unit name (PCS, KG, L, M, M2, M3) from a price unit co...
Parameters
[in]aPuThe price unit code.
Returns
The price unit abbreviation.

◆ priceUnitName()

static String bps::OrderUtils::priceUnitName ( String  aPu)
static

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

print( bps.OrderUtils.priceUnitName('p') ); // Piece, Stück, Pièce, Pezzi - depending on current language
static String priceUnitName(String aPu)
Get the human readable and translated price unit name (Piece, Kilo, Liter, Meter, M2,...
Parameters
[in]aPuThe price unit code.
Returns
The human readable translated price unit name.

◆ refreshLu()

void bps::OrderUtils::refreshLu ( Number  aKey)

Refresh the timestamp of the logistic unit, in case it is locked by the current actor.

Parameters
aKeyThe primary key value (c_key) of the record in table t_newlogisticunits.

◆ setStock()

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

Parameters
[in]aParamsThe parameters defining the stock action.
Key Description Mandatory Default
stock_key The stock key in t_stock yes n.a.
stock_reason The (default) change reason. A key from t_stockreasons yes n.a.
stock_reason_zero The change reason to use instead of stock_reason if the overall quantity is 0. A key from t_stockreasons no Use stock_reason
stock_reason_minus The change reason to use instead of stock_reason if the overall quantity is negative. A key from t_stockreasons no Use stock_reason
stock_article The article key in t_articles no Keep old article
stock_location The stock location key in t_stocklocations no Keep old stock location
stock_prio New priority no Keep old priority
stock_status New status no Keep old status
stock_type New type no Keep old type
stock_indate New in date no Keep old in date
stock_expdate New expire date no Keep old expire date
stock_cpr New consumer price no Keep old consumer price
stock_lotid New lot ID no Keep old lot ID
stock_lus New quantity for logical units no 0
stock_tus New quantity for traded units no 0
stock_cus New quantity for consumer units no 0
stock_tu_lu New factor tu/lu no Keep existing factor
stock_cu_tu New factor cu/tu no Keep existing factor
stock_pu_cu New factor pu/cu no Keep existing factor
stock_remarks New remarks no Keep existing remarks

◆ SSCC18toSSCC()

String bps::OrderUtils::SSCC18toSSCC ( String  aSscc18,
Number  aGcpSize = 0 
)

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.

Parameters
[in]aSscc18The SSCC to convert. Example: "376170070009999913"
aGcpSizeSize of the GS1 Company Prefix. Valid range is 4 to 12.
Returns
The SSCC in EPCIS format. Example: "7617007.3000999991"

◆ SSCCtoSSCC18()

String bps::OrderUtils::SSCCtoSSCC18 ( String  aSscc)

Convert a SSCC from EPCIS to scanner format (SSCC18).

Parameters
[in]aSsccThe SSCC in EPCIS format to convert. Example: "7617007.3000999991"
Returns
The SSCC in scanner format. Example: "376170070009999913"

◆ stockModeName()

static String bps::OrderUtils::stockModeName ( String  aMode)
static

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

print( bps.OrderUtils.stockModeName('r') ); // Regular, Normal, Regolare - depending on current language
static String stockModeName(String aMode)
Get the human readable and translated stock mode name (Regular, FIFO, Quick) from a price unit code (...
Parameters
[in]aModeThe stock mode code.
Returns
The human readable translated stock mode name.

◆ tripdateToString()

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.

Parameters
[in]aTripdateThe date to convert.
Returns
The string representation.

◆ unlockLu()

void bps::OrderUtils::unlockLu ( Number  aKey)

Unlock the logistic unit, in case it is locked by the current actor.

Parameters
aKeyThe primary key value (c_key) of the record in table t_newlogisticunits.

◆ unlockOrdercol()

void bps::OrderUtils::unlockOrdercol ( Number  aKey)

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

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_ordercols.

◆ unlockOrderitem()

void bps::OrderUtils::unlockOrderitem ( Number  aKey)

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

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_orderitems.

◆ unlockOrderrow()

void bps::OrderUtils::unlockOrderrow ( Number  aKey)

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

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_orderrows.

◆ unlockOrdertrip()

void bps::OrderUtils::unlockOrdertrip ( Number  aKey)

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

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_ordertrips.

◆ unlockPackjob()

void bps::OrderUtils::unlockPackjob ( Number  aKey)

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

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_packjobs.

◆ unlockPackprod()

void bps::OrderUtils::unlockPackprod ( Number  aKey)

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

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_packprods.

◆ unlockPurchaseItem()

void bps::OrderUtils::unlockPurchaseItem ( Number  aKey)

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

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_purchaseitems.

◆ unlockPurchaseOrder()

void bps::OrderUtils::unlockPurchaseOrder ( Number  aKey)

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

Parameters
[in]aKeyThe primary key value (c_key) of the record in table t_purchaseorders.

◆ unlockRobot()

void bps::OrderUtils::unlockRobot ( Number  aKey)

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

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

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