-
Notifications
You must be signed in to change notification settings - Fork 9
/
OutboundItemInfo.go
46 lines (41 loc) · 1.46 KB
/
OutboundItemInfo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package wdk
import (
"sync"
)
// OutboundItemInfo 结构体
type OutboundItemInfo struct {
// 容器信息
Containers []ContainerDo `json:"containers,omitempty" xml:"containers>container_do,omitempty"`
// 批发单号
WholesaleOrderNo string `json:"wholesale_order_no,omitempty" xml:"wholesale_order_no,omitempty"`
// 已废弃,请使用containers.production_date
ProductionDate string `json:"production_date,omitempty" xml:"production_date,omitempty"`
// 出库数量(为正数或零)
OutboundQuantity string `json:"outbound_quantity,omitempty" xml:"outbound_quantity,omitempty"`
// 商品编码
SkuCode string `json:"sku_code,omitempty" xml:"sku_code,omitempty"`
// 外部单号,如采购单号
ExternalOrderNo string `json:"external_order_no,omitempty" xml:"external_order_no,omitempty"`
// 是否完结
OutboundCompleted bool `json:"outbound_completed,omitempty" xml:"outbound_completed,omitempty"`
}
var poolOutboundItemInfo = sync.Pool{
New: func() any {
return new(OutboundItemInfo)
},
}
// GetOutboundItemInfo() 从对象池中获取OutboundItemInfo
func GetOutboundItemInfo() *OutboundItemInfo {
return poolOutboundItemInfo.Get().(*OutboundItemInfo)
}
// ReleaseOutboundItemInfo 释放OutboundItemInfo
func ReleaseOutboundItemInfo(v *OutboundItemInfo) {
v.Containers = v.Containers[:0]
v.WholesaleOrderNo = ""
v.ProductionDate = ""
v.OutboundQuantity = ""
v.SkuCode = ""
v.ExternalOrderNo = ""
v.OutboundCompleted = false
poolOutboundItemInfo.Put(v)
}