ManualControl

This commit is contained in:
2025-10-13 12:16:36 +08:00
parent 9b6548c1b4
commit 8c0dc6c815
3 changed files with 1244 additions and 1100 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -334,6 +334,15 @@ definitions:
example: testuser example: testuser
type: string type: string
type: object type: object
dto.ManualControlDeviceRequest:
properties:
action:
description: Action 不传表示这是一个传感器, 会触发一次采集
enum:
- "on"
- "off"
type: string
type: object
dto.MovePigsIntoPenRequest: dto.MovePigsIntoPenRequest:
properties: properties:
quantity: quantity:
@@ -1462,6 +1471,33 @@ paths:
summary: 更新设备信息 summary: 更新设备信息
tags: tags:
- 设备管理 - 设备管理
/api/v1/devices/manual-control/{id}:
post:
consumes:
- application/json
description: 根据设备ID和指定的动作开启或关闭来手动控制设备
parameters:
- description: 设备ID
in: path
name: id
required: true
type: string
- description: 手动控制指令
in: body
name: manualControl
required: true
schema:
$ref: '#/definitions/dto.ManualControlDeviceRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controller.Response'
summary: 手动控制设备
tags:
- 设备管理
/api/v1/pens: /api/v1/pens:
get: get:
description: 获取所有猪栏的列表 description: 获取所有猪栏的列表
@@ -1664,57 +1700,6 @@ paths:
summary: 创建猪批次 summary: 创建猪批次
tags: tags:
- 猪群管理 - 猪群管理
/api/v1/pig-batches/{batchID}/remove-pen/{penID}:
delete:
description: 将一个空闲猪栏从指定的猪批次中移除
parameters:
- description: 猪批次ID
in: path
name: batchID
required: true
type: integer
- description: 待移除的猪栏ID
in: path
name: penID
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 移除成功
schema:
$ref: '#/definitions/controller.Response'
summary: 从猪批次移除空栏
tags:
- 猪群管理
/api/v1/pig-batches/{fromBatchID}/reclassify-pen:
post:
consumes:
- application/json
description: 将一个猪栏(连同其中的猪只)从一个批次整体划拨到另一个批次
parameters:
- description: 源猪批次ID
in: path
name: fromBatchID
required: true
type: integer
- description: 划拨请求信息 (包含目标批次ID、猪栏ID和备注)
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.ReclassifyPenToNewBatchRequest'
produces:
- application/json
responses:
"200":
description: 划拨成功
schema:
$ref: '#/definitions/controller.Response'
summary: 将猪栏划拨到新批次
tags:
- 猪群管理
/api/v1/pig-batches/{id}: /api/v1/pig-batches/{id}:
delete: delete:
description: 根据ID删除一个猪批次 description: 根据ID删除一个猪批次
@@ -1788,7 +1773,7 @@ paths:
summary: 更新猪批次 summary: 更新猪批次
tags: tags:
- 猪群管理 - 猪群管理
/api/v1/pig-batches/{id}/assign-pens: /api/v1/pig-batches/assign-pens/{id}:
post: post:
consumes: consumes:
- application/json - application/json
@@ -1815,7 +1800,7 @@ paths:
summary: 为猪批次分配空栏 summary: 为猪批次分配空栏
tags: tags:
- 猪群管理 - 猪群管理
/api/v1/pig-batches/{id}/buy-pigs: /api/v1/pig-batches/buy-pigs/{id}:
post: post:
consumes: consumes:
- application/json - application/json
@@ -1841,8 +1826,8 @@ paths:
$ref: '#/definitions/controller.Response' $ref: '#/definitions/controller.Response'
summary: 处理买猪的业务逻辑 summary: 处理买猪的业务逻辑
tags: tags:
- 批次管理 - 管理
/api/v1/pig-batches/{id}/move-pigs-into-pen: /api/v1/pig-batches/move-pigs-into-pen/{id}:
post: post:
consumes: consumes:
- application/json - application/json
@@ -1869,7 +1854,34 @@ paths:
summary: 将猪只从“虚拟库存”移入指定猪栏 summary: 将猪只从“虚拟库存”移入指定猪栏
tags: tags:
- 猪群管理 - 猪群管理
/api/v1/pig-batches/{id}/record-cull: /api/v1/pig-batches/reclassify-pen/{fromBatchID}:
post:
consumes:
- application/json
description: 将一个猪栏(连同其中的猪只)从一个批次整体划拨到另一个批次
parameters:
- description: 源猪批次ID
in: path
name: fromBatchID
required: true
type: integer
- description: 划拨请求信息 (包含目标批次ID、猪栏ID和备注)
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.ReclassifyPenToNewBatchRequest'
produces:
- application/json
responses:
"200":
description: 划拨成功
schema:
$ref: '#/definitions/controller.Response'
summary: 将猪栏划拨到新批次
tags:
- 猪群管理
/api/v1/pig-batches/record-cull/{id}:
post: post:
consumes: consumes:
- application/json - application/json
@@ -1895,8 +1907,8 @@ paths:
$ref: '#/definitions/controller.Response' $ref: '#/definitions/controller.Response'
summary: 记录正常猪只淘汰事件 summary: 记录正常猪只淘汰事件
tags: tags:
- 批次管理 - 管理
/api/v1/pig-batches/{id}/record-death: /api/v1/pig-batches/record-death/{id}:
post: post:
consumes: consumes:
- application/json - application/json
@@ -1922,8 +1934,8 @@ paths:
$ref: '#/definitions/controller.Response' $ref: '#/definitions/controller.Response'
summary: 记录正常猪只死亡事件 summary: 记录正常猪只死亡事件
tags: tags:
- 批次管理 - 管理
/api/v1/pig-batches/{id}/record-sick-pig-cull: /api/v1/pig-batches/record-sick-pig-cull/{id}:
post: post:
consumes: consumes:
- application/json - application/json
@@ -1949,8 +1961,8 @@ paths:
$ref: '#/definitions/controller.Response' $ref: '#/definitions/controller.Response'
summary: 记录病猪淘汰事件 summary: 记录病猪淘汰事件
tags: tags:
- 批次管理 - 管理
/api/v1/pig-batches/{id}/record-sick-pig-death: /api/v1/pig-batches/record-sick-pig-death/{id}:
post: post:
consumes: consumes:
- application/json - application/json
@@ -1976,8 +1988,8 @@ paths:
$ref: '#/definitions/controller.Response' $ref: '#/definitions/controller.Response'
summary: 记录病猪死亡事件 summary: 记录病猪死亡事件
tags: tags:
- 批次管理 - 管理
/api/v1/pig-batches/{id}/record-sick-pig-recovery: /api/v1/pig-batches/record-sick-pig-recovery/{id}:
post: post:
consumes: consumes:
- application/json - application/json
@@ -2003,8 +2015,8 @@ paths:
$ref: '#/definitions/controller.Response' $ref: '#/definitions/controller.Response'
summary: 记录病猪康复事件 summary: 记录病猪康复事件
tags: tags:
- 批次管理 - 管理
/api/v1/pig-batches/{id}/record-sick-pigs: /api/v1/pig-batches/record-sick-pigs/{id}:
post: post:
consumes: consumes:
- application/json - application/json
@@ -2030,8 +2042,32 @@ paths:
$ref: '#/definitions/controller.Response' $ref: '#/definitions/controller.Response'
summary: 记录新增病猪事件 summary: 记录新增病猪事件
tags: tags:
- 批次管理 - 管理
/api/v1/pig-batches/{id}/sell-pigs: /api/v1/pig-batches/remove-pen/{penID}/{batchID}:
delete:
description: 将一个空闲猪栏从指定的猪批次中移除
parameters:
- description: 猪批次ID
in: path
name: batchID
required: true
type: integer
- description: 待移除的猪栏ID
in: path
name: penID
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 移除成功
schema:
$ref: '#/definitions/controller.Response'
summary: 从猪批次移除空栏
tags:
- 猪群管理
/api/v1/pig-batches/sell-pigs/{id}:
post: post:
consumes: consumes:
- application/json - application/json
@@ -2057,35 +2093,8 @@ paths:
$ref: '#/definitions/controller.Response' $ref: '#/definitions/controller.Response'
summary: 处理卖猪的业务逻辑 summary: 处理卖猪的业务逻辑
tags: tags:
- 批次管理 - 管理
/api/v1/pig-batches/{id}/transfer-within-batch: /api/v1/pig-batches/transfer-across-batches/{sourceBatchID}:
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: post:
consumes: consumes:
- application/json - application/json
@@ -2111,7 +2120,34 @@ paths:
$ref: '#/definitions/controller.Response' $ref: '#/definitions/controller.Response'
summary: 跨猪群调栏 summary: 跨猪群调栏
tags: tags:
- 批次管理 - 管理
/api/v1/pig-batches/transfer-within-batch/{id}:
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-houses: /api/v1/pig-houses:
get: get:
description: 获取所有猪舍的列表 description: 获取所有猪舍的列表