liujiandao
2023-09-20 49137488b96cb00d3d9e468271a796d5fe2e170a
位置接口开发
8个文件已修改
723 ■■■■ 已修改文件
controllers/location.go 141 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 183 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 183 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
models/location.go 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
models/material.go 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
request/location.go 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/router.go 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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, "参数解析失败,数据类型错误")
        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, "参数解析失败,数据类型错误")
        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, "参数解析失败,数据类型错误")
        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("请选择正确的位置类型")
    }
    if params.ParentId == "" {
        return errors.New("错误参数ParentId")
    }
    if params.CompanyId < 0 {
        return errors.New("错误参数CompanyId")
    }
    return nil
}
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": "可选产品id",
                    "type": "integer"
                    "type": "string"
                },
                "sellExplain": {
                    "description": "销售说明",
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": "可选产品id",
                    "type": "integer"
                    "type": "string"
                },
                "sellExplain": {
                    "description": "销售说明",
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: 可选产品id
        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:
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 {
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:可选产品id" json:"selectProduct"`           //可选产品id
        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:原产地id" json:"originCountryId"`               //原产地id
        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:可选产品id" json:"selectProduct"`        //可选产品id
        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:原产地id" json:"originCountryId"`               //原产地id
        //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 {
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"`
}
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")
@@ -87,12 +98,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