In my environment, the only main thing I need Openbravo POS to do is make sales. To make sales, the database is accessed to query items, and to store the sales.
Storing the sales involves SQL INSERTs and UPDATEs. Might it be possible to cache these in, say, an ArrayList if the database connection is down, then process them when the connection is restored?
As to the read requests (SELECT statements), it could be possible to implement a distributed database system with a single master for the writes, and multiple slaves (read only).
Openbravo POS would also need to be modified to support having two databases, but that wouldn't be too difficult, I think.
Has anyone done anything like this, or have any other suggestions for offline capability of the POS?
I am not sure if what i tried fit your requirements here http://red1.org/adempiere/viewtopic.php?f=29&t=1356
If it can work in my POC - proof of concept, it should work for any standalone/offline scenario.
I have made the modifications necessary to run Openbravo in a very crude "offline" mode. I allowed many of the source classes to receive an additional "Session" (object?) when initiated.
Basically, I use one session as the "local" database connection and the other as the "main" database connection.
This done, a local database is used for handling routine "select" queries. Of particular importance to me was allowing the local database to handle product queries made by the use of the keyboard at the main sales panel.
The SQL queries for resources, sales/refunds, and close cash use the "main" connection. By using an ArrayList queue, sales made while the connection to the "main" database is down are saved until the connection is restored. (Eventually, I would like to make this record queries to files in the event that the register must be powered down).
I have absolutely no idea whether this will work well in production; I have a lot more testing to do.
I think your work is very interesting, do share your updates. thanks
I decided to abandon where I was going with my code in the above description. It became very unwieldy having two database connections (https://sourceforge.net/p/unicentaopos/discussion/1126900/thread/c51b0e6a/).
HOWEVER, I did successfully solve my problem in another fashion.
Using another open source tool called "Symmetric DS", I was able to replicate databases for Openbravo, so that each computer register with Openbravo has a database installed on it as well. In this manner, even if the Ethernet cable comes unplugged, the sales will continue, and the data is cached.
I did have to do a couple small changes to the Openbravo database structure.
1. Completely disable the modification of the "STOCKCURRENT" table in the source code (namely, DataLogicSales.java)
2. Create a trigger to update STOCKCURRENT based on STOCKDIARY inserts
Doing these things allowed me to use Symmetric DS to replicate each register database to the main corporate database.
The reason the STOCKCURRENT trigger is needed is because Symmetric DS, as of the version specified in this post: https://sourceforge.net/p/symmetricds/discussion/739236/thread/9439a4aa/ does not perform additive transforms correctly, which is how this issue might have been resolved using Symmetric alone (https://sourceforge.net/p/symmetricds/discussion/739235/thread/8f41f4af/).
Log in to post a comment.