daShangDao_psiServer/models/response/outbound.go
Administrator a2ea0c3a40 1.在这个接口里 /api/product/updateNameAndImages,添加多张图片时,并未覆盖原来的多张图片。(Y)
2.从系统导出的excel数据,在外部对excel某一列进行更改时,新增的要回传到原来的地方;并对改动的地方进行覆盖。
3.销售单管理、出库管理、发货单三个接口里面展示第三方订单编号和快递单号
4.选择多个仓库时,只要选择发货单子就会报错
5.在这个/api/split-account-deduction-log/create接口里,当传参时,如果参数 total_amount 是0,则会报错 {"code":204,"data":{},"msg":"TotalAmount不能为空"} 0是金额数字,不能当空值进行判断(T)
传递参数created_by,没有往数据表里写入
6.商品销毁的同时写入日志,也能通过读取这个日志,还原销毁的商品。传出这个新增的接口
7.新增一个不需要签名认证的分帐扣钱日志列表接口,新增一个返回字段buniness_no,并对这个字段进行模糊查询。
测试接口:/open/split-account-deduction-log/list
8.增加个新接口:首先 调用 /api/sales-order/create 创建销售订单的时候会锁定库存,
现在我需要一个解锁库存的接口,传递参数是订单编号
POST /api/sales-order/unlock-inventory // 解锁销售订单库存
/api/split-account-deduction-log/update /api/sales-order/unlock-inventory 在这两个接口里不需要签名认证
/api/sales-order/unlock-inventory 在这个接口里面返回解锁的所有商品信息
/api/split-account-deduction-log/update  在这个接口里面的status也需要更改,status没有变化
2026-06-24 09:41:12 +08:00

166 lines
5.9 KiB
Go

package response
import (
"psi/models"
)
type OutboundOrderWithInfo struct {
models.OutboundOrder
CustomerName string `gorm:"column:customer_name"`
WarehouseName string `gorm:"column:warehouse_name"`
}
type OutboundOrderItemWithProduct struct {
models.OutboundOrderItem
ProductName string `gorm:"column:product_name"`
ProductCode string `gorm:"column:product_code"`
CategoryID int64 `gorm:"column:category_id"`
CategoryName string `gorm:"column:category_name"`
LocationName string `gorm:"column:location_name"`
WarehouseName string `gorm:"column:warehouse_name"`
WarehouseCode string `gorm:"column:warehouse_code"`
SalesOrderNo string `gorm:"column:sales_order_no"`
}
// OutboundOrderListResponse 发货单列表响应
type OutboundOrderListResponse struct {
List []OutboundOrderItem `json:"list"`
Total int64 `json:"total"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
}
type OutboundShopInfo struct {
ShopName string `json:"shop_name"`
ShopType int8 `json:"shop_type"`
ShopTypeText string `json:"shop_type_text"`
}
// OutboundOrderItem 发货单项
type OutboundOrderItem struct {
ID int64 `json:"id"`
OutboundNo string `json:"outbound_no"`
WaveTaskID int64 `json:"wave_task_id"`
CustomerID int64 `json:"customer_id"`
CustomerName string `json:"customer_name"`
WarehouseID int64 `json:"warehouse_id"`
WarehouseName string `json:"warehouse_name"`
ShopList []OutboundShopInfo `json:"shop_list"`
AssociationOrderNo string `json:"association_order_no"` //第三方订单编号
LogisticsNo string `json:"logistics_no"` //快递单号
Status int8 `json:"status"`
StatusText string `json:"status_text"`
Operator string `json:"operator"`
OperatorID int64 `json:"operator_id"`
Remark string `json:"remark"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
// OutboundOrderDetailResponse 发货单详情响应
type OutboundOrderDetailResponse struct {
ID int64 `json:"id"`
OutboundNo string `json:"outbound_no"`
SalesOrderID int64 `json:"sales_order_id"`
SalesOrderNo string `json:"sales_order_no"`
WaveTaskID int64 `json:"wave_task_id"`
CustomerID int64 `json:"customer_id"`
CustomerName string `json:"customer_name"`
WarehouseID int64 `json:"warehouse_id"`
WarehouseName string `json:"warehouse_name"`
Status int8 `json:"status"`
StatusText string `json:"status_text"`
Operator string `json:"operator"`
OperatorID int64 `json:"operator_id"`
Remark string `json:"remark"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Items []OutboundOrderDetailItem `json:"items"`
}
// OutboundOrderDetailItem 发货单明细项
type OutboundOrderDetailItem struct {
ID int64 `json:"id"`
OutboundOrderID int64 `json:"out_order_id"`
SalesOrderNo string `json:"sales_order_no"`
ProductID int64 `json:"product_id"`
ProductName string `json:"product_name"`
ProductCode string `json:"product_code"`
CategoryID int64 `json:"category_id"`
CategoryName string `json:"category_name"`
LocationID int64 `json:"location_id"`
LocationName string `json:"location_name"`
WarehouseName string `json:"warehouse_name"`
WarehouseCode string `json:"warehouse_code"`
BatchNo string `json:"batch_no"`
ProductionDate int64 `json:"production_date"`
ExpiryDate int64 `json:"expiry_date"`
Quantity int64 `json:"quantity"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
// ConvertOutboundOrderToItem 将发货单模型转换为响应项
func ConvertOutboundOrderToItem(order models.OutboundOrder, customerName string, warehouseName string, shopList []OutboundShopInfo, associationOrderNo string, logisticsNo string) OutboundOrderItem {
return OutboundOrderItem{
ID: order.ID,
OutboundNo: order.OutNo,
WaveTaskID: order.WaveTaskID,
CustomerID: order.CustomerID,
CustomerName: customerName,
WarehouseID: order.WarehouseID,
WarehouseName: warehouseName,
ShopList: shopList,
AssociationOrderNo: associationOrderNo,
LogisticsNo: logisticsNo,
Status: order.Status,
StatusText: GetOutboundOrderStatusText(order.Status),
Operator: order.Operator,
OperatorID: order.OperatorID,
Remark: order.Remark,
CreatedAt: order.CreatedAt,
UpdatedAt: order.UpdatedAt,
}
}
// ConvertOutboundOrderToDetail 将发货单模型转换为详情响应
func ConvertOutboundOrderToDetail(order models.OutboundOrder, customerName string, warehouseName string, items []OutboundOrderDetailItem) OutboundOrderDetailResponse {
return OutboundOrderDetailResponse{
ID: order.ID,
OutboundNo: order.OutNo,
WaveTaskID: order.WaveTaskID,
CustomerID: order.CustomerID,
CustomerName: customerName,
WarehouseID: order.WarehouseID,
WarehouseName: warehouseName,
Status: order.Status,
StatusText: GetOutboundOrderStatusText(order.Status),
Operator: order.Operator,
OperatorID: order.OperatorID,
Remark: order.Remark,
CreatedAt: order.CreatedAt,
UpdatedAt: order.UpdatedAt,
Items: items,
}
}
// GetOutboundOrderStatusText 获取发货单状态文本
func GetOutboundOrderStatusText(status int8) string {
statusMap := map[int8]string{
1: "已创建",
2: "拣货中",
3: "已完成",
4: "已取消",
5: "发货中",
6: "已发货",
}
if text, ok := statusMap[status]; ok {
return text
}
return "未知"
}