Well, next your idea is good but we solved it differently here in the company,
we did so, we will have a table (pendentes_sync) (int reference, int terminaloffline, int type, synchronized)
reference and the ID of the object I want to synchronize
terimaloffline is the terminaloffile ID (explain below)
type Synchronized within the system it will be an enum .. that says the type of data being synchronized, example if it is 1 .. is a Product, if 3 is a user, if 7 is product_unit and so goes ..
Offline Terminal What is it?
Good offline terminal (I'll give a pdv example)
You are in the supermarket and you are starting to install the system you install the administrative and the pdvs,
to start a pdv you must have an Offline Terminal .. if you do not have the pdv simply will not leave the terminal selection screen offline ..
Offline terminal registration ..
could have an ECF already registered and linked to the pdv if you know the door that will be put here .. if you do not know ok from nowhere does not select in the pdv ..
a description for the offline terminal,
synchronization time,
is an attribute for tying the pdv to a particular offline terminal,
When registering the offline terminal,
you simply select it in pdv and bingo! a preconfiguration is ready
suppose you made the registration and erred the ECF port the pdv .. will not connect but rather show an option to put the correct ecf port .. you put (the synchronizer will send the port to the register on the server) p>
basically this is the offline terminal ..
let's part of the synchronization
pending_sync the table I gave you above ...
When I register a product I will have to insert
the reference (product id), idterminalOffline (if you have two terminals you will need to have two inserts one for each ..), type Synchronized (an indicator that you are synchronizing a product)
the same process to change the product ..
Well, what happens .. if you have two terminals .. you will have two inserts one for each terminal
When the (terminal) pdv synchronizes it will be based on this table.
get her data .. will see that there is pending product to synchronize ..
takes its id from it looks for it and updates / inserts the product in the pdv .. and deletes the record of the pending_sync table that referred to this update ..
And basically that's what we think
If you have any idea where we can improve and welcome =)