zhangqian
2023-12-04 3d0b0140ee304ef6fb435fea5a9080ba637c6620
service/task.go
@@ -206,6 +206,14 @@
// SaveTaskStatusSync 保存任务同步信息
func (slf TaskService) SaveTaskStatusSync(db *gorm.DB, record *model.TaskStatusSync) (err error) {
   if record.IsProcessing {
      record.StartTs = time.Now().Unix()
   }
   if record.IsFinish {
      record.FinishTs = time.Now().Unix()
      startedRecord, _ := model.NewTaskStatusSyncSearch(db).SetProductProcedureId(record.ProductProcedureID).SetWorkOrderId(record.WorkOrderId).First()
      record.StartTs = startedRecord.StartTs
   }
   return model.NewTaskStatusSyncSearch(db).Create(record)
}