mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
[FEAT/BE] fixing remaining stock check closing response
This commit is contained in:
@@ -65,7 +65,7 @@ type SapronakCategoryRowDTO struct {
|
|||||||
QtyOut float64 `json:"qty_out"`
|
QtyOut float64 `json:"qty_out"`
|
||||||
QtyUsed float64 `json:"qty_used"`
|
QtyUsed float64 `json:"qty_used"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
ProductCategory []string `json:"product_category"`
|
ProductCategory string `json:"product_category"`
|
||||||
UnitPrice float64 `json:"unit_price"`
|
UnitPrice float64 `json:"unit_price"`
|
||||||
TotalAmount float64 `json:"total_amount"`
|
TotalAmount float64 `json:"total_amount"`
|
||||||
Notes string `json:"notes"`
|
Notes string `json:"notes"`
|
||||||
@@ -183,13 +183,13 @@ func ToSapronakProjectAggregatedFromReport(report *SapronakReportDTO, flag strin
|
|||||||
"PULLET": 0,
|
"PULLET": 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
buildFlagList := func(productID uint, fallback string) []string {
|
buildFlagList := func(productID uint, fallback string) string {
|
||||||
rawFlags := productFlags[productID]
|
rawFlags := productFlags[productID]
|
||||||
if len(rawFlags) == 0 {
|
if len(rawFlags) == 0 {
|
||||||
if fallback == "" {
|
if fallback == "" {
|
||||||
return []string{}
|
return ""
|
||||||
}
|
}
|
||||||
return []string{fallback}
|
return fallback
|
||||||
}
|
}
|
||||||
seen := make(map[string]struct{}, len(rawFlags))
|
seen := make(map[string]struct{}, len(rawFlags))
|
||||||
ordered := make([]string, 0, len(rawFlags))
|
ordered := make([]string, 0, len(rawFlags))
|
||||||
@@ -220,7 +220,7 @@ func ToSapronakProjectAggregatedFromReport(report *SapronakReportDTO, flag strin
|
|||||||
}
|
}
|
||||||
return li < lj
|
return li < lj
|
||||||
})
|
})
|
||||||
return ordered
|
return strings.Join(ordered, " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, group := range report.Groups {
|
for _, group := range report.Groups {
|
||||||
|
|||||||
+16
-18
@@ -308,25 +308,23 @@ func (s projectFlockKandangService) CheckClosing(c *fiber.Ctx, id uint) (*Closin
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, pw := range productWarehouses {
|
for _, pw := range productWarehouses {
|
||||||
if pw.Quantity > 0 {
|
category := ""
|
||||||
category := ""
|
if pw.Product.ProductCategory.Id != 0 {
|
||||||
if pw.Product.ProductCategory.Id != 0 {
|
category = pw.Product.ProductCategory.Name
|
||||||
category = pw.Product.ProductCategory.Name
|
|
||||||
}
|
|
||||||
uomName := ""
|
|
||||||
if pw.Product.Uom.Id != 0 {
|
|
||||||
uomName = pw.Product.Uom.Name
|
|
||||||
}
|
|
||||||
stockRemain = append(stockRemain, StockRemainingDetail{
|
|
||||||
FlagName: string(flagName),
|
|
||||||
ProductWarehouseId: pw.Id,
|
|
||||||
ProductId: pw.ProductId,
|
|
||||||
ProductName: pw.Product.Name,
|
|
||||||
ProductCategory: category,
|
|
||||||
Uom: uomName,
|
|
||||||
Quantity: pw.Quantity,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
uomName := ""
|
||||||
|
if pw.Product.Uom.Id != 0 {
|
||||||
|
uomName = pw.Product.Uom.Name
|
||||||
|
}
|
||||||
|
stockRemain = append(stockRemain, StockRemainingDetail{
|
||||||
|
FlagName: string(flagName),
|
||||||
|
ProductWarehouseId: pw.Id,
|
||||||
|
ProductId: pw.ProductId,
|
||||||
|
ProductName: pw.Product.Name,
|
||||||
|
ProductCategory: category,
|
||||||
|
Uom: uomName,
|
||||||
|
Quantity: pw.Quantity,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user