物料商品不操作thingmap
This commit is contained in:
@@ -1087,7 +1087,7 @@ func UpdateSku(ctx *jxcontext.Context, skuID int, payload map[string]interface{}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
if sku.ExdSkuID == "" {
|
||||
if sku.ExdSkuID == "" || sku.EclpID == "" {
|
||||
if err = OnUpdateThing(ctx, db, nil, int64(skuID), model.ThingTypeSku); err != nil {
|
||||
dao.Rollback(db)
|
||||
return 0, err
|
||||
|
||||
@@ -614,46 +614,52 @@ func PickupGoods(order *model.GoodsOrder, isSelfDelivery bool, userName string)
|
||||
func orderSolutionForWuLiao(order *model.GoodsOrder) (err error) {
|
||||
if order.FromStoreID != 0 {
|
||||
var (
|
||||
goodsNos []string
|
||||
prices []string
|
||||
quantities []string
|
||||
db = dao.GetDB()
|
||||
db = dao.GetDB()
|
||||
)
|
||||
err = changeOrderStatus(order.VendorOrderID, model.OrderStatusDelivering, "")
|
||||
goods, err := dao.QueryOrders(db, order.VendorOrderID, -1, []int{model.VendorIDJX}, -1, utils.ZeroTimeValue, utils.ZeroTimeValue)
|
||||
if err != nil || len(goods) == 0 {
|
||||
return err
|
||||
}
|
||||
for _, v := range goods[0].Skus {
|
||||
skus, err := dao.GetSkus(db, []int{v.SkuID}, nil, nil, nil, nil)
|
||||
if err != nil || len(skus) == 0 {
|
||||
continue
|
||||
if order.Weight <= 5000 { //如果总重量小于5kg就直接发单
|
||||
var (
|
||||
goodsNos []string
|
||||
prices []string
|
||||
quantities []string
|
||||
)
|
||||
err = changeOrderStatus(order.VendorOrderID, model.OrderStatusDelivering, "")
|
||||
if err != nil || len(goods) == 0 {
|
||||
return err
|
||||
}
|
||||
goodsNos = append(goodsNos, skus[0].EclpID)
|
||||
prices = append(prices, "0")
|
||||
quantities = append(quantities, utils.Int2Str(v.Count))
|
||||
for _, v := range goods[0].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))
|
||||
}
|
||||
result, 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, ","),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
order.EclpOutID = result
|
||||
dao.UpdateEntity(db, order, "EclpOutID")
|
||||
} else { //如果重量超过5kg则需要进行拆单分包,商品分包规则。最后一个包不超过5kg,其他包不超过3kg
|
||||
|
||||
}
|
||||
result, 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, ","),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
order.EclpOutID = result
|
||||
dao.UpdateEntity(db, order, "EclpOutID")
|
||||
//刷新一下库存
|
||||
for _, v := range goods[0].Skus {
|
||||
cms.RefreshMatterStock(jxcontext.AdminCtx, v.SkuID)
|
||||
|
||||
Reference in New Issue
Block a user