From 93c71a94d77ffe1f36654decc0bada0a2ac27c88 Mon Sep 17 00:00:00 2001 From: yinbentan <yinbentan@live.com> Date: 星期二, 16 七月 2024 20:14:10 +0800 Subject: [PATCH] 添加方法,获取庄口列表 --- models/silk_dict.go | 289 +++++++++++ docs/swagger.yaml | 290 ++++++++++ controllers/dict_controller.go | 75 ++ docs/docs.go | 390 +++++++++++++++ docs/swagger.json | 390 +++++++++++++++ router/router.go | 12 6 files changed, 1,397 insertions(+), 49 deletions(-) diff --git a/controllers/dict_controller.go b/controllers/dict_controller.go index 7366885..a9c1a8e 100644 --- a/controllers/dict_controller.go +++ b/controllers/dict_controller.go @@ -1,6 +1,8 @@ package controllers import ( + "context" + "errors" "github.com/gin-gonic/gin" "gorm.io/gorm" "strconv" @@ -8,6 +10,8 @@ "wms/extend/util" "wms/models" "wms/pkg/logx" + "wms/proto/init_client" + "wms/proto/user" "wms/request" ) @@ -35,6 +39,12 @@ if len(params.Name) == 0 { util.ResponseFormat(c, code.RequestParamError, "鍚嶇О涓虹┖") + return + } + + _, err := models.NewMiniDictSearch().SetType(params.Type).SetName(params.Name).First() + if !errors.Is(err, gorm.ErrRecordNotFound) { + util.ResponseFormat(c, code.NameExistedError, "鍚嶇О宸插瓨鍦�") return } @@ -181,7 +191,7 @@ // @Tags 鏁版嵁瀛楀吀 // @Summary 鑾峰彇瀛楀吀淇℃伅鍒楄〃 // @Produce application/json -// @Param object body request.GetMiniDictList true "鍙傛暟" +// @Param object body request.GetMiniDictList true "鍙傛暟" // @Success 200 {object} util.ResponseList{data=[]models.MiniDict} "鎴愬姛" // @Router /api-wms/v1/dict/getDictList [post] func (slf DictController) GetMiniDictList(c *gin.Context) { @@ -208,3 +218,66 @@ util.ResponseFormatList(c, code.Success, list, int(total)) } + +// GetSilkDictList +// +// @Tags 鏁版嵁瀛楀吀 +// @Summary 鑾峰彇搴勫彛鍒楄〃 +// @Produce application/json +// @Param Authorization header string true "token" +// @Param type path string true "瀛楀吀绫诲瀷" +// @Success 200 {object} util.ResponseList{data=[]models.SilkDict} "鎴愬姛" +// @Router /api-wms/v1/dict/getSilkDictList/{type} [get] +func (slf DictController) GetSilkDictList(c *gin.Context) { + + dictType, err := strconv.Atoi(c.Param("type")) + if err != nil { + util.ResponseFormat(c, code.RequestParamError, "璇蜂紶鍏ユ纭殑瀛楀吀绫诲瀷") + return + } + + list, err := models.NewSilkDictSearch().SetDictType(models.SilkDictType(dictType)).FindAll() + if err != nil { + util.ResponseFormat(c, code.RequestParamError, "鏌ユ壘澶辫触") + return + } + util.ResponseFormat(c, code.Success, list) +} + +// GetUserList +// @Tags 鏁版嵁瀛楀吀 +// @Summary 鑾峰彇鐢ㄦ埛鍒楄〃 +// @Produce application/json +// @Param object query user.GetUserRequest true "鍙傛暟" +// @Success 200 {object} util.ResponseList{data=[]user.GetUserRequest} "鎴愬姛" +// @Router /api-wms/v1/dict/getUserList [get] +func (slf DictController) GetUserList(c *gin.Context) { + if init_client.AdminConn == nil { + util.ResponseFormat(c, code.InternalError, "璇峰厛閰嶇疆Admin鐨刧rpc鏈嶅姟淇℃伅") + } + query := new(user.GetUserRequest) + if c.Query("id") != "" { + query.Id = c.Query("id") + } + if c.Query("userName") != "" { + query.UserName = c.Query("userName") + } + if c.Query("nickName") != "" { + query.NickName = c.Query("nickName") + } + if c.Query("parentId") != "" { + query.ParentId = c.Query("parentId") + } + if userType, err := strconv.Atoi(c.Query("userType")); err == nil && userType > 0 { + query.UserType = int32(userType) + } + + cli := user.NewUserServiceClient(init_client.AdminConn) + list, err := cli.GetUserList(context.Background(), query) + if err != nil { + util.ResponseFormat(c, code.InternalError, "鍐呴儴閿欒") + logx.Error("grpc璋冪敤澶辫触, GetPersonnelList err : " + err.Error()) + return + } + util.ResponseFormat(c, code.Success, list.List) +} diff --git a/docs/docs.go b/docs/docs.go index aee23f5..1e95ad9 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -691,6 +691,122 @@ } } }, + "/api-wms/v1/dict/getSilkDictList/{type}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鏁版嵁瀛楀吀" + ], + "summary": "鑾峰彇搴勫彛鍒楄〃", + "parameters": [ + { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "瀛楀吀绫诲瀷", + "name": "type", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/util.ResponseList" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/models.SilkDict" + } + } + } + } + ] + } + } + } + } + }, + "/api-wms/v1/dict/getUserList": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鏁版嵁瀛楀吀" + ], + "summary": "鑾峰彇鐢ㄦ埛鍒楄〃", + "parameters": [ + { + "type": "string", + "name": "id", + "in": "query" + }, + { + "type": "string", + "name": "nickName", + "in": "query" + }, + { + "type": "string", + "name": "parentId", + "in": "query" + }, + { + "type": "string", + "name": "pos", + "in": "query" + }, + { + "type": "string", + "name": "userName", + "in": "query" + }, + { + "type": "integer", + "name": "userType", + "in": "query" + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/util.ResponseList" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/user.GetUserRequest" + } + } + } + } + ] + } + } + } + } + }, "/api-wms/v1/dict/save": { "post": { "produces": [ @@ -1681,6 +1797,13 @@ "summary": "娣诲姞搴撳瓨鐩樼偣淇℃伅", "parameters": [ { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, + { "description": "鍏ュ簱/鍑哄簱淇℃伅", "name": "object", "in": "body", @@ -1710,6 +1833,13 @@ ], "summary": "搴旂敤銆侀獙璇�", "parameters": [ + { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, { "description": "鍏ュ弬", "name": "object", @@ -1895,6 +2025,13 @@ "summary": "淇敼搴撳瓨鐩樼偣淇℃伅", "parameters": [ { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, + { "description": "鍏ュ簱/鍑哄簱淇℃伅", "name": "object", "in": "body", @@ -1952,6 +2089,13 @@ ], "summary": "鏇存敼璁板綍鐘舵��", "parameters": [ + { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, { "type": "integer", "description": "id", @@ -2119,6 +2263,13 @@ "summary": "鍏ュ簱/鍑哄簱鍒楄〃", "parameters": [ { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, + { "description": "鏌ヨ鍙傛暟", "name": "object", "in": "body", @@ -2224,6 +2375,13 @@ "summary": "娣诲姞鍏ュ簱/鍑哄簱", "parameters": [ { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, + { "description": "鍏ュ簱/鍑哄簱淇℃伅", "name": "object", "in": "body", @@ -2253,6 +2411,13 @@ ], "summary": "鍒犻櫎鍏ュ簱/鍑哄簱淇℃伅", "parameters": [ + { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, { "type": "integer", "description": "id", @@ -4658,6 +4823,7 @@ "type": "string" }, "warehouseId": { + "description": "浠撳簱id", "type": "integer" } } @@ -5186,12 +5352,15 @@ "type": "object", "properties": { "accountant": { + "description": "浼氳鍚嶇О", "type": "string" }, "accountantId": { + "description": "浼氳id", "type": "string" }, "auditDate": { + "description": "瀹℃壒鏃堕棿", "type": "string" }, "baseOperationType": { @@ -5203,39 +5372,50 @@ ] }, "checkedBy": { + "description": "楠岃瘉鑰匲serId", "type": "string" }, "comment": { + "description": "澶囨敞", "type": "string" }, "companyID": { + "description": "鍏徃ID-瀹㈡埛", "type": "string" }, "companyName": { + "description": "鍏徃鍚嶇О-瀹㈡埛", "type": "string" }, "contacterID": { + "description": "鑱旂郴浜篒D", "type": "integer" }, "contacterName": { + "description": "鑱旂郴浜哄鍚�", "type": "string" }, "createBy": { + "description": "鍒涘缓鑰匲serId", "type": "string" }, "createTime": { "type": "string" }, "custodian": { + "description": "淇濈鍛樺悕绉�", "type": "string" }, "custodianId": { + "description": "淇濈鍛榠d", "type": "string" }, "dealerType": { + "description": "璋冩嫧鍑哄叆搴撶被鍨�", "type": "string" }, "details": { + "description": "鎿嶄綔鏄庣粏", "type": "array", "items": { "$ref": "#/definitions/models.OperationDetails" @@ -5261,9 +5441,15 @@ "type": "integer" }, "logisticCompany": { - "$ref": "#/definitions/models.LogisticCompany" + "description": "鐗╂祦鍏徃淇℃伅", + "allOf": [ + { + "$ref": "#/definitions/models.LogisticCompany" + } + ] }, "logisticCompanyId": { + "description": "鐗╂祦鍏徃id", "type": "string" }, "logisticWeight": { @@ -5271,9 +5457,11 @@ "type": "number" }, "manager": { + "description": "涓荤鍚嶇О", "type": "string" }, "managerId": { + "description": "涓荤id", "type": "string" }, "number": { @@ -5281,6 +5469,7 @@ "type": "string" }, "operationDate": { + "description": "瀹夋帓鏃ユ湡", "type": "string" }, "operationSource": { @@ -5300,21 +5489,31 @@ "type": "string" }, "receiverAddr": { + "description": "鏀惰揣鍦板潃", "type": "string" }, "receiverName": { + "description": "鏀惰揣浜哄鍚�", "type": "string" }, "receiverPhone": { + "description": "鑱旂郴鐢佃瘽", "type": "string" }, "remark": { + "description": "澶囨敞", "type": "string" }, "salesDetailsNumber": { + "description": "閿�鍞槑缁嗙紪鐮�", + "type": "string" + }, + "silkMarket": { + "description": "鍢夎仈浠撳偍娣诲姞 SilkMarket", "type": "string" }, "source": { + "description": "鏉ユ簮绯荤粺", "type": "string" }, "sourceNumber": { @@ -5345,9 +5544,15 @@ "type": "string" }, "warehouse": { - "$ref": "#/definitions/models.Warehouse" + "description": "浠撳簱淇℃伅", + "allOf": [ + { + "$ref": "#/definitions/models.Warehouse" + } + ] }, "warehouseId": { + "description": "浠撳簱id", "type": "integer" }, "waybillNumber": { @@ -5368,9 +5573,11 @@ "type": "number" }, "auxiliaryAmount": { + "description": "杈呭姪鏁伴噺", "type": "number" }, "auxiliaryUnit": { + "description": "杈呭姪鍗曚綅", "type": "string" }, "baseOperationType": { @@ -5412,7 +5619,7 @@ "type": "boolean" }, "operationId": { - "description": "鎿嶄綔id", + "description": "鎿嶄綔璁板綍id", "type": "integer" }, "product": { @@ -5428,11 +5635,20 @@ "type": "string" }, "remark": { + "description": "澶囨敞", "type": "string" }, "salePrice": { "description": "閿�鍞崟浠�", "type": "number" + }, + "silkMarket": { + "description": "鍢夎仈浠撳偍娣诲姞 SilkMarket銆丼ilkMarketClose", + "type": "string" + }, + "silkMarketClose": { + "description": "搴勫彛鍏抽棴", + "type": "string" }, "stockAmount": { "description": "搴撳瓨鏁伴噺锛岀洏鐐规椂鐢�", @@ -5451,9 +5667,11 @@ "type": "integer" }, "totalGrossWeight": { + "description": "鎬绘瘺閲�", "type": "number" }, "totalNetWeight": { + "description": "鎬诲噣閲�", "type": "number" }, "updateTime": { @@ -5574,6 +5792,64 @@ "type": "string" } } + }, + "models.SilkDict": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "deletedAt": { + "$ref": "#/definitions/gorm.DeletedAt" + }, + "dictType": { + "description": "瀛楀吀绫诲瀷", + "allOf": [ + { + "$ref": "#/definitions/models.SilkDictType" + } + ] + }, + "id": { + "type": "integer" + }, + "name": { + "description": "鍚嶇О", + "type": "string" + }, + "number": { + "description": "缂栧彿", + "type": "string" + }, + "remark": { + "description": "澶囨敞", + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "models.SilkDictType": { + "type": "integer", + "enum": [ + 1, + 2, + 3, + 4 + ], + "x-enum-comments": { + "DictTypeColor": "棰滆壊", + "DictTypeMarket": "搴勫彛", + "DictTypeSpec": "瑙勬牸", + "DictTypeWorkshop": "杞﹂棿" + }, + "x-enum-varnames": [ + "DictTypeMarket", + "DictTypeWorkshop", + "DictTypeColor", + "DictTypeSpec" + ] }, "models.SystemConfig": { "type": "object", @@ -5963,13 +6239,15 @@ "type": "object", "properties": { "accountant": { + "description": "浼氳鍚嶇О", "type": "string" }, "accountantId": { + "description": "浼氳id", "type": "string" }, "baseOperationType": { - "description": "鍩虹浣滀笟绫诲瀷 5搴撳瓨鐩樼偣", + "description": "鍩虹浣滀笟绫诲瀷 1 鍏ュ簱 2 鍑哄簱 3 鍐呴儴璋冩嫧 4 鎶ュ簾 5 搴撳瓨鐩樼偣", "allOf": [ { "$ref": "#/definitions/constvar.BaseOperationType" @@ -5997,15 +6275,19 @@ "type": "string" }, "custodian": { + "description": "淇濈鍛樺悕绉�", "type": "string" }, "custodianId": { + "description": "淇濈鍛榠d", "type": "string" }, "dealerType": { + "description": "璋冩嫧鍑哄叆搴撶被鍨�", "type": "string" }, "details": { + "description": "璇︽儏", "type": "array", "items": { "$ref": "#/definitions/request.OperationDetails" @@ -6019,6 +6301,7 @@ "type": "integer" }, "logisticCompanyId": { + "description": "鐗╂祦鍏徃id", "type": "string" }, "logisticWeight": { @@ -6026,9 +6309,11 @@ "type": "number" }, "manager": { + "description": "涓荤鍚嶇О", "type": "string" }, "managerId": { + "description": "涓荤id", "type": "string" }, "number": { @@ -6036,7 +6321,7 @@ "type": "string" }, "operationDate": { - "description": "FromLocationId int ` + "`" + `json:\"fromLocationId\" gorm:\"type:int;not null;comment:婧愪綅缃甶d\"` + "`" + ` //婧愪綅缃甶d\nToLocationId int ` + "`" + `json:\"toLocationId\" gorm:\"type:int;not null;comment:鐩爣浣嶇疆id\"` + "`" + ` //鐩爣浣嶇疆id", + "description": "FromLocationId int ` + "`" + `json:\"fromLocationId\" ` + "`" + ` //婧愪綅缃甶d\nToLocationId int ` + "`" + `json:\"toLocationId\" ` + "`" + ` //鐩爣浣嶇疆id", "type": "string" }, "operationTypeId": { @@ -6048,12 +6333,19 @@ "type": "string" }, "receiverAddr": { + "description": "鏀惰揣鍦板潃", "type": "string" }, "receiverName": { + "description": "鏀惰揣浜哄鍚�", "type": "string" }, "receiverPhone": { + "description": "鑱旂郴鐢佃瘽", + "type": "string" + }, + "silkMarket": { + "description": "搴勫彛", "type": "string" }, "sourceNumber": { @@ -6333,9 +6625,9 @@ "description": "姣忛〉澶у皬", "type": "integer" }, - "warehouseCode": { - "description": "浠撳簱缂╁啓", - "type": "string" + "warehouseId": { + "description": "WarehouseCode string ` + "`" + `json:\"warehouseCode\"` + "`" + ` //浠撳簱缂╁啓", + "type": "integer" } } }, @@ -6372,6 +6664,13 @@ }, "unit": { "description": "鍗曚綅", + "type": "string" + }, + "warehouseCode": { + "type": "string" + }, + "warehouseId": { + "description": "浠撳簱ID", "type": "string" } } @@ -6593,6 +6892,7 @@ "type": "object", "properties": { "number": { + "description": "鍗曞彿", "type": "string" }, "page": { @@ -6604,6 +6904,7 @@ "type": "integer" }, "sourceNumber": { + "description": "婧愬崟鍙�", "type": "string" } } @@ -6612,6 +6913,7 @@ "type": "object", "properties": { "condition": { + "description": "妯$硦鏌ヨ鏉′欢", "type": "string" }, "keyword": { @@ -6644,7 +6946,7 @@ "type": "integer" }, "amount": { - "description": "ProductName string ` + "`" + `json:\"productName\" gorm:\"type:varchar(255);not null;comment:浜у搧鍚嶇О\"` + "`" + ` //浜у搧鍚嶇О", + "description": "ProductName string ` + "`" + `json:\"productName\" ` + "`" + ` //浜у搧鍚嶇О", "type": "number" }, "auxiliaryAmount": { @@ -6660,7 +6962,7 @@ "type": "number" }, "fromLocationId": { - "description": "Unit string ` + "`" + `json:\"unit\" gorm:\"type:varchar(31);comment:鍗曚綅\"` + "`" + ` //鍗曚綅\nProduct models.Material ` + "`" + `json:\"product\" gorm:\"foreignKey:ProductId;references:ID\"` + "`" + `", + "description": "Unit string ` + "`" + `json:\"unit\"` + "`" + ` //鍗曚綅\nProduct models.Material ` + "`" + `json:\"product\" ` + "`" + ` // 浜у搧", "type": "integer" }, "productId": { @@ -6668,11 +6970,20 @@ "type": "string" }, "remark": { + "description": "澶囨敞", "type": "string" }, "salePrice": { "description": "閿�鍞崟浠�", "type": "number" + }, + "silkMarket": { + "description": "搴勫彛", + "type": "string" + }, + "silkMarketClose": { + "description": "搴勫彛鍏抽棴", + "type": "string" }, "stockAmount": { "description": "搴撳瓨鏁伴噺锛岀洏鐐规椂鐢�", @@ -6696,7 +7007,7 @@ "type": "object", "properties": { "baseOperationType": { - "description": "1 鍏ュ簱 2 鍑哄簱 3 鍐呴儴璋冩嫧 4 鎶ュ簾 5 搴撳瓨鐩樼偣", + "description": "鍩虹浣滀笟绫诲瀷 1 鍏ュ簱 2 鍑哄簱 3 鍐呴儴璋冩嫧 4 鎶ュ簾 5 搴撳瓨鐩樼偣", "allOf": [ { "$ref": "#/definitions/constvar.BaseOperationType" @@ -6704,9 +7015,11 @@ ] }, "number": { + "description": "鍗曞彿", "type": "string" }, "operationTypeId": { + "description": "浣滀笟绫诲瀷id", "type": "integer" }, "page": { @@ -6718,7 +7031,12 @@ "type": "integer" }, "status": { - "$ref": "#/definitions/constvar.OperationStatus" + "description": "鐘舵��", + "allOf": [ + { + "$ref": "#/definitions/constvar.OperationStatus" + } + ] } } }, @@ -7034,9 +7352,11 @@ "type": "object", "properties": { "accountant": { + "description": "浼氳鍚嶇О", "type": "string" }, "accountantId": { + "description": "浼氳id", "type": "string" }, "baseOperationType": { @@ -7068,12 +7388,15 @@ "type": "string" }, "custodian": { + "description": "淇濈鍛樺悕绉�", "type": "string" }, "custodianId": { + "description": "淇濈鍛榠d", "type": "string" }, "details": { + "description": "璇︽儏", "type": "array", "items": { "$ref": "#/definitions/request.OperationDetails" @@ -7083,6 +7406,7 @@ "type": "integer" }, "inventoryDealerType": { + "description": "璋冩嫧鍑哄叆搴撳垎绫�(瀵瑰簲dict瀛楀吀琛ㄧ殑ID)", "type": "integer" }, "locationId": { @@ -7097,9 +7421,11 @@ "type": "number" }, "manager": { + "description": "涓荤鍚嶇О", "type": "string" }, "managerId": { + "description": "涓荤id", "type": "string" }, "number": { @@ -7107,7 +7433,7 @@ "type": "string" }, "operationDate": { - "description": "FromLocationId int ` + "`" + `json:\"fromLocationId\" gorm:\"type:int;not null;comment:婧愪綅缃甶d\"` + "`" + ` //婧愪綅缃甶d\nToLocationId int ` + "`" + `json:\"toLocationId\" gorm:\"type:int;not null;comment:鐩爣浣嶇疆id\"` + "`" + ` //鐩爣浣嶇疆id", + "description": "FromLocationId int ` + "`" + `json:\"fromLocationId\" ` + "`" + ` //婧愪綅缃甶d\nToLocationId int ` + "`" + `json:\"toLocationId\" ` + "`" + ` //鐩爣浣嶇疆id", "type": "string" }, "operationTypeId": { @@ -7119,12 +7445,19 @@ "type": "string" }, "receiverAddr": { + "description": "鏀惰揣鍦板潃", "type": "string" }, "receiverName": { + "description": "鏀惰揣浜哄鍚�", "type": "string" }, "receiverPhone": { + "description": "鑱旂郴鐢佃瘽", + "type": "string" + }, + "silkMarket": { + "description": "搴勫彛", "type": "string" }, "sourceNumber": { @@ -7288,8 +7621,16 @@ "description": "浜у搧id", "type": "string" }, + "productCategory": { + "description": "浜у搧绫诲埆", + "type": "string" + }, "productName": { "description": "浜у搧鍚嶇О", + "type": "string" + }, + "productSpecs": { + "description": "浜у搧瑙勬牸", "type": "string" }, "productType": { @@ -7369,6 +7710,29 @@ } } }, + "user.GetUserRequest": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "nickName": { + "type": "string" + }, + "parentId": { + "type": "string" + }, + "pos": { + "type": "string" + }, + "userName": { + "type": "string" + }, + "userType": { + "type": "integer" + } + } + }, "util.Response": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 76cdd10..6b791a6 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -680,6 +680,122 @@ } } }, + "/api-wms/v1/dict/getSilkDictList/{type}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鏁版嵁瀛楀吀" + ], + "summary": "鑾峰彇搴勫彛鍒楄〃", + "parameters": [ + { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "瀛楀吀绫诲瀷", + "name": "type", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/util.ResponseList" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/models.SilkDict" + } + } + } + } + ] + } + } + } + } + }, + "/api-wms/v1/dict/getUserList": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鏁版嵁瀛楀吀" + ], + "summary": "鑾峰彇鐢ㄦ埛鍒楄〃", + "parameters": [ + { + "type": "string", + "name": "id", + "in": "query" + }, + { + "type": "string", + "name": "nickName", + "in": "query" + }, + { + "type": "string", + "name": "parentId", + "in": "query" + }, + { + "type": "string", + "name": "pos", + "in": "query" + }, + { + "type": "string", + "name": "userName", + "in": "query" + }, + { + "type": "integer", + "name": "userType", + "in": "query" + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/util.ResponseList" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/user.GetUserRequest" + } + } + } + } + ] + } + } + } + } + }, "/api-wms/v1/dict/save": { "post": { "produces": [ @@ -1670,6 +1786,13 @@ "summary": "娣诲姞搴撳瓨鐩樼偣淇℃伅", "parameters": [ { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, + { "description": "鍏ュ簱/鍑哄簱淇℃伅", "name": "object", "in": "body", @@ -1699,6 +1822,13 @@ ], "summary": "搴旂敤銆侀獙璇�", "parameters": [ + { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, { "description": "鍏ュ弬", "name": "object", @@ -1884,6 +2014,13 @@ "summary": "淇敼搴撳瓨鐩樼偣淇℃伅", "parameters": [ { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, + { "description": "鍏ュ簱/鍑哄簱淇℃伅", "name": "object", "in": "body", @@ -1941,6 +2078,13 @@ ], "summary": "鏇存敼璁板綍鐘舵��", "parameters": [ + { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, { "type": "integer", "description": "id", @@ -2108,6 +2252,13 @@ "summary": "鍏ュ簱/鍑哄簱鍒楄〃", "parameters": [ { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, + { "description": "鏌ヨ鍙傛暟", "name": "object", "in": "body", @@ -2213,6 +2364,13 @@ "summary": "娣诲姞鍏ュ簱/鍑哄簱", "parameters": [ { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, + { "description": "鍏ュ簱/鍑哄簱淇℃伅", "name": "object", "in": "body", @@ -2242,6 +2400,13 @@ ], "summary": "鍒犻櫎鍏ュ簱/鍑哄簱淇℃伅", "parameters": [ + { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + }, { "type": "integer", "description": "id", @@ -4647,6 +4812,7 @@ "type": "string" }, "warehouseId": { + "description": "浠撳簱id", "type": "integer" } } @@ -5175,12 +5341,15 @@ "type": "object", "properties": { "accountant": { + "description": "浼氳鍚嶇О", "type": "string" }, "accountantId": { + "description": "浼氳id", "type": "string" }, "auditDate": { + "description": "瀹℃壒鏃堕棿", "type": "string" }, "baseOperationType": { @@ -5192,39 +5361,50 @@ ] }, "checkedBy": { + "description": "楠岃瘉鑰匲serId", "type": "string" }, "comment": { + "description": "澶囨敞", "type": "string" }, "companyID": { + "description": "鍏徃ID-瀹㈡埛", "type": "string" }, "companyName": { + "description": "鍏徃鍚嶇О-瀹㈡埛", "type": "string" }, "contacterID": { + "description": "鑱旂郴浜篒D", "type": "integer" }, "contacterName": { + "description": "鑱旂郴浜哄鍚�", "type": "string" }, "createBy": { + "description": "鍒涘缓鑰匲serId", "type": "string" }, "createTime": { "type": "string" }, "custodian": { + "description": "淇濈鍛樺悕绉�", "type": "string" }, "custodianId": { + "description": "淇濈鍛榠d", "type": "string" }, "dealerType": { + "description": "璋冩嫧鍑哄叆搴撶被鍨�", "type": "string" }, "details": { + "description": "鎿嶄綔鏄庣粏", "type": "array", "items": { "$ref": "#/definitions/models.OperationDetails" @@ -5250,9 +5430,15 @@ "type": "integer" }, "logisticCompany": { - "$ref": "#/definitions/models.LogisticCompany" + "description": "鐗╂祦鍏徃淇℃伅", + "allOf": [ + { + "$ref": "#/definitions/models.LogisticCompany" + } + ] }, "logisticCompanyId": { + "description": "鐗╂祦鍏徃id", "type": "string" }, "logisticWeight": { @@ -5260,9 +5446,11 @@ "type": "number" }, "manager": { + "description": "涓荤鍚嶇О", "type": "string" }, "managerId": { + "description": "涓荤id", "type": "string" }, "number": { @@ -5270,6 +5458,7 @@ "type": "string" }, "operationDate": { + "description": "瀹夋帓鏃ユ湡", "type": "string" }, "operationSource": { @@ -5289,21 +5478,31 @@ "type": "string" }, "receiverAddr": { + "description": "鏀惰揣鍦板潃", "type": "string" }, "receiverName": { + "description": "鏀惰揣浜哄鍚�", "type": "string" }, "receiverPhone": { + "description": "鑱旂郴鐢佃瘽", "type": "string" }, "remark": { + "description": "澶囨敞", "type": "string" }, "salesDetailsNumber": { + "description": "閿�鍞槑缁嗙紪鐮�", + "type": "string" + }, + "silkMarket": { + "description": "鍢夎仈浠撳偍娣诲姞 SilkMarket", "type": "string" }, "source": { + "description": "鏉ユ簮绯荤粺", "type": "string" }, "sourceNumber": { @@ -5334,9 +5533,15 @@ "type": "string" }, "warehouse": { - "$ref": "#/definitions/models.Warehouse" + "description": "浠撳簱淇℃伅", + "allOf": [ + { + "$ref": "#/definitions/models.Warehouse" + } + ] }, "warehouseId": { + "description": "浠撳簱id", "type": "integer" }, "waybillNumber": { @@ -5357,9 +5562,11 @@ "type": "number" }, "auxiliaryAmount": { + "description": "杈呭姪鏁伴噺", "type": "number" }, "auxiliaryUnit": { + "description": "杈呭姪鍗曚綅", "type": "string" }, "baseOperationType": { @@ -5401,7 +5608,7 @@ "type": "boolean" }, "operationId": { - "description": "鎿嶄綔id", + "description": "鎿嶄綔璁板綍id", "type": "integer" }, "product": { @@ -5417,11 +5624,20 @@ "type": "string" }, "remark": { + "description": "澶囨敞", "type": "string" }, "salePrice": { "description": "閿�鍞崟浠�", "type": "number" + }, + "silkMarket": { + "description": "鍢夎仈浠撳偍娣诲姞 SilkMarket銆丼ilkMarketClose", + "type": "string" + }, + "silkMarketClose": { + "description": "搴勫彛鍏抽棴", + "type": "string" }, "stockAmount": { "description": "搴撳瓨鏁伴噺锛岀洏鐐规椂鐢�", @@ -5440,9 +5656,11 @@ "type": "integer" }, "totalGrossWeight": { + "description": "鎬绘瘺閲�", "type": "number" }, "totalNetWeight": { + "description": "鎬诲噣閲�", "type": "number" }, "updateTime": { @@ -5563,6 +5781,64 @@ "type": "string" } } + }, + "models.SilkDict": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "deletedAt": { + "$ref": "#/definitions/gorm.DeletedAt" + }, + "dictType": { + "description": "瀛楀吀绫诲瀷", + "allOf": [ + { + "$ref": "#/definitions/models.SilkDictType" + } + ] + }, + "id": { + "type": "integer" + }, + "name": { + "description": "鍚嶇О", + "type": "string" + }, + "number": { + "description": "缂栧彿", + "type": "string" + }, + "remark": { + "description": "澶囨敞", + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "models.SilkDictType": { + "type": "integer", + "enum": [ + 1, + 2, + 3, + 4 + ], + "x-enum-comments": { + "DictTypeColor": "棰滆壊", + "DictTypeMarket": "搴勫彛", + "DictTypeSpec": "瑙勬牸", + "DictTypeWorkshop": "杞﹂棿" + }, + "x-enum-varnames": [ + "DictTypeMarket", + "DictTypeWorkshop", + "DictTypeColor", + "DictTypeSpec" + ] }, "models.SystemConfig": { "type": "object", @@ -5952,13 +6228,15 @@ "type": "object", "properties": { "accountant": { + "description": "浼氳鍚嶇О", "type": "string" }, "accountantId": { + "description": "浼氳id", "type": "string" }, "baseOperationType": { - "description": "鍩虹浣滀笟绫诲瀷 5搴撳瓨鐩樼偣", + "description": "鍩虹浣滀笟绫诲瀷 1 鍏ュ簱 2 鍑哄簱 3 鍐呴儴璋冩嫧 4 鎶ュ簾 5 搴撳瓨鐩樼偣", "allOf": [ { "$ref": "#/definitions/constvar.BaseOperationType" @@ -5986,15 +6264,19 @@ "type": "string" }, "custodian": { + "description": "淇濈鍛樺悕绉�", "type": "string" }, "custodianId": { + "description": "淇濈鍛榠d", "type": "string" }, "dealerType": { + "description": "璋冩嫧鍑哄叆搴撶被鍨�", "type": "string" }, "details": { + "description": "璇︽儏", "type": "array", "items": { "$ref": "#/definitions/request.OperationDetails" @@ -6008,6 +6290,7 @@ "type": "integer" }, "logisticCompanyId": { + "description": "鐗╂祦鍏徃id", "type": "string" }, "logisticWeight": { @@ -6015,9 +6298,11 @@ "type": "number" }, "manager": { + "description": "涓荤鍚嶇О", "type": "string" }, "managerId": { + "description": "涓荤id", "type": "string" }, "number": { @@ -6025,7 +6310,7 @@ "type": "string" }, "operationDate": { - "description": "FromLocationId int `json:\"fromLocationId\" gorm:\"type:int;not null;comment:婧愪綅缃甶d\"` //婧愪綅缃甶d\nToLocationId int `json:\"toLocationId\" gorm:\"type:int;not null;comment:鐩爣浣嶇疆id\"` //鐩爣浣嶇疆id", + "description": "FromLocationId int `json:\"fromLocationId\" ` //婧愪綅缃甶d\nToLocationId int `json:\"toLocationId\" ` //鐩爣浣嶇疆id", "type": "string" }, "operationTypeId": { @@ -6037,12 +6322,19 @@ "type": "string" }, "receiverAddr": { + "description": "鏀惰揣鍦板潃", "type": "string" }, "receiverName": { + "description": "鏀惰揣浜哄鍚�", "type": "string" }, "receiverPhone": { + "description": "鑱旂郴鐢佃瘽", + "type": "string" + }, + "silkMarket": { + "description": "搴勫彛", "type": "string" }, "sourceNumber": { @@ -6322,9 +6614,9 @@ "description": "姣忛〉澶у皬", "type": "integer" }, - "warehouseCode": { - "description": "浠撳簱缂╁啓", - "type": "string" + "warehouseId": { + "description": "WarehouseCode string `json:\"warehouseCode\"` //浠撳簱缂╁啓", + "type": "integer" } } }, @@ -6361,6 +6653,13 @@ }, "unit": { "description": "鍗曚綅", + "type": "string" + }, + "warehouseCode": { + "type": "string" + }, + "warehouseId": { + "description": "浠撳簱ID", "type": "string" } } @@ -6582,6 +6881,7 @@ "type": "object", "properties": { "number": { + "description": "鍗曞彿", "type": "string" }, "page": { @@ -6593,6 +6893,7 @@ "type": "integer" }, "sourceNumber": { + "description": "婧愬崟鍙�", "type": "string" } } @@ -6601,6 +6902,7 @@ "type": "object", "properties": { "condition": { + "description": "妯$硦鏌ヨ鏉′欢", "type": "string" }, "keyword": { @@ -6633,7 +6935,7 @@ "type": "integer" }, "amount": { - "description": "ProductName string `json:\"productName\" gorm:\"type:varchar(255);not null;comment:浜у搧鍚嶇О\"` //浜у搧鍚嶇О", + "description": "ProductName string `json:\"productName\" ` //浜у搧鍚嶇О", "type": "number" }, "auxiliaryAmount": { @@ -6649,7 +6951,7 @@ "type": "number" }, "fromLocationId": { - "description": "Unit string `json:\"unit\" gorm:\"type:varchar(31);comment:鍗曚綅\"` //鍗曚綅\nProduct models.Material `json:\"product\" gorm:\"foreignKey:ProductId;references:ID\"`", + "description": "Unit string `json:\"unit\"` //鍗曚綅\nProduct models.Material `json:\"product\" ` // 浜у搧", "type": "integer" }, "productId": { @@ -6657,11 +6959,20 @@ "type": "string" }, "remark": { + "description": "澶囨敞", "type": "string" }, "salePrice": { "description": "閿�鍞崟浠�", "type": "number" + }, + "silkMarket": { + "description": "搴勫彛", + "type": "string" + }, + "silkMarketClose": { + "description": "搴勫彛鍏抽棴", + "type": "string" }, "stockAmount": { "description": "搴撳瓨鏁伴噺锛岀洏鐐规椂鐢�", @@ -6685,7 +6996,7 @@ "type": "object", "properties": { "baseOperationType": { - "description": "1 鍏ュ簱 2 鍑哄簱 3 鍐呴儴璋冩嫧 4 鎶ュ簾 5 搴撳瓨鐩樼偣", + "description": "鍩虹浣滀笟绫诲瀷 1 鍏ュ簱 2 鍑哄簱 3 鍐呴儴璋冩嫧 4 鎶ュ簾 5 搴撳瓨鐩樼偣", "allOf": [ { "$ref": "#/definitions/constvar.BaseOperationType" @@ -6693,9 +7004,11 @@ ] }, "number": { + "description": "鍗曞彿", "type": "string" }, "operationTypeId": { + "description": "浣滀笟绫诲瀷id", "type": "integer" }, "page": { @@ -6707,7 +7020,12 @@ "type": "integer" }, "status": { - "$ref": "#/definitions/constvar.OperationStatus" + "description": "鐘舵��", + "allOf": [ + { + "$ref": "#/definitions/constvar.OperationStatus" + } + ] } } }, @@ -7023,9 +7341,11 @@ "type": "object", "properties": { "accountant": { + "description": "浼氳鍚嶇О", "type": "string" }, "accountantId": { + "description": "浼氳id", "type": "string" }, "baseOperationType": { @@ -7057,12 +7377,15 @@ "type": "string" }, "custodian": { + "description": "淇濈鍛樺悕绉�", "type": "string" }, "custodianId": { + "description": "淇濈鍛榠d", "type": "string" }, "details": { + "description": "璇︽儏", "type": "array", "items": { "$ref": "#/definitions/request.OperationDetails" @@ -7072,6 +7395,7 @@ "type": "integer" }, "inventoryDealerType": { + "description": "璋冩嫧鍑哄叆搴撳垎绫�(瀵瑰簲dict瀛楀吀琛ㄧ殑ID)", "type": "integer" }, "locationId": { @@ -7086,9 +7410,11 @@ "type": "number" }, "manager": { + "description": "涓荤鍚嶇О", "type": "string" }, "managerId": { + "description": "涓荤id", "type": "string" }, "number": { @@ -7096,7 +7422,7 @@ "type": "string" }, "operationDate": { - "description": "FromLocationId int `json:\"fromLocationId\" gorm:\"type:int;not null;comment:婧愪綅缃甶d\"` //婧愪綅缃甶d\nToLocationId int `json:\"toLocationId\" gorm:\"type:int;not null;comment:鐩爣浣嶇疆id\"` //鐩爣浣嶇疆id", + "description": "FromLocationId int `json:\"fromLocationId\" ` //婧愪綅缃甶d\nToLocationId int `json:\"toLocationId\" ` //鐩爣浣嶇疆id", "type": "string" }, "operationTypeId": { @@ -7108,12 +7434,19 @@ "type": "string" }, "receiverAddr": { + "description": "鏀惰揣鍦板潃", "type": "string" }, "receiverName": { + "description": "鏀惰揣浜哄鍚�", "type": "string" }, "receiverPhone": { + "description": "鑱旂郴鐢佃瘽", + "type": "string" + }, + "silkMarket": { + "description": "搴勫彛", "type": "string" }, "sourceNumber": { @@ -7277,8 +7610,16 @@ "description": "浜у搧id", "type": "string" }, + "productCategory": { + "description": "浜у搧绫诲埆", + "type": "string" + }, "productName": { "description": "浜у搧鍚嶇О", + "type": "string" + }, + "productSpecs": { + "description": "浜у搧瑙勬牸", "type": "string" }, "productType": { @@ -7358,6 +7699,29 @@ } } }, + "user.GetUserRequest": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "nickName": { + "type": "string" + }, + "parentId": { + "type": "string" + }, + "pos": { + "type": "string" + }, + "userName": { + "type": "string" + }, + "userType": { + "type": "integer" + } + } + }, "util.Response": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 336f0d7..394069f 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -541,6 +541,7 @@ updateTime: type: string warehouseId: + description: 浠撳簱id type: integer type: object models.LogisticCompany: @@ -919,38 +920,52 @@ models.Operation: properties: accountant: + description: 浼氳鍚嶇О type: string accountantId: + description: 浼氳id type: string auditDate: + description: 瀹℃壒鏃堕棿 type: string baseOperationType: allOf: - $ref: '#/definitions/constvar.BaseOperationType' description: 鍩虹浣滀笟绫诲瀷 checkedBy: + description: 楠岃瘉鑰匲serId type: string comment: + description: 澶囨敞 type: string companyID: + description: 鍏徃ID-瀹㈡埛 type: string companyName: + description: 鍏徃鍚嶇О-瀹㈡埛 type: string contacterID: + description: 鑱旂郴浜篒D type: integer contacterName: + description: 鑱旂郴浜哄鍚� type: string createBy: + description: 鍒涘缓鑰匲serId type: string createTime: type: string custodian: + description: 淇濈鍛樺悕绉� type: string custodianId: + description: 淇濈鍛榠d type: string dealerType: + description: 璋冩嫧鍑哄叆搴撶被鍨� type: string details: + description: 鎿嶄綔鏄庣粏 items: $ref: '#/definitions/models.OperationDetails' type: array @@ -967,20 +982,26 @@ description: 婧愪綅缃甶d type: integer logisticCompany: - $ref: '#/definitions/models.LogisticCompany' + allOf: + - $ref: '#/definitions/models.LogisticCompany' + description: 鐗╂祦鍏徃淇℃伅 logisticCompanyId: + description: 鐗╂祦鍏徃id type: string logisticWeight: description: 鐗╂祦閲嶉噺 type: number manager: + description: 涓荤鍚嶇О type: string managerId: + description: 涓荤id type: string number: description: 鍗曞彿 type: string operationDate: + description: 瀹夋帓鏃ユ湡 type: string operationSource: allOf: @@ -993,16 +1014,25 @@ description: 浣滀笟绫诲瀷鍚嶇О type: string receiverAddr: + description: 鏀惰揣鍦板潃 type: string receiverName: + description: 鏀惰揣浜哄鍚� type: string receiverPhone: + description: 鑱旂郴鐢佃瘽 type: string remark: + description: 澶囨敞 type: string salesDetailsNumber: + description: 閿�鍞槑缁嗙紪鐮� + type: string + silkMarket: + description: 鍢夎仈浠撳偍娣诲姞 SilkMarket type: string source: + description: 鏉ユ簮绯荤粺 type: string sourceNumber: description: 婧愬崟鍙� @@ -1021,8 +1051,11 @@ updateTime: type: string warehouse: - $ref: '#/definitions/models.Warehouse' + allOf: + - $ref: '#/definitions/models.Warehouse' + description: 浠撳簱淇℃伅 warehouseId: + description: 浠撳簱id type: integer waybillNumber: description: 杩愬崟鍙� @@ -1038,8 +1071,10 @@ null;comment:浜у搧鍚嶇О"` //浜у搧鍚嶇О type: number auxiliaryAmount: + description: 杈呭姪鏁伴噺 type: number auxiliaryUnit: + description: 杈呭姪鍗曚綅 type: string baseOperationType: allOf: @@ -1066,7 +1101,7 @@ description: 鏄惁璋冩嫧浜х敓鐨勫嚭搴� type: boolean operationId: - description: 鎿嶄綔id + description: 鎿嶄綔璁板綍id type: integer product: allOf: @@ -1076,10 +1111,17 @@ description: 浜у搧id type: string remark: + description: 澶囨敞 type: string salePrice: description: 閿�鍞崟浠� type: number + silkMarket: + description: 鍢夎仈浠撳偍娣诲姞 SilkMarket銆丼ilkMarketClose + type: string + silkMarketClose: + description: 搴勫彛鍏抽棴 + type: string stockAmount: description: 搴撳瓨鏁伴噺锛岀洏鐐规椂鐢� type: number @@ -1091,8 +1133,10 @@ description: 鐩爣浣嶇疆id type: integer totalGrossWeight: + description: 鎬绘瘺閲� type: number totalNetWeight: + description: 鎬诲噣閲� type: number updateTime: type: string @@ -1173,6 +1217,47 @@ updateTime: type: string type: object + models.SilkDict: + properties: + createdAt: + type: string + deletedAt: + $ref: '#/definitions/gorm.DeletedAt' + dictType: + allOf: + - $ref: '#/definitions/models.SilkDictType' + description: 瀛楀吀绫诲瀷 + id: + type: integer + name: + description: 鍚嶇О + type: string + number: + description: 缂栧彿 + type: string + remark: + description: 澶囨敞 + type: string + updatedAt: + type: string + type: object + models.SilkDictType: + enum: + - 1 + - 2 + - 3 + - 4 + type: integer + x-enum-comments: + DictTypeColor: 棰滆壊 + DictTypeMarket: 搴勫彛 + DictTypeSpec: 瑙勬牸 + DictTypeWorkshop: 杞﹂棿 + x-enum-varnames: + - DictTypeMarket + - DictTypeWorkshop + - DictTypeColor + - DictTypeSpec models.SystemConfig: properties: configType: @@ -1438,13 +1523,15 @@ request.AddOperation: properties: accountant: + description: 浼氳鍚嶇О type: string accountantId: + description: 浼氳id type: string baseOperationType: allOf: - $ref: '#/definitions/constvar.BaseOperationType' - description: 鍩虹浣滀笟绫诲瀷 5搴撳瓨鐩樼偣 + description: 鍩虹浣滀笟绫诲瀷 1 鍏ュ簱 2 鍑哄簱 3 鍐呴儴璋冩嫧 4 鎶ュ簾 5 搴撳瓨鐩樼偣 comment: description: 澶囨敞 type: string @@ -1461,12 +1548,16 @@ description: 鑱旂郴浜哄鍚�-闈炲繀濉� type: string custodian: + description: 淇濈鍛樺悕绉� type: string custodianId: + description: 淇濈鍛榠d type: string dealerType: + description: 璋冩嫧鍑哄叆搴撶被鍨� type: string details: + description: 璇︽儏 items: $ref: '#/definitions/request.OperationDetails' type: array @@ -1476,21 +1567,24 @@ description: 婧愪綅缃甶d type: integer logisticCompanyId: + description: 鐗╂祦鍏徃id type: string logisticWeight: description: 鐗╂祦閲嶉噺 type: number manager: + description: 涓荤鍚嶇О type: string managerId: + description: 涓荤id type: string number: description: 鍗曞彿 type: string operationDate: description: |- - FromLocationId int `json:"fromLocationId" gorm:"type:int;not null;comment:婧愪綅缃甶d"` //婧愪綅缃甶d - ToLocationId int `json:"toLocationId" gorm:"type:int;not null;comment:鐩爣浣嶇疆id"` //鐩爣浣嶇疆id + FromLocationId int `json:"fromLocationId" ` //婧愪綅缃甶d + ToLocationId int `json:"toLocationId" ` //鐩爣浣嶇疆id type: string operationTypeId: description: 浣滀笟绫诲瀷id @@ -1499,10 +1593,16 @@ description: 浣滀笟绫诲瀷鍚嶇О type: string receiverAddr: + description: 鏀惰揣鍦板潃 type: string receiverName: + description: 鏀惰揣浜哄鍚� type: string receiverPhone: + description: 鑱旂郴鐢佃瘽 + type: string + silkMarket: + description: 搴勫彛 type: string sourceNumber: description: 婧愬崟鍙� @@ -1693,9 +1793,9 @@ pageSize: description: 姣忛〉澶у皬 type: integer - warehouseCode: - description: 浠撳簱缂╁啓 - type: string + warehouseId: + description: WarehouseCode string `json:"warehouseCode"` //浠撳簱缂╁啓 + type: integer type: object request.GetInventoryHistory: properties: @@ -1720,6 +1820,11 @@ type: string unit: description: 鍗曚綅 + type: string + warehouseCode: + type: string + warehouseId: + description: 浠撳簱ID type: string type: object request.GetList: @@ -1870,6 +1975,7 @@ request.OperationAllList: properties: number: + description: 鍗曞彿 type: string page: description: 椤电爜 @@ -1878,11 +1984,13 @@ description: 姣忛〉澶у皬 type: integer sourceNumber: + description: 婧愬崟鍙� type: string type: object request.OperationCondition: properties: condition: + description: 妯$硦鏌ヨ鏉′欢 type: string keyword: description: 鍏抽敭瀛楁悳绱� @@ -1906,8 +2014,7 @@ description: 鎿嶄綔id type: integer amount: - description: ProductName string `json:"productName" gorm:"type:varchar(255);not - null;comment:浜у搧鍚嶇О"` //浜у搧鍚嶇О + description: ProductName string `json:"productName" ` //浜у搧鍚嶇О type: number auxiliaryAmount: description: 杈呭姪鏁伴噺 @@ -1920,17 +2027,24 @@ type: number fromLocationId: description: |- - Unit string `json:"unit" gorm:"type:varchar(31);comment:鍗曚綅"` //鍗曚綅 - Product models.Material `json:"product" gorm:"foreignKey:ProductId;references:ID"` + Unit string `json:"unit"` //鍗曚綅 + Product models.Material `json:"product" ` // 浜у搧 type: integer productId: description: 浜у搧id type: string remark: + description: 澶囨敞 type: string salePrice: description: 閿�鍞崟浠� type: number + silkMarket: + description: 搴勫彛 + type: string + silkMarketClose: + description: 搴勫彛鍏抽棴 + type: string stockAmount: description: 搴撳瓨鏁伴噺锛岀洏鐐规椂鐢� type: number @@ -1949,10 +2063,12 @@ baseOperationType: allOf: - $ref: '#/definitions/constvar.BaseOperationType' - description: 1 鍏ュ簱 2 鍑哄簱 3 鍐呴儴璋冩嫧 4 鎶ュ簾 5 搴撳瓨鐩樼偣 + description: 鍩虹浣滀笟绫诲瀷 1 鍏ュ簱 2 鍑哄簱 3 鍐呴儴璋冩嫧 4 鎶ュ簾 5 搴撳瓨鐩樼偣 number: + description: 鍗曞彿 type: string operationTypeId: + description: 浣滀笟绫诲瀷id type: integer page: description: 椤电爜 @@ -1961,7 +2077,9 @@ description: 姣忛〉澶у皬 type: integer status: - $ref: '#/definitions/constvar.OperationStatus' + allOf: + - $ref: '#/definitions/constvar.OperationStatus' + description: 鐘舵�� type: object request.PageInfo: properties: @@ -2173,8 +2291,10 @@ request.UpdateOperation: properties: accountant: + description: 浼氳鍚嶇О type: string accountantId: + description: 浼氳id type: string baseOperationType: allOf: @@ -2196,16 +2316,20 @@ description: 鑱旂郴浜哄鍚�-闈炲繀濉� type: string custodian: + description: 淇濈鍛樺悕绉� type: string custodianId: + description: 淇濈鍛榠d type: string details: + description: 璇︽儏 items: $ref: '#/definitions/request.OperationDetails' type: array id: type: integer inventoryDealerType: + description: 璋冩嫧鍑哄叆搴撳垎绫�(瀵瑰簲dict瀛楀吀琛ㄧ殑ID) type: integer locationId: description: 婧愪綅缃甶d @@ -2216,16 +2340,18 @@ description: 鐗╂祦閲嶉噺 type: number manager: + description: 涓荤鍚嶇О type: string managerId: + description: 涓荤id type: string number: description: 鍗曞彿 type: string operationDate: description: |- - FromLocationId int `json:"fromLocationId" gorm:"type:int;not null;comment:婧愪綅缃甶d"` //婧愪綅缃甶d - ToLocationId int `json:"toLocationId" gorm:"type:int;not null;comment:鐩爣浣嶇疆id"` //鐩爣浣嶇疆id + FromLocationId int `json:"fromLocationId" ` //婧愪綅缃甶d + ToLocationId int `json:"toLocationId" ` //鐩爣浣嶇疆id type: string operationTypeId: description: 浣滀笟绫诲瀷id @@ -2234,10 +2360,16 @@ description: 浣滀笟绫诲瀷鍚嶇О type: string receiverAddr: + description: 鏀惰揣鍦板潃 type: string receiverName: + description: 鏀惰揣浜哄鍚� type: string receiverPhone: + description: 鑱旂郴鐢佃瘽 + type: string + silkMarket: + description: 搴勫彛 type: string sourceNumber: description: 婧愬崟鍙� @@ -2349,8 +2481,14 @@ produceId: description: 浜у搧id type: string + productCategory: + description: 浜у搧绫诲埆 + type: string productName: description: 浜у搧鍚嶇О + type: string + productSpecs: + description: 浜у搧瑙勬牸 type: string productType: description: 浜у搧绫诲瀷 @@ -2406,6 +2544,21 @@ items: $ref: '#/definitions/models.Material' type: array + type: object + user.GetUserRequest: + properties: + id: + type: string + nickName: + type: string + parentId: + type: string + pos: + type: string + userName: + type: string + userType: + type: integer type: object util.Response: properties: @@ -2852,6 +3005,74 @@ type: array type: object summary: 鑾峰彇瀛楀吀淇℃伅鍒楄〃 + tags: + - 鏁版嵁瀛楀吀 + /api-wms/v1/dict/getSilkDictList/{type}: + get: + parameters: + - description: token + in: header + name: Authorization + required: true + type: string + - description: 瀛楀吀绫诲瀷 + in: path + name: type + required: true + type: string + produces: + - application/json + responses: + "200": + description: 鎴愬姛 + schema: + allOf: + - $ref: '#/definitions/util.ResponseList' + - properties: + data: + items: + $ref: '#/definitions/models.SilkDict' + type: array + type: object + summary: 鑾峰彇搴勫彛鍒楄〃 + tags: + - 鏁版嵁瀛楀吀 + /api-wms/v1/dict/getUserList: + get: + parameters: + - in: query + name: id + type: string + - in: query + name: nickName + type: string + - in: query + name: parentId + type: string + - in: query + name: pos + type: string + - in: query + name: userName + type: string + - in: query + name: userType + type: integer + produces: + - application/json + responses: + "200": + description: 鎴愬姛 + schema: + allOf: + - $ref: '#/definitions/util.ResponseList' + - properties: + data: + items: + $ref: '#/definitions/user.GetUserRequest' + type: array + type: object + summary: 鑾峰彇鐢ㄦ埛鍒楄〃 tags: - 鏁版嵁瀛楀吀 /api-wms/v1/dict/save: @@ -3447,6 +3668,11 @@ /api-wms/v1/locationProductAmount/add: post: parameters: + - description: token + in: header + name: Authorization + required: true + type: string - description: 鍏ュ簱/鍑哄簱淇℃伅 in: body name: object @@ -3466,6 +3692,11 @@ /api-wms/v1/locationProductAmount/finish: post: parameters: + - description: token + in: header + name: Authorization + required: true + type: string - description: 鍏ュ弬 in: body name: object @@ -3578,6 +3809,11 @@ /api-wms/v1/locationProductAmount/update: post: parameters: + - description: token + in: header + name: Authorization + required: true + type: string - description: 鍏ュ簱/鍑哄簱淇℃伅 in: body name: object @@ -3615,6 +3851,11 @@ /api-wms/v1/operation/finish/{id}: put: parameters: + - description: token + in: header + name: Authorization + required: true + type: string - description: id in: path name: id @@ -3716,6 +3957,11 @@ /api-wms/v1/operation/list: post: parameters: + - description: token + in: header + name: Authorization + required: true + type: string - description: 鏌ヨ鍙傛暟 in: body name: object @@ -3780,6 +4026,11 @@ /api-wms/v1/operation/operation: post: parameters: + - description: token + in: header + name: Authorization + required: true + type: string - description: 鍏ュ簱/鍑哄簱淇℃伅 in: body name: object @@ -3799,6 +4050,11 @@ /api-wms/v1/operation/operation/{id}: delete: parameters: + - description: token + in: header + name: Authorization + required: true + type: string - description: id in: path name: id diff --git a/models/silk_dict.go b/models/silk_dict.go new file mode 100644 index 0000000..21659a7 --- /dev/null +++ b/models/silk_dict.go @@ -0,0 +1,289 @@ +package models + +import ( + "fmt" + "gorm.io/gorm" + "wms/pkg/mysqlx" +) + +type SilkDictType int + +const ( + DictTypeMarket SilkDictType = iota + 1 //搴勫彛 + DictTypeWorkshop //杞﹂棿 + DictTypeColor //棰滆壊 + DictTypeSpec //瑙勬牸 +) + +type ( + // SilkDict 缂笣璇嶅吀 + SilkDict struct { + gorm.Model + DictType SilkDictType `gorm:"index;type:tinyint(3);not null;comment:瀛楀吀绫诲瀷"` //瀛楀吀绫诲瀷 + Number string `gorm:"type:varchar(255);not null;comment:缂栧彿" json:"number"` //缂栧彿 + Name string `gorm:"type:varchar(255);not null;comment:鍚嶇О" json:"name"` //鍚嶇О + Remark string `gorm:"type:varchar(255);not null;comment:澶囨敞" json:"remark"` //澶囨敞 + } + + SilkDictSearch struct { + SilkDict + Order string + PageNum int + PageSize int + Orm *gorm.DB + Keyword string + DictTypes []SilkDictType + } +) + +func (slf *SilkDict) TableName() string { + return "silk_dict" +} + +func NewSilkDictSearch() *SilkDictSearch { + return &SilkDictSearch{Orm: mysqlx.GetDB()} +} + +func (slf *SilkDictSearch) SetOrm(tx *gorm.DB) *SilkDictSearch { + slf.Orm = tx + return slf +} + +func (slf *SilkDictSearch) SetPage(page, size int) *SilkDictSearch { + slf.PageNum, slf.PageSize = page, size + return slf +} + +func (slf *SilkDictSearch) SetOrder(order string) *SilkDictSearch { + slf.Order = order + return slf +} + +func (slf *SilkDictSearch) SetID(id uint) *SilkDictSearch { + slf.ID = id + return slf +} + +func (slf *SilkDictSearch) SetNumber(number string) *SilkDictSearch { + slf.Number = number + return slf +} + +func (slf *SilkDictSearch) SetName(name string) *SilkDictSearch { + slf.Name = name + return slf +} + +func (slf *SilkDictSearch) SetKeyword(keyword string) *SilkDictSearch { + slf.Keyword = keyword + return slf +} + +func (slf *SilkDictSearch) SetDictType(dt SilkDictType) *SilkDictSearch { + slf.DictType = dt + return slf +} + +func (slf *SilkDictSearch) SetDictTypes(dts []SilkDictType) *SilkDictSearch { + slf.DictTypes = dts + return slf +} + +func (slf *SilkDictSearch) build() *gorm.DB { + var db = slf.Orm.Table(slf.TableName()) + + if slf.ID != 0 { + db = db.Where("id = ?", slf.ID) + } + + if slf.Order != "" { + db = db.Order(slf.Order) + } + + if slf.Number != "" { + db = db.Where("number = ?", slf.Number) + } + + if slf.DictType > 0 { + db = db.Where("dict_type = ?", slf.DictType) + } + + if slf.Name != "" { + db = db.Where("name = ?", slf.Name) + } + + if slf.Keyword != "" { + kw := "%" + slf.Keyword + "%" + db = db.Where("name like ? or number like ?", kw, kw) + } + + if len(slf.DictTypes) > 0 { + db = db.Where("dict_type in (?)", slf.DictTypes) + } + + return db +} + +// Create 鍗曟潯鎻掑叆 +func (slf *SilkDictSearch) Create(record *SilkDict) error { + var db = slf.build() + + if err := db.Create(record).Error; err != nil { + return fmt.Errorf("create err: %v, record: %+v", err, record) + } + + return nil +} + +// CreateBatch 鎵归噺鎻掑叆 +func (slf *SilkDictSearch) CreateBatch(records []*SilkDict) error { + var db = slf.build() + + if err := db.Create(&records).Error; err != nil { + return fmt.Errorf("create batch err: %v, records: %+v", err, records) + } + + return nil +} + +func (slf *SilkDictSearch) Save(record *SilkDict) error { + var db = slf.build() + + if err := db.Omit("CreatedAt").Save(record).Error; err != nil { + return fmt.Errorf("save err: %v, record: %+v", err, record) + } + + return nil +} + +func (slf *SilkDictSearch) Update(record *SilkDict) error { + var db = slf.build() + + if err := db.Updates(record).Error; err != nil { + return fmt.Errorf("save err: %v, record: %+v", err, record) + } + + return nil +} + +func (slf *SilkDictSearch) UpdateByMap(upMap map[string]interface{}) error { + var ( + db = slf.build() + ) + + if err := db.Updates(upMap).Error; err != nil { + return fmt.Errorf("update by map err: %v, upMap: %+v", err, upMap) + } + + return nil +} + +func (slf *SilkDictSearch) UpdateByQuery(query string, args []interface{}, upMap map[string]interface{}) error { + var ( + db = slf.Orm.Table(slf.TableName()).Where(query, args...) + ) + + if err := db.Updates(upMap).Error; err != nil { + return fmt.Errorf("update by query err: %v, query: %s, args: %+v, upMap: %+v", err, query, args, upMap) + } + + return nil +} + +func (slf *SilkDictSearch) Delete() error { + var db = slf.build() + + if err := db.Unscoped().Delete(&SilkDict{}).Error; err != nil { + return err + } + + return nil +} + +func (slf *SilkDictSearch) First() (*SilkDict, error) { + var ( + record = new(SilkDict) + db = slf.build() + ) + + if err := db.First(record).Error; err != nil { + return record, err + } + + return record, nil +} + +func (slf *SilkDictSearch) Find() ([]*SilkDict, int64, error) { + var ( + records = make([]*SilkDict, 0) + total int64 + db = slf.build() + ) + + if err := db.Count(&total).Error; err != nil { + return records, total, fmt.Errorf("find count err: %v", err) + } + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, total, fmt.Errorf("find records err: %v", err) + } + + return records, total, nil +} + +func (slf *SilkDictSearch) FindAll() ([]*SilkDict, error) { + var ( + records = make([]*SilkDict, 0) + db = slf.build() + ) + if err := db.Find(&records).Error; err != nil { + return records, fmt.Errorf("find records err: %v", err) + } + + return records, nil +} + +// FindByQuery 鎸囧畾鏉′欢鏌ヨ. +func (slf *SilkDictSearch) FindByQuery(query string, args []interface{}) ([]*SilkDict, int64, error) { + var ( + records = make([]*SilkDict, 0) + total int64 + db = slf.Orm.Table(slf.TableName()).Where(query, args...) + ) + + if err := db.Count(&total).Error; err != nil { + return records, total, fmt.Errorf("find by query count err: %v", err) + } + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, total, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) + } + + return records, total, nil +} + +// FindByQueryNotTotal 鎸囧畾鏉′欢鏌ヨ&涓嶆煡璇㈡�绘潯鏁�. +func (slf *SilkDictSearch) FindByQueryNotTotal(query string, args []interface{}) ([]*SilkDict, error) { + var ( + records = make([]*SilkDict, 0) + db = slf.Orm.Table(slf.TableName()).Where(query, args...) + ) + + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) + } + + return records, nil +} + +// InitDefaultData 鍒濆鍖栨暟鎹� +func (slf *SilkDictSearch) InitDefaultData() error { + return nil +} diff --git a/router/router.go b/router/router.go index 815904d..a6234bd 100644 --- a/router/router.go +++ b/router/router.go @@ -224,11 +224,13 @@ dictController := new(controllers.DictController) dictApi := r.Group(urlPrefix + "/dict") { - dictApi.POST("add", dictController.AddMiniDict) //娣诲姞瀛楀吀淇℃伅 - dictApi.POST("edit", dictController.EditMiniDict) //淇敼瀛楀吀淇℃伅 - dictApi.DELETE("delete/:id", dictController.DeleteMiniDict) //鍒犻櫎瀛楀吀淇℃伅 - dictApi.POST("save", dictController.SaveMiniDict) //鎵归噺淇濆瓨绯荤粺璁剧疆 - dictApi.POST("getDictList", dictController.GetMiniDictList) //鑾峰彇瀛楀吀淇℃伅鍒楄〃 + dictApi.POST("add", dictController.AddMiniDict) //娣诲姞瀛楀吀淇℃伅 + dictApi.POST("edit", dictController.EditMiniDict) //淇敼瀛楀吀淇℃伅 + dictApi.DELETE("delete/:id", dictController.DeleteMiniDict) //鍒犻櫎瀛楀吀淇℃伅 + dictApi.POST("save", dictController.SaveMiniDict) //鎵归噺淇濆瓨绯荤粺璁剧疆 + dictApi.POST("getDictList", dictController.GetMiniDictList) //鑾峰彇瀛楀吀淇℃伅鍒楄〃 + dictApi.GET("getSilkDictList/:type", dictController.GetSilkDictList) // 鑾峰彇搴勫彛鍒楄〃 + dictApi.GET("getUserList", dictController.GetUserList) // 鑾峰彇鐢ㄦ埛鍒楄〃 } //绯荤粺閰嶇疆 -- Gitblit v1.8.0