|
@@ -78,6 +78,10 @@ func (s *StoreEntry) MatingCreateCheck(ctx context.Context, pastureId int64, req
|
|
|
return nil, xerr.WithStack(err)
|
|
|
}
|
|
|
|
|
|
+ if cowInfo.GetEventDayAge(int64(v.MatingAt)) < 0 {
|
|
|
+ return nil, xerr.Customf("牛号:%s,配种时间不能早于牛只出生时间", cowInfo.EarNumber)
|
|
|
+ }
|
|
|
+
|
|
|
operationUser, err := s.GetSystemUserById(ctx, int64(v.OperationId))
|
|
|
if err != nil {
|
|
|
return nil, xerr.WithStack(err)
|
|
@@ -152,6 +156,10 @@ func (s *StoreEntry) PregnantCheckDataCheck(ctx context.Context, pastureId int64
|
|
|
return nil, xerr.Customf("牛只: %d,不是母牛", cowInfo.Id)
|
|
|
}
|
|
|
|
|
|
+ if cowInfo.GetEventDayAge(int64(item.PregnantCheckAt)) < 0 {
|
|
|
+ return nil, xerr.Customf("牛号: %s,孕检时间不能早于牛只出生时间", cowInfo.EarNumber)
|
|
|
+ }
|
|
|
+
|
|
|
operationUser, err := s.GetSystemUserById(ctx, int64(item.OperationId))
|
|
|
if err != nil {
|
|
|
zaplog.Error("PregnantCheckDataCheck", zap.Any("id", item.OperationId), zap.Any("error", err.Error()))
|
|
@@ -230,7 +238,7 @@ func (s *StoreEntry) EstrusCheckDataCheck(ctx context.Context, userModel *model.
|
|
|
}
|
|
|
|
|
|
if int64(item.EstrusAt) <= cowInfo.BirthAt {
|
|
|
- return nil, xerr.Custom("发情时间不能小于出生时间")
|
|
|
+ return nil, xerr.Customf("牛号: %s,发情时间不能小于出生时间", cowInfo.EarNumber)
|
|
|
}
|
|
|
|
|
|
if int64(item.EstrusAt) <= cowInfo.LastCalvingAt {
|
|
@@ -298,6 +306,10 @@ func (s *StoreEntry) AbortionEventDataCheck(ctx context.Context, userModel *mode
|
|
|
return nil, xerr.Customf("牛只: %s,不是怀孕状态", cow.EarNumber)
|
|
|
}
|
|
|
|
|
|
+ if cow.GetEventDayAge(int64(item.AbortionAt)) < 0 {
|
|
|
+ return nil, xerr.Customf("牛号: %s,流产时间不能早于牛只出生时间", cow.EarNumber)
|
|
|
+ }
|
|
|
+
|
|
|
operationUser, err := s.GetSystemUserById(ctx, int64(item.OperationId))
|
|
|
if err != nil {
|
|
|
return nil, xerr.WithStack(err)
|