diff --git a/controllers/barcode.go b/controllers/barcode.go index b70ac4e..4dde75f 100644 --- a/controllers/barcode.go +++ b/controllers/barcode.go @@ -20,10 +20,11 @@ func (r *BarcodeApi) GenerateBarcode(c *gin.Context) { var req systemReq.BarcodeRequest // 参数绑定 if err := c.ShouldBind(&req); err != nil { + // 参数校验失败 ValidAndFail(constant.LoggerChannelRequest, "条形码生成请求参数异常", "参数错误: "+err.Error(), c, err) return } - + // 业务处理 result, err := barcodeService.GenerateBarcode(req.Content) if err != nil { utils.FailWithRequestLog(constant.LoggerChannelWork, "条形码生成异常", err, c, req) diff --git a/controllers/book.go b/controllers/book.go index 3e94be9..731913e 100644 --- a/controllers/book.go +++ b/controllers/book.go @@ -12,17 +12,18 @@ import ( type BookApi struct{} +// SyncBook 同步书籍信息 var bookService = service.BookService{} // GetBookInfo 获取图书信息 func (r *BookApi) GetBookInfo(c *gin.Context) { - + // 参数校验 var req systemReq.BookRequest if err := c.ShouldBindQuery(&req); err != nil { ValidAndFail(constant.LoggerChannelRequest, "获取图书信息请求参数异常", "参数错误: "+err.Error(), c, err) return } - + // 业务处理 result, err := bookService.GetBookInfo(req) if err != nil { utils.FailWithRequestLog(constant.LoggerChannelWork, "获取图书信息异常", err, c, req) @@ -37,6 +38,7 @@ func (r *BookApi) GetBookInfo(c *gin.Context) { // GetSuitBook 获取套装书 func (r *BookApi) GetSuitBook(c *gin.Context) { + var req systemReq.BookRequest if err := c.ShouldBindQuery(&req); err != nil { ValidAndFail(constant.LoggerChannelRequest, "获取套装书请求参数异常", "参数错误: "+err.Error(), c, err) @@ -115,6 +117,7 @@ func (r *BookApi) SyncBook(c *gin.Context) { bookID, result, err := bookService.SyncBook(req) if err != nil { + // 记录日志 utils.FailWithRequestLog(constant.LoggerChannelWork, "同步书籍信息异常", err, c, req) return } diff --git a/controllers/cancel_logistics.go b/controllers/cancel_logistics.go index aad3349..b429eb5 100644 --- a/controllers/cancel_logistics.go +++ b/controllers/cancel_logistics.go @@ -9,8 +9,10 @@ import ( "psi/utils" ) +// CancelLogisticsApi 删除物流单号 定义一个结构体 type CancelLogisticsApi struct{} +// cancelLogisticsService 删除物流单号服务 声明一个变量 var cancelLogisticsService = service.CancelLogisticsService{} // CancelLogistics 取消物流单号 diff --git a/controllers/car.go b/controllers/car.go index afd56a7..a895cf3 100644 --- a/controllers/car.go +++ b/controllers/car.go @@ -76,13 +76,14 @@ func (r *CarApi) GetCarDetail(c *gin.Context) { systemRes.OkWithDetailed(car, "查询成功", c) } +// CreateCar 创建小车 func (r *CarApi) CreateCar(c *gin.Context) { var req systemReq.CreateCarRequest if err := c.ShouldBind(&req); err != nil { ValidAndFail(constant.LoggerChannelRequest, "创建小车请求参数异常", "参数错误: "+err.Error(), c, err) return } - + // 处理shop_info参数 if len(req.ShopInfo) == 0 { info, err := parseInfo(c) if err != nil { @@ -91,7 +92,7 @@ func (r *CarApi) CreateCar(c *gin.Context) { } req.ShopInfo = info } - + // 处理warehouse_info参数 userInfo := utils.GetUserInfo(c) id, err := carService.CreateCar(req, userInfo.ID, database.GetDB(c)) if err != nil { diff --git a/controllers/config.go b/controllers/config.go index 858ffb8..ce50768 100644 --- a/controllers/config.go +++ b/controllers/config.go @@ -12,7 +12,7 @@ import ( "psi/utils" ) -type ConfigApi struct{} +type ConfigApi struct{} //ConfigApi结构体 var configService = service.ConfigService{} diff --git a/controllers/employee.go b/controllers/employee.go index 48d8e7c..aac355f 100644 --- a/controllers/employee.go +++ b/controllers/employee.go @@ -62,14 +62,14 @@ func (r *EmployeeApi) GetCurrentUser(c *gin.Context) { } systemRes.OkWithDetailed(gin.H{ - "type": "admin", - "id": employeeInfo.ID, - "employee_id_str": employeeInfo.EmployeeIDStr, - "username": employeeInfo.Username, - "name": employeeInfo.Name, - "role": employeeInfo.Role, - "points": employeeInfo.Score, - "status": employeeInfo.Status, + "type": "admin", // 255-admin, 128-employee + "id": employeeInfo.ID, // 员工ID + "employee_id_str": employeeInfo.EmployeeIDStr, // 员工编号 + "username": employeeInfo.Username, // 用户名 + "name": employeeInfo.Name, // 姓名 + "role": employeeInfo.Role, // 角色 + "points": employeeInfo.Score, // 积分 + "status": employeeInfo.Status, // 状态 }, "获取成功", c) } diff --git a/models/car.go b/models/car.go index b0bb0f8..691107f 100644 --- a/models/car.go +++ b/models/car.go @@ -2,17 +2,17 @@ package models // Car 小车表 type Car struct { - ID int64 `json:"id" gorm:"primarykey;comment:小车ID"` - WarehouseID int64 `json:"warehouse_id" gorm:"not null;default:0;index;comment:所属仓库ID"` - 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:合并库存)"` - Code int64 `json:"code" gorm:"not null;default:0;comment:小车编号"` - Name string `json:"name" gorm:"size:50;not null;default:'';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:品相"` - 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:更新时间戳(秒)"` - IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` + ID int64 `json:"id" gorm:"primarykey;comment:小车ID"` // 小车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:入库后在上架)"` // 推送类型 + 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:小车编号"` // 小车编号 + Name string `json:"name" gorm:"size:50;not null;default:'';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:品相"` // 品相 + 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:更新时间戳(秒)"` // 更新时间戳(秒) + IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` // 逻辑删除标记(0:未删除,1:已删除) } func (Car) TableName() string { diff --git a/models/car_shop.go b/models/car_shop.go index 32b4da2..e60fb4d 100644 --- a/models/car_shop.go +++ b/models/car_shop.go @@ -2,21 +2,21 @@ package models // CarShop 小车店铺关联表 type CarShop struct { - ID int64 `json:"id" gorm:"primarykey;comment:关联ID"` - CarID int64 `json:"car_id" gorm:"not null;default:0;comment:小车id"` - ShopID int64 `json:"shop_id" gorm:"not null;default:0;comment:店铺id"` - 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:店铺类型"` - ClientID string `json:"client_id" gorm:"size:50;not null;comment:客户端id"` - AppKey string `json:"app_key" gorm:"size:255;not null;default:'';comment:app_key"` - AppSecret string `json:"app_secret" gorm:"size:255;not null;default:'';comment:app_secret"` - 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:更新时间戳(秒)"` - IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` + ID int64 `json:"id" gorm:"primarykey;comment:关联ID"` // 关联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"` // 店铺id + 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:店铺类型"` // 店铺类型 + 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"` // app_key + 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:创建时间戳(秒)"` // 创建时间戳(秒) + 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:已删除)"` // 逻辑删除标记(0:未删除,1:已删除) } func (CarShop) TableName() string { - return "car_shop" + return "car_shop" // 表名 } func (CarShop) TableOptions() string { diff --git a/models/config.go b/models/config.go index 505250a..4392163 100644 --- a/models/config.go +++ b/models/config.go @@ -2,12 +2,12 @@ package models // Config 配置表 type Config struct { - ID int64 `json:"id" gorm:"primarykey;comment:配置ID"` - Key string `json:"key" gorm:"size:200;not null;default:'';uniqueIndex:uk_key;comment:配置键"` - Value string `json:"value" gorm:"type:text;comment:配置值"` - CreatedAt int64 `json:"created_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:已删除)"` + ID int64 `json:"id" gorm:"primarykey;comment:配置ID"` // 配置ID + Key string `json:"key" gorm:"size:200;not null;default:'';uniqueIndex:uk_key;comment:配置键"` // 配置键 + Value string `json:"value" gorm:"type:text;comment:配置值"` // 配置值 + CreatedAt int64 `json:"created_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:已删除)"` // 逻辑删除标记(0:未删除,1:已删除) } func (Config) TableName() string { diff --git a/models/employee.go b/models/employee.go index 91ae62d..cd2f6de 100644 --- a/models/employee.go +++ b/models/employee.go @@ -2,40 +2,40 @@ package models // Employee 员工 type Employee struct { - ID int64 `json:"id" gorm:"primarykey;comment:自增ID"` - EmployeeIDStr string `json:"employee_id_str" gorm:"size:10;not null;uniqueIndex"` // 工号 - Fid int64 `json:"fid" gorm:"not null;default:0;comment:父级id"` - AboutId int64 `json:"about_id" gorm:"not null;default:0;comment:关联id"` - Code string `json:"code" gorm:"size:64;not null;default:'';comment:机械码"` - Username string `json:"username" gorm:"size:50;not null;default:'';comment:登录账号 (init_工号)"` - Password string `json:"password" gorm:"size:100;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:手机号"` - Role int64 `json:"role" gorm:"not null;default:0;comment:权限"` - Status int8 `json:"status" gorm:"not null;default:1;comment:状态 1正常 0禁用"` - Score int64 `json:"score" gorm:"not null;default:0;comment:积分"` - SplitAccountConfigId int64 `json:"split_account_config_id" gorm:"not null;default:0;comment:分账配置ID"` - From string `json:"from" gorm:"size:50;not null;default:'';comment:来源"` - TypeId int8 `json:"type_id" 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"` - CreatedAt int64 `json:"created_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:删除时间"` - ExpireTime int64 `json:"expire_time" gorm:"not null;default:0;comment:过期时间"` + ID int64 `json:"id" gorm:"primarykey;comment:自增ID"` // 自增ID + EmployeeIDStr string `json:"employee_id_str" gorm:"size:10;not null;uniqueIndex"` // 工号 + Fid int64 `json:"fid" gorm:"not null;default:0;comment:父级id"` // 父级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:机械码"` // 机械码 + Username string `json:"username" gorm:"size:50;not null;default:'';comment:登录账号 (init_工号)"` // 登录账号 (init_工号) + Password string `json:"password" gorm:"size:100;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:手机号"` // 手机号 + Role int64 `json:"role" gorm:"not null;default:0;comment:权限"` // 权限 + Status int8 `json:"status" gorm:"not null;default:1;comment:状态 1正常 0禁用"` // 状态 1正常 0禁用 + Score int64 `json:"score" gorm:"not null;default:0;comment:积分"` // 积分 + 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:来源"` // 来源 + TypeId int8 `json:"type_id" 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"` // 最后登录ip + CreatedAt int64 `json:"created_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:删除时间"` // 删除时间 + ExpireTime int64 `json:"expire_time" gorm:"not null;default:0;comment:过期时间"` // 过期时间 } // UpdateEmployeeSplitAccountConfigResponse 更新员工分账配置响应 type UpdateEmployeeSplitAccountConfigResponse struct { - ID int64 `json:"id"` - EmployeeIDStr string `json:"employee_id_str"` - Username string `json:"username"` - Name string `json:"name"` - Phone string `json:"phone"` - AboutId int64 `json:"about_id"` - SplitAccountConfigId int64 `json:"split_account_config_id"` - Status int8 `json:"status"` - UpdatedAt int64 `json:"updated_at"` + ID int64 `json:"id"` // 自增ID + EmployeeIDStr string `json:"employee_id_str"` // 工号 + Username string `json:"username"` // 登录账号 (init_工号) + Name string `json:"name"` // 姓名 + Phone string `json:"phone"` // 手机号 + AboutId int64 `json:"about_id"` // 关联id + SplitAccountConfigId int64 `json:"split_account_config_id"` // 分账配置ID + Status int8 `json:"status"` // 状态 1正常 0禁用 + UpdatedAt int64 `json:"updated_at"` // 更新时间 } func (Employee) TableName() string { diff --git a/models/inventory_detail.go b/models/inventory_detail.go index 02aa514..846fde6 100644 --- a/models/inventory_detail.go +++ b/models/inventory_detail.go @@ -2,11 +2,11 @@ package models // InventoryDetail 库存明细表(库位级) type InventoryDetail struct { - ID int64 `json:"id" gorm:"primarykey;comment:明细ID"` - WarehouseID int64 `json:"warehouse_id" gorm:"not null;default:0;index;comment:仓库ID"` - LocationID int64 `json:"location_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"` - BatchNo string `json:"batch_no" gorm:"size:100;not null;default:'';uniqueIndex:uk_location_product_batch;index;comment:批次号"` + ID int64 `json:"id" gorm:"primarykey;comment:明细ID"` // 明细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"` // 库位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:批次号"` // ProductionDate int64 `json:"production_date" gorm:"not null;default:0;comment:生产日期时间戳(秒)"` ExpiryDate int64 `json:"expiry_date" gorm:"not null;default:0;index;comment:失效日期时间戳(秒)"` Quantity int64 `json:"quantity" gorm:"not null;default:0;comment:当前数量(最小单位)"` diff --git a/models/request/Employee.go b/models/request/Employee.go index a71cc7a..c1a32a5 100644 --- a/models/request/Employee.go +++ b/models/request/Employee.go @@ -2,63 +2,63 @@ package request // LoginRequest 登录请求 type LoginRequest struct { - Username string `form:"username" binding:"required"` - Password string `form:"password" binding:"required"` - AboutID int64 `form:"about_id"` // 租户ID(从ERP关联) - Type int64 `form:"type"` // 类型 1web 2pda - Code string `form:"code"` // 机械码 + Username string `form:"username" binding:"required"` // 用户名 + Password string `form:"password" binding:"required"` // 密码 + AboutID int64 `form:"about_id"` // 租户ID(从ERP关联) + Type int64 `form:"type"` // 类型 1web 2pda + Code string `form:"code"` // 机械码 } // GetEmployeeListRequest 获取员工列表请求 type GetEmployeeListRequest struct { - Page int `form:"page"` - PageSize int `form:"page_size"` - Fid int64 `form:"fid"` - Status string `form:"status"` - Keyword string `form:"keyword"` + Page int `form:"page"` // 页码 + PageSize int `form:"page_size"` // 页大小 + Fid int64 `form:"fid"` // 仓库ID + Status string `form:"status"` // 状态 + Keyword string `form:"keyword"` // 关键词 } // AddEmployeeRequest 添加员工请求 type AddEmployeeRequest struct { - Name string `form:"name" binding:"required"` - UserName string `form:"username"` - AboutId int64 `form:"about_id"` - Fid int64 `form:"fid"` - Phone string `form:"phone"` - Password string `form:"password" binding:"required,min=6"` - From string `form:"from"` - ExpireTime int64 `form:"expire_time"` + Name string `form:"name" binding:"required"` // 员工姓名 + UserName string `form:"username"` // 员工用户名 + AboutId int64 `form:"about_id"` // 租户ID + Fid int64 `form:"fid"` // 仓库ID + Phone string `form:"phone"` // 手机号 + Password string `form:"password" binding:"required,min=6"` // 密码 + From string `form:"from"` // 来源 + ExpireTime int64 `form:"expire_time"` // 过期时间 } // UpdatePasswordEmployeeRequest 修改员工密码请求 type UpdatePasswordEmployeeRequest struct { - Id int64 `form:"id" binding:"required"` - AboutId int64 `form:"about_id"` - Password string `form:"password" binding:"required,min=6"` + Id int64 `form:"id" binding:"required"` // 员工ID + AboutId int64 `form:"about_id"` // 租户ID + Password string `form:"password" binding:"required,min=6"` // 密码 } // UpdateExpireTimeEmployeeRequest 修改员工过期时间请求 type UpdateExpireTimeEmployeeRequest struct { - Id int64 `form:"id" binding:"required"` - AboutId int64 `form:"about_id"` - ExpireTime int64 `form:"expire_time" binding:"required"` + Id int64 `form:"id" binding:"required"` // 员工ID + AboutId int64 `form:"about_id"` // 租户ID + ExpireTime int64 `form:"expire_time" binding:"required"` // 过期时间 } // CheckCodeEmployeeRequest 校验员工机械码 type CheckCodeEmployeeRequest struct { - UserName string `form:"username" binding:"required"` + UserName string `form:"username" binding:"required"` // 员工用户名 } // ClearCodeEmployeeRequest 清除员工机械码请求 type ClearCodeEmployeeRequest struct { - UserName string `form:"username" binding:"required"` + UserName string `form:"username" binding:"required"` // 员工用户名 } // SetEmployeeLevelRequest 设置员工等级 type SetEmployeeLevelRequest struct { - EmpId int64 `form:"emp_id" binding:"required"` - Level int8 `form:"level" binding:"required,min=1,max=5"` // 等级(1-5) - PayTime int64 `form:"pay_time" binding:"required"` + EmpId int64 `form:"emp_id" binding:"required"` // 员工ID + Level int8 `form:"level" binding:"required,min=1,max=5"` // 等级(1-5) + PayTime int64 `form:"pay_time" binding:"required"` // 支付时间 OperationType int8 `form:"operation_type" binding:"required,oneof=1 2 3"` // 操作类型(1:开通,2:升级,3:续费) Duration int64 `form:"duration" binding:"required,min=1"` // 时长(月数),按30天/月计算 } @@ -84,6 +84,6 @@ type GetUserListRequest struct { // UpdateEmployeeSplitAccountConfigRequest 根据about_id更新员工分账配置请求 type UpdateEmployeeSplitAccountConfigRequest struct { - AboutId int64 `form:"about_id" binding:"required"` - SplitAccountConfigId int64 `form:"split_account_config_id" binding:"required"` + AboutId int64 `form:"about_id" binding:"required"` // 租户ID + SplitAccountConfigId int64 `form:"split_account_config_id" binding:"required"` // 员工分账配置ID } diff --git a/models/request/barcode.go b/models/request/barcode.go index 95d1254..4e80d82 100644 --- a/models/request/barcode.go +++ b/models/request/barcode.go @@ -1,5 +1,5 @@ package request type BarcodeRequest struct { - Content string `form:"content" binding:"required"` + Content string `form:"content" binding:"required"` // 条码内容 } diff --git a/models/request/car.go b/models/request/car.go index 3742ba5..663e6b9 100644 --- a/models/request/car.go +++ b/models/request/car.go @@ -1,32 +1,33 @@ package request type QueryCarRequest struct { - Keyword string `form:"keyword"` - Page int `form:"page,default=1"` - PageSize int `form:"page_size,default=10"` + Keyword string `form:"keyword"` // 搜索关键字 + Page int `form:"page,default=1"` // 页码 + PageSize int `form:"page_size,default=10"` // 每页数量 } type CreateCarRequest struct { - WarehouseID int64 `form:"warehouse_id" binding:"required"` - PushType int8 `form:"push_type" binding:"required"` - ReleaseType int8 `form:"release_type" binding:"required"` - Code int64 `form:"code" binding:"required"` - Name string `form:"name" binding:"required,max=50"` - Capacity int64 `form:"capacity" binding:"required"` - Appearance int64 `form:"appearance" binding:"required"` - ShopInfo []map[string]interface{} `form:"shop_info[]"` + WarehouseID int64 `form:"warehouse_id" binding:"required"` // 仓库ID + PushType int8 `form:"push_type" binding:"required"` // 推送类型 + ReleaseType int8 `form:"release_type" binding:"required"` // 发布类型 + Code int64 `form:"code" binding:"required"` // 小车编号 + Name string `form:"name" binding:"required,max=50"` // 小车名称 + Capacity int64 `form:"capacity" binding:"required"` // 容量 + Appearance int64 `form:"appearance" binding:"required"` // 品相 + ShopInfo []map[string]interface{} `form:"shop_info[]"` // 店铺信息 } type UpdateCarRequest struct { - PushType *int8 `form:"push_type" binding:"required"` - ReleaseType *int8 `form:"release_type" binding:"required"` - ID int64 `form:"id" binding:"required"` - Name string `form:"name" binding:"omitempty,max=50"` - Capacity *int64 `form:"capacity" binding:"required"` - Appearance *int64 `form:"appearance" binding:"required"` - ShopInfo []map[string]interface{} `form:"shop_info[]"` + PushType *int8 `form:"push_type" binding:"required"` // 推送类型 + ReleaseType *int8 `form:"release_type" binding:"required"` // 发布类型 + ID int64 `form:"id" binding:"required"` // 小车ID + Name string `form:"name" binding:"omitempty,max=50"` // 小车名称 + Capacity *int64 `form:"capacity" binding:"required"` // 容量 + Appearance *int64 `form:"appearance" binding:"required"` // 品 + Code *int64 `form:"code" binding:"required"` // 小车编号 + ShopInfo []map[string]interface{} `form:"shop_info[]"` // 店铺信息 } type DeleteCarRequest struct { - ID int64 `form:"id" binding:"required"` + ID int64 `form:"id" binding:"required"` // 小车ID } diff --git a/models/request/config.go b/models/request/config.go index 5ad9c38..d19cbd9 100644 --- a/models/request/config.go +++ b/models/request/config.go @@ -2,25 +2,25 @@ package request // GetConfigListRequest 获取配置列表请求 type GetConfigListRequest struct { - Page int `form:"page"` - PageSize int `form:"page_size"` - Keyword string `form:"keyword"` + Page int `form:"page"` // 页码 + PageSize int `form:"page_size"` // 页大小 + Keyword string `form:"keyword"` // 关键字 } // AddConfigRequest 添加配置请求 type AddConfigRequest struct { - Key string `form:"key" binding:"required"` - Value string `form:"value" binding:"required"` + Key string `form:"key" binding:"required"` // 配置键 + Value string `form:"value" binding:"required"` // 配置值 } // UpdateConfigRequest 更新配置请求 type UpdateConfigRequest struct { - ID int64 `form:"id" binding:"required"` - Key string `form:"key"` - Value string `form:"value"` + ID int64 `form:"id" binding:"required"` // 配置ID + Key string `form:"key"` // 配置键 + Value string `form:"value"` // 配置值 } // DeleteConfigRequest 删除配置请求 type DeleteConfigRequest struct { - ID int64 `form:"id" binding:"required"` + ID int64 `form:"id" binding:"required"` // 配置ID } diff --git a/models/request/employee_settings.go b/models/request/employee_settings.go index 7bcc664..7cb214f 100644 --- a/models/request/employee_settings.go +++ b/models/request/employee_settings.go @@ -4,11 +4,11 @@ import "psi/models" // GetEmployeeSettingsRequest 获取员工设置请求 type GetEmployeeSettingsRequest struct { - EmpId int64 `form:"emp_id"` + EmpId int64 `form:"emp_id"` // 员工ID } // SaveEmployeeSettingsRequest 保存员工设置请求 type SaveEmployeeSettingsRequest struct { - EmpId int64 `form:"emp_id"` - models.EmployeeSettingsConfig + EmpId int64 `form:"emp_id"` // 员工ID + models.EmployeeSettingsConfig // 员工设置 } diff --git a/models/request/inventory.go b/models/request/inventory.go index 16e6e4c..4af9e67 100644 --- a/models/request/inventory.go +++ b/models/request/inventory.go @@ -2,60 +2,60 @@ package request // GetInventoryListRequest 获取库存汇总列表请求 type GetInventoryListRequest struct { - Page int `form:"page"` - PageSize int `form:"page_size"` - ProductId int64 `form:"product_id"` - WarehouseID int64 `form:"warehouse_id"` - ISBN string `form:"isbn"` - Name string `form:"name"` + Page int `form:"page"` // 页码 + PageSize int `form:"page_size"` // 分页大小 + ProductId int64 `form:"product_id"` // 商品ID + WarehouseID int64 `form:"warehouse_id"` // 仓库ID + ISBN string `form:"isbn"` // ISBN + Name string `form:"name"` // 商品名称 } // GetInventoryGroupedListRequest 获取按仓库库位分组的库存列表请求 type GetInventoryGroupedListRequest struct { - Page int `form:"page"` - PageSize int `form:"page_size"` - ProductId int64 `form:"product_id"` - WarehouseID int64 `form:"warehouse_id"` + Page int `form:"page"` // 页码 + PageSize int `form:"page_size"` // 分页大小 + ProductId int64 `form:"product_id"` // 商品ID + WarehouseID int64 `form:"warehouse_id"` // 仓库ID } // GetInventoryDetailRequest 获取库存明细请求 type GetInventoryDetailRequest struct { - ProductID int64 `form:"product_id" binding:"required"` + ProductID int64 `form:"product_id" binding:"required"` // 商品ID } // GetInventoryLogListRequest 获取库存流水列表请求 type GetInventoryLogListRequest struct { - Page int `form:"page"` - PageSize int `form:"page_size"` - ISBN string `form:"isbn"` - BookName string `form:"book_name"` - WarehouseID int64 `form:"warehouse_id"` - ChangeType int8 `form:"change_type"` - RelatedOrderNo string `form:"related_order_no"` - StartDate int64 `form:"start_date"` - EndDate int64 `form:"end_date"` + Page int `form:"page"` // 页码 + PageSize int `form:"page_size"` // 分页大小 + ISBN string `form:"isbn"` // ISBN + BookName string `form:"book_name"` // 图书名称 + WarehouseID int64 `form:"warehouse_id"` // 仓库ID + ChangeType int8 `form:"change_type"` // 库存流水类型 + RelatedOrderNo string `form:"related_order_no"` // 关联订单号 + StartDate int64 `form:"start_date"` // 开始时间 + EndDate int64 `form:"end_date"` // 结束时间 } // InventoryStatistRequest 获取条码/品相库存总数请求 type InventoryStatistRequest struct { - Barcode string `form:"barcode"` - Appearance int64 `form:"appearance"` + Barcode string `form:"barcode"` // 条码 + Appearance int64 `form:"appearance"` // 品相 } // GetStockCheckListRequest 获取盘库列表请求 type GetStockCheckListRequest struct { - Page int `form:"page"` - PageSize int `form:"page_size"` - WarehouseID int64 `form:"warehouse_id"` - Status int8 `form:"status"` - CheckNo string `form:"check_no"` - StartDate int64 `form:"start_date"` - EndDate int64 `form:"end_date"` + Page int `form:"page"` // 页码 + PageSize int `form:"page_size"` // 分页大小 + WarehouseID int64 `form:"warehouse_id"` // 仓库ID + Status int8 `form:"status"` // 盘库状态 + CheckNo string `form:"check_no"` // 盘库编号 + StartDate int64 `form:"start_date"` // 开始时间 + EndDate int64 `form:"end_date"` // 结束时间 } // GetStockCheckDetailRequest 获取盘库明细列表请求 type GetStockCheckDetailRequest struct { - Page int `form:"page"` - PageSize int `form:"page_size"` - StockCheckID int64 `form:"stock_check_id" binding:"required"` + Page int `form:"page"` // 页码 + PageSize int `form:"page_size"` // 分页大小 + StockCheckID int64 `form:"stock_check_id" binding:"required"` // 盘库ID } diff --git a/models/response/car.go b/models/response/car.go index 2c21dc1..b99c796 100644 --- a/models/response/car.go +++ b/models/response/car.go @@ -3,10 +3,10 @@ package response import "psi/models" type CarShopInfo struct { - ShopID string `json:"id"` - ShopName string `json:"shop_name"` - ShopType int8 `json:"shop_type"` - ShopTypeText string `json:"shop_type_text"` + ShopID string `json:"id"` // 店铺ID + ShopName string `json:"shop_name"` //店铺名称 + ShopType int8 `json:"shop_type"` //店铺类型 + ShopTypeText string `json:"shop_type_text"` //店铺类型文本 } type CarResponse struct { ID int64 `json:"id"` diff --git a/models/response/config.go b/models/response/config.go index ab8526e..b687eb3 100644 --- a/models/response/config.go +++ b/models/response/config.go @@ -4,28 +4,28 @@ import "psi/models" // ConfigListResponse 配置列表响应 type ConfigListResponse struct { - List []ConfigItem `json:"list"` - Total int64 `json:"total"` - Page int `json:"page"` - PageSize int `json:"pageSize"` + List []ConfigItem `json:"list"` // 列表 + Total int64 `json:"total"` // 总数 + Page int `json:"page"` // 当前页 + PageSize int `json:"pageSize"` // 每页数量 } // ConfigItem 配置列表项 type ConfigItem struct { - ID int64 `json:"id"` - Key string `json:"key"` - Value string `json:"value"` - CreatedAt int64 `json:"created_at"` - UpdatedAt int64 `json:"updated_at"` + ID int64 `json:"id"` // ID + Key string `json:"key"` // 键 + Value string `json:"value"` // 值 + CreatedAt int64 `json:"created_at"` // 创建时间 + UpdatedAt int64 `json:"updated_at"` // 更新时间 } // ConvertConfigToItem 将配置模型转换为响应项 func ConvertConfigToItem(config models.Config) ConfigItem { return ConfigItem{ - ID: config.ID, - Key: config.Key, - Value: config.Value, - CreatedAt: config.CreatedAt, - UpdatedAt: config.UpdatedAt, + ID: config.ID, // ID + Key: config.Key, // 键 + Value: config.Value, // 值 + CreatedAt: config.CreatedAt, // 创建时间 + UpdatedAt: config.UpdatedAt, // 更新时间 } } diff --git a/models/response/inventory.go b/models/response/inventory.go index 972aa5c..ed2e5a6 100644 --- a/models/response/inventory.go +++ b/models/response/inventory.go @@ -6,181 +6,181 @@ import ( // InventoryListResponse 库存汇总列表响应 type InventoryListResponse struct { - List []InventoryItem `json:"list"` - Total int64 `json:"total"` - Page int `json:"page"` - PageSize int `json:"pageSize"` + List []InventoryItem `json:"list"` //库汇总项 + Total int64 `json:"total"` //总数 + Page int `json:"page"` //页码 + PageSize int `json:"pageSize"` //每页数量 } // InventoryItem 库存汇总项 type InventoryItem struct { - ProductID int64 `json:"product_id"` - ProductName string `json:"product_name"` - Appearance int64 `json:"appearance"` - Barcode string `json:"barcode"` - Price int64 `json:"price"` - WarehouseID int64 `json:"warehouse_id"` - WarehouseName string `json:"warehouse_name"` - WarehouseCode string `json:"warehouse_code"` - LocationCode string `json:"location_code"` - TotalQuantity int64 `json:"total_quantity"` - LockedQuantity int64 `json:"locked_quantity"` + ProductID int64 `json:"product_id"` //商品ID + ProductName string `json:"product_name"` //商品名称 + Appearance int64 `json:"appearance"` //封面 + Barcode string `json:"barcode"` //条码 + Price int64 `json:"price"` // 价格 + WarehouseID int64 `json:"warehouse_id"` //仓库ID + WarehouseName string `json:"warehouse_name"` //仓库名称 + WarehouseCode string `json:"warehouse_code"` //仓库编码 + LocationCode string `json:"location_code"` //库位编码 + TotalQuantity int64 `json:"total_quantity"` //总数量 + LockedQuantity int64 `json:"locked_quantity"` //锁定数量 } // InventoryGroupedListResponse 按仓库库位分组的库存列表响应 type InventoryGroupedListResponse struct { - List []InventoryGroupItem `json:"list"` - Total int64 `json:"total"` - Page int `json:"page"` - PageSize int `json:"pageSize"` + List []InventoryGroupItem `json:"list"` //库汇总项 + Total int64 `json:"total"` //总数 + Page int `json:"page"` //页码 + PageSize int `json:"pageSize"` //每页数量 } // InventoryGroupItem 仓库库位分组项(父级) type InventoryGroupItem struct { - WarehouseID int64 `json:"warehouse_id"` - WarehouseName string `json:"warehouse_name"` - WarehouseCode string `json:"warehouse_code"` - LocationID int64 `json:"location_id"` - LocationCode string `json:"location_code"` - TotalQuantity int64 `json:"total_quantity"` - LockedQuantity int64 `json:"locked_quantity"` - ItemCount int `json:"item_count"` - Details []InventoryDetailItem `json:"details"` + WarehouseID int64 `json:"warehouse_id"` //仓库ID + WarehouseName string `json:"warehouse_name"` //仓库名称 + WarehouseCode string `json:"warehouse_code"` //仓库编码 + LocationID int64 `json:"location_id"` //库位ID + LocationCode string `json:"location_code"` //库位编码 + TotalQuantity int64 `json:"total_quantity"` //总数量 + LockedQuantity int64 `json:"locked_quantity"` //锁定数量 + ItemCount int `json:"item_count"` //子项数量 + Details []InventoryDetailItem `json:"details"` //库明细项 } // InventoryDetailResponse 库存明细响应 type InventoryDetailResponse struct { - ProductID int64 `json:"product_id"` - ProductName string `json:"product_name"` - List []InventoryDetailItem `json:"list"` - Total int64 `json:"total"` + ProductID int64 `json:"product_id"` //商品ID + ProductName string `json:"product_name"` //商品名称 + List []InventoryDetailItem `json:"list"` //库明细项 + Total int64 `json:"total"` //总数量 } // InventoryDetailItem 库存明细项 type InventoryDetailItem struct { - ID int64 `json:"id"` - WarehouseID int64 `json:"warehouse_id"` - WarehouseName string `json:"warehouse_name"` - LocationID int64 `json:"location_id"` - LocationCode string `json:"location_code"` - BatchNo string `json:"batch_no"` - ProductionDate int64 `json:"production_date"` - ExpiryDate int64 `json:"expiry_date"` - Quantity int64 `json:"quantity"` - LockedQuantity int64 `json:"locked_quantity"` - CreatedAt int64 `json:"created_at"` - UpdatedAt int64 `json:"updated_at"` - ProductID int64 `json:"product_id"` - ProductName string `json:"product_name"` - Barcode string `json:"barcode"` - Appearance int64 `json:"appearance"` - SalePrice int64 `json:"sale_price"` - WaveNo string `json:"wave_no"` // 波次编号 - WaveTaskNo string `json:"wave_task_no"` // 波次任务编号 - OutTaskNo int64 `json:"out_task_no"` // 出库任务编号 - SalesOrderNo string `json:"sales_order_no"` // 销售单编号 - ShippingNo string `json:"shipping_no"` // 发货单编号 + ID int64 `json:"id"` //库明细项ID + WarehouseID int64 `json:"warehouse_id"` //仓库ID + WarehouseName string `json:"warehouse_name"` //仓库名称 + LocationID int64 `json:"location_id"` //库位ID + LocationCode string `json:"location_code"` //库位编码 + BatchNo string `json:"batch_no"` //批次号 + ProductionDate int64 `json:"production_date"` //生产日期 + ExpiryDate int64 `json:"expiry_date"` //过期日期 + Quantity int64 `json:"quantity"` // 数量 + LockedQuantity int64 `json:"locked_quantity"` //锁定数量 + CreatedAt int64 `json:"created_at"` //创建时间戳(秒) + UpdatedAt int64 `json:"updated_at"` //更新时间戳(秒) + ProductID int64 `json:"product_id"` //商品ID + ProductName string `json:"product_name"` //商品名称 + Barcode string `json:"barcode"` //条码 + Appearance int64 `json:"appearance"` //封面 + SalePrice int64 `json:"sale_price"` //销售价格 + WaveNo string `json:"wave_no"` // 波次编号 + WaveTaskNo string `json:"wave_task_no"` // 波次任务编号 + OutTaskNo int64 `json:"out_task_no"` // 出库任务编号 + SalesOrderNo string `json:"sales_order_no"` // 销售单编号 + ShippingNo string `json:"shipping_no"` // 发货单编号 } // InventoryLogListResponse 库存流水列表响应 type InventoryLogListResponse struct { - List []InventoryLogItem `json:"list"` - Total int64 `json:"total"` - Page int `json:"page"` - PageSize int `json:"pageSize"` + List []InventoryLogItem `json:"list"` //库流水项 + Total int64 `json:"total"` //总数 + Page int `json:"page"` //页码 + PageSize int `json:"pageSize"` //每页数量 } // InventoryLogItem 库存流水项 type InventoryLogItem struct { - ID int64 `json:"id"` - WarehouseID int64 `json:"warehouse_id"` - WarehouseName string `json:"warehouse_name"` - LocationID int64 `json:"location_id"` - LocationCode string `json:"location_code"` - ProductID int64 `json:"product_id"` - ProductName string `json:"product_name"` - Barcode string `json:"barcode"` - BatchNo string `json:"batch_no"` - ChangeType int8 `json:"change_type"` - ChangeTypeText string `json:"change_type_text"` - ChangeQuantity int64 `json:"change_quantity"` - BeforeQuantity int64 `json:"before_quantity"` - AfterQuantity int64 `json:"after_quantity"` - RelatedOrderType string `json:"related_order_type"` - RelatedOrderNo string `json:"related_order_no"` - Operator string `json:"operator"` - OperatorID int64 `json:"operator_id"` - Remark string `json:"remark"` - CreatedAt int64 `json:"created_at"` + ID int64 `json:"id"` //库流水项ID + WarehouseID int64 `json:"warehouse_id"` //仓库ID + WarehouseName string `json:"warehouse_name"` //仓库名称 + LocationID int64 `json:"location_id"` //库位ID + LocationCode string `json:"location_code"` //库位编码 + ProductID int64 `json:"product_id"` //商品ID + ProductName string `json:"product_name"` //商品名称 + Barcode string `json:"barcode"` //条码 + BatchNo string `json:"batch_no"` //批次号 + ChangeType int8 `json:"change_type"` //变更类型 + ChangeTypeText string `json:"change_type_text"` //变更类型文本 + ChangeQuantity int64 `json:"change_quantity"` //变更数量 + BeforeQuantity int64 `json:"before_quantity"` //变更前数量 + AfterQuantity int64 `json:"after_quantity"` //变更后数量 + RelatedOrderType string `json:"related_order_type"` //关联订单类型 + RelatedOrderNo string `json:"related_order_no"` //关联订单编号 + Operator string `json:"operator"` //操作人 + OperatorID int64 `json:"operator_id"` //操作人ID + Remark string `json:"remark"` //备注 + CreatedAt int64 `json:"created_at"` //创建时间戳(秒) } // InventoryStatistResponse ISBN/书名库存总数响应 type InventoryStatistResponse struct { - Barcode string `json:"barcode"` - Appearance int64 `json:"appearance"` - TotalQuantity int64 `json:"total_quantity"` - ProductCount int `json:"product_count"` + Barcode string `json:"barcode"` //条码 + Appearance int64 `json:"appearance"` //封面 + TotalQuantity int64 `json:"total_quantity"` //总数量 + ProductCount int `json:"product_count"` //商品数量 } // StockCheckListResponse 盘库列表响应 type StockCheckListResponse struct { - List []StockCheckItem `json:"list"` - Total int64 `json:"total"` - Page int `json:"page"` - PageSize int `json:"pageSize"` + List []StockCheckItem `json:"list"` //盘库项 + Total int64 `json:"total"` //总数 + Page int `json:"page"` //页码 + PageSize int `json:"pageSize"` //每页数量 } // StockCheckItem 盘库项 type StockCheckItem struct { - ID int64 `json:"id"` - CheckNo string `json:"check_no"` - WarehouseID int64 `json:"warehouse_id"` - WarehouseName string `json:"warehouse_name"` - CheckType int8 `json:"check_type"` - CheckTypeText string `json:"check_type_text"` - Status int8 `json:"status"` - StatusText string `json:"status_text"` - TotalItems int `json:"total_items"` - CheckedItems int `json:"checked_items"` - TotalQuantity int64 `json:"total_quantity"` - ActualQuantity int64 `json:"actual_quantity"` - Operator string `json:"operator"` - OperatorID int64 `json:"operator_id"` - Remark string `json:"remark"` - CreatedAt int64 `json:"created_at"` - UpdatedAt int64 `json:"updated_at"` + ID int64 `json:"id"` //盘库项ID + CheckNo string `json:"check_no"` //盘库编号 + WarehouseID int64 `json:"warehouse_id"` //仓库ID + WarehouseName string `json:"warehouse_name"` //仓库名称 + CheckType int8 `json:"check_type"` //盘库类型 + CheckTypeText string `json:"check_type_text"` //盘库类型文本 + Status int8 `json:"status"` //盘库状态 + StatusText string `json:"status_text"` //盘库状态文本 + TotalItems int `json:"total_items"` //总数量 + CheckedItems int `json:"checked_items"` //已盘数量 + TotalQuantity int64 `json:"total_quantity"` //盘库数量 + ActualQuantity int64 `json:"actual_quantity"` //实际盘库数量 + Operator string `json:"operator"` //操作人 + OperatorID int64 `json:"operator_id"` //操作人ID + Remark string `json:"remark"` //备注 + CreatedAt int64 `json:"created_at"` //创建时间戳(秒) + UpdatedAt int64 `json:"updated_at"` //更新时间戳(秒) } // StockCheckDetailResponse 盘库明细列表响应 type StockCheckDetailResponse struct { - List []StockCheckDetailItem `json:"list"` - Total int64 `json:"total"` - Page int `json:"page"` - PageSize int `json:"pageSize"` + List []StockCheckDetailItem `json:"list"` //库明细项 + Total int64 `json:"total"` //总数量 + Page int `json:"page"` //页码 + PageSize int `json:"pageSize"` //每页数量 } // StockCheckDetailItem 盘库明细项 type StockCheckDetailItem struct { - ID int64 `json:"id"` - ProductID int64 `json:"product_id"` - ProductName string `json:"product_name"` - Barcode string `json:"barcode"` - LocationID int64 `json:"location_id"` - LocationCode string `json:"location_code"` - BatchNo string `json:"batch_no"` - ProductionDate int64 `json:"production_date"` - ExpiryDate int64 `json:"expiry_date"` - SystemQuantity int64 `json:"system_quantity"` - ActualQuantity int64 `json:"actual_quantity"` - DifferenceQuantity int64 `json:"difference_quantity"` - Status int8 `json:"status"` - StatusText string `json:"status_text"` - CheckOperator string `json:"check_operator"` - CheckOperatorID int64 `json:"check_operator_id"` - CheckTime int64 `json:"check_time"` - Remark string `json:"remark"` - CreatedAt int64 `json:"created_at"` - UpdatedAt int64 `json:"updated_at"` + ID int64 `json:"id"` //库明细项ID + ProductID int64 `json:"product_id"` //商品ID + ProductName string `json:"product_name"` //商品名称 + Barcode string `json:"barcode"` //条码 + LocationID int64 `json:"location_id"` //库位ID + LocationCode string `json:"location_code"` //库位编码 + BatchNo string `json:"batch_no"` //批次号 + ProductionDate int64 `json:"production_date"` //生产日期 + ExpiryDate int64 `json:"expiry_date"` //过期日期 + SystemQuantity int64 `json:"system_quantity"` //系统数量 + ActualQuantity int64 `json:"actual_quantity"` //实际盘库数量 + DifferenceQuantity int64 `json:"difference_quantity"` //差异数量 + Status int8 `json:"status"` //盘库状态 + StatusText string `json:"status_text"` //盘库状态文本 + CheckOperator string `json:"check_operator"` //盘库人 + CheckOperatorID int64 `json:"check_operator_id"` //盘库人ID + CheckTime int64 `json:"check_time"` //盘库时间戳(秒) + Remark string `json:"remark"` //备注 + CreatedAt int64 `json:"created_at"` //创建时间戳(秒) + UpdatedAt int64 `json:"updated_at"` //更新时间戳(秒) } // InventorySummaryResponse 库存统计响应 diff --git a/models/response/response.go b/models/response/response.go index 5e282db..213900a 100644 --- a/models/response/response.go +++ b/models/response/response.go @@ -8,16 +8,16 @@ import ( ) type Response struct { - Code int `json:"code"` - Data interface{} `json:"data"` - Msg string `json:"msg"` + Code int `json:"code"` // 状态码 + Data interface{} `json:"data"` // 数据 + Msg string `json:"msg"` // 消息 } // ExternalAPIResponse 外部接口通用响应结构 type ExternalAPIResponse struct { - Code string `json:"code"` - Msg string `json:"msg"` - Data interface{} `json:"data"` + Code string `json:"code"` // 状态码 + Msg string `json:"msg"` // 消息 + Data interface{} `json:"data"` // 数据 } func Result(code int, data interface{}, msg string, c *gin.Context) { diff --git a/models/warehouse.go b/models/warehouse.go index 20c4d98..dd5e629 100644 --- a/models/warehouse.go +++ b/models/warehouse.go @@ -2,25 +2,25 @@ package models // Warehouse 仓库表 type Warehouse struct { - ID int64 `json:"id" gorm:"primarykey;comment:仓库ID"` - LogisticsID int64 `json:"logistics_id" gorm:"not null;default:0;index;comment:所属物流模板ID"` - 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:仓库名称"` - Type int8 `json:"type" gorm:"not null;default:1;comment:仓库类型(1:主仓库,2:备用仓库,3:中转仓库)"` - ContactPerson string `json:"contact_person" gorm:"size:50;default:'';comment:联系人"` - ContactPhone string `json:"contact_phone" gorm:"size:20;default:'';comment:联系电话"` - Province string `json:"province" gorm:"size:50;default:'';comment:省份"` - City string `json:"city" 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:仓库地址"` - 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:创建时间戳(秒)"` - 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:已删除)"` + ID int64 `json:"id" gorm:"primarykey;comment:仓库ID"` // 仓库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:仓库编码"` // 仓库编码 + Name string `json:"name" gorm:"size:100;not null;default:'';comment:仓库名称"` // 仓库名称 + Type int8 `json:"type" gorm:"not null;default:1;comment:仓库类型(1:主仓库,2:备用仓库,3:中转仓库)"` // 仓库类型 + ContactPerson string `json:"contact_person" gorm:"size:50;default:'';comment:联系人"` // 联系人 + ContactPhone string `json:"contact_phone" gorm:"size:20;default:'';comment:联系电话"` // 联系电话 + Province string `json:"province" gorm:"size:50;default:'';comment:省份"` // 省份 + City string `json:"city" 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:仓库地址"` // 仓库地址 + 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:创建时间戳(秒)"` // 创建时间戳(秒) + 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:已删除)"` // 逻辑删除标记(0:未删除,1:已删除) } func (Warehouse) TableName() string { - return "warehouse" + return "warehouse" // 表名 } func (Warehouse) TableOptions() string { diff --git a/service/cancel_logistics.go b/service/cancel_logistics.go index 0daec8c..64de850 100644 --- a/service/cancel_logistics.go +++ b/service/cancel_logistics.go @@ -16,6 +16,7 @@ import ( type CancelLogisticsService struct{} // CancelLogisticsResponse 取消物流接口返回 +// 响应格式 type CancelLogisticsResponse struct { Msg string `json:"msg"` Code string `json:"code"` @@ -24,6 +25,7 @@ type CancelLogisticsResponse struct { // CancelLogistics 取消物流单号 func (s *CancelLogisticsService) CancelLogistics(userID int64, logisticsNo string) (*CancelLogisticsResponse, error) { // 1. 调用外部接口取消物流单号 + //定义字节流变量 var buf bytes.Buffer w := multipart.NewWriter(&buf) if err := w.WriteField("mailNo", logisticsNo); err != nil {