From 8e216cfa89d3bcd6f010376ecb4f2f0e90724ea0 Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期一, 13 十一月 2023 14:38:12 +0800
Subject: [PATCH] 取消接口bug

---
 controllers/product_controller.go |    2 
 controllers/operation.go          |    2 
 docs/swagger.yaml                 |   39 +++++++++++++
 docs/docs.go                      |   65 ++++++++++++++++++++-
 docs/swagger.json                 |   63 ++++++++++++++++++++
 5 files changed, 163 insertions(+), 8 deletions(-)

diff --git a/controllers/operation.go b/controllers/operation.go
index d9b4200..72eaadd 100644
--- a/controllers/operation.go
+++ b/controllers/operation.go
@@ -792,7 +792,7 @@
 		return
 	}
 	operation.Status = constvar.OperationStatus_Cancel
-	if err := models.NewOperationSearch().Save(operation); err != nil {
+	if err := models.NewOperationSearch().SetID(operation.Id).Save(operation); err != nil {
 		util.ResponseFormat(c, code.SaveFail, err.Error())
 		return
 	}
diff --git a/controllers/product_controller.go b/controllers/product_controller.go
index b20a6b5..a7dab0d 100644
--- a/controllers/product_controller.go
+++ b/controllers/product_controller.go
@@ -677,7 +677,7 @@
 		return
 	}
 	operation.Status = constvar.OperationStatus_Cancel
-	if err := models.NewOperationSearch().Save(operation); err != nil {
+	if err := models.NewOperationSearch().SetID(operation.Id).Save(operation); err != nil {
 		util.ResponseFormat(c, code.SaveFail, err.Error())
 		return
 	}
diff --git a/docs/docs.go b/docs/docs.go
index a25619b..2d9e716 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -935,6 +935,34 @@
                 }
             }
         },
+        "/api-wms/v1/operation/cancel/{id}": {
+            "put": {
+                "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/finish/{id}": {
             "put": {
                 "produces": [
@@ -1378,6 +1406,34 @@
                         "schema": {
                             "$ref": "#/definitions/models.ProductCategory"
                         }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "$ref": "#/definitions/util.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/api-wms/v1/product/cancelDisuse/{id}": {
+            "put": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "浜у搧"
+                ],
+                "summary": "鍙栨秷鎶ュ簾",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "id",
+                        "name": "id",
+                        "in": "path",
+                        "required": true
                     }
                 ],
                 "responses": {
@@ -2383,9 +2439,11 @@
                 1,
                 2,
                 3,
-                4
+                4,
+                5
             ],
             "x-enum-comments": {
+                "OperationStatus_Cancel": "瀹屾垚",
                 "OperationStatus_Draft": "鑽夌",
                 "OperationStatus_Finish": "瀹屾垚",
                 "OperationStatus_Ready": "灏辩华",
@@ -2395,7 +2453,8 @@
                 "OperationStatus_Draft",
                 "OperationStatus_Waiting",
                 "OperationStatus_Ready",
-                "OperationStatus_Finish"
+                "OperationStatus_Finish",
+                "OperationStatus_Cancel"
             ]
         },
         "constvar.OrderCreation": {
@@ -4313,8 +4372,6 @@
 	Description:      "",
 	InfoInstanceName: "swagger",
 	SwaggerTemplate:  docTemplate,
-	LeftDelim:        "{{",
-	RightDelim:       "}}",
 }
 
 func init() {
diff --git a/docs/swagger.json b/docs/swagger.json
index 58a7953..61c30f6 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -923,6 +923,34 @@
                 }
             }
         },
+        "/api-wms/v1/operation/cancel/{id}": {
+            "put": {
+                "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/finish/{id}": {
             "put": {
                 "produces": [
@@ -1366,6 +1394,34 @@
                         "schema": {
                             "$ref": "#/definitions/models.ProductCategory"
                         }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "$ref": "#/definitions/util.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/api-wms/v1/product/cancelDisuse/{id}": {
+            "put": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "浜у搧"
+                ],
+                "summary": "鍙栨秷鎶ュ簾",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "id",
+                        "name": "id",
+                        "in": "path",
+                        "required": true
                     }
                 ],
                 "responses": {
@@ -2371,9 +2427,11 @@
                 1,
                 2,
                 3,
-                4
+                4,
+                5
             ],
             "x-enum-comments": {
+                "OperationStatus_Cancel": "瀹屾垚",
                 "OperationStatus_Draft": "鑽夌",
                 "OperationStatus_Finish": "瀹屾垚",
                 "OperationStatus_Ready": "灏辩华",
@@ -2383,7 +2441,8 @@
                 "OperationStatus_Draft",
                 "OperationStatus_Waiting",
                 "OperationStatus_Ready",
-                "OperationStatus_Finish"
+                "OperationStatus_Finish",
+                "OperationStatus_Cancel"
             ]
         },
         "constvar.OrderCreation": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 00a3b09..7346a4a 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -136,8 +136,10 @@
     - 2
     - 3
     - 4
+    - 5
     type: integer
     x-enum-comments:
+      OperationStatus_Cancel: 瀹屾垚
       OperationStatus_Draft: 鑽夌
       OperationStatus_Finish: 瀹屾垚
       OperationStatus_Ready: 灏辩华
@@ -147,6 +149,7 @@
     - OperationStatus_Waiting
     - OperationStatus_Ready
     - OperationStatus_Finish
+    - OperationStatus_Cancel
   constvar.OrderCreation:
     enum:
     - 1
@@ -2042,6 +2045,24 @@
       summary: 淇敼搴撳瓨鐩樼偣淇℃伅
       tags:
       - 搴撳瓨鐩樼偣
+  /api-wms/v1/operation/cancel/{id}:
+    put:
+      parameters:
+      - description: id
+        in: path
+        name: id
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 鎴愬姛
+          schema:
+            $ref: '#/definitions/util.Response'
+      summary: 鍙栨秷
+      tags:
+      - 鍏ュ簱/鍑哄簱
   /api-wms/v1/operation/finish/{id}:
     put:
       parameters:
@@ -2329,6 +2350,24 @@
       summary: 娣诲姞浜у搧绫诲瀷
       tags:
       - 浜у搧绫诲瀷
+  /api-wms/v1/product/cancelDisuse/{id}:
+    put:
+      parameters:
+      - description: id
+        in: path
+        name: id
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 鎴愬姛
+          schema:
+            $ref: '#/definitions/util.Response'
+      summary: 鍙栨秷鎶ュ簾
+      tags:
+      - 浜у搧
   /api-wms/v1/product/deleteProduct/{id}:
     delete:
       parameters:

--
Gitblit v1.8.0