|
@@ -114,8 +114,15 @@ func (s *StoreEntry) PregnantCheckCreateBatch(ctx context.Context, req *pastureP
|
|
|
}
|
|
|
|
|
|
// 更新孕检事件表
|
|
|
- item.EventPregnancyCheck.EventUpdate(int64(item.PregnantCheckAt), item.PregnantCheckResult, item.PregnantCheckMethod,
|
|
|
- item.OperationUser, userModel.SystemUser, item.Remarks)
|
|
|
+ item.EventPregnancyCheck.EventUpdate(
|
|
|
+ int64(item.PregnantCheckAt),
|
|
|
+ item.PregnantCheckResult,
|
|
|
+ item.PregnantCheckMethod,
|
|
|
+ item.OperationUser,
|
|
|
+ userModel.SystemUser,
|
|
|
+ item.Remarks,
|
|
|
+ item.Cow,
|
|
|
+ )
|
|
|
if err = tx.Model(new(model.EventPregnantCheck)).
|
|
|
Select("reality_day", "pregnant_check_result", "pregnant_check_method", "operation_id", "operation_name", "message_id", "message_name", "remarks", "status").
|
|
|
Where("id = ?", item.EventPregnancyCheck.Id).
|
|
@@ -388,11 +395,12 @@ func (s *StoreEntry) NeckRingEstrusToMating(ctx context.Context, userModel *mode
|
|
|
}
|
|
|
// 新增配种事件数据
|
|
|
newMating := model.NewEventMating(userModel.AppPasture.Id, item.Cow, item.MatingAt, pasturePb.ExposeEstrusType_Neck_Ring)
|
|
|
- newMating.EventUpdate(item.MatingAt, item.FrozenSemen.BullId, false, item.OperationUser, userModel.SystemUser)
|
|
|
+ newMating.EventUpdate(item.Cow, item.MatingAt, item.FrozenSemen.BullId, false, item.OperationUser, userModel.SystemUser)
|
|
|
if err := s.MatingCowUpdate(ctx, userModel.AppPasture.Id, item, false); err != nil {
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
- if err := tx.Model(newMating).Create(newMating).Error; err != nil {
|
|
|
+ if err := tx.Model(new(model.EventMating)).
|
|
|
+ Create(newMating).Error; err != nil {
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
return nil
|
|
@@ -438,7 +446,7 @@ func (s *StoreEntry) NaturalEstrusToMating(ctx context.Context, userModel *model
|
|
|
// 2.2. 同期初配
|
|
|
IsMatingUpdate := lastEventMating.IsMatingUpdate()
|
|
|
if IsMatingUpdate {
|
|
|
- lastEventMating.EventUpdate(item.MatingAt, item.FrozenSemen.BullId, isReMating, item.OperationUser, userModel.SystemUser)
|
|
|
+ lastEventMating.EventUpdate(item.Cow, item.MatingAt, item.FrozenSemen.BullId, isReMating, item.OperationUser, userModel.SystemUser)
|
|
|
if err = tx.Model(lastEventMating).
|
|
|
Select("mating_at", "status", "reality_day", "frozen_semen_number", "operation_id", "operation_name", "message_id", "message_name").
|
|
|
Where("id = ?", lastEventMating.Id).
|
|
@@ -460,7 +468,7 @@ func (s *StoreEntry) NaturalEstrusToMating(ctx context.Context, userModel *model
|
|
|
}
|
|
|
// 先创建一条新的配种数据
|
|
|
newMating := model.NewEventMating(userModel.AppPasture.Id, item.Cow, item.MatingAt, pasturePb.ExposeEstrusType_Natural_Estrus)
|
|
|
- newMating.EventUpdate(item.MatingAt, item.FrozenSemen.BullId, isReMating, item.OperationUser, userModel.SystemUser)
|
|
|
+ newMating.EventUpdate(item.Cow, item.MatingAt, item.FrozenSemen.BullId, isReMating, item.OperationUser, userModel.SystemUser)
|
|
|
if err = tx.Model(newMating).Create(newMating).Error; err != nil {
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
@@ -528,7 +536,10 @@ func (s *StoreEntry) WeaningBatch(ctx context.Context, req *pasturePb.EventWeani
|
|
|
return xerr.WithStack(err)
|
|
|
}
|
|
|
|
|
|
- eventWeaning.EventUpdate(int64(item.WeaningAt), int32(item.Weight*1000), item.Remarks, item.PenId, operation, userModel.SystemUser)
|
|
|
+ eventWeaning.EventUpdate(
|
|
|
+ cowInfo, int64(item.WeaningAt), int32(item.Weight*1000),
|
|
|
+ item.Remarks, item.PenId, operation, userModel.SystemUser,
|
|
|
+ )
|
|
|
if err = tx.Model(new(model.EventWeaning)).
|
|
|
Select("status", "reality_day", "operation_id", "operation_name", "message_id", "message_name", "remarks", "after_pen_id").
|
|
|
Where("id = ?", eventWeaning.Id).
|