From 7539ba3aa1ce089442433dd98c86794bee62198f Mon Sep 17 00:00:00 2001 From: jiangshuai <291802688@qq.com> Date: 星期四, 21 九月 2023 19:30:01 +0800 Subject: [PATCH] 1.出入库一部分代码 --- controllers/operation.go | 4 docs/swagger.yaml | 35 ++++++-- docs/docs.go | 99 +++++++++++++++--------- docs/swagger.json | 99 +++++++++++++++--------- 4 files changed, 150 insertions(+), 87 deletions(-) diff --git a/controllers/operation.go b/controllers/operation.go index 32d16bb..11cbd9c 100644 --- a/controllers/operation.go +++ b/controllers/operation.go @@ -294,7 +294,7 @@ return err } if operationType.BaseOperationType == constvar.BaseOperationTypeIncoming { - if err := models.NewMaterialSearch().Orm.Exec("update material INNER JOIN wms_operation_details on wms_operation_details.product_id=material.id INNER JOIN wms_operation on wms_operation.id=wms_operation_details.operation_id set material.amount=material.amount + wms_operation_details.quantity where wms_operation.id=?", id).Error; err != nil { + if err := models.NewMaterialSearch().Orm.Exec("update material INNER JOIN wms_operation_details on wms_operation_details.product_id=material.id INNER JOIN wms_operation on wms_operation.id=wms_operation_details.operation_id set material.amount=material.amount + wms_operation_details.amount where wms_operation.id=?", id).Error; err != nil { return err } } else if operationType.BaseOperationType == constvar.BaseOperationTypeOutgoing { @@ -321,7 +321,7 @@ } } } - if err := models.NewMaterialSearch().Orm.Exec("update material INNER JOIN wms_operation_details on wms_operation_details.product_id=material.id INNER JOIN wms_operation on wms_operation.id=wms_operation_details.operation_id set material.amount=material.amount - wms_operation_details.quantity where wms_operation.id=?", id).Error; err != nil { + if err := models.NewMaterialSearch().Orm.Exec("update material INNER JOIN wms_operation_details on wms_operation_details.product_id=material.id INNER JOIN wms_operation on wms_operation.id=wms_operation_details.operation_id set material.amount=material.amount - wms_operation_details.amount where wms_operation.id=?", id).Error; err != nil { return err } } diff --git a/docs/docs.go b/docs/docs.go index 0e06838..dc2974b 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -565,7 +565,35 @@ } }, "/api-wms/v1/operation/operation/{id}": { - "put": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "鍏ュ簱/鍑哄簱" + ], + "summary": "鍒犻櫎鍏ュ簱/鍑哄簱淇℃伅", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/util.Response" + } + } + } + } + }, + "/api-wms/v1/operation/update": { + "post": { "produces": [ "application/json" ], @@ -582,39 +610,6 @@ "schema": { "$ref": "#/definitions/request.UpdateOperation" } - }, - { - "type": "integer", - "description": "鍏ュ簱淇℃伅id", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/util.Response" - } - } - } - }, - "delete": { - "produces": [ - "application/json" - ], - "tags": [ - "鍏ュ簱/鍑哄簱" - ], - "summary": "鍒犻櫎鍏ュ簱/鍑哄簱淇℃伅", - "parameters": [ - { - "type": "integer", - "description": "id", - "name": "id", - "in": "path", - "required": true } ], "responses": { @@ -1618,8 +1613,20 @@ "description": "浣嶇疆鍚嶇О", "type": "string" }, + "nextCount": { + "description": "涓嬫鐩樼偣", + "type": "string" + }, + "notes": { + "description": "澶栭儴澶囨敞", + "type": "string" + }, "parentId": { "description": "涓婄骇id", + "type": "string" + }, + "recentlyCount": { + "description": "鏈�杩戠洏鐐�", "type": "string" }, "replenishLocation": { @@ -1893,11 +1900,19 @@ "description": "榛樿婧愪綅缃甶d", "type": "integer" }, + "earlyOperations": { + "description": "棰勫~鍐欎綔涓氳鎯�", + "type": "boolean" + }, "id": { "type": "integer" }, "name": { "description": "浠撳簱鍚嶇О", + "type": "string" + }, + "prefix": { + "description": "鍓嶇紑", "type": "string" }, "printLabel": { @@ -2150,6 +2165,10 @@ "description": "浣滀笟绫诲瀷id", "type": "integer" }, + "operationTypeName": { + "description": "浣滀笟绫诲瀷鍚嶇О", + "type": "string" + }, "sourceNumber": { "description": "婧愬崟鍙�", "type": "string" @@ -2316,6 +2335,10 @@ "description": "鎿嶄綔id", "type": "integer" }, + "amount": { + "description": "鏁伴噺", + "type": "number" + }, "productId": { "description": "浜у搧id", "type": "string" @@ -2323,10 +2346,6 @@ "productName": { "description": "浜у搧鍚嶇О", "type": "string" - }, - "quantity": { - "description": "鏁伴噺", - "type": "number" }, "unit": { "type": "string" @@ -2417,6 +2436,10 @@ "description": "浣滀笟绫诲瀷id", "type": "integer" }, + "operationTypeName": { + "description": "浣滀笟绫诲瀷鍚嶇О", + "type": "string" + }, "sourceNumber": { "description": "婧愬崟鍙�", "type": "string" diff --git a/docs/swagger.json b/docs/swagger.json index e4afa48..54bcd5b 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -553,7 +553,35 @@ } }, "/api-wms/v1/operation/operation/{id}": { - "put": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "鍏ュ簱/鍑哄簱" + ], + "summary": "鍒犻櫎鍏ュ簱/鍑哄簱淇℃伅", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/util.Response" + } + } + } + } + }, + "/api-wms/v1/operation/update": { + "post": { "produces": [ "application/json" ], @@ -570,39 +598,6 @@ "schema": { "$ref": "#/definitions/request.UpdateOperation" } - }, - { - "type": "integer", - "description": "鍏ュ簱淇℃伅id", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/util.Response" - } - } - } - }, - "delete": { - "produces": [ - "application/json" - ], - "tags": [ - "鍏ュ簱/鍑哄簱" - ], - "summary": "鍒犻櫎鍏ュ簱/鍑哄簱淇℃伅", - "parameters": [ - { - "type": "integer", - "description": "id", - "name": "id", - "in": "path", - "required": true } ], "responses": { @@ -1606,8 +1601,20 @@ "description": "浣嶇疆鍚嶇О", "type": "string" }, + "nextCount": { + "description": "涓嬫鐩樼偣", + "type": "string" + }, + "notes": { + "description": "澶栭儴澶囨敞", + "type": "string" + }, "parentId": { "description": "涓婄骇id", + "type": "string" + }, + "recentlyCount": { + "description": "鏈�杩戠洏鐐�", "type": "string" }, "replenishLocation": { @@ -1881,11 +1888,19 @@ "description": "榛樿婧愪綅缃甶d", "type": "integer" }, + "earlyOperations": { + "description": "棰勫~鍐欎綔涓氳鎯�", + "type": "boolean" + }, "id": { "type": "integer" }, "name": { "description": "浠撳簱鍚嶇О", + "type": "string" + }, + "prefix": { + "description": "鍓嶇紑", "type": "string" }, "printLabel": { @@ -2138,6 +2153,10 @@ "description": "浣滀笟绫诲瀷id", "type": "integer" }, + "operationTypeName": { + "description": "浣滀笟绫诲瀷鍚嶇О", + "type": "string" + }, "sourceNumber": { "description": "婧愬崟鍙�", "type": "string" @@ -2304,6 +2323,10 @@ "description": "鎿嶄綔id", "type": "integer" }, + "amount": { + "description": "鏁伴噺", + "type": "number" + }, "productId": { "description": "浜у搧id", "type": "string" @@ -2311,10 +2334,6 @@ "productName": { "description": "浜у搧鍚嶇О", "type": "string" - }, - "quantity": { - "description": "鏁伴噺", - "type": "number" }, "unit": { "type": "string" @@ -2405,6 +2424,10 @@ "description": "浣滀笟绫诲瀷id", "type": "integer" }, + "operationTypeName": { + "description": "浣滀笟绫诲瀷鍚嶇О", + "type": "string" + }, "sourceNumber": { "description": "婧愬崟鍙�", "type": "string" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 34d9940..ef9f62c 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -244,8 +244,17 @@ name: description: 浣嶇疆鍚嶇О type: string + nextCount: + description: 涓嬫鐩樼偣 + type: string + notes: + description: 澶栭儴澶囨敞 + type: string parentId: description: 涓婄骇id + type: string + recentlyCount: + description: 鏈�杩戠洏鐐� type: string replenishLocation: description: 鏄惁琛ュ厖浣嶇疆 @@ -442,10 +451,16 @@ defaultLocationSrcId: description: 榛樿婧愪綅缃甶d type: integer + earlyOperations: + description: 棰勫~鍐欎綔涓氳鎯� + type: boolean id: type: integer name: description: 浠撳簱鍚嶇О + type: string + prefix: + description: 鍓嶇紑 type: string printLabel: description: 鏄惁鎵撳嵃鏍囩 @@ -618,6 +633,9 @@ operationTypeId: description: 浣滀笟绫诲瀷id type: integer + operationTypeName: + description: 浣滀笟绫诲瀷鍚嶇О + type: string sourceNumber: description: 婧愬崟鍙� type: string @@ -731,15 +749,15 @@ OperationId: description: 鎿嶄綔id type: integer + amount: + description: 鏁伴噺 + type: number productId: description: 浜у搧id type: string productName: description: 浜у搧鍚嶇О type: string - quantity: - description: 鏁伴噺 - type: number unit: type: string type: object @@ -803,6 +821,9 @@ operationTypeId: description: 浣滀笟绫诲瀷id type: integer + operationTypeName: + description: 浣滀笟绫诲瀷鍚嶇О + type: string sourceNumber: description: 婧愬崟鍙� type: string @@ -1244,7 +1265,8 @@ summary: 鍒犻櫎鍏ュ簱/鍑哄簱淇℃伅 tags: - 鍏ュ簱/鍑哄簱 - put: + /api-wms/v1/operation/update: + post: parameters: - description: 鍏ュ簱淇℃伅 in: body @@ -1252,11 +1274,6 @@ required: true schema: $ref: '#/definitions/request.UpdateOperation' - - description: 鍏ュ簱淇℃伅id - in: path - name: id - required: true - type: integer produces: - application/json responses: -- Gitblit v1.8.0