From 4a7b9a74a83dc308b71ef27e858c8a11f98790e0 Mon Sep 17 00:00:00 2001 From: chenlin Date: Thu, 20 Feb 2025 19:07:45 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=96=B0=E5=A2=9E=E7=A7=9F=E8=B5=81?= =?UTF-8?q?=E8=AE=A2=E5=8D=95-=E5=BA=93=E5=AD=98=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E6=98=8E=E7=BB=86=E7=9B=B8=E5=85=B3=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/stockmanage/stock.go | 39 +++- app/admin/models/commodity.go | 2 +- app/admin/models/game_card.go | 282 +++++++++++++++++++++++++++- app/admin/models/purchase_change.go | 24 ++- app/admin/router/stockmanage.go | 9 +- docs/docs.go | 210 ++++++++++++++++++++- docs/swagger.json | 210 ++++++++++++++++++++- docs/swagger.yaml | 146 +++++++++++++- 8 files changed, 903 insertions(+), 19 deletions(-) diff --git a/app/admin/apis/stockmanage/stock.go b/app/admin/apis/stockmanage/stock.go index 2cc88db..47f8633 100644 --- a/app/admin/apis/stockmanage/stock.go +++ b/app/admin/apis/stockmanage/stock.go @@ -43,6 +43,31 @@ func GameCardGoodsStockInfoList(c *gin.Context) { app.OK(c, resp, "") } +// GameCardGoodsStockOutInfoList 出库明细 +// @Summary 出库明细 +// @Tags 租卡系统-库存管理 +// @Produce json +// @Accept json +// @Param request body models.GameCardGoodsStockOutInfoListReq true "出库明细模型" +// @Success 200 {object} models.GameCardGoodsStockOutInfoListResp +// @Router /api/v1/stock/out_list [post] +func GameCardGoodsStockOutInfoList(c *gin.Context) { + req := &models.GameCardGoodsStockOutInfoListReq{} + if c.ShouldBindJSON(&req) != nil { + logger.Errorf("para err") + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") + return + } + resp, err := req.List(c) + if err != nil { + logger.Errorf("err:", logger.Field("err", err)) + app.Error(c, http.StatusInternalServerError, err, "查询失败") + return + } + + app.OK(c, resp, "") +} + func GameCardGoodsStockCardList(c *gin.Context) { req := &models.GameCardGoodsStockCardListReq{} if c.ShouldBindJSON(&req) != nil { @@ -90,10 +115,16 @@ func GameCardGoodsStockAdds(c *gin.Context) { app.OK(c, nil, "入库成功") } +// GameCardGoodsStockDels 游戏卡出库 +// @Summary 游戏卡出库 +// @Tags 租卡系统-库存管理 +// @Produce json +// @Accept json +// @Param request body models.GameCardGoodsStockDelsReq true "游戏卡出库模型" +// @Success 200 {object} app.Response +// @Router /api/v1/stock/card/dels [post] func GameCardGoodsStockDels(c *gin.Context) { - req := struct { - SerialNumberList []string `json:"serial_number_list"` - }{} + req := &models.GameCardGoodsStockDelsReq{} if c.ShouldBindJSON(&req) != nil { logger.Errorf("para err") app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误") @@ -101,7 +132,7 @@ func GameCardGoodsStockDels(c *gin.Context) { } cardGoods := &models.GameCardGoods{} - err := cardGoods.Dels(req.SerialNumberList) + err := cardGoods.Dels(req.SerialNumberList, c) if err != nil { logger.Errorf("err:", logger.Field("err", err)) app.Error(c, http.StatusInternalServerError, err, "删除失败") diff --git a/app/admin/models/commodity.go b/app/admin/models/commodity.go index c59ca92..0ce022f 100644 --- a/app/admin/models/commodity.go +++ b/app/admin/models/commodity.go @@ -3698,7 +3698,7 @@ type ImeiTraceData struct { // QueryImeiTraceData 串码追踪,返回多个结果 func QueryImeiTraceData(req *ImeiTraceReq) (*ImeiTraceResp, error) { if req == nil || req.IMEI == "" { - return nil, errors.New("imei不能为空") + return &ImeiTraceResp{}, nil } var results []ImeiTraceData diff --git a/app/admin/models/game_card.go b/app/admin/models/game_card.go index a9c699f..faaa14d 100644 --- a/app/admin/models/game_card.go +++ b/app/admin/models/game_card.go @@ -11,6 +11,7 @@ import ( "go-admin/tools" "go-admin/tools/config" "gorm.io/gorm" + "strconv" "strings" "time" ) @@ -1186,17 +1187,26 @@ func (*GameCardGoods) Adds(cards []GameCardGoods) error { return nil } -func (*GameCardGoods) Dels(serials []string) error { +type GameCardGoodsStockDelsReq struct { + SerialNumberList []string `json:"serial_number_list"` +} + +func (*GameCardGoods) Dels(serials []string, c *gin.Context) error { if len(serials) == 0 { return nil } + sysUser, err := GetSysUserByCtx(c) + if err != nil { + return err + } + //serials := make([]string, 0) //for i, _ := range cards { // serials = append(serials, cards[i].SerialNumber) //} list := make([]GameCardGoods, 0) - err := orm.Eloquent.Table("game_card_goods").Where("serial_number in (?)", serials).Find(&list).Error + err = orm.Eloquent.Table("game_card_goods").Where("serial_number in (?)", serials).Find(&list).Error if err != nil { logger.Error(err.Error()) return err @@ -1210,7 +1220,7 @@ func (*GameCardGoods) Dels(serials []string) error { continue } var cardGoodsStock GameCardGoodsStock - err := orm.Eloquent.Table("game_card_goods_stock").Where("store_id", list[i].StoreId).Where("game_card_id", list[i].GameCardId).Find(&cardGoodsStock).Error + err = orm.Eloquent.Table("game_card_goods_stock").Where("store_id", list[i].StoreId).Where("game_card_id", list[i].GameCardId).Find(&cardGoodsStock).Error if err != nil { logger.Error(err.Error()) continue @@ -1220,11 +1230,11 @@ func (*GameCardGoods) Dels(serials []string) error { } begin := orm.Eloquent.Begin() - err = orm.Eloquent.Table("game_card_goods").Where("serial_number", list[i].SerialNumber).Delete(&GameCardGoods{}).Error + err = begin.Table("game_card_goods").Where("serial_number", list[i].SerialNumber).Delete(&GameCardGoods{}).Error if err != nil { begin.Rollback() logger.Error(err.Error()) - continue + return err } sql := fmt.Sprintf("UPDATE game_card_goods_stock SET rent_stock= rent_stock-1,store_stock=store_stock-1,total_stock=total_stock-1 WHERE store_id=%d AND game_card_id=%d;", list[i].StoreId, list[i].GameCardId) @@ -1233,14 +1243,33 @@ func (*GameCardGoods) Dels(serials []string) error { if err != nil { begin.Rollback() logger.Errorf(err.Error()) - continue + return err + } + + // 记录到出库明细表 + nowTime := time.Now() + var record GameCardOutRecord + record.SerialNumber = list[i].SerialNumber + record.StoreId = list[i].StoreId + record.GameCardId = list[i].GameCardId + record.FirstStockTime = &list[i].CreatedAt + record.StockTime = &list[i].StockTime + record.OutStockTime = &nowTime + record.MakerId = uint32(sysUser.UserId) + record.MakerName = sysUser.NickName + + err = begin.Create(&record).Error + if err != nil { + begin.Rollback() + logger.Errorf(err.Error()) + return err } err = begin.Commit().Error if err != nil { begin.Rollback() logger.Error("commit err:", logger.Field("err", err)) - continue + return err } } @@ -3446,3 +3475,242 @@ type CooperativeSetPayInfoReq struct { type CooperativeGetPayInfoReq struct { CooperativeBusinessId uint32 `json:"cooperative_business_id"` // 合作商id } + +// GameCardOutRecord 租赁卡出库明细表 +type GameCardOutRecord struct { + Model + SerialNumber string `json:"serial_number" gorm:"index"` // 游戏卡串码 + StoreId uint64 `json:"store_id"` // 门店id + StoreName string `json:"store_name" gorm:"-"` // 门店名称 + GameCardId uint64 `json:"game_card_id"` // 游戏卡id + GameCardName string `json:"game_card_name" gorm:"-"` // 游戏名称 + FirstStockTime *time.Time `json:"first_stock_time"` // 首次入库时间 + StockTime *time.Time `json:"stock_time"` // 入库时间 + OutStockTime *time.Time `json:"out_stock_time"` // 出库时间 + MakerId uint32 `json:"maker_id" gorm:"index"` // 出库人id + MakerName string `json:"maker_name"` // 出库人名称 +} + +// GameCardGoodsStockOutInfoListReq 出库明细-入参 +type GameCardGoodsStockOutInfoListReq struct { + StoreId []uint32 `json:"store_id"` // 门店id + GameCardId uint64 `json:"game_card_id"` // 游戏卡id + SerialNumber string `json:"serial_number"` // 游戏卡串码 + OutStockTimeStart string `json:"out_stock_time_start"` // 出库开始时间 + OutStockTimeEnd string `json:"out_stock_time_end"` // 出库结束时间 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 + IsExport uint32 `json:"is_export"` // 1-导出 +} + +// GameCardGoodsStockOutInfoListResp 出库明细-出参 +type GameCardGoodsStockOutInfoListResp struct { + List []GameCardOutRecord `json:"list"` + Total int `json:"total"` // 总条数 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 每页展示条数 + ExportUrl string `json:"export_url"` +} + +// List 租卡系统-库存管理-出库明细 +func (m *GameCardGoodsStockOutInfoListReq) List(c *gin.Context) (*GameCardGoodsStockOutInfoListResp, error) { + resp := &GameCardGoodsStockOutInfoListResp{ + PageIndex: m.PageIndex, + PageSize: m.PageSize, + } + + // 构造基础查询,针对出库记录表 + db := orm.Eloquent.Table("game_card_out_record") + + // 根据门店ID数组进行过滤 + if len(m.StoreId) > 0 { + db = db.Where("store_id IN (?)", m.StoreId) + } + // 根据游戏卡ID过滤 + if m.GameCardId > 0 { + db = db.Where("game_card_id = ?", m.GameCardId) + } + // 根据游戏卡串码模糊查询 + if m.SerialNumber != "" { + db = db.Where("serial_number LIKE ?", "%"+m.SerialNumber+"%") + } + // 根据出库时间范围查询 + if m.OutStockTimeStart != "" && m.OutStockTimeEnd != "" { + db = db.Where("out_stock_time BETWEEN ? AND ?", m.OutStockTimeStart, m.OutStockTimeEnd) + } + + // 获取总记录数 + var total int64 + if err := db.Count(&total).Error; err != nil { + return nil, err + } + resp.Total = int(total) + + // 连表查询:左联查store表和game_card表,分别获取门店名称和游戏名称 + // 注意:这里将门店名称别名为store_name,将游戏名称别名为game_card_name,分别对应GameCardOutRecord中的StoreName和GameCardName字段 + db = db.Joins("LEFT JOIN store ON store.id = game_card_out_record.store_id"). + Joins("LEFT JOIN game_card ON game_card.id = game_card_out_record.game_card_id"). + Select("game_card_out_record.*, store.name as store_name, game_card.name as game_card_name") + + // 如果不是导出,则进行分页查询 + if m.IsExport != 1 { + offset := (m.PageIndex - 1) * m.PageSize + db = db.Offset(offset).Limit(m.PageSize) + } + + // 查询数据,按id倒序排序 + var list []GameCardOutRecord + if err := db.Order("game_card_out_record.id DESC").Find(&list).Error; err != nil { + return nil, err + } + + resp.List = list + + if m.IsExport == 1 { // 导出excel + excelPath, err := exportStockOutDetailExcel(resp) + if err != nil { + return nil, err + } + + resp.ExportUrl = excelPath + resp.List = nil + } + + return resp, nil +} + +func exportStockOutDetailExcel(resp *GameCardGoodsStockOutInfoListResp) (string, error) { + // 1. 收集所有需要查询的门店和游戏卡ID,去重处理 + storeIDSet := make(map[uint64]struct{}) + gameCardIDSet := make(map[uint64]struct{}) + for _, record := range resp.List { + storeIDSet[record.StoreId] = struct{}{} + gameCardIDSet[record.GameCardId] = struct{}{} + } + storeIDs := make([]uint64, 0, len(storeIDSet)) + for id := range storeIDSet { + storeIDs = append(storeIDs, id) + } + gameCardIDs := make([]uint64, 0, len(gameCardIDSet)) + for id := range gameCardIDSet { + gameCardIDs = append(gameCardIDs, id) + } + + // 2. 查询门店名称 + var stores []Store + if err := orm.Eloquent.Table("store").Where("id IN (?)", storeIDs).Find(&stores).Error; err != nil { + logger.Error("查询门店名称错误", logger.Field("err", err)) + return "", err + } + storeMap := make(map[uint64]string) + // 注意:假设 Store 结构体内 Model 包含 ID 字段 + for _, s := range stores { + storeMap[uint64(s.ID)] = s.Name + } + + // 3. 查询游戏卡名称 + var gameCards []GameCard + if err := orm.Eloquent.Table("game_card").Where("id IN (?)", gameCardIDs).Find(&gameCards).Error; err != nil { + logger.Error("查询游戏卡名称错误", logger.Field("err", err)) + return "", err + } + gameCardMap := make(map[uint64]string) + for _, g := range gameCards { + gameCardMap[uint64(g.ID)] = g.Name + } + + // 4. 将查询到的名称填充到每个记录中 + for i, record := range resp.List { + if name, ok := storeMap[record.StoreId]; ok { + resp.List[i].StoreName = name + } + if name, ok := gameCardMap[record.GameCardId]; ok { + resp.List[i].GameCardName = name + } + } + + // 5. 生成 Excel 文件 + file := excelize.NewFile() + fSheet := "Sheet1" + url := config.ExportConfig.Url + fileName := time.Now().Format(TimeFormat) + "出库明细" + ".xlsx" + fmt.Println("save fileName:", url+fileName) + + // 设置标题行 + title := []interface{}{"游戏卡串码", "门店名称", "游戏名称", "首次入库时间", "入库时间", "出库时间", "出库人"} + for i, v := range title { + cell, _ := excelize.CoordinatesToCellName(i+1, 1) + if err := file.SetCellValue(fSheet, cell, v); err != nil { + logger.Error("设置标题值错误", logger.Field("err", err)) + } + } + + // 循环写入每条出库记录 + rowIndex := 0 + for _, record := range resp.List { + var firstStockTime, stockTime, outStockTime string + if record.FirstStockTime != nil { + firstStockTime = record.FirstStockTime.Format("2006-01-02 15:04:05") + } + if record.StockTime != nil { + stockTime = record.StockTime.Format("2006-01-02 15:04:05") + } + if record.OutStockTime != nil { + outStockTime = record.OutStockTime.Format("2006-01-02 15:04:05") + } + + rowData := []interface{}{ + record.SerialNumber, // 游戏卡串码 + record.StoreName, // 门店名称 + record.GameCardName, // 游戏名称 + firstStockTime, // 首次入库时间 + stockTime, // 入库时间 + outStockTime, // 出库时间 + record.MakerName, // 出库人 + } + + for j, v := range rowData { + cell, _ := excelize.CoordinatesToCellName(j+1, rowIndex+2) + if err := file.SetCellValue(fSheet, cell, v); err != nil { + logger.Error("写入单元格值错误", logger.Field("err", err)) + } + } + rowIndex++ + } + + // 写入统计行(例如记录总数) + totalData := "记录数:" + strconv.Itoa(resp.Total) + summary := []interface{}{totalData, "", "", "", "", "", ""} + for i, v := range summary { + cell, _ := excelize.CoordinatesToCellName(i+1, rowIndex+2) + if err := file.SetCellValue(fSheet, cell, v); err != nil { + logger.Error("写入统计数据错误", logger.Field("err", err)) + } + } + + // 设置样式:居中、加边框 + style, _ := file.NewStyle(`{"alignment":{"horizontal":"center","vertical":"center"}, + "border":[{"type":"left","color":"000000","style":1}, + {"type":"top","color":"000000","style":1}, + {"type":"right","color":"000000","style":1}, + {"type":"bottom","color":"000000","style":1}]}`) + _ = file.SetRowHeight(fSheet, 1, 20) + _ = file.SetColWidth(fSheet, "A", "A", 20) + _ = file.SetColWidth(fSheet, "B", "B", 20) + _ = file.SetColWidth(fSheet, "C", "C", 20) + _ = file.SetColWidth(fSheet, "D", "D", 25) + _ = file.SetColWidth(fSheet, "E", "E", 25) + _ = file.SetColWidth(fSheet, "F", "F", 25) + _ = file.SetColWidth(fSheet, "G", "G", 15) + + endRow, _ := excelize.CoordinatesToCellName(7, rowIndex+2) + _ = file.SetCellStyle(fSheet, "A1", endRow, style) + + // 保存文件 + if err := file.SaveAs(config.ExportConfig.Path + fileName); err != nil { + logger.Error("保存文件错误", logger.Field("err", err)) + return "", err + } + + return url + fileName, nil +} diff --git a/app/admin/models/purchase_change.go b/app/admin/models/purchase_change.go index d001c42..7821463 100644 --- a/app/admin/models/purchase_change.go +++ b/app/admin/models/purchase_change.go @@ -69,9 +69,11 @@ type ErpPurchaseChangeOrderListReq struct { SerialNumber string `json:"serial_number"` // 单据编号 StoreId uint32 `json:"store_id"` // 门店id ErpSupplierId uint32 `json:"erp_supplier_id"` // 供应商id + MakerTimeStart string `json:"make_time_start"` // 制单开始时间 + MakerTimeEnd string `json:"make_time_end"` // 制单结束时间 AuditTimeStart string `json:"audit_time_start"` // 审核开始时间 AuditTimeEnd string `json:"audit_time_end"` // 审核结束时间 - State []uint32 `json:"state"` // 状态:1-待审核 2-已完成 3-已终止 + State []uint32 `json:"state"` // 状态:1-待审核 2-已完成 HandlerId uint32 `json:"handler_id"` // 经手人id PageIndex int `json:"pageIndex"` // 页码 PageSize int `json:"pageSize"` // 页面条数 @@ -435,6 +437,26 @@ func (m *ErpPurchaseChangeOrderListReq) List(c *gin.Context) (*ErpPurchaseChange if len(m.State) > 0 { qs = qs.Where("state IN (?)", m.State) } + if m.MakerTimeStart != "" { + parse, err := time.Parse(QueryTimeFormat, m.MakerTimeStart) + if err != nil { + logger.Errorf("erpPurchaseChangeOrderList err:", err) + return nil, err + } + qs = qs.Where("make_time > ?", parse) + } + if m.MakerTimeEnd != "" { + parse, err := time.Parse(QueryTimeFormat, m.MakerTimeEnd) + if err != nil { + logger.Errorf("erpPurchaseChangeOrderList err:", err) + return nil, err + } + //parse = parse.AddDate(0, 0, 1) + qs = qs.Where("make_time < ?", parse) + } + if m.HandlerId != 0 { + qs = qs.Where("handler_id=?", m.HandlerId) + } if m.AuditTimeStart != "" { parse, err := time.Parse(QueryTimeFormat, m.AuditTimeStart) if err != nil { diff --git a/app/admin/router/stockmanage.go b/app/admin/router/stockmanage.go index 6df1173..ac44f38 100644 --- a/app/admin/router/stockmanage.go +++ b/app/admin/router/stockmanage.go @@ -13,6 +13,9 @@ func registerStockManageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMi { order.POST("/list", stockmanage.GameCardGoodsStockInfoList) // 库存列表 order.POST("/cannibalize_task/list", stockmanage.CannibalizeTaskList) // 库存调拨列表 + + order.POST("/card/dels", stockmanage.GameCardGoodsStockDels) // 游戏卡减库存/出库 + order.POST("/out_list", stockmanage.GameCardGoodsStockOutInfoList) // 出库明细 } } @@ -21,9 +24,9 @@ func registerStockManageUnAuthRouter(v1 *gin.RouterGroup) { order := v1.Group("/stock") { //order.POST("/list", stockmanage.GameCardGoodsStockInfoList) // 库存列表 - order.POST("/card/list", stockmanage.GameCardGoodsStockCardList) // 游戏卡列表 - order.POST("/card/adds", stockmanage.GameCardGoodsStockAdds) // 游戏卡入库 - order.POST("/card/dels", stockmanage.GameCardGoodsStockDels) // 游戏卡减库存 + order.POST("/card/list", stockmanage.GameCardGoodsStockCardList) // 游戏卡列表 + order.POST("/card/adds", stockmanage.GameCardGoodsStockAdds) // 游戏卡入库 + //order.POST("/card/dels", stockmanage.GameCardGoodsStockDels) // 游戏卡减库存/出库 order.POST("/card/stock_derive", stockmanage.ExportDataGameCardGoodsStock) // order.POST("/cannibalize_task/create", stockmanage.CannibalizeTaskCreate) // 创建调拨 diff --git a/docs/docs.go b/docs/docs.go index 972b540..971da57 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -6217,6 +6217,39 @@ const docTemplate = `{ } } }, + "/api/v1/stock/card/dels": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "租卡系统-库存管理" + ], + "summary": "游戏卡出库", + "parameters": [ + { + "description": "游戏卡出库模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.GameCardGoodsStockDelsReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, "/api/v1/stock/list": { "post": { "consumes": [ @@ -6250,6 +6283,39 @@ const docTemplate = `{ } } }, + "/api/v1/stock/out_list": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "租卡系统-库存管理" + ], + "summary": "出库明细", + "parameters": [ + { + "description": "出库明细模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.GameCardGoodsStockOutInfoListReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.GameCardGoodsStockOutInfoListResp" + } + } + } + } + }, "/api/v1/store/add": { "post": { "consumes": [ @@ -12254,6 +12320,14 @@ const docTemplate = `{ "description": "经手人id", "type": "integer" }, + "make_time_end": { + "description": "制单结束时间", + "type": "string" + }, + "make_time_start": { + "description": "制单开始时间", + "type": "string" + }, "pageIndex": { "description": "页码", "type": "integer" @@ -12267,7 +12341,7 @@ const docTemplate = `{ "type": "string" }, "state": { - "description": "状态:1-待审核 2-已完成 3-已终止", + "description": "状态:1-待审核 2-已完成", "type": "array", "items": { "type": "integer" @@ -14298,6 +14372,17 @@ const docTemplate = `{ } } }, + "models.GameCardGoodsStockDelsReq": { + "type": "object", + "properties": { + "serial_number_list": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "models.GameCardGoodsStockInfo": { "type": "object", "properties": { @@ -14414,6 +14499,129 @@ const docTemplate = `{ } } }, + "models.GameCardGoodsStockOutInfoListReq": { + "type": "object", + "properties": { + "game_card_id": { + "description": "游戏卡id", + "type": "integer" + }, + "is_export": { + "description": "1-导出", + "type": "integer" + }, + "out_stock_time_end": { + "description": "出库结束时间", + "type": "string" + }, + "out_stock_time_start": { + "description": "出库开始时间", + "type": "string" + }, + "pageIndex": { + "description": "页码", + "type": "integer" + }, + "pageSize": { + "description": "页面条数", + "type": "integer" + }, + "serial_number": { + "description": "游戏卡串码", + "type": "string" + }, + "store_id": { + "description": "门店id", + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "models.GameCardGoodsStockOutInfoListResp": { + "type": "object", + "properties": { + "export_url": { + "type": "string" + }, + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/models.GameCardOutRecord" + } + }, + "pageIndex": { + "description": "页码", + "type": "integer" + }, + "pageSize": { + "description": "每页展示条数", + "type": "integer" + }, + "total": { + "description": "总条数", + "type": "integer" + } + } + }, + "models.GameCardOutRecord": { + "type": "object", + "properties": { + "createdAt": { + "description": "创建时间", + "type": "string" + }, + "first_stock_time": { + "description": "首次入库时间", + "type": "string" + }, + "game_card_id": { + "description": "游戏卡id", + "type": "integer" + }, + "game_card_name": { + "description": "游戏名称", + "type": "string" + }, + "id": { + "description": "数据库记录编号", + "type": "integer" + }, + "maker_id": { + "description": "出库人id", + "type": "integer" + }, + "maker_name": { + "description": "出库人名称", + "type": "string" + }, + "out_stock_time": { + "description": "出库时间", + "type": "string" + }, + "serial_number": { + "description": "游戏卡串码", + "type": "string" + }, + "stock_time": { + "description": "入库时间", + "type": "string" + }, + "store_id": { + "description": "门店id", + "type": "integer" + }, + "store_name": { + "description": "门店名称", + "type": "string" + }, + "updatedAt": { + "description": "更新时间", + "type": "string" + } + } + }, "models.GenerateSchemeReq": { "type": "object", "required": [ diff --git a/docs/swagger.json b/docs/swagger.json index 314fded..1fd05eb 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -6206,6 +6206,39 @@ } } }, + "/api/v1/stock/card/dels": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "租卡系统-库存管理" + ], + "summary": "游戏卡出库", + "parameters": [ + { + "description": "游戏卡出库模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.GameCardGoodsStockDelsReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, "/api/v1/stock/list": { "post": { "consumes": [ @@ -6239,6 +6272,39 @@ } } }, + "/api/v1/stock/out_list": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "租卡系统-库存管理" + ], + "summary": "出库明细", + "parameters": [ + { + "description": "出库明细模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.GameCardGoodsStockOutInfoListReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.GameCardGoodsStockOutInfoListResp" + } + } + } + } + }, "/api/v1/store/add": { "post": { "consumes": [ @@ -12243,6 +12309,14 @@ "description": "经手人id", "type": "integer" }, + "make_time_end": { + "description": "制单结束时间", + "type": "string" + }, + "make_time_start": { + "description": "制单开始时间", + "type": "string" + }, "pageIndex": { "description": "页码", "type": "integer" @@ -12256,7 +12330,7 @@ "type": "string" }, "state": { - "description": "状态:1-待审核 2-已完成 3-已终止", + "description": "状态:1-待审核 2-已完成", "type": "array", "items": { "type": "integer" @@ -14287,6 +14361,17 @@ } } }, + "models.GameCardGoodsStockDelsReq": { + "type": "object", + "properties": { + "serial_number_list": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "models.GameCardGoodsStockInfo": { "type": "object", "properties": { @@ -14403,6 +14488,129 @@ } } }, + "models.GameCardGoodsStockOutInfoListReq": { + "type": "object", + "properties": { + "game_card_id": { + "description": "游戏卡id", + "type": "integer" + }, + "is_export": { + "description": "1-导出", + "type": "integer" + }, + "out_stock_time_end": { + "description": "出库结束时间", + "type": "string" + }, + "out_stock_time_start": { + "description": "出库开始时间", + "type": "string" + }, + "pageIndex": { + "description": "页码", + "type": "integer" + }, + "pageSize": { + "description": "页面条数", + "type": "integer" + }, + "serial_number": { + "description": "游戏卡串码", + "type": "string" + }, + "store_id": { + "description": "门店id", + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "models.GameCardGoodsStockOutInfoListResp": { + "type": "object", + "properties": { + "export_url": { + "type": "string" + }, + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/models.GameCardOutRecord" + } + }, + "pageIndex": { + "description": "页码", + "type": "integer" + }, + "pageSize": { + "description": "每页展示条数", + "type": "integer" + }, + "total": { + "description": "总条数", + "type": "integer" + } + } + }, + "models.GameCardOutRecord": { + "type": "object", + "properties": { + "createdAt": { + "description": "创建时间", + "type": "string" + }, + "first_stock_time": { + "description": "首次入库时间", + "type": "string" + }, + "game_card_id": { + "description": "游戏卡id", + "type": "integer" + }, + "game_card_name": { + "description": "游戏名称", + "type": "string" + }, + "id": { + "description": "数据库记录编号", + "type": "integer" + }, + "maker_id": { + "description": "出库人id", + "type": "integer" + }, + "maker_name": { + "description": "出库人名称", + "type": "string" + }, + "out_stock_time": { + "description": "出库时间", + "type": "string" + }, + "serial_number": { + "description": "游戏卡串码", + "type": "string" + }, + "stock_time": { + "description": "入库时间", + "type": "string" + }, + "store_id": { + "description": "门店id", + "type": "integer" + }, + "store_name": { + "description": "门店名称", + "type": "string" + }, + "updatedAt": { + "description": "更新时间", + "type": "string" + } + } + }, "models.GenerateSchemeReq": { "type": "object", "required": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 731d4cd..144053b 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -3630,6 +3630,12 @@ definitions: handler_id: description: 经手人id type: integer + make_time_end: + description: 制单结束时间 + type: string + make_time_start: + description: 制单开始时间 + type: string pageIndex: description: 页码 type: integer @@ -3640,7 +3646,7 @@ definitions: description: 单据编号 type: string state: - description: 状态:1-待审核 2-已完成 3-已终止 + description: 状态:1-待审核 2-已完成 items: type: integer type: array @@ -5115,6 +5121,13 @@ definitions: description: 'StockRemovalType string `json:"stock_removal_type"` // 出库类型: card_retrieve 收回卡 card_issue_retrieve 收回卡异常' type: object + models.GameCardGoodsStockDelsReq: + properties: + serial_number_list: + items: + type: string + type: array + type: object models.GameCardGoodsStockInfo: properties: cover_img: @@ -5197,6 +5210,95 @@ definitions: total_page: type: integer type: object + models.GameCardGoodsStockOutInfoListReq: + properties: + game_card_id: + description: 游戏卡id + type: integer + is_export: + description: 1-导出 + type: integer + out_stock_time_end: + description: 出库结束时间 + type: string + out_stock_time_start: + description: 出库开始时间 + type: string + pageIndex: + description: 页码 + type: integer + pageSize: + description: 页面条数 + type: integer + serial_number: + description: 游戏卡串码 + type: string + store_id: + description: 门店id + items: + type: integer + type: array + type: object + models.GameCardGoodsStockOutInfoListResp: + properties: + export_url: + type: string + list: + items: + $ref: '#/definitions/models.GameCardOutRecord' + type: array + pageIndex: + description: 页码 + type: integer + pageSize: + description: 每页展示条数 + type: integer + total: + description: 总条数 + type: integer + type: object + models.GameCardOutRecord: + properties: + createdAt: + description: 创建时间 + type: string + first_stock_time: + description: 首次入库时间 + type: string + game_card_id: + description: 游戏卡id + type: integer + game_card_name: + description: 游戏名称 + type: string + id: + description: 数据库记录编号 + type: integer + maker_id: + description: 出库人id + type: integer + maker_name: + description: 出库人名称 + type: string + out_stock_time: + description: 出库时间 + type: string + serial_number: + description: 游戏卡串码 + type: string + stock_time: + description: 入库时间 + type: string + store_id: + description: 门店id + type: integer + store_name: + description: 门店名称 + type: string + updatedAt: + description: 更新时间 + type: string + type: object models.GenerateSchemeReq: properties: env_version: @@ -13847,6 +13949,27 @@ paths: summary: 查询游戏卡库存调拨 tags: - 租卡系统-库存管理 + /api/v1/stock/card/dels: + post: + consumes: + - application/json + parameters: + - description: 游戏卡出库模型 + in: body + name: request + required: true + schema: + $ref: '#/definitions/models.GameCardGoodsStockDelsReq' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/app.Response' + summary: 游戏卡出库 + tags: + - 租卡系统-库存管理 /api/v1/stock/list: post: consumes: @@ -13868,6 +13991,27 @@ paths: summary: 查询小程序租卡库存列表 tags: - 租卡系统-库存管理 + /api/v1/stock/out_list: + post: + consumes: + - application/json + parameters: + - description: 出库明细模型 + in: body + name: request + required: true + schema: + $ref: '#/definitions/models.GameCardGoodsStockOutInfoListReq' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.GameCardGoodsStockOutInfoListResp' + summary: 出库明细 + tags: + - 租卡系统-库存管理 /api/v1/store/add: post: consumes: