Hi,
I am trying to implement in CCO plugin a task “Window Pop-up when Item is not found”. Actually, it works for me, but not for all cases correctly. Can you please help me to find right solution.
My implementation:
@PluginAt(pluginClass=IBarcodeManager.class, method="findAllByCodeCached", where=POSITION.AFTER) public Object findAllByCodeCachedAfter(Object proxy, Object[] args, Object returnValue, StackTraceElement callStack) { if (returnValue instanceof Collection<?>) { if(((Collection)returnValue).size() == 0) { Shared.showMessageToUi("Impossible to find item with barcode "+ args[0].toString(), "info",Core.class.getSimpleName(), "60"); } } return returnValue; }
If a user enters barcode which does not exists, it works as expected: item not found => modal window is showed for user and cashier cannot continue until button Ok pressed. However, if item code (not barcode) has been inserted or item (article) has been chosen manually from list, then item appears in receipt and the modal window (item not found) also pops up, which is not correct.