2024-04-02 10:21:20 +00:00
|
|
|
|
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) {
|
2024-04-10 06:17:19 +00:00
|
|
|
|
req := &models.InventoryReportByProductReq{}
|
2024-04-02 10:21:20 +00:00
|
|
|
|
if err := c.ShouldBindJSON(&req); err != nil {
|
2024-04-22 10:12:19 +00:00
|
|
|
|
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误:"+err.Error())
|
2024-04-02 10:21:20 +00:00
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-22 10:12:19 +00:00
|
|
|
|
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")
|
2024-04-02 10:21:20 +00:00
|
|
|
|
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) {
|
2024-04-10 06:17:19 +00:00
|
|
|
|
req := &models.InventoryReportByAllotReq{}
|
2024-04-02 10:21:20 +00:00
|
|
|
|
if err := c.ShouldBindJSON(&req); err != nil {
|
2024-04-22 10:12:19 +00:00
|
|
|
|
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误:"+err.Error())
|
2024-04-02 10:21:20 +00:00
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-23 10:20:49 +00:00
|
|
|
|
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")
|
2024-04-02 10:21:20 +00:00
|
|
|
|
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) {
|
2024-04-10 06:17:19 +00:00
|
|
|
|
req := &models.InventoryReportAllotDetailReq{}
|
2024-04-02 10:21:20 +00:00
|
|
|
|
if err := c.ShouldBindJSON(&req); err != nil {
|
2024-04-22 10:12:19 +00:00
|
|
|
|
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误:"+err.Error())
|
2024-04-02 10:21:20 +00:00
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-23 10:20:49 +00:00
|
|
|
|
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")
|
2024-04-02 10:21:20 +00:00
|
|
|
|
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) {
|
2024-04-10 06:17:19 +00:00
|
|
|
|
req := &models.InventoryReportByOtherReq{}
|
2024-04-02 10:21:20 +00:00
|
|
|
|
if err := c.ShouldBindJSON(&req); err != nil {
|
2024-04-22 10:12:19 +00:00
|
|
|
|
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误:"+err.Error())
|
2024-04-02 10:21:20 +00:00
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-24 08:53:14 +00:00
|
|
|
|
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")
|
2024-04-02 10:21:20 +00:00
|
|
|
|
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) {
|
2024-04-10 06:17:19 +00:00
|
|
|
|
req := &models.InventoryReportOtherDetailReq{}
|
2024-04-02 10:21:20 +00:00
|
|
|
|
if err := c.ShouldBindJSON(&req); err != nil {
|
2024-04-22 10:12:19 +00:00
|
|
|
|
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误:"+err.Error())
|
2024-04-02 10:21:20 +00:00
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-24 08:53:14 +00:00
|
|
|
|
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")
|
2024-04-02 10:21:20 +00:00
|
|
|
|
return
|
|
|
|
|
}
|