mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-06-09 15:07:49 +00:00
Merge branch 'fix/reconcile-fifo' into 'rc/01'
add command to fix reconcile fifo; fix fifo stock v2 See merge request mbugroup/lti-api!582
This commit is contained in:
@@ -45,7 +45,16 @@ func ReleasePopulationConsumptionByUsable(
|
||||
}
|
||||
}
|
||||
|
||||
return stockAllocationRepo.ReleaseByUsable(ctx, usableType, usableID, nil, nil)
|
||||
// Only release the PROJECT_FLOCK_POPULATION allocations here. Releasing the
|
||||
// other CONSUME allocations of this usable (RECORDING_EGG, STOCK_TRANSFER_IN,
|
||||
// PURCHASE_ITEMS, etc.) would orphan their stockable total_used because this
|
||||
// path only restores total_used_qty for population lots — leaving the FIFO
|
||||
// stock counters permanently inflated (phantom stock). Those stock
|
||||
// allocations are owned by the FIFO Reflow/Rollback path, which decrements
|
||||
// total_used correctly via adjustStockableUsedQuantity.
|
||||
return stockAllocationRepo.ReleaseByUsable(ctx, usableType, usableID, nil, func(db *gorm.DB) *gorm.DB {
|
||||
return db.Where("stockable_type = ?", fifo.StockableKeyProjectFlockPopulation.String())
|
||||
})
|
||||
}
|
||||
|
||||
func AllocatePopulationConsumption(
|
||||
|
||||
Reference in New Issue
Block a user