更新猪群对应猪栏接口变更

This commit is contained in:
2025-10-06 23:10:58 +08:00
parent aac0324616
commit 632bd20e7d
8 changed files with 680 additions and 60 deletions

View File

@@ -947,6 +947,83 @@ const docTemplate = `{
}
}
},
"/api/v1/pig-batches/{batchID}/remove-pen/{penID}": {
"delete": {
"description": "将一个空闲猪栏从指定的猪批次中移除",
"produces": [
"application/json"
],
"tags": [
"猪批次管理"
],
"summary": "从猪批次移除空栏",
"parameters": [
{
"type": "integer",
"description": "猪批次ID",
"name": "batchID",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "待移除的猪栏ID",
"name": "penID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "移除成功",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
},
"/api/v1/pig-batches/{fromBatchID}/reclassify-pen": {
"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/{id}": {
"get": {
"description": "根据ID获取单个猪批次信息",
@@ -1066,9 +1143,9 @@ const docTemplate = `{
}
}
},
"/api/v1/pig-batches/{id}/pens": {
"put": {
"description": "更新指定猪批次当前关联的猪栏列表",
"/api/v1/pig-batches/{id}/assign-pens": {
"post": {
"description": "将一个或多个空闲猪栏分配给指定猪批次",
"consumes": [
"application/json"
],
@@ -1078,7 +1155,7 @@ const docTemplate = `{
"tags": [
"猪批次管理"
],
"summary": "更新猪批次关联的猪栏",
"summary": "猪批次分配空栏",
"parameters": [
{
"type": "integer",
@@ -1088,18 +1165,59 @@ const docTemplate = `{
"required": true
},
{
"description": "猪批次关联的猪栏ID列表",
"description": "待分配的猪栏ID列表",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.PigBatchUpdatePensRequest"
"$ref": "#/definitions/dto.AssignEmptyPensToBatchRequest"
}
}
],
"responses": {
"200": {
"description": "更新成功",
"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"
}
@@ -1809,6 +1927,9 @@ const docTemplate = `{
}
}
},
"dto.AssignEmptyPensToBatchRequest": {
"type": "object"
},
"dto.CreateAreaControllerRequest": {
"type": "object",
"required": [
@@ -2144,6 +2265,28 @@ const docTemplate = `{
}
}
},
"dto.MovePigsIntoPenRequest": {
"type": "object",
"required": [
"quantity",
"toPenID"
],
"properties": {
"quantity": {
"description": "移入猪只数量",
"type": "integer",
"minimum": 1
},
"remarks": {
"description": "备注",
"type": "string"
},
"toPenID": {
"description": "目标猪栏ID",
"type": "integer"
}
}
},
"dto.PenResponse": {
"type": "object",
"properties": {
@@ -2298,9 +2441,6 @@ const docTemplate = `{
}
}
},
"dto.PigBatchUpdatePensRequest": {
"type": "object"
},
"dto.PigHouseResponse": {
"type": "object",
"properties": {
@@ -2380,6 +2520,27 @@ const docTemplate = `{
}
}
},
"dto.ReclassifyPenToNewBatchRequest": {
"type": "object",
"required": [
"penID",
"toBatchID"
],
"properties": {
"penID": {
"description": "待划拨的猪栏ID",
"type": "integer"
},
"remarks": {
"description": "备注",
"type": "string"
},
"toBatchID": {
"description": "目标猪批次ID",
"type": "integer"
}
}
},
"dto.SubPlanResponse": {
"type": "object",
"properties": {

View File

@@ -936,6 +936,83 @@
}
}
},
"/api/v1/pig-batches/{batchID}/remove-pen/{penID}": {
"delete": {
"description": "将一个空闲猪栏从指定的猪批次中移除",
"produces": [
"application/json"
],
"tags": [
"猪批次管理"
],
"summary": "从猪批次移除空栏",
"parameters": [
{
"type": "integer",
"description": "猪批次ID",
"name": "batchID",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "待移除的猪栏ID",
"name": "penID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "移除成功",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
},
"/api/v1/pig-batches/{fromBatchID}/reclassify-pen": {
"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/{id}": {
"get": {
"description": "根据ID获取单个猪批次信息",
@@ -1055,9 +1132,9 @@
}
}
},
"/api/v1/pig-batches/{id}/pens": {
"put": {
"description": "更新指定猪批次当前关联的猪栏列表",
"/api/v1/pig-batches/{id}/assign-pens": {
"post": {
"description": "将一个或多个空闲猪栏分配给指定猪批次",
"consumes": [
"application/json"
],
@@ -1067,7 +1144,7 @@
"tags": [
"猪批次管理"
],
"summary": "更新猪批次关联的猪栏",
"summary": "猪批次分配空栏",
"parameters": [
{
"type": "integer",
@@ -1077,18 +1154,59 @@
"required": true
},
{
"description": "猪批次关联的猪栏ID列表",
"description": "待分配的猪栏ID列表",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.PigBatchUpdatePensRequest"
"$ref": "#/definitions/dto.AssignEmptyPensToBatchRequest"
}
}
],
"responses": {
"200": {
"description": "更新成功",
"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"
}
@@ -1798,6 +1916,9 @@
}
}
},
"dto.AssignEmptyPensToBatchRequest": {
"type": "object"
},
"dto.CreateAreaControllerRequest": {
"type": "object",
"required": [
@@ -2133,6 +2254,28 @@
}
}
},
"dto.MovePigsIntoPenRequest": {
"type": "object",
"required": [
"quantity",
"toPenID"
],
"properties": {
"quantity": {
"description": "移入猪只数量",
"type": "integer",
"minimum": 1
},
"remarks": {
"description": "备注",
"type": "string"
},
"toPenID": {
"description": "目标猪栏ID",
"type": "integer"
}
}
},
"dto.PenResponse": {
"type": "object",
"properties": {
@@ -2287,9 +2430,6 @@
}
}
},
"dto.PigBatchUpdatePensRequest": {
"type": "object"
},
"dto.PigHouseResponse": {
"type": "object",
"properties": {
@@ -2369,6 +2509,27 @@
}
}
},
"dto.ReclassifyPenToNewBatchRequest": {
"type": "object",
"required": [
"penID",
"toBatchID"
],
"properties": {
"penID": {
"description": "待划拨的猪栏ID",
"type": "integer"
},
"remarks": {
"description": "备注",
"type": "string"
},
"toBatchID": {
"description": "目标猪批次ID",
"type": "integer"
}
}
},
"dto.SubPlanResponse": {
"type": "object",
"properties": {

View File

@@ -69,6 +69,8 @@ definitions:
updated_at:
type: string
type: object
dto.AssignEmptyPensToBatchRequest:
type: object
dto.CreateAreaControllerRequest:
properties:
location:
@@ -298,6 +300,22 @@ definitions:
example: testuser
type: string
type: object
dto.MovePigsIntoPenRequest:
properties:
quantity:
description: 移入猪只数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
toPenID:
description: 目标猪栏ID
type: integer
required:
- quantity
- toPenID
type: object
dto.PenResponse:
properties:
capacity:
@@ -398,8 +416,6 @@ definitions:
- $ref: '#/definitions/models.PigBatchStatus'
description: 批次状态,可选
type: object
dto.PigBatchUpdatePensRequest:
type: object
dto.PigHouseResponse:
properties:
description:
@@ -450,6 +466,21 @@ definitions:
$ref: '#/definitions/dto.TaskResponse'
type: array
type: object
dto.ReclassifyPenToNewBatchRequest:
properties:
penID:
description: 待划拨的猪栏ID
type: integer
remarks:
description: 备注
type: string
toBatchID:
description: 目标猪批次ID
type: integer
required:
- penID
- toBatchID
type: object
dto.SubPlanResponse:
properties:
child_plan:
@@ -1373,6 +1404,57 @@ 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删除一个猪批次
@@ -1446,31 +1528,58 @@ paths:
summary: 更新猪批次
tags:
- 猪批次管理
/api/v1/pig-batches/{id}/pens:
put:
/api/v1/pig-batches/{id}/assign-pens:
post:
consumes:
- application/json
description: 更新指定猪批次当前关联的猪栏列表
description: 将一个或多个空闲猪栏分配给指定猪批次
parameters:
- description: 猪批次ID
in: path
name: id
required: true
type: integer
- description: 猪批次关联的猪栏ID列表
- description: 待分配的猪栏ID列表
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.PigBatchUpdatePensRequest'
$ref: '#/definitions/dto.AssignEmptyPensToBatchRequest'
produces:
- application/json
responses:
"200":
description: 更新成功
description: 分配成功
schema:
$ref: '#/definitions/controller.Response'
summary: 更新猪批次关联的猪
summary: 猪批次分配空
tags:
- 猪批次管理
/api/v1/pig-batches/{id}/move-pigs-into-pen:
post:
consumes:
- application/json
description: 将指定数量的猪只从批次的“虚拟库存”移入一个已分配的猪栏
parameters:
- description: 猪批次ID
in: path
name: id
required: true
type: integer
- description: 移入猪只请求信息 (包含目标猪栏ID、数量和备注)
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.MovePigsIntoPenRequest'
produces:
- application/json
responses:
"200":
description: 移入成功
schema:
$ref: '#/definitions/controller.Response'
summary: 将猪只从“虚拟库存”移入指定猪栏
tags:
- 猪批次管理
/api/v1/pig-houses: