Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_scm_wms_sync
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
81d5112c
authored
May 08, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
优化代码
parent
3531271e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
9 additions
and
13 deletions
cmd/main.go
cmd/queue/sync_audit_status/main.go
cmd/queue/sync_goods/main.go
cmd/queue/sync_out_store/main.go
cmd/queue/sync_status/main.go
cmd/source/goods/goods.go
cmd/main.go
View file @
81d5112c
package
main
package
main
import
(
import
(
"scm_server/
internal/service
"
"scm_server/
cmd/queue/sync_status/product
"
)
)
func
main
()
{
func
main
()
{
service
.
SendDingTalkRobotToApi
(
"xxx
"
)
product
.
SyncErpStatus
(
"outStore"
,
"MD5CPnEMQziFtwJKXAHx7++cpps=
"
)
}
}
cmd/queue/sync_audit_status/main.go
View file @
81d5112c
...
@@ -30,7 +30,6 @@ func init() {
...
@@ -30,7 +30,6 @@ func init() {
}
}
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
(
err
error
)
{
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
(
err
error
)
{
fmt
.
Println
(
string
(
dataByte
))
var
(
var
(
message
QueueAuditStatus
message
QueueAuditStatus
auditStatusLog
model
.
AuditStatusLog
auditStatusLog
model
.
AuditStatusLog
...
@@ -40,7 +39,6 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
...
@@ -40,7 +39,6 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
goto
ERR
goto
ERR
}
}
//得到message以后,去请求金蝶的接口
//得到message以后,去请求金蝶的接口
fmt
.
Println
(
"请求金蝶接口"
)
if
err
=
SyncErpAuditStatus
(
message
.
SyncName
,
message
.
ErpId
);
err
!=
nil
{
if
err
=
SyncErpAuditStatus
(
message
.
SyncName
,
message
.
ErpId
);
err
!=
nil
{
goto
ERR
goto
ERR
}
}
...
@@ -131,7 +129,6 @@ func SyncErpAuditStatus(syncName, uniqueId string) (err error) {
...
@@ -131,7 +129,6 @@ func SyncErpAuditStatus(syncName, uniqueId string) (err error) {
//检查出入库单申请同步请求的情况
//检查出入库单申请同步请求的情况
func
CheckBillDataRequest
(
res
*
gosoap
.
Response
)
(
err
error
)
{
func
CheckBillDataRequest
(
res
*
gosoap
.
Response
)
(
err
error
)
{
doc
:=
etree
.
NewDocument
()
doc
:=
etree
.
NewDocument
()
fmt
.
Println
(
string
(
res
.
Body
))
if
err
=
doc
.
ReadFromBytes
(
res
.
Body
);
err
!=
nil
{
if
err
=
doc
.
ReadFromBytes
(
res
.
Body
);
err
!=
nil
{
return
return
}
}
...
...
cmd/queue/sync_goods/main.go
View file @
81d5112c
...
@@ -169,5 +169,5 @@ func Sync() {
...
@@ -169,5 +169,5 @@ func Sync() {
"store"
,
"store"
,
"direct"
,
"direct"
,
configs
.
RABBITMQDSN
,
configs
.
RABBITMQDSN
,
},
t
,
3
)
},
t
,
1
)
}
}
cmd/queue/sync_out_store/main.go
View file @
81d5112c
...
@@ -56,7 +56,6 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
...
@@ -56,7 +56,6 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
operateType
string
operateType
string
messageData
[]
byte
messageData
[]
byte
)
)
fmt
.
Println
(
string
(
dataByte
))
//先去转换队列消息的json,如果失败,记录起来
//先去转换队列消息的json,如果失败,记录起来
if
err
=
json
.
Unmarshal
(
dataByte
,
&
message
);
err
!=
nil
{
if
err
=
json
.
Unmarshal
(
dataByte
,
&
message
);
err
!=
nil
{
goto
ERR
goto
ERR
...
...
cmd/queue/sync_status/main.go
View file @
81d5112c
...
@@ -120,7 +120,7 @@ func SyncErpDataStatus(syncName, uniqueId string) (err error) {
...
@@ -120,7 +120,7 @@ func SyncErpDataStatus(syncName, uniqueId string) (err error) {
apiMethod
=
"synErpInventoryStatus"
apiMethod
=
"synErpInventoryStatus"
break
break
default
:
default
:
return
errors
.
New
(
"同步金蝶状态出现非法的同步类型"
+
syncName
)
return
errors
.
New
(
"同步金蝶状态出现非法的同步类型
:
"
+
syncName
)
}
}
soap
,
err
=
gosoap
.
SoapClient
(
apiUrl
)
soap
,
err
=
gosoap
.
SoapClient
(
apiUrl
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -197,6 +197,7 @@ func CheckBillDataRequest(syncName, uniqueId string, res *gosoap.Response) (err
...
@@ -197,6 +197,7 @@ func CheckBillDataRequest(syncName, uniqueId string, res *gosoap.Response) (err
for
key
,
value
:=
range
responseData
{
for
key
,
value
:=
range
responseData
{
//金蝶判断成功的标志
//金蝶判断成功的标志
if
key
==
"0000"
{
if
key
==
"0000"
{
fmt
.
Println
(
"ok"
)
//成功还要去修改记录表
//成功还要去修改记录表
switch
syncName
{
switch
syncName
{
case
"inStore"
:
case
"inStore"
:
...
@@ -208,6 +209,7 @@ func CheckBillDataRequest(syncName, uniqueId string, res *gosoap.Response) (err
...
@@ -208,6 +209,7 @@ func CheckBillDataRequest(syncName, uniqueId string, res *gosoap.Response) (err
}
}
//金额判断失败的标志
//金额判断失败的标志
if
key
==
"4444"
{
if
key
==
"4444"
{
fmt
.
Println
(
"fail"
)
return
errors
.
New
(
"金蝶返回失败,失败信息为:"
+
value
)
return
errors
.
New
(
"金蝶返回失败,失败信息为:"
+
value
)
}
}
}
}
...
...
cmd/source/goods/goods.go
View file @
81d5112c
...
@@ -6,7 +6,6 @@ import (
...
@@ -6,7 +6,6 @@ import (
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/tealeg/xlsx"
"github.com/tealeg/xlsx"
"scm_server/configs"
"scm_server/configs"
"scm_server/internal/logic"
"scm_server/internal/model"
"scm_server/internal/model"
"scm_server/internal/service"
"scm_server/internal/service"
"sync"
"sync"
...
@@ -57,9 +56,9 @@ func Import(wg *sync.WaitGroup) {
...
@@ -57,9 +56,9 @@ func Import(wg *sync.WaitGroup) {
if
goods
.
BrandName
==
""
{
if
goods
.
BrandName
==
""
{
continue
continue
}
}
if
logic
.
CheckGoodsExist
(
goods
.
ErpId
)
{
//if logic.CheckGoodsSyncStatus
(goods.ErpId) {
continue
//
continue
}
//
}
message
:=
make
(
map
[
string
]
interface
{})
message
:=
make
(
map
[
string
]
interface
{})
message
=
map
[
string
]
interface
{}{
message
=
map
[
string
]
interface
{}{
"type"
:
"save"
,
"type"
:
"save"
,
...
@@ -70,7 +69,6 @@ func Import(wg *sync.WaitGroup) {
...
@@ -70,7 +69,6 @@ func Import(wg *sync.WaitGroup) {
"FModel"
:
goods
.
GoodsName
,
"FModel"
:
goods
.
GoodsName
,
},
},
}
}
fmt
.
Println
(
message
)
data
,
err
:=
json
.
Marshal
(
message
)
data
,
err
:=
json
.
Marshal
(
message
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
err
)
fmt
.
Println
(
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