feat(BE-278): add std for max_depletion

This commit is contained in:
ragilap
2025-12-31 09:44:20 +07:00
parent d9afd2913e
commit b8c0b0c37d
3 changed files with 17 additions and 11 deletions
+7 -6
View File
@@ -34,10 +34,11 @@ type Recording struct {
LatestApproval *Approval `gorm:"-" json:"-"`
StandardHandDay *float64 `gorm:"-"`
StandardHandHouse *float64 `gorm:"-"`
StandardFeedIntake *float64 `gorm:"-"`
StandardEggMesh *float64 `gorm:"-"`
StandardEggWeight *float64 `gorm:"-"`
StandardFcr *float64 `gorm:"-"`
StandardHandDay *float64 `gorm:"-"`
StandardHandHouse *float64 `gorm:"-"`
StandardFeedIntake *float64 `gorm:"-"`
StandardMaxDepletion *float64 `gorm:"-"`
StandardEggMesh *float64 `gorm:"-"`
StandardEggWeight *float64 `gorm:"-"`
StandardFcr *float64 `gorm:"-"`
}
@@ -33,6 +33,7 @@ type RecordingRelationDTO struct {
StandardHandDay *float64 `json:"hand_day_std,omitempty"`
StandardHandHouse *float64 `json:"hand_house_std,omitempty"`
StandardFeedIntake *float64 `json:"feed_intake_std,omitempty"`
StandardMaxDepletion *float64 `json:"max_depletion_std,omitempty"`
StandardEggMesh *float64 `json:"egg_mesh_std,omitempty"`
StandardEggWeight *float64 `json:"egg_weight_std,omitempty"`
StandardFcr *float64 `json:"fcr_std,omitempty"`
@@ -164,6 +165,7 @@ func ToRecordingRelationDTO(e entity.Recording) RecordingRelationDTO {
StandardHandDay: e.StandardHandDay,
StandardHandHouse: e.StandardHandHouse,
StandardFeedIntake: e.StandardFeedIntake,
StandardMaxDepletion: e.StandardMaxDepletion,
StandardEggMesh: e.StandardEggMesh,
StandardEggWeight: e.StandardEggWeight,
StandardFcr: e.StandardFcr,
@@ -1016,11 +1016,12 @@ func (s *recordingService) attachLatestApproval(ctx context.Context, item *entit
}
type productionStandardValues struct {
HandDay *float64
HandHouse *float64
FeedIntake *float64
EggMesh *float64
EggWeight *float64
HandDay *float64
HandHouse *float64
FeedIntake *float64
MaxDepletion *float64
EggMesh *float64
EggWeight *float64
}
func (s *recordingService) attachProductionStandards(ctx context.Context, items []entity.Recording) error {
@@ -1083,6 +1084,7 @@ func (s *recordingService) attachProductionStandard(ctx context.Context, item *e
}
if growthDetail != nil {
standard.FeedIntake = growthDetail.FeedIntake
standard.MaxDepletion = growthDetail.MaxDepletion
if category == string(utils.ProjectFlockCategoryLaying) && growthDetail.TargetMeanBw != nil && item.ProjectFlockKandang.ProjectFlock.FcrId > 0 {
targetWeight := *growthDetail.TargetMeanBw
if targetWeight > 10 {
@@ -1103,6 +1105,7 @@ func (s *recordingService) attachProductionStandard(ctx context.Context, item *e
item.StandardHandDay = standard.HandDay
item.StandardHandHouse = standard.HandHouse
item.StandardFeedIntake = standard.FeedIntake
item.StandardMaxDepletion = standard.MaxDepletion
item.StandardEggMesh = standard.EggMesh
item.StandardEggWeight = standard.EggWeight
item.StandardFcr = standardFcr