From b784b08a26808e9faccb7ea397de946501a939eb Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期三, 27 九月 2023 20:08:43 +0800
Subject: [PATCH] 1.二期一部分代码
---
controllers/product_controller.go | 5
controllers/operation.go | 10
models/operation.go | 2
request/location_product_amount.go | 10
request/product_request.go | 3
docs/swagger.yaml | 240 ++++++++++++
request/operation.go | 1
docs/docs.go | 364 ++++++++++++++++++
docs/swagger.json | 364 ++++++++++++++++++
controllers/location_product_amount.go | 100 +----
router/router.go | 5
11 files changed, 990 insertions(+), 114 deletions(-)
diff --git a/controllers/location_product_amount.go b/controllers/location_product_amount.go
index c2c1c16..d7594dc 100644
--- a/controllers/location_product_amount.go
+++ b/controllers/location_product_amount.go
@@ -179,79 +179,27 @@
// @Param object body request.UpdateLocationProductAmount true "鍏ュ簱/鍑哄簱淇℃伅"
// @Success 200 {object} util.Response "鎴愬姛"
// @Router /api-wms/v1/locationProductAmount/update [post]
-//func (slf LocationProductAmountController) Update(c *gin.Context) {
-// var reqParams request.UpdateLocationProductAmount
-// if err := c.BindJSON(&reqParams); err != nil {
-// util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�")
-// return
-// }
-//
-// var existCount int64
-// if err := models.NewOperationSearch().Orm.Table("wms_operation").InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id").Where("wms_operation.from_location_id=? and wms_operation_details.product_id=? and wms_operation.base_operation_type=? and wms_operation.status=?", reqParams.LocationId, reqParams.ProductId, constvar.BaseOperationTypeAdjust, constvar.OperationStatus_Ready).Count(&existCount).Error; err != nil {
-// util.ResponseFormat(c, code.RequestParamError, err.Error())
-// return
-// }
-// if existCount > 0 {
-// util.ResponseFormat(c, code.RequestError, "璇ュ晢鍝佸湪宸查�変腑鐨勪綅缃瓨鍦ㄦ湭楠岃瘉鐨勫簱瀛樼洏鐐逛俊鎭紝鏃犳硶缁х画娣诲姞鐩稿叧淇℃伅")
-// return
-// }
-//
-// locProduct, err := models.NewLocationProductSearch().SetLocationId(reqParams.LocationId).SetProductId(reqParams.ProductId).First()
-// if err != nil {
-// util.ResponseFormat(c, code.RequestParamError, "鍙傛暟寮傚父锛屾湭鎵惧埌璇ヤ笂鏋惰鍒�")
-// return
-// }
-// if locProduct.Id == 0 {
-// util.ResponseFormat(c, code.RequestError, "涓嶅瓨鍦ㄨ涓婃灦瑙勫垯锛屾棤娉曡繘琛屽簱瀛樼洏鐐�")
-// return
-// }
-// location, err := models.NewLocationSearch().SetType(int(constvar.LocationTypeAdjust)).First()
-// if err != nil {
-// util.ResponseFormat(c, code.RequestParamError, err.Error())
-// return
-// }
-// //reqParams.AdjustAmount = reqParams.Amount.Sub(reqParams.DifferenceAmount)
-// reqParams.AdjustAmount = reqParams.DifferenceAmount.Sub(reqParams.Amount)
-// locAmount := models.LocationProductAmount{
-// LocationProductId: locProduct.Id,
-// Amount: decimal.NewFromInt(0),
-// CreateDate: time.Now().Format("2006-01-02 15:04:05"),
-// }
-// detail := &models.OperationDetails{
-// ProductId: reqParams.ProductId,
-// Amount: reqParams.AdjustAmount,
-// }
-// operation := models.Operation{
-// Number: strconv.FormatInt(time.Now().Unix(), 10),
-// Status: constvar.OperationStatus_Ready,
-// OperationDate: time.Now().Format("2006-01-02 15:04:05"),
-// Comment: "搴撳瓨鐩樼偣",
-// BaseOperationType: constvar.BaseOperationTypeAdjust,
-// Details: []*models.OperationDetails{detail},
-// FromLocationID: location.Id,
-// ToLocationID: reqParams.LocationId,
-// }
-//
-// //if reqParams.AdjustAmount.GreaterThanOrEqual(decimal.NewFromInt(0)) {
-// // operation.FromLocationID = Location.Id
-// // operation.ToLocationID = reqParams.LocationId
-// //} else {
-// // operation.FromLocationID = reqParams.LocationId
-// // operation.ToLocationID = Location.Id
-// //}
-//
-// if err := models.WithTransaction(func(tx *gorm.DB) error {
-// if err := models.NewOperationSearch().SetOrm(tx).Create(&operation); err != nil {
-// return err
-// }
-// if err := models.NewLocationProductAmountSearch().SetOrm(tx).Create(&locAmount); err != nil {
-// return err
-// }
-// return nil
-// }); err != nil {
-// util.ResponseFormat(c, code.RequestError, err.Error())
-// return
-// }
-//
-// util.ResponseFormat(c, code.Success, "娣诲姞鎴愬姛")
-//}
+func (slf LocationProductAmountController) Update(c *gin.Context) {
+ var reqParams request.UpdateLocationProductAmount
+ if err := c.BindJSON(&reqParams); err != nil {
+ util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�")
+ return
+ }
+ reqParams.AdjustAmount = reqParams.DifferenceAmount.Sub(reqParams.Amount)
+ operation, err := models.NewOperationSearch().SetID(reqParams.OperationId).First()
+ if err != nil {
+ util.ResponseFormat(c, code.RequestParamError, "鏈壘鍒扮浉鍏虫暟鎹�")
+ return
+ }
+ if operation.Status != constvar.OperationStatus_Ready {
+ util.ResponseFormat(c, code.RequestParamError, "璇ヨ褰曞凡楠岃瘉閫氳繃锛屾棤娉曡繘琛屼慨鏀�")
+ return
+ }
+
+ if err := models.NewOperationDetailsSearch().SetOperationId(reqParams.OperationId).SetProductId(reqParams.ProductId).Update(&models.OperationDetails{Amount: reqParams.AdjustAmount}); err != nil {
+ util.ResponseFormat(c, code.RequestError, "淇敼澶辫触锛�"+err.Error())
+ return
+ }
+
+ util.ResponseFormat(c, code.Success, "淇敼鎴愬姛")
+}
diff --git a/controllers/operation.go b/controllers/operation.go
index fa8137d..3e1e36f 100644
--- a/controllers/operation.go
+++ b/controllers/operation.go
@@ -176,10 +176,7 @@
search := models.NewOperationSearch()
search.SetPage(params.Page, params.PageSize)
if params.Number != "" {
- search.SetNumber(params.Number)
- }
- if params.SourceNumber != "" {
- search.SetSourceNumber(params.SourceNumber)
+ search.SetKeyword(params.Number)
}
list, total, err := search.SetOperationTypeId(params.OperationTypeId).SetPreload(true).SetOrder("created_at desc").Find()
if err != nil {
@@ -412,10 +409,7 @@
search.SetPage(params.Page, params.PageSize)
search.SetPage(params.Page, params.PageSize)
if params.Number != "" {
- search.SetNumber(params.Number)
- }
- if params.SourceNumber != "" {
- search.SetSourceNumber(params.SourceNumber)
+ search.SetKeyword(params.Number)
}
list, total, err := search.SetPreload(true).SetOrder("created_at desc").Find()
if err != nil {
diff --git a/controllers/product_controller.go b/controllers/product_controller.go
index 333d2b0..2750ff6 100644
--- a/controllers/product_controller.go
+++ b/controllers/product_controller.go
@@ -403,11 +403,8 @@
db := models.NewOperationSearch().Orm.Table("wms_operation").Select("wms_operation.id,wms_operation.number,wms_operation.source_number,wms_operation.status,wms_operation.from_location_id,wms_operation.to_location_id,wms_operation.operation_date,wms_operation.contacter_id,wms_operation.contacter_name,wms_operation.company_id,wms_operation.company_name,wms_operation.comment,wms_operation_details.product_id,material.name as product_name,material.unit,wms_operation_details.amount").InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id").InnerJoins("inner join material on material.id=wms_operation_details.product_id")
- if params.SourceNumber != "" {
- db = db.Where("wms_operation.source_number like ?", fmt.Sprintf("%%%v%%", params.SourceNumber))
- }
if params.Number != "" {
- db = db.Where("wms_operation.number like ?", fmt.Sprintf("%%%v%%", params.Number))
+ db = db.Where("wms_operation.number like ? or wms_operation.source_number like ?", fmt.Sprintf("%%%v%%", params.Number), fmt.Sprintf("%%%v%%", params.Number))
}
db = db.Where("wms_operation.operation_type_id=?", 0)
var (
diff --git a/docs/docs.go b/docs/docs.go
index d20b847..4f78bf4 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -294,6 +294,141 @@
}
}
},
+ "/api-wms/v1/forms/getHistory": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "鎶ヨ〃"
+ ],
+ "summary": "鑾峰彇鍘嗗彶淇℃伅",
+ "parameters": [
+ {
+ "description": "鏌ヨ鍙傛暟",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.GetInventoryHistory"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鎴愬姛",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/util.ResponseList"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/response.InventoryHistory"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/api-wms/v1/forms/getInventoryForms": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "鎶ヨ〃"
+ ],
+ "summary": "鑾峰彇搴撳瓨鎶ヨ〃",
+ "parameters": [
+ {
+ "description": "鏌ヨ鍙傛暟",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.GetInventoryForms"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鎴愬姛",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/util.ResponseList"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/response.InventoryForms"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/api-wms/v1/forms/getLocationForms": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "鎶ヨ〃"
+ ],
+ "summary": "鑾峰彇浣嶇疆鎶ヨ〃",
+ "parameters": [
+ {
+ "description": "鏌ヨ鍙傛暟",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.PageInfo"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鎴愬姛",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/util.ResponseList"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/response.LocationForms"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
"/api-wms/v1/location/addLocation": {
"post": {
"produces": [
@@ -632,6 +767,36 @@
"required": true,
"schema": {
"$ref": "#/definitions/request.PageInfo"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鎴愬姛",
+ "schema": {
+ "$ref": "#/definitions/util.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api-wms/v1/locationProductAmount/update": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "搴撳瓨鐩樼偣"
+ ],
+ "summary": "淇敼搴撳瓨鐩樼偣淇℃伅",
+ "parameters": [
+ {
+ "description": "鍏ュ簱/鍑哄簱淇℃伅",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.UpdateLocationProductAmount"
}
}
],
@@ -2791,6 +2956,55 @@
}
}
},
+ "request.GetInventoryForms": {
+ "type": "object",
+ "properties": {
+ "categoryIds": {
+ "description": "浜у搧绫诲瀷id",
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ },
+ "page": {
+ "description": "椤电爜",
+ "type": "integer"
+ },
+ "pageSize": {
+ "description": "姣忛〉澶у皬",
+ "type": "integer"
+ },
+ "warehouseCode": {
+ "description": "浠撳簱缂╁啓",
+ "type": "string"
+ }
+ }
+ },
+ "request.GetInventoryHistory": {
+ "type": "object",
+ "properties": {
+ "page": {
+ "description": "椤电爜",
+ "type": "integer"
+ },
+ "pageSize": {
+ "description": "姣忛〉澶у皬",
+ "type": "integer"
+ },
+ "produceId": {
+ "description": "浜у搧id",
+ "type": "string"
+ },
+ "productName": {
+ "description": "浜у搧鍚嶇О",
+ "type": "string"
+ },
+ "unit": {
+ "description": "鍗曚綅",
+ "type": "string"
+ }
+ }
+ },
"request.GetProductList": {
"type": "object",
"properties": {
@@ -2862,9 +3076,6 @@
"pageSize": {
"description": "姣忛〉澶у皬",
"type": "integer"
- },
- "sourceNumber": {
- "type": "string"
}
}
},
@@ -2894,9 +3105,6 @@
"pageSize": {
"description": "姣忛〉澶у皬",
"type": "integer"
- },
- "sourceNumber": {
- "type": "string"
}
}
},
@@ -3022,6 +3230,31 @@
},
"productCategoryId": {
"description": "浜у搧绉嶇被id",
+ "type": "integer"
+ },
+ "productId": {
+ "description": "浜у搧id",
+ "type": "string"
+ }
+ }
+ },
+ "request.UpdateLocationProductAmount": {
+ "type": "object",
+ "properties": {
+ "Amount": {
+ "description": "搴撳瓨鏁伴噺",
+ "type": "number"
+ },
+ "adjustAmount": {
+ "description": "LocationProductAmountId int ` + "`" + `json:\"locationProductAmountId\"` + "`" + ` //搴撳瓨鐩樼偣id",
+ "type": "number"
+ },
+ "differenceAmount": {
+ "description": "璁℃暟鏁伴噺",
+ "type": "number"
+ },
+ "operationId": {
+ "description": "鍑哄叆搴搃d",
"type": "integer"
},
"productId": {
@@ -3180,6 +3413,125 @@
}
}
},
+ "response.InventoryForms": {
+ "type": "object",
+ "properties": {
+ "amount": {
+ "description": "鍦ㄥ簱鏁伴噺",
+ "type": "number"
+ },
+ "availableNumber": {
+ "description": "鍙敤搴撳瓨",
+ "type": "number"
+ },
+ "cost": {
+ "description": "鎴愭湰",
+ "type": "number"
+ },
+ "in": {
+ "description": "鍏ュ簱",
+ "type": "number"
+ },
+ "out": {
+ "description": "鍑哄簱",
+ "type": "number"
+ },
+ "produceId": {
+ "description": "浜у搧id",
+ "type": "string"
+ },
+ "productName": {
+ "description": "浜у搧鍚嶇О",
+ "type": "string"
+ },
+ "productType": {
+ "description": "浜у搧绫诲瀷",
+ "type": "string"
+ },
+ "unit": {
+ "description": "鍗曚綅",
+ "type": "string"
+ },
+ "value": {
+ "description": "鎬讳环鍊�",
+ "type": "number"
+ }
+ }
+ },
+ "response.InventoryHistory": {
+ "type": "object",
+ "properties": {
+ "amount": {
+ "description": "鏁伴噺",
+ "type": "number"
+ },
+ "baseOperationType": {
+ "description": "鍩虹浣滀笟绫诲瀷",
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.BaseOperationType"
+ }
+ ]
+ },
+ "contactedName": {
+ "description": "瀹屾垚鑰�",
+ "type": "string"
+ },
+ "date": {
+ "description": "鏃ユ湡",
+ "type": "string"
+ },
+ "fromLocation": {
+ "description": "婧愪綅缃�",
+ "type": "string"
+ },
+ "number": {
+ "description": "鍗曞彿",
+ "type": "string"
+ },
+ "toLocation": {
+ "description": "鐩爣浣嶇疆",
+ "type": "string"
+ },
+ "unit": {
+ "description": "鍗曚綅",
+ "type": "string"
+ }
+ }
+ },
+ "response.LocationForms": {
+ "type": "object",
+ "properties": {
+ "amount": {
+ "description": "鏁伴噺",
+ "type": "number"
+ },
+ "locationName": {
+ "description": "浣嶇疆鍚嶇О",
+ "type": "string"
+ },
+ "produceId": {
+ "description": "浜у搧id",
+ "type": "string"
+ },
+ "productName": {
+ "description": "浜у搧鍚嶇О",
+ "type": "string"
+ },
+ "productTypeName": {
+ "description": "浜у搧绫诲埆",
+ "type": "string"
+ },
+ "unit": {
+ "description": "鍗曚綅",
+ "type": "string"
+ },
+ "value": {
+ "description": "鎬讳环鍊�",
+ "type": "number"
+ }
+ }
+ },
"util.Response": {
"type": "object",
"properties": {
diff --git a/docs/swagger.json b/docs/swagger.json
index 330c147..67b761c 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -282,6 +282,141 @@
}
}
},
+ "/api-wms/v1/forms/getHistory": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "鎶ヨ〃"
+ ],
+ "summary": "鑾峰彇鍘嗗彶淇℃伅",
+ "parameters": [
+ {
+ "description": "鏌ヨ鍙傛暟",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.GetInventoryHistory"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鎴愬姛",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/util.ResponseList"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/response.InventoryHistory"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/api-wms/v1/forms/getInventoryForms": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "鎶ヨ〃"
+ ],
+ "summary": "鑾峰彇搴撳瓨鎶ヨ〃",
+ "parameters": [
+ {
+ "description": "鏌ヨ鍙傛暟",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.GetInventoryForms"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鎴愬姛",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/util.ResponseList"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/response.InventoryForms"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/api-wms/v1/forms/getLocationForms": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "鎶ヨ〃"
+ ],
+ "summary": "鑾峰彇浣嶇疆鎶ヨ〃",
+ "parameters": [
+ {
+ "description": "鏌ヨ鍙傛暟",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.PageInfo"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鎴愬姛",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/util.ResponseList"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/response.LocationForms"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
"/api-wms/v1/location/addLocation": {
"post": {
"produces": [
@@ -620,6 +755,36 @@
"required": true,
"schema": {
"$ref": "#/definitions/request.PageInfo"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鎴愬姛",
+ "schema": {
+ "$ref": "#/definitions/util.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api-wms/v1/locationProductAmount/update": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "搴撳瓨鐩樼偣"
+ ],
+ "summary": "淇敼搴撳瓨鐩樼偣淇℃伅",
+ "parameters": [
+ {
+ "description": "鍏ュ簱/鍑哄簱淇℃伅",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.UpdateLocationProductAmount"
}
}
],
@@ -2779,6 +2944,55 @@
}
}
},
+ "request.GetInventoryForms": {
+ "type": "object",
+ "properties": {
+ "categoryIds": {
+ "description": "浜у搧绫诲瀷id",
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ },
+ "page": {
+ "description": "椤电爜",
+ "type": "integer"
+ },
+ "pageSize": {
+ "description": "姣忛〉澶у皬",
+ "type": "integer"
+ },
+ "warehouseCode": {
+ "description": "浠撳簱缂╁啓",
+ "type": "string"
+ }
+ }
+ },
+ "request.GetInventoryHistory": {
+ "type": "object",
+ "properties": {
+ "page": {
+ "description": "椤电爜",
+ "type": "integer"
+ },
+ "pageSize": {
+ "description": "姣忛〉澶у皬",
+ "type": "integer"
+ },
+ "produceId": {
+ "description": "浜у搧id",
+ "type": "string"
+ },
+ "productName": {
+ "description": "浜у搧鍚嶇О",
+ "type": "string"
+ },
+ "unit": {
+ "description": "鍗曚綅",
+ "type": "string"
+ }
+ }
+ },
"request.GetProductList": {
"type": "object",
"properties": {
@@ -2850,9 +3064,6 @@
"pageSize": {
"description": "姣忛〉澶у皬",
"type": "integer"
- },
- "sourceNumber": {
- "type": "string"
}
}
},
@@ -2882,9 +3093,6 @@
"pageSize": {
"description": "姣忛〉澶у皬",
"type": "integer"
- },
- "sourceNumber": {
- "type": "string"
}
}
},
@@ -3010,6 +3218,31 @@
},
"productCategoryId": {
"description": "浜у搧绉嶇被id",
+ "type": "integer"
+ },
+ "productId": {
+ "description": "浜у搧id",
+ "type": "string"
+ }
+ }
+ },
+ "request.UpdateLocationProductAmount": {
+ "type": "object",
+ "properties": {
+ "Amount": {
+ "description": "搴撳瓨鏁伴噺",
+ "type": "number"
+ },
+ "adjustAmount": {
+ "description": "LocationProductAmountId int `json:\"locationProductAmountId\"` //搴撳瓨鐩樼偣id",
+ "type": "number"
+ },
+ "differenceAmount": {
+ "description": "璁℃暟鏁伴噺",
+ "type": "number"
+ },
+ "operationId": {
+ "description": "鍑哄叆搴搃d",
"type": "integer"
},
"productId": {
@@ -3168,6 +3401,125 @@
}
}
},
+ "response.InventoryForms": {
+ "type": "object",
+ "properties": {
+ "amount": {
+ "description": "鍦ㄥ簱鏁伴噺",
+ "type": "number"
+ },
+ "availableNumber": {
+ "description": "鍙敤搴撳瓨",
+ "type": "number"
+ },
+ "cost": {
+ "description": "鎴愭湰",
+ "type": "number"
+ },
+ "in": {
+ "description": "鍏ュ簱",
+ "type": "number"
+ },
+ "out": {
+ "description": "鍑哄簱",
+ "type": "number"
+ },
+ "produceId": {
+ "description": "浜у搧id",
+ "type": "string"
+ },
+ "productName": {
+ "description": "浜у搧鍚嶇О",
+ "type": "string"
+ },
+ "productType": {
+ "description": "浜у搧绫诲瀷",
+ "type": "string"
+ },
+ "unit": {
+ "description": "鍗曚綅",
+ "type": "string"
+ },
+ "value": {
+ "description": "鎬讳环鍊�",
+ "type": "number"
+ }
+ }
+ },
+ "response.InventoryHistory": {
+ "type": "object",
+ "properties": {
+ "amount": {
+ "description": "鏁伴噺",
+ "type": "number"
+ },
+ "baseOperationType": {
+ "description": "鍩虹浣滀笟绫诲瀷",
+ "allOf": [
+ {
+ "$ref": "#/definitions/constvar.BaseOperationType"
+ }
+ ]
+ },
+ "contactedName": {
+ "description": "瀹屾垚鑰�",
+ "type": "string"
+ },
+ "date": {
+ "description": "鏃ユ湡",
+ "type": "string"
+ },
+ "fromLocation": {
+ "description": "婧愪綅缃�",
+ "type": "string"
+ },
+ "number": {
+ "description": "鍗曞彿",
+ "type": "string"
+ },
+ "toLocation": {
+ "description": "鐩爣浣嶇疆",
+ "type": "string"
+ },
+ "unit": {
+ "description": "鍗曚綅",
+ "type": "string"
+ }
+ }
+ },
+ "response.LocationForms": {
+ "type": "object",
+ "properties": {
+ "amount": {
+ "description": "鏁伴噺",
+ "type": "number"
+ },
+ "locationName": {
+ "description": "浣嶇疆鍚嶇О",
+ "type": "string"
+ },
+ "produceId": {
+ "description": "浜у搧id",
+ "type": "string"
+ },
+ "productName": {
+ "description": "浜у搧鍚嶇О",
+ "type": "string"
+ },
+ "productTypeName": {
+ "description": "浜у搧绫诲埆",
+ "type": "string"
+ },
+ "unit": {
+ "description": "鍗曚綅",
+ "type": "string"
+ },
+ "value": {
+ "description": "鎬讳环鍊�",
+ "type": "number"
+ }
+ }
+ },
"util.Response": {
"type": "object",
"properties": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index a87ffb6..eecd6f1 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -799,6 +799,41 @@
required:
- code
type: object
+ request.GetInventoryForms:
+ properties:
+ categoryIds:
+ description: 浜у搧绫诲瀷id
+ items:
+ type: integer
+ type: array
+ page:
+ description: 椤电爜
+ type: integer
+ pageSize:
+ description: 姣忛〉澶у皬
+ type: integer
+ warehouseCode:
+ description: 浠撳簱缂╁啓
+ type: string
+ type: object
+ request.GetInventoryHistory:
+ properties:
+ page:
+ description: 椤电爜
+ type: integer
+ pageSize:
+ description: 姣忛〉澶у皬
+ type: integer
+ produceId:
+ description: 浜у搧id
+ type: string
+ productName:
+ description: 浜у搧鍚嶇О
+ type: string
+ unit:
+ description: 鍗曚綅
+ type: string
+ type: object
request.GetProductList:
properties:
categoryId:
@@ -850,8 +885,6 @@
pageSize:
description: 姣忛〉澶у皬
type: integer
- sourceNumber:
- type: string
type: object
request.PageInfo:
properties:
@@ -872,8 +905,6 @@
pageSize:
description: 姣忛〉澶у皬
type: integer
- sourceNumber:
- type: string
type: object
request.QueryOperationHistory:
properties:
@@ -959,6 +990,25 @@
type: integer
productCategoryId:
description: 浜у搧绉嶇被id
+ type: integer
+ productId:
+ description: 浜у搧id
+ type: string
+ type: object
+ request.UpdateLocationProductAmount:
+ properties:
+ Amount:
+ description: 搴撳瓨鏁伴噺
+ type: number
+ adjustAmount:
+ description: LocationProductAmountId int `json:"locationProductAmountId"`
+ //搴撳瓨鐩樼偣id
+ type: number
+ differenceAmount:
+ description: 璁℃暟鏁伴噺
+ type: number
+ operationId:
+ description: 鍑哄叆搴搃d
type: integer
productId:
description: 浜у搧id
@@ -1063,6 +1113,91 @@
warehouseId:
description: 浠撳簱id
type: integer
+ type: object
+ response.InventoryForms:
+ properties:
+ amount:
+ description: 鍦ㄥ簱鏁伴噺
+ type: number
+ availableNumber:
+ description: 鍙敤搴撳瓨
+ type: number
+ cost:
+ description: 鎴愭湰
+ type: number
+ in:
+ description: 鍏ュ簱
+ type: number
+ out:
+ description: 鍑哄簱
+ type: number
+ produceId:
+ description: 浜у搧id
+ type: string
+ productName:
+ description: 浜у搧鍚嶇О
+ type: string
+ productType:
+ description: 浜у搧绫诲瀷
+ type: string
+ unit:
+ description: 鍗曚綅
+ type: string
+ value:
+ description: 鎬讳环鍊�
+ type: number
+ type: object
+ response.InventoryHistory:
+ properties:
+ amount:
+ description: 鏁伴噺
+ type: number
+ baseOperationType:
+ allOf:
+ - $ref: '#/definitions/constvar.BaseOperationType'
+ description: 鍩虹浣滀笟绫诲瀷
+ contactedName:
+ description: 瀹屾垚鑰�
+ type: string
+ date:
+ description: 鏃ユ湡
+ type: string
+ fromLocation:
+ description: 婧愪綅缃�
+ type: string
+ number:
+ description: 鍗曞彿
+ type: string
+ toLocation:
+ description: 鐩爣浣嶇疆
+ type: string
+ unit:
+ description: 鍗曚綅
+ type: string
+ type: object
+ response.LocationForms:
+ properties:
+ amount:
+ description: 鏁伴噺
+ type: number
+ locationName:
+ description: 浣嶇疆鍚嶇О
+ type: string
+ produceId:
+ description: 浜у搧id
+ type: string
+ productName:
+ description: 浜у搧鍚嶇О
+ type: string
+ productTypeName:
+ description: 浜у搧绫诲埆
+ type: string
+ unit:
+ description: 鍗曚綅
+ type: string
+ value:
+ description: 鎬讳环鍊�
+ type: number
type: object
util.Response:
properties:
@@ -1262,6 +1397,84 @@
summary: 缂栬緫鍏徃
tags:
- 鍏徃
+ /api-wms/v1/forms/getHistory:
+ post:
+ parameters:
+ - description: 鏌ヨ鍙傛暟
+ in: body
+ name: object
+ required: true
+ schema:
+ $ref: '#/definitions/request.GetInventoryHistory'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 鎴愬姛
+ schema:
+ allOf:
+ - $ref: '#/definitions/util.ResponseList'
+ - properties:
+ data:
+ items:
+ $ref: '#/definitions/response.InventoryHistory'
+ type: array
+ type: object
+ summary: 鑾峰彇鍘嗗彶淇℃伅
+ tags:
+ - 鎶ヨ〃
+ /api-wms/v1/forms/getInventoryForms:
+ post:
+ parameters:
+ - description: 鏌ヨ鍙傛暟
+ in: body
+ name: object
+ required: true
+ schema:
+ $ref: '#/definitions/request.GetInventoryForms'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 鎴愬姛
+ schema:
+ allOf:
+ - $ref: '#/definitions/util.ResponseList'
+ - properties:
+ data:
+ items:
+ $ref: '#/definitions/response.InventoryForms'
+ type: array
+ type: object
+ summary: 鑾峰彇搴撳瓨鎶ヨ〃
+ tags:
+ - 鎶ヨ〃
+ /api-wms/v1/forms/getLocationForms:
+ post:
+ parameters:
+ - description: 鏌ヨ鍙傛暟
+ in: body
+ name: object
+ required: true
+ schema:
+ $ref: '#/definitions/request.PageInfo'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 鎴愬姛
+ schema:
+ allOf:
+ - $ref: '#/definitions/util.ResponseList'
+ - properties:
+ data:
+ items:
+ $ref: '#/definitions/response.LocationForms'
+ type: array
+ type: object
+ summary: 鑾峰彇浣嶇疆鎶ヨ〃
+ tags:
+ - 鎶ヨ〃
/api-wms/v1/location/addLocation:
post:
parameters:
@@ -1480,6 +1693,25 @@
summary: 搴撳瓨鐩樼偣鍒楄〃
tags:
- 搴撳瓨鐩樼偣
+ /api-wms/v1/locationProductAmount/update:
+ post:
+ parameters:
+ - description: 鍏ュ簱/鍑哄簱淇℃伅
+ in: body
+ name: object
+ required: true
+ schema:
+ $ref: '#/definitions/request.UpdateLocationProductAmount'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 鎴愬姛
+ schema:
+ $ref: '#/definitions/util.Response'
+ summary: 淇敼搴撳瓨鐩樼偣淇℃伅
+ tags:
+ - 搴撳瓨鐩樼偣
/api-wms/v1/operation/finish/{id}:
put:
parameters:
diff --git a/models/operation.go b/models/operation.go
index 1fd2daf..5a126b3 100644
--- a/models/operation.go
+++ b/models/operation.go
@@ -123,7 +123,7 @@
}
if slf.Keyword != "" {
- db = db.Where("product_name like ?", fmt.Sprintf("%%%v%%", slf.Keyword))
+ db = db.Where("number like ? or source_number like ?", fmt.Sprintf("%%%v%%", slf.Keyword), fmt.Sprintf("%%%v%%", slf.Keyword))
}
if slf.SourceNumber != "" {
diff --git a/request/location_product_amount.go b/request/location_product_amount.go
index faa7b02..fac0745 100644
--- a/request/location_product_amount.go
+++ b/request/location_product_amount.go
@@ -11,8 +11,10 @@
}
type UpdateLocationProductAmount struct {
- LocationProductAmountId int `json:"locationProductAmountId"` //搴撳瓨鐩樼偣id
- AdjustAmount decimal.Decimal `json:"adjustAmount" ` //宸��
- DifferenceAmount decimal.Decimal `json:"differenceAmount"` //璁℃暟鏁伴噺
- OperationId int `json:"operationId"` //鍑哄叆搴搃d
+ //LocationProductAmountId int `json:"locationProductAmountId"` //搴撳瓨鐩樼偣id
+ AdjustAmount decimal.Decimal `json:"adjustAmount" ` //宸��
+ DifferenceAmount decimal.Decimal `json:"differenceAmount"` //璁℃暟鏁伴噺
+ OperationId int `json:"operationId"` //鍑哄叆搴搃d
+ Amount decimal.Decimal `json:"Amount"` //搴撳瓨鏁伴噺
+ ProductId string `json:"productId"` //浜у搧id
}
diff --git a/request/operation.go b/request/operation.go
index cf73ffa..a507a13 100644
--- a/request/operation.go
+++ b/request/operation.go
@@ -42,7 +42,6 @@
PageInfo
OperationTypeId int `json:"operationTypeId" form:"operationTypeId"`
Number string `json:"number"`
- SourceNumber string `json:"sourceNumber"`
}
type UpdateOperation struct {
diff --git a/request/product_request.go b/request/product_request.go
index 6cdafe1..c48f3c0 100644
--- a/request/product_request.go
+++ b/request/product_request.go
@@ -28,8 +28,7 @@
type QueryDisuseList struct {
PageInfo
- Number string `json:"number"`
- SourceNumber string `json:"sourceNumber"`
+ Number string `json:"number"`
}
type UpdateDisuse struct {
diff --git a/router/router.go b/router/router.go
index 0224086..11a3378 100644
--- a/router/router.go
+++ b/router/router.go
@@ -125,8 +125,9 @@
locationProductAmountController := new(controllers.LocationProductAmountController)
locationProductAmountAPI := r.Group(urlPrefix + "/locationProductAmount")
{
- locationProductAmountAPI.POST("add", locationProductAmountController.Add) //娣诲姞搴撳瓨鐩樼偣淇℃伅
- locationProductAmountAPI.POST("list", locationProductAmountController.List) //鏌ョ湅搴撳瓨鐩樼偣鍒楄〃
+ locationProductAmountAPI.POST("add", locationProductAmountController.Add) //娣诲姞搴撳瓨鐩樼偣淇℃伅
+ locationProductAmountAPI.POST("list", locationProductAmountController.List) //鏌ョ湅搴撳瓨鐩樼偣鍒楄〃
+ locationProductAmountAPI.POST("update", locationProductAmountController.Update) //淇敼搴撳瓨鐩樼偣淇℃伅
}
//鎶ヨ〃
--
Gitblit v1.8.0