Commit 81d5112c by mushishixian

优化代码

parent 3531271e
package main
import (
"scm_server/internal/service"
"scm_server/cmd/queue/sync_status/product"
)
func main() {
service.SendDingTalkRobotToApi("xxx")
product.SyncErpStatus("outStore","MD5CPnEMQziFtwJKXAHx7++cpps=")
}
......@@ -30,7 +30,6 @@ func init() {
}
func (t *RecvPro) Consumer(dataByte []byte) (err error) {
fmt.Println(string(dataByte))
var (
message QueueAuditStatus
auditStatusLog model.AuditStatusLog
......@@ -40,7 +39,6 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
goto ERR
}
//得到message以后,去请求金蝶的接口
fmt.Println("请求金蝶接口")
if err = SyncErpAuditStatus(message.SyncName, message.ErpId); err != nil {
goto ERR
}
......@@ -131,7 +129,6 @@ func SyncErpAuditStatus(syncName, uniqueId string) (err error) {
//检查出入库单申请同步请求的情况
func CheckBillDataRequest(res *gosoap.Response) (err error) {
doc := etree.NewDocument()
fmt.Println(string(res.Body))
if err = doc.ReadFromBytes(res.Body); err != nil {
return
}
......
......@@ -169,5 +169,5 @@ func Sync() {
"store",
"direct",
configs.RABBITMQDSN,
}, t, 3)
}, t, 1)
}
......@@ -56,7 +56,6 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
operateType string
messageData []byte
)
fmt.Println(string(dataByte))
//先去转换队列消息的json,如果失败,记录起来
if err = json.Unmarshal(dataByte, &message); err != nil {
goto ERR
......
......@@ -120,7 +120,7 @@ func SyncErpDataStatus(syncName, uniqueId string) (err error) {
apiMethod = "synErpInventoryStatus"
break
default:
return errors.New("同步金蝶状态出现非法的同步类型" + syncName)
return errors.New("同步金蝶状态出现非法的同步类型 : " + syncName)
}
soap, err = gosoap.SoapClient(apiUrl)
if err != nil {
......@@ -197,6 +197,7 @@ func CheckBillDataRequest(syncName, uniqueId string, res *gosoap.Response) (err
for key, value := range responseData {
//金蝶判断成功的标志
if key == "0000" {
fmt.Println("ok")
//成功还要去修改记录表
switch syncName {
case "inStore":
......@@ -208,6 +209,7 @@ func CheckBillDataRequest(syncName, uniqueId string, res *gosoap.Response) (err
}
//金额判断失败的标志
if key == "4444" {
fmt.Println("fail")
return errors.New("金蝶返回失败,失败信息为:" + value)
}
}
......
......@@ -6,7 +6,6 @@ import (
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/tealeg/xlsx"
"scm_server/configs"
"scm_server/internal/logic"
"scm_server/internal/model"
"scm_server/internal/service"
"sync"
......@@ -57,9 +56,9 @@ func Import(wg *sync.WaitGroup) {
if goods.BrandName == "" {
continue
}
if logic.CheckGoodsExist(goods.ErpId) {
continue
}
//if logic.CheckGoodsSyncStatus(goods.ErpId) {
// continue
//}
message := make(map[string]interface{})
message = map[string]interface{}{
"type": "save",
......@@ -70,7 +69,6 @@ func Import(wg *sync.WaitGroup) {
"FModel": goods.GoodsName,
},
}
fmt.Println(message)
data, err := json.Marshal(message)
if err != nil {
fmt.Println(err)
......
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