1
This commit is contained in:
@@ -469,14 +469,15 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
}
|
||||
|
||||
}
|
||||
api := getAPI(getStoreVendorOrgCode(storeID), storeID, vendorStoreID)
|
||||
if globals.EnableMtwmStoreWrite {
|
||||
if len(foodDataList) == 1 {
|
||||
foodDataList[0]["skus"] = string(utils.MustMarshal(foodDataList[0]["skus"]))
|
||||
if err = getAPI(getStoreVendorOrgCode(storeID), storeID, vendorStoreID).RetailInitData(ctx.GetTrackInfo(), vendorStoreID, utils.Int2Str(storeSkuList[0].SkuID), foodDataList[0]); err != nil {
|
||||
if err = api.RetailInitData(ctx.GetTrackInfo(), vendorStoreID, utils.Int2Str(storeSkuList[0].SkuID), foodDataList[0]); err != nil {
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDMTWM], syncType)
|
||||
}
|
||||
} else if len(foodDataList) > 0 {
|
||||
failedFoodList, err2 := getAPI(getStoreVendorOrgCode(storeID), storeID, vendorStoreID).RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList)
|
||||
failedFoodList, err2 := api.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList)
|
||||
if err = err2; err == nil {
|
||||
if err = putils.GenPartialFailedErr(failedFoodList, len(failedFoodList)); err != nil {
|
||||
failedList = SelectStoreSkuListByFoodList(storeSkuList, failedFoodList, storeID, model.VendorChineseNames[model.VendorIDMTWM], syncType)
|
||||
@@ -490,12 +491,38 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDMTWM, "")
|
||||
spuList := make([]*mtwmapi.SpuData, 0, 0)
|
||||
for _, storeSku := range storeSkuList {
|
||||
if storeDetail.QuotationPrice != 0 && storeDetail.PayPercentage >= 50 {
|
||||
spuList = append(spuList, &mtwmapi.SpuData{
|
||||
AppSpuCode: utils.Int2Str(storeSku.SkuID),
|
||||
SkuID: utils.Int2Str(storeSku.SkuID),
|
||||
PurchasePrice: utils.Float64ToStr(float64(storeDetail.QuotationPrice) / float64(100)),
|
||||
})
|
||||
}
|
||||
storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID)
|
||||
}
|
||||
if len(failedList) > 0 {
|
||||
err = nil
|
||||
}
|
||||
|
||||
// 报价门店同步进货价
|
||||
if len(spuList) > 0 {
|
||||
count := len(spuList) / 50
|
||||
if len(spuList)%50 != 0 {
|
||||
count++
|
||||
}
|
||||
for i := 1; i <= count; i++ {
|
||||
if i == count {
|
||||
api.BatchSetRestockingPrice(utils.GetUUID(), vendorStoreID, spuList[(i-1)*50:])
|
||||
} else {
|
||||
api.BatchSetRestockingPrice(utils.GetUUID(), vendorStoreID, spuList[(i-1)*50:i*50])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return failedList, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user