mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
[FIX/BE-US] adjustment recording
This commit is contained in:
@@ -279,9 +279,14 @@ func (u *ProjectflockController) LookupProjectFlockKandang(c *fiber.Ctx) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
_ = availableStock
|
||||||
|
|
||||||
dtoResult := dto.ToProjectFlockKandangDTO(*result)
|
dtoResult := dto.ToProjectFlockKandangDTO(*result)
|
||||||
dtoResult.AvailableQuantity = float64(availableStock)
|
if population, err := u.ProjectflockService.GetProjectFlockKandangPopulation(c, result.Id); err != nil {
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
dtoResult.AvailableQuantity = population
|
||||||
|
}
|
||||||
if warehouse, werr := u.ProjectflockService.GetWarehouseByKandangID(c, result.KandangId); werr != nil {
|
if warehouse, werr := u.ProjectflockService.GetWarehouseByKandangID(c, result.KandangId); werr != nil {
|
||||||
return werr
|
return werr
|
||||||
} else if warehouse != nil {
|
} else if warehouse != nil {
|
||||||
@@ -289,10 +294,7 @@ func (u *ProjectflockController) LookupProjectFlockKandang(c *fiber.Ctx) error {
|
|||||||
dtoResult.Warehouse = &mapped
|
dtoResult.Warehouse = &mapped
|
||||||
}
|
}
|
||||||
if withPopulation {
|
if withPopulation {
|
||||||
population, err := u.ProjectflockService.GetProjectFlockKandangPopulation(c, result.Id)
|
population := dtoResult.AvailableQuantity
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
dtoResult.Population = &population
|
dtoResult.Population = &population
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,14 @@ type KandangWithPivotDTO struct {
|
|||||||
|
|
||||||
type ProjectFlockWithPivotDTO struct {
|
type ProjectFlockWithPivotDTO struct {
|
||||||
ProjectFlockRelationDTO
|
ProjectFlockRelationDTO
|
||||||
Area *areaDTO.AreaRelationDTO `json:"area,omitempty"`
|
Area *areaDTO.AreaRelationDTO `json:"area,omitempty"`
|
||||||
Category string `json:"category"`
|
Category string `json:"category"`
|
||||||
Fcr *fcrDTO.FcrRelationDTO `json:"fcr,omitempty"`
|
Fcr *fcrDTO.FcrRelationDTO `json:"fcr,omitempty"`
|
||||||
ProductionStandard *productionStandardDTO.ProductionStandardRelationDTO `json:"production_standard,omitempty"`
|
ProductionStandard *productionStandardDTO.ProductionStandardRelationDTO `json:"production_standard,omitempty"`
|
||||||
Location *locationDTO.LocationRelationDTO `json:"location,omitempty"`
|
ProductionStandardId uint `json:"production_standard_id"`
|
||||||
Kandangs []KandangWithPivotDTO `json:"kandangs,omitempty"`
|
Location *locationDTO.LocationRelationDTO `json:"location,omitempty"`
|
||||||
CreatedUser *userDTO.UserRelationDTO `json:"created_user,omitempty"`
|
Kandangs []KandangWithPivotDTO `json:"kandangs,omitempty"`
|
||||||
|
CreatedUser *userDTO.UserRelationDTO `json:"created_user,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProjectFlockKandangDTO struct {
|
type ProjectFlockKandangDTO struct {
|
||||||
@@ -55,7 +56,8 @@ func ToProjectFlockKandangDTO(e entity.ProjectFlockKandang) ProjectFlockKandangD
|
|||||||
Period: e.Period,
|
Period: e.Period,
|
||||||
FlockName: e.ProjectFlock.FlockName,
|
FlockName: e.ProjectFlock.FlockName,
|
||||||
},
|
},
|
||||||
Category: e.ProjectFlock.Category,
|
Category: e.ProjectFlock.Category,
|
||||||
|
ProductionStandardId: e.ProjectFlock.ProductionStandardId,
|
||||||
}
|
}
|
||||||
|
|
||||||
if e.ProjectFlock.Area.Id != 0 {
|
if e.ProjectFlock.Area.Id != 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user