From 2df84cdc7faf29cc8a2512b627a36a3881276b9f Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期四, 26 十月 2023 16:29:15 +0800 Subject: [PATCH] plc4x读写加入长度 --- service/task.go | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/service/task.go b/service/task.go index df68848..ed8b6ea 100644 --- a/service/task.go +++ b/service/task.go @@ -137,20 +137,19 @@ upMap := map[string]interface{}{"status": status} if status == model.ProcedureStatusProcessing { upMap["process_model_number"] = processModelNumber + upMap["real_start_time"] = time.Now().Unix() } else if status == model.ProcedureStatusWaitProcess { upMap["process_model_number"] = "" + } else if status == model.ProcedureStatusFinished { + upMap["real_end_time"] = time.Now().Unix() } return model.NewProceduresSearch(db).SetId(id).UpdateByMap(upMap) } -func (slf TaskService) UpdateProcedureStatus(db *gorm.DB, id uint, status model.ProcedureStatus, channel int32) error { - if status == model.ProcedureStatusFinished { - ProgressCacheUnset(channel) - } - return model.NewProceduresSearch(db).SetId(id).UpdateByMap(map[string]interface{}{ - "status": status, - }) +func (slf TaskService) UpdateProcessModelNumber(db *gorm.DB, id uint, processModelNumber string) error { + upMap := map[string]interface{}{"process_model_number": processModelNumber} + return model.NewProceduresSearch(db).SetId(id).UpdateByMap(upMap) } func (slf TaskService) UpdateOrderStatus(db *gorm.DB, id uint, status model.OrderStatus) error { @@ -196,3 +195,8 @@ func (slf TaskService) GetTaskStatusSync(limit int) ([]*model.TaskStatusSync, error) { return model.NewTaskStatusSyncSearch(nil).SetOrder("id desc").SetPage(1, limit).FindNotTotal() } + +// RemoveTaskStatusSync 鍒犻櫎鍚屾瀹岀殑璁板綍 +func (slf TaskService) RemoveTaskStatusSync(ids []uint) (err error) { + return model.NewTaskStatusSyncSearch(nil).SetIDs(ids).Delete() +} -- Gitblit v1.8.0