Documents > BPS V2 Script API
bps::OrderUtils Class Reference

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

List of all members.

Public Member Functions

void addToStock (Object aParams)
 Adds or subtracts stock quantities and updates other stock fields.
void cancelOrderPick (Number aPickKey)
 Cancel an existing pick by deleting the record in t_orderpicks.
Number cloneArticle (Number aKey)
 Make an exact copy of the original article, with exception of the key.
Number clonePartner (Number aKey)
 Make an exact copy of the original partner, with exception of the key.
Number cloneRecord (Number aKey, String aName)
 Make an exact copy of an arbitrary BPS record, with exception of the key.
String cprToString (Number aCpr)
 Convert a consumer price to string.
String dprToString (Number aDpr)
 Convert a dealer price to string.
Number finishOrderRow (Object aParams)
 Finish a order row (depreciated).
Object finishOrderRowEx (Object aParams)
 Finish a order row.
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.
Boolean getSellPrices (Object aParams)
 Find the prices for a certain article and starting date/time.
Boolean getZoneMergeclass (Object aParams)
 Get the zone and merge class for a combination of trip, article and partner class.
Boolean isOrdercolLocked (Number aKey)
 Checks if the order column, the open trip, or any of the details belonging to the column are locked.
Boolean isOrderitemLocked (Number aKey)
 Checks if the order detail or any parent record is locked.
Boolean isOrderrowLocked (Number aKey)
 Checks if the order row, the open trip or any of the details belonging to the row are locked.
Boolean isOrdertripLocked (Number aKey)
 Checks if the open trip or any of the order rows, columns or details belonging to it are locked.
Boolean isPurchaseItemLocked (Number aKey)
 Checks if the purchase order item or the parent purchase order record is locked.
Boolean isPurchaseOrderLocked (Number aKey)
 Checks if the purchase order or any of the items belonging to the order are locked.
Boolean isRobotLocked (Number aKey)
 Checks if the zone is currently robot-locked.
Boolean lockOrdercol (Number aKey, Number aTimeout=0)
 Lock an order column.
Boolean lockOrderitem (Number aKey, Number aTimeout=0)
 Lock an order detail.
Boolean lockOrderrow (Number aKey, Number aTimeout=0)
 Lock an order row.
Boolean lockOrdertrip (Number aKey, Number aTimeout=0)
 Lock an open trip.
Boolean lockPurchaseItem (Number aKey, Number aTimeout=0)
 Lock a purchase order item.
Boolean lockPurchaseOrder (Number aKey, Number aTimeout=0)
 Lock a purchase order.
Boolean lockRobot (Number aKey, Number aTimeout=0)
 Lock a zone for exclusive robot access.
Number makeOrderItem (Object aParams)
 Creates a new order item (depreciated).
Object makeOrderItemEx (Object aParams)
 Creates a new order item.
Number makeOrderPick (Object aParams)
 Make an order pick.
Object makePurchaseItem (Object aParams)
 Creates a new purchase order item.
 OrderUtils (Datastore aDatastore)
void setStock (Object aParams)
 Set the absolute stock quantities and updates other fields.
String tripdateToString (Date aTripdate)
 Convert a order trip date to string.
void unlockOrdercol (Number aKey)
 Unlock the order column, in case it was locked by the current actor.
void unlockOrderitem (Number aKey)
 Unlock the order detail, in case it was locked by the current actor.
void unlockOrderrow (Number aKey)
 Unlock the order row, in case it was locked by the current actor.
void unlockOrdertrip (Number aKey)
 Unlock the open trip, in case it was locked by the current actor.
void unlockPurchaseItem (Number aKey)
 Unlock the purchase order item, in case it was locked by the current actor.
void unlockPurchaseOrder (Number aKey)
 Unlock the purchase order, in case it was locked by the current actor.
void unlockRobot (Number aKey)
 Unlock the zone, in case it was locked by the current actor.

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

Detailed Description

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

Example:

 importExtension('bps');
 
 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();

Constructor & Destructor Documentation

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

Member Function Documentation

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

Adds or subtracts stock quantities and updates other stock fields.

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

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

Parameters:
[in]aKeyKey of the original partner record.
Returns:
Key of the new partner record.
Exceptions:
BpsExceptionwhen 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_.

 // clone a resource in update safe manner
 QVariant key = utils->cloneRecord(oldKey, bStr("resources"));
Parameters:
[in]aKeyKey of the original record.
[in]aNameName of the table and sequence, without prefixes.
Returns:
Key of the new article record.
Exceptions:
BpsExceptionwhen original record does not exist.
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.
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.
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
Object bps::OrderUtils::finishOrderRowEx ( Object  aParams)

Finish a order row.

Parameters:
[in]aParamsThe parameters defining the finish action.
Key Description Mandatory Default
orderrows_key Order row key 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. At final delivery a zero picking record will be added if no pick record is yet present. Also, t_orderitems.c_planned will get shortened to the picked units or zero respectively. no 0
new_trip Key of t_trips to reorder shortfalls at in final delivery mode. If not present, shortfalls will not get reordered. no n.a.
new_tripdate Date for new t_ordertrips in final delivery mode. If not present, shortfalls will not get reordered. no n.a.
new_articles List of articles which are to be reordered in final delivery mode if new_trip and ned_tripdate are given. If not present, shortfalls of all articles are reordered. QVariantList with the keys of t_articles. no n.a.
short_remarks Remarks for shortfall order items not getting delivered in a new order trip. no Leave original remarks unchanged
orig_remarks Remarks for shortfall original order items getting delivered in a new order trip. no Leave original remarks unchanged
new_remarks Remarks for new article order created to deliver shortfalls. no Remarks of original article order
Returns:
Object with informations about the operation:
Property 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:

  • 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.
Boolean bps::OrderUtils::getSellPrices ( Object  aParams)

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

The properties article and start must be set before calling. The method will set or add the properties dpr, cpr and code at execution. If no price is found, dpr and cpr are set to null, and code is to 'n'.

Parameters:
[in]aParamsObject with the parameters.
PropertyDescriptionIn/OutType
articleArticke keyInNumber
startDate and time for when price is searchedInDate
dprDealer price foundOutNumber
cprConsumer price foundOutNumber
codePrice code foundOutString
Returns:
True if prices found, false if not found.
Boolean bps::OrderUtils::getZoneMergeclass ( Object  aParams)

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

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

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

The properties tripclass, articleclass and partnerclass must be set before calling. The method will set or add the properties zone and mergeclass at execution. If no matching entry is found in table t_pickmatrix, zone and mergeclass are set to null.

Parameters:
aParamsObject with the parameters.
PropertyDescriptionIn/OutType
tripclassTrip class keyInNumber
articleclassArticle class keyInNumber
partnerclassPartner class keyInNumber
zoneZone key foundOutNumber
mergeclassMerge class key foundOutNumber
Returns:
True if zone and mergeclass found, false if not found.
Boolean bps::OrderUtils::isOrdercolLocked ( Number  aKey)

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

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_ordercols.
Returns:
True if any locks are present, false if not.
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.
Boolean bps::OrderUtils::isOrderrowLocked ( Number  aKey)

Checks if the order row, the open 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.
Boolean bps::OrderUtils::isOrdertripLocked ( Number  aKey)

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

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_ordertrips.
Returns:
True if any locks are present, false if not.
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.
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.
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.
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.
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.
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.
Boolean bps::OrderUtils::lockOrdertrip ( Number  aKey,
Number  aTimeout = 0 
)

Lock an open trip.

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

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_ordertrips.
[in]aTimeoutTime out in seconds. Special values: 0 = no wait, -1 = wait endless
Returns:
True if the lock was successful, false if not.
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.
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.
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.
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
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
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 order item in table t_orderitems.
newtrip True if the order trip was created, false if it already existed before.
newrow True if the partner order was created, false if it already existed before.
newcol True if the article order was created, false if it already existed before.
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_rfid RF ID. no null
orderpicks_lotid Lot ID. no t_stock.c_lotid if stock_key given, NULL otherwise.
orderpicks_lus # of logistic units picked. (integer) no null
orderpicks_tus # of traded units picked. (integer) no null
orderpicks_cus # of consumer units picked. (integer) no null
orderpicks_pus Quantity of price units picked. (floating point, precision 3) no calculated
orderpicks_tu_lu

Traded units in one logistic unit picked. (integer)

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

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

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

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

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

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

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

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

The stock to take the picked amounts from.

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

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

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

This parameter has precedence over stock_auto.

no null
stock_auto

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

Only used when stock_key is not given.

An existing stock is searched as:

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

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

no "no"
Returns:
The key of the new record as t_orderpicks.c_key
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.
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).

 print( bps.OrderUtils.orderUnitName('T') ); // TU
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.
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
Parameters:
[in]aPuThe price unit code.
Returns:
The price unit abbreviation.
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
Parameters:
[in]aPuThe price unit code.
Returns:
The human readable translated price unit name.
void bps::OrderUtils::setStock ( Object  aParams)

Set the absolute stock quantities and updates other fields.

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

Parameters:
[in]aParamsThe parameters defining the stock action.
Key Description Mandatory Default
stock_key The stock key in t_stock yes n.a.
stock_reason The change reason, a key from t_stockreasons yes n.a.
stock_prio New priority no Keep old priority
stock_status New status no Keep old status
stock_type New type no Keep old type
stock_indate New in date no Keep old in date
stock_expdate New expire date no Keep old expire date
stock_cpr New consumer price no Keep old consumer price
stock_lotid New lot ID no Keep old lot ID
stock_lus New quantity for logical units no 0
stock_tus New quantity for traded units no 0
stock_cus New quantity for consumer units no 0
stock_tu_lu New factor tu/lu no Keep existing factor
stock_cu_tu New factor cu/tu no Keep existing factor
stock_pu_cu New factor pu/cu no Keep existing factor
stock_remarks New remarks no Keep existing remarks
static 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
Parameters:
[in]aModeThe stock mode code.
Returns:
The human readable translated stock mode name.
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.
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.
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.
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.
void bps::OrderUtils::unlockOrdertrip ( Number  aKey)

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

Parameters:
[in]aKeyThe primary key value (c_key) of the record in table t_ordertrips.
void 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.
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.
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.