在这个接口里/api/product_book/list 将self_id返回

This commit is contained in:
Administrator 2026-06-18 18:00:51 +08:00
parent 46aa5831cb
commit 0f2a789a26
23 changed files with 350 additions and 340 deletions

View File

@ -20,10 +20,11 @@ func (r *BarcodeApi) GenerateBarcode(c *gin.Context) {
var req systemReq.BarcodeRequest var req systemReq.BarcodeRequest
// 参数绑定 // 参数绑定
if err := c.ShouldBind(&req); err != nil { if err := c.ShouldBind(&req); err != nil {
// 参数校验失败
ValidAndFail(constant.LoggerChannelRequest, "条形码生成请求参数异常", "参数错误: "+err.Error(), c, err) ValidAndFail(constant.LoggerChannelRequest, "条形码生成请求参数异常", "参数错误: "+err.Error(), c, err)
return return
} }
// 业务处理
result, err := barcodeService.GenerateBarcode(req.Content) result, err := barcodeService.GenerateBarcode(req.Content)
if err != nil { if err != nil {
utils.FailWithRequestLog(constant.LoggerChannelWork, "条形码生成异常", err, c, req) utils.FailWithRequestLog(constant.LoggerChannelWork, "条形码生成异常", err, c, req)

View File

@ -12,17 +12,18 @@ import (
type BookApi struct{} type BookApi struct{}
// SyncBook 同步书籍信息
var bookService = service.BookService{} var bookService = service.BookService{}
// GetBookInfo 获取图书信息 // GetBookInfo 获取图书信息
func (r *BookApi) GetBookInfo(c *gin.Context) { func (r *BookApi) GetBookInfo(c *gin.Context) {
// 参数校验
var req systemReq.BookRequest var req systemReq.BookRequest
if err := c.ShouldBindQuery(&req); err != nil { if err := c.ShouldBindQuery(&req); err != nil {
ValidAndFail(constant.LoggerChannelRequest, "获取图书信息请求参数异常", "参数错误: "+err.Error(), c, err) ValidAndFail(constant.LoggerChannelRequest, "获取图书信息请求参数异常", "参数错误: "+err.Error(), c, err)
return return
} }
// 业务处理
result, err := bookService.GetBookInfo(req) result, err := bookService.GetBookInfo(req)
if err != nil { if err != nil {
utils.FailWithRequestLog(constant.LoggerChannelWork, "获取图书信息异常", err, c, req) utils.FailWithRequestLog(constant.LoggerChannelWork, "获取图书信息异常", err, c, req)
@ -37,6 +38,7 @@ func (r *BookApi) GetBookInfo(c *gin.Context) {
// GetSuitBook 获取套装书 // GetSuitBook 获取套装书
func (r *BookApi) GetSuitBook(c *gin.Context) { func (r *BookApi) GetSuitBook(c *gin.Context) {
var req systemReq.BookRequest var req systemReq.BookRequest
if err := c.ShouldBindQuery(&req); err != nil { if err := c.ShouldBindQuery(&req); err != nil {
ValidAndFail(constant.LoggerChannelRequest, "获取套装书请求参数异常", "参数错误: "+err.Error(), c, err) ValidAndFail(constant.LoggerChannelRequest, "获取套装书请求参数异常", "参数错误: "+err.Error(), c, err)
@ -115,6 +117,7 @@ func (r *BookApi) SyncBook(c *gin.Context) {
bookID, result, err := bookService.SyncBook(req) bookID, result, err := bookService.SyncBook(req)
if err != nil { if err != nil {
// 记录日志
utils.FailWithRequestLog(constant.LoggerChannelWork, "同步书籍信息异常", err, c, req) utils.FailWithRequestLog(constant.LoggerChannelWork, "同步书籍信息异常", err, c, req)
return return
} }

View File

@ -9,8 +9,10 @@ import (
"psi/utils" "psi/utils"
) )
// CancelLogisticsApi 删除物流单号 定义一个结构体
type CancelLogisticsApi struct{} type CancelLogisticsApi struct{}
// cancelLogisticsService 删除物流单号服务 声明一个变量
var cancelLogisticsService = service.CancelLogisticsService{} var cancelLogisticsService = service.CancelLogisticsService{}
// CancelLogistics 取消物流单号 // CancelLogistics 取消物流单号

View File

@ -76,13 +76,14 @@ func (r *CarApi) GetCarDetail(c *gin.Context) {
systemRes.OkWithDetailed(car, "查询成功", c) systemRes.OkWithDetailed(car, "查询成功", c)
} }
// CreateCar 创建小车
func (r *CarApi) CreateCar(c *gin.Context) { func (r *CarApi) CreateCar(c *gin.Context) {
var req systemReq.CreateCarRequest var req systemReq.CreateCarRequest
if err := c.ShouldBind(&req); err != nil { if err := c.ShouldBind(&req); err != nil {
ValidAndFail(constant.LoggerChannelRequest, "创建小车请求参数异常", "参数错误: "+err.Error(), c, err) ValidAndFail(constant.LoggerChannelRequest, "创建小车请求参数异常", "参数错误: "+err.Error(), c, err)
return return
} }
// 处理shop_info参数
if len(req.ShopInfo) == 0 { if len(req.ShopInfo) == 0 {
info, err := parseInfo(c) info, err := parseInfo(c)
if err != nil { if err != nil {
@ -91,7 +92,7 @@ func (r *CarApi) CreateCar(c *gin.Context) {
} }
req.ShopInfo = info req.ShopInfo = info
} }
// 处理warehouse_info参数
userInfo := utils.GetUserInfo(c) userInfo := utils.GetUserInfo(c)
id, err := carService.CreateCar(req, userInfo.ID, database.GetDB(c)) id, err := carService.CreateCar(req, userInfo.ID, database.GetDB(c))
if err != nil { if err != nil {

View File

@ -12,7 +12,7 @@ import (
"psi/utils" "psi/utils"
) )
type ConfigApi struct{} type ConfigApi struct{} //ConfigApi结构体
var configService = service.ConfigService{} var configService = service.ConfigService{}

View File

@ -62,14 +62,14 @@ func (r *EmployeeApi) GetCurrentUser(c *gin.Context) {
} }
systemRes.OkWithDetailed(gin.H{ systemRes.OkWithDetailed(gin.H{
"type": "admin", "type": "admin", // 255-admin, 128-employee
"id": employeeInfo.ID, "id": employeeInfo.ID, // 员工ID
"employee_id_str": employeeInfo.EmployeeIDStr, "employee_id_str": employeeInfo.EmployeeIDStr, // 员工编号
"username": employeeInfo.Username, "username": employeeInfo.Username, // 用户名
"name": employeeInfo.Name, "name": employeeInfo.Name, // 姓名
"role": employeeInfo.Role, "role": employeeInfo.Role, // 角色
"points": employeeInfo.Score, "points": employeeInfo.Score, // 积分
"status": employeeInfo.Status, "status": employeeInfo.Status, // 状态
}, "获取成功", c) }, "获取成功", c)
} }

View File

@ -2,17 +2,17 @@ package models
// Car 小车表 // Car 小车表
type Car struct { type Car struct {
ID int64 `json:"id" gorm:"primarykey;comment:小车ID"` ID int64 `json:"id" gorm:"primarykey;comment:小车ID"` // 小车ID
WarehouseID int64 `json:"warehouse_id" gorm:"not null;default:0;index;comment:所属仓库ID"` WarehouseID int64 `json:"warehouse_id" gorm:"not null;default:0;index;comment:所属仓库ID"` // 所属仓库ID
PushType int8 `json:"push_type" gorm:"type:tinyint(1);not null;default:1;comment:推送类型(1:创建波次后随即上架,2:入库后在上架)"` PushType int8 `json:"push_type" gorm:"type:tinyint(1);not null;default:1;comment:推送类型(1:创建波次后随即上架,2:入库后在上架)"` // 推送类型
ReleaseType int8 `json:"release_type" gorm:"type:tinyint(1);not null;default:1;comment:发布类型(1:独立库存,2:合并库存)"` ReleaseType int8 `json:"release_type" gorm:"type:tinyint(1);not null;default:1;comment:发布类型(1:独立库存,2:合并库存)"` // 发布类型
Code int64 `json:"code" gorm:"not null;default:0;comment:小车编号"` Code int64 `json:"code" gorm:"not null;default:0;comment:小车编号"` // 小车编号
Name string `json:"name" gorm:"size:50;not null;default:'';comment:小车名称"` Name string `json:"name" gorm:"size:50;not null;default:'';comment:小车名称"` // 小车名称
Capacity int64 `json:"capacity" gorm:"not null;default:0;comment:容量"` Capacity int64 `json:"capacity" gorm:"not null;default:0;comment:容量"` // 容量
Appearance int64 `json:"appearance" gorm:"type:bigint(20) unsigned;not null;default:0;comment:品相"` Appearance int64 `json:"appearance" gorm:"type:bigint(20) unsigned;not null;default:0;comment:品相"` // 品相
CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳(秒)"` CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳(秒)"` // 创建时间戳(秒)
UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳(秒)"` UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳(秒)"` // 更新时间戳(秒)
IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` // 逻辑删除标记(0:未删除,1:已删除)
} }
func (Car) TableName() string { func (Car) TableName() string {

View File

@ -2,21 +2,21 @@ package models
// CarShop 小车店铺关联表 // CarShop 小车店铺关联表
type CarShop struct { type CarShop struct {
ID int64 `json:"id" gorm:"primarykey;comment:关联ID"` ID int64 `json:"id" gorm:"primarykey;comment:关联ID"` // 关联ID
CarID int64 `json:"car_id" gorm:"not null;default:0;comment:小车id"` CarID int64 `json:"car_id" gorm:"not null;default:0;comment:小车id"` // 小车id
ShopID int64 `json:"shop_id" gorm:"not null;default:0;comment:店铺id"` ShopID int64 `json:"shop_id" gorm:"not null;default:0;comment:店铺id"` // 店铺id
ShopName string `json:"shop_name" gorm:"size:50;not null;default:'';comment:店铺名称"` ShopName string `json:"shop_name" gorm:"size:50;not null;default:'';comment:店铺名称"` // 店铺名称
ShopType int8 `json:"shop_type" gorm:"type:tinyint(1);not null;default:0;comment:店铺类型"` ShopType int8 `json:"shop_type" gorm:"type:tinyint(1);not null;default:0;comment:店铺类型"` // 店铺类型
ClientID string `json:"client_id" gorm:"size:50;not null;comment:客户端id"` ClientID string `json:"client_id" gorm:"size:50;not null;comment:客户端id"` // 客户端id
AppKey string `json:"app_key" gorm:"size:255;not null;default:'';comment:app_key"` AppKey string `json:"app_key" gorm:"size:255;not null;default:'';comment:app_key"` // app_key
AppSecret string `json:"app_secret" gorm:"size:255;not null;default:'';comment:app_secret"` AppSecret string `json:"app_secret" gorm:"size:255;not null;default:'';comment:app_secret"` // app_secret
CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳(秒)"` CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳(秒)"` // 创建时间戳(秒)
UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳(秒)"` UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳(秒)"` // 更新时间戳(秒)
IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` // 逻辑删除标记(0:未删除,1:已删除)
} }
func (CarShop) TableName() string { func (CarShop) TableName() string {
return "car_shop" return "car_shop" // 表名
} }
func (CarShop) TableOptions() string { func (CarShop) TableOptions() string {

View File

@ -2,12 +2,12 @@ package models
// Config 配置表 // Config 配置表
type Config struct { type Config struct {
ID int64 `json:"id" gorm:"primarykey;comment:配置ID"` ID int64 `json:"id" gorm:"primarykey;comment:配置ID"` // 配置ID
Key string `json:"key" gorm:"size:200;not null;default:'';uniqueIndex:uk_key;comment:配置键"` Key string `json:"key" gorm:"size:200;not null;default:'';uniqueIndex:uk_key;comment:配置键"` // 配置键
Value string `json:"value" gorm:"type:text;comment:配置值"` Value string `json:"value" gorm:"type:text;comment:配置值"` // 配置值
CreatedAt int64 `json:"created_at" gorm:"type:bigint;default:0;comment:创建时间戳(秒)"` CreatedAt int64 `json:"created_at" gorm:"type:bigint;default:0;comment:创建时间戳(秒)"` // 创建时间戳(秒)
UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;default:0;comment:更新时间戳(秒)"` UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;default:0;comment:更新时间戳(秒)"` // 更新时间戳(秒)
IsDel int8 `json:"is_del" gorm:"type:tinyint(1);default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` IsDel int8 `json:"is_del" gorm:"type:tinyint(1);default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` // 逻辑删除标记(0:未删除,1:已删除)
} }
func (Config) TableName() string { func (Config) TableName() string {

View File

@ -2,40 +2,40 @@ package models
// Employee 员工 // Employee 员工
type Employee struct { type Employee struct {
ID int64 `json:"id" gorm:"primarykey;comment:自增ID"` ID int64 `json:"id" gorm:"primarykey;comment:自增ID"` // 自增ID
EmployeeIDStr string `json:"employee_id_str" gorm:"size:10;not null;uniqueIndex"` // 工号 EmployeeIDStr string `json:"employee_id_str" gorm:"size:10;not null;uniqueIndex"` // 工号
Fid int64 `json:"fid" gorm:"not null;default:0;comment:父级id"` Fid int64 `json:"fid" gorm:"not null;default:0;comment:父级id"` // 父级id
AboutId int64 `json:"about_id" gorm:"not null;default:0;comment:关联id"` AboutId int64 `json:"about_id" gorm:"not null;default:0;comment:关联id"` // 关联id
Code string `json:"code" gorm:"size:64;not null;default:'';comment:机械码"` Code string `json:"code" gorm:"size:64;not null;default:'';comment:机械码"` // 机械码
Username string `json:"username" gorm:"size:50;not null;default:'';comment:登录账号 (init_工号)"` Username string `json:"username" gorm:"size:50;not null;default:'';comment:登录账号 (init_工号)"` // 登录账号 (init_工号)
Password string `json:"password" gorm:"size:100;not null;default:'';comment:密码"` Password string `json:"password" gorm:"size:100;not null;default:'';comment:密码"` // 密码
Name string `json:"name" gorm:"size:50;not null;default:'';comment:姓名"` Name string `json:"name" gorm:"size:50;not null;default:'';comment:姓名"` // 姓名
Phone string `json:"phone" gorm:"size:11;not null;default:'';comment:手机号"` Phone string `json:"phone" gorm:"size:11;not null;default:'';comment:手机号"` // 手机号
Role int64 `json:"role" gorm:"not null;default:0;comment:权限"` Role int64 `json:"role" gorm:"not null;default:0;comment:权限"` // 权限
Status int8 `json:"status" gorm:"not null;default:1;comment:状态 1正常 0禁用"` Status int8 `json:"status" gorm:"not null;default:1;comment:状态 1正常 0禁用"` // 状态 1正常 0禁用
Score int64 `json:"score" gorm:"not null;default:0;comment:积分"` Score int64 `json:"score" gorm:"not null;default:0;comment:积分"` // 积分
SplitAccountConfigId int64 `json:"split_account_config_id" gorm:"not null;default:0;comment:分账配置ID"` SplitAccountConfigId int64 `json:"split_account_config_id" gorm:"not null;default:0;comment:分账配置ID"` // 分账配置ID
From string `json:"from" gorm:"size:50;not null;default:'';comment:来源"` From string `json:"from" gorm:"size:50;not null;default:'';comment:来源"` // 来源
TypeId int8 `json:"type_id" gorm:"not null;default:0;comment:关联类型"` TypeId int8 `json:"type_id" gorm:"not null;default:0;comment:关联类型"` // 关联类型
LastLoginAt int64 `json:"last_login_at" gorm:"not null;default:0;comment:最后登录时间"` LastLoginAt int64 `json:"last_login_at" gorm:"not null;default:0;comment:最后登录时间"` // 最后登录时间
LastLoginIp string `json:"last_login_ip" gorm:"size:20;not null;default:'';comment:最后登录ip"` LastLoginIp string `json:"last_login_ip" gorm:"size:20;not null;default:'';comment:最后登录ip"` // 最后登录ip
CreatedAt int64 `json:"created_at" gorm:"not null;default:0;comment:创建时间"` CreatedAt int64 `json:"created_at" gorm:"not null;default:0;comment:创建时间"` // 创建时间
UpdatedAt int64 `json:"updated_at" gorm:"not null;default:0;comment:更新时间"` UpdatedAt int64 `json:"updated_at" gorm:"not null;default:0;comment:更新时间"` // 更新时间
DeletedAt int64 `json:"deleted_at" gorm:"not null;default:0;comment:删除时间"` DeletedAt int64 `json:"deleted_at" gorm:"not null;default:0;comment:删除时间"` // 删除时间
ExpireTime int64 `json:"expire_time" gorm:"not null;default:0;comment:过期时间"` ExpireTime int64 `json:"expire_time" gorm:"not null;default:0;comment:过期时间"` // 过期时间
} }
// UpdateEmployeeSplitAccountConfigResponse 更新员工分账配置响应 // UpdateEmployeeSplitAccountConfigResponse 更新员工分账配置响应
type UpdateEmployeeSplitAccountConfigResponse struct { type UpdateEmployeeSplitAccountConfigResponse struct {
ID int64 `json:"id"` ID int64 `json:"id"` // 自增ID
EmployeeIDStr string `json:"employee_id_str"` EmployeeIDStr string `json:"employee_id_str"` // 工号
Username string `json:"username"` Username string `json:"username"` // 登录账号 (init_工号)
Name string `json:"name"` Name string `json:"name"` // 姓名
Phone string `json:"phone"` Phone string `json:"phone"` // 手机号
AboutId int64 `json:"about_id"` AboutId int64 `json:"about_id"` // 关联id
SplitAccountConfigId int64 `json:"split_account_config_id"` SplitAccountConfigId int64 `json:"split_account_config_id"` // 分账配置ID
Status int8 `json:"status"` Status int8 `json:"status"` // 状态 1正常 0禁用
UpdatedAt int64 `json:"updated_at"` UpdatedAt int64 `json:"updated_at"` // 更新时间
} }
func (Employee) TableName() string { func (Employee) TableName() string {

View File

@ -2,11 +2,11 @@ package models
// InventoryDetail 库存明细表(库位级) // InventoryDetail 库存明细表(库位级)
type InventoryDetail struct { type InventoryDetail struct {
ID int64 `json:"id" gorm:"primarykey;comment:明细ID"` ID int64 `json:"id" gorm:"primarykey;comment:明细ID"` // 明细ID
WarehouseID int64 `json:"warehouse_id" gorm:"not null;default:0;index;comment:仓库ID"` WarehouseID int64 `json:"warehouse_id" gorm:"not null;default:0;index;comment:仓库ID"` // 仓库ID
LocationID int64 `json:"location_id" gorm:"not null;default:0;uniqueIndex:uk_location_product_batch;index;comment:库位ID"` LocationID int64 `json:"location_id" gorm:"not null;default:0;uniqueIndex:uk_location_product_batch;index;comment:库位ID"` // 库位ID
ProductID int64 `json:"product_id" gorm:"not null;default:0;uniqueIndex:uk_location_product_batch;index;comment:商品ID"` ProductID int64 `json:"product_id" gorm:"not null;default:0;uniqueIndex:uk_location_product_batch;index;comment:商品ID"` // 商品ID
BatchNo string `json:"batch_no" gorm:"size:100;not null;default:'';uniqueIndex:uk_location_product_batch;index;comment:批次号"` BatchNo string `json:"batch_no" gorm:"size:100;not null;default:'';uniqueIndex:uk_location_product_batch;index;comment:批次号"` //
ProductionDate int64 `json:"production_date" gorm:"not null;default:0;comment:生产日期时间戳(秒)"` ProductionDate int64 `json:"production_date" gorm:"not null;default:0;comment:生产日期时间戳(秒)"`
ExpiryDate int64 `json:"expiry_date" gorm:"not null;default:0;index;comment:失效日期时间戳(秒)"` ExpiryDate int64 `json:"expiry_date" gorm:"not null;default:0;index;comment:失效日期时间戳(秒)"`
Quantity int64 `json:"quantity" gorm:"not null;default:0;comment:当前数量(最小单位)"` Quantity int64 `json:"quantity" gorm:"not null;default:0;comment:当前数量(最小单位)"`

View File

@ -2,8 +2,8 @@ package request
// LoginRequest 登录请求 // LoginRequest 登录请求
type LoginRequest struct { type LoginRequest struct {
Username string `form:"username" binding:"required"` Username string `form:"username" binding:"required"` // 用户名
Password string `form:"password" binding:"required"` Password string `form:"password" binding:"required"` // 密码
AboutID int64 `form:"about_id"` // 租户ID从ERP关联 AboutID int64 `form:"about_id"` // 租户ID从ERP关联
Type int64 `form:"type"` // 类型 1web 2pda Type int64 `form:"type"` // 类型 1web 2pda
Code string `form:"code"` // 机械码 Code string `form:"code"` // 机械码
@ -11,54 +11,54 @@ type LoginRequest struct {
// GetEmployeeListRequest 获取员工列表请求 // GetEmployeeListRequest 获取员工列表请求
type GetEmployeeListRequest struct { type GetEmployeeListRequest struct {
Page int `form:"page"` Page int `form:"page"` // 页码
PageSize int `form:"page_size"` PageSize int `form:"page_size"` // 页大小
Fid int64 `form:"fid"` Fid int64 `form:"fid"` // 仓库ID
Status string `form:"status"` Status string `form:"status"` // 状态
Keyword string `form:"keyword"` Keyword string `form:"keyword"` // 关键词
} }
// AddEmployeeRequest 添加员工请求 // AddEmployeeRequest 添加员工请求
type AddEmployeeRequest struct { type AddEmployeeRequest struct {
Name string `form:"name" binding:"required"` Name string `form:"name" binding:"required"` // 员工姓名
UserName string `form:"username"` UserName string `form:"username"` // 员工用户名
AboutId int64 `form:"about_id"` AboutId int64 `form:"about_id"` // 租户ID
Fid int64 `form:"fid"` Fid int64 `form:"fid"` // 仓库ID
Phone string `form:"phone"` Phone string `form:"phone"` // 手机号
Password string `form:"password" binding:"required,min=6"` Password string `form:"password" binding:"required,min=6"` // 密码
From string `form:"from"` From string `form:"from"` // 来源
ExpireTime int64 `form:"expire_time"` ExpireTime int64 `form:"expire_time"` // 过期时间
} }
// UpdatePasswordEmployeeRequest 修改员工密码请求 // UpdatePasswordEmployeeRequest 修改员工密码请求
type UpdatePasswordEmployeeRequest struct { type UpdatePasswordEmployeeRequest struct {
Id int64 `form:"id" binding:"required"` Id int64 `form:"id" binding:"required"` // 员工ID
AboutId int64 `form:"about_id"` AboutId int64 `form:"about_id"` // 租户ID
Password string `form:"password" binding:"required,min=6"` Password string `form:"password" binding:"required,min=6"` // 密码
} }
// UpdateExpireTimeEmployeeRequest 修改员工过期时间请求 // UpdateExpireTimeEmployeeRequest 修改员工过期时间请求
type UpdateExpireTimeEmployeeRequest struct { type UpdateExpireTimeEmployeeRequest struct {
Id int64 `form:"id" binding:"required"` Id int64 `form:"id" binding:"required"` // 员工ID
AboutId int64 `form:"about_id"` AboutId int64 `form:"about_id"` // 租户ID
ExpireTime int64 `form:"expire_time" binding:"required"` ExpireTime int64 `form:"expire_time" binding:"required"` // 过期时间
} }
// CheckCodeEmployeeRequest 校验员工机械码 // CheckCodeEmployeeRequest 校验员工机械码
type CheckCodeEmployeeRequest struct { type CheckCodeEmployeeRequest struct {
UserName string `form:"username" binding:"required"` UserName string `form:"username" binding:"required"` // 员工用户名
} }
// ClearCodeEmployeeRequest 清除员工机械码请求 // ClearCodeEmployeeRequest 清除员工机械码请求
type ClearCodeEmployeeRequest struct { type ClearCodeEmployeeRequest struct {
UserName string `form:"username" binding:"required"` UserName string `form:"username" binding:"required"` // 员工用户名
} }
// SetEmployeeLevelRequest 设置员工等级 // SetEmployeeLevelRequest 设置员工等级
type SetEmployeeLevelRequest struct { type SetEmployeeLevelRequest struct {
EmpId int64 `form:"emp_id" binding:"required"` EmpId int64 `form:"emp_id" binding:"required"` // 员工ID
Level int8 `form:"level" binding:"required,min=1,max=5"` // 等级(1-5) Level int8 `form:"level" binding:"required,min=1,max=5"` // 等级(1-5)
PayTime int64 `form:"pay_time" binding:"required"` PayTime int64 `form:"pay_time" binding:"required"` // 支付时间
OperationType int8 `form:"operation_type" binding:"required,oneof=1 2 3"` // 操作类型(1:开通,2:升级,3:续费) OperationType int8 `form:"operation_type" binding:"required,oneof=1 2 3"` // 操作类型(1:开通,2:升级,3:续费)
Duration int64 `form:"duration" binding:"required,min=1"` // 时长(月数)按30天/月计算 Duration int64 `form:"duration" binding:"required,min=1"` // 时长(月数)按30天/月计算
} }
@ -84,6 +84,6 @@ type GetUserListRequest struct {
// UpdateEmployeeSplitAccountConfigRequest 根据about_id更新员工分账配置请求 // UpdateEmployeeSplitAccountConfigRequest 根据about_id更新员工分账配置请求
type UpdateEmployeeSplitAccountConfigRequest struct { type UpdateEmployeeSplitAccountConfigRequest struct {
AboutId int64 `form:"about_id" binding:"required"` AboutId int64 `form:"about_id" binding:"required"` // 租户ID
SplitAccountConfigId int64 `form:"split_account_config_id" binding:"required"` SplitAccountConfigId int64 `form:"split_account_config_id" binding:"required"` // 员工分账配置ID
} }

View File

@ -1,5 +1,5 @@
package request package request
type BarcodeRequest struct { type BarcodeRequest struct {
Content string `form:"content" binding:"required"` Content string `form:"content" binding:"required"` // 条码内容
} }

View File

@ -1,32 +1,33 @@
package request package request
type QueryCarRequest struct { type QueryCarRequest struct {
Keyword string `form:"keyword"` Keyword string `form:"keyword"` // 搜索关键字
Page int `form:"page,default=1"` Page int `form:"page,default=1"` // 页码
PageSize int `form:"page_size,default=10"` PageSize int `form:"page_size,default=10"` // 每页数量
} }
type CreateCarRequest struct { type CreateCarRequest struct {
WarehouseID int64 `form:"warehouse_id" binding:"required"` WarehouseID int64 `form:"warehouse_id" binding:"required"` // 仓库ID
PushType int8 `form:"push_type" binding:"required"` PushType int8 `form:"push_type" binding:"required"` // 推送类型
ReleaseType int8 `form:"release_type" binding:"required"` ReleaseType int8 `form:"release_type" binding:"required"` // 发布类型
Code int64 `form:"code" binding:"required"` Code int64 `form:"code" binding:"required"` // 小车编号
Name string `form:"name" binding:"required,max=50"` Name string `form:"name" binding:"required,max=50"` // 小车名称
Capacity int64 `form:"capacity" binding:"required"` Capacity int64 `form:"capacity" binding:"required"` // 容量
Appearance int64 `form:"appearance" binding:"required"` Appearance int64 `form:"appearance" binding:"required"` // 品相
ShopInfo []map[string]interface{} `form:"shop_info[]"` ShopInfo []map[string]interface{} `form:"shop_info[]"` // 店铺信息
} }
type UpdateCarRequest struct { type UpdateCarRequest struct {
PushType *int8 `form:"push_type" binding:"required"` PushType *int8 `form:"push_type" binding:"required"` // 推送类型
ReleaseType *int8 `form:"release_type" binding:"required"` ReleaseType *int8 `form:"release_type" binding:"required"` // 发布类型
ID int64 `form:"id" binding:"required"` ID int64 `form:"id" binding:"required"` // 小车ID
Name string `form:"name" binding:"omitempty,max=50"` Name string `form:"name" binding:"omitempty,max=50"` // 小车名称
Capacity *int64 `form:"capacity" binding:"required"` Capacity *int64 `form:"capacity" binding:"required"` // 容量
Appearance *int64 `form:"appearance" binding:"required"` Appearance *int64 `form:"appearance" binding:"required"` // 品
ShopInfo []map[string]interface{} `form:"shop_info[]"` Code *int64 `form:"code" binding:"required"` // 小车编号
ShopInfo []map[string]interface{} `form:"shop_info[]"` // 店铺信息
} }
type DeleteCarRequest struct { type DeleteCarRequest struct {
ID int64 `form:"id" binding:"required"` ID int64 `form:"id" binding:"required"` // 小车ID
} }

View File

@ -2,25 +2,25 @@ package request
// GetConfigListRequest 获取配置列表请求 // GetConfigListRequest 获取配置列表请求
type GetConfigListRequest struct { type GetConfigListRequest struct {
Page int `form:"page"` Page int `form:"page"` // 页码
PageSize int `form:"page_size"` PageSize int `form:"page_size"` // 页大小
Keyword string `form:"keyword"` Keyword string `form:"keyword"` // 关键字
} }
// AddConfigRequest 添加配置请求 // AddConfigRequest 添加配置请求
type AddConfigRequest struct { type AddConfigRequest struct {
Key string `form:"key" binding:"required"` Key string `form:"key" binding:"required"` // 配置键
Value string `form:"value" binding:"required"` Value string `form:"value" binding:"required"` // 配置值
} }
// UpdateConfigRequest 更新配置请求 // UpdateConfigRequest 更新配置请求
type UpdateConfigRequest struct { type UpdateConfigRequest struct {
ID int64 `form:"id" binding:"required"` ID int64 `form:"id" binding:"required"` // 配置ID
Key string `form:"key"` Key string `form:"key"` // 配置键
Value string `form:"value"` Value string `form:"value"` // 配置值
} }
// DeleteConfigRequest 删除配置请求 // DeleteConfigRequest 删除配置请求
type DeleteConfigRequest struct { type DeleteConfigRequest struct {
ID int64 `form:"id" binding:"required"` ID int64 `form:"id" binding:"required"` // 配置ID
} }

View File

@ -4,11 +4,11 @@ import "psi/models"
// GetEmployeeSettingsRequest 获取员工设置请求 // GetEmployeeSettingsRequest 获取员工设置请求
type GetEmployeeSettingsRequest struct { type GetEmployeeSettingsRequest struct {
EmpId int64 `form:"emp_id"` EmpId int64 `form:"emp_id"` // 员工ID
} }
// SaveEmployeeSettingsRequest 保存员工设置请求 // SaveEmployeeSettingsRequest 保存员工设置请求
type SaveEmployeeSettingsRequest struct { type SaveEmployeeSettingsRequest struct {
EmpId int64 `form:"emp_id"` EmpId int64 `form:"emp_id"` // 员工ID
models.EmployeeSettingsConfig models.EmployeeSettingsConfig // 员工设置
} }

View File

@ -2,60 +2,60 @@ package request
// GetInventoryListRequest 获取库存汇总列表请求 // GetInventoryListRequest 获取库存汇总列表请求
type GetInventoryListRequest struct { type GetInventoryListRequest struct {
Page int `form:"page"` Page int `form:"page"` // 页码
PageSize int `form:"page_size"` PageSize int `form:"page_size"` // 分页大小
ProductId int64 `form:"product_id"` ProductId int64 `form:"product_id"` // 商品ID
WarehouseID int64 `form:"warehouse_id"` WarehouseID int64 `form:"warehouse_id"` // 仓库ID
ISBN string `form:"isbn"` ISBN string `form:"isbn"` // ISBN
Name string `form:"name"` Name string `form:"name"` // 商品名称
} }
// GetInventoryGroupedListRequest 获取按仓库库位分组的库存列表请求 // GetInventoryGroupedListRequest 获取按仓库库位分组的库存列表请求
type GetInventoryGroupedListRequest struct { type GetInventoryGroupedListRequest struct {
Page int `form:"page"` Page int `form:"page"` // 页码
PageSize int `form:"page_size"` PageSize int `form:"page_size"` // 分页大小
ProductId int64 `form:"product_id"` ProductId int64 `form:"product_id"` // 商品ID
WarehouseID int64 `form:"warehouse_id"` WarehouseID int64 `form:"warehouse_id"` // 仓库ID
} }
// GetInventoryDetailRequest 获取库存明细请求 // GetInventoryDetailRequest 获取库存明细请求
type GetInventoryDetailRequest struct { type GetInventoryDetailRequest struct {
ProductID int64 `form:"product_id" binding:"required"` ProductID int64 `form:"product_id" binding:"required"` // 商品ID
} }
// GetInventoryLogListRequest 获取库存流水列表请求 // GetInventoryLogListRequest 获取库存流水列表请求
type GetInventoryLogListRequest struct { type GetInventoryLogListRequest struct {
Page int `form:"page"` Page int `form:"page"` // 页码
PageSize int `form:"page_size"` PageSize int `form:"page_size"` // 分页大小
ISBN string `form:"isbn"` ISBN string `form:"isbn"` // ISBN
BookName string `form:"book_name"` BookName string `form:"book_name"` // 图书名称
WarehouseID int64 `form:"warehouse_id"` WarehouseID int64 `form:"warehouse_id"` // 仓库ID
ChangeType int8 `form:"change_type"` ChangeType int8 `form:"change_type"` // 库存流水类型
RelatedOrderNo string `form:"related_order_no"` RelatedOrderNo string `form:"related_order_no"` // 关联订单号
StartDate int64 `form:"start_date"` StartDate int64 `form:"start_date"` // 开始时间
EndDate int64 `form:"end_date"` EndDate int64 `form:"end_date"` // 结束时间
} }
// InventoryStatistRequest 获取条码/品相库存总数请求 // InventoryStatistRequest 获取条码/品相库存总数请求
type InventoryStatistRequest struct { type InventoryStatistRequest struct {
Barcode string `form:"barcode"` Barcode string `form:"barcode"` // 条码
Appearance int64 `form:"appearance"` Appearance int64 `form:"appearance"` // 品相
} }
// GetStockCheckListRequest 获取盘库列表请求 // GetStockCheckListRequest 获取盘库列表请求
type GetStockCheckListRequest struct { type GetStockCheckListRequest struct {
Page int `form:"page"` Page int `form:"page"` // 页码
PageSize int `form:"page_size"` PageSize int `form:"page_size"` // 分页大小
WarehouseID int64 `form:"warehouse_id"` WarehouseID int64 `form:"warehouse_id"` // 仓库ID
Status int8 `form:"status"` Status int8 `form:"status"` // 盘库状态
CheckNo string `form:"check_no"` CheckNo string `form:"check_no"` // 盘库编号
StartDate int64 `form:"start_date"` StartDate int64 `form:"start_date"` // 开始时间
EndDate int64 `form:"end_date"` EndDate int64 `form:"end_date"` // 结束时间
} }
// GetStockCheckDetailRequest 获取盘库明细列表请求 // GetStockCheckDetailRequest 获取盘库明细列表请求
type GetStockCheckDetailRequest struct { type GetStockCheckDetailRequest struct {
Page int `form:"page"` Page int `form:"page"` // 页码
PageSize int `form:"page_size"` PageSize int `form:"page_size"` // 分页大小
StockCheckID int64 `form:"stock_check_id" binding:"required"` StockCheckID int64 `form:"stock_check_id" binding:"required"` // 盘库ID
} }

View File

@ -3,10 +3,10 @@ package response
import "psi/models" import "psi/models"
type CarShopInfo struct { type CarShopInfo struct {
ShopID string `json:"id"` ShopID string `json:"id"` // 店铺ID
ShopName string `json:"shop_name"` ShopName string `json:"shop_name"` //店铺名称
ShopType int8 `json:"shop_type"` ShopType int8 `json:"shop_type"` //店铺类型
ShopTypeText string `json:"shop_type_text"` ShopTypeText string `json:"shop_type_text"` //店铺类型文本
} }
type CarResponse struct { type CarResponse struct {
ID int64 `json:"id"` ID int64 `json:"id"`

View File

@ -4,28 +4,28 @@ import "psi/models"
// ConfigListResponse 配置列表响应 // ConfigListResponse 配置列表响应
type ConfigListResponse struct { type ConfigListResponse struct {
List []ConfigItem `json:"list"` List []ConfigItem `json:"list"` // 列表
Total int64 `json:"total"` Total int64 `json:"total"` // 总数
Page int `json:"page"` Page int `json:"page"` // 当前页
PageSize int `json:"pageSize"` PageSize int `json:"pageSize"` // 每页数量
} }
// ConfigItem 配置列表项 // ConfigItem 配置列表项
type ConfigItem struct { type ConfigItem struct {
ID int64 `json:"id"` ID int64 `json:"id"` // ID
Key string `json:"key"` Key string `json:"key"` // 键
Value string `json:"value"` Value string `json:"value"` // 值
CreatedAt int64 `json:"created_at"` CreatedAt int64 `json:"created_at"` // 创建时间
UpdatedAt int64 `json:"updated_at"` UpdatedAt int64 `json:"updated_at"` // 更新时间
} }
// ConvertConfigToItem 将配置模型转换为响应项 // ConvertConfigToItem 将配置模型转换为响应项
func ConvertConfigToItem(config models.Config) ConfigItem { func ConvertConfigToItem(config models.Config) ConfigItem {
return ConfigItem{ return ConfigItem{
ID: config.ID, ID: config.ID, // ID
Key: config.Key, Key: config.Key, // 键
Value: config.Value, Value: config.Value, // 值
CreatedAt: config.CreatedAt, CreatedAt: config.CreatedAt, // 创建时间
UpdatedAt: config.UpdatedAt, UpdatedAt: config.UpdatedAt, // 更新时间
} }
} }

View File

@ -6,75 +6,75 @@ import (
// InventoryListResponse 库存汇总列表响应 // InventoryListResponse 库存汇总列表响应
type InventoryListResponse struct { type InventoryListResponse struct {
List []InventoryItem `json:"list"` List []InventoryItem `json:"list"` //库汇总项
Total int64 `json:"total"` Total int64 `json:"total"` //总数
Page int `json:"page"` Page int `json:"page"` //页码
PageSize int `json:"pageSize"` PageSize int `json:"pageSize"` //每页数量
} }
// InventoryItem 库存汇总项 // InventoryItem 库存汇总项
type InventoryItem struct { type InventoryItem struct {
ProductID int64 `json:"product_id"` ProductID int64 `json:"product_id"` //商品ID
ProductName string `json:"product_name"` ProductName string `json:"product_name"` //商品名称
Appearance int64 `json:"appearance"` Appearance int64 `json:"appearance"` //封面
Barcode string `json:"barcode"` Barcode string `json:"barcode"` //条码
Price int64 `json:"price"` Price int64 `json:"price"` // 价格
WarehouseID int64 `json:"warehouse_id"` WarehouseID int64 `json:"warehouse_id"` //仓库ID
WarehouseName string `json:"warehouse_name"` WarehouseName string `json:"warehouse_name"` //仓库名称
WarehouseCode string `json:"warehouse_code"` WarehouseCode string `json:"warehouse_code"` //仓库编码
LocationCode string `json:"location_code"` LocationCode string `json:"location_code"` //库位编码
TotalQuantity int64 `json:"total_quantity"` TotalQuantity int64 `json:"total_quantity"` //总数量
LockedQuantity int64 `json:"locked_quantity"` LockedQuantity int64 `json:"locked_quantity"` //锁定数量
} }
// InventoryGroupedListResponse 按仓库库位分组的库存列表响应 // InventoryGroupedListResponse 按仓库库位分组的库存列表响应
type InventoryGroupedListResponse struct { type InventoryGroupedListResponse struct {
List []InventoryGroupItem `json:"list"` List []InventoryGroupItem `json:"list"` //库汇总项
Total int64 `json:"total"` Total int64 `json:"total"` //总数
Page int `json:"page"` Page int `json:"page"` //页码
PageSize int `json:"pageSize"` PageSize int `json:"pageSize"` //每页数量
} }
// InventoryGroupItem 仓库库位分组项(父级) // InventoryGroupItem 仓库库位分组项(父级)
type InventoryGroupItem struct { type InventoryGroupItem struct {
WarehouseID int64 `json:"warehouse_id"` WarehouseID int64 `json:"warehouse_id"` //仓库ID
WarehouseName string `json:"warehouse_name"` WarehouseName string `json:"warehouse_name"` //仓库名称
WarehouseCode string `json:"warehouse_code"` WarehouseCode string `json:"warehouse_code"` //仓库编码
LocationID int64 `json:"location_id"` LocationID int64 `json:"location_id"` //库位ID
LocationCode string `json:"location_code"` LocationCode string `json:"location_code"` //库位编码
TotalQuantity int64 `json:"total_quantity"` TotalQuantity int64 `json:"total_quantity"` //总数量
LockedQuantity int64 `json:"locked_quantity"` LockedQuantity int64 `json:"locked_quantity"` //锁定数量
ItemCount int `json:"item_count"` ItemCount int `json:"item_count"` //子项数量
Details []InventoryDetailItem `json:"details"` Details []InventoryDetailItem `json:"details"` //库明细项
} }
// InventoryDetailResponse 库存明细响应 // InventoryDetailResponse 库存明细响应
type InventoryDetailResponse struct { type InventoryDetailResponse struct {
ProductID int64 `json:"product_id"` ProductID int64 `json:"product_id"` //商品ID
ProductName string `json:"product_name"` ProductName string `json:"product_name"` //商品名称
List []InventoryDetailItem `json:"list"` List []InventoryDetailItem `json:"list"` //库明细项
Total int64 `json:"total"` Total int64 `json:"total"` //总数量
} }
// InventoryDetailItem 库存明细项 // InventoryDetailItem 库存明细项
type InventoryDetailItem struct { type InventoryDetailItem struct {
ID int64 `json:"id"` ID int64 `json:"id"` //库明细项ID
WarehouseID int64 `json:"warehouse_id"` WarehouseID int64 `json:"warehouse_id"` //仓库ID
WarehouseName string `json:"warehouse_name"` WarehouseName string `json:"warehouse_name"` //仓库名称
LocationID int64 `json:"location_id"` LocationID int64 `json:"location_id"` //库位ID
LocationCode string `json:"location_code"` LocationCode string `json:"location_code"` //库位编码
BatchNo string `json:"batch_no"` BatchNo string `json:"batch_no"` //批次号
ProductionDate int64 `json:"production_date"` ProductionDate int64 `json:"production_date"` //生产日期
ExpiryDate int64 `json:"expiry_date"` ExpiryDate int64 `json:"expiry_date"` //过期日期
Quantity int64 `json:"quantity"` Quantity int64 `json:"quantity"` // 数量
LockedQuantity int64 `json:"locked_quantity"` LockedQuantity int64 `json:"locked_quantity"` //锁定数量
CreatedAt int64 `json:"created_at"` CreatedAt int64 `json:"created_at"` //创建时间戳(秒)
UpdatedAt int64 `json:"updated_at"` UpdatedAt int64 `json:"updated_at"` //更新时间戳(秒)
ProductID int64 `json:"product_id"` ProductID int64 `json:"product_id"` //商品ID
ProductName string `json:"product_name"` ProductName string `json:"product_name"` //商品名称
Barcode string `json:"barcode"` Barcode string `json:"barcode"` //条码
Appearance int64 `json:"appearance"` Appearance int64 `json:"appearance"` //封面
SalePrice int64 `json:"sale_price"` SalePrice int64 `json:"sale_price"` //销售价格
WaveNo string `json:"wave_no"` // 波次编号 WaveNo string `json:"wave_no"` // 波次编号
WaveTaskNo string `json:"wave_task_no"` // 波次任务编号 WaveTaskNo string `json:"wave_task_no"` // 波次任务编号
OutTaskNo int64 `json:"out_task_no"` // 出库任务编号 OutTaskNo int64 `json:"out_task_no"` // 出库任务编号
@ -84,103 +84,103 @@ type InventoryDetailItem struct {
// InventoryLogListResponse 库存流水列表响应 // InventoryLogListResponse 库存流水列表响应
type InventoryLogListResponse struct { type InventoryLogListResponse struct {
List []InventoryLogItem `json:"list"` List []InventoryLogItem `json:"list"` //库流水项
Total int64 `json:"total"` Total int64 `json:"total"` //总数
Page int `json:"page"` Page int `json:"page"` //页码
PageSize int `json:"pageSize"` PageSize int `json:"pageSize"` //每页数量
} }
// InventoryLogItem 库存流水项 // InventoryLogItem 库存流水项
type InventoryLogItem struct { type InventoryLogItem struct {
ID int64 `json:"id"` ID int64 `json:"id"` //库流水项ID
WarehouseID int64 `json:"warehouse_id"` WarehouseID int64 `json:"warehouse_id"` //仓库ID
WarehouseName string `json:"warehouse_name"` WarehouseName string `json:"warehouse_name"` //仓库名称
LocationID int64 `json:"location_id"` LocationID int64 `json:"location_id"` //库位ID
LocationCode string `json:"location_code"` LocationCode string `json:"location_code"` //库位编码
ProductID int64 `json:"product_id"` ProductID int64 `json:"product_id"` //商品ID
ProductName string `json:"product_name"` ProductName string `json:"product_name"` //商品名称
Barcode string `json:"barcode"` Barcode string `json:"barcode"` //条码
BatchNo string `json:"batch_no"` BatchNo string `json:"batch_no"` //批次号
ChangeType int8 `json:"change_type"` ChangeType int8 `json:"change_type"` //变更类型
ChangeTypeText string `json:"change_type_text"` ChangeTypeText string `json:"change_type_text"` //变更类型文本
ChangeQuantity int64 `json:"change_quantity"` ChangeQuantity int64 `json:"change_quantity"` //变更数量
BeforeQuantity int64 `json:"before_quantity"` BeforeQuantity int64 `json:"before_quantity"` //变更前数量
AfterQuantity int64 `json:"after_quantity"` AfterQuantity int64 `json:"after_quantity"` //变更后数量
RelatedOrderType string `json:"related_order_type"` RelatedOrderType string `json:"related_order_type"` //关联订单类型
RelatedOrderNo string `json:"related_order_no"` RelatedOrderNo string `json:"related_order_no"` //关联订单编号
Operator string `json:"operator"` Operator string `json:"operator"` //操作人
OperatorID int64 `json:"operator_id"` OperatorID int64 `json:"operator_id"` //操作人ID
Remark string `json:"remark"` Remark string `json:"remark"` //备注
CreatedAt int64 `json:"created_at"` CreatedAt int64 `json:"created_at"` //创建时间戳(秒)
} }
// InventoryStatistResponse ISBN/书名库存总数响应 // InventoryStatistResponse ISBN/书名库存总数响应
type InventoryStatistResponse struct { type InventoryStatistResponse struct {
Barcode string `json:"barcode"` Barcode string `json:"barcode"` //条码
Appearance int64 `json:"appearance"` Appearance int64 `json:"appearance"` //封面
TotalQuantity int64 `json:"total_quantity"` TotalQuantity int64 `json:"total_quantity"` //总数量
ProductCount int `json:"product_count"` ProductCount int `json:"product_count"` //商品数量
} }
// StockCheckListResponse 盘库列表响应 // StockCheckListResponse 盘库列表响应
type StockCheckListResponse struct { type StockCheckListResponse struct {
List []StockCheckItem `json:"list"` List []StockCheckItem `json:"list"` //盘库项
Total int64 `json:"total"` Total int64 `json:"total"` //总数
Page int `json:"page"` Page int `json:"page"` //页码
PageSize int `json:"pageSize"` PageSize int `json:"pageSize"` //每页数量
} }
// StockCheckItem 盘库项 // StockCheckItem 盘库项
type StockCheckItem struct { type StockCheckItem struct {
ID int64 `json:"id"` ID int64 `json:"id"` //盘库项ID
CheckNo string `json:"check_no"` CheckNo string `json:"check_no"` //盘库编号
WarehouseID int64 `json:"warehouse_id"` WarehouseID int64 `json:"warehouse_id"` //仓库ID
WarehouseName string `json:"warehouse_name"` WarehouseName string `json:"warehouse_name"` //仓库名称
CheckType int8 `json:"check_type"` CheckType int8 `json:"check_type"` //盘库类型
CheckTypeText string `json:"check_type_text"` CheckTypeText string `json:"check_type_text"` //盘库类型文本
Status int8 `json:"status"` Status int8 `json:"status"` //盘库状态
StatusText string `json:"status_text"` StatusText string `json:"status_text"` //盘库状态文本
TotalItems int `json:"total_items"` TotalItems int `json:"total_items"` //总数量
CheckedItems int `json:"checked_items"` CheckedItems int `json:"checked_items"` //已盘数量
TotalQuantity int64 `json:"total_quantity"` TotalQuantity int64 `json:"total_quantity"` //盘库数量
ActualQuantity int64 `json:"actual_quantity"` ActualQuantity int64 `json:"actual_quantity"` //实际盘库数量
Operator string `json:"operator"` Operator string `json:"operator"` //操作人
OperatorID int64 `json:"operator_id"` OperatorID int64 `json:"operator_id"` //操作人ID
Remark string `json:"remark"` Remark string `json:"remark"` //备注
CreatedAt int64 `json:"created_at"` CreatedAt int64 `json:"created_at"` //创建时间戳(秒)
UpdatedAt int64 `json:"updated_at"` UpdatedAt int64 `json:"updated_at"` //更新时间戳(秒)
} }
// StockCheckDetailResponse 盘库明细列表响应 // StockCheckDetailResponse 盘库明细列表响应
type StockCheckDetailResponse struct { type StockCheckDetailResponse struct {
List []StockCheckDetailItem `json:"list"` List []StockCheckDetailItem `json:"list"` //库明细项
Total int64 `json:"total"` Total int64 `json:"total"` //总数量
Page int `json:"page"` Page int `json:"page"` //页码
PageSize int `json:"pageSize"` PageSize int `json:"pageSize"` //每页数量
} }
// StockCheckDetailItem 盘库明细项 // StockCheckDetailItem 盘库明细项
type StockCheckDetailItem struct { type StockCheckDetailItem struct {
ID int64 `json:"id"` ID int64 `json:"id"` //库明细项ID
ProductID int64 `json:"product_id"` ProductID int64 `json:"product_id"` //商品ID
ProductName string `json:"product_name"` ProductName string `json:"product_name"` //商品名称
Barcode string `json:"barcode"` Barcode string `json:"barcode"` //条码
LocationID int64 `json:"location_id"` LocationID int64 `json:"location_id"` //库位ID
LocationCode string `json:"location_code"` LocationCode string `json:"location_code"` //库位编码
BatchNo string `json:"batch_no"` BatchNo string `json:"batch_no"` //批次号
ProductionDate int64 `json:"production_date"` ProductionDate int64 `json:"production_date"` //生产日期
ExpiryDate int64 `json:"expiry_date"` ExpiryDate int64 `json:"expiry_date"` //过期日期
SystemQuantity int64 `json:"system_quantity"` SystemQuantity int64 `json:"system_quantity"` //系统数量
ActualQuantity int64 `json:"actual_quantity"` ActualQuantity int64 `json:"actual_quantity"` //实际盘库数量
DifferenceQuantity int64 `json:"difference_quantity"` DifferenceQuantity int64 `json:"difference_quantity"` //差异数量
Status int8 `json:"status"` Status int8 `json:"status"` //盘库状态
StatusText string `json:"status_text"` StatusText string `json:"status_text"` //盘库状态文本
CheckOperator string `json:"check_operator"` CheckOperator string `json:"check_operator"` //盘库人
CheckOperatorID int64 `json:"check_operator_id"` CheckOperatorID int64 `json:"check_operator_id"` //盘库人ID
CheckTime int64 `json:"check_time"` CheckTime int64 `json:"check_time"` //盘库时间戳(秒)
Remark string `json:"remark"` Remark string `json:"remark"` //备注
CreatedAt int64 `json:"created_at"` CreatedAt int64 `json:"created_at"` //创建时间戳(秒)
UpdatedAt int64 `json:"updated_at"` UpdatedAt int64 `json:"updated_at"` //更新时间戳(秒)
} }
// InventorySummaryResponse 库存统计响应 // InventorySummaryResponse 库存统计响应

View File

@ -8,16 +8,16 @@ import (
) )
type Response struct { type Response struct {
Code int `json:"code"` Code int `json:"code"` // 状态码
Data interface{} `json:"data"` Data interface{} `json:"data"` // 数据
Msg string `json:"msg"` Msg string `json:"msg"` // 消息
} }
// ExternalAPIResponse 外部接口通用响应结构 // ExternalAPIResponse 外部接口通用响应结构
type ExternalAPIResponse struct { type ExternalAPIResponse struct {
Code string `json:"code"` Code string `json:"code"` // 状态码
Msg string `json:"msg"` Msg string `json:"msg"` // 消息
Data interface{} `json:"data"` Data interface{} `json:"data"` // 数据
} }
func Result(code int, data interface{}, msg string, c *gin.Context) { func Result(code int, data interface{}, msg string, c *gin.Context) {

View File

@ -2,25 +2,25 @@ package models
// Warehouse 仓库表 // Warehouse 仓库表
type Warehouse struct { type Warehouse struct {
ID int64 `json:"id" gorm:"primarykey;comment:仓库ID"` ID int64 `json:"id" gorm:"primarykey;comment:仓库ID"` // 仓库ID
LogisticsID int64 `json:"logistics_id" gorm:"not null;default:0;index;comment:所属物流模板ID"` LogisticsID int64 `json:"logistics_id" gorm:"not null;default:0;index;comment:所属物流模板ID"` // 所属物流模板ID
Code string `json:"code" gorm:"size:50;not null;default:'';uniqueIndex:uk_code;comment:仓库编码"` Code string `json:"code" gorm:"size:50;not null;default:'';uniqueIndex:uk_code;comment:仓库编码"` // 仓库编码
Name string `json:"name" gorm:"size:100;not null;default:'';comment:仓库名称"` Name string `json:"name" gorm:"size:100;not null;default:'';comment:仓库名称"` // 仓库名称
Type int8 `json:"type" gorm:"not null;default:1;comment:仓库类型(1:主仓库,2:备用仓库,3:中转仓库)"` Type int8 `json:"type" gorm:"not null;default:1;comment:仓库类型(1:主仓库,2:备用仓库,3:中转仓库)"` // 仓库类型
ContactPerson string `json:"contact_person" gorm:"size:50;default:'';comment:联系人"` ContactPerson string `json:"contact_person" gorm:"size:50;default:'';comment:联系人"` // 联系人
ContactPhone string `json:"contact_phone" gorm:"size:20;default:'';comment:联系电话"` ContactPhone string `json:"contact_phone" gorm:"size:20;default:'';comment:联系电话"` // 联系电话
Province string `json:"province" gorm:"size:50;default:'';comment:省份"` Province string `json:"province" gorm:"size:50;default:'';comment:省份"` // 省份
City string `json:"city" gorm:"size:50;default:'';comment:城市"` City string `json:"city" gorm:"size:50;default:'';comment:城市"` // 城市
District string `json:"district" gorm:"size:50;default:'';comment:区县"` District string `json:"district" gorm:"size:50;default:'';comment:区县"` // 区县
Address string `json:"address" gorm:"size:255;not null;default:'';comment:仓库地址"` Address string `json:"address" gorm:"size:255;not null;default:'';comment:仓库地址"` // 仓库地址
Status int8 `json:"status" gorm:"type:tinyint(1);not null;default:1;comment:状态(0:禁用,1:启用)"` Status int8 `json:"status" gorm:"type:tinyint(1);not null;default:1;comment:状态(0:禁用,1:启用)"` // 状态
CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳(秒)"` CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳(秒)"` // 创建时间戳(秒)
UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳(秒)"` UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳(秒)"` // 更新时间戳(秒)
IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` // 逻辑删除标记(0:未删除,1:已删除)
} }
func (Warehouse) TableName() string { func (Warehouse) TableName() string {
return "warehouse" return "warehouse" // 表名
} }
func (Warehouse) TableOptions() string { func (Warehouse) TableOptions() string {

View File

@ -16,6 +16,7 @@ import (
type CancelLogisticsService struct{} type CancelLogisticsService struct{}
// CancelLogisticsResponse 取消物流接口返回 // CancelLogisticsResponse 取消物流接口返回
// 响应格式
type CancelLogisticsResponse struct { type CancelLogisticsResponse struct {
Msg string `json:"msg"` Msg string `json:"msg"`
Code string `json:"code"` Code string `json:"code"`
@ -24,6 +25,7 @@ type CancelLogisticsResponse struct {
// CancelLogistics 取消物流单号 // CancelLogistics 取消物流单号
func (s *CancelLogisticsService) CancelLogistics(userID int64, logisticsNo string) (*CancelLogisticsResponse, error) { func (s *CancelLogisticsService) CancelLogistics(userID int64, logisticsNo string) (*CancelLogisticsResponse, error) {
// 1. 调用外部接口取消物流单号 // 1. 调用外部接口取消物流单号
//定义字节流变量
var buf bytes.Buffer var buf bytes.Buffer
w := multipart.NewWriter(&buf) w := multipart.NewWriter(&buf)
if err := w.WriteField("mailNo", logisticsNo); err != nil { if err := w.WriteField("mailNo", logisticsNo); err != nil {