diff --git a/app/admin/apis/inventorymanage/allot.go b/app/admin/apis/inventorymanage/allot.go new file mode 100644 index 0000000..061a9b2 --- /dev/null +++ b/app/admin/apis/inventorymanage/allot.go @@ -0,0 +1,171 @@ +package inventorymanage + +import ( + "errors" + "github.com/gin-gonic/gin" + "go-admin/app/admin/models" + "go-admin/tools/app" + "net/http" +) + +// 库存调拨相关代码 + +// InventoryAllotAdd 新增 +// @Summary 新增 +// @Tags 库存调拨,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.InventoryAllotAddReq true "新增模型" +// @Success 200 {object} models.InventoryAllotOrder +// @Router /api/v1/inventory/allot/add [post] +func InventoryAllotAdd(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// InventoryAllotEdit 编辑 +// @Summary 编辑 +// @Tags 库存调拨,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.InventoryAllotEditReq true "编辑模型" +// @Success 200 {object} models.InventoryAllotOrder +// @Router /api/v1/inventory/allot/edit [post] +func InventoryAllotEdit(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// InventoryAllotAudit 审核 +// @Summary 审核 +// @Tags 库存调拨,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.InventoryAllotAuditReq true "审核模型" +// @Success 200 {object} app.Response +// @Router /api/v1/inventory/allot/audit [post] +func InventoryAllotAudit(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// InventoryAllotDelete 删除 +// @Summary 删除 +// @Tags 库存调拨,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.InventoryAllotDeleteReq true "删除模型" +// @Success 200 {object} app.Response +// @Router /api/v1/inventory/allot/delete [post] +func InventoryAllotDelete(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// InventoryAllotList 库存调拨列表 +// @Summary 库存调拨列表 +// @Tags 库存调拨,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.InventoryAllotListReq true "库存调拨列表模型" +// @Success 200 {object} models.InventoryAllotListResp +// @Router /api/v1/inventory/allot/list [post] +func InventoryAllotList(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// InventoryAllotDetail 库存调拨详情 +// @Summary 库存调拨详情 +// @Tags 库存调拨,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.InventoryAllotDetailReq true "库存调拨详情模型" +// @Success 200 {object} models.InventoryAllotOrder +// @Router /api/v1/inventory/allot/detail [post] +func InventoryAllotDetail(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// InventoryAllotDeliver 调拨发货 +// @Summary 调拨发货 +// @Tags 库存调拨,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.InventoryAllotDeliverReq true "调拨发货模型" +// @Success 200 {object} app.Response +// @Router /api/v1/inventory/allot/deliver [post] +func InventoryAllotDeliver(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// InventoryAllotReceive 调拨收货 +// @Summary 调拨收货 +// @Tags 库存调拨,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.InventoryAllotReceiveReq true "调拨收货模型" +// @Success 200 {object} app.Response +// @Router /api/v1/inventory/allot/receive [post] +func InventoryAllotReceive(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} diff --git a/app/admin/apis/inventorymanage/change.go b/app/admin/apis/inventorymanage/change.go new file mode 100644 index 0000000..b84466f --- /dev/null +++ b/app/admin/apis/inventorymanage/change.go @@ -0,0 +1,131 @@ +package inventorymanage + +import ( + "errors" + "github.com/gin-gonic/gin" + "go-admin/app/admin/models" + "go-admin/tools/app" + "net/http" +) + +// 库存变动相关代码 + +// InventoryChangeAdd 新增 +// @Summary 新增 +// @Tags 库存变动,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.InventoryChangeAddReq true "新增模型" +// @Success 200 {object} models.InventoryChangeOrder +// @Router /api/v1/inventory/change/add [post] +func InventoryChangeAdd(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// InventoryChangeEdit 编辑 +// @Summary 编辑 +// @Tags 库存变动,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.InventoryChangeEditReq true "编辑模型" +// @Success 200 {object} models.InventoryChangeOrder +// @Router /api/v1/inventory/change/edit [post] +func InventoryChangeEdit(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// InventoryChangeAudit 审核 +// @Summary 审核 +// @Tags 库存变动,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.InventoryChangeAuditReq true "审核模型" +// @Success 200 {object} app.Response +// @Router /api/v1/inventory/change/audit [post] +func InventoryChangeAudit(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// InventoryChangeDelete 删除 +// @Summary 删除 +// @Tags 库存变动,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.InventoryChangeDeleteReq true "删除模型" +// @Success 200 {object} app.Response +// @Router /api/v1/inventory/change/delete [post] +func InventoryChangeDelete(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// InventoryChangeList 库存变动列表 +// @Summary 库存变动列表 +// @Tags 库存变动,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.InventoryChangeListReq true "库存变动列表模型" +// @Success 200 {object} models.InventoryChangeListResp +// @Router /api/v1/inventory/change/list [post] +func InventoryChangeList(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// InventoryChangeDetail 库存变动详情 +// @Summary 库存变动详情 +// @Tags 库存变动,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.InventoryChangeDetailReq true "库存变动详情模型" +// @Success 200 {object} models.InventoryChangeOrder +// @Router /api/v1/inventory/change/detail [post] +func InventoryChangeDetail(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} diff --git a/app/admin/apis/inventorymanage/product.go b/app/admin/apis/inventorymanage/product.go new file mode 100644 index 0000000..1e9cc36 --- /dev/null +++ b/app/admin/apis/inventorymanage/product.go @@ -0,0 +1,131 @@ +package inventorymanage + +import ( + "errors" + "github.com/gin-gonic/gin" + "go-admin/app/admin/models" + "go-admin/tools/app" + "net/http" +) + +// 产品入库相关代码 + +// ProductInventoryAdd 新增 +// @Summary 新增 +// @Tags 产品入库,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.ProductInventoryAddReq true "新增模型" +// @Success 200 {object} models.ProductInventoryOrder +// @Router /api/v1/inventory/product/add [post] +func ProductInventoryAdd(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// ProductInventoryEdit 编辑 +// @Summary 编辑 +// @Tags 产品入库,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.ProductInventoryEditReq true "编辑模型" +// @Success 200 {object} models.ProductInventoryOrder +// @Router /api/v1/inventory/product/edit [post] +func ProductInventoryEdit(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// ProductInventoryAudit 审核 +// @Summary 审核 +// @Tags 产品入库,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.ProductInventoryAuditReq true "审核模型" +// @Success 200 {object} app.Response +// @Router /api/v1/inventory/product/audit [post] +func ProductInventoryAudit(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// ProductInventoryDelete 删除 +// @Summary 删除 +// @Tags 产品入库,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.ProductInventoryDeleteReq true "删除模型" +// @Success 200 {object} app.Response +// @Router /api/v1/inventory/product/delete [post] +func ProductInventoryDelete(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// ProductInventoryList 产品入库列表 +// @Summary 产品入库列表 +// @Tags 产品入库,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.ProductInventoryListReq true "产品入库列表模型" +// @Success 200 {object} models.ProductInventoryListResp +// @Router /api/v1/inventory/product/list [post] +func ProductInventoryList(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} + +// ProductInventoryDetail 产品入库详情 +// @Summary 产品入库详情 +// @Tags 产品入库,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.ProductInventoryDetailReq true "产品入库详情模型" +// @Success 200 {object} models.ProductInventoryOrder +// @Router /api/v1/inventory/product/detail [post] +func ProductInventoryDetail(c *gin.Context) { + req := &models.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} diff --git a/app/admin/apis/inventorymanage/report.go b/app/admin/apis/inventorymanage/report.go new file mode 100644 index 0000000..6445fbd --- /dev/null +++ b/app/admin/apis/inventorymanage/report.go @@ -0,0 +1,111 @@ +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.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "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.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "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.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "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.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "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.ErpStockListReq{} + if err := c.ShouldBindJSON(&req); err != nil { + //logger.Error(err) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + + app.OK(c, "", "OK") + return +} diff --git a/app/admin/models/inventory_allot.go b/app/admin/models/inventory_allot.go new file mode 100644 index 0000000..fe72a50 --- /dev/null +++ b/app/admin/models/inventory_allot.go @@ -0,0 +1,104 @@ +package models + +import "time" + +// InventoryAllotOrder 库存调拨订单表 +type InventoryAllotOrder struct { + Model + SerialNumber string `json:"serial_number" gorm:"index"` // 单据编号 + DeliverStoreId uint32 `json:"deliver_store_id" gorm:"index"` // 调出门店id + DeliverStoreName string `json:"deliver_store_name"` // 调出门店名称 + ReceiveStoreId uint32 `json:"receive_store_id" gorm:"index"` // 调入门店id + ReceiveStoreName string `json:"receive_store_name"` // 调入门店名称 + HandlerId uint32 `json:"handler_id" gorm:"index"` // 经手人id + HandlerName string `json:"handler_name"` // 经手人名称 + MakerTime *time.Time `json:"maker_time"` // 制单时间 + MakerId uint32 `json:"maker_id" gorm:"index"` // 制单人id + MakerName string `json:"maker_name"` // 制单人名称 + AuditTime *time.Time `json:"audit_time"` // 审核时间 + AuditorId uint32 `json:"auditor_id" gorm:"index"` // 审核人id + AuditorName string `json:"auditor_name"` // 审核人名称 + DeliverTime *time.Time `json:"deliver_time"` // 发货时间 + ReceiveTime *time.Time `json:"receive_time"` // 收货时间/调入时间 + LogisticsNumber string `json:"logistics_number"` // 物流单号 + State uint32 `json:"state"` // 1-待审核 2-待发货 3-待收货 4-已完成 + TotalCount uint32 `json:"total_count"` // 商品总数量 + Commodities []InventoryAllotCommodity `json:"commodities" gorm:"-"` // 库存调拨商品信息 +} + +// InventoryAllotCommodity 库存调拨商品信息表 +type InventoryAllotCommodity struct { + Model + ProductOrderId uint32 `json:"product_order_id" gorm:"index"` // 库存调拨订单表id + CommodityId uint32 `json:"commodity_id" gorm:"index"` // 商品id + CommodityName string `json:"commodity_name"` // 商品名称 + IMEIType uint32 `json:"imei_type"` // 1-无串码 2-串码 + IMEI string `json:"imei"` // 商品串码 + Count uint32 `json:"count"` // 数量 + Remark string `json:"remark"` // 备注 +} + +// InventoryAllotAddReq 新增库存调拨入参 +type InventoryAllotAddReq struct { + DeliverStoreId uint32 `json:"deliver_store_id" binding:"required"` // 调出门店id + DeliverStoreName string `json:"deliver_store_name" binding:"required"` // 调出门店名称 + ReceiveStoreId uint32 `json:"receive_store_id" binding:"required"` // 调入门店id + ReceiveStoreName string `json:"receive_store_name" binding:"required"` // 调入门店名称 + HandlerId uint32 `json:"handler_id" binding:"required"` // 经手人id + HandlerName string `json:"handler_name" binding:"required"` // 经手人名称 + Commodities []InventoryAllotCommodity `json:"commodities" binding:"required"` // 库存调拨商品信息 +} + +// InventoryAllotEditReq 编辑库存调拨入参 +type InventoryAllotEditReq struct { + SerialNumber string `json:"serial_number" binding:"required"` // 单据编号 + InventoryAllotAddReq +} + +// InventoryAllotAuditReq 审核入参 +type InventoryAllotAuditReq struct { + SerialNumber string `json:"serial_number" binding:"required"` // 单据编号 + State int `json:"state" binding:"required"` // 审核操作: 1-审核 2-取消审核 +} + +// InventoryAllotDeleteReq 删除入参 +type InventoryAllotDeleteReq struct { + SerialNumber string `json:"serial_number" binding:"required"` // 单据编号 +} + +// InventoryAllotListReq 查询库存调拨列表入参 +type InventoryAllotListReq struct { + SerialNumber string `json:"serial_number"` // 单据编号 + DeliverStoreId uint32 `json:"deliver_store_id"` // 调出门店id + ReceiveStoreId uint32 `json:"receive_store_id"` // 调入门店id + HandlerId uint32 `json:"handler_id"` // 经手人id + State int `json:"state"` // 1-待审核 2-待发货 3-待收货 4-已完成 + AuditTimeStart string `json:"audit_time_start"` // 审核开始时间 + AuditTimeEnd string `json:"audit_time_end"` // 审核结束时间 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 +} + +// InventoryAllotListResp 查询库存调拨列表出参 +type InventoryAllotListResp struct { + List []InventoryAllotOrder `json:"list"` + Total int `json:"total"` // 总条数 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 +} + +// InventoryAllotDetailReq 查询库存调拨详情入参 +type InventoryAllotDetailReq struct { + SerialNumber string `json:"serial_number" binding:"required"` // 单据编号 +} + +// InventoryAllotDeliverReq 调拨发货入参 +type InventoryAllotDeliverReq struct { + LogisticsNumber string `json:"logistics_number"` // 物流单号 + Remark string `json:"remark"` // 备注 +} + +// InventoryAllotReceiveReq 调拨收货入参 +type InventoryAllotReceiveReq struct { + SerialNumber string `json:"serial_number" binding:"required"` // 单据编号 +} diff --git a/app/admin/models/inventory_change.go b/app/admin/models/inventory_change.go new file mode 100644 index 0000000..de171a8 --- /dev/null +++ b/app/admin/models/inventory_change.go @@ -0,0 +1,93 @@ +package models + +import "time" + +// InventoryChangeOrder 库存变动订单表 +type InventoryChangeOrder struct { + Model + SerialNumber string `json:"serial_number" gorm:"index"` // 单据编号 + ChangeType string `json:"change_type"` // 类型:add-增加;reduce-减少 + StoreId uint32 `json:"store_id" gorm:"index"` // 门店id + StoreName string `json:"store_name"` // 门店名称 + HandlerId uint32 `json:"handler_id" gorm:"index"` // 经手人id + HandlerName string `json:"handler_name"` // 经手人名称 + MakerTime *time.Time `json:"maker_time"` // 制单时间 + MakerId uint32 `json:"maker_id" gorm:"index"` // 制单人id + MakerName string `json:"maker_name"` // 制单人名称 + AuditTime *time.Time `json:"audit_time"` // 审核时间 + AuditorId uint32 `json:"auditor_id" gorm:"index"` // 审核人id + AuditorName string `json:"auditor_name"` // 审核人名称 + State uint32 `json:"state"` // 1-待审核 2-已完成 + TotalCount uint32 `json:"total_count"` // 总数量 + TotalAmount float64 `json:"total_amount"` // 总金额 + Commodities []InventoryChangeCommodity `json:"commodities" gorm:"-"` // 库存变动商品信息 +} + +// InventoryChangeCommodity 库存变动商品信息表 +type InventoryChangeCommodity struct { + Model + ProductOrderId uint32 `json:"product_order_id" gorm:"index"` // 库存变动订单表id + CommodityId uint32 `json:"commodity_id" gorm:"index"` // 商品id + CommodityName string `json:"commodity_name"` // 商品名称 + SupplierId uint32 `json:"supplier_id" gorm:"index"` // 供应商id + SupplierName string `json:"supplier_name"` // 供应商名称 + IMEIType uint32 `json:"imei_type"` // 1-无串码 2-串码 + IMEI string `json:"imei"` // 商品串码 + Count uint32 `json:"count"` // 计划数量 + Price float64 `json:"price"` // 采购单价 + EmployeePrice float64 `json:"employee_price"` // 员工成本价 + Amount float64 `json:"amount"` // 金额 + Remark string `json:"remark"` // 备注 +} + +// InventoryChangeAddReq 新增库存变动入参 +type InventoryChangeAddReq struct { + StoreId uint32 `json:"store_id" binding:"required"` // 门店id + StoreName string `json:"store_name" binding:"required"` // 门店名称 + HandlerId uint32 `json:"handler_id" binding:"required"` // 经手人id + HandlerName string `json:"handler_name" binding:"required"` // 经手人名称 + Commodities []InventoryChangeCommodity `json:"commodities" binding:"required"` // 库存变动商品信息 +} + +// InventoryChangeEditReq 编辑库存变动入参 +type InventoryChangeEditReq struct { + SerialNumber string `json:"serial_number" binding:"required"` // 单据编号 + InventoryChangeAddReq +} + +// InventoryChangeAuditReq 审核入参 +type InventoryChangeAuditReq struct { + SerialNumber string `json:"serial_number" binding:"required"` // 单据编号 + State int `json:"state" binding:"required"` // 审核操作: 1-审核 2-取消审核 +} + +// InventoryChangeDeleteReq 删除入参 +type InventoryChangeDeleteReq struct { + SerialNumber string `json:"serial_number" binding:"required"` // 单据编号 +} + +// InventoryChangeListReq 查询库存变动列表入参 +type InventoryChangeListReq struct { + SerialNumber string `json:"serial_number"` // 单据编号 + ChangeType string `json:"change_type"` // 类型:add-增加;reduce-减少 + StoreId uint32 `json:"store_id"` // 门店id + HandlerId uint32 `json:"handler_id"` // 经手人id + State int `json:"state"` // 1-待审核 2-已完成 + AuditTimeStart string `json:"audit_time_start"` // 审核开始时间 + AuditTimeEnd string `json:"audit_time_end"` // 审核结束时间 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 +} + +// InventoryChangeListResp 查询库存变动列表出参 +type InventoryChangeListResp struct { + List []InventoryChangeOrder `json:"list"` + Total int `json:"total"` // 总条数 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 +} + +// InventoryChangeDetailReq 查询库存变动详情入参 +type InventoryChangeDetailReq struct { + SerialNumber string `json:"serial_number" binding:"required"` // 单据编号 +} diff --git a/app/admin/models/inventory_product.go b/app/admin/models/inventory_product.go new file mode 100644 index 0000000..a4b6fe6 --- /dev/null +++ b/app/admin/models/inventory_product.go @@ -0,0 +1,91 @@ +package models + +import "time" + +// ProductInventoryOrder 产品入库订单表 +type ProductInventoryOrder struct { + Model + SerialNumber string `json:"serial_number" gorm:"index"` // 单据编号 + StoreId uint32 `json:"store_id" gorm:"index"` // 门店id + StoreName string `json:"store_name"` // 门店名称 + HandlerId uint32 `json:"handler_id" gorm:"index"` // 经手人id + HandlerName string `json:"handler_name"` // 经手人名称 + MakerTime *time.Time `json:"maker_time"` // 制单时间 + MakerId uint32 `json:"maker_id" gorm:"index"` // 制单人id + MakerName string `json:"maker_name"` // 制单人名称 + AuditTime *time.Time `json:"audit_time"` // 审核时间 + AuditorId uint32 `json:"auditor_id" gorm:"index"` // 审核人id + AuditorName string `json:"auditor_name"` // 审核人名称 + State uint32 `json:"state"` // 1-待审核 2-已完成 + TotalCount uint32 `json:"total_count"` // 总数量 + TotalAmount float64 `json:"total_amount"` // 总金额 + Commodities []ProductInventoryCommodity `json:"commodities" gorm:"-"` // 产品入库商品信息 +} + +// ProductInventoryCommodity 产品入库商品信息表 +type ProductInventoryCommodity struct { + Model + ProductOrderId uint32 `json:"product_order_id" gorm:"index"` // 产品入库订单表id + CommodityId uint32 `json:"commodity_id" gorm:"index"` // 商品id + CommodityName string `json:"commodity_name"` // 商品名称 + SupplierId uint32 `json:"supplier_id" gorm:"index"` // 供应商id + SupplierName string `json:"supplier_name"` // 供应商名称 + IMEIType uint32 `json:"imei_type"` // 1-无串码 2-串码 + IMEI string `json:"imei"` // 商品串码 + Count uint32 `json:"count"` // 计划数量 + Price float64 `json:"price"` // 采购单价 + EmployeePrice float64 `json:"employee_price"` // 员工成本价 + Amount float64 `json:"amount"` // 金额 + Remark string `json:"remark"` // 备注 +} + +// ProductInventoryAddReq 新增产品入库入参 +type ProductInventoryAddReq struct { + StoreId uint32 `json:"store_id" binding:"required"` // 门店id + StoreName string `json:"store_name" binding:"required"` // 门店名称 + HandlerId uint32 `json:"handler_id" binding:"required"` // 经手人id + HandlerName string `json:"handler_name" binding:"required"` // 经手人名称 + Commodities []ProductInventoryCommodity `json:"commodities" binding:"required"` // 产品入库商品信息 +} + +// ProductInventoryEditReq 编辑产品入库入参 +type ProductInventoryEditReq struct { + SerialNumber string `json:"serial_number" binding:"required"` // 单据编号 + ProductInventoryAddReq +} + +// ProductInventoryAuditReq 审核入参 +type ProductInventoryAuditReq struct { + SerialNumber string `json:"serial_number" binding:"required"` // 单据编号 + State int `json:"state" binding:"required"` // 审核操作: 1-审核 2-取消审核 +} + +// ProductInventoryDeleteReq 删除入参 +type ProductInventoryDeleteReq struct { + SerialNumber string `json:"serial_number" binding:"required"` // 单据编号 +} + +// ProductInventoryListReq 查询产品入库列表入参 +type ProductInventoryListReq struct { + SerialNumber string `json:"serial_number"` // 单据编号 + StoreId uint32 `json:"store_id"` // 门店id + HandlerId uint32 `json:"handler_id"` // 经手人id + State int `json:"state"` // 1-待审核 2-已完成 + AuditTimeStart string `json:"audit_time_start"` // 审核开始时间 + AuditTimeEnd string `json:"audit_time_end"` // 审核结束时间 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 +} + +// ProductInventoryListResp 查询产品入库列表出参 +type ProductInventoryListResp struct { + List []ProductInventoryOrder `json:"list"` + Total int `json:"total"` // 总条数 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 +} + +// ProductInventoryDetailReq 查询产品入库详情入参 +type ProductInventoryDetailReq struct { + SerialNumber string `json:"serial_number" binding:"required"` // 单据编号 +} diff --git a/app/admin/models/inventory_report.go b/app/admin/models/inventory_report.go new file mode 100644 index 0000000..fdacc96 --- /dev/null +++ b/app/admin/models/inventory_report.go @@ -0,0 +1,211 @@ +package models + +import "time" + +// InventoryReportByProductReq 产品库存汇总(按门店)入参 +type InventoryReportByProductReq struct { + StoreId []uint32 `json:"store_id"` // 门店id + CommoditySerialNumber []string `json:"commodity_serial_number"` // 商品编号 + CommodityName []string `json:"commodity_name"` // 商品名称 + CategoryID []uint32 `json:"category_id"` // 商品分类id + IsExport uint32 `json:"is_export"` // 1-导出 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 +} + +// InventoryReportByProductResp 产品库存汇总(按门店)出参 +type InventoryReportByProductResp struct { + Total int `json:"total"` // 总条数/记录数 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 + TotalEffectiveCount uint32 `json:"total_effective_count"` // 有效库存数 + TotalTransferCount uint32 `json:"total_transfer_count"` // 调入中数量 + TotalCount uint32 `json:"total_count"` // 总数量 + TotalEffectiveAmount float64 `json:"total_effective_amount"` // 有效库存金额 + TotalTransferAmount float64 `json:"total_transfer_amount"` // 调入中金额 + ExportUrl string `json:"export_url"` // 导出excel路径 + List []ReportByProductData `json:"list"` // +} + +// ReportByProductData 产品库存汇总(按门店)数据 +type ReportByProductData struct { + StoreId uint32 `json:"store_id"` // 门店id + StoreName string `json:"store_name"` // 门店名称 + CommoditySerialNumber string `json:"commodity_serial_number"` // 商品编号 + CommodityId uint32 `json:"commodity_id"` // 商品id + CommodityName string `json:"commodity_name"` // 商品名称 + CategoryID uint32 `json:"category_id"` // 商品分类id + CategoryName string `json:"category_name"` // 商品分类名称 + EffectiveCount uint32 `json:"effective_count"` // 有效库存数 + TransferCount uint32 `json:"transfer_count"` // 调入中数量 + Count uint32 `json:"count"` // 总数量 + EffectiveAmount float64 `json:"effective_amount"` // 有效库存金额 + TransferAmount float64 `json:"transfer_amount"` // 调入中金额 +} + +// InventoryReportByAllotReq 库存调拨入参 +type InventoryReportByAllotReq struct { + DeliverStoreId []uint32 `json:"deliver_store_id"` // 调出门店id + ReceiveStoreId []uint32 `json:"receive_store_id"` // 调入门店id + CommodityName []string `json:"commodity_name"` // 商品名称 + CategoryID []uint32 `json:"category_id"` // 商品分类id + State uint32 `json:"state"` // 调拨状态:1-调拨中 2-已完成 + AuditTimeStart string `json:"audit_time_start"` // 审核/发起开始时间 + AuditTimeEnd string `json:"audit_time_end"` // 审核/发起结束时间 + ReceiveTimeStart string `json:"receive_time_start"` // 调入开始时间 + ReceiveTimeEnd string `json:"receive_time_end"` // 调入结束时间 + IsExport uint32 `json:"is_export"` // 1-导出 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 +} + +// InventoryReportByAllotResp 库存调拨出参 +type InventoryReportByAllotResp struct { + Total int `json:"total"` // 总条数/记录数 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 + TotalAllotCount uint32 `json:"total_allot_count"` // 调拨数量 + TotalAllotAmount float64 `json:"total_allot_amount"` // 调拨金额 + ExportUrl string `json:"export_url"` // 导出excel路径 + List []ReportByAllotData `json:"list"` // +} + +// ReportByAllotData 库存调拨数据 +type ReportByAllotData struct { + DeliverStoreId uint32 `json:"deliver_store_id"` // 调出门店id + DeliverStoreName string `json:"deliver_store_name"` // 调出门店名称 + ReceiveStoreId uint32 `json:"receive_store_id"` // 调入门店id + ReceiveStoreName string `json:"receive_store_name"` // 调入门店名称 + CommodityId uint32 `json:"commodity_id"` // 商品id + CommodityName string `json:"commodity_name"` // 商品名称 + CategoryID uint32 `json:"category_id"` // 商品分类id + CategoryName string `json:"category_name"` // 商品分类名称 + State uint32 `json:"state"` // 调拨状态:1-调拨中 2-已完成 + AllotCount uint32 `json:"allot_count"` // 调拨数量 + AllotAmount float64 `json:"allot_amount"` // 调拨金额 +} + +// InventoryReportAllotDetailReq 库存调拨明细入参 +type InventoryReportAllotDetailReq struct { + SerialNumber string `json:"serial_number"` // 单据编号 + DeliverStoreId uint32 `json:"deliver_store_id"` // 调出门店id + ReceiveStoreId uint32 `json:"receive_store_id"` // 调入门店id + CommodityName []string `json:"commodity_name"` // 商品名称 + CategoryID []uint32 `json:"category_id"` // 商品分类id + State uint32 `json:"state"` // 调拨状态:1-调拨中 2-已完成 + AuditTimeStart string `json:"audit_time_start"` // 审核/发起开始时间 + AuditTimeEnd string `json:"audit_time_end"` // 审核/发起结束时间 + ReceiveTimeStart string `json:"receive_time_start"` // 调入开始时间 + ReceiveTimeEnd string `json:"receive_time_end"` // 调入结束时间 + IsExport uint32 `json:"is_export"` // 1-导出 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 +} + +// InventoryReportAllotDetailResp 库存调拨明细出参 +type InventoryReportAllotDetailResp struct { + Total int `json:"total"` // 总条数/记录数 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 + ExportUrl string `json:"export_url"` // 导出excel路径 + List []ReportAllotDetailData `json:"list"` // +} + +// ReportAllotDetailData 库存调拨明细数据 +type ReportAllotDetailData struct { + SerialNumber string `json:"serial_number"` // 单据编号 + DeliverStoreId uint32 `json:"deliver_store_id"` // 调出门店id + DeliverStoreName string `json:"deliver_store_name"` // 调出门店名称 + ReceiveStoreId uint32 `json:"receive_store_id"` // 调入门店id + ReceiveStoreName string `json:"receive_store_name"` // 调入门店名称 + MakerTime *time.Time `json:"maker_time"` // 制单时间/发起时间 + AuditTime *time.Time `json:"audit_time"` // 审核时间 + State uint32 `json:"state"` // 调拨状态:1-调拨中 2-已完成 + CommodityId uint32 `json:"commodity_id"` // 商品id + CommodityName string `json:"commodity_name"` // 商品名称 + CategoryID uint32 `json:"category_id"` // 商品分类id + CategoryName string `json:"category_name"` // 商品分类名称 + IMEIType uint32 `json:"imei_type"` // 1-无串码 2-串码 + IMEI string `json:"imei"` // 商品串码 +} + +// InventoryReportByOtherReq 其他出入库汇总入参 +type InventoryReportByOtherReq struct { + StoreId []uint32 `json:"store_id"` // 门店id + CommodityName []string `json:"commodity_name"` // 商品名称 + CategoryID []uint32 `json:"category_id"` // 商品分类id + State uint32 `json:"state"` // 调拨状态:1-产品入库 2-盘点入库 3-系统出库 4-盘点出库 + StartTime string `json:"start_time"` // 开始时间/入库时间 + EndTime string `json:"end_time"` // 结束时间/出库时间 + IsExport uint32 `json:"is_export"` // 1-导出 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 +} + +// InventoryReportByOtherResp 其他出入库汇总出参 +type InventoryReportByOtherResp struct { + Total int `json:"total"` // 总条数/记录数 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 + TotalCount int32 `json:"total_count"` // 总数量 + TotalAmount float64 `json:"total_amount"` // 总金额 + ExportUrl string `json:"export_url"` // 导出excel路径 + List []ReportByOtherData `json:"list"` // +} + +// ReportByOtherData 其他出入库汇总数据 +type ReportByOtherData struct { + StoreId uint32 `json:"store_id"` // 门店id + StoreName string `json:"store_name"` // 门店名称 + CommodityId uint32 `json:"commodity_id"` // 商品id + CommodityName string `json:"commodity_name"` // 商品名称 + CategoryID uint32 `json:"category_id"` // 商品分类id + CategoryName string `json:"category_name"` // 商品分类名称 + State uint32 `json:"state"` // 调拨状态:1-产品入库 2-盘点入库 3-系统出库 4-盘点出库 + Count int32 `json:"count"` // 数量 + Amount float64 `json:"amount"` // 金额 +} + +// InventoryReportOtherDetailReq 其他出入库明细入参 +type InventoryReportOtherDetailReq struct { + SerialNumber string `json:"serial_number"` // 单据编号 + StoreId []uint32 `json:"store_id"` // 门店id + CommodityName []string `json:"commodity_name"` // 商品名称 + CategoryID []uint32 `json:"category_id"` // 商品分类id + State uint32 `json:"state"` // 调拨状态:1-产品入库 2-盘点入库 3-系统出库 4-盘点出库 + StartTime string `json:"start_time"` // 开始时间/入库时间 + EndTime string `json:"end_time"` // 结束时间/出库时间 + IsExport uint32 `json:"is_export"` // 1-导出 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 +} + +// InventoryReportOtherDetailResp 其他出入库明细出参 +type InventoryReportOtherDetailResp struct { + Total int `json:"total"` // 总条数/记录数 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 + TotalPurchasePrice float64 `json:"total_purchase_price"` // 总入库采购价 + TotalEmployeePrice float64 `json:"total_employee_price"` // 总入库员工成本价 + ExportUrl string `json:"export_url"` // 导出excel路径 + List []ReportOtherDetailData `json:"list"` // +} + +// ReportOtherDetailData 其他出入库明细数据 +type ReportOtherDetailData struct { + CommodityId uint32 `json:"commodity_id"` // 商品id + CommodityName string `json:"commodity_name"` // 商品名称 + CategoryID uint32 `json:"category_id"` // 商品分类id + CategoryName string `json:"category_name"` // 商品分类名称 + IMEIType uint32 `json:"imei_type"` // 1-无串码 2-串码 + IMEI string `json:"imei"` // 商品串码 + StoreId uint32 `json:"store_id"` // 门店id + StoreName string `json:"store_name"` // 门店名称 + SupplierId uint32 `json:"supplier_id"` // 供应商id + SupplierName string `json:"supplier_name"` // 供应商名称 + StockTime *time.Time `json:"stock_time"` // 出入库时间 + State uint32 `json:"state"` // 调拨状态:1-产品入库 2-盘点入库 3-系统出库 4-盘点出库 + SerialNumber string `json:"serial_number"` // 单据编号 + PurchasePrice float64 `json:"purchase_price"` // 入库采购价 + EmployeePrice float64 `json:"employee_price"` // 入库员工成本价 +} diff --git a/app/admin/router/inventory.go b/app/admin/router/inventory.go index 8699194..a7e9c87 100644 --- a/app/admin/router/inventory.go +++ b/app/admin/router/inventory.go @@ -16,4 +16,42 @@ func registerInventoryManageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJ r.POST("import", inventorymanage.BatchImport) // 库存导入 r.POST("add_remark", inventorymanage.AddRemark) // 添加备注 r.POST("query_code", inventorymanage.QueryCode) // 查询商品串码或者条码 + + // 产品入库 + r1 := v1.Group("/inventory/product").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + r1.POST("add", inventorymanage.ProductInventoryAdd) // 新增 + r1.POST("edit", inventorymanage.ProductInventoryEdit) // 编辑 + r1.POST("audit", inventorymanage.ProductInventoryAudit) // 审核 + r1.POST("delete", inventorymanage.ProductInventoryDelete) // 删除 + r1.POST("list", inventorymanage.ProductInventoryList) // 列表 + r1.POST("detail", inventorymanage.ProductInventoryDetail) // 详情 + + // 库存变动 + r2 := v1.Group("/inventory/change").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + r2.POST("add", inventorymanage.InventoryChangeAdd) // 新增 + r2.POST("edit", inventorymanage.InventoryChangeEdit) // 编辑 + r2.POST("audit", inventorymanage.InventoryChangeAudit) // 审核 + r2.POST("delete", inventorymanage.InventoryChangeDelete) // 删除 + r2.POST("list", inventorymanage.InventoryChangeList) // 列表 + r2.POST("detail", inventorymanage.InventoryChangeDetail) // 详情 + + // 库存调拨 + r3 := v1.Group("/inventory/allot").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + r3.POST("add", inventorymanage.InventoryAllotAdd) // 新增 + r3.POST("edit", inventorymanage.InventoryAllotEdit) // 编辑 + r3.POST("audit", inventorymanage.InventoryAllotAudit) // 审核 + r3.POST("delete", inventorymanage.InventoryAllotDelete) // 删除 + r3.POST("list", inventorymanage.InventoryAllotList) // 列表 + r3.POST("detail", inventorymanage.InventoryAllotDetail) // 详情 + r3.POST("deliver", inventorymanage.InventoryAllotDeliver) // 发货 + r3.POST("receive", inventorymanage.InventoryAllotReceive) // 收货 + + // 库存报表 + r4 := v1.Group("/inventory/report").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + r4.POST("product", inventorymanage.InventoryReportByProduct) // 产品库存汇总(按门店) + r4.POST("allot", inventorymanage.InventoryReportByAllot) // 库存调拨汇总 + r4.POST("allot_detail", inventorymanage.InventoryReportAllotDetail) // 库存调拨明细 + r4.POST("other", inventorymanage.InventoryReportByOther) // 其他出入库汇总 + r4.POST("other_detail", inventorymanage.InventoryReportOtherDetail) // 其他出入库明细 + } diff --git a/config/settings.yml b/config/settings.yml index d0b7a0a..4ab7370 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -41,9 +41,9 @@ settings: driver: mysql # 数据库连接字符串 mysql 缺省信息 charset=utf8&parseTime=True&loc=Local&timeout=1000ms # source: root:myTest@921@tcp(127.0.0.1:3306)/mh_dev?charset=utf8&parseTime=True&loc=Local&timeout=1000ms - source: mh_dev:d9qy46ONI0ZTF9eH@tcp(112.33.14.191:3306)/mh_dev?charset=utf8&parseTime=True&loc=Local&timeout=1000ms +# source: mh_dev:d9qy46ONI0ZTF9eH@tcp(112.33.14.191:3306)/mh_dev?charset=utf8&parseTime=True&loc=Local&timeout=1000ms # source: mh_pro:c5JBW3X6EEVQluYM@tcp(39.108.188.218:3306)/mh_pro?charset=utf8&parseTime=True&loc=Local&timeout=1000ms -# source: mh_test:GPLzZ8rMmbJbKtMh@tcp(112.33.14.191:3306)/mh_test?charset=utf8&parseTime=True&loc=Local&timeout=1000ms + source: mh_test:GPLzZ8rMmbJbKtMh@tcp(112.33.14.191:3306)/mh_test?charset=utf8&parseTime=True&loc=Local&timeout=1000ms gen: # 代码生成读取的数据库名称