Class SerialTrackingGuard
java.lang.Object
org.bgerp.plugin.inventoru.service.SerialTrackingGuard
Whether the stock of positions can be accounted per unit: the reconciliation of balances against
units, and the check that refuses turning serial tracking on where it would break accounting.
A position with stock switched to serial tracking with no units yet is fine — the balance runs
ahead of the units until their serial numbers are filled in. Two things are not: more units on a
store than its balance (a unit counted twice), and an active reserve without a serial number —
the 1C export writes off exactly the unit its reserve names, and such a reserve names none, so
the write-off of that process would fail.
Tracking is inherited down the type hierarchy, and a type change reaches the item type cache only
after the transaction commits (the cache reads with a connection of its own), so what is tracked
is computed here from the types as the caller's connection sees them.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classOne store and position: the balance against the units standing there. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckItemBecomesTracked(int itemId, boolean trackedBefore, boolean trackedAfter) Refuses giving the item a type that tracks it per unit when that would break accounting.voidcheckNewlyTracked(Set<Integer> trackedBefore) Refuses what has become serial tracked sincetrackedBefore— the caller's change of a type, of its parent or of its inheritance — when it would break accounting.itemIdsOfTypes(Collection<Integer> typeIds) Live positions of these types.lines(Collection<Integer> itemIds) The reconciliation of these positions: every store where there is a balance, a unit or an active reserve without a serial, ordered by position and store.problems(Collection<Integer> itemIds) Lines that stand in the way of per-unit accounting of these positions.Types whose effective serial tracking is on, as the caller's connection sees them.
-
Constructor Details
-
SerialTrackingGuard
-
-
Method Details
-
trackedTypeIds
Types whose effective serial tracking is on, as the caller's connection sees them.- Throws:
SQLException
-
checkNewlyTracked
Refuses what has become serial tracked sincetrackedBefore— the caller's change of a type, of its parent or of its inheritance — when it would break accounting. Call after writing the change, before committing; the refusal is thrown and takes the change back with it.- Throws:
SQLExceptionBGMessageException
-
checkItemBecomesTracked
public void checkItemBecomesTracked(int itemId, boolean trackedBefore, boolean trackedAfter) throws SQLException, BGMessageException Refuses giving the item a type that tracks it per unit when that would break accounting. Call after writing the item, before committing.- Throws:
SQLExceptionBGMessageException
-
problems
Lines that stand in the way of per-unit accounting of these positions.- Throws:
SQLException
-
itemIdsOfTypes
Live positions of these types.- Throws:
SQLException
-
lines
The reconciliation of these positions: every store where there is a balance, a unit or an active reserve without a serial, ordered by position and store.- Throws:
SQLException
-