Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS
# Conflicts:
# docs/docs.go
# docs/swagger.json
# docs/swagger.yaml
| | |
| | | LocationTypeInventoryLoss // 库存损失 |
| | | LocationTypeProduction // 生产 |
| | | LocationTypeTransit // 中转位置 |
| | | LocationTypeDisuse |
| | | LocationTypeDisuse //报废位置 |
| | | LocationTypeAdjust //库存盘点 |
| | | ) |
| | | |
| | | func (t LocationType) Valid() bool { |
| | |
| | | util.ResponseFormat(c, code.RequestParamError, "请选择产品") |
| | | return |
| | | } |
| | | if params.ProductCategoryID == 0 { |
| | | util.ResponseFormat(c, code.RequestParamError, "请选择产品类别") |
| | | return |
| | | } |
| | | //if params.ProductCategoryID == 0 { |
| | | // util.ResponseFormat(c, code.RequestParamError, "请选择产品类别") |
| | | // return |
| | | //} |
| | | if err := models.NewLocationProductSearch().Create(¶ms); err != nil { |
| | | logx.Errorf("Operation create err: %v", err) |
| | | util.ResponseFormat(c, code.SaveFail, "添加失败:"+err.Error()) |
| | |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误:"+err.Error()) |
| | | return |
| | | } |
| | | if params.Check() { |
| | | if !params.Check() { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数异常") |
| | | return |
| | | } |
| | |
| | | // @Tags 上架规则 |
| | | // @Summary 修改上架规则 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateLocationProduct true "入库信息" |
| | | // @Param object body request.UpdateLocationProduct true "修改参数" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/locationProduct/update [post] |
| | | func (slf LocationProductController) Update(c *gin.Context) { |
| | |
| | | import ( |
| | | "fmt" |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/shopspring/decimal" |
| | | "gorm.io/gorm" |
| | | "strconv" |
| | | "time" |
| | | "wms/constvar" |
| | | "wms/extend/code" |
| | | "wms/extend/util" |
| | |
| | | // @Produce application/json |
| | | // @Param object body request.PageInfo true "查询参数" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/locationProduct/list [post] |
| | | // @Router /api-wms/v1/locationProductAmount/list [post] |
| | | func (slf LocationProductAmountController) List(c *gin.Context) { |
| | | var params request.PageInfo |
| | | if err := c.BindJSON(¶ms); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误:"+err.Error()) |
| | | return |
| | | } |
| | | if params.Check() { |
| | | if !params.Check() { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数异常") |
| | | return |
| | | } |
| | |
| | | search := models.NewLocationProductAmountSearch() |
| | | search.SetPage(params.Page, params.PageSize) |
| | | |
| | | search.Orm = search.Orm.Model(&models.LocationProductAmountWithOperation{}).Table("wms_location_product_amount").Select("wms_location_product_amount.*,wms_operation.amount as adjust_amount").InnerJoins("inner join wms_location_product on wms_location_product.id=wms_location_product_amount.location_product_id").InnerJoins("inner join wms_operation_details on wms_operation_details.product_id=wms_location_product.product_id").InnerJoins("inner join wms_operation on wms_operation.id=wms_operation_details.operation_id").Where("wms_operation.base_operation_type=?", constvar.BaseOperationTypeAdjust) |
| | | search.Orm = search.Orm. |
| | | Table("wms_location_product_amount"). |
| | | Select(` |
| | | wms_location.id as location_id, |
| | | wms_location.name as location_name, |
| | | material.id as product_id, |
| | | material.name as product_name, |
| | | wms_location_product_amount.amount, |
| | | material.unit, |
| | | wms_location_product_amount.create_date, |
| | | wms_operation_details.amount as adjust_amount, |
| | | wms_operation.id as operation_id`). |
| | | InnerJoins("inner join wms_location_product on wms_location_product.id=wms_location_product_amount.location_product_id"). |
| | | InnerJoins("inner join wms_location on wms_location.id=wms_location_product.location_id"). |
| | | InnerJoins("inner join wms_operation_details on wms_operation_details.product_id=wms_location_product.product_id"). |
| | | InnerJoins("inner join material on material.id=wms_operation_details.product_id"). |
| | | InnerJoins("inner join wms_operation on wms_operation.id=wms_operation_details.operation_id"). |
| | | Where("wms_operation.base_operation_type=?", constvar.BaseOperationTypeAdjust) |
| | | |
| | | var ( |
| | | records = make([]*models.ResponseDisuseList, 0) |
| | | records = make([]*models.LocationProductAmountWithOperation, 0) |
| | | total int64 |
| | | ) |
| | | |
| | |
| | | util.ResponseFormat(c, code.RequestError, fmt.Errorf("find count err: %v", err)) |
| | | return |
| | | } |
| | | search.Orm = search.Orm.Preload("LocationProduct").Preload("LocationProduct.Location").Preload("LocationProduct.Product") |
| | | //search.Orm = search.Orm.Preload("LocationProduct").Preload("LocationProduct.Location").Preload("LocationProduct.Product") |
| | | if params.Page*params.PageSize > 0 { |
| | | search.Orm = search.Orm.Offset((params.Page - 1) * params.PageSize).Limit(params.PageSize) |
| | | } |
| | |
| | | util.ResponseFormat(c, code.RequestError, fmt.Errorf("find count err: %v", err)) |
| | | return |
| | | } |
| | | |
| | | for k, v := range records { |
| | | records[k].DifferenceAmount = v.Amount.Sub(v.AdjustAmount) |
| | | } |
| | | util.ResponseFormatListWithPage(c, code.Success, records, int(total), params.Page, params.PageSize) |
| | | } |
| | | |
| | |
| | | // @Produce application/json |
| | | // @Param object body request.AddLocationProductAmount true "入库/出库信息" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/operation/operation [post] |
| | | //func (slf LocationProductAmountController) Add(c *gin.Context) { |
| | | // var reqParams request.AddLocationProductAmount |
| | | // @Router /api-wms/v1/locationProductAmount/add [post] |
| | | func (slf LocationProductAmountController) Add(c *gin.Context) { |
| | | var reqParams request.AddLocationProductAmount |
| | | if err := c.BindJSON(&reqParams); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误") |
| | | return |
| | | } |
| | | if reqParams.LocationId == 0 { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数异常,请选择位置") |
| | | return |
| | | } |
| | | if reqParams.ProductId == "" { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数异常,请选择产品") |
| | | return |
| | | } |
| | | |
| | | var existCount int64 |
| | | if err := models.NewOperationSearch().Orm.Table("wms_operation").InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id").Where("wms_operation.from_location_id=? and wms_operation_details.product_id=? and wms_operation.base_operation_type=? and wms_operation.status=?", reqParams.LocationId, reqParams.ProductId, constvar.BaseOperationTypeAdjust, constvar.OperationStatus_Ready).Count(&existCount).Error; err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | if existCount > 0 { |
| | | util.ResponseFormat(c, code.RequestError, "该商品在已选中的位置存在未验证的库存盘点信息,无法继续添加相关信息") |
| | | return |
| | | } |
| | | |
| | | locProduct, err := models.NewLocationProductSearch().SetLocationId(reqParams.LocationId).SetProductId(reqParams.ProductId).First() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数异常,未找到该上架规则") |
| | | return |
| | | } |
| | | if locProduct.Id == 0 { |
| | | util.ResponseFormat(c, code.RequestError, "不存在该上架规则,无法进行库存盘点") |
| | | return |
| | | } |
| | | location, err := models.NewLocationSearch().SetType(int(constvar.LocationTypeAdjust)).First() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | //reqParams.AdjustAmount = reqParams.Amount.Sub(reqParams.DifferenceAmount) |
| | | reqParams.AdjustAmount = reqParams.DifferenceAmount.Sub(reqParams.Amount) |
| | | locAmount := models.LocationProductAmount{ |
| | | LocationProductId: locProduct.Id, |
| | | Amount: decimal.NewFromInt(0), |
| | | CreateDate: time.Now().Format("2006-01-02 15:04:05"), |
| | | } |
| | | detail := &models.OperationDetails{ |
| | | ProductId: reqParams.ProductId, |
| | | Amount: reqParams.AdjustAmount, |
| | | } |
| | | operation := models.Operation{ |
| | | Number: strconv.FormatInt(time.Now().Unix(), 10), |
| | | Status: constvar.OperationStatus_Ready, |
| | | OperationDate: time.Now().Format("2006-01-02 15:04:05"), |
| | | Comment: "库存盘点", |
| | | BaseOperationType: constvar.BaseOperationTypeAdjust, |
| | | Details: []*models.OperationDetails{detail}, |
| | | FromLocationID: location.Id, |
| | | ToLocationID: reqParams.LocationId, |
| | | } |
| | | |
| | | //if reqParams.AdjustAmount.GreaterThanOrEqual(decimal.NewFromInt(0)) { |
| | | // operation.FromLocationID = Location.Id |
| | | // operation.ToLocationID = reqParams.LocationId |
| | | //} else { |
| | | // operation.FromLocationID = reqParams.LocationId |
| | | // operation.ToLocationID = Location.Id |
| | | //} |
| | | |
| | | if err := models.WithTransaction(func(tx *gorm.DB) error { |
| | | if err := models.NewOperationSearch().SetOrm(tx).Create(&operation); err != nil { |
| | | return err |
| | | } |
| | | if err := models.NewLocationProductAmountSearch().SetOrm(tx).Create(&locAmount); err != nil { |
| | | return err |
| | | } |
| | | return nil |
| | | }); err != nil { |
| | | util.ResponseFormat(c, code.RequestError, err.Error()) |
| | | return |
| | | } |
| | | |
| | | util.ResponseFormat(c, code.Success, "添加成功") |
| | | } |
| | | |
| | | // Add |
| | | // @Tags 库存盘点 |
| | | // @Summary 修改库存盘点信息 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateLocationProductAmount true "入库/出库信息" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/locationProductAmount/update [post] |
| | | //func (slf LocationProductAmountController) Update(c *gin.Context) { |
| | | // var reqParams request.UpdateLocationProductAmount |
| | | // if err := c.BindJSON(&reqParams); err != nil { |
| | | // util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误") |
| | | // return |
| | | // } |
| | | // if reqParams.LocationProductAmountId==0 { |
| | | // util.ResponseFormat(c, code.RequestParamError, "参数异常,locationProductAmountId为0") |
| | | // |
| | | // var existCount int64 |
| | | // if err := models.NewOperationSearch().Orm.Table("wms_operation").InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id").Where("wms_operation.from_location_id=? and wms_operation_details.product_id=? and wms_operation.base_operation_type=? and wms_operation.status=?", reqParams.LocationId, reqParams.ProductId, constvar.BaseOperationTypeAdjust, constvar.OperationStatus_Ready).Count(&existCount).Error; err != nil { |
| | | // util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | // return |
| | | // } |
| | | // locAmount:=models.LocationProductAmount{ |
| | | // LocationProductId: reqParams.LocationProductAmountId |
| | | // if existCount > 0 { |
| | | // util.ResponseFormat(c, code.RequestError, "该商品在已选中的位置存在未验证的库存盘点信息,无法继续添加相关信息") |
| | | // return |
| | | // } |
| | | // operationType, err := models.NewOperationTypeSearch().SetID(uint(params.OperationTypeId)).First() |
| | | // |
| | | // locProduct, err := models.NewLocationProductSearch().SetLocationId(reqParams.LocationId).SetProductId(reqParams.ProductId).First() |
| | | // if err != nil { |
| | | // util.ResponseFormat(c, code.RequestParamError, "参数异常,未找到该上架规则") |
| | | // return |
| | | // } |
| | | // if locProduct.Id == 0 { |
| | | // util.ResponseFormat(c, code.RequestError, "不存在该上架规则,无法进行库存盘点") |
| | | // return |
| | | // } |
| | | // location, err := models.NewLocationSearch().SetType(int(constvar.LocationTypeAdjust)).First() |
| | | // if err != nil { |
| | | // util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | // return |
| | | // } |
| | | // ////// |
| | | // if location, err := models.NewLocationSearch().SetType(int(constvar.LocationTypeCustomer)).First(); err != nil { |
| | | // return err |
| | | // } else { |
| | | // params.ToLocationID = location.Id |
| | | // //reqParams.AdjustAmount = reqParams.Amount.Sub(reqParams.DifferenceAmount) |
| | | // reqParams.AdjustAmount = reqParams.DifferenceAmount.Sub(reqParams.Amount) |
| | | // locAmount := models.LocationProductAmount{ |
| | | // LocationProductId: locProduct.Id, |
| | | // Amount: decimal.NewFromInt(0), |
| | | // CreateDate: time.Now().Format("2006-01-02 15:04:05"), |
| | | // } |
| | | // detail := &models.OperationDetails{ |
| | | // ProductId: reqParams.ProductId, |
| | | // Amount: reqParams.AdjustAmount, |
| | | // } |
| | | // operation := models.Operation{ |
| | | // Number: strconv.FormatInt(time.Now().Unix(), 10), |
| | | // Status: constvar.OperationStatus_Ready, |
| | | // OperationDate: time.Now().Format("2006-01-02 15:04:05"), |
| | | // Comment: "库存盘点", |
| | | // BaseOperationType: constvar.BaseOperationTypeAdjust, |
| | | // Details: []*models.OperationDetails{detail}, |
| | | // FromLocationID: location.Id, |
| | | // ToLocationID: reqParams.LocationId, |
| | | // } |
| | | // |
| | | // //if reqParams.AdjustAmount.GreaterThanOrEqual(decimal.NewFromInt(0)) { |
| | | // // operation.FromLocationID = Location.Id |
| | | // // operation.ToLocationID = reqParams.LocationId |
| | | // //} else { |
| | | // // operation.FromLocationID = reqParams.LocationId |
| | | // // operation.ToLocationID = Location.Id |
| | | // //} |
| | | // |
| | | // params.Status = constvar.OperationStatus_Ready |
| | | // params.Number = strconv.FormatInt(time.Now().Unix(), 10) |
| | | // params.BaseOperationType = operationType.BaseOperationType |
| | | // if err := models.NewOperationSearch().Create(¶ms); err != nil { |
| | | // logx.Errorf("Operation create err: %v", err) |
| | | // util.ResponseFormat(c, code.SaveFail, "添加失败:"+err.Error()) |
| | | // if err := models.WithTransaction(func(tx *gorm.DB) error { |
| | | // if err := models.NewOperationSearch().SetOrm(tx).Create(&operation); err != nil { |
| | | // return err |
| | | // } |
| | | // if err := models.NewLocationProductAmountSearch().SetOrm(tx).Create(&locAmount); err != nil { |
| | | // return err |
| | | // } |
| | | // return nil |
| | | // }); err != nil { |
| | | // util.ResponseFormat(c, code.RequestError, err.Error()) |
| | | // return |
| | | // } |
| | | // |
| | | // util.ResponseFormat(c, code.Success, "添加成功") |
| | | //} |
| | |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/shopspring/decimal" |
| | | "gorm.io/gorm" |
| | | "sort" |
| | | "strconv" |
| | | "time" |
| | | "wms/constvar" |
| | |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | |
| | | if CheckDetailsRepeat(params.Details) { |
| | | util.ResponseFormat(c, code.RequestParamError, "明细中不能存在重复的产品") |
| | | return |
| | | } |
| | | |
| | | operationType, err := models.NewOperationTypeSearch().SetID(uint(params.OperationTypeId)).First() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | |
| | | return |
| | | } |
| | | util.ResponseFormat(c, code.Success, "添加成功") |
| | | } |
| | | |
| | | func CheckDetailsRepeat(details []*models.OperationDetails) bool { |
| | | detailIDs := []string{} |
| | | var tempID string |
| | | for _, v := range details { |
| | | detailIDs = append(detailIDs, v.ProductId) |
| | | } |
| | | sort.Strings(detailIDs) |
| | | for _, v := range detailIDs { |
| | | if v != tempID { |
| | | tempID = v |
| | | } else { |
| | | return true |
| | | } |
| | | } |
| | | return false |
| | | } |
| | | |
| | | func (slf OperationController) FormatLocation(params *models.Operation) error { |
| | |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | if CheckDetailsRepeat(params.Details) { |
| | | util.ResponseFormat(c, code.RequestParamError, "明细中不能存在重复的产品") |
| | | return |
| | | } |
| | | if err := slf.FormatLocation(¶ms); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | |
| | | } |
| | | util.ResponseFormat(c, code.Success, "添加成功") |
| | | } |
| | | |
| | | // ListHistory |
| | | // @Tags 产品 |
| | | // @Summary 产品位置历史信息 |
| | | // @Produce application/json |
| | | // @Param object body request.QueryOperationHistory true "查询参数" |
| | | // @Success 200 {object} util.ResponseList{data=[]models.Operation} "成功" |
| | | // @Router /api-wms/v1/product/listHistory [post] |
| | | func (slf ProductController) ListHistory(c *gin.Context) { |
| | | var params request.QueryOperationHistory |
| | | if err := c.BindJSON(¶ms); 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=? and (wms_operation.from_location_id=? or wms_operation.to_location_id=?)", params.ProductId, params.LocationId, params.LocationId)) |
| | | |
| | | 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) |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/forms/getInventoryForms": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "报表" |
| | | ], |
| | | "summary": "获取库存报表", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetInventoryForms" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/response.InventoryForms" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/forms/getInventoryHistory": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "报表" |
| | | ], |
| | | "summary": "获取库存历史", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetInventoryHistory" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/response.InventoryHistory" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/location/addLocation": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "库存盘点" |
| | | "上架规则" |
| | | ], |
| | | "summary": "库存盘点列表", |
| | | "summary": "上架规则列表", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | |
| | | "summary": "修改上架规则", |
| | | "parameters": [ |
| | | { |
| | | "description": "入库信息", |
| | | "description": "修改参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateLocationProduct" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/locationProductAmount/add": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "库存盘点" |
| | | ], |
| | | "summary": "添加库存盘点信息", |
| | | "parameters": [ |
| | | { |
| | | "description": "入库/出库信息", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddLocationProductAmount" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/locationProductAmount/list": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "库存盘点" |
| | | ], |
| | | "summary": "库存盘点列表", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.PageInfo" |
| | | } |
| | | } |
| | | ], |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/product/listHistory": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "产品" |
| | | ], |
| | | "summary": "产品位置历史信息", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.QueryOperationHistory" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.Operation" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/product/listOperaton": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | 5, |
| | | 6, |
| | | 7, |
| | | 8 |
| | | 8, |
| | | 9 |
| | | ], |
| | | "x-enum-comments": { |
| | | "LocationTypeAdjust": "库存盘点", |
| | | "LocationTypeCustomer": "客户位置", |
| | | "LocationTypeDisuse": "报废位置", |
| | | "LocationTypeInternal": "内部位置", |
| | | "LocationTypeInventoryLoss": "库存损失", |
| | | "LocationTypeProduction": "生产", |
| | |
| | | "LocationTypeInventoryLoss", |
| | | "LocationTypeProduction", |
| | | "LocationTypeTransit", |
| | | "LocationTypeDisuse" |
| | | "LocationTypeDisuse", |
| | | "LocationTypeAdjust" |
| | | ] |
| | | }, |
| | | "constvar.MaterialMode": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.AddLocationProductAmount": { |
| | | "type": "object", |
| | | "properties": { |
| | | "Amount": { |
| | | "description": "库存数量", |
| | | "type": "number" |
| | | }, |
| | | "adjustAmount": { |
| | | "description": "差值", |
| | | "type": "number" |
| | | }, |
| | | "differenceAmount": { |
| | | "description": "计数数量", |
| | | "type": "number" |
| | | }, |
| | | "locationId": { |
| | | "type": "integer" |
| | | }, |
| | | "productId": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.AddOperation": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.GetInventoryForms": { |
| | | "type": "object", |
| | | "properties": { |
| | | "categoryIds": { |
| | | "description": "产品类型id", |
| | | "type": "array", |
| | | "items": { |
| | | "type": "integer" |
| | | } |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "warehouseCode": { |
| | | "description": "仓库缩写", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.GetInventoryHistory": { |
| | | "type": "object", |
| | | "properties": { |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "produceId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "description": "产品名称", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "description": "单位", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.GetProductList": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "type": "integer" |
| | | }, |
| | | "sourceNumber": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.QueryOperationHistory": { |
| | | "type": "object", |
| | | "properties": { |
| | | "locationId": { |
| | | "type": "integer" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "productId": { |
| | | "type": "string" |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "response.InventoryForms": { |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "在库数量", |
| | | "type": "number" |
| | | }, |
| | | "availableNumber": { |
| | | "description": "可用库存", |
| | | "type": "number" |
| | | }, |
| | | "cost": { |
| | | "description": "成本", |
| | | "type": "number" |
| | | }, |
| | | "in": { |
| | | "description": "入库", |
| | | "type": "number" |
| | | }, |
| | | "out": { |
| | | "description": "出库", |
| | | "type": "number" |
| | | }, |
| | | "produceId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "description": "产品名称", |
| | | "type": "string" |
| | | }, |
| | | "productType": { |
| | | "description": "产品类型", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "description": "单位", |
| | | "type": "string" |
| | | }, |
| | | "value": { |
| | | "description": "总价值", |
| | | "type": "number" |
| | | } |
| | | } |
| | | }, |
| | | "response.InventoryHistory": { |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "数量", |
| | | "type": "number" |
| | | }, |
| | | "baseOperationType": { |
| | | "description": "基础作业类型", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.BaseOperationType" |
| | | } |
| | | ] |
| | | }, |
| | | "contactedName": { |
| | | "description": "完成者", |
| | | "type": "string" |
| | | }, |
| | | "date": { |
| | | "description": "日期", |
| | | "type": "string" |
| | | }, |
| | | "fromLocation": { |
| | | "description": "源位置", |
| | | "type": "string" |
| | | }, |
| | | "number": { |
| | | "description": "单号", |
| | | "type": "string" |
| | | }, |
| | | "toLocation": { |
| | | "description": "目标位置", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "description": "单位", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "util.Response": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | Description: "", |
| | | InfoInstanceName: "swagger", |
| | | SwaggerTemplate: docTemplate, |
| | | LeftDelim: "{{", |
| | | RightDelim: "}}", |
| | | } |
| | | |
| | | func init() { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/forms/getInventoryForms": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "报表" |
| | | ], |
| | | "summary": "获取库存报表", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetInventoryForms" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/response.InventoryForms" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/forms/getInventoryHistory": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "报表" |
| | | ], |
| | | "summary": "获取库存历史", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetInventoryHistory" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/response.InventoryHistory" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/location/addLocation": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "库存盘点" |
| | | "上架规则" |
| | | ], |
| | | "summary": "库存盘点列表", |
| | | "summary": "上架规则列表", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | |
| | | "summary": "修改上架规则", |
| | | "parameters": [ |
| | | { |
| | | "description": "入库信息", |
| | | "description": "修改参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateLocationProduct" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/locationProductAmount/add": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "库存盘点" |
| | | ], |
| | | "summary": "添加库存盘点信息", |
| | | "parameters": [ |
| | | { |
| | | "description": "入库/出库信息", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddLocationProductAmount" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/locationProductAmount/list": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "库存盘点" |
| | | ], |
| | | "summary": "库存盘点列表", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.PageInfo" |
| | | } |
| | | } |
| | | ], |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/product/listHistory": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "产品" |
| | | ], |
| | | "summary": "产品位置历史信息", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.QueryOperationHistory" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.Operation" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/product/listOperaton": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | 5, |
| | | 6, |
| | | 7, |
| | | 8 |
| | | 8, |
| | | 9 |
| | | ], |
| | | "x-enum-comments": { |
| | | "LocationTypeAdjust": "库存盘点", |
| | | "LocationTypeCustomer": "客户位置", |
| | | "LocationTypeDisuse": "报废位置", |
| | | "LocationTypeInternal": "内部位置", |
| | | "LocationTypeInventoryLoss": "库存损失", |
| | | "LocationTypeProduction": "生产", |
| | |
| | | "LocationTypeInventoryLoss", |
| | | "LocationTypeProduction", |
| | | "LocationTypeTransit", |
| | | "LocationTypeDisuse" |
| | | "LocationTypeDisuse", |
| | | "LocationTypeAdjust" |
| | | ] |
| | | }, |
| | | "constvar.MaterialMode": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.AddLocationProductAmount": { |
| | | "type": "object", |
| | | "properties": { |
| | | "Amount": { |
| | | "description": "库存数量", |
| | | "type": "number" |
| | | }, |
| | | "adjustAmount": { |
| | | "description": "差值", |
| | | "type": "number" |
| | | }, |
| | | "differenceAmount": { |
| | | "description": "计数数量", |
| | | "type": "number" |
| | | }, |
| | | "locationId": { |
| | | "type": "integer" |
| | | }, |
| | | "productId": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.AddOperation": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.GetInventoryForms": { |
| | | "type": "object", |
| | | "properties": { |
| | | "categoryIds": { |
| | | "description": "产品类型id", |
| | | "type": "array", |
| | | "items": { |
| | | "type": "integer" |
| | | } |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "warehouseCode": { |
| | | "description": "仓库缩写", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.GetInventoryHistory": { |
| | | "type": "object", |
| | | "properties": { |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "produceId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "description": "产品名称", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "description": "单位", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.GetProductList": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "type": "integer" |
| | | }, |
| | | "sourceNumber": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.QueryOperationHistory": { |
| | | "type": "object", |
| | | "properties": { |
| | | "locationId": { |
| | | "type": "integer" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | }, |
| | | "productId": { |
| | | "type": "string" |
| | | } |
| | | } |
| | |
| | | "warehouseId": { |
| | | "description": "仓库id", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "response.InventoryForms": { |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "在库数量", |
| | | "type": "number" |
| | | }, |
| | | "availableNumber": { |
| | | "description": "可用库存", |
| | | "type": "number" |
| | | }, |
| | | "cost": { |
| | | "description": "成本", |
| | | "type": "number" |
| | | }, |
| | | "in": { |
| | | "description": "入库", |
| | | "type": "number" |
| | | }, |
| | | "out": { |
| | | "description": "出库", |
| | | "type": "number" |
| | | }, |
| | | "produceId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "description": "产品名称", |
| | | "type": "string" |
| | | }, |
| | | "productType": { |
| | | "description": "产品类型", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "description": "单位", |
| | | "type": "string" |
| | | }, |
| | | "value": { |
| | | "description": "总价值", |
| | | "type": "number" |
| | | } |
| | | } |
| | | }, |
| | | "response.InventoryHistory": { |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "数量", |
| | | "type": "number" |
| | | }, |
| | | "baseOperationType": { |
| | | "description": "基础作业类型", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.BaseOperationType" |
| | | } |
| | | ] |
| | | }, |
| | | "contactedName": { |
| | | "description": "完成者", |
| | | "type": "string" |
| | | }, |
| | | "date": { |
| | | "description": "日期", |
| | | "type": "string" |
| | | }, |
| | | "fromLocation": { |
| | | "description": "源位置", |
| | | "type": "string" |
| | | }, |
| | | "number": { |
| | | "description": "单号", |
| | | "type": "string" |
| | | }, |
| | | "toLocation": { |
| | | "description": "目标位置", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "description": "单位", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | - 6 |
| | | - 7 |
| | | - 8 |
| | | - 9 |
| | | type: integer |
| | | x-enum-comments: |
| | | LocationTypeAdjust: 库存盘点 |
| | | LocationTypeCustomer: 客户位置 |
| | | LocationTypeDisuse: 报废位置 |
| | | LocationTypeInternal: 内部位置 |
| | | LocationTypeInventoryLoss: 库存损失 |
| | | LocationTypeProduction: 生产 |
| | |
| | | - LocationTypeProduction |
| | | - LocationTypeTransit |
| | | - LocationTypeDisuse |
| | | - LocationTypeAdjust |
| | | constvar.MaterialMode: |
| | | enum: |
| | | - 原材料 |
| | |
| | | description: 产品id |
| | | type: string |
| | | type: object |
| | | request.AddLocationProductAmount: |
| | | properties: |
| | | Amount: |
| | | description: 库存数量 |
| | | type: number |
| | | adjustAmount: |
| | | description: 差值 |
| | | type: number |
| | | differenceAmount: |
| | | description: 计数数量 |
| | | type: number |
| | | locationId: |
| | | type: integer |
| | | productId: |
| | | type: string |
| | | type: object |
| | | request.AddOperation: |
| | | properties: |
| | | comment: |
| | |
| | | required: |
| | | - code |
| | | type: object |
| | | request.GetInventoryForms: |
| | | properties: |
| | | categoryIds: |
| | | description: 产品类型id |
| | | items: |
| | | type: integer |
| | | type: array |
| | | page: |
| | | description: 页码 |
| | | type: integer |
| | | pageSize: |
| | | description: 每页大小 |
| | | type: integer |
| | | warehouseCode: |
| | | description: 仓库缩写 |
| | | type: string |
| | | type: object |
| | | request.GetInventoryHistory: |
| | | properties: |
| | | page: |
| | | description: 页码 |
| | | type: integer |
| | | pageSize: |
| | | description: 每页大小 |
| | | type: integer |
| | | produceId: |
| | | description: 产品id |
| | | type: string |
| | | productName: |
| | | description: 产品名称 |
| | | type: string |
| | | unit: |
| | | description: 单位 |
| | | type: string |
| | | type: object |
| | | request.GetProductList: |
| | | properties: |
| | | categoryId: |
| | |
| | | description: 每页大小 |
| | | type: integer |
| | | sourceNumber: |
| | | type: string |
| | | type: object |
| | | request.QueryOperationHistory: |
| | | properties: |
| | | locationId: |
| | | type: integer |
| | | page: |
| | | description: 页码 |
| | | type: integer |
| | | pageSize: |
| | | description: 每页大小 |
| | | type: integer |
| | | productId: |
| | | type: string |
| | | type: object |
| | | request.QueryOperationList: |
| | |
| | | warehouseId: |
| | | description: 仓库id |
| | | type: integer |
| | | type: object |
| | | response.InventoryForms: |
| | | properties: |
| | | amount: |
| | | description: 在库数量 |
| | | type: number |
| | | availableNumber: |
| | | description: 可用库存 |
| | | type: number |
| | | cost: |
| | | description: 成本 |
| | | type: number |
| | | in: |
| | | description: 入库 |
| | | type: number |
| | | out: |
| | | description: 出库 |
| | | type: number |
| | | produceId: |
| | | description: 产品id |
| | | type: string |
| | | productName: |
| | | description: 产品名称 |
| | | type: string |
| | | productType: |
| | | description: 产品类型 |
| | | type: string |
| | | unit: |
| | | description: 单位 |
| | | type: string |
| | | value: |
| | | description: 总价值 |
| | | type: number |
| | | type: object |
| | | response.InventoryHistory: |
| | | properties: |
| | | amount: |
| | | description: 数量 |
| | | type: number |
| | | baseOperationType: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.BaseOperationType' |
| | | description: 基础作业类型 |
| | | contactedName: |
| | | description: 完成者 |
| | | type: string |
| | | date: |
| | | description: 日期 |
| | | type: string |
| | | fromLocation: |
| | | description: 源位置 |
| | | type: string |
| | | number: |
| | | description: 单号 |
| | | type: string |
| | | toLocation: |
| | | description: 目标位置 |
| | | type: string |
| | | unit: |
| | | description: 单位 |
| | | type: string |
| | | type: object |
| | | util.Response: |
| | | properties: |
| | |
| | | summary: 编辑公司 |
| | | tags: |
| | | - 公司 |
| | | /api-wms/v1/forms/getInventoryForms: |
| | | post: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.GetInventoryForms' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/util.ResponseList' |
| | | - properties: |
| | | data: |
| | | items: |
| | | $ref: '#/definitions/response.InventoryForms' |
| | | type: array |
| | | type: object |
| | | summary: 获取库存报表 |
| | | tags: |
| | | - 报表 |
| | | /api-wms/v1/forms/getInventoryHistory: |
| | | post: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.GetInventoryHistory' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/util.ResponseList' |
| | | - properties: |
| | | data: |
| | | items: |
| | | $ref: '#/definitions/response.InventoryHistory' |
| | | type: array |
| | | type: object |
| | | summary: 获取库存历史 |
| | | tags: |
| | | - 报表 |
| | | /api-wms/v1/location/addLocation: |
| | | post: |
| | | parameters: |
| | |
| | | description: 成功 |
| | | schema: |
| | | $ref: '#/definitions/util.Response' |
| | | summary: 库存盘点列表 |
| | | summary: 上架规则列表 |
| | | tags: |
| | | - 库存盘点 |
| | | - 上架规则 |
| | | /api-wms/v1/locationProduct/update: |
| | | post: |
| | | parameters: |
| | | - description: 入库信息 |
| | | - description: 修改参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | |
| | | summary: 修改上架规则 |
| | | tags: |
| | | - 上架规则 |
| | | /api-wms/v1/locationProductAmount/add: |
| | | post: |
| | | parameters: |
| | | - description: 入库/出库信息 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.AddLocationProductAmount' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | $ref: '#/definitions/util.Response' |
| | | summary: 添加库存盘点信息 |
| | | tags: |
| | | - 库存盘点 |
| | | /api-wms/v1/locationProductAmount/list: |
| | | post: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.PageInfo' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | $ref: '#/definitions/util.Response' |
| | | summary: 库存盘点列表 |
| | | tags: |
| | | - 库存盘点 |
| | | /api-wms/v1/operation/finish/{id}: |
| | | put: |
| | | parameters: |
| | |
| | | summary: 报废列表 |
| | | tags: |
| | | - 产品 |
| | | /api-wms/v1/product/listHistory: |
| | | post: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.QueryOperationHistory' |
| | | 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/listOperaton: |
| | | post: |
| | | parameters: |
| | |
| | | //Product{}, |
| | | ProductCategory{}, |
| | | Material{}, |
| | | LocationProduct{}, |
| | | LocationProductAmount{}, |
| | | ) |
| | | return err |
| | | } |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *LocationProductSearch) SetProductId(productId string) *LocationProductSearch { |
| | | slf.ProductId = productId |
| | | return slf |
| | | } |
| | | |
| | | func (slf *LocationProductSearch) SetLocationId(locationId int) *LocationProductSearch { |
| | | slf.LocationId = locationId |
| | | return slf |
| | | } |
| | | |
| | | func (slf *LocationProductSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Model(&LocationProduct{}) |
| | | |
| | |
| | | db = db.Model(&LocationProduct{}).Preload("Location").Preload("Area").Preload("ProductCategory").Preload("Product") |
| | | } |
| | | |
| | | if slf.LocationId != 0 { |
| | | db = db.Where("location_id = ?", slf.LocationId) |
| | | } |
| | | |
| | | if slf.ProductId != "" { |
| | | db = db.Where("product_id=?", slf.ProductId) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | |
| | | LocationProductId int `json:"locationProductId" gorm:"type:int;not null;comment:上架规则id"` //上架规则id |
| | | LocationProduct LocationProduct `json:"locationProduct" gorm:"foreignKey:LocationProductId;references:Id"` |
| | | Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:库存数量"` //库存数量 |
| | | CreateDate string `json:"createDate" gorm:"type:varchar(63);comment:日期"` //日期 |
| | | } |
| | | |
| | | LocationProductAmountSearch struct { |
| | |
| | | } |
| | | |
| | | LocationProductAmountWithOperation struct { |
| | | LocationProductAmount LocationProductAmount `json:"locationProductAmount"` |
| | | AdjustAmount decimal.Decimal `json:"adjustAmount" gorm:"column:adjust_amount"` |
| | | DifferenceAmount decimal.Decimal `json:"difference_amount"` |
| | | //LocationProductAmount LocationProductAmount `json:"locationProductAmount"` |
| | | LocationId int `json:"locationId" gorm:"column:location_id"` |
| | | LocationName string `json:"locationName" gorm:"column:location_name"` |
| | | ProductId string `json:"productId" gorm:"column:product_id"` |
| | | ProductName string `json:"productName" gorm:"column:product_name"` |
| | | Amount decimal.Decimal `json:"amount" gorm:"column:amount"` |
| | | Unit string `json:"unit" gorm:"column:unit"` |
| | | CreateDate string `json:"createDate" gorm:"column:create_date"` |
| | | AdjustAmount decimal.Decimal `json:"adjustAmount" gorm:"column:adjust_amount"` |
| | | DifferenceAmount decimal.Decimal `json:"differenceAmount" gorm:"-"` |
| | | OperationId int `json:"operationId" gorm:"column:operation_id"` |
| | | } |
| | | ) |
| | | |
| | |
| | | import "github.com/shopspring/decimal" |
| | | |
| | | type AddLocationProductAmount struct { |
| | | LocationProductAmountId int `json:"locationProductAmountId"` //库存盘点id |
| | | AdjustAmount decimal.Decimal `json:"adjustAmount" ` //差值 |
| | | DifferenceAmount decimal.Decimal `json:"difference_amount"` //计数数量 |
| | | LocationId int `json:"locationId"` |
| | | ProductId string `json:"productId"` |
| | | Amount decimal.Decimal `json:"Amount"` //库存数量 |
| | | AdjustAmount decimal.Decimal `json:"adjustAmount" ` //差值 |
| | | DifferenceAmount decimal.Decimal `json:"differenceAmount"` //计数数量 |
| | | } |
| | | |
| | | type UpdateLocationProductAmount struct { |
| | | LocationProductAmountId int `json:"locationProductAmountId"` //库存盘点id |
| | | AdjustAmount decimal.Decimal `json:"adjustAmount" ` //差值 |
| | | DifferenceAmount decimal.Decimal `json:"difference_amount"` //计数数量 |
| | | DifferenceAmount decimal.Decimal `json:"differenceAmount"` //计数数量 |
| | | OperationId int `json:"operationId"` //出入库id |
| | | } |
| | |
| | | OperationDate string `json:"operationDate"` |
| | | BaseOperationType constvar.BaseOperationType `json:"baseOperationType"` |
| | | } |
| | | |
| | | type QueryOperationHistory struct { |
| | | PageInfo |
| | | ProductId string `json:"productId"` |
| | | LocationId int `json:"locationId"` |
| | | } |
| | |
| | | productAPI.POST("listDisuse", productController.ListDisuse) //查看产品的历史出入库信息 |
| | | productAPI.PUT("finishDisuse/:id", productController.FinishDisuse) //报废验证 |
| | | productAPI.POST("updateDisuse", productController.UpdateDisuse) //修改报废信息 |
| | | productAPI.POST("listHistory", productController.ListHistory) //产品位置历史记录 |
| | | |
| | | } |
| | | |
| | | // 上架规则 |
| | | locationProductController := new(controllers.LocationProductController) |
| | | locationProductAPI := r.Group(urlPrefix + "/locationProduct") |
| | | { |
| | | locationProductAPI.GET("operationType", locationProductController.List) // 获取上架规则列表 |
| | | locationProductAPI.POST("operationType", locationProductController.Add) // 新增上架规则 |
| | | locationProductAPI.PUT("operationType/:id", locationProductController.Update) // 修改上架规则 |
| | | locationProductAPI.DELETE("operationType/:id", locationProductController.Delete) // 删除上架规则 |
| | | locationProductAPI.POST("list", locationProductController.List) // 获取上架规则列表 |
| | | locationProductAPI.POST("add", locationProductController.Add) // 新增上架规则 |
| | | locationProductAPI.POST("update", locationProductController.Update) // 修改上架规则 |
| | | locationProductAPI.DELETE("delete/:id", locationProductController.Delete) // 删除上架规则 |
| | | } |
| | | |
| | | //库存盘点 |
| | | locationProductAmountController := new(controllers.LocationProductAmountController) |
| | | locationProductAmountAPI := r.Group(urlPrefix + "/locationProductAmount") |
| | | { |
| | | locationProductAmountAPI.POST("add", locationProductAmountController.Add) //添加库存盘点信息 |
| | | locationProductAmountAPI.POST("list", locationProductAmountController.List) //查看库存盘点列表 |
| | | } |
| | | |
| | | //报表 |