读取永辉ecxcle

This commit is contained in:
suyl
2019-11-17 16:44:59 +08:00
parent d0d5e1752d
commit 6c54e3901f

View File

@@ -153,9 +153,9 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync boo
errMsg += fmt.Sprintf("在微盟上未找到该商品excel商品ID : [%v]\n", k) errMsg += fmt.Sprintf("在微盟上未找到该商品excel商品ID : [%v]\n", k)
} }
} }
if errMsg != "" { // if errMsg != "" {
return "", errors.New(errMsg) // return "", errors.New(errMsg)
} // }
case 2: case 2:
//找出微盟上有excel上没有的有就更新没有就下架 //找出微盟上有excel上没有的有就更新没有就下架
taskFunc3 := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { 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 { if len(skuList) == 0 {
errMsg += fmt.Sprintf("在京西库中未找到该商品name_id : [%v] \n", goodsDetail.SkuMap.SingleSku.OuterSkuCode) errMsg += fmt.Sprintf("在京西库中未找到该商品name_id : [%v] \n", goodsDetail.SkuMap.SingleSku.OuterSkuCode)
} else { } else {
if skuList[0].Unit != "份" { if skuList[0].Unit == "份" {
costPrice = Float64Round(0.5 / goodsDetail.SkuMap.SingleSku.B2CSku.Weight * skuMap[spuCode]) if goodsDetail.SkuMap.SingleSku.B2CSku.Weight == 0 {
costPrice = skuMap[spuCode]
} else {
costPrice = Float64Round(0.5 / goodsDetail.SkuMap.SingleSku.B2CSku.Weight * skuMap[spuCode])
}
} else { } else {
costPrice = skuMap[spuCode] costPrice = skuMap[spuCode]
} }
if errMsg == "" { // if errMsg == "" {
_, _, err = updateWeiMobGoods(costPrice, skuMap[spuCode], goodsDetail) _, _, err = updateWeiMobGoods(costPrice, skuMap[spuCode], goodsDetail)
} // }
} }
} else { } else {
//下架微盟商品 //下架微盟商品
@@ -195,19 +199,19 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync boo
// 批量下架微盟商品 // 批量下架微盟商品
goodsIDListForPutAway = goodsIDListForPutAwayInterface goodsIDListForPutAway = goodsIDListForPutAwayInterface
case 3: case 3:
if errMsg == "" { // if errMsg == "" {
taskFunc4 := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { taskFunc4 := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
int64Slice := []int64{} int64Slice := []int64{}
for _, v := range batchItemList { for _, v := range batchItemList {
int64Slice = append(int64Slice, v.(int64)) int64Slice = append(int64Slice, v.(int64))
}
PutAwayWeiMobSku(int64Slice)
return retVal, err
} }
taskParallel4 := tasksch.NewParallelTask("下架微盟商品", tasksch.NewParallelConfig().SetParallelCount(parallelCount).SetBatchSize(UpdateGoodsShelfStatusCount), ctx, taskFunc4, goodsIDListForPutAway) PutAwayWeiMobSku(int64Slice)
tasksch.HandleTask(taskParallel4, task, true).Run() return retVal, err
_, err = taskParallel4.GetResult(0)
} }
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 return result, err
} }