订单转移修改

This commit is contained in:
苏尹岚
2020-06-18 09:34:30 +08:00
parent c30ef36095
commit 5c88bf1298
3 changed files with 65 additions and 9 deletions

View File

@@ -7,6 +7,8 @@ import (
"strings"
"time"
"git.rosy.net.cn/baseapi/platformapi/jdeclpapi"
"git.rosy.net.cn/jx-callback/business/jxstore/common"
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
@@ -1184,9 +1186,10 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int)
}
//重新构建order的数据
storeMaps, err := dao.GetStoresMapList(db, []int{order.VendorID}, []int{order.StoreID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "")
if len(storeMaps) > 0 {
stores, err := dao.GetStoreList(db, []int{storeID}, nil, nil, nil, "")
if len(storeMaps) > 0 && len(stores) > 0 {
order.StoreID = storeID
order.StoreName = storeMaps[0].StoreName
order.StoreName = stores[0].Name
order.VendorStoreID = storeMaps[0].VendorStoreID
} else {
return "", fmt.Errorf("未查询到该门店对应的平台信息!门店:[%v]", order.StoreID)
@@ -1233,8 +1236,61 @@ func SendJdwlForJdsOrder(ctx *jxcontext.Context, vendorOrderID string) (err erro
return err
}
}
handler := partner.DeliveryPlatformHandlers[model.VendorIDJDWL]
waybill2, err := handler.Handler.CreateWaybill(order, 0)
jdshop.CurPurchaseHandler.OrderExport(ctx, vendorOrderID, waybill2.VendorWaybillID, false)
var vendorWaybillID string
if order.StoreID == model.JdShopMainStoreID {
var (
goodsNos []string
prices []string
quantities []string
)
for _, v := range order.Skus {
skus, err := dao.GetSkus(db, []int{v.SkuID}, nil, nil, nil, nil)
if err != nil || len(skus) == 0 {
continue
}
goodsNos = append(goodsNos, skus[0].EclpID)
prices = append(prices, "0")
quantities = append(quantities, utils.Int2Str(v.Count))
}
eclpSoNo, err := api.JdEclpAPI.AddOrder(&jdeclpapi.AddOrderParam{
IsvUUID: order.VendorOrderID,
IsvSource: jdeclpapi.IsvSource,
ShopNo: jdeclpapi.ShopNo,
DepartmentNo: jdeclpapi.DepartmentNo,
WarehouseNo: jdeclpapi.WarehouseNo,
SalesPlatformOrderNo: order.VendorOrderID,
SalePlatformSource: jdeclpapi.SalePlatformSource,
ConsigneeName: order.ConsigneeName,
ConsigneeMobile: order.ConsigneeMobile,
ConsigneeAddress: order.ConsigneeAddress,
OrderMark: jdeclpapi.OrderMark,
GoodsNo: strings.Join(goodsNos, ","),
Price: strings.Join(prices, ","),
Quantity: strings.Join(quantities, ","),
})
waybill := &model.Waybill{
VendorOrderID: order.VendorOrderID,
OrderVendorID: model.VendorIDJX,
VendorWaybillID: eclpSoNo,
WaybillVendorID: model.VendorIDJDWL,
Status: model.WaybillStatusDelivering,
WaybillCreatedAt: time.Now(),
StatusTime: time.Now(),
WaybillFinishedAt: utils.DefaultTimeValue,
DeliveryFlag: model.OrderDeliveryFlagMaskScheduleDisabled,
}
dao.CreateEntity(db, waybill)
if err != nil {
return err
}
} else {
handler := partner.DeliveryPlatformHandlers[model.VendorIDJDWL]
waybill2, err := handler.Handler.CreateWaybill(order, 0)
if err != nil {
return err
}
vendorWaybillID = waybill2.VendorWaybillID
}
jdshop.CurPurchaseHandler.OrderExport(ctx, vendorOrderID, vendorWaybillID, false)
return err
}

View File

@@ -2587,8 +2587,7 @@ func UpdateSkuExinfoMap(ctx *jxcontext.Context, nameIDs []int, imgWaterMark stri
}
CurVendorSync.SyncSkus(ctx, db, nil, skuIDs, isAsync, isContinueWhenError, ctx.GetUserName())
} else {
CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{vendorID}, nil, false, skuIDs, nil, model.SyncFlagModifiedMask, true, true)
CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{vendorID}, nil, false, skuIDs, nil, model.SyncFlagModifiedMask, isAsync, isContinueWhenError)
}
}
}

View File

@@ -26,7 +26,8 @@ const (
VendorIDDada = 101
VendorIDMTPS = 102
VendorIDFengNiao = 103
VendorIDDeliveryEnd = 200
VendorIDJDWL = 401 //京东物流
VendorIDDeliveryEnd = 500
VendorIDPrinterBegin = 201
VendorIDFeiE = 201 // 飞鹅打印机
@@ -48,7 +49,6 @@ const (
VendorIDQiNiuCloud = 323 // 七牛云
VendorIDShowAPI = 325 // 万维易源
VendorIDJDWL = 401 //京东物流
)
type VendorInfo struct {
@@ -82,6 +82,7 @@ var (
VendorIDZhongWu: "ZhongWu",
VendorIDQiNiuCloud: "Qiniu",
VendorIDJDWL: "Jdwl",
}
VendorTypeName = map[int]string{