From 5adf6ad89a4df69aa169beab89ca5afc738adfa4 Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期三, 20 九月 2023 19:36:53 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS

---
 models/location.go      |   21 
 models/material.go      |   62 ++--
 docs/swagger.yaml       |  111 ++++++++
 controllers/location.go |  141 ++++++++--
 docs/docs.go            |  183 ++++++++++++++
 docs/swagger.json       |  183 ++++++++++++++
 request/location.go     |    5 
 router/router.go        |   17 
 8 files changed, 648 insertions(+), 75 deletions(-)

diff --git a/controllers/location.go b/controllers/location.go
index c4f3002..421958b 100644
--- a/controllers/location.go
+++ b/controllers/location.go
@@ -3,6 +3,7 @@
 import (
 	"errors"
 	"github.com/gin-gonic/gin"
+	"strconv"
 	"wms/extend/code"
 	"wms/extend/util"
 	"wms/models"
@@ -12,42 +13,130 @@
 type LocationController struct {
 }
 
-func (slf LocationController) ListLocationByType(c *gin.Context) {
-	var params request.LocationByType
+// AddLocation
+// @Tags      浣嶇疆
+// @Summary   娣诲姞浣嶇疆淇℃伅
+// @Produce   application/json
+// @Param     object  body  models.Location true  "浣嶇疆淇℃伅"
+// @Success   200 {object} util.Response "鎴愬姛"
+// @Router    /api-wms/v1/location/addLocation [post]
+func (slf LocationController) AddLocation(c *gin.Context) {
+	var params models.Location
 	if err := c.BindJSON(&params); err != nil {
-		util.ResponseFormat(c, code.RequestParamError, "鍙傛暟缁戝畾澶辫触")
+		util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�")
 		return
 	}
-	if err := slf.CheckLocationByTypeParams(params); err != nil {
-		util.ResponseFormat(c, code.RequestParamError, err.Error())
+	if err := slf.CheckLocation(params); err != nil {
+		util.ResponseFormat(c, code.RequestParamError, err)
+		return
 	}
-	search := models.NewLocationSearch()
-	search.SetType(params.Type)
-	if params.Keyword != "" {
-		search.SetKeyword(params.Keyword)
-	}
-	if params.ParentId != "" {
-		search.SetParentId(params.ParentId)
-	}
-	if params.CompanyId != 0 {
-		search.SetCompanyId(params.CompanyId)
-	}
-	res, err := search.SetOrder("created_at desc").FindAll()
+	err := models.NewLocationSearch().Create(&params)
 	if err != nil {
-		util.ResponseFormat(c, code.RequestError, err.Error())
+		util.ResponseFormat(c, code.RequestParamError, "鍒涘缓澶辫触")
+		return
 	}
-	util.ResponseFormat(c, code.Success, res)
+	util.ResponseFormat(c, code.RequestParamError, "鍒涘缓鎴愬姛")
 }
 
-func (slf LocationController) CheckLocationByTypeParams(params request.LocationByType) error {
+// GetLocationList
+// @Tags      浣嶇疆
+// @Summary   鑾峰彇浣嶇疆鍒楄〃
+// @Produce   application/json
+// @Param     object  body  request.GetProductList true  "鏌ヨ鍙傛暟"
+// @Success   200 {object} util.ResponseList{data=[]models.Location}	"鎴愬姛"
+// @Router    /api-wms/v1/location/getLocationList [post]
+func (slf LocationController) GetLocationList(c *gin.Context) {
+	var params request.GetLocationList
+	if err := c.BindJSON(&params); err != nil {
+		util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�")
+		return
+	}
+	search := models.NewLocationSearch()
+	if params.PageInfo.Check() {
+		search.SetPage(params.Page, params.PageSize)
+	}
+	list, total, err := search.SetKeyword(params.KeyWord).SetOrder("created_at desc").Find()
+	if err != nil {
+		util.ResponseFormat(c, code.RequestParamError, "鏌ユ壘澶辫触")
+		return
+	}
+
+	util.ResponseFormatList(c, code.Success, list, int(total))
+}
+
+// GetLocationDetails
+// @Tags      浣嶇疆
+// @Summary   鑾峰彇浣嶇疆璇︽儏
+// @Produce   application/json
+// @Param		id	path		string			true	"id"  "鏌ヨ鍙傛暟"
+// @Success   200 {object} util.Response{data=models.Location}	"鎴愬姛"
+// @Router    /api-wms/v1/location/getLocationDetails/{id} [get]
+func (slf LocationController) GetLocationDetails(c *gin.Context) {
+	id, _ := strconv.Atoi(c.Param("id"))
+	if id == 0 {
+		util.ResponseFormat(c, code.RequestParamError, "鏃犳晥id")
+		return
+	}
+	location, err := models.NewLocationSearch().SetID(id).First()
+	if err != nil {
+		util.ResponseFormat(c, code.RequestParamError, "鏌ユ壘澶辫触")
+		return
+	}
+	util.ResponseFormat(c, code.Success, location)
+}
+
+// UpdateLocation
+// @Tags      浣嶇疆
+// @Summary   淇敼浣嶇疆
+// @Produce   application/json
+// @Param     object  body  models.Location true  "浜у搧淇℃伅"
+// @Success   200 {object} util.Response "鎴愬姛"
+// @Router    /api-wms/v1/location/updateLocation [post]
+func (slf LocationController) UpdateLocation(c *gin.Context) {
+	var params models.Location
+	if err := c.BindJSON(&params); err != nil {
+		util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�")
+		return
+	}
+	if err := slf.CheckLocation(params); err != nil {
+		util.ResponseFormat(c, code.RequestParamError, err)
+		return
+	}
+	err := models.NewLocationSearch().Update(&params)
+	if err != nil {
+		util.ResponseFormat(c, code.RequestParamError, "浣嶇疆淇℃伅鏇存柊澶辫触")
+		return
+	}
+	util.ResponseFormat(c, code.Success, "鏇存柊鎴愬姛")
+}
+
+// DeleteLocation
+// @Tags      浣嶇疆
+// @Summary   鍒犻櫎浣嶇疆
+// @Produce   application/json
+// @Param		id	path		string			true	"id"  "鏌ヨ鍙傛暟"
+// @Success   200 {object} util.Response "鎴愬姛"
+// @Router    /api-wms/v1/location/deleteLocation/{id} [delete]
+func (slf LocationController) DeleteLocation(c *gin.Context) {
+	id, _ := strconv.Atoi(c.Param("id"))
+	if id == 0 {
+		util.ResponseFormat(c, code.RequestParamError, "鏃犳晥id")
+		return
+	}
+	err := models.NewLocationSearch().SetID(id).Delete()
+	if err != nil {
+		util.ResponseFormat(c, code.RequestParamError, "鍒犻櫎澶辫触")
+		return
+	}
+	util.ResponseFormat(c, code.Success, "鍒犻櫎鎴愬姛")
+}
+
+func (slf LocationController) CheckLocation(params models.Location) error {
+	if params.Name == "" {
+		return errors.New("鍚嶇О涓嶈兘涓虹┖")
+	}
 	if params.Type == 0 {
 		return errors.New("璇烽�夋嫨姝g‘鐨勪綅缃被鍨�")
-	}
-	if params.ParentId == "" {
-		return errors.New("閿欒鍙傛暟ParentId")
-	}
-	if params.CompanyId < 0 {
-		return errors.New("閿欒鍙傛暟CompanyId")
 	}
 	return nil
 }
diff --git a/docs/docs.go b/docs/docs.go
index f67d02f..e0a89ae 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -294,6 +294,179 @@
                 }
             }
         },
+        "/api-wms/v1/location/addLocation": {
+            "post": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "浣嶇疆"
+                ],
+                "summary": "娣诲姞浣嶇疆淇℃伅",
+                "parameters": [
+                    {
+                        "description": "浣嶇疆淇℃伅",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.Location"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "$ref": "#/definitions/util.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/api-wms/v1/location/deleteLocation/{id}": {
+            "delete": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "浣嶇疆"
+                ],
+                "summary": "鍒犻櫎浣嶇疆",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "path",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "$ref": "#/definitions/util.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/api-wms/v1/location/getLocationDetails/{id}": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "浣嶇疆"
+                ],
+                "summary": "鑾峰彇浣嶇疆璇︽儏",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "path",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/util.Response"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/models.Location"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
+        "/api-wms/v1/location/getLocationList": {
+            "post": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "浣嶇疆"
+                ],
+                "summary": "鑾峰彇浣嶇疆鍒楄〃",
+                "parameters": [
+                    {
+                        "description": "鏌ヨ鍙傛暟",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/request.GetProductList"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/util.ResponseList"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/definitions/models.Location"
+                                            }
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
+        "/api-wms/v1/location/updateLocation": {
+            "post": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "浣嶇疆"
+                ],
+                "summary": "淇敼浣嶇疆",
+                "parameters": [
+                    {
+                        "description": "浜у搧淇℃伅",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.Location"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "$ref": "#/definitions/util.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/api-wms/v1/operation/operation": {
             "get": {
                 "consumes": [
@@ -1402,6 +1575,14 @@
                 "createTime": {
                     "type": "string"
                 },
+                "forceRemovalStrategy": {
+                    "description": "涓嬫灦绛栫暐",
+                    "allOf": [
+                        {
+                            "$ref": "#/definitions/constvar.ForceRemovalStrategy"
+                        }
+                    ]
+                },
                 "id": {
                     "type": "integer"
                 },
@@ -1606,7 +1787,7 @@
                 },
                 "selectProduct": {
                     "description": "鍙�変骇鍝乮d",
-                    "type": "integer"
+                    "type": "string"
                 },
                 "sellExplain": {
                     "description": "閿�鍞鏄�",
diff --git a/docs/swagger.json b/docs/swagger.json
index db0828c..03e6f9a 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -282,6 +282,179 @@
                 }
             }
         },
+        "/api-wms/v1/location/addLocation": {
+            "post": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "浣嶇疆"
+                ],
+                "summary": "娣诲姞浣嶇疆淇℃伅",
+                "parameters": [
+                    {
+                        "description": "浣嶇疆淇℃伅",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.Location"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "$ref": "#/definitions/util.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/api-wms/v1/location/deleteLocation/{id}": {
+            "delete": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "浣嶇疆"
+                ],
+                "summary": "鍒犻櫎浣嶇疆",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "path",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "$ref": "#/definitions/util.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/api-wms/v1/location/getLocationDetails/{id}": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "浣嶇疆"
+                ],
+                "summary": "鑾峰彇浣嶇疆璇︽儏",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "id",
+                        "name": "id",
+                        "in": "path",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/util.Response"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/models.Location"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
+        "/api-wms/v1/location/getLocationList": {
+            "post": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "浣嶇疆"
+                ],
+                "summary": "鑾峰彇浣嶇疆鍒楄〃",
+                "parameters": [
+                    {
+                        "description": "鏌ヨ鍙傛暟",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/request.GetProductList"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/util.ResponseList"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/definitions/models.Location"
+                                            }
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
+        "/api-wms/v1/location/updateLocation": {
+            "post": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "浣嶇疆"
+                ],
+                "summary": "淇敼浣嶇疆",
+                "parameters": [
+                    {
+                        "description": "浜у搧淇℃伅",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.Location"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "$ref": "#/definitions/util.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/api-wms/v1/operation/operation": {
             "get": {
                 "consumes": [
@@ -1390,6 +1563,14 @@
                 "createTime": {
                     "type": "string"
                 },
+                "forceRemovalStrategy": {
+                    "description": "涓嬫灦绛栫暐",
+                    "allOf": [
+                        {
+                            "$ref": "#/definitions/constvar.ForceRemovalStrategy"
+                        }
+                    ]
+                },
                 "id": {
                     "type": "integer"
                 },
@@ -1594,7 +1775,7 @@
                 },
                 "selectProduct": {
                     "description": "鍙�変骇鍝乮d",
-                    "type": "integer"
+                    "type": "string"
                 },
                 "sellExplain": {
                     "description": "閿�鍞鏄�",
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index a30050d..0294966 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -233,6 +233,10 @@
         type: integer
       createTime:
         type: string
+      forceRemovalStrategy:
+        allOf:
+        - $ref: '#/definitions/constvar.ForceRemovalStrategy'
+        description: 涓嬫灦绛栫暐
       id:
         type: integer
       isReturnLocation:
@@ -381,7 +385,7 @@
         type: number
       selectProduct:
         description: 鍙�変骇鍝乮d
-        type: integer
+        type: string
       sellExplain:
         description: 閿�鍞鏄�
         type: string
@@ -1060,6 +1064,111 @@
       summary: 缂栬緫鍏徃
       tags:
       - 鍏徃
+  /api-wms/v1/location/addLocation:
+    post:
+      parameters:
+      - description: 浣嶇疆淇℃伅
+        in: body
+        name: object
+        required: true
+        schema:
+          $ref: '#/definitions/models.Location'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 鎴愬姛
+          schema:
+            $ref: '#/definitions/util.Response'
+      summary: 娣诲姞浣嶇疆淇℃伅
+      tags:
+      - 浣嶇疆
+  /api-wms/v1/location/deleteLocation/{id}:
+    delete:
+      parameters:
+      - description: id
+        in: path
+        name: id
+        required: true
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 鎴愬姛
+          schema:
+            $ref: '#/definitions/util.Response'
+      summary: 鍒犻櫎浣嶇疆
+      tags:
+      - 浣嶇疆
+  /api-wms/v1/location/getLocationDetails/{id}:
+    get:
+      parameters:
+      - description: id
+        in: path
+        name: id
+        required: true
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 鎴愬姛
+          schema:
+            allOf:
+            - $ref: '#/definitions/util.Response'
+            - properties:
+                data:
+                  $ref: '#/definitions/models.Location'
+              type: object
+      summary: 鑾峰彇浣嶇疆璇︽儏
+      tags:
+      - 浣嶇疆
+  /api-wms/v1/location/getLocationList:
+    post:
+      parameters:
+      - description: 鏌ヨ鍙傛暟
+        in: body
+        name: object
+        required: true
+        schema:
+          $ref: '#/definitions/request.GetProductList'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 鎴愬姛
+          schema:
+            allOf:
+            - $ref: '#/definitions/util.ResponseList'
+            - properties:
+                data:
+                  items:
+                    $ref: '#/definitions/models.Location'
+                  type: array
+              type: object
+      summary: 鑾峰彇浣嶇疆鍒楄〃
+      tags:
+      - 浣嶇疆
+  /api-wms/v1/location/updateLocation:
+    post:
+      parameters:
+      - description: 浜у搧淇℃伅
+        in: body
+        name: object
+        required: true
+        schema:
+          $ref: '#/definitions/models.Location'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 鎴愬姛
+          schema:
+            $ref: '#/definitions/util.Response'
+      summary: 淇敼浣嶇疆
+      tags:
+      - 浣嶇疆
   /api-wms/v1/operation/operation:
     get:
       consumes:
diff --git a/models/location.go b/models/location.go
index a11b1a9..4c0338c 100644
--- a/models/location.go
+++ b/models/location.go
@@ -11,16 +11,17 @@
 	// Location 浣嶇疆
 	Location struct {
 		WmsModel
-		Id                int                   `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
-		Name              string                `json:"name" gorm:"index;type:varchar(255);not null;comment:浣嶇疆鍚嶇О"` //浣嶇疆鍚嶇О
-		ParentId          string                `json:"parentId" gorm:"type:varchar(255)"`                         //涓婄骇id
-		CompanyId         int                   `json:"companyId" gorm:"type:int"`                                 //鍏徃id
-		Company           Company               `json:"company" gorm:"foreignKey:CompanyId"`                       //鍏徃
-		Type              constvar.LocationType `json:"type" gorm:"type:int(11);comment:浣嶇疆绫诲瀷"`                     //浣嶇疆绫诲瀷
-		CountFrequency    int                   `json:"countFrequency" gorm:"type:tinyint;comment:鐩樼偣棰戠巼锛堝ぉ锛�"`        //鐩樼偣棰戠巼锛堝ぉ锛�
-		IsScrapLocation   bool                  `json:"isScrapLocation" gorm:"type:tinyint;comment:鏄惁鎶ュ簾浣嶇疆"`        //鏄惁鎶ュ簾浣嶇疆
-		IsReturnLocation  bool                  `json:"isReturnLocation" gorm:"type:tinyint;comment:鏄惁閫�璐т綅缃�"`       //鏄惁閫�璐т綅缃�
-		ReplenishLocation bool                  `json:"replenishLocation" gorm:"type:tinyint;comment:鏄惁琛ュ厖浣嶇疆"`      //鏄惁琛ュ厖浣嶇疆
+		Id                   int                           `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
+		Name                 string                        `json:"name" gorm:"index;type:varchar(255);not null;comment:浣嶇疆鍚嶇О"` //浣嶇疆鍚嶇О
+		ParentId             string                        `json:"parentId" gorm:"type:varchar(255)"`                         //涓婄骇id
+		CompanyId            int                           `json:"companyId" gorm:"type:int"`                                 //鍏徃id
+		Company              Company                       `json:"company" gorm:"foreignKey:CompanyId"`                       //鍏徃
+		Type                 constvar.LocationType         `json:"type" gorm:"type:int(11);comment:浣嶇疆绫诲瀷"`                     //浣嶇疆绫诲瀷
+		CountFrequency       int                           `json:"countFrequency" gorm:"type:tinyint;comment:鐩樼偣棰戠巼锛堝ぉ锛�"`        //鐩樼偣棰戠巼锛堝ぉ锛�
+		IsScrapLocation      bool                          `json:"isScrapLocation" gorm:"type:tinyint;comment:鏄惁鎶ュ簾浣嶇疆"`        //鏄惁鎶ュ簾浣嶇疆
+		IsReturnLocation     bool                          `json:"isReturnLocation" gorm:"type:tinyint;comment:鏄惁閫�璐т綅缃�"`       //鏄惁閫�璐т綅缃�
+		ReplenishLocation    bool                          `json:"replenishLocation" gorm:"type:tinyint;comment:鏄惁琛ュ厖浣嶇疆"`      //鏄惁琛ュ厖浣嶇疆
+		ForceRemovalStrategy constvar.ForceRemovalStrategy `json:"forceRemovalStrategy" gorm:"type:tinyint;comment:涓嬫灦绛栫暐"`     //涓嬫灦绛栫暐
 	}
 
 	LocationSearch struct {
diff --git a/models/material.go b/models/material.go
index 8d9a4ee..d8098fd 100644
--- a/models/material.go
+++ b/models/material.go
@@ -38,36 +38,38 @@
 		SalePrice decimal.Decimal `gorm:"type:decimal(35,18);comment:閿�鍞崟浠�" json:"salePrice"` //閿�鍞崟浠�
 		AutoIncr  uint            `gorm:"type:int(11);comment:鑷ID;default:0;" json:"-"`
 		//wms娣诲姞瀛楁
-		ProductType             constvar.ProductType       `gorm:"type:int(11);comment:浜у搧绫诲瀷" json:"productType"`                    //浜у搧绫诲瀷
-		InvoicingStrategy       constvar.InvoicingStrategy `gorm:"type:int(11);comment:寮�绁ㄧ瓥鐣�" json:"invoicingStrategy"`              //寮�绁ㄧ瓥鐣�
-		OrderCreation           constvar.OrderCreation     `gorm:"type:int(11);comment:璁㈠崟鍒涘缓" json:"orderCreation"`                  //璁㈠崟鍒涘缓
-		CustomerTaxes           decimal.Decimal            `gorm:"type:decimal(20,2);comment:瀹㈡埛绋�" json:"customerTaxes"`             //瀹㈡埛绋庣櫨鍒嗘瘮
-		Cost                    decimal.Decimal            `gorm:"type:decimal(20,2);comment:鎴愭湰" json:"cost"`                       //鎴愭湰
-		CategoryId              int                        `gorm:"type:int(11);comment:浜у搧绫诲埆id" json:"categoryId"`                   //浜у搧绫诲埆id
-		CategoryName            string                     `gorm:"type:varchar(255);comment:浜у搧绫诲埆鍚嶇О" json:"categoryName"`            //浜у搧绫诲埆鍚嶇О
-		InternalReference       string                     `gorm:"type:varchar(255);comment:鍐呴儴鍙傝��" json:"internalReference"`         //鍐呴儴鍙傝��
-		Barcode                 string                     `gorm:"type:varchar(255);comment:鏉$爜" json:"barcode"`                     //鏉$爜
-		ProductTagId            int                        `gorm:"type:int(11);comment:浜у搧鏍囩id" json:"productTagId"`                 //浜у搧鏍囩id
-		ProductTagName          string                     `gorm:"type:varchar(255);comment:浜у搧鏍囩鍚嶇О" json:"productTagName"`          //浜у搧鏍囩鍚嶇О
-		CompanyId               int                        `gorm:"type:int(11);comment:鍏徃id" json:"companyId"`                      //鍏徃id
-		CompanyName             string                     `gorm:"type:varchar(255);comment:鍏徃鍚嶇О" json:"companyName"`               //鍏徃鍚嶇О
-		InternalNotes           string                     `gorm:"type:varchar(512);comment:鍐呴儴璇存槑" json:"internalNotes"`             //鍐呴儴璇存槑
-		SelectProduct           string                     `gorm:"type:varchar(255);comment:鍙�変骇鍝乮d" json:"selectProduct"`           //鍙�変骇鍝乮d
-		SellExplain             string                     `gorm:"type:varchar(512);comment:閿�鍞鏄�" json:"sellExplain"`               //閿�鍞鏄�
-		CanBePurchased          bool                       `gorm:"type:int(11);comment:鏄惁鍙噰璐�" json:"canBePurchased"`                //鏄惁鍙噰璐�
-		CurrencyName            string                     `gorm:"type:varchar(255);comment:甯佺鍚嶇О" json:"currencyName"`              //甯佺鍚嶇О
-		DeliveryAdvanceTime     int                        `gorm:"type:int(11);comment:浜よ揣鎻愬墠鏃堕棿(澶�)" json:"deliveryAdvanceTime"`       //浜よ揣鎻愬墠鏃堕棿(澶�)
-		ControlStrategy         constvar.InvoicingStrategy `gorm:"type:int(11);comment:鎺у埗绛栫暐" json:"controlStrategy"`                //鎺у埗绛栫暐
-		BuyExplain              string                     `gorm:"type:varchar(512);comment:閲囪喘璇存槑" json:"buyExplain"`                //閲囪喘璇存槑
-		Principal               string                     `gorm:"type:varchar(255);comment:璐熻矗浜�" json:"principal"`                  //璐熻矗浜�
-		Weight                  decimal.Decimal            `gorm:"type:decimal(20,2);comment:閲嶉噺" json:"weight"`                     //閲嶉噺
-		Volume                  decimal.Decimal            `gorm:"type:decimal(20,2);comment:浣撶Н" json:"volume"`                     //浣撶Н
-		HSCode                  string                     `gorm:"type:varchar(255);comment:HS缂栫爜" json:"HSCode"`                    //HS缂栫爜
-		OriginCountryId         int                        `gorm:"type:int(11);comment:鍘熶骇鍦癷d" json:"originCountryId"`               //鍘熶骇鍦癷d
-		OriginCountryName       string                     `gorm:"type:varchar(255);comment:鍘熶骇鍦板悕绉�" json:"originCountryName"`        //鍘熶骇鍦板悕绉�
-		InStorageExplain        string                     `gorm:"type:varchar(512);comment:鍏ュ簱璇存槑" json:"inStorageExplain"`          //鍏ュ簱璇存槑
-		OutStorageExplain       string                     `gorm:"type:varchar(512);comment:鍑哄簱璇存槑" json:"outStorageExplain"`         //鍑哄簱璇存槑
-		InternalTransferExplain string                     `gorm:"type:varchar(512);comment:鍐呴儴璋冩嫧璇存槑" json:"internalTransferExplain"` //鍐呴儴璋冩嫧璇存槑
+		ProductType         constvar.ProductType       `gorm:"type:int(11);comment:浜у搧绫诲瀷" json:"productType"`                 //浜у搧绫诲瀷
+		InvoicingStrategy   constvar.InvoicingStrategy `gorm:"type:int(11);comment:寮�绁ㄧ瓥鐣�" json:"invoicingStrategy"`           //寮�绁ㄧ瓥鐣�
+		OrderCreation       constvar.OrderCreation     `gorm:"type:int(11);comment:璁㈠崟鍒涘缓" json:"orderCreation"`               //璁㈠崟鍒涘缓
+		CustomerTaxes       decimal.Decimal            `gorm:"type:decimal(20,2);comment:瀹㈡埛绋�" json:"customerTaxes"`          //瀹㈡埛绋庣櫨鍒嗘瘮
+		Cost                decimal.Decimal            `gorm:"type:decimal(20,2);comment:鎴愭湰" json:"cost"`                    //鎴愭湰
+		CategoryId          int                        `gorm:"type:int(11);comment:浜у搧绫诲埆id" json:"categoryId"`                //浜у搧绫诲埆id
+		CategoryName        string                     `gorm:"type:varchar(255);comment:浜у搧绫诲埆鍚嶇О" json:"categoryName"`         //浜у搧绫诲埆鍚嶇О
+		InternalReference   string                     `gorm:"type:varchar(255);comment:鍐呴儴鍙傝��" json:"internalReference"`      //鍐呴儴鍙傝��
+		Barcode             string                     `gorm:"type:varchar(255);comment:鏉$爜" json:"barcode"`                  //鏉$爜
+		ProductTagId        int                        `gorm:"type:int(11);comment:浜у搧鏍囩id" json:"productTagId"`              //浜у搧鏍囩id
+		ProductTagName      string                     `gorm:"type:varchar(255);comment:浜у搧鏍囩鍚嶇О" json:"productTagName"`       //浜у搧鏍囩鍚嶇О
+		CompanyId           int                        `gorm:"type:int(11);comment:鍏徃id" json:"companyId"`                   //鍏徃id
+		CompanyName         string                     `gorm:"type:varchar(255);comment:鍏徃鍚嶇О" json:"companyName"`            //鍏徃鍚嶇О
+		InternalNotes       string                     `gorm:"type:varchar(512);comment:鍐呴儴璇存槑" json:"internalNotes"`          //鍐呴儴璇存槑
+		SelectProduct       string                     `gorm:"type:varchar(255);comment:鍙�変骇鍝乮d" json:"selectProduct"`        //鍙�変骇鍝乮d
+		SellExplain         string                     `gorm:"type:varchar(512);comment:閿�鍞鏄�" json:"sellExplain"`            //閿�鍞鏄�
+		CanBePurchased      bool                       `gorm:"type:int(11);comment:鏄惁鍙噰璐�" json:"canBePurchased"`             //鏄惁鍙噰璐�
+		CurrencyName        string                     `gorm:"type:varchar(255);comment:甯佺鍚嶇О" json:"currencyName"`           //甯佺鍚嶇О
+		ControlStrategy     constvar.InvoicingStrategy `gorm:"type:int(11);comment:鎺у埗绛栫暐" json:"controlStrategy"`             //鎺у埗绛栫暐
+		BuyExplain          string                     `gorm:"type:varchar(512);comment:閲囪喘璇存槑" json:"buyExplain"`             //閲囪喘璇存槑
+		Principal           string                     `gorm:"type:varchar(255);comment:璐熻矗浜�" json:"principal"`               //璐熻矗浜�
+		Weight              decimal.Decimal            `gorm:"type:decimal(20,2);comment:閲嶉噺" json:"weight"`                  //閲嶉噺
+		Volume              decimal.Decimal            `gorm:"type:decimal(20,2);comment:浣撶Н" json:"volume"`                  //浣撶Н
+		MakeAdvanceTime     decimal.Decimal            `gorm:"type:decimal(20,2);comment:鍒堕�犲墠缃椂闂�" json:"makeAdvanceTime"`     //鍒堕�犲墠缃椂闂�(澶�)
+		OrderAdvanceTime    decimal.Decimal            `gorm:"type:decimal(20,2);comment:璁㈠崟鍑嗗澶╂暟" json:"orderAdvanceTime"`    //璁㈠崟鍑嗗澶╂暟(澶�)
+		DeliveryAdvanceTime decimal.Decimal            `gorm:"type:decimal(20,2);comment:瀹㈡埛鍓嶇疆鏃堕棿" json:"deliveryAdvanceTime"` //瀹㈡埛鍓嶇疆鏃堕棿(澶�)
+		//HSCode                  string                     `gorm:"type:varchar(255);comment:HS缂栫爜" json:"HSCode"`                    //HS缂栫爜
+		//OriginCountryId         int                        `gorm:"type:int(11);comment:鍘熶骇鍦癷d" json:"originCountryId"`               //鍘熶骇鍦癷d
+		//OriginCountryName       string                     `gorm:"type:varchar(255);comment:鍘熶骇鍦板悕绉�" json:"originCountryName"`        //鍘熶骇鍦板悕绉�
+		InStorageExplain        string `gorm:"type:varchar(512);comment:鍏ュ簱璇存槑" json:"inStorageExplain"`          //鍏ュ簱璇存槑
+		OutStorageExplain       string `gorm:"type:varchar(512);comment:鍑哄簱璇存槑" json:"outStorageExplain"`         //鍑哄簱璇存槑
+		InternalTransferExplain string `gorm:"type:varchar(512);comment:鍐呴儴璋冩嫧璇存槑" json:"internalTransferExplain"` //鍐呴儴璋冩嫧璇存槑
 	}
 
 	MaterialSearch struct {
diff --git a/request/location.go b/request/location.go
index f3e9708..ce3e2be 100644
--- a/request/location.go
+++ b/request/location.go
@@ -6,3 +6,8 @@
 	ParentId  string `json:"parentId" form:"parentId"`
 	CompanyId int    `json:"companyId" form:"companyId"`
 }
+
+type GetLocationList struct {
+	PageInfo
+	KeyWord string `json:"keyWord"`
+}
diff --git a/router/router.go b/router/router.go
index 2a98f20..084dc11 100644
--- a/router/router.go
+++ b/router/router.go
@@ -52,6 +52,17 @@
 		warehouseAPI.GET("getWarehouseDetails/:id", warehouseController.GetWarehouseDetails) // 鑾峰彇浠撳簱璇︽儏
 	}
 
+	// 浣嶇疆淇℃伅
+	locationController := new(controllers.LocationController)
+	locationAPI := r.Group(urlPrefix + "/location")
+	{
+		locationAPI.POST("addLocation", locationController.AddLocation)                  //娣诲姞浣嶇疆淇℃伅
+		locationAPI.POST("getLocationList", locationController.GetLocationList)          //鑾峰彇浣嶇疆鍒楄〃
+		locationAPI.POST("updateLocation", locationController.UpdateLocation)            //淇敼浣嶇疆
+		locationAPI.GET("getLocationDetails/:id", locationController.GetLocationDetails) //鑾峰彇浣嶇疆璇︽儏
+		locationAPI.DELETE("deleteLocation/:id", locationController.DeleteLocation)      //鍒犻櫎浣嶇疆
+	}
+
 	// 涓氬姟绫诲瀷
 	operationTypeController := new(controllers.OperationTypeController)
 	operationTypeAPI := r.Group(urlPrefix + "/operationType")
@@ -88,12 +99,6 @@
 		productAPI.GET("getProductCategoryDetails/:id", productController.GetProductCategoryDetails) //鑾峰彇浜у搧绫诲瀷璇︽儏
 		productAPI.POST("updateProductCategory", productController.UpdateProductCategory)            //淇敼浜у搧绫诲瀷
 		productAPI.DELETE("deleteProductCategory/:id", productController.DeleteProductCategory)      //鍒犻櫎浜у搧绫诲瀷
-	}
-
-	locationController := new(controllers.LocationController)
-	locationAPI := r.Group(urlPrefix + "/location")
-	{
-		locationAPI.POST("listByType", locationController.ListLocationByType)
 	}
 
 	return r

--
Gitblit v1.8.0