diff --git a/internal/modules/closings/dto/closingSapronak.dto.go b/internal/modules/closings/dto/closingSapronak.dto.go index d4cb0d0d..4dd1dc59 100644 --- a/internal/modules/closings/dto/closingSapronak.dto.go +++ b/internal/modules/closings/dto/closingSapronak.dto.go @@ -65,7 +65,7 @@ type SapronakCategoryRowDTO struct { QtyOut float64 `json:"qty_out"` QtyUsed float64 `json:"qty_used"` Description string `json:"description"` - ProductCategory []string `json:"product_category"` + ProductCategory string `json:"product_category"` UnitPrice float64 `json:"unit_price"` TotalAmount float64 `json:"total_amount"` Notes string `json:"notes"` @@ -183,13 +183,13 @@ func ToSapronakProjectAggregatedFromReport(report *SapronakReportDTO, flag strin "PULLET": 0, } - buildFlagList := func(productID uint, fallback string) []string { + buildFlagList := func(productID uint, fallback string) string { rawFlags := productFlags[productID] if len(rawFlags) == 0 { if fallback == "" { - return []string{} + return "" } - return []string{fallback} + return fallback } seen := make(map[string]struct{}, len(rawFlags)) ordered := make([]string, 0, len(rawFlags)) @@ -220,7 +220,7 @@ func ToSapronakProjectAggregatedFromReport(report *SapronakReportDTO, flag strin } return li < lj }) - return ordered + return strings.Join(ordered, " ") } for _, group := range report.Groups { diff --git a/internal/modules/production/project-flock-kandangs/services/project_flock_kandang.service.go b/internal/modules/production/project-flock-kandangs/services/project_flock_kandang.service.go index 61a593d5..a2d276cd 100644 --- a/internal/modules/production/project-flock-kandangs/services/project_flock_kandang.service.go +++ b/internal/modules/production/project-flock-kandangs/services/project_flock_kandang.service.go @@ -308,25 +308,23 @@ func (s projectFlockKandangService) CheckClosing(c *fiber.Ctx, id uint) (*Closin } for _, pw := range productWarehouses { - if pw.Quantity > 0 { - category := "" - if pw.Product.ProductCategory.Id != 0 { - 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, - }) + category := "" + if pw.Product.ProductCategory.Id != 0 { + 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, + }) } } }