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) }