|
@@ -10,26 +10,28 @@ 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"` // 耳标号
|
|
|
- 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"` // 流产天数
|
|
|
- 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"` // 牧场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"` // 流产天数
|
|
|
+ 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
|
|
|
|
|
|
}
|