| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 | 
							- package model
 
- import (
 
- 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
 
- )
 
- type EventEstrus struct {
 
- 	Id                  int64                           `json:"id"`
 
- 	PastureId           int64                           `json:"pastureId"`
 
- 	CowId               int64                           `json:"cowId"`
 
- 	NeckRingNumber      string                          `json:"neckRingNumber"`
 
- 	EarNumber           string                          `json:"earNumber"`
 
- 	Lact                int32                           `json:"lact"`
 
- 	DayAge              int32                           `json:"dayAge"`
 
- 	CalvingAge          int32                           `json:"calvingAge"`
 
- 	ExposeEstrusType    pasturePb.ExposeEstrusType_Kind `json:"exposeEstrusType"`
 
- 	LastEstrusDay       int64                           `json:"lastEstrusDay"`
 
- 	PlanDay             int64                           `json:"planDay"`
 
- 	RealityDay          int64                           `json:"realityDay"`
 
- 	EndDay              int64                           `json:"endDay"`
 
- 	IsMating            pasturePb.IsShow_Kind           `json:"isMating"`
 
- 	UnMatingReasonsKind pasturePb.UnMatingReasons_Kind  `json:"unMatingReasonsKind"`
 
- 	UnMatingReasonsName string                          `json:"unMatingReasonsName"`
 
- 	Level               pasturePb.EstrusLevel_Kind      `json:"level"`
 
- 	Remarks             string                          `json:"remarks"`
 
- 	IsShow              pasturePb.IsShow_Kind           `json:"isShow"`
 
- 	OperationId         int64                           `json:"operationId"`
 
- 	OperationName       string                          `json:"operationName"`
 
- 	MessageId           int64                           `json:"messageId"`
 
- 	MessageName         string                          `json:"messageName"`
 
- 	CreatedAt           int64                           `json:"createdAt"`
 
- 	UpdatedAt           int64                           `json:"updatedAt"`
 
- }
 
- func (e *EventEstrus) TableName() string {
 
- 	return "event_estrus"
 
- }
 
- func NewEventEstrus(
 
- 	pastureId int64,
 
- 	cow *Cow,
 
- 	exposeEstrusType pasturePb.ExposeEstrusType_Kind,
 
- 	isShow pasturePb.IsShow_Kind,
 
- 	isMating pasturePb.IsShow_Kind,
 
- 	PlanDay int64,
 
- 	operationUser, currentUser *SystemUser,
 
- ) *EventEstrus {
 
- 	return &EventEstrus{
 
- 		PastureId:        pastureId,
 
- 		CowId:            cow.Id,
 
- 		Lact:             cow.Lact,
 
- 		DayAge:           cow.DayAge,
 
- 		CalvingAge:       cow.CalvingAge,
 
- 		NeckRingNumber:   cow.NeckRingNumber,
 
- 		EarNumber:        cow.EarNumber,
 
- 		ExposeEstrusType: exposeEstrusType,
 
- 		PlanDay:          PlanDay,
 
- 		RealityDay:       PlanDay,
 
- 		IsMating:         isMating,
 
- 		IsShow:           isShow,
 
- 		OperationId:      operationUser.Id,
 
- 		OperationName:    operationUser.Name,
 
- 		MessageId:        currentUser.Id,
 
- 		MessageName:      currentUser.Name,
 
- 	}
 
- }
 
- type EventEstrusSlice []*EventEstrus
 
- func (e EventEstrusSlice) ToPB() []*pasturePb.SearchEventEstrusList {
 
- 	res := make([]*pasturePb.SearchEventEstrusList, len(e))
 
- 	for i, v := range e {
 
- 		res[i] = &pasturePb.SearchEventEstrusList{
 
- 			Id:              int32(v.Id),
 
- 			CowId:           int32(v.CowId),
 
- 			EarNumber:       v.EarNumber,
 
- 			DayAge:          v.DayAge,
 
- 			Lact:            v.Lact,
 
- 			EstrusAt:        int32(v.RealityDay),
 
- 			IsMating:        v.IsMating,
 
- 			UnMatingReasons: v.UnMatingReasonsName,
 
- 			OperationName:   v.OperationName,
 
- 			Remarks:         v.Remarks,
 
- 			CreatedAt:       int32(v.CreatedAt),
 
- 			UpdatedAt:       int32(v.UpdatedAt),
 
- 		}
 
- 	}
 
- 	return res
 
- }
 
- type EventEstrusBatch struct {
 
- 	EventEstrusList  []*EventEstrus
 
- 	EventMatingList  []*EventMating
 
- 	ExposeEstrusType pasturePb.ExposeEstrusType_Kind
 
- 	EarNumbers       []string
 
- }
 
 
  |