liujiandao
2023-09-23 79eca4ef507f418b88a0817f43a9ea25750a818a
Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS
11个文件已修改
1975 ■■■■■ 已修改文件
constvar/const.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/operation.go 92 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/product_controller.go 275 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 576 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 574 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 341 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
models/material.go 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
models/operation.go 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
request/operation.go 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
request/product_request.go 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/router.go 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
constvar/const.go
@@ -124,6 +124,7 @@
    LocationTypeInventoryLoss                         // 库存损失
    LocationTypeProduction                            // 生产
    LocationTypeTransit                               // 中转位置
    LocationTypeDisuse
)
func (t LocationType) Valid() bool {
controllers/operation.go
@@ -7,6 +7,7 @@
    "github.com/shopspring/decimal"
    "gorm.io/gorm"
    "strconv"
    "time"
    "wms/constvar"
    "wms/extend/code"
    "wms/extend/util"
@@ -47,6 +48,7 @@
    }
    params.Status = constvar.OperationStatus_Ready
    params.Number = strconv.FormatInt(time.Now().Unix(), 10)
    if err := models.NewOperationSearch().Create(&params); err != nil {
        logx.Errorf("Operation create err: %v", err)
        util.ResponseFormat(c, code.SaveFail, "添加失败:"+err.Error())
@@ -128,13 +130,12 @@
// @Tags      入库/出库
// @Summary   入库/出库列表
// @Produce   application/json
// @Accept      json
// @Param     object  query  request.OperationList true  "参数"
// @Success   200 {object} util.Response "成功"
// @Router    /api-wms/v1/operation/operation [get]
// @Param         object  body  request.OperationList true  "查询参数"
// @Success   200 {object} util.Response    "成功"
// @Router    /api-wms/v1/operation/list [post]
func (slf OperationController) List(c *gin.Context) {
    var params request.OperationList
    if err := c.ShouldBindQuery(&params); err != nil {
    if err := c.BindJSON(&params); err != nil {
        util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误:"+err.Error())
        return
    }
@@ -144,14 +145,19 @@
    }
    search := models.NewOperationSearch()
    search.SetPage(params.Page, params.PageSize)
    if params.Number != "" {
        search.SetNumber(params.Number)
    }
    if params.SourceNumber != "" {
        search.SetSourceNumber(params.SourceNumber)
    }
    list, total, err := search.SetOperationTypeId(params.OperationTypeId).SetPreload(true).SetOrder("created_at desc").Find()
    if err != nil {
        util.ResponseFormat(c, code.RequestError, "查找失败:"+err.Error())
        return
    }
    util.ResponseFormatList(c, code.Success, list, int(total))
    util.ResponseFormatListWithPage(c, code.Success, list, int(total), params.Page, params.PageSize)
}
func (slf OperationController) CheckListParams(params *request.OperationList) error {
@@ -293,11 +299,7 @@
        if err := models.NewOperationSearch().SetOrm(tx).SetID(id).Update(&models.Operation{Status: constvar.OperationStatus_Finish}); err != nil {
            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 {
                return err
            }
        } else if operationType.BaseOperationType == constvar.BaseOperationTypeOutgoing {
        if operationType.BaseOperationType != constvar.BaseOperationTypeInternal {
            var listProdtId []string
            var listProdt []*models.Material
            mapProdt := make(map[string]decimal.Decimal)
@@ -312,18 +314,34 @@
            if err := models.NewMaterialSearch().Orm.Where("id IN ?", listProdtId).Find(&listProdt).Error; err != nil {
                return err
            }
            for _, v := range listProdt {
                if value, ok := mapProdt[v.ID]; !ok {
                    return errors.New("产品种类异常")
                } else {
                    if v.Amount.LessThan(value) {
                        return errors.New(fmt.Sprintf("产品:%v,库存:%v,出库:%v,数量不够,无法完成出库操作", v.Name, v.Amount.String(), value.String()))
            if operationType.BaseOperationType == constvar.BaseOperationTypeIncoming {
                for k, v := range listProdt {
                    if value, ok := mapProdt[v.ID]; !ok {
                        return errors.New("产品种类异常")
                    } else {
                        listProdt[k].Amount = listProdt[k].Amount.Add(value)
                        if err := tx.Save(listProdt[k]).Error; err != nil {
                            return err
                        }
                    }
                }
            }
            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 {
                return err
            if operationType.BaseOperationType == constvar.BaseOperationTypeOutgoing {
                for k, v := range listProdt {
                    if value, ok := mapProdt[v.ID]; !ok {
                        return errors.New("产品种类异常")
                    } else {
                        if v.Amount.LessThan(value) {
                            return errors.New(fmt.Sprintf("产品:%v,库存:%v,出库:%v,数量不够,无法完成出库操作", v.Name, v.Amount.String(), value.String()))
                        }
                        listProdt[k].Amount = listProdt[k].Amount.Sub(value)
                        if err := tx.Save(listProdt[k]).Error; err != nil {
                            return err
                        }
                    }
                }
            }
        }
        return nil
    }); err != nil {
@@ -332,3 +350,37 @@
    }
    util.ResponseFormat(c, code.Success, "操作成功")
}
// ListAll
// @Tags      入库/出库
// @Summary   调拨
// @Produce   application/json
// @Param     object  body  request.OperationAllList true  "参数"
// @Success   200 {object} util.Response "成功"
// @Router    /api-wms/v1/operation/listAll [post]
func (slf OperationController) ListAll(c *gin.Context) {
    var params request.OperationAllList
    if err := c.BindJSON(&params); err != nil {
        util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误:"+err.Error())
        return
    }
    if !params.PageInfo.Check() {
        util.ResponseFormat(c, code.RequestParamError, "数据分页信息错误")
        return
    }
    search := models.NewOperationSearch()
    search.SetPage(params.Page, params.PageSize)
    search.SetPage(params.Page, params.PageSize)
    if params.Number != "" {
        search.SetNumber(params.Number)
    }
    if params.SourceNumber != "" {
        search.SetSourceNumber(params.SourceNumber)
    }
    list, total, err := search.SetPreload(true).SetOrder("created_at desc").Find()
    if err != nil {
        util.ResponseFormat(c, code.RequestError, "查找失败:"+err.Error())
        return
    }
    util.ResponseFormatListWithPage(c, code.Success, list, int(total), params.Page, params.PageSize)
}
controllers/product_controller.go
@@ -1,11 +1,19 @@
package controllers
import (
    "errors"
    "fmt"
    "github.com/gin-gonic/gin"
    "github.com/shopspring/decimal"
    "github.com/spf13/cast"
    "gorm.io/gorm"
    "strconv"
    "time"
    "wms/constvar"
    "wms/extend/code"
    "wms/extend/util"
    "wms/models"
    "wms/pkg/logx"
    "wms/request"
    "wms/utils"
)
@@ -290,3 +298,270 @@
    }
    util.ResponseFormat(c, code.Success, "删除成功")
}
// ListOperation
// @Tags      产品
// @Summary   产品历史出入库信息
// @Produce   application/json
// @Param         object  body  request.QueryOperationList true  "查询参数"
// @Success   200 {object} util.ResponseList{data=[]models.Operation}    "成功"
// @Router    /api-wms/v1/product/listOperaton [post]
func (slf ProductController) ListOperation(c *gin.Context) {
    var params request.QueryOperationList
    if err := c.BindJSON(&params); err != nil {
        util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误:"+err.Error())
        return
    }
    if !params.PageInfo.Check() {
        util.ResponseFormat(c, code.RequestParamError, "页码信息错误")
        return
    }
    search := models.NewOperationSearch().SetPage(params.Page, params.PageSize).SetPreload(true).SetOrder("created_at desc")
    search.SetOrm(search.Orm.InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id").Where("wms_operation_details.product_id=?", params.ProductId))
    list, total, err := search.Find()
    if err != nil {
        util.ResponseFormat(c, code.RequestError, "查找失败:"+err.Error())
        return
    }
    util.ResponseFormatListWithPage(c, code.Success, list, int(total), params.Page, params.PageSize)
}
// AddDisuse
// @Tags      产品
// @Summary   添加报废信息
// @Produce   application/json
// @Param     object  body  request.AddDisuse true  "入库/出库信息"
// @Success   200 {object} util.Response "成功"
// @Router    /api-wms/v1/product/addDisuse [post]
func (slf ProductController) AddDisuse(c *gin.Context) {
    var params request.AddDisuse
    if err := c.BindJSON(&params); err != nil {
        util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误:"+err.Error())
        return
    }
    if params.Amount.LessThanOrEqual(decimal.NewFromInt(0)) {
        util.ResponseFormat(c, code.RequestParamError, "数量异常")
        return
    }
    if params.FromLocationId == 0 {
        util.ResponseFormat(c, code.RequestParamError, "请选择源位置")
        return
    }
    if params.ToLocationId == 0 {
        util.ResponseFormat(c, code.RequestParamError, "请选择报废位置")
        return
    }
    if params.SourceNumber == "" {
        util.ResponseFormat(c, code.RequestParamError, "请输入源单据")
        return
    }
    detail := &models.OperationDetails{
        ProductId:   params.ProductId,
        ProductName: params.ProductName,
        Amount:      params.Amount,
        Unit:        params.Unit,
    }
    operation := models.Operation{
        Number:          strconv.FormatInt(time.Now().Unix(), 10),
        SourceNumber:    params.SourceNumber,
        OperationTypeId: 0,
        Status:          constvar.OperationStatus_Ready,
        FromLocationID:  params.FromLocationId,
        ToLocationID:    params.ToLocationId,
        OperationDate:   time.Now().Format("2006-01-02 15:04:05"),
        Details:         []*models.OperationDetails{detail},
    }
    if err := models.NewOperationSearch().Create(&operation); err != nil {
        logx.Errorf("Operation create err: %v", err)
        util.ResponseFormat(c, code.SaveFail, "添加失败:"+err.Error())
        return
    }
    util.ResponseFormat(c, code.Success, "添加成功")
}
// ListDisuse
// @Tags      产品
// @Summary   报废列表
// @Produce   application/json
// @Param         object  body  request.QueryDisuseList true  "查询参数"
// @Success   200 {object} util.Response    "成功"
// @Router    /api-wms/v1/product/listDisuse [post]
func (slf ProductController) ListDisuse(c *gin.Context) {
    var params request.QueryDisuseList
    if err := c.BindJSON(&params); err != nil {
        util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误:"+err.Error())
        return
    }
    if !params.PageInfo.Check() {
        util.ResponseFormat(c, code.RequestParamError, "数据分页信息错误")
        return
    }
    db := models.NewOperationSearch().Orm.Table("wms_operation").Select("wms_operation.id,wms_operation.number,wms_operation.source_number,wms_operation.status,wms_operation.from_location_id,wms_operation.to_location_id,wms_operation.operation_date,wms_operation.contacter_id,wms_operation.contacter_name,wms_operation.company_id,wms_operation.company_name,wms_operation.comment,wms_operation_details.product_id,wms_operation_details.product_name,wms_operation_details.unit,wms_operation_details.amount").InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id")
    if params.SourceNumber != "" {
        db = db.Where("wms_operation.source_number like ?", fmt.Sprintf("%%%v%%", params.SourceNumber))
    }
    if params.Number != "" {
        db = db.Where("wms_operation.number like ?", fmt.Sprintf("%%%v%%", params.Number))
    }
    db = db.Where("wms_operation.operation_type_id=?", 0)
    var (
        records = make([]*models.ResponseDisuseList, 0)
        total   int64
    )
    //list, total, err := search.SetDisuse(true).SetPreload(true).SetOrder("created_at desc").Find()
    if err := db.Count(&total).Error; err != nil {
        util.ResponseFormat(c, code.RequestError, fmt.Errorf("find count err: %v", err))
        return
    }
    db = db.Preload("ToLocation").Preload("FromLocation")
    if params.Page*params.PageSize > 0 {
        db = db.Offset((params.Page - 1) * params.PageSize).Limit(params.PageSize)
    }
    if err := db.Find(&records).Error; err != nil {
        util.ResponseFormat(c, code.RequestError, fmt.Errorf("find count err: %v", err))
        return
    }
    util.ResponseFormatListWithPage(c, code.Success, records, int(total), params.Page, params.PageSize)
}
// FinishDisuse
//
//    @Tags        产品
//    @Summary    验证报废
//    @Produce    application/json
//    @Param        id    path        int            true    "id"
//    @Success    200    {object}    util.Response    "成功"
//    @Router        /api-wms/v1/product/finishDisuse/{id} [put]
func (slf ProductController) FinishDisuse(c *gin.Context) {
    id, err := strconv.Atoi(c.Param("id"))
    if err != nil {
        util.ResponseFormat(c, code.RequestParamError, "错误的id值")
        return
    }
    if id == 0 {
        util.ResponseFormat(c, code.RequestParamError, "id为0")
        return
    }
    operation, err := models.NewOperationSearch().SetID(id).First()
    if err != nil {
        util.ResponseFormat(c, code.RequestParamError, "未找到相关信息:"+err.Error())
        return
    }
    if operation.Status != constvar.OperationStatus_Ready {
        util.ResponseFormat(c, code.RequestError, "该验证无法完成")
        return
    }
    if err := models.WithTransaction(func(tx *gorm.DB) error {
        if err := models.NewOperationSearch().SetOrm(tx).SetID(id).Update(&models.Operation{Status: constvar.OperationStatus_Finish}); err != nil {
            return err
        }
        var listProdtId []string
        var listProdt []*models.Material
        mapProdt := make(map[string]decimal.Decimal)
        listDetails, err := models.NewOperationDetailsSearch().SetOperationId(operation.Id).FindAll()
        if err != nil {
            return err
        }
        for _, v := range listDetails {
            listProdtId = append(listProdtId, v.ProductId)
            mapProdt[v.ProductId] = v.Amount
        }
        if err := models.NewMaterialSearch().Orm.Where("id IN ?", listProdtId).Find(&listProdt).Error; err != nil {
            return err
        }
        for k, v := range listProdt {
            if value, ok := mapProdt[v.ID]; !ok {
                return errors.New("产品种类异常")
            } else {
                if v.Amount.LessThan(value) {
                    return errors.New(fmt.Sprintf("产品:%v,库存:%v,报废:%v,数量不够,无法完成报废操作", v.Name, v.Amount.String(), value.String()))
                }
                listProdt[k].Amount = listProdt[k].Amount.Sub(value)
                if err := tx.Save(listProdt[k]).Error; err != nil {
                    return err
                }
            }
        }
        return nil
    }); err != nil {
        util.ResponseFormat(c, code.RequestError, err.Error())
        return
    }
    util.ResponseFormat(c, code.Success, "操作成功")
}
// UpdateDisuse
// @Tags      产品
// @Summary   修改报废信息
// @Produce   application/json
// @Param     object  body  request.UpdateDisuse true  "入库/出库信息"
// @Success   200 {object} util.Response "成功"
// @Router    /api-wms/v1/product/updateDisuse [post]
func (slf ProductController) UpdateDisuse(c *gin.Context) {
    var params request.UpdateDisuse
    if err := c.BindJSON(&params); err != nil {
        util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误:"+err.Error())
        return
    }
    if params.Amount.LessThanOrEqual(decimal.NewFromInt(0)) {
        util.ResponseFormat(c, code.RequestParamError, "数量异常")
        return
    }
    if params.FromLocationId == 0 {
        util.ResponseFormat(c, code.RequestParamError, "请选择源位置")
        return
    }
    if params.ToLocationId == 0 {
        util.ResponseFormat(c, code.RequestParamError, "请选择报废位置")
        return
    }
    if params.SourceNumber == "" {
        util.ResponseFormat(c, code.RequestParamError, "请输入源单据")
        return
    }
    if params.Status != constvar.OperationStatus_Ready {
        util.ResponseFormat(c, code.RequestParamError, "该信息无法修改")
        return
    }
    detail := &models.OperationDetails{
        ProductId:   params.ProductId,
        ProductName: params.ProductName,
        Amount:      params.Amount,
        Unit:        params.Unit,
    }
    operation := models.Operation{
        Id:              params.Id,
        Number:          params.Number,
        SourceNumber:    params.SourceNumber,
        OperationTypeId: 0,
        Status:          params.Status,
        FromLocationID:  params.FromLocationId,
        ToLocationID:    params.ToLocationId,
        OperationDate:   params.OperationDate,
        Details:         []*models.OperationDetails{detail},
    }
    if err := models.WithTransaction(func(tx *gorm.DB) error {
        if err := models.NewOperationDetailsSearch().SetOrm(tx).SetOperationId(params.Id).Delete(); err != nil {
            return err
        }
        operationSearch := models.NewOperationSearch().SetOrm(tx)
        if err := operationSearch.Orm.Model(&operation).Association("Details").Replace(operation.Details); err != nil {
            return err
        }
        if err := models.NewOperationSearch().SetOrm(tx).SetID(params.Id).Save(&operation); err != nil {
            return err
        }
        return nil
    }); err != nil {
        util.ResponseFormat(c, code.RequestParamError, "修改失败:"+err.Error())
        return
    }
    util.ResponseFormat(c, code.Success, "添加成功")
}
docs/docs.go
@@ -495,11 +495,8 @@
                }
            }
        },
        "/api-wms/v1/operation/operation": {
            "get": {
                "consumes": [
                    "application/json"
                ],
        "/api-wms/v1/operation/list": {
            "post": {
                "produces": [
                    "application/json"
                ],
@@ -509,21 +506,13 @@
                "summary": "入库/出库列表",
                "parameters": [
                    {
                        "type": "integer",
                        "name": "operationTypeId",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "页码",
                        "name": "page",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "每页大小",
                        "name": "pageSize",
                        "in": "query"
                        "description": "查询参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.OperationList"
                        }
                    }
                ],
                "responses": {
@@ -534,7 +523,39 @@
                        }
                    }
                }
            },
            }
        },
        "/api-wms/v1/operation/listAll": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "入库/出库"
                ],
                "summary": "调拨",
                "parameters": [
                    {
                        "description": "参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.OperationAllList"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "$ref": "#/definitions/util.Response"
                        }
                    }
                }
            }
        },
        "/api-wms/v1/operation/operation": {
            "post": {
                "produces": [
                    "application/json"
@@ -565,7 +586,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 +631,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": {
@@ -771,6 +787,36 @@
                }
            }
        },
        "/api-wms/v1/product/addDisuse": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "产品"
                ],
                "summary": "添加报废信息",
                "parameters": [
                    {
                        "description": "入库/出库信息",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.AddDisuse"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "$ref": "#/definitions/util.Response"
                        }
                    }
                }
            }
        },
        "/api-wms/v1/product/addProduct": {
            "post": {
                "produces": [
@@ -871,6 +917,34 @@
                "parameters": [
                    {
                        "type": "string",
                        "description": "id",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "$ref": "#/definitions/util.Response"
                        }
                    }
                }
            }
        },
        "/api-wms/v1/product/finishDisuse/{id}": {
            "put": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "产品"
                ],
                "summary": "验证报废",
                "parameters": [
                    {
                        "type": "integer",
                        "description": "id",
                        "name": "id",
                        "in": "path",
@@ -1052,6 +1126,111 @@
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/api-wms/v1/product/listDisuse": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "产品"
                ],
                "summary": "报废列表",
                "parameters": [
                    {
                        "description": "查询参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.QueryDisuseList"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "$ref": "#/definitions/util.Response"
                        }
                    }
                }
            }
        },
        "/api-wms/v1/product/listOperaton": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "产品"
                ],
                "summary": "产品历史出入库信息",
                "parameters": [
                    {
                        "description": "查询参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.QueryOperationList"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/util.ResponseList"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/definitions/models.Operation"
                                            }
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/api-wms/v1/product/updateDisuse": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "产品"
                ],
                "summary": "修改报废信息",
                "parameters": [
                    {
                        "description": "入库/出库信息",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.UpdateDisuse"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "$ref": "#/definitions/util.Response"
                        }
                    }
                }
@@ -1395,7 +1574,8 @@
                4,
                5,
                6,
                7
                7,
                8
            ],
            "x-enum-comments": {
                "LocationTypeCustomer": "客户位置",
@@ -1413,7 +1593,8 @@
                "LocationTypeCustomer",
                "LocationTypeInventoryLoss",
                "LocationTypeProduction",
                "LocationTypeTransit"
                "LocationTypeTransit",
                "LocationTypeDisuse"
            ]
        },
        "constvar.MaterialMode": {
@@ -1613,6 +1794,10 @@
                "isScrapLocation": {
                    "description": "是否报废位置",
                    "type": "boolean"
                },
                "jointName": {
                    "description": "拼接名称",
                    "type": "string"
                },
                "name": {
                    "description": "位置名称",
@@ -1840,6 +2025,125 @@
                "weight": {
                    "description": "重量",
                    "type": "number"
                }
            }
        },
        "models.Operation": {
            "type": "object",
            "properties": {
                "comment": {
                    "type": "string"
                },
                "companyID": {
                    "type": "integer"
                },
                "companyName": {
                    "type": "string"
                },
                "contacterID": {
                    "type": "integer"
                },
                "contacterName": {
                    "type": "string"
                },
                "createTime": {
                    "type": "string"
                },
                "details": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/models.OperationDetails"
                    }
                },
                "fromLocation": {
                    "description": "源位置",
                    "allOf": [
                        {
                            "$ref": "#/definitions/models.Location"
                        }
                    ]
                },
                "fromLocationId": {
                    "description": "源位置id",
                    "type": "integer"
                },
                "id": {
                    "type": "integer"
                },
                "number": {
                    "description": "单号",
                    "type": "string"
                },
                "operationDate": {
                    "type": "string"
                },
                "operationTypeId": {
                    "description": "作业类型id",
                    "type": "integer"
                },
                "operationTypeName": {
                    "description": "作业类型名称",
                    "type": "string"
                },
                "sourceNumber": {
                    "description": "源单号",
                    "type": "string"
                },
                "status": {
                    "description": "状态",
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.OperationStatus"
                        }
                    ]
                },
                "toLocation": {
                    "description": "目标位置",
                    "allOf": [
                        {
                            "$ref": "#/definitions/models.Location"
                        }
                    ]
                },
                "toLocationId": {
                    "description": "目标位置id",
                    "type": "integer"
                },
                "updateTime": {
                    "type": "string"
                }
            }
        },
        "models.OperationDetails": {
            "type": "object",
            "properties": {
                "amount": {
                    "description": "数量",
                    "type": "number"
                },
                "createTime": {
                    "type": "string"
                },
                "id": {
                    "type": "integer"
                },
                "operationId": {
                    "description": "操作id",
                    "type": "integer"
                },
                "productId": {
                    "description": "产品id",
                    "type": "string"
                },
                "productName": {
                    "description": "产品名称",
                    "type": "string"
                },
                "unit": {
                    "type": "string"
                },
                "updateTime": {
                    "type": "string"
                }
            }
        },
@@ -2122,6 +2426,32 @@
                }
            }
        },
        "request.AddDisuse": {
            "type": "object",
            "properties": {
                "amount": {
                    "type": "number"
                },
                "fromLocationId": {
                    "type": "integer"
                },
                "productId": {
                    "type": "string"
                },
                "productName": {
                    "type": "string"
                },
                "sourceNumber": {
                    "type": "string"
                },
                "toLocationId": {
                    "type": "integer"
                },
                "unit": {
                    "type": "string"
                }
            }
        },
        "request.AddOperation": {
            "type": "object",
            "properties": {
@@ -2169,6 +2499,10 @@
                "operationTypeId": {
                    "description": "作业类型id",
                    "type": "integer"
                },
                "operationTypeName": {
                    "description": "作业类型名称",
                    "type": "string"
                },
                "sourceNumber": {
                    "description": "源单号",
@@ -2329,12 +2663,35 @@
                }
            }
        },
        "request.OperationAllList": {
            "type": "object",
            "properties": {
                "number": {
                    "type": "string"
                },
                "page": {
                    "description": "页码",
                    "type": "integer"
                },
                "pageSize": {
                    "description": "每页大小",
                    "type": "integer"
                },
                "sourceNumber": {
                    "type": "string"
                }
            }
        },
        "request.OperationDetails": {
            "type": "object",
            "properties": {
                "OperationId": {
                    "description": "操作id",
                    "type": "integer"
                },
                "amount": {
                    "description": "数量",
                    "type": "number"
                },
                "productId": {
                    "description": "产品id",
@@ -2344,11 +2701,64 @@
                    "description": "产品名称",
                    "type": "string"
                },
                "quantity": {
                    "description": "数量",
                    "type": "number"
                },
                "unit": {
                    "type": "string"
                }
            }
        },
        "request.OperationList": {
            "type": "object",
            "properties": {
                "number": {
                    "type": "string"
                },
                "operationTypeId": {
                    "type": "integer"
                },
                "page": {
                    "description": "页码",
                    "type": "integer"
                },
                "pageSize": {
                    "description": "每页大小",
                    "type": "integer"
                },
                "sourceNumber": {
                    "type": "string"
                }
            }
        },
        "request.QueryDisuseList": {
            "type": "object",
            "properties": {
                "number": {
                    "type": "string"
                },
                "page": {
                    "description": "页码",
                    "type": "integer"
                },
                "pageSize": {
                    "description": "每页大小",
                    "type": "integer"
                },
                "sourceNumber": {
                    "type": "string"
                }
            }
        },
        "request.QueryOperationList": {
            "type": "object",
            "properties": {
                "page": {
                    "description": "页码",
                    "type": "integer"
                },
                "pageSize": {
                    "description": "每页大小",
                    "type": "integer"
                },
                "productId": {
                    "type": "string"
                }
            }
@@ -2385,6 +2795,44 @@
                },
                "remark": {
                    "description": "备注",
                    "type": "string"
                }
            }
        },
        "request.UpdateDisuse": {
            "type": "object",
            "properties": {
                "amount": {
                    "type": "number"
                },
                "fromLocationId": {
                    "type": "integer"
                },
                "id": {
                    "type": "integer"
                },
                "number": {
                    "type": "string"
                },
                "operationDate": {
                    "type": "string"
                },
                "productId": {
                    "type": "string"
                },
                "productName": {
                    "type": "string"
                },
                "sourceNumber": {
                    "type": "string"
                },
                "status": {
                    "$ref": "#/definitions/constvar.OperationStatus"
                },
                "toLocationId": {
                    "type": "integer"
                },
                "unit": {
                    "type": "string"
                }
            }
@@ -2436,6 +2884,10 @@
                "operationTypeId": {
                    "description": "作业类型id",
                    "type": "integer"
                },
                "operationTypeName": {
                    "description": "作业类型名称",
                    "type": "string"
                },
                "sourceNumber": {
                    "description": "源单号",
@@ -2573,8 +3025,6 @@
    Description:      "",
    InfoInstanceName: "swagger",
    SwaggerTemplate:  docTemplate,
    LeftDelim:        "{{",
    RightDelim:       "}}",
}
func init() {
docs/swagger.json
@@ -483,11 +483,8 @@
                }
            }
        },
        "/api-wms/v1/operation/operation": {
            "get": {
                "consumes": [
                    "application/json"
                ],
        "/api-wms/v1/operation/list": {
            "post": {
                "produces": [
                    "application/json"
                ],
@@ -497,21 +494,13 @@
                "summary": "入库/出库列表",
                "parameters": [
                    {
                        "type": "integer",
                        "name": "operationTypeId",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "页码",
                        "name": "page",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "每页大小",
                        "name": "pageSize",
                        "in": "query"
                        "description": "查询参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.OperationList"
                        }
                    }
                ],
                "responses": {
@@ -522,7 +511,39 @@
                        }
                    }
                }
            },
            }
        },
        "/api-wms/v1/operation/listAll": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "入库/出库"
                ],
                "summary": "调拨",
                "parameters": [
                    {
                        "description": "参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.OperationAllList"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "$ref": "#/definitions/util.Response"
                        }
                    }
                }
            }
        },
        "/api-wms/v1/operation/operation": {
            "post": {
                "produces": [
                    "application/json"
@@ -553,7 +574,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 +619,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": {
@@ -759,6 +775,36 @@
                }
            }
        },
        "/api-wms/v1/product/addDisuse": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "产品"
                ],
                "summary": "添加报废信息",
                "parameters": [
                    {
                        "description": "入库/出库信息",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.AddDisuse"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "$ref": "#/definitions/util.Response"
                        }
                    }
                }
            }
        },
        "/api-wms/v1/product/addProduct": {
            "post": {
                "produces": [
@@ -859,6 +905,34 @@
                "parameters": [
                    {
                        "type": "string",
                        "description": "id",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "$ref": "#/definitions/util.Response"
                        }
                    }
                }
            }
        },
        "/api-wms/v1/product/finishDisuse/{id}": {
            "put": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "产品"
                ],
                "summary": "验证报废",
                "parameters": [
                    {
                        "type": "integer",
                        "description": "id",
                        "name": "id",
                        "in": "path",
@@ -1040,6 +1114,111 @@
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/api-wms/v1/product/listDisuse": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "产品"
                ],
                "summary": "报废列表",
                "parameters": [
                    {
                        "description": "查询参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.QueryDisuseList"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "$ref": "#/definitions/util.Response"
                        }
                    }
                }
            }
        },
        "/api-wms/v1/product/listOperaton": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "产品"
                ],
                "summary": "产品历史出入库信息",
                "parameters": [
                    {
                        "description": "查询参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.QueryOperationList"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/util.ResponseList"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/definitions/models.Operation"
                                            }
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/api-wms/v1/product/updateDisuse": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "产品"
                ],
                "summary": "修改报废信息",
                "parameters": [
                    {
                        "description": "入库/出库信息",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.UpdateDisuse"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功",
                        "schema": {
                            "$ref": "#/definitions/util.Response"
                        }
                    }
                }
@@ -1383,7 +1562,8 @@
                4,
                5,
                6,
                7
                7,
                8
            ],
            "x-enum-comments": {
                "LocationTypeCustomer": "客户位置",
@@ -1401,7 +1581,8 @@
                "LocationTypeCustomer",
                "LocationTypeInventoryLoss",
                "LocationTypeProduction",
                "LocationTypeTransit"
                "LocationTypeTransit",
                "LocationTypeDisuse"
            ]
        },
        "constvar.MaterialMode": {
@@ -1601,6 +1782,10 @@
                "isScrapLocation": {
                    "description": "是否报废位置",
                    "type": "boolean"
                },
                "jointName": {
                    "description": "拼接名称",
                    "type": "string"
                },
                "name": {
                    "description": "位置名称",
@@ -1828,6 +2013,125 @@
                "weight": {
                    "description": "重量",
                    "type": "number"
                }
            }
        },
        "models.Operation": {
            "type": "object",
            "properties": {
                "comment": {
                    "type": "string"
                },
                "companyID": {
                    "type": "integer"
                },
                "companyName": {
                    "type": "string"
                },
                "contacterID": {
                    "type": "integer"
                },
                "contacterName": {
                    "type": "string"
                },
                "createTime": {
                    "type": "string"
                },
                "details": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/models.OperationDetails"
                    }
                },
                "fromLocation": {
                    "description": "源位置",
                    "allOf": [
                        {
                            "$ref": "#/definitions/models.Location"
                        }
                    ]
                },
                "fromLocationId": {
                    "description": "源位置id",
                    "type": "integer"
                },
                "id": {
                    "type": "integer"
                },
                "number": {
                    "description": "单号",
                    "type": "string"
                },
                "operationDate": {
                    "type": "string"
                },
                "operationTypeId": {
                    "description": "作业类型id",
                    "type": "integer"
                },
                "operationTypeName": {
                    "description": "作业类型名称",
                    "type": "string"
                },
                "sourceNumber": {
                    "description": "源单号",
                    "type": "string"
                },
                "status": {
                    "description": "状态",
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.OperationStatus"
                        }
                    ]
                },
                "toLocation": {
                    "description": "目标位置",
                    "allOf": [
                        {
                            "$ref": "#/definitions/models.Location"
                        }
                    ]
                },
                "toLocationId": {
                    "description": "目标位置id",
                    "type": "integer"
                },
                "updateTime": {
                    "type": "string"
                }
            }
        },
        "models.OperationDetails": {
            "type": "object",
            "properties": {
                "amount": {
                    "description": "数量",
                    "type": "number"
                },
                "createTime": {
                    "type": "string"
                },
                "id": {
                    "type": "integer"
                },
                "operationId": {
                    "description": "操作id",
                    "type": "integer"
                },
                "productId": {
                    "description": "产品id",
                    "type": "string"
                },
                "productName": {
                    "description": "产品名称",
                    "type": "string"
                },
                "unit": {
                    "type": "string"
                },
                "updateTime": {
                    "type": "string"
                }
            }
        },
@@ -2110,6 +2414,32 @@
                }
            }
        },
        "request.AddDisuse": {
            "type": "object",
            "properties": {
                "amount": {
                    "type": "number"
                },
                "fromLocationId": {
                    "type": "integer"
                },
                "productId": {
                    "type": "string"
                },
                "productName": {
                    "type": "string"
                },
                "sourceNumber": {
                    "type": "string"
                },
                "toLocationId": {
                    "type": "integer"
                },
                "unit": {
                    "type": "string"
                }
            }
        },
        "request.AddOperation": {
            "type": "object",
            "properties": {
@@ -2157,6 +2487,10 @@
                "operationTypeId": {
                    "description": "作业类型id",
                    "type": "integer"
                },
                "operationTypeName": {
                    "description": "作业类型名称",
                    "type": "string"
                },
                "sourceNumber": {
                    "description": "源单号",
@@ -2317,12 +2651,35 @@
                }
            }
        },
        "request.OperationAllList": {
            "type": "object",
            "properties": {
                "number": {
                    "type": "string"
                },
                "page": {
                    "description": "页码",
                    "type": "integer"
                },
                "pageSize": {
                    "description": "每页大小",
                    "type": "integer"
                },
                "sourceNumber": {
                    "type": "string"
                }
            }
        },
        "request.OperationDetails": {
            "type": "object",
            "properties": {
                "OperationId": {
                    "description": "操作id",
                    "type": "integer"
                },
                "amount": {
                    "description": "数量",
                    "type": "number"
                },
                "productId": {
                    "description": "产品id",
@@ -2332,11 +2689,64 @@
                    "description": "产品名称",
                    "type": "string"
                },
                "quantity": {
                    "description": "数量",
                    "type": "number"
                },
                "unit": {
                    "type": "string"
                }
            }
        },
        "request.OperationList": {
            "type": "object",
            "properties": {
                "number": {
                    "type": "string"
                },
                "operationTypeId": {
                    "type": "integer"
                },
                "page": {
                    "description": "页码",
                    "type": "integer"
                },
                "pageSize": {
                    "description": "每页大小",
                    "type": "integer"
                },
                "sourceNumber": {
                    "type": "string"
                }
            }
        },
        "request.QueryDisuseList": {
            "type": "object",
            "properties": {
                "number": {
                    "type": "string"
                },
                "page": {
                    "description": "页码",
                    "type": "integer"
                },
                "pageSize": {
                    "description": "每页大小",
                    "type": "integer"
                },
                "sourceNumber": {
                    "type": "string"
                }
            }
        },
        "request.QueryOperationList": {
            "type": "object",
            "properties": {
                "page": {
                    "description": "页码",
                    "type": "integer"
                },
                "pageSize": {
                    "description": "每页大小",
                    "type": "integer"
                },
                "productId": {
                    "type": "string"
                }
            }
@@ -2373,6 +2783,44 @@
                },
                "remark": {
                    "description": "备注",
                    "type": "string"
                }
            }
        },
        "request.UpdateDisuse": {
            "type": "object",
            "properties": {
                "amount": {
                    "type": "number"
                },
                "fromLocationId": {
                    "type": "integer"
                },
                "id": {
                    "type": "integer"
                },
                "number": {
                    "type": "string"
                },
                "operationDate": {
                    "type": "string"
                },
                "productId": {
                    "type": "string"
                },
                "productName": {
                    "type": "string"
                },
                "sourceNumber": {
                    "type": "string"
                },
                "status": {
                    "$ref": "#/definitions/constvar.OperationStatus"
                },
                "toLocationId": {
                    "type": "integer"
                },
                "unit": {
                    "type": "string"
                }
            }
@@ -2425,6 +2873,10 @@
                    "description": "作业类型id",
                    "type": "integer"
                },
                "operationTypeName": {
                    "description": "作业类型名称",
                    "type": "string"
                },
                "sourceNumber": {
                    "description": "源单号",
                    "type": "string"
docs/swagger.yaml
@@ -77,6 +77,7 @@
    - 5
    - 6
    - 7
    - 8
    type: integer
    x-enum-comments:
      LocationTypeCustomer: 客户位置
@@ -94,6 +95,7 @@
    - LocationTypeInventoryLoss
    - LocationTypeProduction
    - LocationTypeTransit
    - LocationTypeDisuse
  constvar.MaterialMode:
    enum:
    - 原材料
@@ -241,6 +243,9 @@
      isScrapLocation:
        description: 是否报废位置
        type: boolean
      jointName:
        description: 拼接名称
        type: string
      name:
        description: 位置名称
        type: string
@@ -414,6 +419,84 @@
      weight:
        description: 重量
        type: number
    type: object
  models.Operation:
    properties:
      comment:
        type: string
      companyID:
        type: integer
      companyName:
        type: string
      contacterID:
        type: integer
      contacterName:
        type: string
      createTime:
        type: string
      details:
        items:
          $ref: '#/definitions/models.OperationDetails'
        type: array
      fromLocation:
        allOf:
        - $ref: '#/definitions/models.Location'
        description: 源位置
      fromLocationId:
        description: 源位置id
        type: integer
      id:
        type: integer
      number:
        description: 单号
        type: string
      operationDate:
        type: string
      operationTypeId:
        description: 作业类型id
        type: integer
      operationTypeName:
        description: 作业类型名称
        type: string
      sourceNumber:
        description: 源单号
        type: string
      status:
        allOf:
        - $ref: '#/definitions/constvar.OperationStatus'
        description: 状态
      toLocation:
        allOf:
        - $ref: '#/definitions/models.Location'
        description: 目标位置
      toLocationId:
        description: 目标位置id
        type: integer
      updateTime:
        type: string
    type: object
  models.OperationDetails:
    properties:
      amount:
        description: 数量
        type: number
      createTime:
        type: string
      id:
        type: integer
      operationId:
        description: 操作id
        type: integer
      productId:
        description: 产品id
        type: string
      productName:
        description: 产品名称
        type: string
      unit:
        type: string
      updateTime:
        type: string
    type: object
  models.OperationType:
    properties:
@@ -598,6 +681,23 @@
        description: 备注
        type: string
    type: object
  request.AddDisuse:
    properties:
      amount:
        type: number
      fromLocationId:
        type: integer
      productId:
        type: string
      productName:
        type: string
      sourceNumber:
        type: string
      toLocationId:
        type: integer
      unit:
        type: string
    type: object
  request.AddOperation:
    properties:
      comment:
@@ -633,6 +733,9 @@
      operationTypeId:
        description: 作业类型id
        type: integer
      operationTypeName:
        description: 作业类型名称
        type: string
      sourceNumber:
        description: 源单号
        type: string
@@ -741,21 +844,73 @@
        description: 每页大小
        type: integer
    type: object
  request.OperationAllList:
    properties:
      number:
        type: string
      page:
        description: 页码
        type: integer
      pageSize:
        description: 每页大小
        type: integer
      sourceNumber:
        type: string
    type: object
  request.OperationDetails:
    properties:
      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
  request.OperationList:
    properties:
      number:
        type: string
      operationTypeId:
        type: integer
      page:
        description: 页码
        type: integer
      pageSize:
        description: 每页大小
        type: integer
      sourceNumber:
        type: string
    type: object
  request.QueryDisuseList:
    properties:
      number:
        type: string
      page:
        description: 页码
        type: integer
      pageSize:
        description: 每页大小
        type: integer
      sourceNumber:
        type: string
    type: object
  request.QueryOperationList:
    properties:
      page:
        description: 页码
        type: integer
      pageSize:
        description: 每页大小
        type: integer
      productId:
        type: string
    type: object
  request.UpdateCompany:
@@ -781,6 +936,31 @@
        type: integer
      remark:
        description: 备注
        type: string
    type: object
  request.UpdateDisuse:
    properties:
      amount:
        type: number
      fromLocationId:
        type: integer
      id:
        type: integer
      number:
        type: string
      operationDate:
        type: string
      productId:
        type: string
      productName:
        type: string
      sourceNumber:
        type: string
      status:
        $ref: '#/definitions/constvar.OperationStatus'
      toLocationId:
        type: integer
      unit:
        type: string
    type: object
  request.UpdateOperation:
@@ -818,6 +998,9 @@
      operationTypeId:
        description: 作业类型id
        type: integer
      operationTypeName:
        description: 作业类型名称
        type: string
      sourceNumber:
        description: 源单号
        type: string
@@ -1197,22 +1380,15 @@
      summary: 更改记录状态
      tags:
      - 入库/出库
  /api-wms/v1/operation/operation:
    get:
      consumes:
      - application/json
  /api-wms/v1/operation/list:
    post:
      parameters:
      - in: query
        name: operationTypeId
        type: integer
      - description: 页码
        in: query
        name: page
        type: integer
      - description: 每页大小
        in: query
        name: pageSize
        type: integer
      - description: 查询参数
        in: body
        name: object
        required: true
        schema:
          $ref: '#/definitions/request.OperationList'
      produces:
      - application/json
      responses:
@@ -1223,6 +1399,26 @@
      summary: 入库/出库列表
      tags:
      - 入库/出库
  /api-wms/v1/operation/listAll:
    post:
      parameters:
      - description: 参数
        in: body
        name: object
        required: true
        schema:
          $ref: '#/definitions/request.OperationAllList'
      produces:
      - application/json
      responses:
        "200":
          description: 成功
          schema:
            $ref: '#/definitions/util.Response'
      summary: 调拨
      tags:
      - 入库/出库
  /api-wms/v1/operation/operation:
    post:
      parameters:
      - description: 入库/出库信息
@@ -1259,7 +1455,8 @@
      summary: 删除入库/出库信息
      tags:
      - 入库/出库
    put:
  /api-wms/v1/operation/update:
    post:
      parameters:
      - description: 入库信息
        in: body
@@ -1267,11 +1464,6 @@
        required: true
        schema:
          $ref: '#/definitions/request.UpdateOperation'
      - description: 入库信息id
        in: path
        name: id
        required: true
        type: integer
      produces:
      - application/json
      responses:
@@ -1372,6 +1564,25 @@
      summary: 编辑作业类型
      tags:
      - 业务类型
  /api-wms/v1/product/addDisuse:
    post:
      parameters:
      - description: 入库/出库信息
        in: body
        name: object
        required: true
        schema:
          $ref: '#/definitions/request.AddDisuse'
      produces:
      - application/json
      responses:
        "200":
          description: 成功
          schema:
            $ref: '#/definitions/util.Response'
      summary: 添加报废信息
      tags:
      - 产品
  /api-wms/v1/product/addProduct:
    post:
      parameters:
@@ -1446,6 +1657,24 @@
      summary: 删除产品类型
      tags:
      - 产品类型
  /api-wms/v1/product/finishDisuse/{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/getProductCategoryDetails/{id}:
    get:
      parameters:
@@ -1544,6 +1773,70 @@
      summary: 获取产品列表
      tags:
      - 产品
  /api-wms/v1/product/listDisuse:
    post:
      parameters:
      - description: 查询参数
        in: body
        name: object
        required: true
        schema:
          $ref: '#/definitions/request.QueryDisuseList'
      produces:
      - application/json
      responses:
        "200":
          description: 成功
          schema:
            $ref: '#/definitions/util.Response'
      summary: 报废列表
      tags:
      - 产品
  /api-wms/v1/product/listOperaton:
    post:
      parameters:
      - description: 查询参数
        in: body
        name: object
        required: true
        schema:
          $ref: '#/definitions/request.QueryOperationList'
      produces:
      - application/json
      responses:
        "200":
          description: 成功
          schema:
            allOf:
            - $ref: '#/definitions/util.ResponseList'
            - properties:
                data:
                  items:
                    $ref: '#/definitions/models.Operation'
                  type: array
              type: object
      summary: 产品历史出入库信息
      tags:
      - 产品
  /api-wms/v1/product/updateDisuse:
    post:
      parameters:
      - description: 入库/出库信息
        in: body
        name: object
        required: true
        schema:
          $ref: '#/definitions/request.UpdateDisuse'
      produces:
      - application/json
      responses:
        "200":
          description: 成功
          schema:
            $ref: '#/definitions/util.Response'
      summary: 修改报废信息
      tags:
      - 产品
  /api-wms/v1/product/updateProduct:
    post:
      parameters:
models/material.go
@@ -475,3 +475,24 @@
    }
    return result.Max, nil
}
type ResponseDisuseList struct {
    Id             int                      `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
    Number         string                   `json:"number" gorm:"type:varchar(255)"`                                 //单号
    SourceNumber   string                   `json:"sourceNumber" gorm:"type:varchar(255)"`                           //源单号
    Status         constvar.OperationStatus `json:"status" gorm:"type:int(11);not null;comment:状态"`                  //状态
    FromLocationID int                      `json:"fromLocationId"   gorm:"type:int;not null;comment:源位置id"`         //源位置id
    FromLocation   Location                 `json:"fromLocation"     gorm:"foreignKey:FromLocationID;references:Id"` //源位置
    ToLocation     Location                 `json:"toLocation"      gorm:"foreignKey:ToLocationID;references:Id"`    //目标位置
    ToLocationID   int                      `json:"toLocationId"    gorm:"type:int;not null;comment:目标位置id"`         //目标位置id
    OperationDate  string                   `json:"operationDate" gorm:"type:varchar(31);comment:安排日期"`
    ContacterID    int                      `json:"contacterID" gorm:"type:int;comment:联系人ID"`
    ContacterName  string                   `json:"contacterName" gorm:"type:varchar(63);comment:联系人姓名"`
    CompanyID      int                      `json:"companyID" gorm:"type:int;comment:公司ID-客户"`
    CompanyName    string                   `json:"companyName" gorm:"type:varchar(127);comment:公司名称-客户"`
    Comment        string                   `json:"comment" gorm:"type:text;comment:备注"`
    ProductId      string                   `json:"productId" gorm:"type:varchar(191);not null;comment:产品id"`   //产品id
    ProductName    string                   `json:"productName" gorm:"type:varchar(255);not null;comment:产品名称"` //产品名称
    Amount         decimal.Decimal          `json:"amount" gorm:"type:decimal(20,2);not null;comment:数量"`       //数量
    Unit           string                   `json:"unit" gorm:"type:varchar(31);comment:单位"`
}
models/operation.go
@@ -45,6 +45,7 @@
        Keyword  string
        Orm      *gorm.DB
        Preload  bool
        Disuse   bool
    }
)
@@ -91,6 +92,21 @@
    return slf
}
func (slf *OperationSearch) SetNumber(number string) *OperationSearch {
    slf.Number = number
    return slf
}
func (slf *OperationSearch) SetSourceNumber(sourceNumber string) *OperationSearch {
    slf.SourceNumber = sourceNumber
    return slf
}
func (slf *OperationSearch) SetDisuse(disuse bool) *OperationSearch {
    slf.Disuse = disuse
    return slf
}
func (slf *OperationSearch) build() *gorm.DB {
    var db = slf.Orm.Model(&Operation{})
@@ -101,9 +117,17 @@
        db = db.Order(slf.Order)
    }
    //if slf.Keyword != "" {
    //    db = db.Where("product_name like ?", fmt.Sprintf("%%%v%%", slf.Keyword))
    //}
    if slf.Keyword != "" {
        db = db.Where("product_name like ?", fmt.Sprintf("%%%v%%", slf.Keyword))
    }
    if slf.SourceNumber != "" {
        db = db.Where("source_number like ?", fmt.Sprintf("%%%v%%", slf.SourceNumber))
    }
    if slf.Number != "" {
        db = db.Where("number like ?", fmt.Sprintf("%%%v%%", slf.Number))
    }
    if slf.OperationTypeId != 0 {
        db.Where("operation_type_id = ?", slf.OperationTypeId)
@@ -113,6 +137,10 @@
        db = db.Model(&Operation{}).Preload("Details").Preload("FromLocation").Preload("ToLocation")
    }
    if slf.Disuse {
        db = db.Where("operation_type_id = ?", 0)
    }
    return db
}
request/operation.go
@@ -39,7 +39,9 @@
type OperationList struct {
    PageInfo
    OperationTypeId int `json:"operationTypeId" form:"operationTypeId"`
    OperationTypeId int    `json:"operationTypeId" form:"operationTypeId"`
    Number          string `json:"number"`
    SourceNumber    string `json:"sourceNumber"`
}
type UpdateOperation struct {
@@ -65,3 +67,9 @@
    //Weight         decimal.Decimal `json:"weight" gorm:"type:decimal(20,2);comment:重量(kg)"`           //重量(kg)-非必填
    //TransferWeight decimal.Decimal `json:"transferWeight" gorm:"type:decimal(20,2);comment:物流重量(kg)"` //物流重量(kg)-非必填
}
type OperationAllList struct {
    PageInfo
    Number       string `json:"number"`
    SourceNumber string `json:"sourceNumber"`
}
request/product_request.go
@@ -1,6 +1,46 @@
package request
import (
    "github.com/shopspring/decimal"
    "wms/constvar"
)
type GetProductList struct {
    PageInfo
    KeyWord string `json:"keyWord"`
}
type QueryOperationList struct {
    PageInfo
    ProductId string `json:"productId"`
}
type AddDisuse struct {
    ProductId      string          `json:"productId"`
    ProductName    string          `json:"productName"`
    Amount         decimal.Decimal `json:"amount"`
    FromLocationId int             `json:"fromLocationId"`
    ToLocationId   int             `json:"toLocationId"`
    SourceNumber   string          `json:"sourceNumber"`
    Unit           string          `json:"unit"`
}
type QueryDisuseList struct {
    PageInfo
    Number       string `json:"number"`
    SourceNumber string `json:"sourceNumber"`
}
type UpdateDisuse struct {
    Id             int                      `json:"id"`
    ProductId      string                   `json:"productId"`
    ProductName    string                   `json:"productName"`
    Amount         decimal.Decimal          `json:"amount"`
    FromLocationId int                      `json:"fromLocationId"`
    ToLocationId   int                      `json:"toLocationId"`
    SourceNumber   string                   `json:"sourceNumber"`
    Unit           string                   `json:"unit"`
    Number         string                   `json:"number"`
    Status         constvar.OperationStatus `json:"status"`
    OperationDate  string                   `json:"operationDate"`
}
router/router.go
@@ -77,11 +77,13 @@
    operationController := new(controllers.OperationController)
    operationAPI := r.Group(urlPrefix + "/operation")
    {
        operationAPI.GET("operation", operationController.List)
        operationAPI.POST("list", operationController.List)
        operationAPI.POST("operation", operationController.Add)
        operationAPI.POST("update", operationController.Update)
        operationAPI.DELETE("operation/:id", operationController.Delete)
        operationAPI.PUT("finish/:id", operationController.Finish)
        operationAPI.POST("listAll", operationController.ListAll)
    }
    //产品
@@ -99,6 +101,13 @@
        productAPI.GET("getProductCategoryDetails/:id", productController.GetProductCategoryDetails) //获取产品类型详情
        productAPI.POST("updateProductCategory", productController.UpdateProductCategory)            //修改产品类型
        productAPI.DELETE("deleteProductCategory/:id", productController.DeleteProductCategory)      //删除产品类型
        productAPI.POST("listOperaton", productController.ListOperation)   //查看产品的历史出入库信息
        productAPI.POST("addDisuse", productController.AddDisuse)          //添加报废信息
        productAPI.POST("listDisuse", productController.ListDisuse)        //查看产品的历史出入库信息
        productAPI.PUT("finishDisuse/:id", productController.FinishDisuse) //报废验证
        productAPI.POST("updateDisuse", productController.UpdateDisuse)    //修改报废信息
    }
    return r