This commit is contained in:
苏尹岚
2021-01-28 14:27:37 +08:00
parent de0cc168f3
commit a236f0b14c

View File

@@ -1081,6 +1081,8 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
} }
userName := ctx.GetUserName() userName := ctx.GetUserName()
needSyncIDMap := make(map[int]int) needSyncIDMap := make(map[int]int)
isSyncSkus := false
var appCodeList []string
dao.Begin(db) dao.Begin(db)
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
@@ -1248,26 +1250,26 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
if thingMaps[0].VendorThingID == "" { if thingMaps[0].VendorThingID == "" {
//并且同步标志还没有带待创建因为addskuname现在建到thingmap上不会带待创建标志了 //并且同步标志还没有带待创建因为addskuname现在建到thingmap上不会带待创建标志了
if !model.IsSyncStatusNew(thingMaps[0].SyncStatus) { if !model.IsSyncStatusNew(thingMaps[0].SyncStatus) {
if err = OnCreateThing(ctx, db, []*MultiStoreVendorInfo{ isSyncSkus = true
appCodeList = append(appCodeList, list1[0].VendorOrgCode)
OnCreateThing(ctx, db, []*MultiStoreVendorInfo{
&MultiStoreVendorInfo{ &MultiStoreVendorInfo{
VendorID: model.VendorIDJD, VendorID: model.VendorIDJD,
OrgCode: list1[0].VendorOrgCode, OrgCode: list1[0].VendorOrgCode,
}, },
}, int64(v.RealSkuID), model.ThingTypeSku, model.SyncFlagNewMask); err == nil { }, int64(v.RealSkuID), model.ThingTypeSku, model.SyncFlagNewMask)
_, err = SyncSkus(ctx, nil, []int{model.VendorIDJD}, []string{list1[0].VendorOrgCode}, nil, []int{v.RealSkuID}, true)
}
} }
} }
} else { } else {
//万一不存在 //万一不存在
if err = OnCreateThing(ctx, db, []*MultiStoreVendorInfo{ isSyncSkus = true
appCodeList = append(appCodeList, list1[0].VendorOrgCode)
OnCreateThing(ctx, db, []*MultiStoreVendorInfo{
&MultiStoreVendorInfo{ &MultiStoreVendorInfo{
VendorID: model.VendorIDJD, VendorID: model.VendorIDJD,
OrgCode: list1[0].VendorOrgCode, OrgCode: list1[0].VendorOrgCode,
}, },
}, int64(v.RealSkuID), model.ThingTypeSku, model.SyncFlagNewMask); err == nil { }, int64(v.RealSkuID), model.ThingTypeSku, model.SyncFlagNewMask)
_, err = SyncSkus(ctx, nil, []int{model.VendorIDJD}, []string{list1[0].VendorOrgCode}, nil, []int{v.RealSkuID}, true)
}
} }
} }
} }
@@ -1418,6 +1420,9 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
} }
dao.Commit(db) dao.Commit(db)
skuIDs := jxutils.IntMap2List(needSyncIDMap) skuIDs := jxutils.IntMap2List(needSyncIDMap)
if isSyncSkus {
_, err = SyncSkus(ctx, nil, []int{model.VendorIDJD}, appCodeList, nil, skuIDs, true)
}
return skuIDs, err return skuIDs, err
} }