| | |
| | | if (IsExecutingTask.TaskType == (int)TaskInboundTypeEnum.Inbound) |
| | | { |
| | | IsExecutingTask.TargetStation = station.stationRemark; |
| | | IsExecutingTask.TaskState = (int)TaskInStatusEnum.RGV_TransFer; |
| | | } |
| | | else |
| | | { |
| | | IsExecutingTask.TargetStation = station.remark; |
| | | IsExecutingTask.TaskState = (int)TaskOutStatusEnum.RGV_TransFer; |
| | | } |
| | | IsExecutingTask.TaskState = (int)TaskInStatusEnum.RGV_TransFer; |
| | | |
| | | _taskRepository.UpdateData(IsExecutingTask); |
| | | Thread.Sleep(1000); |
| | | } |
| | |
| | | IsExecutingTask.RGVName = "RGV01"; |
| | | IsExecutingTask.CurrentAddress = IsExecutingTask.Remark; |
| | | IsExecutingTask.Remark = ""; |
| | | IsExecutingTask.TaskState = (int)TaskInStatusEnum.RGV_TransFer; |
| | | |
| | | Dt_StationManager station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == IsExecutingTask.NextAddress); |
| | | IsExecutingTask.SourceStation = IsExecutingTask.CurrentAddress == "1025" ? 10 : 7; |
| | | if (IsExecutingTask.TaskType == (int)TaskInboundTypeEnum.Inbound) |
| | | { |
| | | IsExecutingTask.TaskState = (int)TaskInStatusEnum.RGV_TransFer; |
| | | IsExecutingTask.TargetStation = station.stationRemark; |
| | | } |
| | | else |
| | | { |
| | | IsExecutingTask.TaskState = (int)TaskOutStatusEnum.RGV_TransFer; |
| | | IsExecutingTask.TargetStation = station.remark; |
| | | } |
| | | |
| | |
| | | { |
| | | if (commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Automatic) && !commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Fault)) |
| | | { |
| | | |
| | | var taskSecond = _taskRepository.QueryFirst(x => x.RGVName == "RGV02" && x.TaskNum == commonRGVSecond.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum) && ((x.TaskType == (int)TaskInboundTypeEnum.Inbound && x.TaskState < 230) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound))); |
| | | var taskSecond = _taskRepository.QueryFirst(x => x.RGVName == "RGV02" && x.TaskNum == commonRGVSecond.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum) && ((x.TaskType == (int)TaskInboundTypeEnum.Inbound && (x.TaskState < 230||x.TaskState == (int)TaskInStatusEnum.RGV_TransFer|| x.TaskState == (int)TaskInStatusEnum.RGV_TransFerFInish)) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound))); |
| | | if (taskSecond != null) |
| | | { |
| | | if (taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_Outdispatch || taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_Indispatch || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_InAwaitWMS || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) |
| | |
| | | |
| | | Thread.Sleep(1000); |
| | | |
| | | if (task.Remark != null) |
| | | if (task.Remark != null || ((task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV02" && task.TargetAddress == "1002") || (task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV01" && (task.TargetAddress == "1030" || task.TargetAddress == "1029")))) |
| | | { |
| | | return GetDispatchExecutingTask(task); |
| | | task.Remark = "1025"; |
| | | _taskRepository.UpdateData(task); |
| | | return GetDispatchExecutingTask(task, taskSecond); |
| | | } |
| | | return task; |
| | | } |
| | | } |
| | | } |
| | | else if ((taskSecond.CurrentAddress == "1025" || taskSecond.CurrentAddress == "1026") && (taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_InExecuting)) |
| | | { |
| | | if (task.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || task.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) |
| | | { |
| | | if (task.TargetStation - taskSecond.SourceStation > 1 && task.TargetStation - taskSecond.TargetStation > 1) |
| | | { |
| | | LogAndWarn("æ§è¡è°åº¦ä»»å¡æ§å¶", $"ã{commonRGV.DeviceCode}工使¨¡å¼ï¼ã{commonRGV.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}ã设å¤ç¶æï¼ã{commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Fault)}ãã{commonRGVSecond.DeviceCode}ãä»»å¡ã{JsonConvert.SerializeObject(taskSecond)}ã{commonRGVSecond.DeviceCode}è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(task.TaskNum)}ãã"); |
| | | |
| | | Thread.Sleep(1000); |
| | | |
| | | if (task.Remark != null || ((task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV02" && task.TargetAddress == "1002") || (task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV01" && (task.TargetAddress == "1030" || task.TargetAddress == "1029")))) |
| | | { |
| | | task.Remark = "1025"; |
| | | _taskRepository.UpdateData(task); |
| | | return GetDispatchExecutingTask(task, taskSecond); |
| | | } |
| | | return task; |
| | | } |
| | | } |
| | |
| | | { |
| | | LogAndWarn("æ§è¡è°åº¦ä»»å¡æ§å¶", $"ã{commonRGV.DeviceCode}工使¨¡å¼ï¼ã{commonRGV.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}ã设å¤ç¶æï¼ã{commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Fault)}ãã{commonRGVSecond.DeviceCode}ãä»»å¡ã{JsonConvert.SerializeObject(taskSecond)}ã{commonRGVSecond.DeviceCode}è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(task.TaskNum)}ãã"); |
| | | Thread.Sleep(1000); |
| | | if (task.Remark != null) |
| | | if (task.Remark != null || ((task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV02" && task.TargetAddress == "1002") || (task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV01" && (task.TargetAddress == "1030" || task.TargetAddress == "1029")))) |
| | | { |
| | | return GetDispatchExecutingTask(task); |
| | | task.Remark = "1025"; |
| | | _taskRepository.UpdateData(task); |
| | | return GetDispatchExecutingTask(task, taskSecond); |
| | | } |
| | | return task; |
| | | } |
| | |
| | | } |
| | | if (commonRGVSecond.GetValue<RGVDBName, int>(RGVDBName.LevelPoint) > 35000) |
| | | { |
| | | if (commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Running)) |
| | | { |
| | | return null; |
| | | } |
| | | RGVTaskCommand command = new RGVTaskCommand() |
| | | { |
| | | PickupLocation = (byte)Convert.ToSByte(15), |
| | |
| | | TaskType = (byte)Convert.ToSByte(1) |
| | | }; |
| | | SendCommand(commonRGVSecond, command); |
| | | Thread.Sleep(1000); |
| | | Thread.Sleep(3000); |
| | | if (!commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Running)) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | Thread.Sleep(1000); |
| | | if (task.Remark != null || ((task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV02" && task.TargetAddress == "1002") || (task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV01" && (task.TargetAddress == "1030" || task.TargetAddress == "1029")))) |
| | | { |
| | | task.Remark = "1025"; |
| | | _taskRepository.UpdateData(task); |
| | | return GetDispatchExecutingTask(task); |
| | | } |
| | | return task; |
| | | } |
| | | } |
| | | } |
| | | if (task.Remark != null || ((task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV02" && task.TargetAddress == "1002") || (task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV01" && (task.TargetAddress == "1030" || task.TargetAddress == "1029")))) |
| | | { |
| | | task.Remark = "1025"; |
| | | _taskRepository.UpdateData(task); |
| | | return GetDispatchExecutingTask(task); |
| | | } |
| | | return task; |
| | | } |
| | |
| | | { |
| | | if (commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Automatic) && !commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)) |
| | | { |
| | | var taskSecond = _taskRepository.QueryFirst(x => x.RGVName == "RGV01" && x.TaskNum == commonRGVFirst.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum) && ((x.TaskType == (int)TaskInboundTypeEnum.Inbound && x.TaskState < 230) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound))); |
| | | var taskSecond = _taskRepository.QueryFirst(x => x.RGVName == "RGV01" && x.TaskNum == commonRGVFirst.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum) && ((x.TaskType == (int)TaskInboundTypeEnum.Inbound && (x.TaskState < 230 || x.TaskState == (int)TaskInStatusEnum.RGV_TransFer || x.TaskState == (int)TaskInStatusEnum.RGV_TransFerFInish)) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound))); |
| | | if (taskSecond != null) |
| | | { |
| | | if (taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_Outdispatch || taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_Indispatch || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_InAwaitWMS || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) |
| | |
| | | LogAndWarn("æ§è¡è°åº¦ä»»å¡æ§å¶", $"ã{commonRGV.DeviceCode}工使¨¡å¼ï¼ã{commonRGV.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}ã设å¤ç¶æï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)}ãã{commonRGVFirst.DeviceCode}ãä»»å¡ã{JsonConvert.SerializeObject(taskSecond)}ã{commonRGVFirst.DeviceCode}è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(task.TaskNum)}ãã"); |
| | | Thread.Sleep(1000); |
| | | |
| | | if (task.Remark != null) |
| | | if (task.Remark != null || ((task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV02" && task.TargetAddress == "1002") || (task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV01" && (task.TargetAddress == "1030" || task.TargetAddress == "1029")))) |
| | | { |
| | | return GetDispatchExecutingTask(task); |
| | | task.Remark = "1026"; |
| | | _taskRepository.UpdateData(task); |
| | | return GetDispatchExecutingTask(task, taskSecond); |
| | | } |
| | | return task; |
| | | } |
| | | } |
| | | } |
| | | else if ((taskSecond.CurrentAddress == "1025" || taskSecond.CurrentAddress == "1026") && (taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_InExecuting)) |
| | | { |
| | | if (task.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || task.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) |
| | | { |
| | | if (taskSecond.SourceStation - task.TargetStation > 1 && taskSecond.TargetStation - task.TargetStation > 1) |
| | | { |
| | | LogAndWarn("æ§è¡è°åº¦ä»»å¡æ§å¶", $"ã{commonRGV.DeviceCode}工使¨¡å¼ï¼ã{commonRGV.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}ã设å¤ç¶æï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)}ãã{commonRGVFirst.DeviceCode}ãä»»å¡ã{JsonConvert.SerializeObject(taskSecond)}ã{commonRGVFirst.DeviceCode}è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(task.TaskNum)}ãã"); |
| | | Thread.Sleep(1000); |
| | | |
| | | if (task.Remark != null || ((task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV02" && task.TargetAddress == "1002") || (task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV01" && (task.TargetAddress == "1030" || task.TargetAddress == "1029")))) |
| | | { |
| | | task.Remark = "1026"; |
| | | _taskRepository.UpdateData(task); |
| | | return GetDispatchExecutingTask(task, taskSecond); |
| | | } |
| | | return task; |
| | | } |
| | |
| | | LogAndWarn("æ§è¡è°åº¦ä»»å¡æ§å¶", $"ã{commonRGV.DeviceCode}工使¨¡å¼ï¼ã{commonRGV.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}ã设å¤ç¶æï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)}ãã{commonRGVFirst.DeviceCode}ãä»»å¡ã{JsonConvert.SerializeObject(taskSecond)}ã{commonRGVFirst.DeviceCode}è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(task.TaskNum)}ãã"); |
| | | Thread.Sleep(1000); |
| | | |
| | | if (task.Remark != null) |
| | | if (task.Remark != null || ((task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV02" && task.TargetAddress == "1002") || (task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV01" && (task.TargetAddress == "1030" || task.TargetAddress == "1029")))) |
| | | { |
| | | return GetDispatchExecutingTask(task); |
| | | task.Remark = "1026"; |
| | | _taskRepository.UpdateData(task); |
| | | return GetDispatchExecutingTask(task, taskSecond); |
| | | } |
| | | return task; |
| | | } |
| | |
| | | } |
| | | if (commonRGVFirst.GetValue<RGVDBName, int>(RGVDBName.LevelPoint) < 420000) |
| | | { |
| | | if (commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Running)) |
| | | { |
| | | return null; |
| | | } |
| | | RGVTaskCommand command = new RGVTaskCommand() |
| | | { |
| | | PickupLocation = (byte)Convert.ToSByte(26), |
| | |
| | | TaskType = (byte)Convert.ToSByte(1) |
| | | }; |
| | | SendCommand(commonRGVFirst, command); |
| | | Thread.Sleep(1000); |
| | | Thread.Sleep(3000); |
| | | if (!commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Running)) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | Thread.Sleep(1000); |
| | | if (task.Remark != null || ((task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV02" && task.TargetAddress == "1002") || (task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV01" && (task.TargetAddress == "1030" || task.TargetAddress == "1029")))) |
| | | { |
| | | task.Remark = "1026"; |
| | | _taskRepository.UpdateData(task); |
| | | return GetDispatchExecutingTask(task); |
| | | } |
| | | return task; |
| | | } |
| | | } |
| | | } |
| | | if (task.Remark != null || ((task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV02" && task.TargetAddress == "1002") || (task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.RGVName == "RGV01" && (task.TargetAddress == "1030" || task.TargetAddress == "1029")))) |
| | | { |
| | | task.Remark = "1026"; |
| | | _taskRepository.UpdateData(task); |
| | | return GetDispatchExecutingTask(task); |
| | | } |
| | | return task; |
| | | } |
| | |
| | | try |
| | | { |
| | | var tasks = _taskService.QueryRGVTask(); |
| | | Dt_Task task; |
| | | Dt_Task task = new Dt_Task(); |
| | | if (tasks.Count() == 0) |
| | | { |
| | | return null; |
| | |
| | | { |
| | | if (commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Automatic) && !commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Fault)) |
| | | { |
| | | var taskSecond = _taskRepository.QueryFirst(x => x.RGVName == "RGV02" && x.TaskNum == commonRGVSecond.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum) && ((x.TaskType == (int)TaskInboundTypeEnum.Inbound && x.TaskState < 230) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound))); |
| | | var taskSecond = _taskRepository.QueryFirst(x => x.RGVName == "RGV02" && x.TaskNum == commonRGVSecond.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum) && ((x.TaskType == (int)TaskInboundTypeEnum.Inbound && (x.TaskState < 230 || x.TaskState == (int)TaskInStatusEnum.RGV_TransFer || x.TaskState == (int)TaskInStatusEnum.RGV_TransFerFInish)) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound))); |
| | | if (taskSecond != null) |
| | | { |
| | | task = GetDispatchTask(tasks, taskSecond); |
| | | |
| | | LogAndWarn("è°åº¦ä»»å¡æ§å¶", $"ã{commonRGV.DeviceCode}工使¨¡å¼ï¼ã{commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}ã设å¤ç¶æï¼ã{commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Fault)}ãã{commonRGVSecond.DeviceCode}ãä»»å¡ã{JsonConvert.SerializeObject(taskSecond)}ã{commonRGVSecond.DeviceCode}è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(task.TaskNum)}ãã"); |
| | | Thread.Sleep(1000); |
| | | |
| | | Thread.Sleep(1000); |
| | | return task; |
| | | } |
| | | } |
| | | var taskNews = tasks.Where(x => (x.TaskType == (int)TaskInboundTypeEnum.Inbound && Convert.ToInt32(x.SourceAddress) < 1015) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound && (x.Roadway == "SC01" || x.Roadway == "SC02" || x.Roadway == "SC03")) || x.RGVName == "RGV01").ToList(); |
| | | var taskNews = tasks.Where(x => (x.TaskType == (int)TaskInboundTypeEnum.Inbound && (Convert.ToInt32(x.SourceAddress) < 1015|| Convert.ToInt32(x.SourceAddress)>1031)) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound && (x.Roadway == "SC01" || x.Roadway == "SC02" || x.Roadway == "SC03")) || x.RGVName == "RGV01").ToList(); |
| | | if (taskNews.Count == 0) |
| | | { |
| | | return null; |
| | |
| | | } |
| | | if (commonRGVSecond.GetValue<RGVDBName, int>(RGVDBName.LevelPoint) > 35000) |
| | | { |
| | | if (commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Running)) |
| | | { |
| | | return null; |
| | | } |
| | | RGVTaskCommand command = new RGVTaskCommand() |
| | | { |
| | | PickupLocation = (byte)Convert.ToSByte(15), |
| | |
| | | TaskType = (byte)Convert.ToSByte(1) |
| | | }; |
| | | SendCommand(commonRGVSecond, command); |
| | | Thread.Sleep(1000); |
| | | Thread.Sleep(3000); |
| | | if (!commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Running)) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | if (tasks.FirstOrDefault(x => x.RGVName == "RGV01") != null) |
| | | task = GetDispatchTask(taskNews, "RGV01"); |
| | | if (task == null) |
| | | { |
| | | LogAndWarn("è°åº¦ä»»å¡æ§å¶", $"ã{commonRGVSecond.DeviceCode}工使¨¡å¼ï¼ã{commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}ãä½ä¸ç¶æï¼ã{commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Running)}ã设å¤ç¶æï¼ã{commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Fault)}ãæ¯å¦æè´§ï¼ã{commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.InStock)}ãè¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(taskNews.FirstOrDefault(x => x.RGVName == "RGV01").TaskNum)}ãã"); |
| | | Thread.Sleep(1000); |
| | | return taskNews.FirstOrDefault(x => x.RGVName == "RGV01"); |
| | | return tasks.FirstOrDefault(x => x.RGVName != "RGV02"); |
| | | } |
| | | else |
| | | { |
| | | LogAndWarn("è°åº¦ä»»å¡æ§å¶", $"ã{commonRGVSecond.DeviceCode}工使¨¡å¼ï¼ã{commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}ãä½ä¸ç¶æï¼ã{commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Running)}ã设å¤ç¶æï¼ã{commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Fault)}ãæ¯å¦æè´§ï¼ã{commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.InStock)}ãè¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(taskNews.FirstOrDefault(x => x.RGVName != "RGV02").TaskNum)}ãã"); |
| | | Thread.Sleep(1000); |
| | | return taskNews.FirstOrDefault(x => x.RGVName != "RGV02"); |
| | | } |
| | | return task; |
| | | //if (taskNews.FirstOrDefault(x => x.RGVName == "RGV01") != null) |
| | | //{ |
| | | // return taskNews.FirstOrDefault(x => x.RGVName == "RGV01"); |
| | | //} |
| | | //else |
| | | //{ |
| | | // return taskNews.FirstOrDefault(x => x.RGVName != "RGV02"); |
| | | //} |
| | | } |
| | | else |
| | | { |
| | | if (tasks.FirstOrDefault(x => x.RGVName == "RGV01") != null) |
| | | { |
| | | LogAndWarn("è°åº¦ä»»å¡æ§å¶", $"ãæªæ¾å°RGV02设å¤ä¿¡æ¯ãè¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(tasks.FirstOrDefault(x => x.RGVName == "RGV01").TaskNum)}ãã"); |
| | | Thread.Sleep(1000); |
| | | return tasks.FirstOrDefault(x => x.RGVName == "RGV01"); |
| | | } |
| | | else |
| | | { |
| | | LogAndWarn("è°åº¦ä»»å¡æ§å¶", $"ãæªæ¾å°RGV02设å¤ä¿¡æ¯ãè¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(tasks.FirstOrDefault(x => x.RGVName != "RGV02").TaskNum)}ãã"); |
| | | Thread.Sleep(1000); |
| | | return tasks.FirstOrDefault(x => x.RGVName != "RGV02"); |
| | | } |
| | | return GetDispatchTask(tasks, "RGV01"); |
| | | //if (tasks.FirstOrDefault(x => x.RGVName == "RGV01") != null) |
| | | //{ |
| | | // LogAndWarn("è°åº¦ä»»å¡æ§å¶", $"ãæªæ¾å°RGV02设å¤ä¿¡æ¯ãè¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(tasks.FirstOrDefault(x => x.RGVName == "RGV01").TaskNum)}ãã"); |
| | | // Thread.Sleep(1000); |
| | | // return tasks.FirstOrDefault(x => x.RGVName == "RGV01"); |
| | | //} |
| | | //else |
| | | //{ |
| | | // LogAndWarn("è°åº¦ä»»å¡æ§å¶", $"ãæªæ¾å°RGV02设å¤ä¿¡æ¯ãè¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(tasks.FirstOrDefault(x => x.RGVName != "RGV02").TaskNum)}ãã"); |
| | | // Thread.Sleep(1000); |
| | | // return tasks.FirstOrDefault(x => x.RGVName != "RGV02"); |
| | | //} |
| | | } |
| | | } |
| | | else |
| | |
| | | if (commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Automatic) && !commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)) |
| | | { |
| | | |
| | | var taskFirst = _taskRepository.QueryFirst(x => x.RGVName == "RGV01" && x.TaskNum == commonRGVFirst.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum) && ((x.TaskType == (int)TaskInboundTypeEnum.Inbound && x.TaskState < 230) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound))); |
| | | var taskFirst = _taskRepository.QueryFirst(x => x.RGVName == "RGV01" && x.TaskNum == commonRGVFirst.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum) && ((x.TaskType == (int)TaskInboundTypeEnum.Inbound && (x.TaskState < 230 || x.TaskState == (int)TaskInStatusEnum.RGV_TransFer || x.TaskState == (int)TaskInStatusEnum.RGV_TransFerFInish)) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound))); |
| | | if (taskFirst != null) |
| | | { |
| | | task = GetDispatchTask(tasks, taskFirst); |
| | | |
| | | LogAndWarn("æ§è¡è°åº¦ä»»å¡æ§å¶", $"ã{commonRGVFirst.DeviceCode}工使¨¡å¼ï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}ã设å¤ç¶æï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)}ãã{commonRGVFirst.DeviceCode}ãä»»å¡ã{JsonConvert.SerializeObject(taskFirst)}ã{commonRGVFirst.DeviceCode}è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(task.TaskNum)}ãã"); |
| | | LogAndWarn("è°åº¦ä»»å¡æ§å¶", $"ã{commonRGVFirst.DeviceCode}工使¨¡å¼ï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}ã设å¤ç¶æï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)}ãã{commonRGVFirst.DeviceCode}ãä»»å¡ã{JsonConvert.SerializeObject(taskFirst)}ã{commonRGVFirst.DeviceCode}è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(task.TaskNum)}ãã"); |
| | | Thread.Sleep(1000); |
| | | |
| | | return task; |
| | | } |
| | | |
| | | } |
| | | var taskNews = tasks.Where(x => (x.TaskType == (int)TaskInboundTypeEnum.Inbound && Convert.ToInt32(x.SourceAddress) > 1014) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound && (x.Roadway == "SC04" || x.Roadway == "SC05" || x.Roadway == "SC06")) || x.RGVName == "RGV02").ToList(); |
| | | var taskNews = tasks.Where(x => (x.TaskType == (int)TaskInboundTypeEnum.Inbound && Convert.ToInt32(x.SourceAddress) > 1014 && Convert.ToInt32(x.SourceAddress)<1031) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound && (x.Roadway == "SC04" || x.Roadway == "SC05" || x.Roadway == "SC06")) || x.RGVName == "RGV02").ToList(); |
| | | if (taskNews.Count == 0) |
| | | { |
| | | return null; |
| | |
| | | } |
| | | if (commonRGVFirst.GetValue<RGVDBName, int>(RGVDBName.LevelPoint) < 420000) |
| | | { |
| | | if (commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Running)) |
| | | { |
| | | return null; |
| | | } |
| | | RGVTaskCommand command = new RGVTaskCommand() |
| | | { |
| | | PickupLocation = (byte)Convert.ToSByte(26), |
| | |
| | | TaskType = (byte)Convert.ToSByte(1) |
| | | }; |
| | | SendCommand(commonRGVFirst, command); |
| | | Thread.Sleep(1000); |
| | | Thread.Sleep(3000); |
| | | if (!commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Running)) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | if (tasks.FirstOrDefault(x => x.RGVName == "RGV02") != null) |
| | | task = GetDispatchTask(taskNews, "RGV02"); |
| | | if (task == null) |
| | | { |
| | | LogAndWarn("è°åº¦ä»»å¡æ§å¶", $"ã{commonRGVFirst.DeviceCode}工使¨¡å¼ï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}ãä½ä¸ç¶æï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Running)}ã设å¤ç¶æï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)}ãæ¯å¦æè´§ï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.InStock)}ãè¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(taskNews.FirstOrDefault(x => x.RGVName == "RGV02").TaskNum)}ãã"); |
| | | Thread.Sleep(1000); |
| | | return taskNews.FirstOrDefault(x => x.RGVName == "RGV02"); |
| | | return tasks.FirstOrDefault(x => x.RGVName != "RGV01"); |
| | | } |
| | | else |
| | | { |
| | | LogAndWarn("è°åº¦ä»»å¡æ§å¶", $"ã{commonRGVFirst.DeviceCode}工使¨¡å¼ï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}ãä½ä¸ç¶æï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Running)}ã设å¤ç¶æï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)}ãæ¯å¦æè´§ï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.InStock)}ãè¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(taskNews.FirstOrDefault(x => x.RGVName != "RGV01").TaskNum)}ãã"); |
| | | |
| | | Thread.Sleep(1000); |
| | | return taskNews.FirstOrDefault(x => x.RGVName != "RGV01"); |
| | | } |
| | | return task; |
| | | //if (taskNews.FirstOrDefault(x => x.RGVName == "RGV02") != null) |
| | | //{ |
| | | // return taskNews.FirstOrDefault(x => x.RGVName == "RGV02"); |
| | | //} |
| | | //else |
| | | //{ |
| | | // return taskNews.FirstOrDefault(x => x.RGVName != "RGV01"); |
| | | //} |
| | | } |
| | | else |
| | | { |
| | | if (tasks.FirstOrDefault(x => x.RGVName == "RGV02") != null) |
| | | { |
| | | LogAndWarn("è°åº¦ä»»å¡æ§å¶", $"ãæªæ¾å°RGV01设å¤ä¿¡æ¯ã è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(tasks.FirstOrDefault(x => x.RGVName == "RGV02").TaskNum)}ãã"); |
| | | return GetDispatchTask(tasks, "RGV02"); |
| | | //if (tasks.FirstOrDefault(x => x.RGVName == "RGV02") != null) |
| | | //{ |
| | | // LogAndWarn("è°åº¦ä»»å¡æ§å¶", $"ãæªæ¾å°RGV01设å¤ä¿¡æ¯ã è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(tasks.FirstOrDefault(x => x.RGVName == "RGV02").TaskNum)}ãã"); |
| | | |
| | | Thread.Sleep(1000); |
| | | return tasks.FirstOrDefault(x => x.RGVName == "RGV02"); |
| | | } |
| | | else |
| | | { |
| | | LogAndWarn("è°åº¦ä»»å¡æ§å¶", $"ãæªæ¾å°RGV01设å¤ä¿¡æ¯ãè¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(tasks.FirstOrDefault(x => x.RGVName != "RGV01").TaskNum)}ãã"); |
| | | // Thread.Sleep(1000); |
| | | // return tasks.FirstOrDefault(x => x.RGVName == "RGV02"); |
| | | //} |
| | | //else |
| | | //{ |
| | | // LogAndWarn("è°åº¦ä»»å¡æ§å¶", $"ãæªæ¾å°RGV01设å¤ä¿¡æ¯ãè¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(tasks.FirstOrDefault(x => x.RGVName != "RGV01").TaskNum)}ãã"); |
| | | |
| | | Thread.Sleep(1000); |
| | | return tasks.FirstOrDefault(x => x.RGVName != "RGV01"); |
| | | } |
| | | // Thread.Sleep(1000); |
| | | // return tasks.FirstOrDefault(x => x.RGVName != "RGV01"); |
| | | //} |
| | | } |
| | | } |
| | | } |
| | |
| | | try |
| | | { |
| | | var tasks = _taskRepository.QueryData(x => x.Floor == "1F" && (x.TaskState == (int)TaskInStatusEnum.RGV_TransFerFInish || x.TaskState == (int)TaskOutStatusEnum.RGV_TransFerFInish)); |
| | | Dt_Task task; |
| | | Dt_Task task = new Dt_Task(); |
| | | if (tasks.Count() == 0) |
| | | { |
| | | return null; |
| | |
| | | { |
| | | if (commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Automatic) && !commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Fault)) |
| | | { |
| | | |
| | | var taskSecond = _taskRepository.QueryFirst(x => x.RGVName == "RGV02" && x.TaskNum == commonRGVSecond.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum) && ((x.TaskType == (int)TaskInboundTypeEnum.Inbound && x.TaskState < 230) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound))); |
| | | var taskSecond = _taskRepository.QueryFirst(x => x.RGVName == "RGV02" && x.TaskNum == commonRGVSecond.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum) && ((x.TaskType == (int)TaskInboundTypeEnum.Inbound && (x.TaskState < 230 || x.TaskState == (int)TaskInStatusEnum.RGV_TransFer || x.TaskState == (int)TaskInStatusEnum.RGV_TransFerFInish)) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound))); |
| | | if (taskSecond != null) |
| | | { |
| | | if (taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_Outdispatch || taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) |
| | |
| | | } |
| | | if (commonRGVSecond.GetValue<RGVDBName, int>(RGVDBName.LevelPoint) > 35000) |
| | | { |
| | | if (commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Running)) |
| | | { |
| | | return null; |
| | | } |
| | | RGVTaskCommand command = new RGVTaskCommand() |
| | | { |
| | | PickupLocation = (byte)Convert.ToSByte(15), |
| | |
| | | TaskType = (byte)Convert.ToSByte(1) |
| | | }; |
| | | SendCommand(commonRGVSecond, command); |
| | | Thread.Sleep(1000); |
| | | Thread.Sleep(3000); |
| | | if (!commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Running)) |
| | | { |
| | | return null; |
| | |
| | | if (commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Automatic) && !commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)) |
| | | { |
| | | |
| | | var taskFirst = _taskRepository.QueryFirst(x => x.RGVName == "RGV01" && x.TaskNum == commonRGVFirst.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum) && ((x.TaskType == (int)TaskInboundTypeEnum.Inbound && x.TaskState < 230) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound))); |
| | | var taskFirst = _taskRepository.QueryFirst(x => x.RGVName == "RGV01" && x.TaskNum == commonRGVFirst.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum) && ((x.TaskType == (int)TaskInboundTypeEnum.Inbound && (x.TaskState < 230 || x.TaskState == (int)TaskInStatusEnum.RGV_TransFer || x.TaskState == (int)TaskInStatusEnum.RGV_TransFerFInish)) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound))); |
| | | if (taskFirst != null) |
| | | { |
| | | if (taskFirst.TaskState == (int)TaskOutStatusEnum.RGV_Outdispatch || taskFirst.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || taskFirst.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) |
| | | { |
| | | |
| | | task = tasks.FirstOrDefault(x => ((x.SourceStation - taskFirst.TargetStation > 1 && x.SourceStation - taskFirst.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - taskFirst.TargetStation > 1 && x.TargetStation - taskFirst.SourceStation > 1 && x.SourceStation - taskFirst.SourceStation > 1 && x.TargetStation - taskFirst.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)) && x.RGVName == "RGV02"); |
| | | task = tasks.FirstOrDefault(x => ((taskFirst.TargetStation-x.SourceStation > 1 &&taskFirst.SourceStation - x.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || ( taskFirst.TargetStation- x.SourceStation > 1 && taskFirst.SourceStation- x.TargetStation > 1 && taskFirst.SourceStation- x.SourceStation > 1 && taskFirst.TargetStation - x.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)) && x.RGVName == "RGV02"); |
| | | |
| | | |
| | | LogAndWarn("ä¸è½¬è°åº¦ä»»å¡æ§å¶", $"ã{commonRGVFirst.DeviceCode}工使¨¡å¼ï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}ã设å¤ç¶æï¼ã{commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)}ãã{commonRGVFirst.DeviceCode}ãä»»å¡ã{JsonConvert.SerializeObject(taskFirst)}ã{commonRGVFirst.DeviceCode}è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(task.TaskNum)}ãã"); |
| | |
| | | } |
| | | if (commonRGVFirst.GetValue<RGVDBName, int>(RGVDBName.LevelPoint) < 420000) |
| | | { |
| | | if (commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Running)) |
| | | { |
| | | return null; |
| | | } |
| | | RGVTaskCommand command = new RGVTaskCommand() |
| | | { |
| | | PickupLocation = (byte)Convert.ToSByte(26), |
| | |
| | | TaskType = (byte)Convert.ToSByte(1) |
| | | }; |
| | | SendCommand(commonRGVFirst, command); |
| | | Thread.Sleep(1000); |
| | | Thread.Sleep(3000); |
| | | if (!commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Running)) |
| | | { |
| | | return null; |
| | |
| | | return null; |
| | | } |
| | | |
| | | public Dt_Task? GetDispatchTask(List<Dt_Task> tasks, Dt_Task oldtask) |
| | | public Dt_Task? GetDispatchTask(List<Dt_Task> tasks,Dt_Task oldtask) |
| | | { |
| | | Dt_Task y = tasks.Where(x => x.Remark != null && ((x.SourceStation - oldtask.TargetStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.SourceStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TargetStation - oldtask.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound))).FirstOrDefault(); |
| | | Dt_Task y = tasks.Where(x => x.Remark != null&& ((x.SourceStation - oldtask.TargetStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.SourceStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TargetStation - oldtask.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound))).FirstOrDefault(); |
| | | if (y == null) |
| | | { |
| | | WriteInfo("æ¥è¯¢ä»»å¡", $" è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(oldtask)}ãã"); |
| | | if (oldtask.TaskState == (int)TaskOutStatusEnum.RGV_Outdispatch || oldtask.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || oldtask.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) |
| | | { |
| | | if (oldtask.RGVName == "RGV01") |
| | | { |
| | | return tasks.FirstOrDefault(x => (oldtask.TargetStation - x.SourceStation > 1 && oldtask.SourceStation - x.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (oldtask.TargetStation - x.SourceStation > 1 && oldtask.SourceStation - x.TargetStation > 1 && oldtask.SourceStation - x.SourceStation > 1 && oldtask.TargetStation - x.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); |
| | | } |
| | | else |
| | | { |
| | | return tasks.FirstOrDefault(x => (x.SourceStation - oldtask.TargetStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.SourceStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TargetStation - oldtask.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); |
| | | |
| | | } |
| | | } |
| | | else if ((oldtask.CurrentAddress == "1025" || oldtask.CurrentAddress == "1026") && (oldtask.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || oldtask.TaskState == (int)TaskInStatusEnum.RGV_InExecuting)) |
| | | { |
| | | if (oldtask.RGVName == "RGV01") |
| | | { |
| | | return tasks.FirstOrDefault(x => (oldtask.TargetStation - x.SourceStation > 1 && oldtask.SourceStation - x.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (oldtask.TargetStation - x.SourceStation > 1 && oldtask.SourceStation - x.TargetStation > 1 && oldtask.SourceStation - x.SourceStation > 1 && oldtask.TargetStation - x.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); |
| | | } |
| | | else |
| | | { |
| | | return tasks.FirstOrDefault(x => (x.SourceStation - oldtask.TargetStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.SourceStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TargetStation - oldtask.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); |
| | | |
| | | return tasks.FirstOrDefault(x => (x.SourceStation - oldtask.TargetStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.SourceStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TargetStation - oldtask.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); |
| | | } |
| | | |
| | | } |
| | | else if (oldtask.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || oldtask.TaskState == (int)TaskInStatusEnum.RGV_InExecuting) |
| | | { |
| | | return tasks.FirstOrDefault(x => x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.TargetStation > 1); |
| | | if (oldtask.RGVName == "RGV01") |
| | | { |
| | | return tasks.FirstOrDefault(x => oldtask.TargetStation - x.SourceStation > 1 && oldtask.TargetStation - x.TargetStation > 1); |
| | | |
| | | } |
| | | else |
| | | { |
| | | return tasks.FirstOrDefault(x => x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.TargetStation > 1); |
| | | } |
| | | |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | else |
| | |
| | | } |
| | | if (next != null) |
| | | { |
| | | oldtask.Remark = next; |
| | | _taskRepository.UpdateData(oldtask); |
| | | return oldtask; |
| | | y.Remark = next; |
| | | _taskRepository.UpdateData(y); |
| | | LogAndWarn("ä¸è½¬ä»»å¡", $" è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(y)}ãã"); |
| | | return y; |
| | | } |
| | | } |
| | | if (oldtask.TaskState == (int)TaskOutStatusEnum.RGV_Outdispatch || oldtask.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || oldtask.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) |
| | | { |
| | | |
| | | return tasks.FirstOrDefault(x => (x.SourceStation - oldtask.TargetStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.SourceStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TargetStation - oldtask.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); |
| | | } |
| | | else if ((oldtask.CurrentAddress == "1025" || oldtask.CurrentAddress == "1026") && (oldtask.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || oldtask.TaskState == (int)TaskInStatusEnum.RGV_InExecuting)) |
| | | { |
| | | return tasks.FirstOrDefault(x => (x.SourceStation - oldtask.TargetStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.SourceStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TargetStation - oldtask.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); |
| | | } |
| | | else if (oldtask.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || oldtask.TaskState == (int)TaskInStatusEnum.RGV_InExecuting) |
| | |
| | | } |
| | | } |
| | | |
| | | public Dt_Task? GetDispatchExecutingTask(Dt_Task oldtask) |
| | | public Dt_Task? GetDispatchTask(List<Dt_Task> tasks,string RGVName) |
| | | { |
| | | Dt_Task y = tasks.Where(x => x.Remark != null).FirstOrDefault(); |
| | | if (y == null) |
| | | { |
| | | if (RGVName == "RGV01") |
| | | { |
| | | if (tasks.FirstOrDefault(x => x.RGVName == RGVName) != null) |
| | | { |
| | | return tasks.FirstOrDefault(x => x.RGVName == RGVName); |
| | | } |
| | | else |
| | | { |
| | | return tasks.FirstOrDefault(x => x.RGVName != "RGV02"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (tasks.FirstOrDefault(x => x.RGVName == RGVName) != null) |
| | | { |
| | | return tasks.FirstOrDefault(x => x.RGVName == RGVName); |
| | | } |
| | | else |
| | | { |
| | | return tasks.FirstOrDefault(x => x.RGVName != "RGV01"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var stationManager = _stationManagerRepository.QueryData(x => x.stationType == 15); |
| | | if (stationManager.Count() > 0) |
| | | { |
| | | string next = null; |
| | | foreach (var item in stationManager) |
| | | { |
| | | var x = _taskRepository.QueryFirst(x => x.NextAddress == item.stationChildCode || x.CurrentAddress == item.stationChildCode); |
| | | if (x == null) |
| | | { |
| | | next = item.stationChildCode; |
| | | break; |
| | | } |
| | | } |
| | | if (next != null) |
| | | { |
| | | y.Remark = next; |
| | | _taskRepository.UpdateData(y); |
| | | LogAndWarn("ä¸è½¬ä»»å¡", $" è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(y)}ãã"); |
| | | return y; |
| | | } |
| | | } |
| | | if (RGVName == "RGV01") |
| | | { |
| | | if (tasks.FirstOrDefault(x => x.RGVName == RGVName) != null) |
| | | { |
| | | return tasks.FirstOrDefault(x => x.RGVName == RGVName); |
| | | } |
| | | else |
| | | { |
| | | return tasks.FirstOrDefault(x => x.RGVName != "RGV02"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (tasks.FirstOrDefault(x => x.RGVName == RGVName) != null) |
| | | { |
| | | return tasks.FirstOrDefault(x => x.RGVName == RGVName); |
| | | } |
| | | else |
| | | { |
| | | return tasks.FirstOrDefault(x => x.RGVName != "RGV01"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | var stationManager = _stationManagerRepository.QueryData(x => x.stationType == 15); |
| | | if (stationManager.Count() > 0) |
| | | public Dt_Task? GetDispatchExecutingTask(Dt_Task oldtask,Dt_Task task) |
| | | { |
| | | var stationManagers = _stationManagerRepository.QueryData(x => x.stationType == 15); |
| | | if (stationManagers.Count() > 0) |
| | | { |
| | | string next = null; |
| | | foreach (var item in stationManager) |
| | | foreach (var item in stationManagers) |
| | | { |
| | | var x = _taskRepository.QueryFirst(x => x.NextAddress == item.stationChildCode || x.CurrentAddress == item.stationChildCode); |
| | | if (x == null) |
| | | { |
| | | next = item.stationChildCode; |
| | | LogAndWarn("ä¸è½¬è·åç«å°", $" è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(x)}ããã{next}ã"); |
| | | break; |
| | | } |
| | | } |
| | | if (next != null) |
| | | { |
| | | var stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == next); |
| | | oldtask.Remark = next; |
| | | //oldtask.CurrentAddress = next; |
| | | _taskRepository.UpdateData(oldtask); |
| | | if (task.RGVName == "RGV01") |
| | | { |
| | | if (task.TargetStation - stationManager.stationRemark > 1 && task.SourceStation - stationManager.stationRemark > 1 && task.SourceStation - oldtask.SourceStation > 1 && task.TargetStation - oldtask.SourceStation > 1) |
| | | { |
| | | LogAndWarn("ä¸è½¬ä»»å¡GetDispatchExecutingTask", $" è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(oldtask)}ããã{next}ã"); |
| | | return oldtask; |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (stationManager.stationRemark - task.TargetStation > 1 && stationManager.stationRemark - task.SourceStation > 1 && oldtask.SourceStation - task.SourceStation > 1 && oldtask.SourceStation - task.TargetStation > 1) |
| | | { |
| | | LogAndWarn("ä¸è½¬ä»»å¡GetDispatchExecutingTask", $" è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(oldtask)}ãã"); |
| | | return oldtask; |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public Dt_Task? GetDispatchExecutingTask(Dt_Task oldtask) |
| | | { |
| | | var stationManagers = _stationManagerRepository.QueryData(x => x.stationType == 15); |
| | | if (stationManagers.Count() > 0) |
| | | { |
| | | string next = null; |
| | | foreach (var item in stationManagers) |
| | | { |
| | | var x = _taskRepository.QueryFirst(x => x.NextAddress == item.stationChildCode || x.CurrentAddress == item.stationChildCode); |
| | | if (x == null) |
| | | { |
| | | next = item.stationChildCode; |
| | | LogAndWarn("ä¸è½¬è·åç«å°", $" è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(x)}ããã{next}ã"); |
| | | break; |
| | | } |
| | | } |
| | | if (next != null) |
| | | { |
| | | var stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == next); |
| | | oldtask.Remark = next; |
| | | _taskRepository.UpdateData(oldtask); |
| | | return oldtask; |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |