读取永辉excel
This commit is contained in:
@@ -97,12 +97,11 @@ func LoadExcelByYongHui(ctx *jxcontext.Context, files []*multipart.FileHeader, i
|
||||
|
||||
func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync, IsContinueWhenError bool) (hint string, err error) {
|
||||
var (
|
||||
skuMap = make(map[string]float64)
|
||||
errMsg string
|
||||
costPrice float64 //成本价
|
||||
goodsList []*weimobapi.GoodsInfo
|
||||
goodsIDListForPutAwayInterface []interface{}
|
||||
err2 error
|
||||
skuMap = make(map[string]float64)
|
||||
errMsg string
|
||||
costPrice float64 //成本价
|
||||
goodsList []*weimobapi.GoodsInfo
|
||||
goodsIDListForPutAway []interface{}
|
||||
)
|
||||
db := dao.GetDB()
|
||||
taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||
@@ -191,17 +190,18 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync, Is
|
||||
retVal = []int64{goodsDetail.GoodsID}
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
if errTmp != "" {
|
||||
return retVal, errors.New(errTmp)
|
||||
}
|
||||
return retVal, err
|
||||
}
|
||||
taskParallel3 := tasksch.NewParallelTask("根据获取的微盟所有商品并更新", tasksch.NewParallelConfig().SetParallelCount(parallelCount).SetIsContinueWhenError(IsContinueWhenError), ctx, taskFunc3, goodsList)
|
||||
tasksch.HandleTask(taskParallel3, task, true).Run()
|
||||
goodsIDListForPutAwayInterface, err2 = taskParallel3.GetResult(0)
|
||||
if err2 != nil {
|
||||
errMsg += err2.Error()
|
||||
goodsIDListForPutAwayInterface, err2 := taskParallel3.GetResult(0)
|
||||
if err = err2; err != nil {
|
||||
return "", err
|
||||
}
|
||||
goodsIDListForPutAway = goodsIDListForPutAwayInterface
|
||||
case 3:
|
||||
// 批量下架微盟商品
|
||||
// if errMsg == "" {
|
||||
@@ -213,12 +213,15 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync, Is
|
||||
PutAwayWeiMobSku(int64Slice)
|
||||
return retVal, err
|
||||
}
|
||||
taskParallel4 := tasksch.NewParallelTask("下架微盟商品", tasksch.NewParallelConfig().SetParallelCount(parallelCount).SetBatchSize(UpdateGoodsShelfStatusCount), ctx, taskFunc4, goodsIDListForPutAwayInterface)
|
||||
taskParallel4 := tasksch.NewParallelTask("下架微盟商品", tasksch.NewParallelConfig().SetParallelCount(parallelCount).SetBatchSize(UpdateGoodsShelfStatusCount), ctx, taskFunc4, goodsIDListForPutAway)
|
||||
tasksch.HandleTask(taskParallel4, task, true).Run()
|
||||
_, err = taskParallel4.GetResult(0)
|
||||
// }
|
||||
}
|
||||
return result, errors.New(errMsg)
|
||||
if errMsg != "" {
|
||||
return result, errors.New(errMsg)
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
taskSeq := tasksch.NewSeqTask("读取永辉Excel文件修改微盟商品价格可售状态-序列任务", ctx, taskSeqFunc, 4)
|
||||
tasksch.HandleTask(taskSeq, nil, true).Run()
|
||||
|
||||
Reference in New Issue
Block a user