|
@@ -32,6 +32,7 @@ type Cow struct {
|
|
CowKind pasturePb.CowKind_Kind `json:"cowKind"` // 牛只品种
|
|
CowKind pasturePb.CowKind_Kind `json:"cowKind"` // 牛只品种
|
|
BirthWeight int64 `json:"birthWeight"` // 出生体重
|
|
BirthWeight int64 `json:"birthWeight"` // 出生体重
|
|
CurrentWeight int64 `json:"currentWeight"` // 当前体重
|
|
CurrentWeight int64 `json:"currentWeight"` // 当前体重
|
|
|
|
+ CurrentHeight int64 `json:"currentHeight"` // 当前身高
|
|
AdmissionWeight int64 `json:"admissionWeight"` // 入场体重
|
|
AdmissionWeight int64 `json:"admissionWeight"` // 入场体重
|
|
SourceKind pasturePb.CowSource_Kind `json:"sourceKind"` // 来源哪里
|
|
SourceKind pasturePb.CowSource_Kind `json:"sourceKind"` // 来源哪里
|
|
PurposeKind pasturePb.Purpose_Kind `json:"purposeKind"` // 用途
|
|
PurposeKind pasturePb.Purpose_Kind `json:"purposeKind"` // 用途
|
|
@@ -68,6 +69,7 @@ func (c *Cow) TableName() string {
|
|
return "cow"
|
|
return "cow"
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// EventUpdate 牛只基本信息维护
|
|
func (c *Cow) EventUpdate(weeklyActive int32) {
|
|
func (c *Cow) EventUpdate(weeklyActive int32) {
|
|
c.DayAge = c.GetDayAge()
|
|
c.DayAge = c.GetDayAge()
|
|
c.CalvingAge = c.GetCalvingAge()
|
|
c.CalvingAge = c.GetCalvingAge()
|
|
@@ -123,11 +125,12 @@ func (c *Cow) EventAbortionUpdate(abortionAt int64, isLact pasturePb.IsShow_Kind
|
|
}
|
|
}
|
|
|
|
|
|
// EventWeightUpdate 称重更新
|
|
// EventWeightUpdate 称重更新
|
|
-func (c *Cow) EventWeightUpdate(weight int64, weightAt int64) {
|
|
|
|
|
|
+func (c *Cow) EventWeightUpdate(weight, height, weightAt int64) {
|
|
c.LastSecondWeight = c.CurrentWeight
|
|
c.LastSecondWeight = c.CurrentWeight
|
|
c.LastSecondWeightAt = c.LastWeightAt
|
|
c.LastSecondWeightAt = c.LastWeightAt
|
|
c.LastWeightAt = weightAt
|
|
c.LastWeightAt = weightAt
|
|
c.CurrentWeight = weight
|
|
c.CurrentWeight = weight
|
|
|
|
+ c.CurrentHeight = height
|
|
}
|
|
}
|
|
|
|
|
|
// EventHealthStatusUpdate 健康状态更新
|
|
// EventHealthStatusUpdate 健康状态更新
|
|
@@ -291,6 +294,7 @@ func (c CowSlice) ToPB(
|
|
EarNumber: v.EarNumber,
|
|
EarNumber: v.EarNumber,
|
|
BirthWeight: float32(v.BirthWeight) / 1000,
|
|
BirthWeight: float32(v.BirthWeight) / 1000,
|
|
CurrentWeight: float32(v.CurrentWeight) / 1000,
|
|
CurrentWeight: float32(v.CurrentWeight) / 1000,
|
|
|
|
+ CurrentHeight: int32(v.CurrentHeight),
|
|
DayAge: v.DayAge,
|
|
DayAge: v.DayAge,
|
|
SourceName: cowSourceMap[v.SourceKind],
|
|
SourceName: cowSourceMap[v.SourceKind],
|
|
MotherNumber: v.MotherNumber,
|
|
MotherNumber: v.MotherNumber,
|
|
@@ -371,6 +375,7 @@ func NewEnterCow(pastureId int64, req *pasturePb.EventEnterRequest, penMap map[i
|
|
if req.BreedStatus == pasturePb.BreedStatus_No_Mating {
|
|
if req.BreedStatus == pasturePb.BreedStatus_No_Mating {
|
|
isForbiddenMating = pasturePb.IsShow_Ok
|
|
isForbiddenMating = pasturePb.IsShow_Ok
|
|
}
|
|
}
|
|
|
|
+
|
|
return &Cow{
|
|
return &Cow{
|
|
PastureId: pastureId,
|
|
PastureId: pastureId,
|
|
Sex: req.Sex,
|
|
Sex: req.Sex,
|