作者 yangfu

fix: 计划同步修改

... ... @@ -55,11 +55,11 @@ func (crontabService *CrontabService) initTask() {
autoTodayWorkshopPlanCompletionRecord := task.NewTask("定时刷新当天车间计划完成纪录", "0 0 1-23/1 * * *", AutoTodayWorkshopPlanCompletionRecord) // 1:00, 4:00, 每三个小时运行一次
task.AddTask("autoTodayWorkshopPlanCompletionRecord", autoTodayWorkshopPlanCompletionRecord)
syncProductPlan := task.NewTask("定时同步车间计划", "0 */5 * * * *", SyncProductPlan)
task.AddTask("SyncProductPlan", syncProductPlan)
syncProduct := task.NewTask("定时同步产品信息", "0 */30 * * * *", SyncProduct)
syncProduct := task.NewTask("定时同步产品信息", "0 0 * * * *", SyncProduct)
task.AddTask("syncProduct", syncProduct)
syncProductPlan := task.NewTask("定时同步车间计划", "0 5 * * * *", SyncProductPlan)
task.AddTask("SyncProductPlan", syncProductPlan)
}
func (crontabService *CrontabService) StartCrontabTask() {
... ...
... ... @@ -6,7 +6,7 @@ import (
"github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/syncdata"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/redis"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log"
"runtime/debug"
"time"
... ... @@ -45,7 +45,8 @@ func SyncProduct(ctx context.Context) error {
}
}
if fromTime.IsZero() {
fromTime, err = redis.GetLastFetchTime(redis.MaterialK3cloudFetchTimeKey())
// fromTime, err = redis.GetLastFetchTime(redis.MaterialK3cloudFetchTimeKey())
fromTime = utils.GetZeroTime(time.Now()).Add(-time.Hour * 24) //前一天有修改的记录
if err != nil {
log.Logger.Error(err.Error())
return nil
... ...
... ... @@ -5,6 +5,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/domainService"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/redis"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log"
"strconv"
"strings"
... ... @@ -483,10 +484,11 @@ func (srv *PullDataK3CloudService) SyncDataProductPlan(ptr *pgTransaction.Transa
3.查询是否有重复的批次号
4.有进行更新,其他的插入
*/
lastTime, err := redis.GetLastFetchTime()
if err != nil {
return err
}
//lastTime, err := redis.GetLastFetchTime()
//if err != nil {
// return err
//}
var lastTime = utils.GetZeroTime(time.Now()).Add(-time.Hour * 24) //前一天有修改的记录
if !fromTime.IsZero() {
lastTime = fromTime
}
... ...