|
@@ -10,26 +10,28 @@ import (
|
|
|
|
|
|
type Cow struct {
|
|
|
Id int64 `json:"id"`
|
|
|
- PastureId int64 `json:"pastureId"`
|
|
|
- Sex pasturePb.Genders_Kind `json:"sex"`
|
|
|
- NeckRingNumber string `json:"neckRingNumber"`
|
|
|
- EarNumber string `json:"earNumber"`
|
|
|
- EarOldNumber string `json:"earOldNumber"`
|
|
|
- PenId int32 `json:"penId"`
|
|
|
- PenName string `json:"penName"`
|
|
|
- Lact int32 `json:"lact"`
|
|
|
- DayAge int32 `json:"dayAge"`
|
|
|
- CalvingAge int32 `json:"calvingAge"`
|
|
|
- PregnancyAge int32 `json:"pregnancyAge"`
|
|
|
- AdmissionAge int32 `json:"admissionAge"`
|
|
|
- AbortionAge int32 `json:"abortionAge"`
|
|
|
- CowType pasturePb.CowType_Kind `json:"cowType"`
|
|
|
- BreedStatus pasturePb.BreedStatus_Kind `json:"breedStatus"`
|
|
|
- CowKind pasturePb.CowKind_Kind `json:"cowKind"`
|
|
|
- BirthWeight int64 `json:"birthWeight"`
|
|
|
- CurrentWeight int64 `json:"currentWeight"`
|
|
|
- AdmissionWeight int64 `json:"admissionWeight"`
|
|
|
- SourceId pasturePb.CowSource_Kind `json:"sourceId"`
|
|
|
+ PastureId int64 `json:"pastureId"`
|
|
|
+ Sex pasturePb.Genders_Kind `json:"sex"`
|
|
|
+ NeckRingNumber string `json:"neckRingNumber"`
|
|
|
+ EarNumber string `json:"earNumber"`
|
|
|
+ EleEarNumber string `json:"eleEarNumber"`
|
|
|
+ EarOldNumber string `json:"earOldNumber"`
|
|
|
+ PenId int32 `json:"penId"`
|
|
|
+ PenName string `json:"penName"`
|
|
|
+ Lact int32 `json:"lact"`
|
|
|
+ DayAge int32 `json:"dayAge"`
|
|
|
+ CalvingAge int32 `json:"calvingAge"`
|
|
|
+ PregnancyAge int32 `json:"pregnancyAge"`
|
|
|
+ AdmissionAge int32 `json:"admissionAge"`
|
|
|
+ AbortionAge int32 `json:"abortionAge"`
|
|
|
+ CowType pasturePb.CowType_Kind `json:"cowType"`
|
|
|
+ BreedStatus pasturePb.BreedStatus_Kind `json:"breedStatus"`
|
|
|
+ CowKind pasturePb.CowKind_Kind `json:"cowKind"`
|
|
|
+ BirthWeight int64 `json:"birthWeight"`
|
|
|
+ CurrentWeight int64 `json:"currentWeight"`
|
|
|
+ AdmissionWeight int64 `json:"admissionWeight"`
|
|
|
+ SourceKind pasturePb.CowSource_Kind `json:"sourceKind"`
|
|
|
+ PurposeKind pasturePb.Purpose_Kind `json:"purposeKind"`
|
|
|
FatherNumber string `json:"fatherNumber"`
|
|
|
MotherNumber string `json:"motherNumber"`
|
|
|
AdmissionStatus pasturePb.AdmissionStatus_Kind `json:"admissionStatus"`
|
|
@@ -265,7 +267,7 @@ func (c CowSlice) ToPB(
|
|
|
BirthWeight: float32(v.BirthWeight) / 1000,
|
|
|
CurrentWeight: float32(v.CurrentWeight) / 1000,
|
|
|
DayAge: v.DayAge,
|
|
|
- SourceName: cowSourceMap[v.SourceId],
|
|
|
+ SourceName: cowSourceMap[v.SourceKind],
|
|
|
MotherNumber: v.MotherNumber,
|
|
|
FatherNumber: v.FatherNumber,
|
|
|
AdmissionStatusName: admissionStatusMap[v.AdmissionStatus],
|
|
@@ -349,11 +351,13 @@ func NewEnterCow(pastureId int64, req *pasturePb.EventEnterRequest, penMap map[i
|
|
|
CowType: req.CowType,
|
|
|
BreedStatus: req.BreedStatus,
|
|
|
CowKind: req.CowKind,
|
|
|
- SourceId: req.CowSource,
|
|
|
+ SourceKind: req.CowSource,
|
|
|
FatherNumber: req.FatherNumber,
|
|
|
MotherNumber: req.MotherNumber,
|
|
|
AdmissionStatus: pasturePb.AdmissionStatus_Admission,
|
|
|
HealthStatus: pasturePb.HealthStatus_Health,
|
|
|
+ PurposeKind: req.PurposeKind,
|
|
|
+ EleEarNumber: req.EleEarNumber,
|
|
|
IsPregnant: isPregnant,
|
|
|
WeaningAt: int64(req.WeaningAt),
|
|
|
BirthAt: int64(req.BirthAt),
|
|
@@ -381,7 +385,7 @@ func NewCalfCow(matherInfo *Cow, calf *CalvingCalf) *Cow {
|
|
|
CowKind: matherInfo.CowKind,
|
|
|
BirthWeight: calf.BirthWeight,
|
|
|
BirthAt: calf.BirthAt,
|
|
|
- SourceId: pasturePb.CowSource_Calving,
|
|
|
+ SourceKind: pasturePb.CowSource_Calving,
|
|
|
FatherNumber: matherInfo.EarNumber,
|
|
|
MotherNumber: matherInfo.LastBullNumber,
|
|
|
AdmissionStatus: pasturePb.AdmissionStatus_Admission,
|
|
@@ -455,7 +459,7 @@ func (c *Cow) GetAverageDailyWeight() float64 {
|
|
|
return 0
|
|
|
}
|
|
|
firstWeight := c.BirthWeight
|
|
|
- if c.SourceId == pasturePb.CowSource_Buy {
|
|
|
+ if c.SourceKind == pasturePb.CowSource_Buy {
|
|
|
firstWeight = c.AdmissionWeight
|
|
|
|
|
|
}
|