142 lines
4.3 KiB
Go
142 lines
4.3 KiB
Go
package inventorymanage
|
||
|
||
import (
|
||
"errors"
|
||
"github.com/gin-gonic/gin"
|
||
"go-admin/app/admin/models"
|
||
"go-admin/tools/app"
|
||
"net/http"
|
||
)
|
||
|
||
// 库存报表相关代码
|
||
|
||
// InventoryReportByProduct 产品库存汇总(按门店)
|
||
// @Summary 产品库存汇总(按门店)
|
||
// @Tags 库存报表,V1.4.0
|
||
// @Produce json
|
||
// @Accept json
|
||
// @Param request body models.InventoryReportByProductReq true "产品库存汇总(按门店)模型"
|
||
// @Success 200 {object} models.InventoryReportByProductResp
|
||
// @Router /api/v1/inventory/report/product [post]
|
||
func InventoryReportByProduct(c *gin.Context) {
|
||
req := &models.InventoryReportByProductReq{}
|
||
if err := c.ShouldBindJSON(&req); err != nil {
|
||
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误:"+err.Error())
|
||
return
|
||
}
|
||
|
||
resp, err := req.ReportByProductList(c)
|
||
if err != nil {
|
||
//logger.Error("erp commodity list err:", err)
|
||
app.Error(c, http.StatusInternalServerError, err, "查询失败:"+err.Error())
|
||
return
|
||
}
|
||
|
||
app.OK(c, resp, "OK")
|
||
return
|
||
}
|
||
|
||
// InventoryReportByAllot 库存调拨汇总
|
||
// @Summary 库存调拨汇总
|
||
// @Tags 库存报表,V1.4.0
|
||
// @Produce json
|
||
// @Accept json
|
||
// @Param request body models.InventoryReportByAllotReq true "库存调拨汇总模型"
|
||
// @Success 200 {object} models.InventoryReportByAllotResp
|
||
// @Router /api/v1/inventory/report/allot [post]
|
||
func InventoryReportByAllot(c *gin.Context) {
|
||
req := &models.InventoryReportByAllotReq{}
|
||
if err := c.ShouldBindJSON(&req); err != nil {
|
||
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误:"+err.Error())
|
||
return
|
||
}
|
||
|
||
resp, err := req.ReportAllotList(c)
|
||
if err != nil {
|
||
//logger.Error("erp commodity list err:", err)
|
||
app.Error(c, http.StatusInternalServerError, err, "查询失败:"+err.Error())
|
||
return
|
||
}
|
||
|
||
app.OK(c, resp, "OK")
|
||
return
|
||
}
|
||
|
||
// InventoryReportAllotDetail 库存调拨明细
|
||
// @Summary 库存调拨明细
|
||
// @Tags 库存报表,V1.4.0
|
||
// @Produce json
|
||
// @Accept json
|
||
// @Param request body models.InventoryReportAllotDetailReq true "库存调拨明细模型"
|
||
// @Success 200 {object} models.InventoryReportAllotDetailResp
|
||
// @Router /api/v1/inventory/report/allot_detail [post]
|
||
func InventoryReportAllotDetail(c *gin.Context) {
|
||
req := &models.InventoryReportAllotDetailReq{}
|
||
if err := c.ShouldBindJSON(&req); err != nil {
|
||
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误:"+err.Error())
|
||
return
|
||
}
|
||
|
||
resp, err := req.ReportAllotDetailList(c)
|
||
if err != nil {
|
||
//logger.Error("erp commodity list err:", err)
|
||
app.Error(c, http.StatusInternalServerError, err, "查询失败:"+err.Error())
|
||
return
|
||
}
|
||
|
||
app.OK(c, resp, "OK")
|
||
return
|
||
}
|
||
|
||
// InventoryReportByOther 其他出入库汇总
|
||
// @Summary 其他出入库汇总
|
||
// @Tags 库存报表,V1.4.0
|
||
// @Produce json
|
||
// @Accept json
|
||
// @Param request body models.InventoryReportByOtherReq true "其他出入库汇总模型"
|
||
// @Success 200 {object} models.InventoryReportByOtherResp
|
||
// @Router /api/v1/inventory/report/other [post]
|
||
func InventoryReportByOther(c *gin.Context) {
|
||
req := &models.InventoryReportByOtherReq{}
|
||
if err := c.ShouldBindJSON(&req); err != nil {
|
||
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误:"+err.Error())
|
||
return
|
||
}
|
||
|
||
resp, err := req.ReportByOtherList(c)
|
||
if err != nil {
|
||
//logger.Error("erp commodity list err:", err)
|
||
app.Error(c, http.StatusInternalServerError, err, "查询失败:"+err.Error())
|
||
return
|
||
}
|
||
|
||
app.OK(c, resp, "OK")
|
||
return
|
||
}
|
||
|
||
// InventoryReportOtherDetail 其他出入库明细
|
||
// @Summary 其他出入库明细
|
||
// @Tags 库存报表,V1.4.0
|
||
// @Produce json
|
||
// @Accept json
|
||
// @Param request body models.InventoryReportOtherDetailReq true "其他出入库明细模型"
|
||
// @Success 200 {object} models.InventoryReportOtherDetailResp
|
||
// @Router /api/v1/inventory/report/other_detail [post]
|
||
func InventoryReportOtherDetail(c *gin.Context) {
|
||
req := &models.InventoryReportOtherDetailReq{}
|
||
if err := c.ShouldBindJSON(&req); err != nil {
|
||
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误:"+err.Error())
|
||
return
|
||
}
|
||
|
||
resp, err := req.ReportByOtherDetailList(c)
|
||
if err != nil {
|
||
//logger.Error("erp commodity list err:", err)
|
||
app.Error(c, http.StatusInternalServerError, err, "查询失败:"+err.Error())
|
||
return
|
||
}
|
||
|
||
app.OK(c, resp, "OK")
|
||
return
|
||
}
|