Batches
The batches table is a child of saleable products.
It also has a 1 to many relationship with seedlots
- i.e. there can be many batches made from a single seedlot
It is used to store information about ‘batches’, a batch is a set of packets/ labels which are made together for a particular product from a particular seedlot.
Batches are created by users via the packets dashboard. Doing this will also created a matching assembly record, which users will then use to assemble the batch.
Along with interfacing with batches via the assembly and packets dashboards, user will interface with them via the shipments/shipment lines tables when they are allocating lines to batches.
The table also stores the print views used to generate small packet/ bulk label designs. These are used when printing the packets/ labels.
In terms of the main fields/ buttons shown
- Batches search helper
- this was created as the search function when selecting batches was not responding to product info
- this is likely as product info is not in a field on the batches table, and is just a relationship field
- this field therefore contains product code/ name info, it is filled via an on update trigger on the batch record.
- Batch number
- autogenerated when the batch is created on the packets dash
- should be a unique identifer, however sometimes duplicates end up being created due to desync
- for this reason the dupes checker python script exists
- Batch creation date
- filled when the batch is created via the packets dash
- Assembled
- defaults to
false
when created via the packets dash - set to
true
once assembled via the assembly dash - once assembled
- batches can be allocated to shipment lines
- defaults to
- start size
- initial size of the batch…
- remaining size
- start size - allocations - adjustments
- unlike seedlot remaining size, this is a formula
- we used a formula here as otherwise adjusting batches on allocation would be a difficult problem
- reprint whole batch
- works by sending a post request to the batch printing integromat scenario
- number to print/ print n
- reprints the number of packets given in number to print
- works by sending a post request to the batch printing integromat scenario with the batch size parameter being equal to
number to print
Then, the views conditionally shown depending on the value of the show view
choice field
- order item allocations
- displays a list of shipment lines the batch was allocated to during the picking process
- operation log
- displays related packets dashboard records for batch
- creation
- adjustment
- disassembly
- displays related packets dashboard records for batch
- assembly log
- though there is technically a 1 to many relationship here
- 1 batch can have many assembly log records
- in reality it should only ever be a 1 to 1 relationship
- 1 batch will have exactly 1 assembly log record
- the older batches may not have any assembly log records
- if for some reason the record failed to create, a
create assembly record
button will be shown in the admin section - generally, this is just used as a way to view the assembly log record after the batch has been assembled
- though there is technically a 1 to many relationship here
Finally within the admin section (visible only if isAdminMode()
is true
)
- cnt asmb dash
- formula which counts the number of attached assembly log records
- if not 1, there is a problem…
- if 0 a button to create one will be shown
- if 2 there will be an error when trying to assemble the product