mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-06-09 15:07:49 +00:00
fix over consume by code, revert migration overconsume sell
This commit is contained in:
@@ -195,9 +195,12 @@ func (s *fifoStockV2Service) allocateInternal(ctx context.Context, tx *gorm.DB,
|
||||
|
||||
if remaining > 0 {
|
||||
if !allowOverConsume {
|
||||
return nil, fmt.Errorf("%w: requested %.3f, allocated %.3f", ErrInsufficientStock, req.NeedQty, result.AllocatedQty)
|
||||
s.logger.Warnf("FIFO v2: clearing historical pending (%.3f) for %s/%d at PW=%d — over-consume is blocked by rule",
|
||||
remaining, req.Usable.LegacyTypeKey, req.Usable.ID, req.ProductWarehouseID)
|
||||
result.PendingQty = 0
|
||||
} else {
|
||||
result.PendingQty = remaining
|
||||
}
|
||||
result.PendingQty = remaining
|
||||
}
|
||||
|
||||
if err := s.applyUsableDeltas(tx, *usableRule, req.Usable.ID, result.AllocatedQty, result.PendingQty); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user