猪群管理聚合服务 增加调栏管理

This commit is contained in:
2025-10-05 17:30:39 +08:00
parent 6d080d250d
commit 01327eb8d2
10 changed files with 350 additions and 33 deletions

View File

@@ -21,6 +21,8 @@ var (
ErrPenStatusInvalidForAllocation = errors.New("猪栏状态不允许分配")
// ErrPenNotFound 表示猪栏不存在
ErrPenNotFound = errors.New("指定的猪栏不存在")
// ErrPenNotAssociatedWithBatch 表示猪栏未与该批次关联
ErrPenNotAssociatedWithBatch = errors.New("猪栏未与该批次关联")
)
// --- 领域服务接口 ---
@@ -28,6 +30,12 @@ var (
// PigBatchService 定义了猪批次管理的核心业务逻辑接口。
// 它抽象了所有与猪批次相关的操作,使得应用层可以依赖于此接口,而不是具体的实现。
type PigBatchService interface {
// TransferPigsWithinBatch 处理同一个猪群内部的调栏业务。
TransferPigsWithinBatch(batchID uint, fromPenID uint, toPenID uint, quantity uint) error
// TransferPigsAcrossBatches 处理跨猪群的调栏业务。
TransferPigsAcrossBatches(sourceBatchID uint, destBatchID uint, fromPenID uint, toPenID uint, quantity uint) error
// CreatePigBatch 创建一个新的猪批次。
CreatePigBatch(batch *models.PigBatch) (*models.PigBatch, error)