From 6c54e3901f55a93cb02e2f4d6e9439c725d7faab Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Sun, 17 Nov 2019 16:44:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BB=E5=8F=96=E6=B0=B8=E8=BE=89ecxcle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/yonghui/yonghui.go | 42 ++++++++++++++++------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/business/jxstore/yonghui/yonghui.go b/business/jxstore/yonghui/yonghui.go index 1d0b545cf..361c1bca6 100644 --- a/business/jxstore/yonghui/yonghui.go +++ b/business/jxstore/yonghui/yonghui.go @@ -153,9 +153,9 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync boo errMsg += fmt.Sprintf("在微盟上未找到该商品!excel商品ID : [%v]\n", k) } } - if errMsg != "" { - return "", errors.New(errMsg) - } + // if errMsg != "" { + // return "", errors.New(errMsg) + // } case 2: //找出微盟上有,excel上没有的,有就更新,没有就下架 taskFunc3 := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { @@ -170,14 +170,18 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync boo if len(skuList) == 0 { errMsg += fmt.Sprintf("在京西库中未找到该商品!name_id : [%v] \n", goodsDetail.SkuMap.SingleSku.OuterSkuCode) } else { - if skuList[0].Unit != "份" { - costPrice = Float64Round(0.5 / goodsDetail.SkuMap.SingleSku.B2CSku.Weight * skuMap[spuCode]) + if skuList[0].Unit == "份" { + if goodsDetail.SkuMap.SingleSku.B2CSku.Weight == 0 { + costPrice = skuMap[spuCode] + } else { + costPrice = Float64Round(0.5 / goodsDetail.SkuMap.SingleSku.B2CSku.Weight * skuMap[spuCode]) + } } else { costPrice = skuMap[spuCode] } - if errMsg == "" { - _, _, err = updateWeiMobGoods(costPrice, skuMap[spuCode], goodsDetail) - } + // if errMsg == "" { + _, _, err = updateWeiMobGoods(costPrice, skuMap[spuCode], goodsDetail) + // } } } else { //下架微盟商品 @@ -195,19 +199,19 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync boo // 批量下架微盟商品 goodsIDListForPutAway = goodsIDListForPutAwayInterface case 3: - if errMsg == "" { - taskFunc4 := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { - int64Slice := []int64{} - for _, v := range batchItemList { - int64Slice = append(int64Slice, v.(int64)) - } - PutAwayWeiMobSku(int64Slice) - return retVal, err + // if errMsg == "" { + taskFunc4 := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { + int64Slice := []int64{} + for _, v := range batchItemList { + int64Slice = append(int64Slice, v.(int64)) } - taskParallel4 := tasksch.NewParallelTask("下架微盟商品", tasksch.NewParallelConfig().SetParallelCount(parallelCount).SetBatchSize(UpdateGoodsShelfStatusCount), ctx, taskFunc4, goodsIDListForPutAway) - tasksch.HandleTask(taskParallel4, task, true).Run() - _, err = taskParallel4.GetResult(0) + PutAwayWeiMobSku(int64Slice) + return retVal, err } + taskParallel4 := tasksch.NewParallelTask("下架微盟商品", tasksch.NewParallelConfig().SetParallelCount(parallelCount).SetBatchSize(UpdateGoodsShelfStatusCount), ctx, taskFunc4, goodsIDListForPutAway) + tasksch.HandleTask(taskParallel4, task, true).Run() + _, err = taskParallel4.GetResult(0) + // } } return result, err }