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
6d55a733
authored
May 29, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
完善
parent
8fed8855
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
5 deletions
cmd/cmd.exe~
cmd/queue/bom.go
internal/logic/bom_item.go
internal/logic/bom_matching.go
internal/logic/match.go
cmd/cmd.exe~
View file @
6d55a733
The file could not be displayed because it is too large.
cmd/queue/bom.go
View file @
6d55a733
...
...
@@ -22,7 +22,7 @@ func init() {
"amqp://huntadmin:jy2y2900@192.168.1.237:5672/"
,
}
str
:=
`{"bom_id":1
7
5,"delivery_type":1,"sort":1}`
str
:=
`{"bom_id":1
9
5,"delivery_type":1,"sort":1}`
rabbitmq
.
Send
(
queueExchange
,
str
)
}
...
...
internal/logic/bom_item.go
View file @
6d55a733
...
...
@@ -5,6 +5,7 @@ import (
"bom_server/internal/model"
"encoding/json"
"errors"
"fmt"
es
"gopkg.in/olivere/elastic.v5"
"strconv"
)
...
...
@@ -45,6 +46,12 @@ func UpdateNoMatchBomItem(bomItems []model.BomItem) (err error) {
if
err
!=
nil
{
return
}
matchingDelStatus
:=
2
err
=
model
.
Db
.
Table
(
"lie_bom_item_matching_"
+
tableEnd
)
.
Where
(
"bom_item_id IN (?)"
,
updateIdList
)
.
Updates
(
map
[
string
]
interface
{}{
"status"
:
matchingDelStatus
})
.
Error
if
err
!=
nil
{
return
}
return
nil
}
...
...
@@ -81,12 +88,17 @@ func UpdateBomItem(bomId, bomItemId int) (err error) {
if
err
!=
nil
{
return
}
err
=
UpdateGoodsData
(
goodsMapList
)
fmt
.
Println
(
goodsMapList
)
if
len
(
goodsMapList
)
==
0
{
err
=
UpdateNoMatchBomItem
(
bomItems
)
if
err
!=
nil
{
return
}
}
else
{
err
=
UpdateGoodsData
(
goodsMapList
)
if
err
!=
nil
{
return
}
}
return
}
internal/logic/bom_matching.go
View file @
6d55a733
...
...
@@ -33,7 +33,10 @@ func BatchSaveMatchings(bomId int, matchingList []model.BomItemMatching) (err er
tableEnd
:=
string
(
bomIdStr
[
len
(
bomIdStr
)
-
1
])
tableName
:=
"lie_bom_item_matching_"
+
tableEnd
var
isBuyBomItemIdList
,
noBuyBomItemIdList
[]
int
for
_
,
matching
:=
range
matchingList
{
for
k
,
matching
:=
range
matchingList
{
if
k
==
1
||
k
==
2
||
k
==
3
{
time
.
Sleep
(
2
*
time
.
Second
)
}
//先去数据库查询是否存在该记录,有的话修改,没有就新增
var
match
model
.
BomItemMatching
model
.
Db
.
Table
(
tableName
)
.
Where
(
"bom_item_id = ?"
,
matching
.
BomItemID
)
.
First
(
&
match
)
...
...
internal/logic/match.go
View file @
6d55a733
...
...
@@ -7,7 +7,7 @@ import (
"context"
"encoding/json"
"errors"
"
fmt
"
"
github.com/prometheus/common/log
"
es
"gopkg.in/olivere/elastic.v5"
"math"
"regexp"
...
...
@@ -53,7 +53,7 @@ func MatchGoods(message model.BomMessage) (err error) {
}
go
func
()
{
if
err
:=
SearchGoods
(
bomId
,
bomData
,
message
.
DeliveryType
,
message
.
Sort
,
&
wg
);
err
!=
nil
{
fmt
.
Println
(
err
)
log
.
Error
(
err
)
}
}()
}
...
...
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