|
@@ -9,58 +9,59 @@ import (
|
|
|
)
|
|
|
|
|
|
type Cow struct {
|
|
|
- Id int64 `json:"id"`
|
|
|
- PastureId int64 `json:"pastureId"` // 牧场id
|
|
|
- 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"` // 栏舍id
|
|
|
- PenName string `json:"penName"` // 栏舍名称
|
|
|
- Lact int32 `json:"lact"` // 胎次
|
|
|
- DayAge int32 `json:"dayAge"` // 日龄
|
|
|
- CalvingAge int32 `json:"calvingAge"` // 产后天使
|
|
|
- PregnancyAge int32 `json:"pregnancyAge"` // 怀孕天数 孕检结果有阳性更新,产犊后至0
|
|
|
- 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"` // 是否禁配 1 是 2 否
|
|
|
- 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"` // 牧场id
|
|
|
+ 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"` // 栏舍id
|
|
|
+ PenName string `json:"penName"` // 栏舍名称
|
|
|
+ Lact int32 `json:"lact"` // 胎次
|
|
|
+ DayAge int32 `json:"dayAge"` // 日龄
|
|
|
+ CalvingAge int32 `json:"calvingAge"` // 产后天使
|
|
|
+ PregnancyAge int32 `json:"pregnancyAge"` // 怀孕天数 孕检结果有阳性更新,产犊后至0
|
|
|
+ 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"` // 是否禁配 1 是 2 否
|
|
|
+ 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
|
|
|
}
|
|
|
|
|
|
+// EventDryMilkUpdate 干奶更新
|
|
|
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
|
|
|
}
|
|
|
|
|
|
+// ForbiddenMatingUpdate 禁配更新
|
|
|
+func (c *Cow) ForbiddenMatingUpdate(forbiddenMatingAt int64) {
|
|
|
+ c.IsForbiddenMating = pasturePb.IsShow_Ok
|
|
|
+ c.LastForbiddenMatingAt = forbiddenMatingAt
|
|
|
+}
|
|
|
+
|
|
|
+// UnForbiddenMatingUpdate 解禁配更新
|
|
|
+func (c *Cow) UnForbiddenMatingUpdate() {
|
|
|
+ c.IsForbiddenMating = pasturePb.IsShow_No
|
|
|
+ c.LastForbiddenMatingAt = 0
|
|
|
+}
|
|
|
+
|
|
|
type CowSlice []*Cow
|
|
|
|
|
|
func (c CowSlice) ToPB(
|