Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
scm_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
3a982cd6
authored
Apr 30, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
提取配置文件
parent
48f0d1f4
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
74 additions
and
107 deletions
back/supplier_back.go
cmd/queue/sync_in_store/main.go
cmd/queue/sync_out_store/main.go
conf/config.ini
go.mod
go.sum
internal/logic/in_store.go
internal/logic/out_store.go
back/supplier_back.go
deleted
100644 → 0
View file @
48f0d1f4
package
supplier
import
(
"fmt"
"github.com/imroc/req"
"github.com/tealeg/xlsx"
"scm_server/configs"
"scm_server/internal/common"
"scm_server/internal/logic"
"scm_server/internal/model"
)
//导入委托方的信息(excel导入)
func
Import
()
{
var
(
excelFileName
string
xlFile
*
xlsx
.
File
err
error
supplier
model
.
Supplier
)
excelFileName
=
"./cmd/source/data/supplier.xlsx"
xlFile
,
err
=
xlsx
.
OpenFile
(
excelFileName
)
if
err
!=
nil
{
fmt
.
Printf
(
"open failed: %s
\n
"
,
err
)
}
for
_
,
sheet
:=
range
xlFile
.
Sheets
{
for
key
,
row
:=
range
sheet
.
Rows
{
if
key
>
0
{
supplier
.
ErpId
=
row
.
Cells
[
0
]
.
String
()
supplier
.
ErpSupplierCode
=
row
.
Cells
[
1
]
.
String
()
supplier
.
Name
=
row
.
Cells
[
2
]
.
String
()
//先去查询是否存在,不存在才去插入
if
logic
.
CheckSupplierExist
(
supplier
.
ErpId
)
{
continue
}
if
err
=
logic
.
InsertSupplier
(
supplier
);
err
!=
nil
{
fmt
.
Println
(
err
)
continue
}
//插入成功后还要去请求后端接口同步数据
if
!
SyncSupplierData
(
supplier
)
{
continue
}
}
}
}
}
//同步数据
func
SyncSupplierData
(
supplier
model
.
Supplier
)
bool
{
var
(
resp
*
req
.
Resp
url
string
respData
common
.
Response
err
error
)
param
:=
req
.
Param
{
"erp_supplier_sn"
:
supplier
.
ErpSupplierCode
,
"supplier_name"
:
supplier
.
Name
,
"erp_supplier_id"
:
supplier
.
ErpId
,
"admin_name"
:
"系统"
,
"admin_id"
:
1
,
}
url
=
configs
.
BasicApiUrl
+
"/basic/api/ApiInsertSupplierInfo"
req
.
Debug
=
true
resp
,
err
=
req
.
Post
(
url
,
param
)
if
err
!=
nil
{
logSyncErrorToDataBase
(
supplier
.
ErpId
,
err
.
Error
())
return
false
}
if
err
=
resp
.
ToJSON
(
&
respData
);
err
!=
nil
{
logSyncErrorToDataBase
(
supplier
.
ErpId
,
err
.
Error
())
return
false
}
if
respData
.
Errcode
!=
101100
{
logSyncErrorToDataBase
(
supplier
.
ErpId
,
respData
.
Errmsg
)
return
false
}
//都没问题,代表后端那边已经成功修改,修改同步表的状态
if
err
=
logic
.
SyncSupplierSuccess
(
supplier
.
ErpId
);
err
!=
nil
{
fmt
.
Println
(
err
)
}
return
true
}
func
logSyncErrorToDataBase
(
erpId
,
syncError
string
)
{
var
err
error
//请求失败的话,将原因存起来
if
err
=
logic
.
WriteSupplierSyncError
(
erpId
,
syncError
);
err
!=
nil
{
//写数据失败,记录到日志
fmt
.
Println
(
err
)
}
}
cmd/queue/sync_in_store/main.go
View file @
3a982cd6
...
...
@@ -77,8 +77,8 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
goto
ERR
}
inStore
.
QueueMessage
=
string
(
messageData
)
//先去查询是否存在
,不存在才去插入
if
!
logic
.
CheckInStore
Exist
(
inStore
.
BillId
)
{
//先去查询是否存在
已经同步完成的记录
if
!
logic
.
CheckInStore
SyncStatus
(
inStore
.
BillId
)
{
operateType
=
"insert"
if
err
=
logic
.
InsertInStore
(
inStore
);
err
!=
nil
{
goto
ERR
...
...
@@ -100,10 +100,13 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
err
=
errors
.
New
(
"同步入货单出现不存在的操作类型"
+
operateType
)
goto
ERR
}
//没有操作类型,代表的是已经后端同步成功过一次的了,直接去请求金蝶同步状态即可
if
operateType
!=
""
{
//操作成功后还要去请求后端接口同步数据
if
err
=
SyncInStoreData
(
operateType
,
message
);
err
!=
nil
{
goto
ERR
}
}
fmt
.
Println
(
"同步成功,开始发送金蝶状态同步"
)
if
err
=
product
.
SyncErpStatus
(
"inStore"
,
inStore
.
BillId
);
err
!=
nil
{
goto
ERR
...
...
cmd/queue/sync_out_store/main.go
View file @
3a982cd6
...
...
@@ -79,7 +79,7 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
}
outStore
.
QueueMessage
=
string
(
messageData
)
//先去查询是否存在,不存在才去插入,已经存在即是修改
if
!
logic
.
CheckOutStore
Exist
(
outStore
.
BillId
)
{
if
!
logic
.
CheckOutStore
SyncStatus
(
outStore
.
BillId
)
{
operateType
=
"insert"
if
err
=
logic
.
InsertOutStore
(
outStore
);
err
!=
nil
{
goto
ERR
...
...
@@ -101,10 +101,13 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
err
=
errors
.
New
(
"同步出货单出现不存在的操作类型"
+
operateType
)
goto
ERR
}
//没有操作类型,代表的是已经后端同步成功过一次的了,直接去请求金蝶同步状态即可
if
operateType
!=
""
{
//操作成功后还要去请求后端接口同步数据
if
err
=
SyncOutStoreData
(
operateType
,
message
);
err
!=
nil
{
goto
ERR
}
}
fmt
.
Println
(
"同步成功,开始发送金蝶状态同步"
)
if
err
=
product
.
SyncErpStatus
(
"outStore"
,
outStore
.
BillId
);
err
!=
nil
{
goto
ERR
...
...
conf/config.ini
0 → 100644
View file @
3a982cd6
[mysql]
username
=
root
password
=
root
host
=
192.168.2.250
database
=
lie_scm_sync
[rabbitmq]
url
=
"amqp://huntadmin:jy2y2900@192.168.1.237:5672/"
[api]
base
=
http://192.168.2.113:40001
out_store
=
http://192.168.2.179:40003
in_store
=
http://192.168.2.239:40004"
erp_sync_base_data_status
=
http://192.168.2.253:6888/ormrpc/services/WSInventoryManagementFacade?wsdl
erp_sync_bill_status
=
http://192.168.2.253:6888/ormrpc/services/WSInventoryManagementFacade?wsdl
erp_login_status
=
http://192.168.2.253:6888/ormrpc/services/EASLogin?wsdl
go.mod
View file @
3a982cd6
...
...
@@ -5,13 +5,13 @@ go 1.13
require (
github.com/beevik/etree v1.1.0
github.com/go-kratos/kratos v0.4.2
github.com/hooklift/gowsdl v0.3.2-0.20200216020636-7a3e6bce010b
github.com/ichunt2019/go-rabbitmq v1.0.1
github.com/imroc/req v0.3.0
github.com/jmoiron/sqlx v1.2.0
github.com/mushishixian/gosoap v1.2.1-0.20200424081802-b11347c911bc
github.com/pkg/errors v0.9.1
github.com/s
yyongx/php2go v0.9.4
github.com/s
martystreets/goconvey v1.6.4 // indirect
github.com/tealeg/xlsx v1.0.5
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd // indirect
gopkg.in/ini.v1 v1.55.0
)
go.sum
View file @
3a982cd6
...
...
@@ -94,6 +94,8 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
...
...
@@ -102,9 +104,8 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hooklift/gowsdl v0.3.2-0.20200216020636-7a3e6bce010b h1:rNDZgrP4P3Fm48SLvy6n1+G9l8rfNxGZuJho+0sg4mM=
github.com/hooklift/gowsdl v0.3.2-0.20200216020636-7a3e6bce010b/go.mod h1:TYmt7jpe3F5zLlMtKGetjHLwUBIAF5JCd+NYq+mQ/Zk=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ichunt2019/go-rabbitmq v1.0.1 h1:qHhpGm9v7jnhSBo3f3viX+BSky9yugp9lCSV03eYsF4=
github.com/ichunt2019/go-rabbitmq v1.0.1/go.mod h1:TQsZ1XWULyvm4UwpYHwNPtOXYbuVvLLI0GM7g/BRy68=
...
...
@@ -119,6 +120,8 @@ github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqx
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
...
...
@@ -140,6 +143,7 @@ github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdA
github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
...
...
@@ -152,6 +156,7 @@ github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOq
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
...
...
@@ -171,6 +176,7 @@ github.com/openconfig/gnmi v0.0.0-20190823184014-89b2bf29312c/go.mod h1:t+O9It+L
github.com/openconfig/reference v0.0.0-20190727015836-8dfd928c9696/go.mod h1:ym2A+zigScwkSEb/cVQB0/ZMpU3rqiH6X7WRRsxgOGw=
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/otokaze/mock v0.0.0-20190125081256-8282b7a7c7c3/go.mod h1:pLR8n2aimFxvvDJ6n8JuQWthMGezCYMjuhlaTjPTZf0=
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/philchia/agollo v0.0.0-20190728085453-a95533fccea3 h1:e/WwwXpp+h9CtbiwSdDxrgq6ymvrvLH/P+kS+8qq4v8=
github.com/philchia/agollo v0.0.0-20190728085453-a95533fccea3/go.mod h1:EXNdWdQkS+QBi0nb/Xm+sBBuQ1PM7/NIPr1JDzOlt8A=
...
...
@@ -215,15 +221,24 @@ github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBf
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94 h1:0ngsPmuP6XIjiFRNFYlvKwSr5zff2v+uPHaffZ6/M4k=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
...
...
@@ -235,8 +250,6 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/syyongx/php2go v0.9.4 h1:qUtETTHzqHzxZK8plkbkb0YawD8bpLpxNsbzHQmb22Y=
github.com/syyongx/php2go v0.9.4/go.mod h1:meN2eIhhUoxOd2nMxbpe8g6cFPXI5O9/UAAuz7oDdzw=
github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE=
github.com/tealeg/xlsx v1.0.5/go.mod h1:btRS8dz54TDnvKNosuAqxrM1QgN1udgk9O34bDCnORM=
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU=
...
...
@@ -328,6 +341,7 @@ golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
...
...
@@ -359,6 +373,8 @@ gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXa
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
gopkg.in/go-playground/validator.v9 v9.29.1 h1:SvGtYmN60a5CVKTOzMSyfzWDeZRxRuGvRQyEAKbw1xc=
gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
gopkg.in/ini.v1 v1.55.0 h1:E8yzL5unfpW3M6fz/eB7Cb5MQAYSZ7GKo4Qth+N2sgQ=
gopkg.in/ini.v1 v1.55.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo=
gopkg.in/jcmturner/dnsutils.v1 v1.0.1/go.mod h1:m3v+5svpVOhtFAP/wSz+yzh4Mc0Fg7eRhxkJMWSIz9Q=
gopkg.in/jcmturner/goidentity.v3 v3.0.0/go.mod h1:oG2kH0IvSYNIu80dVAyu/yoefjq1mNfM5bm88whjWx4=
...
...
internal/logic/in_store.go
View file @
3a982cd6
...
...
@@ -6,7 +6,9 @@ import (
"time"
)
const
CheckInStoreExistSql
=
"SELECT in_store_id FROM lie_in_store WHERE bill_id = ? AND sync_status = 1"
const
CheckInStoreExistSql
=
"SELECT in_store_id FROM lie_in_store WHERE bill_id = ?"
const
CheckInStoreSyncStatusSql
=
"SELECT sync_status FROM lie_in_store WHERE bill_id = ?"
const
InsertInStoreSql
=
"INSERT INTO `lie_in_store` (`queue_message`,`bill_id`,`add_time`) VALUES (?,?,?)"
...
...
@@ -25,15 +27,24 @@ func CheckInStoreExist(billId string) (exist bool) {
return
inStoreId
>
0
}
//获取后端同步状态
func
CheckInStoreSyncStatus
(
erpId
string
)
(
status
bool
)
{
var
statusInt
int
dao
.
GetDb
()
.
QueryRowx
(
CheckInStoreSyncStatusSql
,
erpId
)
.
Scan
(
&
statusInt
)
return
statusInt
>
0
}
//插入出库
func
InsertInStore
(
outStore
model
.
InStore
)
(
err
error
)
{
_
,
err
=
dao
.
GetDb
()
.
Exec
(
InsertInStoreSql
,
outStore
.
QueueMessage
,
outStore
.
BillId
,
time
.
Now
()
.
Unix
())
func
InsertInStore
(
inStore
model
.
InStore
)
(
err
error
)
{
if
!
CheckInStoreExist
(
inStore
.
BillId
)
{
_
,
err
=
dao
.
GetDb
()
.
Exec
(
InsertInStoreSql
,
inStore
.
QueueMessage
,
inStore
.
BillId
,
time
.
Now
()
.
Unix
())
}
return
}
//删除出库
func
DeleteInStore
(
out
Store
model
.
InStore
)
(
err
error
)
{
_
,
err
=
dao
.
GetDb
()
.
Exec
(
DeleteInStoreSql
,
outStore
.
Status
,
time
.
Now
()
.
Unix
(),
out
Store
.
BillId
)
func
DeleteInStore
(
in
Store
model
.
InStore
)
(
err
error
)
{
_
,
err
=
dao
.
GetDb
()
.
Exec
(
DeleteInStoreSql
,
inStore
.
Status
,
time
.
Now
()
.
Unix
(),
in
Store
.
BillId
)
return
}
...
...
internal/logic/out_store.go
View file @
3a982cd6
...
...
@@ -8,6 +8,8 @@ import (
const
CheckOutStoreExistSql
=
"SELECT out_store_id FROM lie_out_store WHERE bill_id = ?"
const
CheckOutStoreSyncStatusSql
=
"SELECT sync_status FROM lie_out_store WHERE bill_id = ?"
const
InsertOutStoreSql
=
"INSERT INTO `lie_out_store` (`queue_message`,`bill_id`,`add_time`) VALUES (?,?,?)"
const
DeleteOutStoreSql
=
"UPDATE `lie_out_store` SET `status` = ? , `update_time` = ? WHERE `bill_id` = ?"
...
...
@@ -25,9 +27,18 @@ func CheckOutStoreExist(erpId string) (exist bool) {
return
goodsId
>
0
}
//获取后端同步状态
func
CheckOutStoreSyncStatus
(
erpId
string
)
(
status
bool
)
{
var
statusInt
int
dao
.
GetDb
()
.
QueryRowx
(
CheckOutStoreSyncStatusSql
,
erpId
)
.
Scan
(
&
statusInt
)
return
statusInt
>
0
}
//插入出库
func
InsertOutStore
(
outStore
model
.
OutStore
)
(
err
error
)
{
if
!
CheckOutStoreExist
(
outStore
.
BillId
)
{
_
,
err
=
dao
.
GetDb
()
.
Exec
(
InsertOutStoreSql
,
outStore
.
QueueMessage
,
outStore
.
BillId
,
time
.
Now
()
.
Unix
())
}
return
}
...
...
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