概述(一级模块)-入库(二级模块)-新建操作(含出入库,内部调拨)的人可以删除自己创建的,不能删除别人创建的:删除时验证创建人
| | |
| | | } |
| | | operation, err := models.NewOperationSearch().SetID(id).First() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "未找到相关出入库信息:"+err.Error()) |
| | | util.ResponseFormat(c, code.RequestParamError, "未找到相关出入库单据:"+err.Error()) |
| | | return |
| | | } |
| | | userInfo := middleware.GetUserInfo(c) |
| | | if operation.CreatedBy != userInfo.Username { |
| | | util.ResponseFormat(c, code.RequestError, "别人的出入库单据无法进行删除") |
| | | return |
| | | } |
| | | if operation.Status != constvar.OperationStatus_Ready { |
| | | util.ResponseFormat(c, code.RequestError, "该入库信息无法进行删除") |
| | | util.ResponseFormat(c, code.RequestError, "该出入库单据无法进行删除") |
| | | return |
| | | } |
| | | if err := models.WithTransaction(func(tx *gorm.DB) error { |