猪群领域其他方法映射到api

This commit is contained in:
2025-10-06 23:22:47 +08:00
parent 632bd20e7d
commit e142405bb3
10 changed files with 2783 additions and 35 deletions

View File

@@ -71,6 +71,40 @@ definitions:
type: object
dto.AssignEmptyPensToBatchRequest:
type: object
dto.BuyPigsRequest:
properties:
penID:
description: 猪栏ID
type: integer
quantity:
description: 买入猪只数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
totalPrice:
description: 总价
minimum: 0
type: number
tradeDate:
description: 交易日期
type: string
traderName:
description: 交易方名称
type: string
unitPrice:
description: 单价
minimum: 0
type: number
required:
- penID
- quantity
- totalPrice
- tradeDate
- traderName
- unitPrice
type: object
dto.CreateAreaControllerRequest:
properties:
location:
@@ -481,6 +515,180 @@ definitions:
- penID
- toBatchID
type: object
dto.RecordCullRequest:
properties:
happenedAt:
description: 发生时间
type: string
penID:
description: 猪栏ID
type: integer
quantity:
description: 淘汰猪数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
required:
- happenedAt
- penID
- quantity
type: object
dto.RecordDeathRequest:
properties:
happenedAt:
description: 发生时间
type: string
penID:
description: 猪栏ID
type: integer
quantity:
description: 死亡猪数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
required:
- happenedAt
- penID
- quantity
type: object
dto.RecordSickPigCullRequest:
properties:
happenedAt:
description: 发生时间
type: string
penID:
description: 猪栏ID
type: integer
quantity:
description: 淘汰猪数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
treatmentLocation:
allOf:
- $ref: '#/definitions/models.PigBatchSickPigTreatmentLocation'
description: 治疗地点
required:
- happenedAt
- penID
- quantity
- treatmentLocation
type: object
dto.RecordSickPigDeathRequest:
properties:
happenedAt:
description: 发生时间
type: string
penID:
description: 猪栏ID
type: integer
quantity:
description: 死亡猪数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
treatmentLocation:
allOf:
- $ref: '#/definitions/models.PigBatchSickPigTreatmentLocation'
description: 治疗地点
required:
- happenedAt
- penID
- quantity
- treatmentLocation
type: object
dto.RecordSickPigRecoveryRequest:
properties:
happenedAt:
description: 发生时间
type: string
penID:
description: 猪栏ID
type: integer
quantity:
description: 康复猪数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
treatmentLocation:
allOf:
- $ref: '#/definitions/models.PigBatchSickPigTreatmentLocation'
description: 治疗地点
required:
- happenedAt
- penID
- quantity
- treatmentLocation
type: object
dto.RecordSickPigsRequest:
properties:
happenedAt:
description: 发生时间
type: string
penID:
description: 猪栏ID
type: integer
quantity:
description: 病猪数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
treatmentLocation:
allOf:
- $ref: '#/definitions/models.PigBatchSickPigTreatmentLocation'
description: 治疗地点
required:
- happenedAt
- penID
- quantity
- treatmentLocation
type: object
dto.SellPigsRequest:
properties:
penID:
description: 猪栏ID
type: integer
quantity:
description: 卖出猪只数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
totalPrice:
description: 总价
minimum: 0
type: number
tradeDate:
description: 交易日期
type: string
traderName:
description: 交易方名称
type: string
unitPrice:
description: 单价
minimum: 0
type: number
required:
- penID
- quantity
- totalPrice
- tradeDate
- traderName
- unitPrice
type: object
dto.SubPlanResponse:
properties:
child_plan:
@@ -542,6 +750,50 @@ definitions:
- $ref: '#/definitions/models.TaskType'
example: 等待
type: object
dto.TransferPigsAcrossBatchesRequest:
properties:
destBatchID:
description: 目标猪批次ID
type: integer
fromPenID:
description: 源猪栏ID
type: integer
quantity:
description: 调栏猪只数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
toPenID:
description: 目标猪栏ID
type: integer
required:
- destBatchID
- fromPenID
- quantity
- toPenID
type: object
dto.TransferPigsWithinBatchRequest:
properties:
fromPenID:
description: 源猪栏ID
type: integer
quantity:
description: 调栏猪只数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
toPenID:
description: 目标猪栏ID
type: integer
required:
- fromPenID
- quantity
- toPenID
type: object
dto.UpdateAreaControllerRequest:
properties:
location:
@@ -708,6 +960,14 @@ definitions:
x-enum-varnames:
- OriginTypeSelfFarrowed
- OriginTypePurchased
models.PigBatchSickPigTreatmentLocation:
enum:
- 原地治疗
- 病猪栏治疗
type: string
x-enum-varnames:
- TreatmentLocationOnSite
- TreatmentLocationSickBay
models.PigBatchStatus:
enum:
- 保育
@@ -1377,7 +1637,7 @@ paths:
type: object
summary: 获取猪批次列表
tags:
- 批次管理
- 管理
post:
consumes:
- application/json
@@ -1403,7 +1663,7 @@ paths:
type: object
summary: 创建猪批次
tags:
- 批次管理
- 管理
/api/v1/pig-batches/{batchID}/remove-pen/{penID}:
delete:
description: 将一个空闲猪栏从指定的猪批次中移除
@@ -1427,7 +1687,7 @@ paths:
$ref: '#/definitions/controller.Response'
summary: 从猪批次移除空栏
tags:
- 批次管理
- 管理
/api/v1/pig-batches/{fromBatchID}/reclassify-pen:
post:
consumes:
@@ -1454,7 +1714,7 @@ paths:
$ref: '#/definitions/controller.Response'
summary: 将猪栏划拨到新批次
tags:
- 批次管理
- 管理
/api/v1/pig-batches/{id}:
delete:
description: 根据ID删除一个猪批次
@@ -1473,7 +1733,7 @@ paths:
$ref: '#/definitions/controller.Response'
summary: 删除猪批次
tags:
- 批次管理
- 管理
get:
description: 根据ID获取单个猪批次信息
parameters:
@@ -1496,7 +1756,7 @@ paths:
type: object
summary: 获取单个猪批次
tags:
- 批次管理
- 管理
put:
consumes:
- application/json
@@ -1527,7 +1787,7 @@ paths:
type: object
summary: 更新猪批次
tags:
- 批次管理
- 管理
/api/v1/pig-batches/{id}/assign-pens:
post:
consumes:
@@ -1554,6 +1814,33 @@ paths:
$ref: '#/definitions/controller.Response'
summary: 为猪批次分配空栏
tags:
- 猪群管理
/api/v1/pig-batches/{id}/buy-pigs:
post:
consumes:
- application/json
description: 记录猪批次中的猪只购买事件
parameters:
- description: 猪批次ID
in: path
name: id
required: true
type: integer
- description: 买猪请求信息
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.BuyPigsRequest'
produces:
- application/json
responses:
"200":
description: 买猪成功
schema:
$ref: '#/definitions/controller.Response'
summary: 处理买猪的业务逻辑
tags:
- 猪批次管理
/api/v1/pig-batches/{id}/move-pigs-into-pen:
post:
@@ -1581,6 +1868,249 @@ paths:
$ref: '#/definitions/controller.Response'
summary: 将猪只从“虚拟库存”移入指定猪栏
tags:
- 猪群管理
/api/v1/pig-batches/{id}/record-cull:
post:
consumes:
- application/json
description: 记录猪批次中正常猪只淘汰的数量和发生时间
parameters:
- description: 猪批次ID
in: path
name: id
required: true
type: integer
- description: 记录正常猪只淘汰请求信息
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.RecordCullRequest'
produces:
- application/json
responses:
"200":
description: 记录成功
schema:
$ref: '#/definitions/controller.Response'
summary: 记录正常猪只淘汰事件
tags:
- 猪批次管理
/api/v1/pig-batches/{id}/record-death:
post:
consumes:
- application/json
description: 记录猪批次中正常猪只死亡的数量和发生时间
parameters:
- description: 猪批次ID
in: path
name: id
required: true
type: integer
- description: 记录正常猪只死亡请求信息
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.RecordDeathRequest'
produces:
- application/json
responses:
"200":
description: 记录成功
schema:
$ref: '#/definitions/controller.Response'
summary: 记录正常猪只死亡事件
tags:
- 猪批次管理
/api/v1/pig-batches/{id}/record-sick-pig-cull:
post:
consumes:
- application/json
description: 记录猪批次中病猪淘汰的数量、治疗地点和发生时间
parameters:
- description: 猪批次ID
in: path
name: id
required: true
type: integer
- description: 记录病猪淘汰请求信息
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.RecordSickPigCullRequest'
produces:
- application/json
responses:
"200":
description: 记录成功
schema:
$ref: '#/definitions/controller.Response'
summary: 记录病猪淘汰事件
tags:
- 猪批次管理
/api/v1/pig-batches/{id}/record-sick-pig-death:
post:
consumes:
- application/json
description: 记录猪批次中病猪死亡的数量、治疗地点和发生时间
parameters:
- description: 猪批次ID
in: path
name: id
required: true
type: integer
- description: 记录病猪死亡请求信息
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.RecordSickPigDeathRequest'
produces:
- application/json
responses:
"200":
description: 记录成功
schema:
$ref: '#/definitions/controller.Response'
summary: 记录病猪死亡事件
tags:
- 猪批次管理
/api/v1/pig-batches/{id}/record-sick-pig-recovery:
post:
consumes:
- application/json
description: 记录猪批次中病猪康复的数量、治疗地点和发生时间
parameters:
- description: 猪批次ID
in: path
name: id
required: true
type: integer
- description: 记录病猪康复请求信息
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.RecordSickPigRecoveryRequest'
produces:
- application/json
responses:
"200":
description: 记录成功
schema:
$ref: '#/definitions/controller.Response'
summary: 记录病猪康复事件
tags:
- 猪批次管理
/api/v1/pig-batches/{id}/record-sick-pigs:
post:
consumes:
- application/json
description: 记录猪批次中新增病猪的数量、治疗地点和发生时间
parameters:
- description: 猪批次ID
in: path
name: id
required: true
type: integer
- description: 记录病猪请求信息
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.RecordSickPigsRequest'
produces:
- application/json
responses:
"200":
description: 记录成功
schema:
$ref: '#/definitions/controller.Response'
summary: 记录新增病猪事件
tags:
- 猪批次管理
/api/v1/pig-batches/{id}/sell-pigs:
post:
consumes:
- application/json
description: 记录猪批次中的猪只出售事件
parameters:
- description: 猪批次ID
in: path
name: id
required: true
type: integer
- description: 卖猪请求信息
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.SellPigsRequest'
produces:
- application/json
responses:
"200":
description: 卖猪成功
schema:
$ref: '#/definitions/controller.Response'
summary: 处理卖猪的业务逻辑
tags:
- 猪批次管理
/api/v1/pig-batches/{id}/transfer-within-batch:
post:
consumes:
- application/json
description: 将指定数量的猪只在同一个猪群的不同猪栏间调动
parameters:
- description: 猪批次ID
in: path
name: id
required: true
type: integer
- description: 群内调栏请求信息
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.TransferPigsWithinBatchRequest'
produces:
- application/json
responses:
"200":
description: 调栏成功
schema:
$ref: '#/definitions/controller.Response'
summary: 群内调栏
tags:
- 猪批次管理
/api/v1/pig-batches/{sourceBatchID}/transfer-across-batches:
post:
consumes:
- application/json
description: 将指定数量的猪只从一个猪群的猪栏调动到另一个猪群的猪栏
parameters:
- description: 源猪批次ID
in: path
name: sourceBatchID
required: true
type: integer
- description: 跨群调栏请求信息
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.TransferPigsAcrossBatchesRequest'
produces:
- application/json
responses:
"200":
description: 调栏成功
schema:
$ref: '#/definitions/controller.Response'
summary: 跨猪群调栏
tags:
- 猪批次管理
/api/v1/pig-houses:
get: