mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-23 23:05:44 +00:00
feat(BE-74-76-78-278):delete unused code recording
This commit is contained in:
@@ -901,47 +901,6 @@ type eggTotals struct {
|
|||||||
Weight float64
|
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 {
|
func stocksMatch(existing []entity.RecordingStock, incoming []validation.Stock) bool {
|
||||||
hasPending := false
|
hasPending := false
|
||||||
|
|||||||
Reference in New Issue
Block a user