From 8c0dc6c815fcacfe74736055a6f8ec4073cf3c89 Mon Sep 17 00:00:00 2001 From: huang <1724659546@qq.com> Date: Mon, 13 Oct 2025 12:16:36 +0800 Subject: [PATCH] ManualControl --- docs/docs.go | 1056 ++++++++++++++++++++++++--------------------- docs/swagger.json | 1056 ++++++++++++++++++++++++--------------------- docs/swagger.yaml | 232 +++++----- 3 files changed, 1244 insertions(+), 1100 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index cd81b29..32ca199 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -490,6 +490,47 @@ const docTemplate = `{ } } }, + "/api/v1/devices/manual-control/{id}": { + "post": { + "description": "根据设备ID和指定的动作(开启或关闭)来手动控制设备", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设备管理" + ], + "summary": "手动控制设备", + "parameters": [ + { + "type": "string", + "description": "设备ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "手动控制指令", + "name": "manualControl", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.ManualControlDeviceRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, "/api/v1/devices/{id}": { "get": { "description": "根据设备ID获取单个设备的详细信息", @@ -947,7 +988,417 @@ const docTemplate = `{ } } }, - "/api/v1/pig-batches/{batchID}/remove-pen/{penID}": { + "/api/v1/pig-batches/assign-pens/{id}": { + "post": { + "description": "将一个或多个空闲猪栏分配给指定的猪批次", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "为猪批次分配空栏", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "待分配的猪栏ID列表", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.AssignEmptyPensToBatchRequest" + } + } + ], + "responses": { + "200": { + "description": "分配成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/buy-pigs/{id}": { + "post": { + "description": "记录猪批次中的猪只购买事件", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "处理买猪的业务逻辑", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "买猪请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.BuyPigsRequest" + } + } + ], + "responses": { + "200": { + "description": "买猪成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/move-pigs-into-pen/{id}": { + "post": { + "description": "将指定数量的猪只从批次的“虚拟库存”移入一个已分配的猪栏", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "将猪只从“虚拟库存”移入指定猪栏", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "移入猪只请求信息 (包含目标猪栏ID、数量和备注)", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.MovePigsIntoPenRequest" + } + } + ], + "responses": { + "200": { + "description": "移入成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/reclassify-pen/{fromBatchID}": { + "post": { + "description": "将一个猪栏(连同其中的猪只)从一个批次整体划拨到另一个批次", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "将猪栏划拨到新批次", + "parameters": [ + { + "type": "integer", + "description": "源猪批次ID", + "name": "fromBatchID", + "in": "path", + "required": true + }, + { + "description": "划拨请求信息 (包含目标批次ID、猪栏ID和备注)", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.ReclassifyPenToNewBatchRequest" + } + } + ], + "responses": { + "200": { + "description": "划拨成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/record-cull/{id}": { + "post": { + "description": "记录猪批次中正常猪只淘汰的数量和发生时间", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "记录正常猪只淘汰事件", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "记录正常猪只淘汰请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.RecordCullRequest" + } + } + ], + "responses": { + "200": { + "description": "记录成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/record-death/{id}": { + "post": { + "description": "记录猪批次中正常猪只死亡的数量和发生时间", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "记录正常猪只死亡事件", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "记录正常猪只死亡请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.RecordDeathRequest" + } + } + ], + "responses": { + "200": { + "description": "记录成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/record-sick-pig-cull/{id}": { + "post": { + "description": "记录猪批次中病猪淘汰的数量、治疗地点和发生时间", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "记录病猪淘汰事件", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "记录病猪淘汰请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.RecordSickPigCullRequest" + } + } + ], + "responses": { + "200": { + "description": "记录成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/record-sick-pig-death/{id}": { + "post": { + "description": "记录猪批次中病猪死亡的数量、治疗地点和发生时间", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "记录病猪死亡事件", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "记录病猪死亡请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.RecordSickPigDeathRequest" + } + } + ], + "responses": { + "200": { + "description": "记录成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/record-sick-pig-recovery/{id}": { + "post": { + "description": "记录猪批次中病猪康复的数量、治疗地点和发生时间", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "记录病猪康复事件", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "记录病猪康复请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.RecordSickPigRecoveryRequest" + } + } + ], + "responses": { + "200": { + "description": "记录成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/record-sick-pigs/{id}": { + "post": { + "description": "记录猪批次中新增病猪的数量、治疗地点和发生时间", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "记录新增病猪事件", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "记录病猪请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.RecordSickPigsRequest" + } + } + ], + "responses": { + "200": { + "description": "记录成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/remove-pen/{penID}/{batchID}": { "delete": { "description": "将一个空闲猪栏从指定的猪批次中移除", "produces": [ @@ -983,9 +1434,9 @@ const docTemplate = `{ } } }, - "/api/v1/pig-batches/{fromBatchID}/reclassify-pen": { + "/api/v1/pig-batches/sell-pigs/{id}": { "post": { - "description": "将一个猪栏(连同其中的猪只)从一个批次整体划拨到另一个批次", + "description": "记录猪批次中的猪只出售事件", "consumes": [ "application/json" ], @@ -995,28 +1446,110 @@ const docTemplate = `{ "tags": [ "猪群管理" ], - "summary": "将猪栏划拨到新批次", + "summary": "处理卖猪的业务逻辑", "parameters": [ { "type": "integer", - "description": "源猪批次ID", - "name": "fromBatchID", + "description": "猪批次ID", + "name": "id", "in": "path", "required": true }, { - "description": "划拨请求信息 (包含目标批次ID、猪栏ID和备注)", + "description": "卖猪请求信息", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/dto.ReclassifyPenToNewBatchRequest" + "$ref": "#/definitions/dto.SellPigsRequest" } } ], "responses": { "200": { - "description": "划拨成功", + "description": "卖猪成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/transfer-across-batches/{sourceBatchID}": { + "post": { + "description": "将指定数量的猪只从一个猪群的猪栏调动到另一个猪群的猪栏", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "跨猪群调栏", + "parameters": [ + { + "type": "integer", + "description": "源猪批次ID", + "name": "sourceBatchID", + "in": "path", + "required": true + }, + { + "description": "跨群调栏请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.TransferPigsAcrossBatchesRequest" + } + } + ], + "responses": { + "200": { + "description": "调栏成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/transfer-within-batch/{id}": { + "post": { + "description": "将指定数量的猪只在同一个猪群的不同猪栏间调动", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "群内调栏", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "群内调栏请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.TransferPigsWithinBatchRequest" + } + } + ], + "responses": { + "200": { + "description": "调栏成功", "schema": { "$ref": "#/definitions/controller.Response" } @@ -1143,498 +1676,6 @@ const docTemplate = `{ } } }, - "/api/v1/pig-batches/{id}/assign-pens": { - "post": { - "description": "将一个或多个空闲猪栏分配给指定的猪批次", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪群管理" - ], - "summary": "为猪批次分配空栏", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "待分配的猪栏ID列表", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.AssignEmptyPensToBatchRequest" - } - } - ], - "responses": { - "200": { - "description": "分配成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/buy-pigs": { - "post": { - "description": "记录猪批次中的猪只购买事件", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "处理买猪的业务逻辑", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "买猪请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.BuyPigsRequest" - } - } - ], - "responses": { - "200": { - "description": "买猪成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/move-pigs-into-pen": { - "post": { - "description": "将指定数量的猪只从批次的“虚拟库存”移入一个已分配的猪栏", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪群管理" - ], - "summary": "将猪只从“虚拟库存”移入指定猪栏", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "移入猪只请求信息 (包含目标猪栏ID、数量和备注)", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.MovePigsIntoPenRequest" - } - } - ], - "responses": { - "200": { - "description": "移入成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/record-cull": { - "post": { - "description": "记录猪批次中正常猪只淘汰的数量和发生时间", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "记录正常猪只淘汰事件", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "记录正常猪只淘汰请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.RecordCullRequest" - } - } - ], - "responses": { - "200": { - "description": "记录成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/record-death": { - "post": { - "description": "记录猪批次中正常猪只死亡的数量和发生时间", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "记录正常猪只死亡事件", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "记录正常猪只死亡请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.RecordDeathRequest" - } - } - ], - "responses": { - "200": { - "description": "记录成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/record-sick-pig-cull": { - "post": { - "description": "记录猪批次中病猪淘汰的数量、治疗地点和发生时间", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "记录病猪淘汰事件", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "记录病猪淘汰请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.RecordSickPigCullRequest" - } - } - ], - "responses": { - "200": { - "description": "记录成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/record-sick-pig-death": { - "post": { - "description": "记录猪批次中病猪死亡的数量、治疗地点和发生时间", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "记录病猪死亡事件", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "记录病猪死亡请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.RecordSickPigDeathRequest" - } - } - ], - "responses": { - "200": { - "description": "记录成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/record-sick-pig-recovery": { - "post": { - "description": "记录猪批次中病猪康复的数量、治疗地点和发生时间", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "记录病猪康复事件", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "记录病猪康复请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.RecordSickPigRecoveryRequest" - } - } - ], - "responses": { - "200": { - "description": "记录成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/record-sick-pigs": { - "post": { - "description": "记录猪批次中新增病猪的数量、治疗地点和发生时间", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "记录新增病猪事件", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "记录病猪请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.RecordSickPigsRequest" - } - } - ], - "responses": { - "200": { - "description": "记录成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/sell-pigs": { - "post": { - "description": "记录猪批次中的猪只出售事件", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "处理卖猪的业务逻辑", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "卖猪请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.SellPigsRequest" - } - } - ], - "responses": { - "200": { - "description": "卖猪成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/transfer-within-batch": { - "post": { - "description": "将指定数量的猪只在同一个猪群的不同猪栏间调动", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "群内调栏", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "群内调栏请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.TransferPigsWithinBatchRequest" - } - } - ], - "responses": { - "200": { - "description": "调栏成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{sourceBatchID}/transfer-across-batches": { - "post": { - "description": "将指定数量的猪只从一个猪群的猪栏调动到另一个猪群的猪栏", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "跨猪群调栏", - "parameters": [ - { - "type": "integer", - "description": "源猪批次ID", - "name": "sourceBatchID", - "in": "path", - "required": true - }, - { - "description": "跨群调栏请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.TransferPigsAcrossBatchesRequest" - } - } - ], - "responses": { - "200": { - "description": "调栏成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, "/api/v1/pig-houses": { "get": { "description": "获取所有猪舍的列表", @@ -2719,6 +2760,19 @@ const docTemplate = `{ } } }, + "dto.ManualControlDeviceRequest": { + "type": "object", + "properties": { + "action": { + "description": "Action 不传表示这是一个传感器, 会触发一次采集", + "type": "string", + "enum": [ + "on", + "off" + ] + } + } + }, "dto.MovePigsIntoPenRequest": { "type": "object", "required": [ diff --git a/docs/swagger.json b/docs/swagger.json index c14cfa3..2c0a284 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -479,6 +479,47 @@ } } }, + "/api/v1/devices/manual-control/{id}": { + "post": { + "description": "根据设备ID和指定的动作(开启或关闭)来手动控制设备", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "设备管理" + ], + "summary": "手动控制设备", + "parameters": [ + { + "type": "string", + "description": "设备ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "手动控制指令", + "name": "manualControl", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.ManualControlDeviceRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, "/api/v1/devices/{id}": { "get": { "description": "根据设备ID获取单个设备的详细信息", @@ -936,7 +977,417 @@ } } }, - "/api/v1/pig-batches/{batchID}/remove-pen/{penID}": { + "/api/v1/pig-batches/assign-pens/{id}": { + "post": { + "description": "将一个或多个空闲猪栏分配给指定的猪批次", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "为猪批次分配空栏", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "待分配的猪栏ID列表", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.AssignEmptyPensToBatchRequest" + } + } + ], + "responses": { + "200": { + "description": "分配成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/buy-pigs/{id}": { + "post": { + "description": "记录猪批次中的猪只购买事件", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "处理买猪的业务逻辑", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "买猪请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.BuyPigsRequest" + } + } + ], + "responses": { + "200": { + "description": "买猪成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/move-pigs-into-pen/{id}": { + "post": { + "description": "将指定数量的猪只从批次的“虚拟库存”移入一个已分配的猪栏", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "将猪只从“虚拟库存”移入指定猪栏", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "移入猪只请求信息 (包含目标猪栏ID、数量和备注)", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.MovePigsIntoPenRequest" + } + } + ], + "responses": { + "200": { + "description": "移入成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/reclassify-pen/{fromBatchID}": { + "post": { + "description": "将一个猪栏(连同其中的猪只)从一个批次整体划拨到另一个批次", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "将猪栏划拨到新批次", + "parameters": [ + { + "type": "integer", + "description": "源猪批次ID", + "name": "fromBatchID", + "in": "path", + "required": true + }, + { + "description": "划拨请求信息 (包含目标批次ID、猪栏ID和备注)", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.ReclassifyPenToNewBatchRequest" + } + } + ], + "responses": { + "200": { + "description": "划拨成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/record-cull/{id}": { + "post": { + "description": "记录猪批次中正常猪只淘汰的数量和发生时间", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "记录正常猪只淘汰事件", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "记录正常猪只淘汰请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.RecordCullRequest" + } + } + ], + "responses": { + "200": { + "description": "记录成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/record-death/{id}": { + "post": { + "description": "记录猪批次中正常猪只死亡的数量和发生时间", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "记录正常猪只死亡事件", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "记录正常猪只死亡请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.RecordDeathRequest" + } + } + ], + "responses": { + "200": { + "description": "记录成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/record-sick-pig-cull/{id}": { + "post": { + "description": "记录猪批次中病猪淘汰的数量、治疗地点和发生时间", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "记录病猪淘汰事件", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "记录病猪淘汰请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.RecordSickPigCullRequest" + } + } + ], + "responses": { + "200": { + "description": "记录成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/record-sick-pig-death/{id}": { + "post": { + "description": "记录猪批次中病猪死亡的数量、治疗地点和发生时间", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "记录病猪死亡事件", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "记录病猪死亡请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.RecordSickPigDeathRequest" + } + } + ], + "responses": { + "200": { + "description": "记录成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/record-sick-pig-recovery/{id}": { + "post": { + "description": "记录猪批次中病猪康复的数量、治疗地点和发生时间", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "记录病猪康复事件", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "记录病猪康复请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.RecordSickPigRecoveryRequest" + } + } + ], + "responses": { + "200": { + "description": "记录成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/record-sick-pigs/{id}": { + "post": { + "description": "记录猪批次中新增病猪的数量、治疗地点和发生时间", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "记录新增病猪事件", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "记录病猪请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.RecordSickPigsRequest" + } + } + ], + "responses": { + "200": { + "description": "记录成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/remove-pen/{penID}/{batchID}": { "delete": { "description": "将一个空闲猪栏从指定的猪批次中移除", "produces": [ @@ -972,9 +1423,9 @@ } } }, - "/api/v1/pig-batches/{fromBatchID}/reclassify-pen": { + "/api/v1/pig-batches/sell-pigs/{id}": { "post": { - "description": "将一个猪栏(连同其中的猪只)从一个批次整体划拨到另一个批次", + "description": "记录猪批次中的猪只出售事件", "consumes": [ "application/json" ], @@ -984,28 +1435,110 @@ "tags": [ "猪群管理" ], - "summary": "将猪栏划拨到新批次", + "summary": "处理卖猪的业务逻辑", "parameters": [ { "type": "integer", - "description": "源猪批次ID", - "name": "fromBatchID", + "description": "猪批次ID", + "name": "id", "in": "path", "required": true }, { - "description": "划拨请求信息 (包含目标批次ID、猪栏ID和备注)", + "description": "卖猪请求信息", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/dto.ReclassifyPenToNewBatchRequest" + "$ref": "#/definitions/dto.SellPigsRequest" } } ], "responses": { "200": { - "description": "划拨成功", + "description": "卖猪成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/transfer-across-batches/{sourceBatchID}": { + "post": { + "description": "将指定数量的猪只从一个猪群的猪栏调动到另一个猪群的猪栏", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "跨猪群调栏", + "parameters": [ + { + "type": "integer", + "description": "源猪批次ID", + "name": "sourceBatchID", + "in": "path", + "required": true + }, + { + "description": "跨群调栏请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.TransferPigsAcrossBatchesRequest" + } + } + ], + "responses": { + "200": { + "description": "调栏成功", + "schema": { + "$ref": "#/definitions/controller.Response" + } + } + } + } + }, + "/api/v1/pig-batches/transfer-within-batch/{id}": { + "post": { + "description": "将指定数量的猪只在同一个猪群的不同猪栏间调动", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "猪群管理" + ], + "summary": "群内调栏", + "parameters": [ + { + "type": "integer", + "description": "猪批次ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "群内调栏请求信息", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.TransferPigsWithinBatchRequest" + } + } + ], + "responses": { + "200": { + "description": "调栏成功", "schema": { "$ref": "#/definitions/controller.Response" } @@ -1132,498 +1665,6 @@ } } }, - "/api/v1/pig-batches/{id}/assign-pens": { - "post": { - "description": "将一个或多个空闲猪栏分配给指定的猪批次", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪群管理" - ], - "summary": "为猪批次分配空栏", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "待分配的猪栏ID列表", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.AssignEmptyPensToBatchRequest" - } - } - ], - "responses": { - "200": { - "description": "分配成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/buy-pigs": { - "post": { - "description": "记录猪批次中的猪只购买事件", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "处理买猪的业务逻辑", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "买猪请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.BuyPigsRequest" - } - } - ], - "responses": { - "200": { - "description": "买猪成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/move-pigs-into-pen": { - "post": { - "description": "将指定数量的猪只从批次的“虚拟库存”移入一个已分配的猪栏", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪群管理" - ], - "summary": "将猪只从“虚拟库存”移入指定猪栏", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "移入猪只请求信息 (包含目标猪栏ID、数量和备注)", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.MovePigsIntoPenRequest" - } - } - ], - "responses": { - "200": { - "description": "移入成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/record-cull": { - "post": { - "description": "记录猪批次中正常猪只淘汰的数量和发生时间", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "记录正常猪只淘汰事件", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "记录正常猪只淘汰请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.RecordCullRequest" - } - } - ], - "responses": { - "200": { - "description": "记录成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/record-death": { - "post": { - "description": "记录猪批次中正常猪只死亡的数量和发生时间", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "记录正常猪只死亡事件", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "记录正常猪只死亡请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.RecordDeathRequest" - } - } - ], - "responses": { - "200": { - "description": "记录成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/record-sick-pig-cull": { - "post": { - "description": "记录猪批次中病猪淘汰的数量、治疗地点和发生时间", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "记录病猪淘汰事件", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "记录病猪淘汰请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.RecordSickPigCullRequest" - } - } - ], - "responses": { - "200": { - "description": "记录成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/record-sick-pig-death": { - "post": { - "description": "记录猪批次中病猪死亡的数量、治疗地点和发生时间", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "记录病猪死亡事件", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "记录病猪死亡请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.RecordSickPigDeathRequest" - } - } - ], - "responses": { - "200": { - "description": "记录成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/record-sick-pig-recovery": { - "post": { - "description": "记录猪批次中病猪康复的数量、治疗地点和发生时间", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "记录病猪康复事件", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "记录病猪康复请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.RecordSickPigRecoveryRequest" - } - } - ], - "responses": { - "200": { - "description": "记录成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/record-sick-pigs": { - "post": { - "description": "记录猪批次中新增病猪的数量、治疗地点和发生时间", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "记录新增病猪事件", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "记录病猪请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.RecordSickPigsRequest" - } - } - ], - "responses": { - "200": { - "description": "记录成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/sell-pigs": { - "post": { - "description": "记录猪批次中的猪只出售事件", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "处理卖猪的业务逻辑", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "卖猪请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.SellPigsRequest" - } - } - ], - "responses": { - "200": { - "description": "卖猪成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{id}/transfer-within-batch": { - "post": { - "description": "将指定数量的猪只在同一个猪群的不同猪栏间调动", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "群内调栏", - "parameters": [ - { - "type": "integer", - "description": "猪批次ID", - "name": "id", - "in": "path", - "required": true - }, - { - "description": "群内调栏请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.TransferPigsWithinBatchRequest" - } - } - ], - "responses": { - "200": { - "description": "调栏成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, - "/api/v1/pig-batches/{sourceBatchID}/transfer-across-batches": { - "post": { - "description": "将指定数量的猪只从一个猪群的猪栏调动到另一个猪群的猪栏", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "猪批次管理" - ], - "summary": "跨猪群调栏", - "parameters": [ - { - "type": "integer", - "description": "源猪批次ID", - "name": "sourceBatchID", - "in": "path", - "required": true - }, - { - "description": "跨群调栏请求信息", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.TransferPigsAcrossBatchesRequest" - } - } - ], - "responses": { - "200": { - "description": "调栏成功", - "schema": { - "$ref": "#/definitions/controller.Response" - } - } - } - } - }, "/api/v1/pig-houses": { "get": { "description": "获取所有猪舍的列表", @@ -2708,6 +2749,19 @@ } } }, + "dto.ManualControlDeviceRequest": { + "type": "object", + "properties": { + "action": { + "description": "Action 不传表示这是一个传感器, 会触发一次采集", + "type": "string", + "enum": [ + "on", + "off" + ] + } + } + }, "dto.MovePigsIntoPenRequest": { "type": "object", "required": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index e5dcd7c..71b1241 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -334,6 +334,15 @@ definitions: example: testuser type: string type: object + dto.ManualControlDeviceRequest: + properties: + action: + description: Action 不传表示这是一个传感器, 会触发一次采集 + enum: + - "on" + - "off" + type: string + type: object dto.MovePigsIntoPenRequest: properties: quantity: @@ -1462,6 +1471,33 @@ paths: summary: 更新设备信息 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: get: description: 获取所有猪栏的列表 @@ -1664,57 +1700,6 @@ paths: summary: 创建猪批次 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}: delete: description: 根据ID删除一个猪批次 @@ -1788,7 +1773,7 @@ paths: summary: 更新猪批次 tags: - 猪群管理 - /api/v1/pig-batches/{id}/assign-pens: + /api/v1/pig-batches/assign-pens/{id}: post: consumes: - application/json @@ -1815,7 +1800,7 @@ paths: summary: 为猪批次分配空栏 tags: - 猪群管理 - /api/v1/pig-batches/{id}/buy-pigs: + /api/v1/pig-batches/buy-pigs/{id}: post: consumes: - application/json @@ -1841,8 +1826,8 @@ paths: $ref: '#/definitions/controller.Response' summary: 处理买猪的业务逻辑 tags: - - 猪批次管理 - /api/v1/pig-batches/{id}/move-pigs-into-pen: + - 猪群管理 + /api/v1/pig-batches/move-pigs-into-pen/{id}: post: consumes: - application/json @@ -1869,7 +1854,34 @@ paths: summary: 将猪只从“虚拟库存”移入指定猪栏 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: consumes: - application/json @@ -1895,8 +1907,8 @@ paths: $ref: '#/definitions/controller.Response' summary: 记录正常猪只淘汰事件 tags: - - 猪批次管理 - /api/v1/pig-batches/{id}/record-death: + - 猪群管理 + /api/v1/pig-batches/record-death/{id}: post: consumes: - application/json @@ -1922,8 +1934,8 @@ paths: $ref: '#/definitions/controller.Response' summary: 记录正常猪只死亡事件 tags: - - 猪批次管理 - /api/v1/pig-batches/{id}/record-sick-pig-cull: + - 猪群管理 + /api/v1/pig-batches/record-sick-pig-cull/{id}: post: consumes: - application/json @@ -1949,8 +1961,8 @@ paths: $ref: '#/definitions/controller.Response' summary: 记录病猪淘汰事件 tags: - - 猪批次管理 - /api/v1/pig-batches/{id}/record-sick-pig-death: + - 猪群管理 + /api/v1/pig-batches/record-sick-pig-death/{id}: post: consumes: - application/json @@ -1976,8 +1988,8 @@ paths: $ref: '#/definitions/controller.Response' summary: 记录病猪死亡事件 tags: - - 猪批次管理 - /api/v1/pig-batches/{id}/record-sick-pig-recovery: + - 猪群管理 + /api/v1/pig-batches/record-sick-pig-recovery/{id}: post: consumes: - application/json @@ -2003,8 +2015,8 @@ paths: $ref: '#/definitions/controller.Response' summary: 记录病猪康复事件 tags: - - 猪批次管理 - /api/v1/pig-batches/{id}/record-sick-pigs: + - 猪群管理 + /api/v1/pig-batches/record-sick-pigs/{id}: post: consumes: - application/json @@ -2030,8 +2042,32 @@ paths: $ref: '#/definitions/controller.Response' summary: 记录新增病猪事件 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: consumes: - application/json @@ -2057,35 +2093,8 @@ paths: $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: + - 猪群管理 + /api/v1/pig-batches/transfer-across-batches/{sourceBatchID}: post: consumes: - application/json @@ -2111,7 +2120,34 @@ paths: $ref: '#/definitions/controller.Response' summary: 跨猪群调栏 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: get: description: 获取所有猪舍的列表