|
@@ -3,7 +3,6 @@ package goods
|
|
|
import (
|
|
|
"kpt-pasture/http/middleware"
|
|
|
"net/http"
|
|
|
- "strconv"
|
|
|
|
|
|
operationPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/operation"
|
|
|
"gitee.com/xuyiping_admin/pkg/valid"
|
|
@@ -167,95 +166,3 @@ func NeckRingCreateOrUpdate(c *gin.Context) {
|
|
|
Data: &operationPb.Success{Success: true},
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
-func OutboundApply(c *gin.Context) {
|
|
|
- var req pasturePb.OutboundApplyItem
|
|
|
- if err := ginutil.BindProto(c, &req); err != nil {
|
|
|
- apierr.AbortBadRequest(c, http.StatusBadRequest, err)
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- if err := valid.ValidateStruct(&req,
|
|
|
- valid.Field(&req.OutType, valid.Required),
|
|
|
- valid.Field(&req.Goods, valid.Required),
|
|
|
- ); err != nil {
|
|
|
- apierr.AbortBadRequest(c, http.StatusBadRequest, err)
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- if err := middleware.BackendOperation(c).OpsService.OutboundApply(c, &req); err != nil {
|
|
|
- apierr.ClassifiedAbort(c, err)
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- ginutil.JSONResp(c, &operationPb.CommonOK{
|
|
|
- Code: http.StatusOK,
|
|
|
- Msg: "ok",
|
|
|
- Data: &operationPb.Success{Success: true},
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-func OutboundList(c *gin.Context) {
|
|
|
- var req pasturePb.SearchOutboundApplyRequest
|
|
|
- if err := ginutil.BindProto(c, &req); err != nil {
|
|
|
- apierr.AbortBadRequest(c, http.StatusBadRequest, err)
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- pagination := &pasturePb.PaginationModel{
|
|
|
- Page: int32(c.GetInt(middleware.Page)),
|
|
|
- PageSize: int32(c.GetInt(middleware.PageSize)),
|
|
|
- PageOffset: int32(c.GetInt(middleware.PageOffset)),
|
|
|
- }
|
|
|
-
|
|
|
- res, err := middleware.Dependency(c).StoreEventHub.OpsService.OutboundList(c, &req, pagination)
|
|
|
- if err != nil {
|
|
|
- apierr.ClassifiedAbort(c, err)
|
|
|
- return
|
|
|
- }
|
|
|
- ginutil.JSONResp(c, res)
|
|
|
-}
|
|
|
-
|
|
|
-func OutboundAudit(c *gin.Context) {
|
|
|
- var req pasturePb.OutboundApplyAuditRequest
|
|
|
- if err := ginutil.BindProto(c, &req); err != nil {
|
|
|
- apierr.AbortBadRequest(c, http.StatusBadRequest, err)
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- if err := valid.ValidateStruct(&req,
|
|
|
- valid.Field(&req.Id, valid.Required),
|
|
|
- valid.Field(&req.AuditStatus, valid.Required),
|
|
|
- ); err != nil {
|
|
|
- apierr.AbortBadRequest(c, http.StatusBadRequest, err)
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- if err := middleware.BackendOperation(c).OpsService.OutboundAudit(c, &req); err != nil {
|
|
|
- apierr.ClassifiedAbort(c, err)
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- ginutil.JSONResp(c, &operationPb.CommonOK{
|
|
|
- Code: http.StatusOK,
|
|
|
- Msg: "ok",
|
|
|
- Data: &operationPb.Success{Success: true},
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-func OutboundDetail(c *gin.Context) {
|
|
|
- idStr := c.Query("id")
|
|
|
- id, _ := strconv.ParseInt(idStr, 10, 64)
|
|
|
- if err := valid.Validate(id, valid.Required); err != nil {
|
|
|
- apierr.AbortBadRequest(c, http.StatusBadRequest, err)
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- res, err := middleware.BackendOperation(c).OpsService.OutboundDetail(c, id)
|
|
|
- if err != nil {
|
|
|
- apierr.ClassifiedAbort(c, err)
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- ginutil.JSONResp(c, res)
|
|
|
-}
|