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
fa6e2fd3
authored
May 28, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
优化
parent
3c0b0a6b
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
30 deletions
cmd/cmd.exe~
cmd/queue/bom.go
conf/config_production.ini
internal/logic/bom.go
internal/logic/bom_item.go
internal/service/oss.go
server/http/bom_item.go
server/http/main.go
cmd/cmd.exe~
View file @
fa6e2fd3
The file could not be displayed because it is too large.
cmd/queue/bom.go
View file @
fa6e2fd3
...
...
@@ -14,16 +14,16 @@ type RecvPro struct {
}
func
init
()
{
//
queueExchange := rabbitmq.QueueExchange{
//
"bom_match",
//
"bom_match",
//
"bom",
//
"direct",
//
"amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
//
}
//
//str := `{"bom_id":141,"delivery_type":1,"sort_type
":1}`
//
rabbitmq.Send(queueExchange, str)
queueExchange
:=
rabbitmq
.
QueueExchange
{
"bom_match"
,
"bom_match"
,
"bom"
,
"direct"
,
"amqp://huntadmin:jy2y2900@192.168.1.237:5672/"
,
}
str
:=
`{"bom_id":98,"delivery_type":1,"sort
":1}`
rabbitmq
.
Send
(
queueExchange
,
str
)
}
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
(
err
error
)
{
...
...
conf/config_production.ini
View file @
fa6e2fd3
...
...
@@ -12,7 +12,8 @@ url = "amqp://huntadmin:jy2y2900@192.168.1.237:5672/"
[api]
base
=
http://192.168.2.232:40001
goods
=
http://192.168.2.232:60004
upload
=
http://api.liexin.net
upload
=
http://api.liexin.com/oss/upload
api_port
=
60010
[oss]
upload_key
=
fh6y5t4rr351d2c3bryi
...
...
@@ -22,4 +23,4 @@ push_url = http://192.168.1.237:1988/v1/push
[es]
url
=
http://192.168.2.232:9200
goods_index_name
=
future,rochester,tme,verical,element14,digikey,chip1stop,aipco,arrow,alliedelec,avnet,mouser,zhuanmai,peigenesis,powell,rs,buerklin,liexin_ziying
\ No newline at end of file
goods_index_name
=
future,rochester,tme,verical,element14,digikey,chip1stop,aipco,arrow,alliedelec,avnet,mouser,peigenesis,powell,rs,buerklin
\ No newline at end of file
internal/logic/bom.go
View file @
fa6e2fd3
...
...
@@ -2,16 +2,11 @@ package logic
import
(
"bom_server/internal/model"
"fmt"
)
//根据bom_id查出bom表信息
func
GetBomInfo
(
bomId
int
)
(
bom
model
.
Bom
)
{
err
:=
model
.
Db
.
Where
(
"bom_id = ?"
,
bomId
)
.
First
(
&
bom
)
.
Error
if
err
!=
nil
{
fmt
.
Println
(
err
)
}
fmt
.
Println
(
err
)
model
.
Db
.
Where
(
"bom_id = ?"
,
bomId
)
.
First
(
&
bom
)
return
bom
}
...
...
internal/logic/bom_item.go
View file @
fa6e2fd3
...
...
@@ -4,7 +4,7 @@ import (
"bom_server/configs"
"bom_server/internal/model"
"encoding/json"
"
fmt
"
"
errors
"
es
"gopkg.in/olivere/elastic.v5"
"strconv"
)
...
...
@@ -58,6 +58,9 @@ func UpdateBomItem(bomId, bomItemId int) (err error) {
//先去查主表的信息
bom
:=
GetBomInfo
(
bomId
)
bomItem
:=
GetBomItem
(
bomId
,
bomItemId
)
if
bom
.
BomID
==
0
||
bomItem
.
BomID
==
0
{
return
errors
.
New
(
"该bom单不存在商品"
)
}
var
bomItems
[]
model
.
BomItem
bomItems
=
append
(
bomItems
,
bomItem
)
//获取排序条件
...
...
@@ -68,15 +71,11 @@ func UpdateBomItem(bomId, bomItemId int) (err error) {
return
err
}
}
if
len
(
bomItems
)
==
0
{
return
}
client
,
err
:=
es
.
NewClient
(
es
.
SetURL
(
configs
.
ESSetting
.
Url
))
if
err
!=
nil
{
panic
(
err
)
return
err
}
defer
client
.
Stop
()
fmt
.
Println
(
bomItems
[
0
]
.
BomID
)
//直接模糊匹配
goodsMapList
,
err
:=
getUpdateGoodsData
(
bomId
,
bomItems
,
where
.
DeliveryType
,
where
.
Sort
,
client
,
false
)
if
err
!=
nil
{
...
...
internal/service/oss.go
View file @
fa6e2fd3
...
...
@@ -23,7 +23,6 @@ func UploadToOss(path, fileType string) (ossPath string, err error) {
}
url
:=
configs
.
ApiSetting
.
Upload
uploadKey
:=
configs
.
OssSetting
.
UploadKey
fmt
.
Println
(
uploadKey
)
now
:=
time
.
Now
()
.
Unix
()
nowStr
:=
strconv
.
Itoa
(
int
(
now
))
params
:=
req
.
Param
{
...
...
server/http/bom_item.go
View file @
fa6e2fd3
...
...
@@ -3,7 +3,6 @@ package http
import
(
"bom_server/internal/common"
"bom_server/internal/logic"
"fmt"
"github.com/gin-gonic/gin"
"strconv"
)
...
...
@@ -12,7 +11,6 @@ import (
func
UpdateBomItem
(
c
*
gin
.
Context
)
{
bomItemIdStr
:=
c
.
PostForm
(
"bom_item_id"
)
bomIdStr
:=
c
.
PostForm
(
"bom_id"
)
fmt
.
Println
(
bomIdStr
,
bomItemIdStr
)
bomItemId
,
_
:=
strconv
.
Atoi
(
bomItemIdStr
)
bomId
,
_
:=
strconv
.
Atoi
(
bomIdStr
)
err
:=
logic
.
UpdateBomItem
(
bomId
,
bomItemId
)
...
...
server/http/main.go
View file @
fa6e2fd3
...
...
@@ -9,8 +9,6 @@ import (
func
InitRouter
()
*
gin
.
Engine
{
router
:=
gin
.
Default
()
router
.
Use
(
gin
.
Logger
())
router
.
Use
(
gin
.
Recovery
())
router
.
POST
(
"/bom/export"
,
Export
)
router
.
POST
(
"/bom_matching/refresh"
,
RefreshBomMatchingGoods
)
router
.
POST
(
"/bom_matching/update"
,
UpdateBomMatching
)
...
...
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