Commit 87846042 by mushishixian

优化代码

parent 8ab52c7b
...@@ -25,9 +25,9 @@ type QueueAuditData struct { ...@@ -25,9 +25,9 @@ type QueueAuditData struct {
type StoreData struct { type StoreData struct {
ErpStoreId string `json:"erp_store_id"` ErpStoreId string `json:"erp_store_id"`
BoxNumber int `json:"box_number"` BoxNumber int `json:"box_number"`
BoxWeight string `json:"box_weight"` BoxWeight string `json:"box_weight"`
PalletNumber int `json:"pallet_number"` PalletNumber int `json:"pallet_number"`
PalletWeight string `json:"pallet_weight"` PalletWeight string `json:"pallet_weight"`
Detail []StoreGoods `json:"detail"` Detail []StoreGoods `json:"detail"`
} }
......
...@@ -53,40 +53,8 @@ ERR: ...@@ -53,40 +53,8 @@ ERR:
return nil 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) { func SyncErpDataStatus(syncName, uniqueId string) (err error) {
if err = LoginErp(); err != nil { if err = service.LoginErp(); err != nil {
return return
} }
var ( var (
......
...@@ -17,3 +17,12 @@ erp_login_status = http://192.168.2.253:6888/ormrpc/services/EASLogin?wsdl ...@@ -17,3 +17,12 @@ erp_login_status = http://192.168.2.253:6888/ormrpc/services/EASLogin?wsdl
[falcon] [falcon]
push_url = http://192.168.1.237:1988/v1/push 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) { ...@@ -13,13 +13,13 @@ func LoginErp() (err error) {
return return
} }
params := gosoap.ArrayParams{ params := gosoap.ArrayParams{
{"userName", "WBYH"}, {"userName", configs.ErpUserName},
{"password", "123456"}, {"password", configs.ErpPassword},
{"slnName", "eas"}, {"slnName", configs.ErpSlnName},
{"dcName", "demo"}, {"dcName", configs.ErpDcName},
{"language", "L2"}, {"language", configs.ErpLanguage},
{"dbType", "1"}, {"dbType", configs.ErpDbType},
{"authPattern", "BaseDB"}, {"authPattern", configs.ErpAuthPattern},
} }
res, err := soap.Call("login", params) 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