阿里云查询商品条码

This commit is contained in:
苏尹岚
2020-04-08 09:49:17 +08:00
parent 093d87fc33
commit 93fd64c711
3 changed files with 43 additions and 3 deletions

View File

@@ -3,6 +3,8 @@ package cms
import (
"errors"
"fmt"
"io"
"mime/multipart"
"strconv"
"strings"
"time"
@@ -573,7 +575,8 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku bool, params ma
t1.ex_prefix,
t1.ex_prefix_begin,
t1.ex_prefix_end,
t1.yb_name_suffix`
t1.yb_name_suffix,
t4.mid_unit_price`
if isBySku {
sql += `,
t2.id`
@@ -608,6 +611,7 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku bool, params ma
t1.ex_prefix_begin,
t1.ex_prefix_end,
t1.yb_name_suffix,
t4.mid_unit_price,
CONCAT("[", GROUP_CONCAT(DISTINCT CONCAT('{"id":', t2.id, ',"comment":"', t2.comment, '","status":', t2.status,
',"createdAt":"', CONCAT(REPLACE(t2.created_at," ","T"),"+08:00"), '","updatedAt":"', CONCAT(REPLACE(t2.updated_at," ","T"),"+08:00"),
'","lastOperator":"', t2.last_operator, '","specQuality":', t2.spec_quality, ',"specUnit":"', t2.spec_unit,
@@ -1588,7 +1592,7 @@ func SumExianDaDepot(ctx *jxcontext.Context, isAsync, isContinueWhenError bool)
Upc: &v.UpcID,
Status: model.SkuStatusNormal,
}
skuName.CategoryID = 35 //默认给了个分类
skuName.CategoryID = model.NoCatCatgoryID //默认给了个分类
dao.WrapAddIDCULDEntity(skuName, ctx.GetUserName())
err = dao.CreateEntity(db, skuName)
if err != nil {
@@ -1710,3 +1714,29 @@ func SendNoCatSkusToOperater(ctx *jxcontext.Context) (err error) {
}
return err
}
func CreateUpcSkuByExcel(ctx *jxcontext.Context, files []*multipart.FileHeader) (err error) {
if len(files) == 0 {
return errors.New("没有文件上传!")
}
fileHeader := files[0]
file, err := fileHeader.Open()
err = CreateUpcSkuByExcelBin(ctx, file)
file.Close()
return err
}
func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader) (err error) {
taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
switch step {
case 0:
case 1:
case 2:
}
return result, err
}
taskSeq := tasksch.NewSeqTask2("根据excel创建标品-序列任务", ctx, true, taskSeqFunc, 3)
tasksch.HandleTask(taskSeq, nil, true).Run()
_, err = taskSeq.GetResult(0)
return err
}