Commit f0e58d7e by mushishixian

修复bug

parent dd2c7e26
...@@ -14,16 +14,16 @@ type RecvPro struct { ...@@ -14,16 +14,16 @@ type RecvPro struct {
} }
func init() { func init() {
queueExchange := rabbitmq.QueueExchange{ //queueExchange := rabbitmq.QueueExchange{
"bom_match", // "bom_match",
"bom_match", // "bom_match",
"bom", // "bom",
"direct", // "direct",
"amqp://huntadmin:jy2y2900@192.168.1.237:5672/", // "amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
} //}
//
str := `{"bom_id":545,"delivery_type":1,"sort":1}` //str := `{"bom_id":571,"delivery_type":1,"sort":1}`
rabbitmq.Send(queueExchange, str) //rabbitmq.Send(queueExchange, str)
} }
func (t *RecvPro) Consumer(dataByte []byte) (err error) { func (t *RecvPro) Consumer(dataByte []byte) (err error) {
......
...@@ -31,7 +31,6 @@ func MatchGoodsNameByAttrs(bomItems []model.BomItem) (result []model.BomItem, er ...@@ -31,7 +31,6 @@ func MatchGoodsNameByAttrs(bomItems []model.BomItem) (result []model.BomItem, er
for _, item := range bomItems { for _, item := range bomItems {
//如果有型号,但是型号有可能是参数,所以先去匹配下参数,有的话转成对应的型号 //如果有型号,但是型号有可能是参数,所以先去匹配下参数,有的话转成对应的型号
if item.GoodsName != "" && item.Attrs == "" { if item.GoodsName != "" && item.Attrs == "" {
//todo
search = searchAttr(item.GoodsName, item.BrandName, item.Encap, search) search = searchAttr(item.GoodsName, item.BrandName, item.Encap, search)
searchFlag = true searchFlag = true
} }
......
...@@ -29,6 +29,7 @@ func UpdateGoodsData(goodsMapList []GoodsMap) (err error) { ...@@ -29,6 +29,7 @@ func UpdateGoodsData(goodsMapList []GoodsMap) (err error) {
goodsIds = append(goodsIds, goodsMap.GoodsId) goodsIds = append(goodsIds, goodsMap.GoodsId)
} }
goodsIdsStr := strings.Join(goodsIds, ",") goodsIdsStr := strings.Join(goodsIds, ",")
//fmt.Println(goodsIdsStr)
goodsList, err := GetGoodsInfo(goodsIdsStr) goodsList, err := GetGoodsInfo(goodsIdsStr)
if len(goodsMapList) != 0 { if len(goodsMapList) != 0 {
bomId = goodsMapList[0].BomId bomId = goodsMapList[0].BomId
......
...@@ -7,7 +7,6 @@ import ( ...@@ -7,7 +7,6 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt"
"math" "math"
"regexp" "regexp"
"strings" "strings"
...@@ -84,9 +83,6 @@ func SearchGoods(bomId int, bomItems []model.BomItem, deliveryType, sort int, wg ...@@ -84,9 +83,6 @@ func SearchGoods(bomId int, bomItems []model.BomItem, deliveryType, sort int, wg
defer client.Stop() defer client.Stop()
//匹配之前,去遍历bom_item,把没有型号名称但是有参数的bom_item进行型号补充 //匹配之前,去遍历bom_item,把没有型号名称但是有参数的bom_item进行型号补充
bomItems, err = MatchGoodsNameByAttrs(bomItems) bomItems, err = MatchGoodsNameByAttrs(bomItems)
for _,value:=range bomItems {
fmt.Println(value.GoodsName)
}
//第一次先去精确匹配 //第一次先去精确匹配
goodsMapList, err := getUpdateGoodsData(bomId, bomItems, deliveryType, sort, client, true) goodsMapList, err := getUpdateGoodsData(bomId, bomItems, deliveryType, sort, client, true)
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment