Error When Ending Work Period

Hi,
I have encountered an error when trying to end work period. I have read the topic Error Work Period but not sure if this is the same case.

Below is the error log:

-----------------------------
[General Info]

Application: SambaPOS
Version:     4.1.78
Region:      en
DB:          CE
Machine:     CAFEPC
User:        Cafe PC
Date:        27/11/2014
Time:        4:42

User Explanation:

Cafe PC said ""
-----------------------------

[Exception Info 1]

Top-level Exception
Type:        System.InvalidOperationException
Message:     Sequence contains more than one matching element
Source:      System.Core
Stack Trace: at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at Samba.Services.Implementations.CacheService.GetRecipe(String portionName, Int32 menuItemId)
   at Samba.Presentation.Services.Implementations.InventoryModule.ConsumptionBuilder.UpdateConsumption(PeriodicConsumption pc, Int32 warehouseId, IEnumerable`1 tickets)
   at Samba.Presentation.Services.Implementations.InventoryModule.ConsumptionBuilder.BuildPeriodicConsumption()
   at Samba.Presentation.Services.Implementations.InventoryModule.InventoryService.DoWorkPeriodEnd()
   at Samba.Presentation.Services.Implementations.InventoryModule.InventoryWorkperiodProcessor.ProcessWorkPeriodEnd(WorkPeriod workPeriod)
   at Samba.Presentation.Services.Implementations.WorkPeriodModule.WorkPeriodService.StopWorkPeriod(String description)

-----------------------------

[Assembly Info]

PresentationFramework, Version=4.0.0.0
System.Xaml, Version=4.0.0.0
Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0
mscorlib, Version=4.0.0.0
System, Version=4.0.0.0
WindowsBase, Version=4.0.0.0
System.Configuration, Version=4.0.0.0
Samba.Services, Version=1.0.0.0
Samba.Presentation.Services, Version=1.0.0.0
Samba.Presentation.Common, Version=1.0.0.0
Samba.Domain, Version=1.0.0.0
PresentationCore, Version=4.0.0.0
DevExpress.Xpf.Core.v14.1, Version=14.1.6.0
Microsoft.Practices.ServiceLocation, Version=1.0.0.0
Samba.Infrastructure, Version=1.0.0.0
Microsoft.Practices.Prism, Version=4.0.0.0
System.ComponentModel.Composition, Version=4.0.0.0
System.Core, Version=4.0.0.0
Samba.Localization, Version=1.0.0.0
FastButton, Version=1.0.0.0

-----------------------------

[System Info]

Operating System
-Microsoft Windows 8 Pro
--CodeSet = 1252
--CSDVersion = 
--CurrentTimeZone = 420
--FreePhysicalMemory = 1232068
--OSArchitecture = 32-bit
--OSLanguage = 2057
--ServicePackMajorVersion = 0
--ServicePackMinorVersion = 0
--Version = 6.2.9200

Machine
-CAFEPC
--Manufacturer = INTEL_
--Model = D525MW__
--TotalPhysicalMemory = 2129584128
--UserName = CAFEPC\Cafe PC

-----------------------------

######################### E N D #########################

Seems like one product have multiple recipes for a single portion. Normally it won’t permit creating multiple recipes for a single portion. Did you cloned any recipes while creating them? On recent versions I’ve improved verification code for cloned recipes.

OK, I will check the database first. I inserted the recipes programmatically so that may be the cause.
So if I’m not misunderstanding what you said, there must be at least a portion of a menu item that has duplicate recipe, correct?

Thanks for the explanation.

UPDATE: I saw the flaw of my code and fixed it, but I have not tested carefully, so I assume it’s working now because there’s no duplicated reference to portion anymore.

By programmatically you did it by editing the database? Just curious other people may be interested so they can prevent a similar situation.

I coded a small desktop application to import inventory items, menu items and recipes from CSV files. Quite similar to JohnS’ PHP bulk importer but mine imports from separated files not in a single CSV file. Not finished yet, still needs testing but some basic functions that I need have worked somehow.

1 Like