Today one of my customers ran into a problem with my coding of a system meant to group related lines together on a purchase order.
There are estimating details that contain an affiliation number for grouping lines together. They are unique per phase number. These need to be translated into group numbers for the purchase orders.
My calculation was: Phase Number + Affiliation number + 100.
So the problem arose when we had consecutive phase numbers with multiple affiliation numbers.
Phase 60 and Affiliation number 2 was calculated for a group number of 162.
Then Phase 61 and Affiliation number 1 on that phase was also calculated to be 162.
This caused havoc with my system that then was supposed to renumber everything with unique group numbers starting with 1 and going up. These numbers are per Purchase Order and increment regardless of phase.
It didn’t handle phase 60 affiliation 2 and phase 61 affiliation 1 correctly and grouped them together with the same concrete group number.
Anyway, what I had really needed and think I even meant to do was to do something like (Phase Number * 100) + Affiliation number. Although this could still result in overlapping numbers if the affiliation number goes to 100 for a phase, that’s very unlikely. However, I could get the maximum affiliation number on the job and make sure my multiplier is one magnitude of 10 larger than that. That would then fix the issue permanently no matter how many affiliations they needed to use.