From 94d30c9562b42d7cd38cbf3469400b752f219939 Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期二, 12 三月 2024 14:25:37 +0800 Subject: [PATCH] 字段统一 --- api/v1/purchase/purchase.go | 10 +- model/purchase/response/purchase.go | 32 ++++---- docs/swagger.yaml | 51 ++++++++++++ docs/docs.go | 68 ++++++++++++++++ docs/swagger.json | 68 ++++++++++++++++ 5 files changed, 202 insertions(+), 27 deletions(-) diff --git a/api/v1/purchase/purchase.go b/api/v1/purchase/purchase.go index 3ceee93..c847f43 100644 --- a/api/v1/purchase/purchase.go +++ b/api/v1/purchase/purchase.go @@ -357,7 +357,7 @@ // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Success 200 {object} response.Response{data=[]purchase_wms.SrmGetWarehouseInfoResponse} "鑾峰彇閲囪喘绫诲瀷鍒楄〃" +// @Success 200 {object} response.Response{data=[]purchaseRes.OperationInfo} "鑾峰彇鎿嶄綔淇℃伅" // @Router /purchase/getOperationInfo/{id} [get] func (e *PurchaseApi) GetOperationInfo(c *gin.Context) { id, _ := strconv.Atoi(c.Param("id")) @@ -388,9 +388,9 @@ operationInfos := make([]purchaseRes.OperationInfo, 0) for _, operation := range info.Operations { var oi purchaseRes.OperationInfo - oi.ProductId = operation.ProductId - oi.ProductName = operation.ProductName - oi.Number = operation.Number + oi.Number = operation.ProductId + oi.Name = operation.ProductName + oi.OperationNumber = operation.Number oi.Status = operation.Status oi.Principal = data.Principal oi.WarehouseName = data.Warehouse @@ -403,7 +403,7 @@ for _, products := range productList { if products.Product.Number == operation.ProductId { oi.Amount = products.Amount - oi.Price = products.Price + oi.PurchasePrice = products.Price oi.Total = products.Total oi.Unit = products.Product.Unit oi.Specifications = products.Product.Specifications diff --git a/docs/docs.go b/docs/docs.go index bf06611..a683fef 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1625,7 +1625,7 @@ "summary": "鑾峰彇鎿嶄綔淇℃伅", "responses": { "200": { - "description": "鑾峰彇閲囪喘绫诲瀷鍒楄〃", + "description": "鑾峰彇鎿嶄綔淇℃伅", "schema": { "allOf": [ { @@ -1637,7 +1637,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/purchase_wms.SrmGetWarehouseInfoResponse" + "$ref": "#/definitions/response.OperationInfo" } } } @@ -4232,6 +4232,70 @@ } } }, + "response.OperationInfo": { + "type": "object", + "properties": { + "amount": { + "description": "閲囪喘鏁�", + "type": "number" + }, + "modelNumber": { + "description": "鍨嬪彿", + "type": "string" + }, + "name": { + "description": "浜у搧鍚嶇О", + "type": "string" + }, + "number": { + "description": "浜у搧缂栫爜", + "type": "string" + }, + "operationNumber": { + "description": "鍏ュ簱鍗曞彿", + "type": "string" + }, + "overAmount": { + "description": "鍏ュ簱鏁�", + "type": "integer" + }, + "overTime": { + "description": "鍏ュ簱鏃堕棿", + "type": "string" + }, + "principal": { + "description": "璐熻矗浜�", + "type": "string" + }, + "purchasePrice": { + "description": "鍗曚环", + "type": "number" + }, + "sendAmount": { + "description": "鍙戣揣鏁�", + "type": "integer" + }, + "specifications": { + "description": "瑙勬牸", + "type": "string" + }, + "status": { + "type": "integer" + }, + "total": { + "description": "鎬讳环", + "type": "number" + }, + "unit": { + "description": "鍗曚綅", + "type": "string" + }, + "warehouseName": { + "description": "浠撳簱鍚�", + "type": "string" + } + } + }, "response.PageResult": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index ceab31e..4c8c5ad 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1616,7 +1616,7 @@ "summary": "鑾峰彇鎿嶄綔淇℃伅", "responses": { "200": { - "description": "鑾峰彇閲囪喘绫诲瀷鍒楄〃", + "description": "鑾峰彇鎿嶄綔淇℃伅", "schema": { "allOf": [ { @@ -1628,7 +1628,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/purchase_wms.SrmGetWarehouseInfoResponse" + "$ref": "#/definitions/response.OperationInfo" } } } @@ -4223,6 +4223,70 @@ } } }, + "response.OperationInfo": { + "type": "object", + "properties": { + "amount": { + "description": "閲囪喘鏁�", + "type": "number" + }, + "modelNumber": { + "description": "鍨嬪彿", + "type": "string" + }, + "name": { + "description": "浜у搧鍚嶇О", + "type": "string" + }, + "number": { + "description": "浜у搧缂栫爜", + "type": "string" + }, + "operationNumber": { + "description": "鍏ュ簱鍗曞彿", + "type": "string" + }, + "overAmount": { + "description": "鍏ュ簱鏁�", + "type": "integer" + }, + "overTime": { + "description": "鍏ュ簱鏃堕棿", + "type": "string" + }, + "principal": { + "description": "璐熻矗浜�", + "type": "string" + }, + "purchasePrice": { + "description": "鍗曚环", + "type": "number" + }, + "sendAmount": { + "description": "鍙戣揣鏁�", + "type": "integer" + }, + "specifications": { + "description": "瑙勬牸", + "type": "string" + }, + "status": { + "type": "integer" + }, + "total": { + "description": "鎬讳环", + "type": "number" + }, + "unit": { + "description": "鍗曚綅", + "type": "string" + }, + "warehouseName": { + "description": "浠撳簱鍚�", + "type": "string" + } + } + }, "response.PageResult": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 8b827c8..bdcf9a0 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -785,6 +785,53 @@ $ref: '#/definitions/test.SupplierType' type: array type: object + response.OperationInfo: + properties: + amount: + description: 閲囪喘鏁� + type: number + modelNumber: + description: 鍨嬪彿 + type: string + name: + description: 浜у搧鍚嶇О + type: string + number: + description: 浜у搧缂栫爜 + type: string + operationNumber: + description: 鍏ュ簱鍗曞彿 + type: string + overAmount: + description: 鍏ュ簱鏁� + type: integer + overTime: + description: 鍏ュ簱鏃堕棿 + type: string + principal: + description: 璐熻矗浜� + type: string + purchasePrice: + description: 鍗曚环 + type: number + sendAmount: + description: 鍙戣揣鏁� + type: integer + specifications: + description: 瑙勬牸 + type: string + status: + type: integer + total: + description: 鎬讳环 + type: number + unit: + description: 鍗曚綅 + type: string + warehouseName: + description: 浠撳簱鍚� + type: string + type: object response.PageResult: properties: list: {} @@ -1975,14 +2022,14 @@ - application/json responses: "200": - description: 鑾峰彇閲囪喘绫诲瀷鍒楄〃 + description: 鑾峰彇鎿嶄綔淇℃伅 schema: allOf: - $ref: '#/definitions/response.Response' - properties: data: items: - $ref: '#/definitions/purchase_wms.SrmGetWarehouseInfoResponse' + $ref: '#/definitions/response.OperationInfo' type: array type: object security: diff --git a/model/purchase/response/purchase.go b/model/purchase/response/purchase.go index 57a9fa7..953ab7a 100644 --- a/model/purchase/response/purchase.go +++ b/model/purchase/response/purchase.go @@ -13,7 +13,7 @@ type PurchaseProducts struct { PurchaseId int `json:"purchaseId" form:"purchaseType" gorm:"type:int(11);not null;default 0;comment:閲囪喘绫诲瀷id"` // 閲囪喘id - ProductId int `json:"productId" form:"supplierId" gorm:"type:int(11);not null;default 0;comment:渚涘簲鍟唅d"` // 浜у搧id + ProductId int `json:"productId" form:"supplierId" gorm:"type:int(11);not null;default 0;comment:浜у搧id"` // 浜у搧id Amount decimal.Decimal `json:"amount" form:"amount" gorm:"type:decimal(12,2);not null;default 0;comment:閲囪喘鏁伴噺"` // 閲囪喘鏁伴噺 Price decimal.Decimal `json:"price" form:"price" gorm:"type:decimal(12,2);not null;default 0.00;comment:閲囪喘鍗曚环"` // 閲囪喘鍗曚环 Total decimal.Decimal `json:"total" form:"total" gorm:"type:decimal(12,2);not null;default 0.00;comment:閲囪喘鎬讳环"` // 閲囪喘鎬讳环 @@ -51,19 +51,19 @@ } type OperationInfo struct { - ProductId string `json:"productId"` - ProductName string `json:"productName"` - Specifications string `json:"specifications"` //瑙勬牸 - ModelNumber string `json:"modelNumber"` //鍨嬪彿 - Amount decimal.Decimal `json:"amount"` //閲囪喘鏁� - SendAmount int64 `json:"sendAmount"` //鍙戣揣鏁� - OverAmount int64 `json:"overAmount"` //鍏ュ簱鏁� - Unit string `json:"unit"` //鍗曚綅 - Price decimal.Decimal `json:"price"` //鍗曚环 - Total decimal.Decimal `json:"total"` //鎬讳环 - Number string `json:"number"` //鍏ュ簱鍗曞彿 - WarehouseName string `json:"warehouseName"` //浠撳簱鍚� - OverTime string `json:"overTime"` //鍏ュ簱鏃堕棿 - Status int64 `json:"status"` - Principal string `json:"principal"` //璐熻矗浜� + Number string `json:"number"` //浜у搧缂栫爜 + Name string `json:"name"` //浜у搧鍚嶇О + Specifications string `json:"specifications"` //瑙勬牸 + ModelNumber string `json:"modelNumber"` //鍨嬪彿 + Amount decimal.Decimal `json:"amount"` //閲囪喘鏁� + SendAmount int64 `json:"sendAmount"` //鍙戣揣鏁� + OverAmount int64 `json:"overAmount"` //鍏ュ簱鏁� + Unit string `json:"unit"` //鍗曚綅 + PurchasePrice decimal.Decimal `json:"purchasePrice"` //鍗曚环 + Total decimal.Decimal `json:"total"` //鎬讳环 + OperationNumber string `json:"operationNumber"` //鍏ュ簱鍗曞彿 + WarehouseName string `json:"warehouseName"` //浠撳簱鍚� + OverTime string `json:"overTime"` //鍏ュ簱鏃堕棿 + Status int64 `json:"status"` + Principal string `json:"principal"` //璐熻矗浜� } -- Gitblit v1.8.0