BPS C++ API  2.24.4
bpsorderutils.h
Go to the documentation of this file.
1 
4 #ifndef BPSORDERUTILS_H
5 #define BPSORDERUTILS_H
6 
7 #include "bps.h"
8 #include <QObject>
9 
10 class BpsDatastore;
11 class BpsEpcis;
12 class BpsRobot;
13 
19 {
20  Q_OBJECT
22 
23 public:
24 
28  enum OrderGenMode {
30  OM_ERP
31  };
32 
36  enum OuIndex {
38  O_PU,
39  O_CU,
40  O_TU,
41  O_LU
42  };
43 
47  enum PuIndex {
54  P_CubicMeter
55  };
56 
64  SM_Quick
65  };
66 
84  SR_Autosync
85  };
86 
92  BpsOrderUtils(BpsDatastore* aDatastore, QObject* aParent = nullptr);
93 
94  virtual ~BpsOrderUtils();
95 
101  static OuIndex orderUnitIndex(const QVariant& aOu);
102 
111 
120 
128  static QString orderUnitName(const QVariant& aOu);
129 
137  static QString orderUnitName(const QVariant& aOu, const QVariant& aPu);
138 
144  static PuIndex priceUnitIndex(const QVariant& aPu);
145 
153 
160  static QString priceUnitName(const QVariant& aPu);
161 
169 
177 
183  static StockModeIndex stockModeIndex(const QVariant& aMode);
184 
192 
199  static QString stockModeName(const QVariant& aMode);
200 
207 
215  QString tripdateToString(const QVariant& aTripdate);
216 
225 
234 
239 
244 
250  BpsRobot* robot(const QVariant& aZone) const;
251 
257 
262  bool anyRobots() const;
263 
277  QVariant cloneRecord(const QVariant& aKey, const QString& aName);
278 
293 
304 
312  QVariantMap getZone(const QVariant& aZoneKey);
313 
321  QVariantMap getTrip(const QVariant& aTripKey);
322 
330  QVariantMap getArticle(const QVariant& aArticleKey);
331 
339  QVariantMap getPartner(const QVariant& aPartnerKey);
340 
348  QVariantMap getProd(const QVariant& aProdKey);
349 
357  QVariantMap getPackjob(const QVariant& aPackjobKey);
358 
371  Bps::Status lockOrdertrip(const QVariant& aKey, int aTimeout = 0, bool aFullcheck = true);
372 
377  void unlockOrdertrip(const QVariant& aKey);
378 
385  bool isOrdertripLocked(const QVariant& aKey);
386 
399  Bps::Status lockOrderrow(const QVariant& aKey, int aTimeout = 0, bool aFullcheck = true);
400 
405  void unlockOrderrow(const QVariant& aKey);
406 
412  bool isOrderrowLocked(const QVariant& aKey);
413 
426  Bps::Status lockOrdercol(const QVariant& aKey, int aTimeout = 0, bool aFullcheck = true);
427 
432  void unlockOrdercol(const QVariant& aKey);
433 
439  bool isOrdercolLocked(const QVariant& aKey);
440 
452  Bps::Status lockOrderitem(const QVariant& aKey, int aTimeout = 0, bool aFullcheck = true);
453 
458  void unlockOrderitem(const QVariant& aKey);
459 
465  void unlockOrderitems(const QVariant& aKID);
466 
471  void unlockOrderitems(const QVariantList& aKeys);
472 
478  bool isOrderitemLocked(const QVariant& aKey);
479 
492  Bps::Status lockPackprod(const QVariant& aKey, int aTimeout = 0, bool aFullcheck = true);
493 
498  void unlockPackprod(const QVariant& aKey);
499 
505  bool isPackprodLocked(const QVariant& aKey);
506 
519  Bps::Status lockPackjob(const QVariant& aKey, bool aExclusive = true, int aTimeout = 0, bool aFullcheck = true);
520 
525  void unlockPackjob(const QVariant& aKey);
526 
533  bool isPackjobLocked(const QVariant& aKey, bool aExclusive = true);
534 
546  Bps::Status lockPurchaseOrder(const QVariant& aKey, int aTimeout = 0);
547 
552  void unlockPurchaseOrder(const QVariant& aKey);
553 
559  bool isPurchaseOrderLocked(const QVariant& aKey);
560 
571  Bps::Status lockPurchaseItem(const QVariant& aKey, int aTimeout = 0);
572 
577  void unlockPurchaseItem(const QVariant& aKey);
578 
584  bool isPurchaseItemLocked(const QVariant& aKey);
585 
596  const QVariant& aArticleKey,
597  const QDateTime& aStart,
598  QVariant& aDpr,
599  QVariant& aCpr,
600  QVariant& aCode);
601 
627  const QVariant& aTripclassKey,
628  const QVariant& aArticleclassKey,
629  const QVariant& aPartnerclassKey,
630  QVariant& aZoneKey,
631  QVariant& aMergeclassKey);
632 
877  QVariantMap makeOrderItem(const QVariantMap& aParams);
878 
972  QVariantList makeErpOrders(const QList<QVariantMap>& aParams);
973 
974 
1128  QVariant makeOrderPick(const QVariantMap& aParams);
1129 
1136  void cancelOrderPick(const QVariant& aPickKey);
1137 
1188  QVariant makeLu(const QVariantMap& aParams);
1189 
1254  Bps::Status adoptLu(const QVariantMap& aParams);
1255 
1308  QVariant findLu(const QVariantMap& aParams);
1309 
1385  QVariantMap findLockLu(const QVariantMap& aParams);
1386 
1463  QVariantMap findOrMakeSharedLu(const QVariantMap& aParams);
1464 
1474  Bps::Status lockLu(const QVariant& aKey, int aTimeout = 0);
1475 
1480  void unlockLu(const QVariant& aKey);
1481 
1486  void refreshLu(const QVariant& aKey);
1487 
1493  bool anyPicksOnLu(const QVariant& aKey);
1494 
1613  QVariantMap finalizeLu(const QVariantMap& aParams);
1614 
1744  QVariantMap finishOrderRow(const QVariantMap& aParams);
1745 
1886  QVariantMap makePackJob(const QVariantMap& aParams);
1887 
1998  QVariant makePackRec(const QVariantMap& aParams);
1999 
2007  QVariant clearPackStock(const QVariant& aPackRecKey);
2008 
2237  QVariantMap makePurchaseItem(const QVariantMap& aParams);
2238 
2424  QVariantMap makePurchaseDelivery(const QVariantMap& aParams);
2425 
2725  QVariantMap makePurchaseEntry(const QVariantMap& aParams);
2726 
2735  void setPurchaseDeliveryStock(const QVariant& aDeliveryKey, const QVariant& aStockKey = QVariant());
2736 
2745 
2761  bool finishPurchaseOrder(const QVariant& aOrderKey, bool aLock = false, int aTimeout = 0);
2762 
2881  void setStock(const QVariantMap& aParams);
2882 
2927  void addToStock(const QVariantMap& aParams);
2928 
3082  QVariant saveZoneStock(const QVariantMap& aParams);
3083 
3210  QVariant makeStock(const QVariantMap& aParams);
3211 
3222 
3233 
3241 
3242 };
3243 
3244 #endif // BPSDATASTORE_H
Public include file for Bps class.
#define BPSCORE_EXPORT
Declare class to be an import from the shared library.
Definition: bpscore_global.h:22
#define BPS_PRIVATE(Class)
Declare pointer to private object in a public class.
Definition: bpsglobals.h:102
BPS datastore class.
Definition: bpsdatastore.h:61
EPCIS utilities.
Definition: bpsepcis.h:17
Status
General purpose return status.
Definition: bps.h:80
BPS order utilities.
Definition: bpsorderutils.h:19
void unlockOrderitem(const QVariant &aKey)
Unlock the order item.
void unlockPurchaseOrder(const QVariant &aKey)
Unlock the purchase order, in case it was locked by the current actor.
PuIndex
Price unit enumeration.
Definition: bpsorderutils.h:47
@ P_Liter
Liters.
Definition: bpsorderutils.h:51
@ P_SquareMeter
Square meters.
Definition: bpsorderutils.h:53
@ P_Piece
Pieces.
Definition: bpsorderutils.h:49
@ P_unknown
Unknown unit.
Definition: bpsorderutils.h:48
@ P_Meter
Meters.
Definition: bpsorderutils.h:52
@ P_Kilo
Kilos.
Definition: bpsorderutils.h:50
bool getSellPrices(const QVariant &aArticleKey, const QDateTime &aStart, QVariant &aDpr, QVariant &aCpr, QVariant &aCode)
Find the prices for a certain article and starting date/time.
void addToStock(const QVariantMap &aParams)
Adds (or subtracts) stock quantities and updates other stock fields.
static QString stockModeName(StockModeIndex aMode)
Get the human readable and translated stock mode name (Regular, FIFO, Quick) from a stock mode index ...
Bps::Status lockPackjob(const QVariant &aKey, bool aExclusive=true, int aTimeout=0, bool aFullcheck=true)
Lock a packing job.
Bps::Status adoptLu(const QVariantMap &aParams)
Adopt an orphaned new logistic unit.
QVariantMap getPartner(const QVariant &aPartnerKey)
Get partner record.
bool finishPurchaseOrder(const QVariant &aOrderKey, bool aLock=false, int aTimeout=0)
Finishes a purchase order having the status ready, active or completed, and not having any blocked de...
QVariantMap finalizeLu(const QVariantMap &aParams)
Finalize a logistic unit.
void setPurchaseDeliveryStock(const QVariant &aDeliveryKey, const QVariant &aStockKey=QVariant())
Register stock of purchase delivery record.
static QString orderUnitName(OuIndex aOu)
Get the human readable and translated order unit name (LU, TU, CU, PU) from a order unit index (O_LU,...
static QString priceUnitName(PuIndex aPu)
Get the human readable and translated price unit name (Piece, Kilo, Liter, Meter, M2,...
QString dprToString(const QVariant &aDpr)
Convert a dealer price to string.
static OuIndex orderUnitIndex(const QVariant &aOu)
Get the enumeration for a order unit code.
QVariantMap makePurchaseEntry(const QVariantMap &aParams)
Registration of an entry on an existing purchase delivery.
bool isOrderitemLocked(const QVariant &aKey)
Checks if the order detail or any parent record is locked.
BpsEpcis * epcis()
static StockModeIndex stockModeIndex(const QVariant &aMode)
Get the enumeration for a stock mode code.
void cancelOrderPick(const QVariant &aPickKey)
Cancel an existing pick by deleting the record in t_orderpicks.
QVariant getStockReason(StockReasonIndex aIndex)
Get the stock reason for a certain stock reason index from table t_stockreasons.
static QString priceUnitAbbreviation(const QVariant &aPu)
Get the abbreviated, maximum 3 character price unit name (PCS, KG, L, M, M2, M3) from a price unit co...
bool isOrdertripLocked(const QVariant &aKey)
Checks if the order trip or any of the order rows, columns or details belonging to it are locked.
Bps::Status lockLu(const QVariant &aKey, int aTimeout=0)
Lock an logistic unit in table t_newlogisticunits.
static QString orderUnitName(OuIndex aOu, PuIndex aPu)
Get the human readable and translated order unit name (LU, TU, CU, Piece, Kilo, Liter,...
QVariant cloneRecord(const QVariant &aKey, const QString &aName)
Make an exact copy of an arbitrary BPS record, with exception of the key.
void refreshLu(const QVariant &aKey)
Refresh the timestamp of the logistic unit, in case it is locked by the current actor.
void unlockPackprod(const QVariant &aKey)
Unlock the packing production, in case it was locked by the current actor.
bool isPurchaseOrderLocked(const QVariant &aKey)
Checks if the purchase order or any of the items belonging to the order are locked.
void unlockOrderrow(const QVariant &aKey)
Unlock the order row, in case it was locked by the current actor.
void unlockOrdercol(const QVariant &aKey)
Unlock the order column, in case it was locked by the current actor.
static QString orderUnitName(const QVariant &aOu)
Get the human readable and translated order unit name (LU, TU, CU, PU) from a order unit code ("L",...
static QString priceUnitAbbreviation(PuIndex aPu)
Get the abbreviated, maximum 3 character price unit name (PCS, KG, L, M, M2, M3) from a price unit in...
StockReasonIndex
Stock change reason index.
Definition: bpsorderutils.h:70
@ SR_ManualMinus
Manual - change (m-)
Definition: bpsorderutils.h:74
@ SR_StockOK
Stocktaking confirmation (s0)
Definition: bpsorderutils.h:81
@ SR_Unknown
Unknown stock reason.
Definition: bpsorderutils.h:71
@ SR_Manual
Manual change (m)
Definition: bpsorderutils.h:72
@ SR_PickReturn
Picking return (p+)
Definition: bpsorderutils.h:79
@ SR_StockPlus
Stocktaking + change (s+)
Definition: bpsorderutils.h:82
@ SR_SupplyReturn
Supply return (i-)
Definition: bpsorderutils.h:78
@ SR_StockMinus
Stocktaking - change (s-)
Definition: bpsorderutils.h:83
@ SR_ManualPlus
Manual + change (m+)
Definition: bpsorderutils.h:73
@ SR_Withdraw
General withdraw (g-)
Definition: bpsorderutils.h:76
@ SR_PickDraw
Picking draw (p-)
Definition: bpsorderutils.h:80
@ SR_SupplyIntake
Supply intake (i+)
Definition: bpsorderutils.h:77
@ SR_Storage
General storage (g+)
Definition: bpsorderutils.h:75
QString cprToString(const QVariant &aCpr)
Convert a consumer price to string.
void unlockOrderitems(const QVariantList &aKeys)
Unlock a list of order items.
bool isPackjobLocked(const QVariant &aKey, bool aExclusive=true)
Checks if the packing job or the production it belongs to are locked.
QVariantMap findOrMakeSharedLu(const QVariantMap &aParams)
Find and lock an orphaned new logistic unit, or create a new one.
OrderGenMode orderGenMode(const QString &aTripid)
Get the order generation mode for a given trip ID.
bool getZoneMergeclass(const QVariant &aTripclassKey, const QVariant &aArticleclassKey, const QVariant &aPartnerclassKey, QVariant &aZoneKey, QVariant &aMergeclassKey)
Get the zone and merge class for a combination of trip, article and partner class.
QVariant clearPurchaseDeliveryStock(const QVariant &aDeliveryKey)
Clear stock registration of purchase delivery record.
QVariant makeOrderPick(const QVariantMap &aParams)
Make an order pick.
BpsOrderUtils(BpsDatastore *aDatastore, QObject *aParent=nullptr)
Constructor for the BpsOrderUtils objects.
Bps::Status lockPurchaseItem(const QVariant &aKey, int aTimeout=0)
Lock a purchase order item.
QList< BpsRobot * > robots() const
Get a list of all active robot.
QVariantMap finishOrderRow(const QVariantMap &aParams)
Finish a order row.
QVariant makeLu(const QVariantMap &aParams)
Create a new logistic unit.
QVariant clearPackStock(const QVariant &aPackRecKey)
Clear stock registration of a packing record.
Bps::Status lockPurchaseOrder(const QVariant &aKey, int aTimeout=0)
Lock a purchase order.
QVariant cloneArticle(const QVariant &aKey)
Make an exact copy of the original article, with exception of the key.
QVariantList makeErpOrders(const QList< QVariantMap > &aParams)
Create ERP orders in table t_erporders and t_erporderitems.
bool anyPicksOnLu(const QVariant &aKey)
Check if there are any picks on the logistic unit.
QVariant getStockReason(const QString &aType)
Get the stock reason for a certain type from table t_stockreasons.
Bps::Status lockOrdercol(const QVariant &aKey, int aTimeout=0, bool aFullcheck=true)
Lock an order column.
QList< QPair< QString, QString > > getDefaultStockReasons()
Get the default stock reason types and names as a list.
Bps::Status lockOrderitem(const QVariant &aKey, int aTimeout=0, bool aFullcheck=true)
Lock an order item.
QVariantMap makePurchaseItem(const QVariantMap &aParams)
Creates a new purchase order item.
void unlockLu(const QVariant &aKey)
Unlock the logistic unit, in case it is locked by the current actor.
QString tripdateToString(const QVariant &aTripdate)
Convert a order trip date to string.
QVariantMap getZone(const QVariant &aZoneKey)
Get zone record.
QVariant makePackRec(const QVariantMap &aParams)
Make a packing record.
StockModeIndex
Stock handling modes.
Definition: bpsorderutils.h:60
@ SM_Regular
Regular stock mode.
Definition: bpsorderutils.h:62
@ SM_FIFO
Regular stock mode.
Definition: bpsorderutils.h:63
@ SM_unknown
Unknown stock mode.
Definition: bpsorderutils.h:61
QVariantMap getPackjob(const QVariant &aPackjobKey)
Get packing job record.
bool isOrderrowLocked(const QVariant &aKey)
Checks if the order row, the order trip, the related columns or any of the details belonging to the r...
QVariantMap getTrip(const QVariant &aTripKey)
Get trip record.
bool isPurchaseItemLocked(const QVariant &aKey)
Checks if the purchase order item or the parent purchase order record is locked.
void unlockPurchaseItem(const QVariant &aKey)
Unlock the purchase order item, in case it was locked by the current actor.
Bps::Status lockOrdertrip(const QVariant &aKey, int aTimeout=0, bool aFullcheck=true)
Lock an order trip.
bool anyRobots() const
Check if there are any active robots.
QVariant saveZoneStock(const QVariantMap &aParams)
Adds a quantity to an existing stock in the given zone, or creates a new stock in the zone when no ex...
QVariantMap findLockLu(const QVariantMap &aParams)
Find and lock an orphaned new logistic unit.
QVariantMap getArticle(const QVariant &aArticleKey)
Get article record.
OuIndex
Order unit enumeration.
Definition: bpsorderutils.h:36
@ O_TU
Traded unit.
Definition: bpsorderutils.h:40
@ O_unknown
Unknown unit.
Definition: bpsorderutils.h:37
@ O_PU
Price unit.
Definition: bpsorderutils.h:38
@ O_CU
Consumer unit.
Definition: bpsorderutils.h:39
void setStock(const QVariantMap &aParams)
Set the absolute stock quantities and updates other fields on an existing stock.
QVariantMap makePackJob(const QVariantMap &aParams)
Creates or updates a packing job.
bool isPackprodLocked(const QVariant &aKey)
Checks if the packing production or any of the jobs belonging to it are locked.
OrderGenMode
Order generation modes.
Definition: bpsorderutils.h:28
@ OM_BPS
Create BPS orders.
Definition: bpsorderutils.h:29
QVariant clonePartner(const QVariant &aKey)
Make an exact copy of the original partner, with exception of the key.
void unlockOrdertrip(const QVariant &aKey)
Unlock the order trip, in case it was locked by the current actor.
static QString priceUnitName(const QVariant &aPu)
Get the human readable and translated price unit name (Piece, Kilo, Liter, Meter, M2,...
QVariant makeStock(const QVariantMap &aParams)
Create a new stock.
BpsRobot * robot(const QVariant &aZone) const
Get robot of a given zone.
static QString stockModeName(const QVariant &aMode)
Get the human readable and translated stock mode name (Regular, FIFO, Quick) from a price unit code (...
static PuIndex priceUnitIndex(const QVariant &aPu)
Get the enumeration for a price unit code.
QVariant findLu(const QVariantMap &aParams)
Find a new logistic unit.
bool isOrdercolLocked(const QVariant &aKey)
Checks if the order column, the order trip, or any of the details belonging to the column are locked.
QVariantMap makeOrderItem(const QVariantMap &aParams)
Creates a new order item.
void unlockOrderitems(const QVariant &aKID)
Unlock a list of order items held in table t_keyids.
void unlockPackjob(const QVariant &aKey)
Unlock the packing job, in case it was locked by the current actor.
QVariantMap makePurchaseDelivery(const QVariantMap &aParams)
Creates a new purchase order delivery.
BpsDatastore * datastore() const
Bps::Status lockOrderrow(const QVariant &aKey, int aTimeout=0, bool aFullcheck=true)
Lock an order row.
QVariantMap getProd(const QVariant &aProdKey)
Get production record.
Bps::Status lockPackprod(const QVariant &aKey, int aTimeout=0, bool aFullcheck=true)
Lock an packing production.
static QString orderUnitName(const QVariant &aOu, const QVariant &aPu)
Get the human readable and translated order unit name (LU, TU, CU, Piece, Kilo, Liter,...
Pick robot interface.
Definition: bpsrobot.h:19