From 861a89be3807fb8b9b1e8863adc165cc78bb7700 Mon Sep 17 00:00:00 2001 From: wanjianli <1061428287@qq.com> Date: 星期一, 18 九月 2023 19:55:55 +0800 Subject: [PATCH] 出入库一部分代码 --- go.sum | 7 go.mod | 7 docs/swagger.yaml | 138 +++++++++++++ docs/docs.go | 197 +++++++++++++++++++ docs/swagger.json | 195 +++++++++++++++++++ 5 files changed, 533 insertions(+), 11 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 2922b77..0f27c63 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -294,6 +294,36 @@ } } }, + "/api-wms/v1/operation/operation": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鍏ュ簱/鍑哄簱" + ], + "summary": "娣诲姞鍏ュ簱/鍑哄簱", + "parameters": [ + { + "description": "鍏ュ簱/鍑哄簱淇℃伅", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddOperation" + } + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/util.Response" + } + } + } + } + }, "/api-wms/v1/warehouse/operationType": { "get": { "produces": [ @@ -602,6 +632,57 @@ "BaseOperationTypeInternal" ] }, + "constvar.LocationType": { + "type": "integer", + "enum": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ], + "x-enum-comments": { + "LocationTypeCustomer": "瀹㈡埛浣嶇疆", + "LocationTypeInternal": "鍐呴儴浣嶇疆", + "LocationTypeInventoryLoss": "搴撳瓨鎹熷け", + "LocationTypeProduction": "鐢熶骇", + "LocationTypeTransit": "涓浆浣嶇疆", + "LocationTypeVendor": "渚涘簲鍟嗕綅缃�", + "LocationTypeView": "瑙嗗浘" + }, + "x-enum-varnames": [ + "LocationTypeVendor", + "LocationTypeView", + "LocationTypeInternal", + "LocationTypeCustomer", + "LocationTypeInventoryLoss", + "LocationTypeProduction", + "LocationTypeTransit" + ] + }, + "constvar.OperationStatus": { + "type": "integer", + "enum": [ + 1, + 2, + 3, + 4 + ], + "x-enum-comments": { + "OperationStatus_Draft": "鑽夌", + "OperationStatus_Finish": "瀹屾垚", + "OperationStatus_Ready": "灏辩华", + "OperationStatus_Waiting": "姝e湪绛夊緟" + }, + "x-enum-varnames": [ + "OperationStatus_Draft", + "OperationStatus_Waiting", + "OperationStatus_Ready", + "OperationStatus_Finish" + ] + }, "constvar.ReservationMethod": { "type": "integer", "enum": [ @@ -697,15 +778,55 @@ "models.Location": { "type": "object", "properties": { + "company": { + "description": "鍏徃", + "allOf": [ + { + "$ref": "#/definitions/models.Company" + } + ] + }, + "companyId": { + "description": "鍏徃id", + "type": "integer" + }, + "countFrequency": { + "description": "鐩樼偣棰戠巼锛堝ぉ锛�", + "type": "integer" + }, "createTime": { "type": "string" }, "id": { "type": "integer" }, + "isReturnLocation": { + "description": "鏄惁閫�璐т綅缃�", + "type": "boolean" + }, + "isScrapLocation": { + "description": "鏄惁鎶ュ簾浣嶇疆", + "type": "boolean" + }, "name": { "description": "浣嶇疆鍚嶇О", "type": "string" + }, + "parentId": { + "description": "涓婄骇id", + "type": "integer" + }, + "replenishLocation": { + "description": "鏄惁琛ュ厖浣嶇疆", + "type": "boolean" + }, + "type": { + "description": "浣嶇疆绫诲瀷", + "allOf": [ + { + "$ref": "#/definitions/constvar.LocationType" + } + ] }, "updateTime": { "type": "string" @@ -915,6 +1036,51 @@ } } }, + "request.AddOperation": { + "type": "object", + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/request.OperationDetails" + } + }, + "fromLocationId": { + "description": "婧愪綅缃甶d", + "type": "integer" + }, + "id": { + "type": "integer" + }, + "number": { + "description": "鍗曞彿", + "type": "string" + }, + "operationDate": { + "$ref": "#/definitions/util.JSONTime" + }, + "operationTypeId": { + "description": "浣滀笟绫诲瀷id", + "type": "integer" + }, + "sourceNumber": { + "description": "婧愬崟鍙�", + "type": "string" + }, + "status": { + "description": "鐘舵��", + "allOf": [ + { + "$ref": "#/definitions/constvar.OperationStatus" + } + ] + }, + "toLocationId": { + "description": "鐩爣浣嶇疆id", + "type": "integer" + } + } + }, "request.AddOperationType": { "type": "object", "properties": { @@ -1021,6 +1187,27 @@ "items": { "type": "string" } + } + } + }, + "request.OperationDetails": { + "type": "object", + "properties": { + "finishQuantity": { + "description": "瀹屾垚鏁伴噺", + "type": "number" + }, + "productId": { + "description": "浜у搧id", + "type": "integer" + }, + "productName": { + "description": "浜у搧鍚嶇О", + "type": "string" + }, + "quantity": { + "description": "鏁伴噺", + "type": "number" } } }, @@ -1172,6 +1359,14 @@ } } }, + "util.JSONTime": { + "type": "object", + "properties": { + "time.Time": { + "type": "string" + } + } + }, "util.Response": { "type": "object", "properties": { @@ -1218,8 +1413,6 @@ Description: "", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, - LeftDelim: "{{", - RightDelim: "}}", } func init() { diff --git a/docs/swagger.json b/docs/swagger.json index 6700840..8d67b82 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -282,6 +282,36 @@ } } }, + "/api-wms/v1/operation/operation": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鍏ュ簱/鍑哄簱" + ], + "summary": "娣诲姞鍏ュ簱/鍑哄簱", + "parameters": [ + { + "description": "鍏ュ簱/鍑哄簱淇℃伅", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AddOperation" + } + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/util.Response" + } + } + } + } + }, "/api-wms/v1/warehouse/operationType": { "get": { "produces": [ @@ -590,6 +620,57 @@ "BaseOperationTypeInternal" ] }, + "constvar.LocationType": { + "type": "integer", + "enum": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ], + "x-enum-comments": { + "LocationTypeCustomer": "瀹㈡埛浣嶇疆", + "LocationTypeInternal": "鍐呴儴浣嶇疆", + "LocationTypeInventoryLoss": "搴撳瓨鎹熷け", + "LocationTypeProduction": "鐢熶骇", + "LocationTypeTransit": "涓浆浣嶇疆", + "LocationTypeVendor": "渚涘簲鍟嗕綅缃�", + "LocationTypeView": "瑙嗗浘" + }, + "x-enum-varnames": [ + "LocationTypeVendor", + "LocationTypeView", + "LocationTypeInternal", + "LocationTypeCustomer", + "LocationTypeInventoryLoss", + "LocationTypeProduction", + "LocationTypeTransit" + ] + }, + "constvar.OperationStatus": { + "type": "integer", + "enum": [ + 1, + 2, + 3, + 4 + ], + "x-enum-comments": { + "OperationStatus_Draft": "鑽夌", + "OperationStatus_Finish": "瀹屾垚", + "OperationStatus_Ready": "灏辩华", + "OperationStatus_Waiting": "姝e湪绛夊緟" + }, + "x-enum-varnames": [ + "OperationStatus_Draft", + "OperationStatus_Waiting", + "OperationStatus_Ready", + "OperationStatus_Finish" + ] + }, "constvar.ReservationMethod": { "type": "integer", "enum": [ @@ -685,15 +766,55 @@ "models.Location": { "type": "object", "properties": { + "company": { + "description": "鍏徃", + "allOf": [ + { + "$ref": "#/definitions/models.Company" + } + ] + }, + "companyId": { + "description": "鍏徃id", + "type": "integer" + }, + "countFrequency": { + "description": "鐩樼偣棰戠巼锛堝ぉ锛�", + "type": "integer" + }, "createTime": { "type": "string" }, "id": { "type": "integer" }, + "isReturnLocation": { + "description": "鏄惁閫�璐т綅缃�", + "type": "boolean" + }, + "isScrapLocation": { + "description": "鏄惁鎶ュ簾浣嶇疆", + "type": "boolean" + }, "name": { "description": "浣嶇疆鍚嶇О", "type": "string" + }, + "parentId": { + "description": "涓婄骇id", + "type": "integer" + }, + "replenishLocation": { + "description": "鏄惁琛ュ厖浣嶇疆", + "type": "boolean" + }, + "type": { + "description": "浣嶇疆绫诲瀷", + "allOf": [ + { + "$ref": "#/definitions/constvar.LocationType" + } + ] }, "updateTime": { "type": "string" @@ -903,6 +1024,51 @@ } } }, + "request.AddOperation": { + "type": "object", + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/request.OperationDetails" + } + }, + "fromLocationId": { + "description": "婧愪綅缃甶d", + "type": "integer" + }, + "id": { + "type": "integer" + }, + "number": { + "description": "鍗曞彿", + "type": "string" + }, + "operationDate": { + "$ref": "#/definitions/util.JSONTime" + }, + "operationTypeId": { + "description": "浣滀笟绫诲瀷id", + "type": "integer" + }, + "sourceNumber": { + "description": "婧愬崟鍙�", + "type": "string" + }, + "status": { + "description": "鐘舵��", + "allOf": [ + { + "$ref": "#/definitions/constvar.OperationStatus" + } + ] + }, + "toLocationId": { + "description": "鐩爣浣嶇疆id", + "type": "integer" + } + } + }, "request.AddOperationType": { "type": "object", "properties": { @@ -1009,6 +1175,27 @@ "items": { "type": "string" } + } + } + }, + "request.OperationDetails": { + "type": "object", + "properties": { + "finishQuantity": { + "description": "瀹屾垚鏁伴噺", + "type": "number" + }, + "productId": { + "description": "浜у搧id", + "type": "integer" + }, + "productName": { + "description": "浜у搧鍚嶇О", + "type": "string" + }, + "quantity": { + "description": "鏁伴噺", + "type": "number" } } }, @@ -1160,6 +1347,14 @@ } } }, + "util.JSONTime": { + "type": "object", + "properties": { + "time.Time": { + "type": "string" + } + } + }, "util.Response": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index eb93df2..7f4c9c9 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -13,6 +13,49 @@ - BaseOperationTypeIncoming - BaseOperationTypeOutgoing - BaseOperationTypeInternal + constvar.LocationType: + enum: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + type: integer + x-enum-comments: + LocationTypeCustomer: 瀹㈡埛浣嶇疆 + LocationTypeInternal: 鍐呴儴浣嶇疆 + LocationTypeInventoryLoss: 搴撳瓨鎹熷け + LocationTypeProduction: 鐢熶骇 + LocationTypeTransit: 涓浆浣嶇疆 + LocationTypeVendor: 渚涘簲鍟嗕綅缃� + LocationTypeView: 瑙嗗浘 + x-enum-varnames: + - LocationTypeVendor + - LocationTypeView + - LocationTypeInternal + - LocationTypeCustomer + - LocationTypeInventoryLoss + - LocationTypeProduction + - LocationTypeTransit + constvar.OperationStatus: + enum: + - 1 + - 2 + - 3 + - 4 + type: integer + x-enum-comments: + OperationStatus_Draft: 鑽夌 + OperationStatus_Finish: 瀹屾垚 + OperationStatus_Ready: 灏辩华 + OperationStatus_Waiting: 姝e湪绛夊緟 + x-enum-varnames: + - OperationStatus_Draft + - OperationStatus_Waiting + - OperationStatus_Ready + - OperationStatus_Finish constvar.ReservationMethod: enum: - 1 @@ -82,13 +125,39 @@ type: object models.Location: properties: + company: + allOf: + - $ref: '#/definitions/models.Company' + description: 鍏徃 + companyId: + description: 鍏徃id + type: integer + countFrequency: + description: 鐩樼偣棰戠巼锛堝ぉ锛� + type: integer createTime: type: string id: type: integer + isReturnLocation: + description: 鏄惁閫�璐т綅缃� + type: boolean + isScrapLocation: + description: 鏄惁鎶ュ簾浣嶇疆 + type: boolean name: description: 浣嶇疆鍚嶇О type: string + parentId: + description: 涓婄骇id + type: integer + replenishLocation: + description: 鏄惁琛ュ厖浣嶇疆 + type: boolean + type: + allOf: + - $ref: '#/definitions/constvar.LocationType' + description: 浣嶇疆绫诲瀷 updateTime: type: string type: object @@ -225,6 +294,36 @@ description: 澶囨敞 type: string type: object + request.AddOperation: + properties: + details: + items: + $ref: '#/definitions/request.OperationDetails' + type: array + fromLocationId: + description: 婧愪綅缃甶d + type: integer + id: + type: integer + number: + description: 鍗曞彿 + type: string + operationDate: + $ref: '#/definitions/util.JSONTime' + operationTypeId: + description: 浣滀笟绫诲瀷id + type: integer + sourceNumber: + description: 婧愬崟鍙� + type: string + status: + allOf: + - $ref: '#/definitions/constvar.OperationStatus' + description: 鐘舵�� + toLocationId: + description: 鐩爣浣嶇疆id + type: integer + type: object request.AddOperationType: properties: ReservationDaysBeforePriority: @@ -298,6 +397,21 @@ type: array required: - code + type: object + request.OperationDetails: + properties: + finishQuantity: + description: 瀹屾垚鏁伴噺 + type: number + productId: + description: 浜у搧id + type: integer + productName: + description: 浜у搧鍚嶇О + type: string + quantity: + description: 鏁伴噺 + type: number type: object request.UpdateCompany: properties: @@ -399,6 +513,11 @@ type: array required: - code + type: object + util.JSONTime: + properties: + time.Time: + type: string type: object util.Response: properties: @@ -598,6 +717,25 @@ summary: 缂栬緫鍏徃 tags: - 鍏徃 + /api-wms/v1/operation/operation: + post: + parameters: + - description: 鍏ュ簱/鍑哄簱淇℃伅 + in: body + name: object + required: true + schema: + $ref: '#/definitions/request.AddOperation' + produces: + - application/json + responses: + "200": + description: 鎴愬姛 + schema: + $ref: '#/definitions/util.Response' + summary: 娣诲姞鍏ュ簱/鍑哄簱 + tags: + - 鍏ュ簱/鍑哄簱 /api-wms/v1/warehouse/operationType: get: parameters: diff --git a/go.mod b/go.mod index 2518648..84ea6f9 100644 --- a/go.mod +++ b/go.mod @@ -7,13 +7,15 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.9.0 github.com/nsqio/go-nsq v1.1.0 + github.com/shopspring/decimal v1.3.1 + github.com/spf13/cast v1.5.0 github.com/spf13/viper v1.15.0 github.com/swaggo/files v1.0.1 github.com/swaggo/gin-swagger v1.6.0 github.com/swaggo/swag v1.16.1 go.uber.org/zap v1.24.0 golang.org/x/crypto v0.11.0 - google.golang.org/grpc v1.54.0 + google.golang.org/genproto v0.0.0-20230323212658-478b75c54725 gopkg.in/natefinch/lumberjack.v2 v2.2.1 gorm.io/driver/mysql v1.5.0 gorm.io/gorm v1.25.0 @@ -36,7 +38,6 @@ github.com/go-playground/validator/v10 v10.14.1 // indirect github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/goccy/go-json v0.10.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect @@ -53,7 +54,6 @@ github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml/v2 v2.0.9 // indirect github.com/spf13/afero v1.9.3 // indirect - github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.4.2 // indirect @@ -66,7 +66,6 @@ golang.org/x/sys v0.10.0 // indirect golang.org/x/text v0.11.0 // indirect golang.org/x/tools v0.11.0 // indirect - google.golang.org/genproto v0.0.0-20230323212658-478b75c54725 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index ffc0ea1..4aa9e74 100644 --- a/go.sum +++ b/go.sum @@ -135,8 +135,6 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -232,6 +230,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= +github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= @@ -593,8 +593,6 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -606,7 +604,6 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -- Gitblit v1.8.0