There are two custom tables. One for employee's work EmpWork, another one for employee's calendar entries EmpWorkDays.
Both tables contain field DefaultDimension. EmpWork table's data were filled some years ago, probably imported.
When EmpWorkDays table is filled by a class method, it creates a new EmpWorkDays record for every day in month and every entry has a copy of DefaultDimension value from EmpWork.
After that EmpWorkDays entries can be deleted / inserted from Excel using a custom class. And then magic happens.
In my example EmpWork entry have dimension values '023' for department and '010' for cost center.
In Excel there are the same values for dimensions. But when import happens, DefaultDimension value is different then the one in EmpWork. Shouldn't they be the same?
When part of month is imported, the result is that part of records are with DefaultDimension value from EmpWork, another part with other DefaultDimension value from Excel, but all of them have dimension values '023' for department and '010' for cost center. Later records are processed grouped by DefaultDimension and undesirable effects occur.
Here is a screenshot from DimensionAttributeValueSetItem table, as you can see DimensionAttributeValue is the same for two records.
Why it happens so? Is it possible to fix it?