mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Feat[BE]: implement FIFO stock management for marketing delivery products, including migration scripts and updates to related services and DTOs
This commit is contained in:
@@ -64,7 +64,7 @@ func ToSalesDTO(e entity.MarketingDeliveryProduct) SalesDTO {
|
||||
DoNumber: doNumber,
|
||||
Product: product,
|
||||
Customer: customer,
|
||||
Qty: e.Qty,
|
||||
Qty: e.UsageQty, // Show allocated quantity from FIFO
|
||||
Weight: e.TotalWeight,
|
||||
AvgWeight: e.AvgWeight,
|
||||
Price: e.UnitPrice,
|
||||
|
||||
@@ -712,13 +712,13 @@ func (s closingService) calculateAverageSalesAge(ctx context.Context, projectFlo
|
||||
)
|
||||
|
||||
for _, product := range deliveryProducts {
|
||||
if product.Qty == 0 {
|
||||
if product.UsageQty == 0 {
|
||||
continue
|
||||
}
|
||||
projectFlockKandang := product.MarketingProduct.ProductWarehouse.ProjectFlockKandang
|
||||
ageWeeks := dto.CalculateAgeFromChickinDataProduksi(projectFlockKandang, product.DeliveryDate)
|
||||
totalAgeWeeks += float64(ageWeeks) * product.Qty
|
||||
totalQty += product.Qty
|
||||
totalAgeWeeks += float64(ageWeeks) * product.UsageQty
|
||||
totalQty += product.UsageQty
|
||||
}
|
||||
|
||||
if totalQty == 0 {
|
||||
|
||||
Reference in New Issue
Block a user