Commit b237c424 by mushishixian

格式替换

parent 2e1f6f44
package main package main
import ( import (
"encoding/json"
"errors"
"fmt" "fmt"
"github.com/beevik/etree" "strings"
"github.com/mushishixian/gosoap"
"log"
) )
func main() { func main() {
fmt.Println(SyncBaseDataStatus()) temp:=`{\"type\":\"save\",\"date\":{\"FID\":\"UxasZFrOQGC+oCfTmVSNuUQJ5/A=\",\"FBrand\":\"3M\",\"FModel\":\"aabbddcc\",\"FGoods\":\"\u4E8C\u6781\u7BA1\"}}`
} temp = strings.ReplaceAll(temp,`\`,"")
fmt.Println(temp)
func LoginErp() bool { return
soap, err := gosoap.SoapClient("http://192.168.2.253:6888/ormrpc/services/EASLogin?wsdl")
if err != nil {
log.Fatalf("SoapClient error: %s", err)
}
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 {
log.Fatalf("Call error: %s", err)
}
doc := etree.NewDocument()
if err := doc.ReadFromBytes(res.Body); err != nil {
fmt.Println(err)
}
root := doc.SelectElement("multiRef")
sessionId := root.SelectElement("sessionId").Text()
if sessionId != "" {
return true
}
return false
}
func SyncBaseDataStatus() (err error) {
soap, err := gosoap.SoapClient("http://192.168.2.253:6888/ormrpc/services/WSInventoryManagementFacade?wsdl")
if err != nil {
return
}
params := gosoap.ArrayParams{
{"json", `{"FType":"material", "FID":"++Mhf5K+T9KTEE+bJhM9PEQJ5/A="}`},
//{"json", `{"FType":"material", "FID":"ET9WHFzYagYZf0="}`},
}
res, err := soap.Call("synRewriteErpBaseDataStatus", params)
if err != nil {
return
}
doc := etree.NewDocument()
if err = doc.ReadFromBytes(res.Body); err != nil {
return
}
//没有这个xml节点代表金蝶报错了
root := doc.SelectElement("synRewriteErpBaseDataStatusResponse")
if root == nil {
return errors.New(string(res.Body))
}
result := root.SelectElement("synRewriteErpBaseDataStatusReturn")
if result != nil {
var responseData map[string]interface{}
json.Unmarshal([]byte(result.Text()), &responseData)
for key, _ := range responseData {
//金蝶判断成功的标志
if key == "0000" {
return
}
//金额判断失败的标志
if key == "4444" {
return errors.New("金蝶返回失败")
}
}
}
return errors.New("金蝶返回响应格式无法识别")
} }
...@@ -155,7 +155,7 @@ func SyncCustomerData(operate string, customer model.Customer) (err error) { ...@@ -155,7 +155,7 @@ func SyncCustomerData(operate string, customer model.Customer) (err error) {
} }
if respData.Errcode != 101100 { if respData.Errcode != 101100 {
paramJson, _ := json.Marshal(param) paramJson, _ := json.Marshal(param)
return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为%s", url, string(paramJson), respData.Errmsg)) return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为 : %s", url, string(paramJson), respData.Errmsg))
} }
//都没问题,代表后端那边已经成功修改,修改同步表的状态 //都没问题,代表后端那边已经成功修改,修改同步表的状态
if err = logic.SyncCustomerSuccess(customer.ErpId); err != nil { if err = logic.SyncCustomerSuccess(customer.ErpId); err != nil {
...@@ -178,7 +178,7 @@ func SyncCustomerData(operate string, customer model.Customer) (err error) { ...@@ -178,7 +178,7 @@ func SyncCustomerData(operate string, customer model.Customer) (err error) {
} }
if respData.Errcode != 101100 { if respData.Errcode != 101100 {
paramJson, _ := json.Marshal(param) paramJson, _ := json.Marshal(param)
return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为%s", url, string(paramJson), respData.Errmsg)) return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为 : %s", url, string(paramJson), respData.Errmsg))
} }
//都没问题,代表后端那边已经成功修改,修改同步表的状态 //都没问题,代表后端那边已经成功修改,修改同步表的状态
if err = logic.SyncCustomerSuccess(customer.ErpId); err != nil { if err = logic.SyncCustomerSuccess(customer.ErpId); err != nil {
......
...@@ -157,7 +157,7 @@ func SyncGoodsData(operate string, goods model.Goods) (err error) { ...@@ -157,7 +157,7 @@ func SyncGoodsData(operate string, goods model.Goods) (err error) {
} }
if respData.Errcode != 101100 { if respData.Errcode != 101100 {
paramJson, _ := json.Marshal(param) paramJson, _ := json.Marshal(param)
return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为%s", url, string(paramJson), respData.Errmsg)) return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为 : %s", url, string(paramJson), respData.Errmsg))
} }
//都没问题,代表后端那边已经成功修改,修改同步表的状态 //都没问题,代表后端那边已经成功修改,修改同步表的状态
if err = logic.SyncGoodsSuccess(goods.ErpId, false); err != nil { if err = logic.SyncGoodsSuccess(goods.ErpId, false); err != nil {
...@@ -180,7 +180,7 @@ func SyncGoodsData(operate string, goods model.Goods) (err error) { ...@@ -180,7 +180,7 @@ func SyncGoodsData(operate string, goods model.Goods) (err error) {
} }
if respData.Errcode != 101100 { if respData.Errcode != 101100 {
paramJson, _ := json.Marshal(param) paramJson, _ := json.Marshal(param)
return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为%s", url, string(paramJson), respData.Errmsg)) return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为 : %s", url, string(paramJson), respData.Errmsg))
} }
//都没问题,代表后端那边已经成功修改,修改同步表的状态 //都没问题,代表后端那边已经成功修改,修改同步表的状态
if err = logic.SyncGoodsSuccess(goods.ErpId, true); err != nil { if err = logic.SyncGoodsSuccess(goods.ErpId, true); err != nil {
......
...@@ -56,12 +56,12 @@ func init() { ...@@ -56,12 +56,12 @@ func init() {
func (t *RecvPro) Consumer(dataByte []byte) error { func (t *RecvPro) Consumer(dataByte []byte) error {
var ( var (
message InStoreMessage message InStoreMessage
err error err error
inStore model.InStore inStore model.InStore
operateType string operateType string
syncLog model.SyncLog syncLog model.SyncLog
msg []byte msg, messageData []byte
) )
//先去转换队列消息的json,如果失败,记录起来 //先去转换队列消息的json,如果失败,记录起来
if err = json.Unmarshal(dataByte, &message); err != nil { if err = json.Unmarshal(dataByte, &message); err != nil {
...@@ -72,17 +72,15 @@ func (t *RecvPro) Consumer(dataByte []byte) error { ...@@ -72,17 +72,15 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
switch message.Type { switch message.Type {
case "save": case "save":
inStore.BillId = message.Data.FSourceBillID inStore.BillId = message.Data.FSourceBillID
messageData, err := json.Marshal(&message) messageData, err = json.Marshal(&message)
if err != nil { if err != nil {
goto ERR goto ERR
} }
inStore.QueueMessage = string(messageData) inStore.QueueMessage = string(messageData)
//先去查询是否存在,不存在才去插入,已经存在即是修改 //先去查询是否存在,不存在才去插入
if !logic.CheckInStoreExist(inStore.BillId) { if !logic.CheckInStoreExist(inStore.BillId) {
operateType = "insert" operateType = "insert"
if err = logic.InsertInStore(inStore); err != nil { if err = logic.InsertInStore(inStore); err != nil {
fmt.Println(err)
//todo:错误原因会消失
goto ERR goto ERR
} }
} }
...@@ -107,14 +105,15 @@ func (t *RecvPro) Consumer(dataByte []byte) error { ...@@ -107,14 +105,15 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
goto ERR goto ERR
} }
fmt.Println("同步成功,开始发送金蝶状态同步") fmt.Println("同步成功,开始发送金蝶状态同步")
product.SyncErpStatus("out_store", inStore.BillId) if err = product.SyncErpStatus("in_store", inStore.BillId); err != nil {
goto ERR
}
return nil return nil
ERR: ERR:
//不存在的billId不去操作对应的数据库 //不存在的billId不去操作对应的数据库
if inStore.BillId != "" { if inStore.BillId != "" {
logSyncErrorToInStore(inStore.BillId, err.Error()) logSyncErrorToInStore(inStore.BillId, err.Error())
} }
//还要存到一个统一错误表 //还要存到一个统一错误表
syncLog = model.SyncLog{ syncLog = model.SyncLog{
AddTime: time.Now().Unix(), AddTime: time.Now().Unix(),
...@@ -145,7 +144,7 @@ func SyncInStoreData(operate string, message InStoreMessage) (err error) { ...@@ -145,7 +144,7 @@ func SyncInStoreData(operate string, message InStoreMessage) (err error) {
resp *req.Resp resp *req.Resp
url string url string
respData common.Response respData common.Response
params map[string]interface{} params req.Param
) )
params = TransformParams(message) params = TransformParams(message)
//更新和插入接口不同 //更新和插入接口不同
...@@ -164,9 +163,9 @@ func SyncInStoreData(operate string, message InStoreMessage) (err error) { ...@@ -164,9 +163,9 @@ func SyncInStoreData(operate string, message InStoreMessage) (err error) {
if err = resp.ToJSON(&respData); err != nil { if err = resp.ToJSON(&respData); err != nil {
return return
} }
if respData.Errcode != 101100 { if respData.Errcode != 0 {
paramJson, _ := json.Marshal(params) paramJson, _ := json.Marshal(params)
return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为%s", url, string(paramJson), respData.Errmsg)) return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为 : %s", url, string(paramJson), respData.Errmsg))
} }
//都没问题,代表后端那边已经成功修改,修改同步表的状态 //都没问题,代表后端那边已经成功修改,修改同步表的状态
if err = logic.SyncInStoreSuccess(billId, false); err != nil { if err = logic.SyncInStoreSuccess(billId, false); err != nil {
...@@ -185,9 +184,10 @@ func logSyncErrorToInStore(erpId, syncError string) { ...@@ -185,9 +184,10 @@ func logSyncErrorToInStore(erpId, syncError string) {
} }
} }
func TransformParams(message InStoreMessage) (params map[string]interface{}) { func TransformParams(message InStoreMessage) (result req.Param) {
var ( var (
entry InStoreFEntrys entry InStoreFEntrys
params map[string]interface{}
outStoreDetail map[string]interface{} outStoreDetail map[string]interface{}
key int key int
detailPrefix string detailPrefix string
...@@ -196,6 +196,17 @@ func TransformParams(message InStoreMessage) (params map[string]interface{}) { ...@@ -196,6 +196,17 @@ func TransformParams(message InStoreMessage) (params map[string]interface{}) {
params = make(map[string]interface{}) params = make(map[string]interface{})
outStoreDetail = make(map[string]interface{}) outStoreDetail = make(map[string]interface{})
for key, entry = range message.Data.FEntrys { for key, entry = range message.Data.FEntrys {
var isInsp, isPrint int
if entry.CFIsInsp {
isInsp = 1
} else {
isInsp = 0
}
if entry.FIsPrint {
isPrint = 1
} else {
isPrint = 0
}
detailPrefix = fmt.Sprintf("detail[%d][", key) detailPrefix = fmt.Sprintf("detail[%d][", key)
detailMap = map[string]interface{}{ detailMap = map[string]interface{}{
detailPrefix + "erp_entry_sn]": entry.FSourceBillEntryID, detailPrefix + "erp_entry_sn]": entry.FSourceBillEntryID,
...@@ -205,33 +216,40 @@ func TransformParams(message InStoreMessage) (params map[string]interface{}) { ...@@ -205,33 +216,40 @@ func TransformParams(message InStoreMessage) (params map[string]interface{}) {
detailPrefix + "number]": entry.FQty, detailPrefix + "number]": entry.FQty,
detailPrefix + "country]": entry.FOriginCountry, detailPrefix + "country]": entry.FOriginCountry,
detailPrefix + "goods_unit]": entry.FUnit, detailPrefix + "goods_unit]": entry.FUnit,
detailPrefix + "is_insp]": entry.CFIsInsp, detailPrefix + "is_insp]": isInsp,
detailPrefix + "is_print]": entry.FIsPrint, detailPrefix + "is_print]": isPrint,
} }
for k, v := range detailMap { for k, v := range detailMap {
outStoreDetail[k] = v outStoreDetail[k] = v
} }
} }
var isInsp int var isInsp, isApplyCustoms int
if message.Data.CFIsInsp { if message.Data.CFIsInsp {
isInsp = 1 isInsp = 1
} else { } else {
isInsp = 0 isInsp = 0
} }
if message.Data.FIsCustoms {
isApplyCustoms = 1
} else {
isApplyCustoms = 0
}
params = map[string]interface{}{ params = map[string]interface{}{
//缺一个原始单据id "erp_in_store_id": message.Data.FSourceBillID,
"receiving_sn": message.Data.FErpPurInWorehouseNo, "receiving_sn": message.Data.FErpPurInWorehouseNo,
"warehousing_sn": message.Data.FEntrustBillNo, "warehousing_sn": message.Data.FEntrustBillNo,
"is_insp": isInsp, "is_insp": isInsp,
"store_erp_id": message.Data.FWarehouseNo, "store_erp_id": message.Data.FWarehouseNo,
"customer_erp_id": message.Data.FPrincipalNo, "customer_erp_id": message.Data.FPrincipalNo,
"supplier_erp_id": "LxYAAAABf9I3xn38", "supplier_erp_id": message.Data.FSupplierNo,
"is_apply_customs": 1, "is_apply_customs": isApplyCustoms,
} }
for k, v := range outStoreDetail { for k, v := range outStoreDetail {
params[k] = v params[k] = v
} }
return result = params
return result
} }
func main() { func main() {
......
...@@ -13,11 +13,12 @@ func main() { ...@@ -13,11 +13,12 @@ func main() {
"data": map[string]interface{}{ "data": map[string]interface{}{
"FWarehouseNo": "002", "FWarehouseNo": "002",
"FEntrustBillNo": "B05364", "FEntrustBillNo": "B05364",
"FErpPurInWorehouseNo": "FKSH202003107482", "FErpPurInWorehouseNo": "FKSH202003107481",
"FSourceBillID": "+7fvorsZSAevQCJ7ujsbLMBZJbY=", "FSourceBillID": "+7fvorsZSAevQCJ7ujsbLMBZJbY=",
"CFIsInsp": false, "CFIsInsp": false,
"FPrincipalNo": "WT00018", "FPrincipalNo": "WT00018",
//"FPrincipalNo": "FIZXuVrXRCms51pqby5EVagYZf0=", //"FPrincipalNo": "FIZXuVrXRCms51pqby5EVagYZf0=",
"FSupplierNo": "M0000045",
"FBizType": "执行采购", "FBizType": "执行采购",
"FEntrys": []map[string]interface{}{ "FEntrys": []map[string]interface{}{
{ {
...@@ -26,14 +27,13 @@ func main() { ...@@ -26,14 +27,13 @@ func main() {
"FOriginCountry": "502", "FOriginCountry": "502",
"FIsPrint": false, "FIsPrint": false,
"CFIsInsp": false, "CFIsInsp": false,
"FMaterialID": "9l++jtj+RNS2VpdFhzcRE0QJ5/A=", "FMaterialID": "nlOzVwbKSC2pIOF329QfN0QJ5/A=",
"FBrand": "ON", "FBrand": "ON",
"FSourceBillEntryID": "gHw/y6EQRBmCpLGDFkdJCO0oFFw=", "FSourceBillEntryID": "gHw/y6EQRBmCpLGDFkdJCO0oFFw=",
"FModel": "1abaaba", "FModel": "1abaaba",
"FGoods": "集成电路", "FGoods": "集成电路",
"FUnit": "个", "FUnit": "个",
"FIsCustoms": true, "FIsCustoms": true,
"FSupplierNo": "LxYAAAABgRI3xn38",
}, },
}, },
}, },
......
...@@ -63,6 +63,7 @@ func (t *RecvPro) Consumer(dataByte []byte) error { ...@@ -63,6 +63,7 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
syncLog model.SyncLog syncLog model.SyncLog
msg, messageData []byte msg, messageData []byte
) )
fmt.Println(string(dataByte))
//先去转换队列消息的json,如果失败,记录起来 //先去转换队列消息的json,如果失败,记录起来
if err = json.Unmarshal(dataByte, &message); err != nil { if err = json.Unmarshal(dataByte, &message); err != nil {
goto ERR goto ERR
...@@ -169,7 +170,7 @@ func SyncOutStoreData(operate string, message OutStoreMessage) (err error) { ...@@ -169,7 +170,7 @@ func SyncOutStoreData(operate string, message OutStoreMessage) (err error) {
} }
if respData.Errcode != 0 { if respData.Errcode != 0 {
paramJson, _ := json.Marshal(params) paramJson, _ := json.Marshal(params)
return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为%s", url, string(paramJson), respData.Data)) return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为 : %s", url, string(paramJson), respData.Data))
} }
//都没问题,代表后端那边已经成功修改,修改同步表的状态 //都没问题,代表后端那边已经成功修改,修改同步表的状态
if err = logic.SyncOutStoreSuccess(billId, false); err != nil { if err = logic.SyncOutStoreSuccess(billId, false); err != nil {
......
...@@ -153,7 +153,7 @@ func SyncSupplierData(operate string, supplier model.Supplier) (err error) { ...@@ -153,7 +153,7 @@ func SyncSupplierData(operate string, supplier model.Supplier) (err error) {
} }
if respData.Errcode != 101100 { if respData.Errcode != 101100 {
paramJson, _ := json.Marshal(param) paramJson, _ := json.Marshal(param)
return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为%s", url, string(paramJson), respData.Errmsg)) return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为 : %s", url, string(paramJson), respData.Errmsg))
} }
//都没问题,代表后端那边已经成功修改,修改同步表的状态 //都没问题,代表后端那边已经成功修改,修改同步表的状态
if err = logic.SyncSupplierSuccess(supplier.ErpId); err != nil { if err = logic.SyncSupplierSuccess(supplier.ErpId); err != nil {
...@@ -176,7 +176,7 @@ func SyncSupplierData(operate string, supplier model.Supplier) (err error) { ...@@ -176,7 +176,7 @@ func SyncSupplierData(operate string, supplier model.Supplier) (err error) {
} }
if respData.Errcode != 101100 { if respData.Errcode != 101100 {
paramJson, _ := json.Marshal(param) paramJson, _ := json.Marshal(param)
return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为%s", url, string(paramJson), respData.Errmsg)) return errors.New(fmt.Sprintf("请求后端接口返回失败,接口链接为%s,请求参数为%s,返回的错误信息为 : %s", url, string(paramJson), respData.Errmsg))
} }
//都没问题,代表后端那边已经成功修改,修改同步表的状态 //都没问题,代表后端那边已经成功修改,修改同步表的状态
if err = logic.SyncCustomerSuccess(supplier.ErpId); err != nil { if err = logic.SyncCustomerSuccess(supplier.ErpId); err != nil {
......
...@@ -40,6 +40,9 @@ func Import() { ...@@ -40,6 +40,9 @@ func Import() {
if key == 0 { if key == 0 {
continue continue
} }
if key == 100 {
break
}
goods.ErpId = row.Cells[0].String() goods.ErpId = row.Cells[0].String()
goods.GoodsName = row.Cells[1].String() goods.GoodsName = row.Cells[1].String()
goods.BrandName = row.Cells[2].String() goods.BrandName = row.Cells[2].String()
...@@ -49,7 +52,6 @@ func Import() { ...@@ -49,7 +52,6 @@ func Import() {
continue continue
} }
if logic.CheckGoodsExist(goods.ErpId) { if logic.CheckGoodsExist(goods.ErpId) {
fmt.Println("已存在,跳过")
continue continue
} }
message := make(map[string]interface{}) message := make(map[string]interface{})
......
package main package main
import "scm_server/cmd/source/customer" import "scm_server/cmd/source/goods"
func main() { func main() {
//forever := make(chan bool) //forever := make(chan bool)
...@@ -8,6 +8,6 @@ func main() { ...@@ -8,6 +8,6 @@ func main() {
//go supplier.Import() //go supplier.Import()
//supplier.Import() //supplier.Import()
//<-forever //<-forever
customer.Import() //customer.Import()
//goods.Import() goods.Import()
} }
...@@ -6,23 +6,23 @@ import ( ...@@ -6,23 +6,23 @@ import (
"time" "time"
) )
const CheckInStoreExistSql = "SELECT goods_id FROM lie_in_store WHERE erp_id = ? AND sync_status = 1" const CheckInStoreExistSql = "SELECT in_store_id FROM lie_in_store WHERE bill_id = ? AND sync_status = 1"
const InsertInStoreSql = "INSERT INTO `lie_in_store` (`queue_message`,`bill_id`,`add_time`) VALUES (?,?,?)" const InsertInStoreSql = "INSERT INTO `lie_in_store` (`queue_message`,`bill_id`,`add_time`) VALUES (?,?,?)"
const DeleteInStoreSql = "UPDATE `lie_in_store` SET `status` = ? , `update_time` = ? WHERE `erp_id` = ?" const DeleteInStoreSql = "UPDATE `lie_in_store` SET `status` = ? , `update_time` = ? WHERE `bill_id` = ?"
const WriteInStoreSyncErrorSql = "UPDATE `lie_in_store` SET sync_error = ? WHERE bill_id = ?" const WriteInStoreSyncErrorSql = "UPDATE `lie_in_store` SET sync_error = ? WHERE bill_id = ?"
const SyncInStoreSuccessSql = "UPDATE `lie_in_store` SET sync_status = 1 , sync_time = ? WHERE erp_id = ?" const SyncInStoreSuccessSql = "UPDATE `lie_in_store` SET sync_status = 1 , sync_time = ? WHERE bill_id = ?"
const SyncInStoreSuccessSqlWithStatus = "UPDATE `lie_in_store` SET sync_status = 1 , sync_time = ? , status = ? WHERE erp_id = ?" const SyncInStoreSuccessSqlWithStatus = "UPDATE `lie_in_store` SET sync_status = 1 , sync_time = ? , status = ? WHERE bill_id = ?"
//检查出库是否存在 //检查出库是否存在
func CheckInStoreExist(erpId string) (exist bool) { func CheckInStoreExist(billId string) (exist bool) {
var goodsId int var inStoreId int
dao.GetDb().QueryRowx(CheckInStoreExistSql, erpId).Scan(&goodsId) dao.GetDb().QueryRowx(CheckInStoreExistSql, billId).Scan(&inStoreId)
return goodsId > 0 return inStoreId > 0
} }
//插入出库 //插入出库
...@@ -38,18 +38,18 @@ func DeleteInStore(outStore model.InStore) (err error) { ...@@ -38,18 +38,18 @@ func DeleteInStore(outStore model.InStore) (err error) {
} }
//写入同步失败的原因 //写入同步失败的原因
func WriteInStoreSyncError(erpId string, syncError string) (err error) { func WriteInStoreSyncError(billId string, syncError string) (err error) {
_, err = dao.GetDb().Exec(WriteInStoreSyncErrorSql, syncError, erpId) _, err = dao.GetDb().Exec(WriteInStoreSyncErrorSql, syncError, billId)
return return
} }
//修改成功的同步状态 //修改成功的同步状态
func SyncInStoreSuccess(erpId string, isDelete bool) (err error) { func SyncInStoreSuccess(billId string, isDelete bool) (err error) {
//不是删除,不需要修改状态 //不是删除,不需要修改状态
if !isDelete { if !isDelete {
_, err = dao.GetDb().Exec(SyncInStoreSuccessSql, time.Now().Unix(), erpId) _, err = dao.GetDb().Exec(SyncInStoreSuccessSql, time.Now().Unix(), billId)
} else { } else {
_, err = dao.GetDb().Exec(SyncInStoreSuccessSqlWithStatus, time.Now().Unix(), 0, erpId) _, err = dao.GetDb().Exec(SyncInStoreSuccessSqlWithStatus, time.Now().Unix(), 0, billId)
} }
return return
} }
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