zhangqian
2023-10-19 eba4eb850f0ecfb5839395aa125955ceaa2a454f
service/progress.go
@@ -1,9 +1,10 @@
package service
import (
   "apsClient/conf"
   "apsClient/model"
   "errors"
   "gorm.io/gorm"
   "github.com/jinzhu/gorm"
)
type ProgressService struct {
@@ -54,7 +55,7 @@
   var ok bool
   progressCache, ok = ProgressCacheGet(channel)
   if !ok {
      progressCache, err = model.NewProductionProgressSearch(nil).SetChannel(channel).SetOrder("id desc").First()
      progressCache, err = model.NewProductionProgressSearch(nil).SetDeviceId(conf.Conf.System.DeviceId).SetChannel(channel).SetOrder("id desc").First()
      if err == gorm.ErrRecordNotFound {
         return nil, errors.New("progress not found")
      }
@@ -71,3 +72,9 @@
   }
   return
}
// GetProgressList 获取待同步进度工序
func (slf ProgressService) GetProgressList() (progressList []*model.ProductionProgress, err error) {
   progressList, err = model.NewProductionProgressSearch(nil).SetUnFinished().SetOrder("id desc").SetPage(1, 100).FindNotTotal()
   return
}