From 547033793c42538123775cf862b0cff46f79d661 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期四, 11 四月 2024 10:17:28 +0800
Subject: [PATCH] 获取位置产品信息
---
service/input_history_search.go | 8 +
docs/swagger.yaml | 56 +++++++++++
docs/docs.go | 85 +++++++++++++++++
docs/swagger.json | 85 +++++++++++++++++
controllers/location_product_amount.go | 28 +++++
router/router.go | 11 +-
6 files changed, 265 insertions(+), 8 deletions(-)
diff --git a/controllers/location_product_amount.go b/controllers/location_product_amount.go
index 195d636..90d59f1 100644
--- a/controllers/location_product_amount.go
+++ b/controllers/location_product_amount.go
@@ -251,7 +251,7 @@
util.ResponseFormat(c, code.Success, "淇敼鎴愬姛")
}
-// finish
+// Finish
//
// @Tags 搴撳瓨鐩樼偣
// @Summary 搴旂敤銆侀獙璇�
@@ -311,3 +311,29 @@
}
util.ResponseFormat(c, code.Success, "鎿嶄綔鎴愬姛")
}
+
+// GetLocationProductAmount
+//
+// @Tags 搴撳瓨鐩樼偣
+// @Summary 鑾峰彇浣嶇疆浜у搧淇℃伅
+// @Produce application/json
+// @Param object body request.GetRuleList true "鍏ュ弬"
+// @Success 200 {object} util.Response{data=models.LocationProductAmount} "鎴愬姛"
+// @Router /api-wms/v1/locationProductAmount/getLocationProductAmount [post]
+func (slf LocationProductAmountController) GetLocationProductAmount(c *gin.Context) {
+ var params request.GetRuleList
+ if err := c.BindJSON(¶ms); err != nil {
+ util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�")
+ return
+ }
+ if params.LocationId == 0 || params.ProductId == "" {
+ util.ResponseFormat(c, code.Success, nil)
+ return
+ }
+ first, err := models.NewLocationProductAmountSearch().SetLocationId(params.LocationId).SetProductId(params.ProductId).First()
+ if err != nil {
+ util.ResponseFormat(c, code.RequestParamError, err.Error())
+ return
+ }
+ util.ResponseFormat(c, code.Success, first)
+}
diff --git a/docs/docs.go b/docs/docs.go
index b81598e..574cc1b 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -936,6 +936,48 @@
}
}
},
+ "/api-wms/v1/locationProductAmount/getLocationProductAmount": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "搴撳瓨鐩樼偣"
+ ],
+ "summary": "鑾峰彇浣嶇疆浜у搧淇℃伅",
+ "parameters": [
+ {
+ "description": "鍏ュ弬",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.GetRuleList"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鎴愬姛",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/util.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/models.LocationProductAmount"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
"/api-wms/v1/locationProductAmount/getRuleList": {
"post": {
"produces": [
@@ -3193,6 +3235,49 @@
}
}
},
+ "models.LocationProductAmount": {
+ "type": "object",
+ "properties": {
+ "amount": {
+ "description": "搴撳瓨鏁伴噺",
+ "type": "number"
+ },
+ "createDate": {
+ "description": "鏃ユ湡",
+ "type": "string"
+ },
+ "createTime": {
+ "type": "string"
+ },
+ "id": {
+ "type": "integer"
+ },
+ "location": {
+ "$ref": "#/definitions/models.Location"
+ },
+ "locationId": {
+ "description": "LocationProductId int ` + "`" + `json:\"locationProductId\" gorm:\"type:int;not null;comment:涓婃灦瑙勫垯id\"` + "`" + ` //涓婃灦瑙勫垯id\nLocationProduct LocationProduct ` + "`" + `json:\"locationProduct\" gorm:\"foreignKey:LocationProductId;references:Id\"` + "`" + `",
+ "type": "integer"
+ },
+ "product": {
+ "$ref": "#/definitions/models.Material"
+ },
+ "productCategory": {
+ "$ref": "#/definitions/models.ProductCategory"
+ },
+ "productCategoryId": {
+ "description": "浜у搧绉嶇被id",
+ "type": "integer"
+ },
+ "productId": {
+ "description": "浜у搧id",
+ "type": "string"
+ },
+ "updateTime": {
+ "type": "string"
+ }
+ }
+ },
"models.LogisticCompany": {
"type": "object",
"properties": {
diff --git a/docs/swagger.json b/docs/swagger.json
index a6c10ac..9d2d5c5 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -924,6 +924,48 @@
}
}
},
+ "/api-wms/v1/locationProductAmount/getLocationProductAmount": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "搴撳瓨鐩樼偣"
+ ],
+ "summary": "鑾峰彇浣嶇疆浜у搧淇℃伅",
+ "parameters": [
+ {
+ "description": "鍏ュ弬",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.GetRuleList"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鎴愬姛",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/util.Response"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/models.LocationProductAmount"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
"/api-wms/v1/locationProductAmount/getRuleList": {
"post": {
"produces": [
@@ -3181,6 +3223,49 @@
}
}
},
+ "models.LocationProductAmount": {
+ "type": "object",
+ "properties": {
+ "amount": {
+ "description": "搴撳瓨鏁伴噺",
+ "type": "number"
+ },
+ "createDate": {
+ "description": "鏃ユ湡",
+ "type": "string"
+ },
+ "createTime": {
+ "type": "string"
+ },
+ "id": {
+ "type": "integer"
+ },
+ "location": {
+ "$ref": "#/definitions/models.Location"
+ },
+ "locationId": {
+ "description": "LocationProductId int `json:\"locationProductId\" gorm:\"type:int;not null;comment:涓婃灦瑙勫垯id\"` //涓婃灦瑙勫垯id\nLocationProduct LocationProduct `json:\"locationProduct\" gorm:\"foreignKey:LocationProductId;references:Id\"`",
+ "type": "integer"
+ },
+ "product": {
+ "$ref": "#/definitions/models.Material"
+ },
+ "productCategory": {
+ "$ref": "#/definitions/models.ProductCategory"
+ },
+ "productCategoryId": {
+ "description": "浜у搧绉嶇被id",
+ "type": "integer"
+ },
+ "productId": {
+ "description": "浜у搧id",
+ "type": "string"
+ },
+ "updateTime": {
+ "type": "string"
+ }
+ }
+ },
"models.LogisticCompany": {
"type": "object",
"properties": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 7ffb926..85d71c5 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -425,6 +425,38 @@
description: 浠撳簱ID
type: integer
type: object
+ models.LocationProductAmount:
+ properties:
+ amount:
+ description: 搴撳瓨鏁伴噺
+ type: number
+ createDate:
+ description: 鏃ユ湡
+ type: string
+ createTime:
+ type: string
+ id:
+ type: integer
+ location:
+ $ref: '#/definitions/models.Location'
+ locationId:
+ description: |-
+ LocationProductId int `json:"locationProductId" gorm:"type:int;not null;comment:涓婃灦瑙勫垯id"` //涓婃灦瑙勫垯id
+ LocationProduct LocationProduct `json:"locationProduct" gorm:"foreignKey:LocationProductId;references:Id"`
+ type: integer
+ product:
+ $ref: '#/definitions/models.Material'
+ productCategory:
+ $ref: '#/definitions/models.ProductCategory'
+ productCategoryId:
+ description: 浜у搧绉嶇被id
+ type: integer
+ productId:
+ description: 浜у搧id
+ type: string
+ updateTime:
+ type: string
+ type: object
models.LogisticCompany:
properties:
contact:
@@ -2301,6 +2333,30 @@
summary: 搴旂敤銆侀獙璇�
tags:
- 搴撳瓨鐩樼偣
+ /api-wms/v1/locationProductAmount/getLocationProductAmount:
+ post:
+ parameters:
+ - description: 鍏ュ弬
+ in: body
+ name: object
+ required: true
+ schema:
+ $ref: '#/definitions/request.GetRuleList'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 鎴愬姛
+ schema:
+ allOf:
+ - $ref: '#/definitions/util.Response'
+ - properties:
+ data:
+ $ref: '#/definitions/models.LocationProductAmount'
+ type: object
+ summary: 鑾峰彇浣嶇疆浜у搧淇℃伅
+ tags:
+ - 搴撳瓨鐩樼偣
/api-wms/v1/locationProductAmount/getRuleList:
post:
parameters:
diff --git a/router/router.go b/router/router.go
index b28aef4..1b936db 100644
--- a/router/router.go
+++ b/router/router.go
@@ -140,11 +140,12 @@
locationProductAmountController := new(controllers.LocationProductAmountController)
locationProductAmountAPI := r.Group(urlPrefix + "/locationProductAmount")
{
- locationProductAmountAPI.POST("add", locationProductAmountController.Add) //娣诲姞搴撳瓨鐩樼偣淇℃伅
- locationProductAmountAPI.POST("list", locationProductAmountController.List) //鏌ョ湅搴撳瓨鐩樼偣鍒楄〃
- locationProductAmountAPI.POST("update", locationProductAmountController.Update) //淇敼搴撳瓨鐩樼偣淇℃伅
- locationProductAmountAPI.POST("finish", locationProductAmountController.Finish) //搴旂敤銆侀獙璇佸簱瀛樼洏鐐逛俊鎭�
- locationProductAmountAPI.POST("getRuleList", locationProductAmountController.GetRuleList) //鑾峰彇涓婃灦瑙勫垯
+ locationProductAmountAPI.POST("add", locationProductAmountController.Add) //娣诲姞搴撳瓨鐩樼偣淇℃伅
+ locationProductAmountAPI.POST("list", locationProductAmountController.List) //鏌ョ湅搴撳瓨鐩樼偣鍒楄〃
+ locationProductAmountAPI.POST("update", locationProductAmountController.Update) //淇敼搴撳瓨鐩樼偣淇℃伅
+ locationProductAmountAPI.POST("finish", locationProductAmountController.Finish) //搴旂敤銆侀獙璇佸簱瀛樼洏鐐逛俊鎭�
+ locationProductAmountAPI.POST("getRuleList", locationProductAmountController.GetRuleList) //鑾峰彇涓婃灦瑙勫垯
+ locationProductAmountAPI.POST("getLocationProductAmount", locationProductAmountController.GetLocationProductAmount) //鑾峰彇浣嶇疆浜у搧淇℃伅
}
//鎶ヨ〃
diff --git a/service/input_history_search.go b/service/input_history_search.go
index e81a10d..68b61f9 100644
--- a/service/input_history_search.go
+++ b/service/input_history_search.go
@@ -98,10 +98,14 @@
var ids []string
from := (page - 1) * pageSize
t, err := parseDateString(keyword)
+ m := make(map[string]interface{})
+ if operationType > 0 {
+ m["baseOperationType"] = operationType
+ }
if err != nil && t.IsZero() {
- ids, total, err = blevex.ComplexSearch(HistoryReportIndexName, keyword, map[string]interface{}{"baseOperationType": operationType}, from, pageSize)
+ ids, total, err = blevex.ComplexSearch(HistoryReportIndexName, keyword, m, from, pageSize)
} else {
- ids, total, err = blevex.TimeSearch(HistoryReportIndexName, t, map[string]interface{}{"baseOperationType": operationType}, from, pageSize)
+ ids, total, err = blevex.TimeSearch(HistoryReportIndexName, t, m, from, pageSize)
}
if err != nil {
--
Gitblit v1.8.0