From 79eca4ef507f418b88a0817f43a9ea25750a818a Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期六, 23 九月 2023 16:57:57 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS --- constvar/const.go | 1 controllers/product_controller.go | 275 ++++++++ controllers/operation.go | 92 ++ models/material.go | 21 models/operation.go | 34 request/product_request.go | 40 + docs/swagger.yaml | 341 +++++++++ request/operation.go | 10 docs/docs.go | 576 +++++++++++++++- docs/swagger.json | 574 +++++++++++++++- router/router.go | 11 11 files changed, 1,802 insertions(+), 173 deletions(-) diff --git a/constvar/const.go b/constvar/const.go index 85b175d..42221db 100644 --- a/constvar/const.go +++ b/constvar/const.go @@ -124,6 +124,7 @@ LocationTypeInventoryLoss // 搴撳瓨鎹熷け LocationTypeProduction // 鐢熶骇 LocationTypeTransit // 涓浆浣嶇疆 + LocationTypeDisuse ) func (t LocationType) Valid() bool { diff --git a/controllers/operation.go b/controllers/operation.go index 32d16bb..9d6fa9b 100644 --- a/controllers/operation.go +++ b/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(¶ms); 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(¶ms); err != nil { + if err := c.BindJSON(¶ms); err != nil { util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�:"+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(¶ms); err != nil { + util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�:"+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) +} diff --git a/controllers/product_controller.go b/controllers/product_controller.go index a47c9a1..15878dc 100644 --- a/controllers/product_controller.go +++ b/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(¶ms); err != nil { + util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�:"+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(¶ms); err != nil { + util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�:"+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(¶ms); err != nil { + util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�:"+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, "閿欒鐨刬d鍊�") + 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(¶ms); err != nil { + util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�:"+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, "娣诲姞鎴愬姛") +} diff --git a/docs/docs.go b/docs/docs.go index bce2dc6..3d921fd 100644 --- a/docs/docs.go +++ b/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": "婧愪綅缃甶d", + "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() { diff --git a/docs/swagger.json b/docs/swagger.json index cfa2f3c..a8ff32a 100644 --- a/docs/swagger.json +++ b/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": "婧愪綅缃甶d", + "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" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 0ffdc96..f0f0d6e 100644 --- a/docs/swagger.yaml +++ b/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: 婧愪綅缃甶d + 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: diff --git a/models/material.go b/models/material.go index d8098fd..dd74cb1 100644 --- a/models/material.go +++ b/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:婧愪綅缃甶d"` //婧愪綅缃甶d + 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:鑱旂郴浜篒D"` + 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:鍗曚綅"` +} diff --git a/models/operation.go b/models/operation.go index d1c7545..b0d64d4 100644 --- a/models/operation.go +++ b/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 } diff --git a/request/operation.go b/request/operation.go index b3b0bc2..9e730f2 100644 --- a/request/operation.go +++ b/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"` +} diff --git a/request/product_request.go b/request/product_request.go index 8af1cd0..0f16f7b 100644 --- a/request/product_request.go +++ b/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"` +} diff --git a/router/router.go b/router/router.go index ac257be..e912304 100644 --- a/router/router.go +++ b/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 -- Gitblit v1.8.0