| | |
| | | package constvar |
| | | |
| | | type BaseJobType int |
| | | |
| | | const ( |
| | | BaseJobTypeIncoming BaseJobType = iota + 1 //收货 |
| | | BaseJobTypeOutgoing //交货 |
| | | BaseJobTypeInternal //内部调拨 |
| | | ) |
| | | |
| | | func (slf BaseJobType) IsValid() bool { |
| | | return slf == BaseJobTypeIncoming || |
| | | slf == BaseJobTypeOutgoing || |
| | | slf == BaseJobTypeInternal |
| | | } |
| | | |
| | | type ReservationMethod int |
| | | |
| | | const ( |
| | | ReservationMethodAtConfirm ReservationMethod = iota + 1 //在确认时 |
| | | ReservationMethodManual //手动 |
| | | ReservationMethodByDate //在预定日期之前 |
| | | ) |
| | | |
| | | func (slf ReservationMethod) IsValid() bool { |
| | | return slf == ReservationMethodAtConfirm || |
| | | slf == ReservationMethodManual || |
| | | slf == ReservationMethodByDate |
| | | } |
| | | |
| | | type WhetherType int |
| | | |
| | | const ( |
| | | WhetherTypeAsk WhetherType = iota + 1 //询问 |
| | | WhetherTypeAlways //总是 |
| | | ReservationNever //从不 |
| | | ) |
| | | |
| | | func (slf WhetherType) IsValid() bool { |
| | | return slf == WhetherTypeAsk || |
| | | slf == WhetherTypeAlways || |
| | | slf == ReservationNever |
| | | } |
New file |
| | |
| | | package controllers |
| | | |
| | | import ( |
| | | "errors" |
| | | "fmt" |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/spf13/cast" |
| | | "gorm.io/gorm" |
| | | "wms/extend/code" |
| | | "wms/extend/util" |
| | | "wms/models" |
| | | "wms/pkg/logx" |
| | | "wms/pkg/structx" |
| | | "wms/request" |
| | | ) |
| | | |
| | | type CompanyController struct{} |
| | | |
| | | // Add |
| | | // @Tags 公司 |
| | | // @Summary 添加公司 |
| | | // @Produce application/json |
| | | // @Param object body request.AddCompany true "公司信息" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/company/company [post] |
| | | func (slf CompanyController) Add(c *gin.Context) { |
| | | var reqParams request.AddCompany |
| | | var params models.Company |
| | | if err := c.BindJSON(&reqParams); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误") |
| | | return |
| | | } |
| | | if err := structx.AssignTo(reqParams, ¶ms); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "数据转换错误") |
| | | return |
| | | } |
| | | |
| | | if err := slf.ParamsCheck(params); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | if err := models.NewCompanySearch().Create(¶ms); err != nil { |
| | | logx.Errorf("Company create err: %v", err) |
| | | util.ResponseFormat(c, code.SaveFail, "插入失败") |
| | | return |
| | | } |
| | | |
| | | util.ResponseFormat(c, code.Success, "添加成功") |
| | | } |
| | | |
| | | // Update |
| | | // @Tags 公司 |
| | | // @Summary 编辑公司 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateCompany true "公司信息" |
| | | // @Param id path string true "公司id" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/company/company/{id} [put] |
| | | func (slf CompanyController) Update(c *gin.Context) { |
| | | id := cast.ToUint(c.Param("id")) |
| | | if id == 0 { |
| | | util.ResponseFormat(c, code.RequestParamError, "空的记录id") |
| | | return |
| | | } |
| | | var ( |
| | | reqParams request.UpdateCompany |
| | | params models.Company |
| | | ) |
| | | if err := c.BindJSON(&reqParams); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, fmt.Sprintf("参数解析失败: %v"+err.Error())) |
| | | return |
| | | } |
| | | if err := structx.AssignTo(reqParams, ¶ms); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, fmt.Sprintf("数据转换错误: %v", err.Error())) |
| | | return |
| | | } |
| | | params.ID = id |
| | | if err := slf.ParamsCheck(params); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | |
| | | err := models.NewCompanySearch().SetID(params.ID).Update(¶ms) |
| | | |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "修改失败") |
| | | return |
| | | } |
| | | |
| | | util.ResponseFormat(c, code.UpdateSuccess, "更新成功") |
| | | } |
| | | |
| | | func (slf CompanyController) ParamsCheck(params models.Company) (err error) { |
| | | var oldRecord *models.Company |
| | | if params.ID != 0 { |
| | | oldRecord, err = models.NewCompanySearch().SetID(params.ID).First() |
| | | if err == gorm.ErrRecordNotFound { |
| | | return errors.New("记录不存在") |
| | | } |
| | | } |
| | | if oldRecord == nil || params.Name != oldRecord.Name { |
| | | _, err = models.NewCompanySearch().SetName(params.Name).First() |
| | | if err != gorm.ErrRecordNotFound { |
| | | return errors.New("公司名称重复") |
| | | } |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | // List |
| | | // @Tags 公司 |
| | | // @Summary 查询公司列表 |
| | | // @Produce application/json |
| | | // @Param object query request.GetCompanyList true "查询参数" |
| | | // @Success 200 {object} util.ResponseList{data=[]models.Company} "成功" |
| | | // @Router /api-wms/v1/company/company [get] |
| | | func (slf CompanyController) List(c *gin.Context) { |
| | | var params request.GetCompanyList |
| | | if err := c.ShouldBindQuery(¶ms); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | list, total, err := models.NewCompanySearch().SetPage(params.Page, params.PageSize).SetKeyword(params.Keyword).SetOrder("id desc").Find() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "查找失败") |
| | | return |
| | | } |
| | | |
| | | util.ResponseFormatList(c, code.Success, list, cast.ToInt(total)) |
| | | } |
| | | |
| | | // Delete |
| | | // @Tags 公司 |
| | | // @Summary 删除公司 |
| | | // @Produce application/json |
| | | // @Param id path string true "公司id" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/company/company/{id} [delete] |
| | | func (slf CompanyController) Delete(c *gin.Context) { |
| | | id := cast.ToUint(c.Param("id")) |
| | | if id == 0 { |
| | | util.ResponseFormat(c, code.RequestParamError, "空的记录id") |
| | | return |
| | | } |
| | | |
| | | err := models.NewCompanySearch().SetID(id).Delete() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "删除失败") |
| | | return |
| | | } |
| | | util.ResponseFormat(c, code.UpdateSuccess, "删除成功") |
| | | } |
New file |
| | |
| | | package controllers |
| | | |
| | | import ( |
| | | "errors" |
| | | "fmt" |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/spf13/cast" |
| | | "gorm.io/gorm" |
| | | "wms/extend/code" |
| | | "wms/extend/util" |
| | | "wms/models" |
| | | "wms/pkg/logx" |
| | | "wms/pkg/structx" |
| | | "wms/request" |
| | | ) |
| | | |
| | | type JobTypeController struct{} |
| | | |
| | | // Add |
| | | // @Tags 作业类型 |
| | | // @Summary 添加作业类型 |
| | | // @Produce application/json |
| | | // @Param object body request.AddJobType true "作业类型信息" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/warehouse/jobType [post] |
| | | func (slf JobTypeController) Add(c *gin.Context) { |
| | | var reqParams request.AddJobType |
| | | var params models.JobType |
| | | if err := c.BindJSON(&reqParams); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误") |
| | | return |
| | | } |
| | | if err := structx.AssignTo(reqParams, ¶ms); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "数据转换错误") |
| | | return |
| | | } |
| | | |
| | | if err := slf.ParamsCheck(params); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | if err := models.NewJobTypeSearch().Create(¶ms); err != nil { |
| | | logx.Errorf("JobType create err: %v", err) |
| | | util.ResponseFormat(c, code.SaveFail, "插入失败") |
| | | return |
| | | } |
| | | |
| | | util.ResponseFormat(c, code.Success, "添加成功") |
| | | } |
| | | |
| | | // Update |
| | | // @Tags 作业类型 |
| | | // @Summary 编辑作业类型 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateJobType true "作业类型信息" |
| | | // @Param id path string true "作业类型id" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/warehouse/jobType/{id} [put] |
| | | func (slf JobTypeController) Update(c *gin.Context) { |
| | | id := cast.ToUint(c.Param("id")) |
| | | if id == 0 { |
| | | util.ResponseFormat(c, code.RequestParamError, "空的记录id") |
| | | return |
| | | } |
| | | var ( |
| | | reqParams request.UpdateJobType |
| | | params models.JobType |
| | | ) |
| | | if err := c.BindJSON(&reqParams); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, fmt.Sprintf("参数解析失败: %v"+err.Error())) |
| | | return |
| | | } |
| | | if err := structx.AssignTo(reqParams, ¶ms); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, fmt.Sprintf("数据转换错误: %v", err.Error())) |
| | | return |
| | | } |
| | | params.ID = id |
| | | if err := slf.ParamsCheck(params); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | |
| | | err := models.NewJobTypeSearch().SetID(params.ID).Update(¶ms) |
| | | |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "修改失败") |
| | | return |
| | | } |
| | | |
| | | util.ResponseFormat(c, code.UpdateSuccess, "更新成功") |
| | | } |
| | | |
| | | func (slf JobTypeController) ParamsCheck(params models.JobType) (err error) { |
| | | if params.ID != 0 { |
| | | _, err = models.NewJobTypeSearch().SetID(params.ID).First() |
| | | if err == gorm.ErrRecordNotFound { |
| | | return errors.New("记录不存在") |
| | | } |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | // List |
| | | // @Tags 作业类型 |
| | | // @Summary 查询作业类型列表 |
| | | // @Produce application/json |
| | | // @Param object query request.GetJobTypeList true "查询参数" |
| | | // @Success 200 {object} util.ResponseList{data=[]models.JobType} "成功" |
| | | // @Router /api-wms/v1/warehouse/jobType [get] |
| | | func (slf JobTypeController) List(c *gin.Context) { |
| | | var params request.GetJobTypeList |
| | | if err := c.ShouldBindQuery(¶ms); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | list, total, err := models.NewJobTypeSearch().SetPage(params.Page, params.PageSize).SetKeyword(params.Keyword).SetOrder("id desc").SetPreload(true).Find() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "查找失败") |
| | | return |
| | | } |
| | | |
| | | util.ResponseFormatList(c, code.Success, list, cast.ToInt(total)) |
| | | } |
| | | |
| | | // Delete |
| | | // @Tags 作业类型 |
| | | // @Summary 删除作业类型 |
| | | // @Produce application/json |
| | | // @Param id path string true "作业类型id" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/warehouse/jobType/{id} [delete] |
| | | func (slf JobTypeController) Delete(c *gin.Context) { |
| | | id := cast.ToUint(c.Param("id")) |
| | | if id == 0 { |
| | | util.ResponseFormat(c, code.RequestParamError, "空的记录id") |
| | | return |
| | | } |
| | | |
| | | err := models.NewJobTypeSearch().SetID(id).Delete() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "删除失败") |
| | | return |
| | | } |
| | | util.ResponseFormat(c, code.UpdateSuccess, "删除成功") |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/company/company": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "公司" |
| | | ], |
| | | "summary": "查询公司列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "name": "keyword", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "页码", |
| | | "name": "page", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "每页大小", |
| | | "name": "pageSize", |
| | | "in": "query" |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.Company" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "公司" |
| | | ], |
| | | "summary": "添加公司", |
| | | "parameters": [ |
| | | { |
| | | "description": "公司信息", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddCompany" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/company/company/{id}": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "公司" |
| | | ], |
| | | "summary": "编辑公司", |
| | | "parameters": [ |
| | | { |
| | | "description": "公司信息", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateCompany" |
| | | } |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "公司id", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "公司" |
| | | ], |
| | | "summary": "删除公司", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "description": "公司id", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/warehouse/jobType": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "作业类型" |
| | | ], |
| | | "summary": "查询作业类型列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "name": "keyword", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "页码", |
| | | "name": "page", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "每页大小", |
| | | "name": "pageSize", |
| | | "in": "query" |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.JobType" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "作业类型" |
| | | ], |
| | | "summary": "添加作业类型", |
| | | "parameters": [ |
| | | { |
| | | "description": "作业类型信息", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddJobType" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/warehouse/jobType/{id}": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "作业类型" |
| | | ], |
| | | "summary": "编辑作业类型", |
| | | "parameters": [ |
| | | { |
| | | "description": "作业类型信息", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateJobType" |
| | | } |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "作业类型id", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "作业类型" |
| | | ], |
| | | "summary": "删除作业类型", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "description": "作业类型id", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/warehouse/warehouse": { |
| | | "get": { |
| | | "produces": [ |
| | |
| | | } |
| | | }, |
| | | "definitions": { |
| | | "constvar.BaseJobType": { |
| | | "type": "integer", |
| | | "enum": [ |
| | | 1, |
| | | 2, |
| | | 3 |
| | | ], |
| | | "x-enum-comments": { |
| | | "BaseJobTypeIncoming": "收货", |
| | | "BaseJobTypeInternal": "内部调拨", |
| | | "BaseJobTypeOutgoing": "交货" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "BaseJobTypeIncoming", |
| | | "BaseJobTypeOutgoing", |
| | | "BaseJobTypeInternal" |
| | | ] |
| | | }, |
| | | "constvar.ReservationMethod": { |
| | | "type": "integer", |
| | | "enum": [ |
| | | 1, |
| | | 2, |
| | | 3 |
| | | ], |
| | | "x-enum-comments": { |
| | | "ReservationMethodAtConfirm": "在确认时", |
| | | "ReservationMethodByDate": "在预定日期之前", |
| | | "ReservationMethodManual": "手动" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "ReservationMethodAtConfirm", |
| | | "ReservationMethodManual", |
| | | "ReservationMethodByDate" |
| | | ] |
| | | }, |
| | | "constvar.WhetherType": { |
| | | "type": "integer", |
| | | "enum": [ |
| | | 1, |
| | | 2, |
| | | 3 |
| | | ], |
| | | "x-enum-comments": { |
| | | "ReservationNever": "从不", |
| | | "WhetherTypeAlways": "总是", |
| | | "WhetherTypeAsk": "询问" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "WhetherTypeAsk", |
| | | "WhetherTypeAlways", |
| | | "ReservationNever" |
| | | ] |
| | | }, |
| | | "models.Company": { |
| | | "type": "object", |
| | | "properties": { |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "公司名称", |
| | | "type": "string" |
| | | }, |
| | | "updateTime": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "models.Department": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "models.JobType": { |
| | | "type": "object", |
| | | "properties": { |
| | | "ReservationDaysBeforePriority": { |
| | | "description": "在优先级的前几天", |
| | | "type": "integer" |
| | | }, |
| | | "baseJobType": { |
| | | "description": "基础作业类型", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.BaseJobType" |
| | | } |
| | | ] |
| | | }, |
| | | "company": { |
| | | "description": "公司", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Company" |
| | | } |
| | | ] |
| | | }, |
| | | "companyId": { |
| | | "description": "公司id", |
| | | "type": "integer" |
| | | }, |
| | | "createBackorder": { |
| | | "description": "创建欠单", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.WhetherType" |
| | | } |
| | | ] |
| | | }, |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "defaultLocationDest": { |
| | | "description": "默认目标位置", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Location" |
| | | } |
| | | ] |
| | | }, |
| | | "defaultLocationDestId": { |
| | | "description": "默认目标位置id", |
| | | "type": "integer" |
| | | }, |
| | | "defaultLocationSrc": { |
| | | "description": "默认源位置", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Location" |
| | | } |
| | | ] |
| | | }, |
| | | "defaultLocationSrcId": { |
| | | "description": "默认源位置id", |
| | | "type": "integer" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "仓库名称", |
| | | "type": "string" |
| | | }, |
| | | "printLabel": { |
| | | "description": "是否打印标签", |
| | | "type": "boolean" |
| | | }, |
| | | "reservationDaysBefore": { |
| | | "description": "收货前几天", |
| | | "type": "integer" |
| | | }, |
| | | "reservationMethod": { |
| | | "description": "保留方式", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.ReservationMethod" |
| | | } |
| | | ] |
| | | }, |
| | | "returnJobType": { |
| | | "description": "退货类型名称", |
| | | "type": "string" |
| | | }, |
| | | "returnJobTypeID": { |
| | | "description": "退货类型ID", |
| | | "type": "integer" |
| | | }, |
| | | "showOperations": { |
| | | "description": "显示作业详情", |
| | | "type": "boolean" |
| | | }, |
| | | "updateTime": { |
| | | "type": "string" |
| | | }, |
| | | "warehouse": { |
| | | "description": "仓库", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Warehouse" |
| | | } |
| | | ] |
| | | }, |
| | | "warehouseId": { |
| | | "description": "仓库id", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "models.Location": { |
| | | "type": "object", |
| | | "properties": { |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "位置名称", |
| | | "type": "string" |
| | | }, |
| | | "updateTime": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "models.Warehouse": { |
| | | "type": "object", |
| | | "required": [ |
| | |
| | | "maxLength": 5, |
| | | "minLength": 1 |
| | | }, |
| | | "company": { |
| | | "$ref": "#/definitions/models.Company" |
| | | }, |
| | | "companyId": { |
| | | "type": "integer" |
| | | }, |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "仓库名称", |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.AddCompany": { |
| | | "type": "object", |
| | | "properties": { |
| | | "name": { |
| | | "description": "公司名称", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.AddDepartment": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "remark": { |
| | | "description": "备注", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.AddJobType": { |
| | | "type": "object", |
| | | "properties": { |
| | | "ReservationDaysBeforePriority": { |
| | | "description": "在优先级的前几天", |
| | | "type": "integer" |
| | | }, |
| | | "baseJobType": { |
| | | "description": "基础作业类型", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.BaseJobType" |
| | | } |
| | | ] |
| | | }, |
| | | "companyId": { |
| | | "description": "公司id", |
| | | "type": "integer" |
| | | }, |
| | | "createBackorder": { |
| | | "description": "创建欠单", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.WhetherType" |
| | | } |
| | | ] |
| | | }, |
| | | "defaultLocationDestId": { |
| | | "description": "默认目标位置id", |
| | | "type": "integer" |
| | | }, |
| | | "defaultLocationSrcId": { |
| | | "description": "默认源位置id", |
| | | "type": "integer" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "仓库名称", |
| | | "type": "string" |
| | | }, |
| | | "printLabel": { |
| | | "description": "是否打印标签", |
| | | "type": "boolean" |
| | | }, |
| | | "reservationDaysBefore": { |
| | | "description": "收货前几天", |
| | | "type": "integer" |
| | | }, |
| | | "reservationMethod": { |
| | | "description": "保留方式", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.ReservationMethod" |
| | | } |
| | | ] |
| | | }, |
| | | "returnJobTypeID": { |
| | | "description": "退货类型ID", |
| | | "type": "integer" |
| | | }, |
| | | "showOperations": { |
| | | "description": "显示作业详情", |
| | | "type": "boolean" |
| | | }, |
| | | "warehouseId": { |
| | | "description": "仓库id", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateCompany": { |
| | | "type": "object", |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "公司名称", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateDepartment": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateJobType": { |
| | | "type": "object", |
| | | "properties": { |
| | | "ReservationDaysBeforePriority": { |
| | | "description": "在优先级的前几天", |
| | | "type": "integer" |
| | | }, |
| | | "baseJobType": { |
| | | "description": "基础作业类型", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.BaseJobType" |
| | | } |
| | | ] |
| | | }, |
| | | "companyId": { |
| | | "description": "公司id", |
| | | "type": "integer" |
| | | }, |
| | | "createBackorder": { |
| | | "description": "创建欠单", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.WhetherType" |
| | | } |
| | | ] |
| | | }, |
| | | "defaultLocationDestId": { |
| | | "description": "默认目标位置id", |
| | | "type": "integer" |
| | | }, |
| | | "defaultLocationSrcId": { |
| | | "description": "默认源位置id", |
| | | "type": "integer" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "仓库名称", |
| | | "type": "string" |
| | | }, |
| | | "printLabel": { |
| | | "description": "是否打印标签", |
| | | "type": "boolean" |
| | | }, |
| | | "reservationDaysBefore": { |
| | | "description": "收货前几天", |
| | | "type": "integer" |
| | | }, |
| | | "reservationMethod": { |
| | | "description": "保留方式", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.ReservationMethod" |
| | | } |
| | | ] |
| | | }, |
| | | "returnJobTypeID": { |
| | | "description": "退货类型ID", |
| | | "type": "integer" |
| | | }, |
| | | "showOperations": { |
| | | "description": "显示作业详情", |
| | | "type": "boolean" |
| | | }, |
| | | "warehouseId": { |
| | | "description": "仓库id", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateWarehouse": { |
| | | "type": "object", |
| | | "required": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/company/company": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "公司" |
| | | ], |
| | | "summary": "查询公司列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "name": "keyword", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "页码", |
| | | "name": "page", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "每页大小", |
| | | "name": "pageSize", |
| | | "in": "query" |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.Company" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "公司" |
| | | ], |
| | | "summary": "添加公司", |
| | | "parameters": [ |
| | | { |
| | | "description": "公司信息", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddCompany" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/company/company/{id}": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "公司" |
| | | ], |
| | | "summary": "编辑公司", |
| | | "parameters": [ |
| | | { |
| | | "description": "公司信息", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateCompany" |
| | | } |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "公司id", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "公司" |
| | | ], |
| | | "summary": "删除公司", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "description": "公司id", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/warehouse/jobType": { |
| | | "get": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "作业类型" |
| | | ], |
| | | "summary": "查询作业类型列表", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "name": "keyword", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "页码", |
| | | "name": "page", |
| | | "in": "query" |
| | | }, |
| | | { |
| | | "type": "integer", |
| | | "description": "每页大小", |
| | | "name": "pageSize", |
| | | "in": "query" |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.JobType" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "作业类型" |
| | | ], |
| | | "summary": "添加作业类型", |
| | | "parameters": [ |
| | | { |
| | | "description": "作业类型信息", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.AddJobType" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/warehouse/jobType/{id}": { |
| | | "put": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "作业类型" |
| | | ], |
| | | "summary": "编辑作业类型", |
| | | "parameters": [ |
| | | { |
| | | "description": "作业类型信息", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateJobType" |
| | | } |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "作业类型id", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "delete": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "作业类型" |
| | | ], |
| | | "summary": "删除作业类型", |
| | | "parameters": [ |
| | | { |
| | | "type": "string", |
| | | "description": "作业类型id", |
| | | "name": "id", |
| | | "in": "path", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "$ref": "#/definitions/util.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/warehouse/warehouse": { |
| | | "get": { |
| | | "produces": [ |
| | |
| | | } |
| | | }, |
| | | "definitions": { |
| | | "constvar.BaseJobType": { |
| | | "type": "integer", |
| | | "enum": [ |
| | | 1, |
| | | 2, |
| | | 3 |
| | | ], |
| | | "x-enum-comments": { |
| | | "BaseJobTypeIncoming": "收货", |
| | | "BaseJobTypeInternal": "内部调拨", |
| | | "BaseJobTypeOutgoing": "交货" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "BaseJobTypeIncoming", |
| | | "BaseJobTypeOutgoing", |
| | | "BaseJobTypeInternal" |
| | | ] |
| | | }, |
| | | "constvar.ReservationMethod": { |
| | | "type": "integer", |
| | | "enum": [ |
| | | 1, |
| | | 2, |
| | | 3 |
| | | ], |
| | | "x-enum-comments": { |
| | | "ReservationMethodAtConfirm": "在确认时", |
| | | "ReservationMethodByDate": "在预定日期之前", |
| | | "ReservationMethodManual": "手动" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "ReservationMethodAtConfirm", |
| | | "ReservationMethodManual", |
| | | "ReservationMethodByDate" |
| | | ] |
| | | }, |
| | | "constvar.WhetherType": { |
| | | "type": "integer", |
| | | "enum": [ |
| | | 1, |
| | | 2, |
| | | 3 |
| | | ], |
| | | "x-enum-comments": { |
| | | "ReservationNever": "从不", |
| | | "WhetherTypeAlways": "总是", |
| | | "WhetherTypeAsk": "询问" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "WhetherTypeAsk", |
| | | "WhetherTypeAlways", |
| | | "ReservationNever" |
| | | ] |
| | | }, |
| | | "models.Company": { |
| | | "type": "object", |
| | | "properties": { |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "公司名称", |
| | | "type": "string" |
| | | }, |
| | | "updateTime": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "models.Department": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "models.JobType": { |
| | | "type": "object", |
| | | "properties": { |
| | | "ReservationDaysBeforePriority": { |
| | | "description": "在优先级的前几天", |
| | | "type": "integer" |
| | | }, |
| | | "baseJobType": { |
| | | "description": "基础作业类型", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.BaseJobType" |
| | | } |
| | | ] |
| | | }, |
| | | "company": { |
| | | "description": "公司", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Company" |
| | | } |
| | | ] |
| | | }, |
| | | "companyId": { |
| | | "description": "公司id", |
| | | "type": "integer" |
| | | }, |
| | | "createBackorder": { |
| | | "description": "创建欠单", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.WhetherType" |
| | | } |
| | | ] |
| | | }, |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "defaultLocationDest": { |
| | | "description": "默认目标位置", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Location" |
| | | } |
| | | ] |
| | | }, |
| | | "defaultLocationDestId": { |
| | | "description": "默认目标位置id", |
| | | "type": "integer" |
| | | }, |
| | | "defaultLocationSrc": { |
| | | "description": "默认源位置", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Location" |
| | | } |
| | | ] |
| | | }, |
| | | "defaultLocationSrcId": { |
| | | "description": "默认源位置id", |
| | | "type": "integer" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "仓库名称", |
| | | "type": "string" |
| | | }, |
| | | "printLabel": { |
| | | "description": "是否打印标签", |
| | | "type": "boolean" |
| | | }, |
| | | "reservationDaysBefore": { |
| | | "description": "收货前几天", |
| | | "type": "integer" |
| | | }, |
| | | "reservationMethod": { |
| | | "description": "保留方式", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.ReservationMethod" |
| | | } |
| | | ] |
| | | }, |
| | | "returnJobType": { |
| | | "description": "退货类型名称", |
| | | "type": "string" |
| | | }, |
| | | "returnJobTypeID": { |
| | | "description": "退货类型ID", |
| | | "type": "integer" |
| | | }, |
| | | "showOperations": { |
| | | "description": "显示作业详情", |
| | | "type": "boolean" |
| | | }, |
| | | "updateTime": { |
| | | "type": "string" |
| | | }, |
| | | "warehouse": { |
| | | "description": "仓库", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Warehouse" |
| | | } |
| | | ] |
| | | }, |
| | | "warehouseId": { |
| | | "description": "仓库id", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "models.Location": { |
| | | "type": "object", |
| | | "properties": { |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "位置名称", |
| | | "type": "string" |
| | | }, |
| | | "updateTime": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "models.Warehouse": { |
| | | "type": "object", |
| | | "required": [ |
| | |
| | | "maxLength": 5, |
| | | "minLength": 1 |
| | | }, |
| | | "company": { |
| | | "$ref": "#/definitions/models.Company" |
| | | }, |
| | | "companyId": { |
| | | "type": "integer" |
| | | }, |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "仓库名称", |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.AddCompany": { |
| | | "type": "object", |
| | | "properties": { |
| | | "name": { |
| | | "description": "公司名称", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.AddDepartment": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "remark": { |
| | | "description": "备注", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.AddJobType": { |
| | | "type": "object", |
| | | "properties": { |
| | | "ReservationDaysBeforePriority": { |
| | | "description": "在优先级的前几天", |
| | | "type": "integer" |
| | | }, |
| | | "baseJobType": { |
| | | "description": "基础作业类型", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.BaseJobType" |
| | | } |
| | | ] |
| | | }, |
| | | "companyId": { |
| | | "description": "公司id", |
| | | "type": "integer" |
| | | }, |
| | | "createBackorder": { |
| | | "description": "创建欠单", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.WhetherType" |
| | | } |
| | | ] |
| | | }, |
| | | "defaultLocationDestId": { |
| | | "description": "默认目标位置id", |
| | | "type": "integer" |
| | | }, |
| | | "defaultLocationSrcId": { |
| | | "description": "默认源位置id", |
| | | "type": "integer" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "仓库名称", |
| | | "type": "string" |
| | | }, |
| | | "printLabel": { |
| | | "description": "是否打印标签", |
| | | "type": "boolean" |
| | | }, |
| | | "reservationDaysBefore": { |
| | | "description": "收货前几天", |
| | | "type": "integer" |
| | | }, |
| | | "reservationMethod": { |
| | | "description": "保留方式", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.ReservationMethod" |
| | | } |
| | | ] |
| | | }, |
| | | "returnJobTypeID": { |
| | | "description": "退货类型ID", |
| | | "type": "integer" |
| | | }, |
| | | "showOperations": { |
| | | "description": "显示作业详情", |
| | | "type": "boolean" |
| | | }, |
| | | "warehouseId": { |
| | | "description": "仓库id", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateCompany": { |
| | | "type": "object", |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "公司名称", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateDepartment": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateJobType": { |
| | | "type": "object", |
| | | "properties": { |
| | | "ReservationDaysBeforePriority": { |
| | | "description": "在优先级的前几天", |
| | | "type": "integer" |
| | | }, |
| | | "baseJobType": { |
| | | "description": "基础作业类型", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.BaseJobType" |
| | | } |
| | | ] |
| | | }, |
| | | "companyId": { |
| | | "description": "公司id", |
| | | "type": "integer" |
| | | }, |
| | | "createBackorder": { |
| | | "description": "创建欠单", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.WhetherType" |
| | | } |
| | | ] |
| | | }, |
| | | "defaultLocationDestId": { |
| | | "description": "默认目标位置id", |
| | | "type": "integer" |
| | | }, |
| | | "defaultLocationSrcId": { |
| | | "description": "默认源位置id", |
| | | "type": "integer" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "name": { |
| | | "description": "仓库名称", |
| | | "type": "string" |
| | | }, |
| | | "printLabel": { |
| | | "description": "是否打印标签", |
| | | "type": "boolean" |
| | | }, |
| | | "reservationDaysBefore": { |
| | | "description": "收货前几天", |
| | | "type": "integer" |
| | | }, |
| | | "reservationMethod": { |
| | | "description": "保留方式", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.ReservationMethod" |
| | | } |
| | | ] |
| | | }, |
| | | "returnJobTypeID": { |
| | | "description": "退货类型ID", |
| | | "type": "integer" |
| | | }, |
| | | "showOperations": { |
| | | "description": "显示作业详情", |
| | | "type": "boolean" |
| | | }, |
| | | "warehouseId": { |
| | | "description": "仓库id", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateWarehouse": { |
| | | "type": "object", |
| | | "required": [ |
| | |
| | | definitions: |
| | | constvar.BaseJobType: |
| | | enum: |
| | | - 1 |
| | | - 2 |
| | | - 3 |
| | | type: integer |
| | | x-enum-comments: |
| | | BaseJobTypeIncoming: 收货 |
| | | BaseJobTypeInternal: 内部调拨 |
| | | BaseJobTypeOutgoing: 交货 |
| | | x-enum-varnames: |
| | | - BaseJobTypeIncoming |
| | | - BaseJobTypeOutgoing |
| | | - BaseJobTypeInternal |
| | | constvar.ReservationMethod: |
| | | enum: |
| | | - 1 |
| | | - 2 |
| | | - 3 |
| | | type: integer |
| | | x-enum-comments: |
| | | ReservationMethodAtConfirm: 在确认时 |
| | | ReservationMethodByDate: 在预定日期之前 |
| | | ReservationMethodManual: 手动 |
| | | x-enum-varnames: |
| | | - ReservationMethodAtConfirm |
| | | - ReservationMethodManual |
| | | - ReservationMethodByDate |
| | | constvar.WhetherType: |
| | | enum: |
| | | - 1 |
| | | - 2 |
| | | - 3 |
| | | type: integer |
| | | x-enum-comments: |
| | | ReservationNever: 从不 |
| | | WhetherTypeAlways: 总是 |
| | | WhetherTypeAsk: 询问 |
| | | x-enum-varnames: |
| | | - WhetherTypeAsk |
| | | - WhetherTypeAlways |
| | | - ReservationNever |
| | | models.Company: |
| | | properties: |
| | | createTime: |
| | | type: string |
| | | id: |
| | | type: integer |
| | | name: |
| | | description: 公司名称 |
| | | type: string |
| | | updateTime: |
| | | type: string |
| | | type: object |
| | | models.Department: |
| | | properties: |
| | | children: |
| | |
| | | description: 排序 |
| | | type: integer |
| | | type: object |
| | | models.JobType: |
| | | properties: |
| | | ReservationDaysBeforePriority: |
| | | description: 在优先级的前几天 |
| | | type: integer |
| | | baseJobType: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.BaseJobType' |
| | | description: 基础作业类型 |
| | | company: |
| | | allOf: |
| | | - $ref: '#/definitions/models.Company' |
| | | description: 公司 |
| | | companyId: |
| | | description: 公司id |
| | | type: integer |
| | | createBackorder: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.WhetherType' |
| | | description: 创建欠单 |
| | | createTime: |
| | | type: string |
| | | defaultLocationDest: |
| | | allOf: |
| | | - $ref: '#/definitions/models.Location' |
| | | description: 默认目标位置 |
| | | defaultLocationDestId: |
| | | description: 默认目标位置id |
| | | type: integer |
| | | defaultLocationSrc: |
| | | allOf: |
| | | - $ref: '#/definitions/models.Location' |
| | | description: 默认源位置 |
| | | defaultLocationSrcId: |
| | | description: 默认源位置id |
| | | type: integer |
| | | id: |
| | | type: integer |
| | | name: |
| | | description: 仓库名称 |
| | | type: string |
| | | printLabel: |
| | | description: 是否打印标签 |
| | | type: boolean |
| | | reservationDaysBefore: |
| | | description: 收货前几天 |
| | | type: integer |
| | | reservationMethod: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.ReservationMethod' |
| | | description: 保留方式 |
| | | returnJobType: |
| | | description: 退货类型名称 |
| | | type: string |
| | | returnJobTypeID: |
| | | description: 退货类型ID |
| | | type: integer |
| | | showOperations: |
| | | description: 显示作业详情 |
| | | type: boolean |
| | | updateTime: |
| | | type: string |
| | | warehouse: |
| | | allOf: |
| | | - $ref: '#/definitions/models.Warehouse' |
| | | description: 仓库 |
| | | warehouseId: |
| | | description: 仓库id |
| | | type: integer |
| | | type: object |
| | | models.Location: |
| | | properties: |
| | | createTime: |
| | | type: string |
| | | id: |
| | | type: integer |
| | | name: |
| | | description: 位置名称 |
| | | type: string |
| | | updateTime: |
| | | type: string |
| | | type: object |
| | | models.Warehouse: |
| | | properties: |
| | | active: |
| | |
| | | maxLength: 5 |
| | | minLength: 1 |
| | | type: string |
| | | company: |
| | | $ref: '#/definitions/models.Company' |
| | | companyId: |
| | | type: integer |
| | | createTime: |
| | | type: string |
| | | id: |
| | | type: integer |
| | | name: |
| | | description: 仓库名称 |
| | | type: string |
| | |
| | | required: |
| | | - code |
| | | type: object |
| | | request.AddCompany: |
| | | properties: |
| | | name: |
| | | description: 公司名称 |
| | | type: string |
| | | type: object |
| | | request.AddDepartment: |
| | | properties: |
| | | name: |
| | |
| | | remark: |
| | | description: 备注 |
| | | type: string |
| | | type: object |
| | | request.AddJobType: |
| | | properties: |
| | | ReservationDaysBeforePriority: |
| | | description: 在优先级的前几天 |
| | | type: integer |
| | | baseJobType: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.BaseJobType' |
| | | description: 基础作业类型 |
| | | companyId: |
| | | description: 公司id |
| | | type: integer |
| | | createBackorder: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.WhetherType' |
| | | description: 创建欠单 |
| | | defaultLocationDestId: |
| | | description: 默认目标位置id |
| | | type: integer |
| | | defaultLocationSrcId: |
| | | description: 默认源位置id |
| | | type: integer |
| | | id: |
| | | type: integer |
| | | name: |
| | | description: 仓库名称 |
| | | type: string |
| | | printLabel: |
| | | description: 是否打印标签 |
| | | type: boolean |
| | | reservationDaysBefore: |
| | | description: 收货前几天 |
| | | type: integer |
| | | reservationMethod: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.ReservationMethod' |
| | | description: 保留方式 |
| | | returnJobTypeID: |
| | | description: 退货类型ID |
| | | type: integer |
| | | showOperations: |
| | | description: 显示作业详情 |
| | | type: boolean |
| | | warehouseId: |
| | | description: 仓库id |
| | | type: integer |
| | | type: object |
| | | request.AddWarehouse: |
| | | properties: |
| | |
| | | required: |
| | | - code |
| | | type: object |
| | | request.UpdateCompany: |
| | | properties: |
| | | id: |
| | | type: integer |
| | | name: |
| | | description: 公司名称 |
| | | type: string |
| | | type: object |
| | | request.UpdateDepartment: |
| | | properties: |
| | | id: |
| | |
| | | remark: |
| | | description: 备注 |
| | | type: string |
| | | type: object |
| | | request.UpdateJobType: |
| | | properties: |
| | | ReservationDaysBeforePriority: |
| | | description: 在优先级的前几天 |
| | | type: integer |
| | | baseJobType: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.BaseJobType' |
| | | description: 基础作业类型 |
| | | companyId: |
| | | description: 公司id |
| | | type: integer |
| | | createBackorder: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.WhetherType' |
| | | description: 创建欠单 |
| | | defaultLocationDestId: |
| | | description: 默认目标位置id |
| | | type: integer |
| | | defaultLocationSrcId: |
| | | description: 默认源位置id |
| | | type: integer |
| | | id: |
| | | type: integer |
| | | name: |
| | | description: 仓库名称 |
| | | type: string |
| | | printLabel: |
| | | description: 是否打印标签 |
| | | type: boolean |
| | | reservationDaysBefore: |
| | | description: 收货前几天 |
| | | type: integer |
| | | reservationMethod: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.ReservationMethod' |
| | | description: 保留方式 |
| | | returnJobTypeID: |
| | | description: 退货类型ID |
| | | type: integer |
| | | showOperations: |
| | | description: 显示作业详情 |
| | | type: boolean |
| | | warehouseId: |
| | | description: 仓库id |
| | | type: integer |
| | | type: object |
| | | request.UpdateWarehouse: |
| | | properties: |
| | |
| | | summary: 编辑部门信息 |
| | | tags: |
| | | - 部门信息 |
| | | /api-wms/v1/company/company: |
| | | get: |
| | | parameters: |
| | | - in: query |
| | | name: keyword |
| | | type: string |
| | | - description: 页码 |
| | | in: query |
| | | name: page |
| | | type: integer |
| | | - description: 每页大小 |
| | | in: query |
| | | name: pageSize |
| | | type: integer |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/util.ResponseList' |
| | | - properties: |
| | | data: |
| | | items: |
| | | $ref: '#/definitions/models.Company' |
| | | type: array |
| | | type: object |
| | | summary: 查询公司列表 |
| | | tags: |
| | | - 公司 |
| | | post: |
| | | parameters: |
| | | - description: 公司信息 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.AddCompany' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | $ref: '#/definitions/util.Response' |
| | | summary: 添加公司 |
| | | tags: |
| | | - 公司 |
| | | /api-wms/v1/company/company/{id}: |
| | | delete: |
| | | parameters: |
| | | - description: 公司id |
| | | in: path |
| | | name: id |
| | | required: true |
| | | type: string |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | $ref: '#/definitions/util.Response' |
| | | summary: 删除公司 |
| | | tags: |
| | | - 公司 |
| | | put: |
| | | parameters: |
| | | - description: 公司信息 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.UpdateCompany' |
| | | - description: 公司id |
| | | in: path |
| | | name: id |
| | | required: true |
| | | type: string |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | $ref: '#/definitions/util.Response' |
| | | summary: 编辑公司 |
| | | tags: |
| | | - 公司 |
| | | /api-wms/v1/warehouse/jobType: |
| | | get: |
| | | parameters: |
| | | - in: query |
| | | name: keyword |
| | | type: string |
| | | - description: 页码 |
| | | in: query |
| | | name: page |
| | | type: integer |
| | | - description: 每页大小 |
| | | in: query |
| | | name: pageSize |
| | | type: integer |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/util.ResponseList' |
| | | - properties: |
| | | data: |
| | | items: |
| | | $ref: '#/definitions/models.JobType' |
| | | type: array |
| | | type: object |
| | | summary: 查询作业类型列表 |
| | | tags: |
| | | - 作业类型 |
| | | post: |
| | | parameters: |
| | | - description: 作业类型信息 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.AddJobType' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | $ref: '#/definitions/util.Response' |
| | | summary: 添加作业类型 |
| | | tags: |
| | | - 作业类型 |
| | | /api-wms/v1/warehouse/jobType/{id}: |
| | | delete: |
| | | parameters: |
| | | - description: 作业类型id |
| | | in: path |
| | | name: id |
| | | required: true |
| | | type: string |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | $ref: '#/definitions/util.Response' |
| | | summary: 删除作业类型 |
| | | tags: |
| | | - 作业类型 |
| | | put: |
| | | parameters: |
| | | - description: 作业类型信息 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.UpdateJobType' |
| | | - description: 作业类型id |
| | | in: path |
| | | name: id |
| | | required: true |
| | | type: string |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | $ref: '#/definitions/util.Response' |
| | | summary: 编辑作业类型 |
| | | tags: |
| | | - 作业类型 |
| | | /api-wms/v1/warehouse/warehouse: |
| | | get: |
| | | parameters: |
New file |
| | |
| | | package models |
| | | |
| | | import ( |
| | | "fmt" |
| | | "gorm.io/gorm" |
| | | "wms/pkg/mysqlx" |
| | | ) |
| | | |
| | | type ( |
| | | // Company 公司 |
| | | Company struct { |
| | | WmsModel |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | Name string `json:"name" gorm:"index;type:varchar(255);not null;comment:公司名称"` //公司名称 |
| | | } |
| | | |
| | | CompanySearch struct { |
| | | Company |
| | | Order string |
| | | PageNum int |
| | | PageSize int |
| | | Keyword string |
| | | Orm *gorm.DB |
| | | } |
| | | ) |
| | | |
| | | func (slf *Company) TableName() string { |
| | | return "company" |
| | | } |
| | | |
| | | func NewCompanySearch() *CompanySearch { |
| | | return &CompanySearch{Orm: mysqlx.GetDB()} |
| | | } |
| | | |
| | | func (slf *CompanySearch) SetOrm(tx *gorm.DB) *CompanySearch { |
| | | slf.Orm = tx |
| | | return slf |
| | | } |
| | | |
| | | func (slf *CompanySearch) SetPage(page, size int) *CompanySearch { |
| | | slf.PageNum, slf.PageSize = page, size |
| | | return slf |
| | | } |
| | | |
| | | func (slf *CompanySearch) SetOrder(order string) *CompanySearch { |
| | | slf.Order = order |
| | | return slf |
| | | } |
| | | |
| | | func (slf *CompanySearch) SetID(id uint) *CompanySearch { |
| | | slf.ID = id |
| | | return slf |
| | | } |
| | | |
| | | func (slf *CompanySearch) SetName(name string) *CompanySearch { |
| | | slf.Name = name |
| | | return slf |
| | | } |
| | | |
| | | func (slf *CompanySearch) SetKeyword(keyword string) *CompanySearch { |
| | | slf.Keyword = keyword |
| | | return slf |
| | | } |
| | | |
| | | func (slf *CompanySearch) build() *gorm.DB { |
| | | var db = slf.Orm.Table(slf.TableName()) |
| | | |
| | | if slf.ID != 0 { |
| | | db = db.Where("id = ?", slf.ID) |
| | | } |
| | | |
| | | if slf.Order != "" { |
| | | db = db.Order(slf.Order) |
| | | } |
| | | |
| | | if slf.Keyword != "" { |
| | | db = db.Where("name like ?", fmt.Sprintf("%%%v%%", slf.Keyword)) |
| | | } |
| | | if slf.Name != "" { |
| | | db = db.Where("name = ?", slf.Name) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | | // Create 单条插入 |
| | | func (slf *CompanySearch) Create(record *Company) error { |
| | | var db = slf.build() |
| | | |
| | | if err := db.Create(record).Error; err != nil { |
| | | return err |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | // CreateBatch 批量插入 |
| | | func (slf *CompanySearch) CreateBatch(records []*Company) error { |
| | | var db = slf.build() |
| | | |
| | | if err := db.Create(&records).Error; err != nil { |
| | | return fmt.Errorf("create batch err: %v, records: %+v", err, records) |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | func (slf *CompanySearch) Update(record *Company) error { |
| | | var db = slf.build() |
| | | |
| | | if err := db.Omit("CreatedAt").Updates(record).Error; err != nil { |
| | | return fmt.Errorf("save err: %v, record: %+v", err, record) |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | func (slf *CompanySearch) UpdateByMap(upMap map[string]interface{}) error { |
| | | var ( |
| | | db = slf.build() |
| | | ) |
| | | |
| | | if err := db.Updates(upMap).Error; err != nil { |
| | | return fmt.Errorf("update by map err: %v, upMap: %+v", err, upMap) |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | func (slf *CompanySearch) UpdateByQuery(query string, args []interface{}, upMap map[string]interface{}) error { |
| | | var ( |
| | | db = slf.Orm.Table(slf.TableName()).Where(query, args...) |
| | | ) |
| | | |
| | | if err := db.Updates(upMap).Error; err != nil { |
| | | return fmt.Errorf("update by query err: %v, query: %s, args: %+v, upMap: %+v", err, query, args, upMap) |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | func (slf *CompanySearch) Delete() error { |
| | | var db = slf.build() |
| | | return db.Delete(&Company{}).Error |
| | | } |
| | | |
| | | func (slf *CompanySearch) First() (*Company, error) { |
| | | var ( |
| | | record = new(Company) |
| | | db = slf.build() |
| | | ) |
| | | |
| | | if err := db.First(record).Error; err != nil { |
| | | return record, err |
| | | } |
| | | |
| | | return record, nil |
| | | } |
| | | |
| | | func (slf *CompanySearch) Find() ([]*Company, int64, error) { |
| | | var ( |
| | | records = make([]*Company, 0) |
| | | total int64 |
| | | db = slf.build() |
| | | ) |
| | | |
| | | if err := db.Count(&total).Error; err != nil { |
| | | return records, total, fmt.Errorf("find count err: %v", err) |
| | | } |
| | | if slf.PageNum*slf.PageSize > 0 { |
| | | db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) |
| | | } |
| | | if err := db.Find(&records).Error; err != nil { |
| | | return records, total, fmt.Errorf("find records err: %v", err) |
| | | } |
| | | |
| | | return records, total, nil |
| | | } |
| | | |
| | | func (slf *CompanySearch) FindNotTotal() ([]*Company, error) { |
| | | var ( |
| | | records = make([]*Company, 0) |
| | | db = slf.build() |
| | | ) |
| | | |
| | | if slf.PageNum*slf.PageSize > 0 { |
| | | db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) |
| | | } |
| | | if err := db.Find(&records).Error; err != nil { |
| | | return records, fmt.Errorf("find records err: %v", err) |
| | | } |
| | | |
| | | return records, nil |
| | | } |
| | | |
| | | // FindByQuery 指定条件查询. |
| | | func (slf *CompanySearch) FindByQuery(query string, args []interface{}) ([]*Company, int64, error) { |
| | | var ( |
| | | records = make([]*Company, 0) |
| | | total int64 |
| | | db = slf.Orm.Table(slf.TableName()).Where(query, args...) |
| | | ) |
| | | |
| | | if err := db.Count(&total).Error; err != nil { |
| | | return records, total, fmt.Errorf("find by query count err: %v", err) |
| | | } |
| | | if slf.PageNum*slf.PageSize > 0 { |
| | | db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) |
| | | } |
| | | if err := db.Find(&records).Error; err != nil { |
| | | return records, total, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) |
| | | } |
| | | |
| | | return records, total, nil |
| | | } |
| | | |
| | | // FindByQueryNotTotal 指定条件查询&不查询总条数. |
| | | func (slf *CompanySearch) FindByQueryNotTotal(query string, args []interface{}) ([]*Company, error) { |
| | | var ( |
| | | records = make([]*Company, 0) |
| | | db = slf.Orm.Table(slf.TableName()).Where(query, args...) |
| | | ) |
| | | |
| | | if slf.PageNum*slf.PageSize > 0 { |
| | | db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) |
| | | } |
| | | if err := db.Find(&records).Error; err != nil { |
| | | return records, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) |
| | | } |
| | | |
| | | return records, nil |
| | | } |
| | |
| | | func RegisterTables() error { |
| | | db := mysqlx.GetDB() |
| | | err := db.AutoMigrate( |
| | | Company{}, |
| | | Warehouse{}, |
| | | JobType{}, |
| | | Location{}, |
| | | ) |
| | | return err |
| | | } |
New file |
| | |
| | | package models |
| | | |
| | | import ( |
| | | "fmt" |
| | | "gorm.io/gorm" |
| | | "wms/constvar" |
| | | "wms/pkg/mysqlx" |
| | | ) |
| | | |
| | | type ( |
| | | // JobType 作业类型 |
| | | JobType struct { |
| | | WmsModel |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | Name string `json:"name" gorm:"index;type:varchar(255);not null;comment:仓库名称"` //仓库名称 |
| | | BaseJobType constvar.BaseJobType `json:"baseJobType" gorm:"type:tinyint;not null;comment:基础作业类型"` //基础作业类型 |
| | | CompanyId int `json:"companyId" gorm:"type:int;not null;comment:公司id"` //公司id |
| | | Company Company `json:"company" gorm:"foreignKey:CompanyId"` //公司 |
| | | WarehouseId int `json:"warehouseId" gorm:"type:int;not null;comment:仓库id"` //仓库id |
| | | Warehouse Warehouse `json:"warehouse" gorm:"foreignKey:WarehouseId"` //仓库 |
| | | |
| | | DefaultLocationSrcId int `json:"defaultLocationSrcId" gorm:"type:int;not null;comment:默认源位置id"` //默认源位置id |
| | | DefaultLocationSrc Location `json:"defaultLocationSrc" gorm:"foreignKey:DefaultLocationSrcId"` //默认源位置 |
| | | DefaultLocationDestId int `json:"defaultLocationDestId" gorm:"type:int;not null;comment:默认目标位置id"` //默认目标位置id |
| | | DefaultLocationDest Location `json:"defaultLocationDest" gorm:"foreignKey:DefaultLocationDestId"` //默认目标位置 |
| | | |
| | | PrintLabel bool `json:"printLabel" gorm:"column:print_label;type:tinyint;comment:打印标签"` //是否打印标签 |
| | | ReservationMethod constvar.ReservationMethod `json:"reservationMethod" gorm:"column:reservation_method"` //保留方式 |
| | | ReservationDaysBefore int `json:"reservationDaysBefore" gorm:"type:int;"` //收货前几天 |
| | | ReservationDaysBeforePriority int `json:"ReservationDaysBeforePriority" gorm:"type:int;"` //在优先级的前几天 |
| | | ShowOperations bool `json:"showOperations" gorm:"column:show_operations;type:int"` //显示作业详情 |
| | | CreateBackorder constvar.WhetherType `json:"createBackorder" gorm:"column:create_backorder"` //创建欠单 |
| | | ReturnJobTypeID int `json:"returnJobTypeID" gorm:"column:return_job_type_id"` //退货类型ID |
| | | ReturnJobType string `json:"returnJobType" gorm:"-"` //退货类型名称 |
| | | } |
| | | |
| | | JobTypeSearch struct { |
| | | JobType |
| | | Order string |
| | | PageNum int |
| | | PageSize int |
| | | Keyword string |
| | | Orm *gorm.DB |
| | | Preload bool |
| | | } |
| | | ) |
| | | |
| | | func (slf *JobType) TableName() string { |
| | | return "job_type" |
| | | } |
| | | |
| | | func NewJobTypeSearch() *JobTypeSearch { |
| | | return &JobTypeSearch{Orm: mysqlx.GetDB()} |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) SetOrm(tx *gorm.DB) *JobTypeSearch { |
| | | slf.Orm = tx |
| | | return slf |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) SetPage(page, size int) *JobTypeSearch { |
| | | slf.PageNum, slf.PageSize = page, size |
| | | return slf |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) SetOrder(order string) *JobTypeSearch { |
| | | slf.Order = order |
| | | return slf |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) SetID(id uint) *JobTypeSearch { |
| | | slf.ID = id |
| | | return slf |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) SetName(name string) *JobTypeSearch { |
| | | slf.Name = name |
| | | return slf |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) SetKeyword(keyword string) *JobTypeSearch { |
| | | slf.Keyword = keyword |
| | | return slf |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) SetPreload(preload bool) *JobTypeSearch { |
| | | slf.Preload = preload |
| | | return slf |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Model(&JobType{}) |
| | | |
| | | if slf.ID != 0 { |
| | | db = db.Where("id = ?", slf.ID) |
| | | } |
| | | |
| | | if slf.Order != "" { |
| | | db = db.Order(slf.Order) |
| | | } |
| | | |
| | | if slf.Keyword != "" { |
| | | db = db.Where("name like ?", fmt.Sprintf("%%%v%%", slf.Keyword)) |
| | | } |
| | | |
| | | if slf.Name != "" { |
| | | db = db.Where("name = ?", slf.Name) |
| | | } |
| | | |
| | | if slf.Preload { |
| | | db = db.Preload("Company").Preload("Warehouse").Preload("DefaultLocationSrc").Preload("DefaultLocationDest") |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | | // Create 单条插入 |
| | | func (slf *JobTypeSearch) Create(record *JobType) error { |
| | | var db = slf.build() |
| | | |
| | | if err := db.Create(record).Error; err != nil { |
| | | return err |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | // CreateBatch 批量插入 |
| | | func (slf *JobTypeSearch) CreateBatch(records []*JobType) error { |
| | | var db = slf.build() |
| | | |
| | | if err := db.Create(&records).Error; err != nil { |
| | | return fmt.Errorf("create batch err: %v, records: %+v", err, records) |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) Update(record *JobType) error { |
| | | var db = slf.build() |
| | | |
| | | if err := db.Omit("CreatedAt").Updates(record).Error; err != nil { |
| | | return fmt.Errorf("save err: %v, record: %+v", err, record) |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) UpdateByMap(upMap map[string]interface{}) error { |
| | | var ( |
| | | db = slf.build() |
| | | ) |
| | | |
| | | if err := db.Updates(upMap).Error; err != nil { |
| | | return fmt.Errorf("update by map err: %v, upMap: %+v", err, upMap) |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) UpdateByQuery(query string, args []interface{}, upMap map[string]interface{}) error { |
| | | var ( |
| | | db = slf.Orm.Table(slf.TableName()).Where(query, args...) |
| | | ) |
| | | |
| | | if err := db.Updates(upMap).Error; err != nil { |
| | | return fmt.Errorf("update by query err: %v, query: %s, args: %+v, upMap: %+v", err, query, args, upMap) |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) Delete() error { |
| | | var db = slf.build() |
| | | return db.Delete(&JobType{}).Error |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) First() (*JobType, error) { |
| | | var ( |
| | | record = new(JobType) |
| | | db = slf.build() |
| | | ) |
| | | |
| | | if err := db.First(record).Error; err != nil { |
| | | return record, err |
| | | } |
| | | |
| | | return record, nil |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) Find() ([]*JobType, int64, error) { |
| | | var ( |
| | | records = make([]*JobType, 0) |
| | | total int64 |
| | | db = slf.build() |
| | | ) |
| | | |
| | | if err := db.Count(&total).Error; err != nil { |
| | | return records, total, fmt.Errorf("find count err: %v", err) |
| | | } |
| | | if slf.PageNum*slf.PageSize > 0 { |
| | | db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) |
| | | } |
| | | if err := db.Find(&records).Error; err != nil { |
| | | return records, total, fmt.Errorf("find records err: %v", err) |
| | | } |
| | | |
| | | return records, total, nil |
| | | } |
| | | |
| | | func (slf *JobTypeSearch) FindNotTotal() ([]*JobType, error) { |
| | | var ( |
| | | records = make([]*JobType, 0) |
| | | db = slf.build() |
| | | ) |
| | | |
| | | if slf.PageNum*slf.PageSize > 0 { |
| | | db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) |
| | | } |
| | | if err := db.Find(&records).Error; err != nil { |
| | | return records, fmt.Errorf("find records err: %v", err) |
| | | } |
| | | |
| | | return records, nil |
| | | } |
| | | |
| | | // FindByQuery 指定条件查询. |
| | | func (slf *JobTypeSearch) FindByQuery(query string, args []interface{}) ([]*JobType, int64, error) { |
| | | var ( |
| | | records = make([]*JobType, 0) |
| | | total int64 |
| | | db = slf.Orm.Table(slf.TableName()).Where(query, args...) |
| | | ) |
| | | |
| | | if err := db.Count(&total).Error; err != nil { |
| | | return records, total, fmt.Errorf("find by query count err: %v", err) |
| | | } |
| | | if slf.PageNum*slf.PageSize > 0 { |
| | | db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) |
| | | } |
| | | if err := db.Find(&records).Error; err != nil { |
| | | return records, total, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) |
| | | } |
| | | |
| | | return records, total, nil |
| | | } |
| | | |
| | | // FindByQueryNotTotal 指定条件查询&不查询总条数. |
| | | func (slf *JobTypeSearch) FindByQueryNotTotal(query string, args []interface{}) ([]*JobType, error) { |
| | | var ( |
| | | records = make([]*JobType, 0) |
| | | db = slf.Orm.Table(slf.TableName()).Where(query, args...) |
| | | ) |
| | | |
| | | if slf.PageNum*slf.PageSize > 0 { |
| | | db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) |
| | | } |
| | | if err := db.Find(&records).Error; err != nil { |
| | | return records, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) |
| | | } |
| | | |
| | | return records, nil |
| | | } |
New file |
| | |
| | | package models |
| | | |
| | | import ( |
| | | "fmt" |
| | | "gorm.io/gorm" |
| | | "wms/pkg/mysqlx" |
| | | ) |
| | | |
| | | type ( |
| | | // Location 位置 |
| | | Location struct { |
| | | WmsModel |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | Name string `json:"name" gorm:"index;type:varchar(255);not null;comment:位置名称"` //位置名称 |
| | | } |
| | | |
| | | LocationSearch struct { |
| | | Location |
| | | Order string |
| | | PageNum int |
| | | PageSize int |
| | | Keyword string |
| | | Orm *gorm.DB |
| | | Preload bool |
| | | } |
| | | ) |
| | | |
| | | func (slf *Location) TableName() string { |
| | | return "location" |
| | | } |
| | | |
| | | func NewLocationSearch() *LocationSearch { |
| | | return &LocationSearch{Orm: mysqlx.GetDB()} |
| | | } |
| | | |
| | | func (slf *LocationSearch) SetOrm(tx *gorm.DB) *LocationSearch { |
| | | slf.Orm = tx |
| | | return slf |
| | | } |
| | | |
| | | func (slf *LocationSearch) SetPage(page, size int) *LocationSearch { |
| | | slf.PageNum, slf.PageSize = page, size |
| | | return slf |
| | | } |
| | | |
| | | func (slf *LocationSearch) SetOrder(order string) *LocationSearch { |
| | | slf.Order = order |
| | | return slf |
| | | } |
| | | |
| | | func (slf *LocationSearch) SetID(id uint) *LocationSearch { |
| | | slf.ID = id |
| | | return slf |
| | | } |
| | | |
| | | func (slf *LocationSearch) SetName(name string) *LocationSearch { |
| | | slf.Name = name |
| | | return slf |
| | | } |
| | | |
| | | func (slf *LocationSearch) SetKeyword(keyword string) *LocationSearch { |
| | | slf.Keyword = keyword |
| | | return slf |
| | | } |
| | | |
| | | func (slf *LocationSearch) SetPreload(preload bool) *LocationSearch { |
| | | slf.Preload = preload |
| | | return slf |
| | | } |
| | | |
| | | func (slf *LocationSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Model(&Location{}) |
| | | |
| | | if slf.ID != 0 { |
| | | db = db.Where("id = ?", slf.ID) |
| | | } |
| | | |
| | | if slf.Order != "" { |
| | | db = db.Order(slf.Order) |
| | | } |
| | | |
| | | if slf.Keyword != "" { |
| | | db = db.Where("name like ?", fmt.Sprintf("%%%v%%", slf.Keyword)) |
| | | } |
| | | |
| | | if slf.Name != "" { |
| | | db = db.Where("name = ?", slf.Name) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | | // Create 单条插入 |
| | | func (slf *LocationSearch) Create(record *Location) error { |
| | | var db = slf.build() |
| | | |
| | | if err := db.Create(record).Error; err != nil { |
| | | return err |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | // CreateBatch 批量插入 |
| | | func (slf *LocationSearch) CreateBatch(records []*Location) error { |
| | | var db = slf.build() |
| | | |
| | | if err := db.Create(&records).Error; err != nil { |
| | | return fmt.Errorf("create batch err: %v, records: %+v", err, records) |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | func (slf *LocationSearch) Update(record *Location) error { |
| | | var db = slf.build() |
| | | |
| | | if err := db.Omit("CreatedAt").Updates(record).Error; err != nil { |
| | | return fmt.Errorf("save err: %v, record: %+v", err, record) |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | func (slf *LocationSearch) UpdateByMap(upMap map[string]interface{}) error { |
| | | var ( |
| | | db = slf.build() |
| | | ) |
| | | |
| | | if err := db.Updates(upMap).Error; err != nil { |
| | | return fmt.Errorf("update by map err: %v, upMap: %+v", err, upMap) |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | func (slf *LocationSearch) UpdateByQuery(query string, args []interface{}, upMap map[string]interface{}) error { |
| | | var ( |
| | | db = slf.Orm.Table(slf.TableName()).Where(query, args...) |
| | | ) |
| | | |
| | | if err := db.Updates(upMap).Error; err != nil { |
| | | return fmt.Errorf("update by query err: %v, query: %s, args: %+v, upMap: %+v", err, query, args, upMap) |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |
| | | func (slf *LocationSearch) Delete() error { |
| | | var db = slf.build() |
| | | return db.Delete(&Location{}).Error |
| | | } |
| | | |
| | | func (slf *LocationSearch) First() (*Location, error) { |
| | | var ( |
| | | record = new(Location) |
| | | db = slf.build() |
| | | ) |
| | | |
| | | if err := db.First(record).Error; err != nil { |
| | | return record, err |
| | | } |
| | | |
| | | return record, nil |
| | | } |
| | | |
| | | func (slf *LocationSearch) Find() ([]*Location, int64, error) { |
| | | var ( |
| | | records = make([]*Location, 0) |
| | | total int64 |
| | | db = slf.build() |
| | | ) |
| | | |
| | | if err := db.Count(&total).Error; err != nil { |
| | | return records, total, fmt.Errorf("find count err: %v", err) |
| | | } |
| | | if slf.PageNum*slf.PageSize > 0 { |
| | | db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) |
| | | } |
| | | if err := db.Find(&records).Error; err != nil { |
| | | return records, total, fmt.Errorf("find records err: %v", err) |
| | | } |
| | | |
| | | return records, total, nil |
| | | } |
| | | |
| | | func (slf *LocationSearch) FindNotTotal() ([]*Location, error) { |
| | | var ( |
| | | records = make([]*Location, 0) |
| | | db = slf.build() |
| | | ) |
| | | |
| | | if slf.PageNum*slf.PageSize > 0 { |
| | | db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) |
| | | } |
| | | if err := db.Find(&records).Error; err != nil { |
| | | return records, fmt.Errorf("find records err: %v", err) |
| | | } |
| | | |
| | | return records, nil |
| | | } |
| | | |
| | | // FindByQuery 指定条件查询. |
| | | func (slf *LocationSearch) FindByQuery(query string, args []interface{}) ([]*Location, int64, error) { |
| | | var ( |
| | | records = make([]*Location, 0) |
| | | total int64 |
| | | db = slf.Orm.Table(slf.TableName()).Where(query, args...) |
| | | ) |
| | | |
| | | if err := db.Count(&total).Error; err != nil { |
| | | return records, total, fmt.Errorf("find by query count err: %v", err) |
| | | } |
| | | if slf.PageNum*slf.PageSize > 0 { |
| | | db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) |
| | | } |
| | | if err := db.Find(&records).Error; err != nil { |
| | | return records, total, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) |
| | | } |
| | | |
| | | return records, total, nil |
| | | } |
| | | |
| | | // FindByQueryNotTotal 指定条件查询&不查询总条数. |
| | | func (slf *LocationSearch) FindByQueryNotTotal(query string, args []interface{}) ([]*Location, error) { |
| | | var ( |
| | | records = make([]*Location, 0) |
| | | db = slf.Orm.Table(slf.TableName()).Where(query, args...) |
| | | ) |
| | | |
| | | if slf.PageNum*slf.PageSize > 0 { |
| | | db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) |
| | | } |
| | | if err := db.Find(&records).Error; err != nil { |
| | | return records, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) |
| | | } |
| | | |
| | | return records, nil |
| | | } |
| | |
| | | ) |
| | | |
| | | type ( |
| | | // Warehouse 部门信息 |
| | | // Warehouse 仓库 |
| | | Warehouse struct { |
| | | WmsModel |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | Name string `json:"name" gorm:"index;type:varchar(255);not null;comment:仓库名称"` //仓库名称 |
| | | Active bool `json:"active" gorm:"type:tinyint(1);not null;comment:是否激活"` //是否启用,传true就行 |
| | | Code string `json:"code" binding:"required,min=1,max=5" gorm:"index;type:varchar(255);not null;comment:仓库编码"` //仓库编码 |
| | |
| | | ResupplyWhIdsStr string `json:"-" gorm:"column:resupply_wh_ids;type:varchar(255);not null;comment:补给来源仓库ID"` //补给来源仓库ID |
| | | ResupplyWhIds []string `json:"resupplyWhIds" gorm:"-"` //补给来源仓库ID |
| | | ResupplyWh []*Warehouse `json:"resupplyWh" gorm:"-"` //补给来源仓库 |
| | | CompanyId int `json:"companyId" gorm:"type:int;not null;comment:公司id"` |
| | | Company Company `json:"company" gorm:"foreignKey:CompanyId"` |
| | | } |
| | | |
| | | WarehouseSearch struct { |
| | |
| | | PageSize int |
| | | Keyword string |
| | | Orm *gorm.DB |
| | | Preload bool |
| | | } |
| | | ) |
| | | |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *WarehouseSearch) SetPreload(preload bool) *WarehouseSearch { |
| | | slf.Preload = preload |
| | | return slf |
| | | } |
| | | |
| | | func (slf *WarehouseSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Table(slf.TableName()) |
| | | var db = slf.Orm.Model(&Warehouse{}) |
| | | |
| | | if slf.ID != 0 { |
| | | db = db.Where("id = ?", slf.ID) |
| | |
| | | if slf.Keyword != "" { |
| | | db = db.Where("name like ?", fmt.Sprintf("%%%v%%", slf.Keyword)) |
| | | } |
| | | |
| | | if slf.Name != "" { |
| | | db = db.Where("name = ?", slf.Name) |
| | | } |
| | | |
| | | if slf.Preload { |
| | | db = db.Preload("Company") |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
New file |
| | |
| | | package request |
| | | |
| | | type GetCompanyList struct { |
| | | PageInfo |
| | | Keyword string `json:"keyword"` |
| | | } |
| | | |
| | | type AddCompany struct { |
| | | Name string `json:"name" gorm:"index;type:varchar(255);not null;comment:公司名称"` //公司名称 |
| | | } |
| | | |
| | | type UpdateCompany struct { |
| | | ID uint `gorm:"comment:主键ID;primaryKey;" json:"id"` |
| | | AddCompany |
| | | } |
New file |
| | |
| | | package request |
| | | |
| | | import "wms/constvar" |
| | | |
| | | type GetJobTypeList struct { |
| | | PageInfo |
| | | Keyword string `json:"keyword"` |
| | | } |
| | | |
| | | type AddJobType struct { |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | Name string `json:"name" gorm:"index;type:varchar(255);not null;comment:仓库名称"` //仓库名称 |
| | | BaseJobType constvar.BaseJobType `json:"baseJobType" gorm:"type:tinyint;not null;comment:基础作业类型"` //基础作业类型 |
| | | CompanyId int `json:"companyId" gorm:"type:int;not null;comment:公司id"` //公司id |
| | | WarehouseId int `json:"warehouseId" gorm:"type:int;not null;comment:仓库id"` //仓库id |
| | | |
| | | DefaultLocationSrcId int `json:"defaultLocationSrcId" gorm:"type:int;not null;comment:默认源位置id"` //默认源位置id |
| | | DefaultLocationDestId int `json:"defaultLocationDestId" gorm:"type:int;not null;comment:默认目标位置id"` //默认目标位置id |
| | | |
| | | PrintLabel bool `json:"printLabel" gorm:"column:print_label;type:tinyint;comment:打印标签"` //是否打印标签 |
| | | ReservationMethod constvar.ReservationMethod `json:"reservationMethod" gorm:"column:reservation_method"` //保留方式 |
| | | ReservationDaysBefore int `json:"reservationDaysBefore" gorm:"type:int;"` //收货前几天 |
| | | ReservationDaysBeforePriority int `json:"ReservationDaysBeforePriority" gorm:"type:int;"` //在优先级的前几天 |
| | | ShowOperations bool `json:"showOperations" gorm:"column:show_operations;type:int"` //显示作业详情 |
| | | CreateBackorder constvar.WhetherType `json:"createBackorder" gorm:"column:create_backorder"` //创建欠单 |
| | | ReturnJobTypeID int `json:"returnJobTypeID" gorm:"column:return_job_type_id"` //退货类型ID |
| | | } |
| | | |
| | | type UpdateJobType struct { |
| | | ID uint `gorm:"comment:主键ID;primaryKey;" json:"id"` |
| | | AddJobType |
| | | } |
| | |
| | | organizeAPI.DELETE("department/:id", departmentController.Delete) // 删除部门 |
| | | } |
| | | |
| | | // 公司管理 |
| | | companyController := new(controllers.CompanyController) |
| | | companyAPI := r.Group(urlPrefix + "/company") |
| | | { |
| | | companyAPI.GET("company", companyController.List) // 获取公司列表 |
| | | companyAPI.POST("company", companyController.Add) // 新增公司 |
| | | companyAPI.PUT("company/:id", companyController.Update) // 修改公司 |
| | | companyAPI.DELETE("company/:id", companyController.Delete) // 删除公司 |
| | | } |
| | | |
| | | // 仓库管理 |
| | | warehouseController := new(controllers.WarehouseController) |
| | | warehouseAPI := r.Group(urlPrefix + "/warehouse") |
| | |
| | | warehouseAPI.DELETE("warehouse/:id", warehouseController.Delete) // 删除仓库 |
| | | } |
| | | |
| | | // 作业类型 |
| | | jobTypeController := new(controllers.JobTypeController) |
| | | jobTypeAPI := r.Group(urlPrefix + "/warehouse") |
| | | { |
| | | jobTypeAPI.GET("jobType", jobTypeController.List) // 获取作业类型列表 |
| | | jobTypeAPI.POST("jobType", jobTypeController.Add) // 新增作业类型 |
| | | jobTypeAPI.PUT("jobType/:id", jobTypeController.Update) // 修改作业类型 |
| | | jobTypeAPI.DELETE("jobType/:id", jobTypeController.Delete) // 删除作业类型 |
| | | } |
| | | |
| | | return r |
| | | } |