| | |
| | | |
| | | public void AddTaskExecuteDetail(int taskId, string description = "") |
| | | { |
| | | try |
| | | { |
| | | bool isNormal = true; |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskId == taskId); |
| | | if (task == null) return; |
| | | int taskNum = task.TaskNum; |
| | | int taskState = task.TaskState; |
| | | bool isNormal = true; |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskId == taskId); |
| | | if (task == null) return; |
| | | int taskNum = task.TaskNum; |
| | | int taskState = task.TaskState; |
| | | int TaskStateremark = task.RGVTaskType; //æ°å¢RGvä»»å¡ç±»å |
| | | |
| | | |
| | | Dt_TaskExecuteDetail taskExecuteDetail = new() |
| | | { |
| | | IsManual = App.User.UserId > 0, |
| | | IsNormal = isNormal, |
| | | TaskNum = taskNum, |
| | | TaskId = taskId, |
| | | TaskState = taskState, |
| | | Description = description, |
| | | CurrentAddress = task.CurrentAddress, |
| | | NextAddress = task.NextAddress, |
| | | }; |
| | | BaseDal.AddData(taskExecuteDetail); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | string getstastr = GetEnumDescription(taskState); |
| | | string getrgvtasktyperema = GetEnumDescription2(TaskStateremark); |
| | | |
| | | } |
| | | |
| | | Dt_TaskExecuteDetail taskExecuteDetail = new() |
| | | { |
| | | IsManual = App.User.UserId > 0, |
| | | IsNormal = isNormal, |
| | | TaskNum = taskNum, |
| | | TaskId = taskId, |
| | | TaskState = taskState, |
| | | Description = description, |
| | | CurrentAddress = task.CurrentAddress, |
| | | NextAddress = task.NextAddress, |
| | | Roadway = task.Roadway, //æ°å¢æ§è¡è®¾å¤ |
| | | RGVTaskType = TaskStateremark, |
| | | TaskStateremark = getstastr, |
| | | RGVTaskTyperemark = getrgvtasktyperema |
| | | }; |
| | | BaseDal.AddData(taskExecuteDetail); |
| | | } |
| | | |
| | | public void AddTaskExecuteDetail(List<int> taskNums, string description = "") |
| | |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskInboundTypeEnum>(TaskType.ToString()).ToString(), out result)) |
| | | { |
| | | steps = Enum.GetValues(typeof(TaskInStatusEnum)).Cast<int>().ToList(); |
| | | steps = Enum.GetValues(typeof(TaskInStatusEnum)).Cast<int>().Where(x => x <= (int)TaskInStatusEnum.InPending).ToList(); |
| | | foreach (var item in steps) |
| | | { |
| | | object obj; |
| | |
| | | active = steps.IndexOf(TaskState) + 1; |
| | | |
| | | } |
| | | |
| | | content = WebResponseContent.Instance.OK(data: new { active, list }); |
| | | string curradd = task.CurrentAddress; |
| | | string nextadd = task.NextAddress; |
| | | content = WebResponseContent.Instance.OK(data: new { active, list,curradd, nextadd }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | WebResponseContent content = new(); |
| | | try |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum); |
| | | //Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum); |
| | | |
| | | |
| | | Dt_Task task = _taskRepository.QueryData().Where(x => x.TaskNum == taskNum).FirstOrDefault(); |
| | | |
| | | int TaskNum = 0; |
| | | |
| | | Dt_Task_hty task_h = null; |
| | | if (task != null) |
| | | { |
| | | List<Dt_TaskExecuteDetail> taskExecuteDetails = BaseDal.QueryData(x => x.TaskId == task.TaskId, new Dictionary<string, SqlSugar.OrderByType> { { nameof(Dt_TaskExecuteDetail.TaskDetailId), SqlSugar.OrderByType.Asc } }); |
| | | TaskNum = task.TaskNum; |
| | | } |
| | | else if (task == null) |
| | | { |
| | | task_h = _task_Hty.QueryData().Where(x => x.TaskNum == taskNum).FirstOrDefault(); |
| | | TaskNum = task_h.TaskNum; |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ä»»å¡ä¸åå¨"); |
| | | } |
| | | |
| | | if (task != null || task_h != null) |
| | | { |
| | | List<Dt_TaskExecuteDetail> taskExecuteDetails = BaseDal.QueryData(x => x.TaskNum == TaskNum, new Dictionary<string, SqlSugar.OrderByType> { { nameof(Dt_TaskExecuteDetail.TaskDetailId), SqlSugar.OrderByType.Asc } }); |
| | | |
| | | content = WebResponseContent.Instance.OK(data: taskExecuteDetails); |
| | | } |
| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡ç±»åæä¸¾ |
| | | /// </summary> |
| | | public string GetEnumDescription(int enumValue) |
| | | { |
| | | var enumType = typeof(TaskInStatusEnum); |
| | | var field = enumType.GetFields() |
| | | .FirstOrDefault(f => f.FieldType == enumType && |
| | | (int)f.GetValue(null) == enumValue); |
| | | |
| | | if (field != null) |
| | | { |
| | | var descriptionAttribute = field.GetCustomAttributes(typeof(DescriptionAttribute), false) |
| | | .FirstOrDefault() as DescriptionAttribute; |
| | | |
| | | return descriptionAttribute?.Description ?? field.Name; |
| | | } |
| | | |
| | | return string.Empty; |
| | | } |
| | | |
| | | public string GetEnumDescription2(int enumValue) |
| | | { |
| | | var enumType = typeof(RGVTaskTypeEnum); |
| | | var field = enumType.GetFields() |
| | | .FirstOrDefault(f => f.FieldType == enumType && |
| | | (int)f.GetValue(null) == enumValue); |
| | | |
| | | if (field != null) |
| | | { |
| | | var descriptionAttribute = field.GetCustomAttributes(typeof(DescriptionAttribute), false) |
| | | .FirstOrDefault() as DescriptionAttribute; |
| | | |
| | | return descriptionAttribute?.Description ?? field.Name; |
| | | } |
| | | |
| | | return string.Empty; |
| | | } |
| | | } |
| | | } |