- 设置门店假营业时间放在每晚例行同步任务之后

This commit is contained in:
gazebo
2019-08-02 16:23:36 +08:00
parent 8518248080
commit 87d78777af
3 changed files with 31 additions and 11 deletions

View File

@@ -99,6 +99,7 @@ func doDailyWork() {
globals.SugarLogger.Debug("doDailyWork") globals.SugarLogger.Debug("doDailyWork")
// cms.CurVendorSync.FullSyncStoresSkus(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDJD}, nil, true, true) // cms.CurVendorSync.FullSyncStoresSkus(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDJD}, nil, true, true)
cms.CurVendorSync.SyncStoresSkus(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDJD, model.VendorIDEBAI, model.VendorIDMTWM}, nil, nil, false, true, true) cms.CurVendorSync.SyncStoresSkus(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDJD, model.VendorIDEBAI, model.VendorIDMTWM}, nil, nil, false, true, true)
InitEx()
netprinter.RebindAllPrinters(jxcontext.AdminCtx, false, true) netprinter.RebindAllPrinters(jxcontext.AdminCtx, false, true)
} }

View File

@@ -6,6 +6,7 @@ import (
"git.rosy.net.cn/baseapi" "git.rosy.net.cn/baseapi"
"git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxstore/cms" "git.rosy.net.cn/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch" "git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
"git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model"
@@ -159,19 +160,38 @@ func StartOrEndOpStore(isStart bool, startTime, endTime int16, isAsync, isContin
} }
func InitEx() { func InitEx() {
// if globals.IsMainProductEnv() {
// ScheduleTimerFunc(func() {
// StartOrEndOpStore(true, 0, 0, false, true)
// }, startOpStoreTimeListJXCS)
// ScheduleTimerFunc(func() {
// StartOrEndOpStore(false, 0, 0, false, true)
// }, endOpStoreTimeListJXCS)
// } else {
// ScheduleTimerFunc(func() {
// StartOrEndOpStore(true, 0, 0, false, true)
// }, startOpStoreTimeListJXGY)
// ScheduleTimerFunc(func() {
// StartOrEndOpStore(false, 0, 0, false, true)
// }, endOpStoreTimeListJXGY)
// }
var (
time1, time2 time.Time
)
now := time.Now()
if globals.IsMainProductEnv() { if globals.IsMainProductEnv() {
ScheduleTimerFunc(func() { time1 = jxutils.GetNextTimeFromList(now, startOpStoreTimeListJXCS)
StartOrEndOpStore(true, 0, 0, false, true) time2 = jxutils.GetNextTimeFromList(now, endOpStoreTimeListJXCS)
}, startOpStoreTimeListJXCS)
ScheduleTimerFunc(func() {
StartOrEndOpStore(false, 0, 0, false, true)
}, endOpStoreTimeListJXCS)
} else { } else {
ScheduleTimerFunc(func() { time1 = jxutils.GetNextTimeFromList(now, startOpStoreTimeListJXGY)
time2 = jxutils.GetNextTimeFromList(now, endOpStoreTimeListJXGY)
}
if time1.Sub(now) < 2*time.Hour {
utils.AfterFuncWithRecover(time1.Sub(now), func() {
StartOrEndOpStore(true, 0, 0, false, true) StartOrEndOpStore(true, 0, 0, false, true)
}, startOpStoreTimeListJXGY) })
ScheduleTimerFunc(func() { utils.AfterFuncWithRecover(time2.Sub(now), func() {
StartOrEndOpStore(false, 0, 0, false, true) StartOrEndOpStore(false, 0, 0, false, true)
}, endOpStoreTimeListJXGY) })
} }
} }

View File

@@ -56,7 +56,6 @@ func Init() {
if globals.IsProductEnv() { if globals.IsProductEnv() {
ebai.CurPurchaseHandler.StartRefreshComment() ebai.CurPurchaseHandler.StartRefreshComment()
misc.InitEx()
} }
misc.Init() misc.Init()
} }