58 lines
2.5 KiB
Go
58 lines
2.5 KiB
Go
package response
|
|
|
|
import "psi/models"
|
|
|
|
// WarehouseResponse 仓库信息
|
|
type WarehouseResponse struct {
|
|
ID int64 `json:"id"` // 仓库ID
|
|
LogisticsID int64 `json:"logistics_id"` // 所属物流模板ID
|
|
Code string `json:"code"` // 仓库编码
|
|
Name string `json:"name"` // 仓库名称
|
|
Type int8 `json:"type"` // 仓库类型
|
|
ContactPerson string `json:"contact_person"` // 联系人
|
|
ContactPhone string `json:"contact_phone"` // 联系电话
|
|
Province string `json:"province"` // 省份
|
|
City string `json:"city"` // 城市
|
|
District string `json:"district"` // 区/县
|
|
Address string `json:"address"` // 详细地址
|
|
Status int8 `json:"status"` // 仓库状态
|
|
CreatedAt int64 `json:"created_at"` // 创建时间
|
|
UpdatedAt int64 `json:"updated_at"` // 更新时间
|
|
}
|
|
|
|
// ExportLocationResponse 导出库位数据响应参数
|
|
type ExportLocationResponse struct {
|
|
Total int64 `json:"total"` // 总数
|
|
FileName string `json:"file_name"` // 文件名
|
|
FilePath string `json:"file_path"` // 文件路径
|
|
}
|
|
|
|
// ImportLocationResult 导入库位数据响应参数
|
|
type ImportLocationResult struct {
|
|
SuccessCount int `json:"success_count"` // 成功数量
|
|
FailCount int `json:"fail_count"` // 失败数量
|
|
SuccessCodes []string `json:"success_codes"` // 成功编码
|
|
FailCodes []string `json:"fail_codes"` // 失败编码
|
|
Message string `json:"message"` // 错误信息
|
|
}
|
|
|
|
// ConvertWarehouseToResponse 仓库信息转换成响应参数
|
|
func ConvertWarehouseToResponse(warehouse models.Warehouse) WarehouseResponse {
|
|
return WarehouseResponse{
|
|
ID: warehouse.ID, // 仓库ID
|
|
LogisticsID: warehouse.LogisticsID, // 所属物流模板ID
|
|
Code: warehouse.Code, // 仓库编码
|
|
Name: warehouse.Name, // 仓库名称
|
|
Type: warehouse.Type, // 仓库类型
|
|
ContactPerson: warehouse.ContactPerson, // 联系人
|
|
ContactPhone: warehouse.ContactPhone, // 联系电话
|
|
Province: warehouse.Province, // 省份
|
|
City: warehouse.City, // 城市
|
|
District: warehouse.District, // 区/县
|
|
Address: warehouse.Address, // 详细地址
|
|
Status: warehouse.Status, // 仓库状态
|
|
CreatedAt: warehouse.CreatedAt, // 创建时间
|
|
UpdatedAt: warehouse.UpdatedAt, // 更新时间
|
|
}
|
|
}
|