物料订单增加补足五香粉
This commit is contained in:
@@ -49,7 +49,8 @@ const (
|
||||
autoCancelOrderReason = "支付超时,系统自动取消!"
|
||||
cancelMatterOrderReason = "失败重发!"
|
||||
|
||||
splitMatterOrderMinWeight = 4500 //物料订单分包最少要4.5kg
|
||||
splitMatterOrderMinWeight = 4500 //物料订单分包最少要4.5kg
|
||||
jxwxfMatterEclpID = "EMG4418113943423" //京西五香粉物料编码
|
||||
)
|
||||
|
||||
type JxSkuInfo struct {
|
||||
@@ -876,6 +877,7 @@ func orderSolutionForWuLiao(order *model.GoodsOrder) (err error) {
|
||||
goodsNos []string
|
||||
prices []string
|
||||
quantities []string
|
||||
countSum int
|
||||
)
|
||||
for _, v := range orderSkus {
|
||||
skus, err := dao.GetSkus(db, []int{v.SkuID}, nil, nil, nil, nil)
|
||||
@@ -885,6 +887,28 @@ func orderSolutionForWuLiao(order *model.GoodsOrder) (err error) {
|
||||
goodsNos = append(goodsNos, skus[0].EclpID)
|
||||
prices = append(prices, "0")
|
||||
quantities = append(quantities, utils.Int2Str(v.Count))
|
||||
countSum += v.Count
|
||||
}
|
||||
//总订单不足3kg && 商品数量不足3个 && 五香粉有库存,要送五香粉,补足3个
|
||||
stockResult, err := api.JdEclpAPI.QueryStock(jxwxfMatterEclpID)
|
||||
if err == nil && len(stockResult) > 0 && stockResult[0].UsableNum > 0 {
|
||||
if order.Weight < 3000 && countSum < 3 {
|
||||
//要判断他本身买没买五香粉EMG4418113943423
|
||||
var index = 9999
|
||||
for k, v := range goodsNos {
|
||||
if v == jxwxfMatterEclpID {
|
||||
index = k
|
||||
}
|
||||
}
|
||||
//说明他买了五香粉
|
||||
if index != 9999 {
|
||||
quantities[index] = utils.Int2Str(utils.Str2Int(quantities[index]) + 3 - countSum)
|
||||
} else {
|
||||
goodsNos = append(goodsNos, jxwxfMatterEclpID)
|
||||
prices = append(prices, "0")
|
||||
quantities = append(quantities, utils.Int2Str(3-countSum))
|
||||
}
|
||||
}
|
||||
}
|
||||
result, err := api.JdEclpAPI.AddOrder(&jdeclpapi.AddOrderParam{
|
||||
IsvUUID: order.VendorOrderID,
|
||||
|
||||
Reference in New Issue
Block a user