From 14fc2f577e2c0b7b146c1a430e9438f317ad5b0c Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期六, 23 九月 2023 14:14:27 +0800 Subject: [PATCH] 任务接收增加channel字段,postion字段改为channel --- service/progress.go | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/service/progress.go b/service/progress.go index 9f19ae6..6eab830 100644 --- a/service/progress.go +++ b/service/progress.go @@ -22,20 +22,20 @@ ProcedureID: procedure.ProceduresInfo.ProcedureID, DeviceID: procedure.DeviceID, TotalQuantity: order.Amount.IntPart(), - Position: procedure.Position, + Channel: procedure.Channel, } err := model.NewProductionProgressSearch(db).Create(progress) if err != nil { return err } - ProgressCacheSet(procedure.Position, progress) + ProgressCacheSet(procedure.Channel, progress) } return nil } -func (slf ProgressService) UpdateProgress(position int, finishedQuantity int64) (err error) { - progressCache, err := slf.GetCurrentProgress(position) +func (slf ProgressService) UpdateProgress(channel int32, finishedQuantity int64) (err error) { + progressCache, err := slf.GetCurrentProgress(channel) if err != nil { return err } @@ -44,17 +44,17 @@ } if finishedQuantity > progressCache.FinishedQuantity { //褰撴湁鍙樺寲鏃舵墠鏇存柊 progressCache.FinishedQuantity = finishedQuantity - ProgressCacheSet(position, progressCache) + ProgressCacheSet(channel, progressCache) return model.NewProductionProgressSearch(nil).SetId(progressCache.ID).Save(progressCache) } return nil } -func (slf ProgressService) GetCurrentProgress(position int) (progressCache *model.ProductionProgress, err error) { +func (slf ProgressService) GetCurrentProgress(channel int32) (progressCache *model.ProductionProgress, err error) { var ok bool - progressCache, ok = ProgressCacheGet(position) + progressCache, ok = ProgressCacheGet(channel) if !ok { - progressCache, err = model.NewProductionProgressSearch(nil).SetPosition(position).SetOrder("id desc").First() + progressCache, err = model.NewProductionProgressSearch(nil).SetChannel(channel).SetOrder("id desc").First() if err == gorm.ErrRecordNotFound { return nil, errors.New("progress not found") } @@ -66,7 +66,7 @@ progressCache = nil } if progressCache != nil { - ProgressCacheSet(position, progressCache) + ProgressCacheSet(channel, progressCache) } } return -- Gitblit v1.8.0