Commit 87846042 by mushishixian

优化代码

parent 8ab52c7b
......@@ -25,9 +25,9 @@ type QueueAuditData struct {
type StoreData struct {
ErpStoreId string `json:"erp_store_id"`
BoxNumber int `json:"box_number"`
BoxWeight string `json:"box_weight"`
BoxWeight string `json:"box_weight"`
PalletNumber int `json:"pallet_number"`
PalletWeight string `json:"pallet_weight"`
PalletWeight string `json:"pallet_weight"`
Detail []StoreGoods `json:"detail"`
}
......
......@@ -53,40 +53,8 @@ ERR:
return nil
}
func LoginErp() (err error) {
soap, err := gosoap.SoapClient(configs.ErpLoginStatusApi)
if err != nil {
return
}
params := gosoap.ArrayParams{
{"userName", "WBYH"},
{"password", "123456"},
{"slnName", "eas"},
{"dcName", "demo"},
{"language", "L2"},
{"dbType", "1"},
{"authPattern", "BaseDB"},
}
res, err := soap.Call("login", params)
if err != nil {
return
}
doc := etree.NewDocument()
if err := doc.ReadFromBytes(res.Body); err != nil {
return err
}
root := doc.SelectElement("multiRef")
sessionId := root.SelectElement("sessionId").Text()
if sessionId != "" {
return
}
return errors.New(string(res.Body))
}
func SyncErpDataStatus(syncName, uniqueId string) (err error) {
if err = LoginErp(); err != nil {
if err = service.LoginErp(); err != nil {
return
}
var (
......
......@@ -17,3 +17,12 @@ erp_login_status = http://192.168.2.253:6888/ormrpc/services/EASLogin?wsdl
[falcon]
push_url = http://192.168.1.237:1988/v1/push
[erp]
userName = WBYH
password = 123456
slnName = eas
dcName = demo
language = L2
dbType = 1
authPattern = BaseDB
package configs
var ErpUserName string
var ErpPassword string
var ErpSlnName string
var ErpDcName string
var ErpLanguage string
var ErpDbType string
var ErpAuthPattern string
func init() {
ErpUserName = GetConfig("erp", "userName")
ErpPassword = GetConfig("erp", "password")
ErpSlnName = GetConfig("erp", "slnName")
ErpDcName = GetConfig("erp", "dcName")
ErpLanguage = GetConfig("erp", "language")
ErpDbType = GetConfig("erp", "dbType")
ErpAuthPattern = GetConfig("erp", "authPattern")
}
\ No newline at end of file
......@@ -13,13 +13,13 @@ func LoginErp() (err error) {
return
}
params := gosoap.ArrayParams{
{"userName", "WBYH"},
{"password", "123456"},
{"slnName", "eas"},
{"dcName", "demo"},
{"language", "L2"},
{"dbType", "1"},
{"authPattern", "BaseDB"},
{"userName", configs.ErpUserName},
{"password", configs.ErpPassword},
{"slnName", configs.ErpSlnName},
{"dcName", configs.ErpDcName},
{"language", configs.ErpLanguage},
{"dbType", configs.ErpDbType},
{"authPattern", configs.ErpAuthPattern},
}
res, err := soap.Call("login", params)
......
The file could not be displayed because it is too large.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment