Commit fdaedb67 by mushishixian

修复

parent fe3a7b9d
......@@ -128,7 +128,11 @@ func SyncErpAuditStatus(syncName, billId, json string) (err error) {
if err != nil {
return
}
return CheckBillDataRequest(syncName, billId, res)
if syncName == "in_store" {
return CheckBillDataRequest(syncName, billId, res)
}else{
return CheckOutStoreBillDataRequest(syncName, billId, res)
}
}
//检查出入库单申请同步请求的情况
......@@ -164,6 +168,39 @@ func CheckBillDataRequest(syncName, billId string, res *gosoap.Response) (err er
return errors.New("金蝶返回响应格式无法识别")
}
//检查出入库单申请同步请求的情况
func CheckOutStoreBillDataRequest(syncName, billId string, res *gosoap.Response) (err error) {
doc := etree.NewDocument()
if err = doc.ReadFromBytes(res.Body); err != nil {
return
}
//没有这个xml节点代表金蝶报错了
root := doc.SelectElement("ns1:synOutWarehousAuditResponse")
if root == nil {
return errors.New(string(res.Body))
}
result := root.SelectElement("synOutWarehousAuditReturn")
if result != nil {
var responseData map[string]string
json.Unmarshal([]byte(result.Text()), &responseData)
for key, value := range responseData {
//金蝶判断成功的标志
if key == "0000" {
if syncName == "in_store" {
return logic.SyncInStoreErpAuditSuccess(billId)
} else {
return logic.SyncOutStoreErpAuditSuccess(billId)
}
}
//金额判断失败的标志
if key == "4444" {
return errors.New("金蝶返回失败,失败信息为:" + value)
}
}
}
return errors.New("金蝶返回响应格式无法识别")
}
func (t *RecvPro) FailAction(dataByte []byte) error {
service.SendDingTalkRobotToApi(fmt.Sprintf("存在尝试3次都同步失败的审核队列,队列信息为:%s", string(dataByte)))
return nil
......
......@@ -7,7 +7,7 @@ import (
)
func main() () {
message := `{"SyncName":"out_store","Data":{"erp_store_id":"eRoPxET5QsGpiG\/+k153z++cpps=","box_number":1,"pallet_number":1,"detail":[{"erp_entry_sn":"AJ6EYRbSSICvCxd\/CZeciMLaWpc=","number":"60.0000","box_id":"117","pallet_id":44}]}}`
message := `{"SyncName":"out_store","Data":{"erp_store_id":"HZz+KziKSha3qvk\/h22l9e+cpps=","box_number":1,"pallet_number":1,"detail":[{"erp_entry_sn":"6SaHDGNFTWKuhg9sRtzKi8LaWpc=","number":"10.0000","box_id":"126","pallet_id":35}]}}`
fmt.Println(message)
queueExchange := rabbitmq.QueueExchange{
"scm_store_audit_status",
......
package configs
import (
"flag"
"fmt"
"gopkg.in/ini.v1"
"os"
)
var Cfg *ini.File
//func init() {
// var err error
// Cfg, err = ini.Load("conf/config.ini")
// if err != nil {
// fmt.Printf("Fail to read file: %v", err)
// os.Exit(1)
// }
//}
func Setup(path string){
func Setup(path string) {
var err error
//Cfg, err = ini.Load("conf/config.ini")
Cfg, err = ini.Load(path)
if err != nil {
fmt.Printf("Fail to read file: %v", err)
os.Exit(1)
}
SetUpOne()
SetUpTwo()
SetUpThree()
}
func GetConfig(section, name string) string {
return Cfg.Section(section).Key(name).String()
}
func GetPath(){
var path string
flag.StringVar(&path, "config", "./conf/config.ini", "./conf/config.ini")
flag.Parse()
}
......@@ -18,7 +18,7 @@ var ErpLoginStatusApi string
var OpenFalconPushUrl string
func init() {
func SetUpOne() {
BasicApiUrl = GetConfig("api", "base")
OutStoreApiUrl = GetConfig("api", "out_store")
InStoreApiUrl = GetConfig("api", "in_store")
......
......@@ -8,7 +8,7 @@ var ErpLanguage string
var ErpDbType string
var ErpAuthPattern string
func init() {
func SetUpTwo() {
ErpUserName = GetConfig("erp", "userName")
ErpPassword = GetConfig("erp", "password")
ErpSlnName = GetConfig("erp", "slnName")
......
......@@ -3,6 +3,6 @@ package configs
//const RABBITMQDSN = "amqp://huntadmin:jy2y2900@192.168.1.237:5672/"
var RABBITMQDSN string
func init() {
func SetUpThree() {
RABBITMQDSN = GetConfig("rabbitmq", "url")
}
package main
import (
"flag"
"github.com/imroc/req"
"scm_server/cmd/queue/sync_audit_status"
"scm_server/cmd/queue/sync_customer"
"scm_server/cmd/queue/sync_goods"
......@@ -10,8 +12,6 @@ import (
"scm_server/cmd/queue/sync_supplier"
"scm_server/configs"
"time"
"github.com/imroc/req"
)
type PayloadItem struct {
......@@ -52,17 +52,16 @@ func pushAlive() {
}
}
//var (
// ConfFile string // 配置文件路径
//)
func init() {
// main.go -config ./conf/config.ini
//func init() {
// // master -config ./conf/config.ini
// flag.StringVar(&ConfFile, "config", "./conf/config.ini", "./conf/config.ini")
// flag.Parse()
//}
}
func main() {
var path string
flag.StringVar(&path, "config", "./conf/config.ini", "./conf/config.ini")
flag.Parse()
configs.Setup(path)
go sync_customer.Sync()
go sync_supplier.Sync()
go sync_goods.Sync()
......
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