订单转移修改
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user