123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- package insider
- import (
- "Cold_Logistic/internal/pkg/common/codex"
- "Cold_Logistic/internal/pkg/common/global"
- "Cold_Logistic/internal/server/application/warehousesrv"
- "Cold_Logistic/internal/server/infra/dao"
- "github.com/gin-gonic/gin"
- "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/core"
- "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/errors"
- )
- // houseInfo
- // @Tags 仓管
- // @Summary 仓库信息
- // @Success 200 {object} warehousesrv.WarehouseInfoRespVO "成功响应的结构体"
- // @Accept application/json
- // @Router /app/warehouse/info [post]
- func (api Api) houseInfo(c *gin.Context) {
- srv := warehousesrv.NewWarehouseService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
- res, err := srv.WarehouseInfo(c)
- if err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, ""))
- return
- }
- core.WriteResponse(c, nil, res)
- }
- // warehouseOrder
- // @Tags 仓管
- // @Summary 库中订单列表
- // @Success 200 {object} swagger.PageListResponse "成功响应的结构体"
- // @Param req body swagger.WarehouseOrderReqVO true "请求参数"
- // @Accept application/json
- // @Router /app/warehouse/orderPage [post]
- func (api Api) warehouseOrder(c *gin.Context) {
- req := warehousesrv.WarehouseOrderReqVO{}
- if err := c.ShouldBindJSON(&req); err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, ""))
- return
- }
- srv := warehousesrv.NewWarehouseService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
- res, err := srv.WarehouseOrder(c, req)
- if err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, ""))
- return
- }
- core.WriteResponse(c, nil, res)
- }
- // orderIntoHouse
- // @Tags 仓管
- // @Summary 订单入库
- // @Success 200 {object} warehousesrv.OrderIntoHouseRespVO "成功响应的结构体"
- // @Param req body warehousesrv.OrderIntoHouseReqVO true "请求参数"
- // @Accept application/json
- // @Router /app/warehouse/orderInto [post]
- func (api Api) orderIntoHouse(c *gin.Context) {
- req := warehousesrv.OrderIntoHouseReqVO{}
- if err := c.ShouldBindJSON(&req); err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, ""))
- return
- }
- if err := req.Validate(); err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrParamValidate, ""))
- return
- }
- srv := warehousesrv.NewWarehouseService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
- res, err := srv.OrderIntoHouse(c, req)
- if err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, ""))
- return
- }
- core.WriteResponse(c, nil, res)
- }
- // orderOutHouse
- // @Tags 仓管
- // @Summary 订单出库
- // @Success 200 {object} warehousesrv.OrderIntoHouseRespVO "成功响应的结构体"
- // @Param req body warehousesrv.OrderIntoHouseReqVO true "请求参数"
- // @Accept application/json
- // @Router /app/warehouse/orderOutHouse [post]
- func (api Api) orderOutHouse(c *gin.Context) {
- req := warehousesrv.OrderIntoHouseReqVO{}
- if err := c.ShouldBindJSON(&req); err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, ""))
- return
- }
- if err := req.Validate(); err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrParamValidate, ""))
- return
- }
- srv := warehousesrv.NewWarehouseService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
- res, err := srv.OrderIntoHouse(c, req)
- if err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, ""))
- return
- }
- core.WriteResponse(c, nil, res)
- }
|