From dad1ae79fe78e770d88f41713b4c68fad562d9ef Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期一, 09 十月 2023 21:36:34 +0800
Subject: [PATCH] 当前使用的工艺编号置顶
---
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