Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
bom_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f0e58d7e
authored
Jun 23, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复bug
parent
dd2c7e26
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
15 deletions
cmd/queue/bom.go
internal/logic/attr.go
internal/logic/goods.go
internal/logic/match.go
cmd/queue/bom.go
View file @
f0e58d7e
...
@@ -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
)
{
...
...
internal/logic/attr.go
View file @
f0e58d7e
...
@@ -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
}
}
...
...
internal/logic/goods.go
View file @
f0e58d7e
...
@@ -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
...
...
internal/logic/match.go
View file @
f0e58d7e
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment