diff --git a/internal/modules/production/recordings/services/recording.service.go b/internal/modules/production/recordings/services/recording.service.go index e46056e5..819552dc 100644 --- a/internal/modules/production/recordings/services/recording.service.go +++ b/internal/modules/production/recordings/services/recording.service.go @@ -901,47 +901,6 @@ type eggTotals struct { Weight float64 } -type stockTotals struct { - Usage float64 - Pending float64 - Total float64 -} - -func summarizeExistingStocks(stocks []entity.RecordingStock) map[uint]stockTotals { - totals := make(map[uint]stockTotals) - for _, stock := range stocks { - var usage float64 - var pending float64 - if stock.UsageQty != nil { - usage = *stock.UsageQty - } - if stock.PendingQty != nil { - pending = *stock.PendingQty - } - current := totals[stock.ProductWarehouseId] - current.Usage += usage - current.Pending += pending - current.Total += usage + pending - totals[stock.ProductWarehouseId] = current - } - return totals -} - -func summarizeIncomingStocks(stocks []validation.Stock) map[uint]stockTotals { - totals := make(map[uint]stockTotals) - for _, stock := range stocks { - var pending float64 - if stock.PendingQty != nil { - pending = *stock.PendingQty - } - current := totals[stock.ProductWarehouseId] - current.Usage += stock.Qty - current.Pending += pending - current.Total += stock.Qty + pending - totals[stock.ProductWarehouseId] = current - } - return totals -} func stocksMatch(existing []entity.RecordingStock, incoming []validation.Stock) bool { hasPending := false