|
@@ -9,58 +9,59 @@ 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"`
|
|
|
- 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"`
|
|
|
- LactationAge int32 `json:"lactationAge"`
|
|
|
- DryMilkAge int32 `json:"dryMilkAge"`
|
|
|
- CowType pasturePb.CowType_Kind `json:"cowType"`
|
|
|
- MilkKind pasturePb.CowMilk_Kind `json:"milkKind"`
|
|
|
- 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"`
|
|
|
- IsPregnant pasturePb.IsShow_Kind `json:"isPregnant"`
|
|
|
- IsNotMating pasturePb.IsShow_Kind `json:"isNotMating"`
|
|
|
- HealthStatus pasturePb.HealthStatus_Kind `json:"healthStatus"`
|
|
|
- WeaningAt int64 `json:"weaningAt"`
|
|
|
- BirthAt int64 `json:"birthAt"`
|
|
|
- AdmissionAt int64 `json:"admissionAt"`
|
|
|
- DepartureAt int64 `json:"departureAt"`
|
|
|
- FirstMatingAt int64 `json:"firstMatingAt"`
|
|
|
- MatingTimes int32 `json:"matingTimes"`
|
|
|
- AbortionTimes int32 `json:"abortionTimes"`
|
|
|
- WeeklyActive int32 `json:"weeklyActive"`
|
|
|
- LastEstrusAt int64 `json:"lastEstrusAt"`
|
|
|
- LastCalvingAt int64 `json:"lastCalvingAt"`
|
|
|
- LastMatingAt int64 `json:"lastMatingAt"`
|
|
|
- LastBullNumber string `json:"lastBullNumber"`
|
|
|
- LastPregnantCheckAt int64 `json:"lastPregnantCheckAt"`
|
|
|
- LastDryMilkAt int64 `json:"lastDryMilkAt"`
|
|
|
- LastSecondWeight int64 `json:"lastSecondWeight"`
|
|
|
- LastSecondWeightAt int64 `json:"lastSecondWeightAt"`
|
|
|
- LastAbortionAt int64 `json:"lastAbortionAt"`
|
|
|
- LastWeightAt int64 `json:"lastWeightAt"`
|
|
|
- CreatedAt int64 `json:"createdAt"`
|
|
|
- UpdatedAt int64 `json:"updatedAt"`
|
|
|
+ Id int64 `json:"id"`
|
|
|
+ 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"`
|
|
|
+ LactationAge int32 `json:"lactationAge"`
|
|
|
+ DryMilkAge int32 `json:"dryMilkAge"`
|
|
|
+ CowType pasturePb.CowType_Kind `json:"cowType"`
|
|
|
+ MilkKind pasturePb.CowMilk_Kind `json:"milkKind"`
|
|
|
+ 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"`
|
|
|
+ IsPregnant pasturePb.IsShow_Kind `json:"isPregnant"`
|
|
|
+ IsForbiddenMating pasturePb.IsShow_Kind `json:"isForbiddenMating"`
|
|
|
+ HealthStatus pasturePb.HealthStatus_Kind `json:"healthStatus"`
|
|
|
+ WeaningAt int64 `json:"weaningAt"`
|
|
|
+ BirthAt int64 `json:"birthAt"`
|
|
|
+ AdmissionAt int64 `json:"admissionAt"`
|
|
|
+ DepartureAt int64 `json:"departureAt"`
|
|
|
+ FirstMatingAt int64 `json:"firstMatingAt"`
|
|
|
+ MatingTimes int32 `json:"matingTimes"`
|
|
|
+ AbortionTimes int32 `json:"abortionTimes"`
|
|
|
+ WeeklyActive int32 `json:"weeklyActive"`
|
|
|
+ LastEstrusAt int64 `json:"lastEstrusAt"`
|
|
|
+ LastCalvingAt int64 `json:"lastCalvingAt"`
|
|
|
+ LastMatingAt int64 `json:"lastMatingAt"`
|
|
|
+ LastBullNumber string `json:"lastBullNumber"`
|
|
|
+ LastPregnantCheckAt int64 `json:"lastPregnantCheckAt"`
|
|
|
+ LastDryMilkAt int64 `json:"lastDryMilkAt"`
|
|
|
+ LastForbiddenMatingAt int64 `json:"lastForbiddenMatingAt"`
|
|
|
+ LastSecondWeight int64 `json:"lastSecondWeight"`
|
|
|
+ LastSecondWeightAt int64 `json:"lastSecondWeightAt"`
|
|
|
+ LastAbortionAt int64 `json:"lastAbortionAt"`
|
|
|
+ LastWeightAt int64 `json:"lastWeightAt"`
|
|
|
+ CreatedAt int64 `json:"createdAt"`
|
|
|
+ UpdatedAt int64 `json:"updatedAt"`
|
|
|
}
|
|
|
|
|
|
func (c *Cow) TableName() string {
|
|
@@ -182,6 +183,7 @@ func (c *Cow) EstrusUpdate(estrusAt int64) {
|
|
|
c.LastEstrusAt = estrusAt
|
|
|
}
|
|
|
|
|
|
+
|
|
|
func (c *Cow) EventDryMilkUpdate(dryMilkAt int64, pen *Pen) {
|
|
|
c.LastDryMilkAt = dryMilkAt
|
|
|
c.MilkKind = pasturePb.CowMilk_Dry_Milk
|
|
@@ -189,6 +191,18 @@ func (c *Cow) EventDryMilkUpdate(dryMilkAt int64, pen *Pen) {
|
|
|
c.PenName = pen.Name
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+func (c *Cow) ForbiddenMatingUpdate(forbiddenMatingAt int64) {
|
|
|
+ c.IsForbiddenMating = pasturePb.IsShow_Ok
|
|
|
+ c.LastForbiddenMatingAt = forbiddenMatingAt
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (c *Cow) UnForbiddenMatingUpdate() {
|
|
|
+ c.IsForbiddenMating = pasturePb.IsShow_No
|
|
|
+ c.LastForbiddenMatingAt = 0
|
|
|
+}
|
|
|
+
|
|
|
type CowSlice []*Cow
|
|
|
|
|
|
func (c CowSlice) ToPB(
|