From 7144c4cb9615ca3d60e12c6286271353b1c8b29d Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期五, 24 十一月 2023 16:44:43 +0800
Subject: [PATCH] 查询指定操作详情修改
---
response/report_forms_response.go | 1 +
controllers/operation.go | 9 +++++----
models/move_history.go | 2 +-
controllers/report_forms_controller.go | 2 +-
docs/swagger.yaml | 10 ++++++----
docs/docs.go | 11 +++++++----
docs/swagger.json | 11 +++++++----
router/router.go | 2 +-
8 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/controllers/operation.go b/controllers/operation.go
index aafdf87..a83dd97 100644
--- a/controllers/operation.go
+++ b/controllers/operation.go
@@ -177,17 +177,18 @@
// @Summary 鍏ュ簱/鍑哄簱鍒楄〃
// @Produce application/json
//
-// @Param number path string true "鍗曞彿"
+// @Param id path string true "id"
//
// @Success 200 {object} util.Response "鎴愬姛"
-// @Router /api-wms/v1/operation/getOperationInfo/{number} [post]
+// @Router /api-wms/v1/operation/getOperationInfo/{id} [get]
func (slf OperationController) GetOperationInfo(c *gin.Context) {
- number := c.Param("number")
+ number := c.Param("id")
if number == "" {
util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屽弬鏁颁笉鑳戒负绌�")
return
}
- operation, err := models.NewOperationSearch().SetNumber(number).SetPreload(true).First()
+ id, _ := strconv.Atoi(number)
+ operation, err := models.NewOperationSearch().SetID(id).SetPreload(true).First()
if err != nil {
util.ResponseFormat(c, code.RequestParamError, err.Error())
return
diff --git a/controllers/report_forms_controller.go b/controllers/report_forms_controller.go
index 7c57613..25bb3f3 100644
--- a/controllers/report_forms_controller.go
+++ b/controllers/report_forms_controller.go
@@ -265,7 +265,7 @@
}
detailsSearch.Orm = detailsSearch.Orm.Model(&models.MoveHistory{}).
- Select("number, updated_at as date, product_name as product_name, from_location_id," +
+ Select("number, updated_at as date, product_name as product_name, from_location_id, operation_id," +
"to_location_id, amount, unit, operator as contacted_name, base_operation_type, weight, product_id, from_location, to_location").Order("id desc")
if len(ids) > 0 {
detailsSearch.Orm = detailsSearch.Orm.Where("id in ?", ids)
diff --git a/docs/docs.go b/docs/docs.go
index de21b37..3f4b27a 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -1150,8 +1150,8 @@
}
}
},
- "/api-wms/v1/operation/getOperationInfo/{number}": {
- "post": {
+ "/api-wms/v1/operation/getOperationInfo/{id}": {
+ "get": {
"produces": [
"application/json"
],
@@ -1162,8 +1162,8 @@
"parameters": [
{
"type": "string",
- "description": "鍗曞彿",
- "name": "number",
+ "description": "id",
+ "name": "id",
"in": "path",
"required": true
}
@@ -4656,6 +4656,9 @@
"description": "鍗曞彿",
"type": "string"
},
+ "operationId": {
+ "type": "integer"
+ },
"productId": {
"type": "string"
},
diff --git a/docs/swagger.json b/docs/swagger.json
index 3f31871..9d13c83 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -1138,8 +1138,8 @@
}
}
},
- "/api-wms/v1/operation/getOperationInfo/{number}": {
- "post": {
+ "/api-wms/v1/operation/getOperationInfo/{id}": {
+ "get": {
"produces": [
"application/json"
],
@@ -1150,8 +1150,8 @@
"parameters": [
{
"type": "string",
- "description": "鍗曞彿",
- "name": "number",
+ "description": "id",
+ "name": "id",
"in": "path",
"required": true
}
@@ -4644,6 +4644,9 @@
"description": "鍗曞彿",
"type": "string"
},
+ "operationId": {
+ "type": "integer"
+ },
"productId": {
"type": "string"
},
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 8660f8a..83761e3 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -1519,6 +1519,8 @@
number:
description: 鍗曞彿
type: string
+ operationId:
+ type: integer
productId:
type: string
productName:
@@ -2292,12 +2294,12 @@
summary: 鑾峰彇鐗╂祦鍏徃鍒楄〃
tags:
- 鍏ュ簱/鍑哄簱
- /api-wms/v1/operation/getOperationInfo/{number}:
- post:
+ /api-wms/v1/operation/getOperationInfo/{id}:
+ get:
parameters:
- - description: 鍗曞彿
+ - description: id
in: path
- name: number
+ name: id
required: true
type: string
produces:
diff --git a/models/move_history.go b/models/move_history.go
index ff02764..ef75cbd 100644
--- a/models/move_history.go
+++ b/models/move_history.go
@@ -17,7 +17,7 @@
BaseOperationType constvar.BaseOperationType `json:"baseOperationType" gorm:"type:tinyint;not null;comment:鍩虹浣滀笟绫诲瀷"` //鍩虹浣滀笟绫诲瀷
OperationTypeId int `json:"operationTypeId" gorm:"type:int;not null;comment:浣滀笟绫诲瀷id"` //浣滀笟绫诲瀷id
OperationTypeName string `json:"operationTypeName" gorm:"type:varchar(127);not null;comment:浣滀笟绫诲瀷鍚嶇О"` //浣滀笟绫诲瀷鍚嶇О
- OperationId int `json:"operationRecordId" gorm:"type:int;not null;comment:鎿嶄綔id"` //鎿嶄綔id
+ OperationId int `json:"operationId" gorm:"type:int;not null;comment:鎿嶄綔id"` //鎿嶄綔id
ProductId string `json:"productId" gorm:"type:varchar(255);not null;comment:浜у搧id"` //浜у搧id
ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:浜у搧鍚嶇О"` //浜у搧鍚嶇О
Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:鏁伴噺"` //鏁伴噺
diff --git a/response/report_forms_response.go b/response/report_forms_response.go
index 4a60e50..6585587 100644
--- a/response/report_forms_response.go
+++ b/response/report_forms_response.go
@@ -33,6 +33,7 @@
ProductId string `json:"productId"`
FromLocationId int `json:"fromLocationId"`
ToLocationId int `json:"toLocationId"`
+ OperationId int `json:"operationId"`
}
type LocationForms struct {
diff --git a/router/router.go b/router/router.go
index 0064c33..ae57b87 100644
--- a/router/router.go
+++ b/router/router.go
@@ -81,7 +81,7 @@
operationAPI := r.Group(urlPrefix + "/operation")
{
operationAPI.POST("list", operationController.List)
- operationAPI.POST("getOperationInfo/:number", operationController.GetOperationInfo)
+ operationAPI.GET("getOperationInfo/:id", operationController.GetOperationInfo)
operationAPI.POST("operation", operationController.Add)
operationAPI.POST("update", operationController.Update)
operationAPI.DELETE("operation/:id", operationController.Delete)
--
Gitblit v1.8.0