cancel
Showing results for 
Search instead for 
Did you mean: 

Correct way for plugin implementation "​Window Pop-up when Item is not found" in CCO

0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

R_Zieschang
Contributor
0 Kudos

Hi Sergei,

did you check if the material, which was chosen manually does have barcodes assigned? What is the difference in the entries in the args array when scanning a barcode and chosing the material manually?

regards

Robert

0 Kudos

Hi Robert,

When a user has chosen material manually from list, this entry point "findAllByCodeCached" AFTER has parameters args = external code (B1 item code) and returnValue = empty collection.

When a user scans barcode, args contains scanned barcode returnValue= is collection of BarcodeEntities.

I am thinking as about last solution is seaching by external code in "findAllByCodeCached" AFTER, and if there is item, then do not show modal window. But better probably to find another existing method which does that, to avoid double seach, but I cannot find this method/entry point.