提取修改猪群数量逻辑

This commit is contained in:
2025-10-06 15:08:32 +08:00
parent 59b6977367
commit 91e18c432c
8 changed files with 66 additions and 54 deletions

View File

@@ -24,6 +24,8 @@ var (
ErrPenNotFound = errors.New("指定的猪栏不存在")
// ErrPenNotAssociatedWithBatch 表示猪栏未与该批次关联
ErrPenNotAssociatedWithBatch = errors.New("猪栏未与该批次关联")
// ErrInvalidOperation 非法操作
ErrInvalidOperation = errors.New("非法操作")
)
// --- 领域服务接口 ---
@@ -51,4 +53,6 @@ type PigBatchService interface {
SellPigs(batchID uint, quantity int, unitPrice float64, tatalPrice float64, traderName string, tradeDate time.Time, remarks string, operatorID uint) error
// BuyPigs 处理买猪的业务逻辑。
BuyPigs(batchID uint, quantity int, unitPrice float64, tatalPrice float64, traderName string, tradeDate time.Time, remarks string, operatorID uint) error
UpdatePigBatchQuantity(operatorID uint, batchID uint, changeType models.LogChangeType, changeAmount int, changeReason string, happenedAt time.Time) error
}