| | |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.HttpContextUser; |
| | | using WIDESEAWCS_DTO.Enum; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_IBasicInfoService; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | |
| | | bool sendFlag = SendCommand(FirstRgv, rgvTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | IsExecutingTask.RGVName = FirstRgv.DeviceCode; |
| | | _taskRepository.UpdateData(IsExecutingTask); |
| | | _taskService.UpdateTaskStatusToNext(IsExecutingTask.TaskNum); |
| | | Thread.Sleep(1000); |
| | | if (IsExecutingTask.Remark != null) |
| | | { |
| | | IsExecutingTask.RGVName = "RGV02"; |
| | | IsExecutingTask.CurrentAddress = IsExecutingTask.Remark; |
| | | IsExecutingTask.Remark = ""; |
| | | Dt_StationManager station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == IsExecutingTask.NextAddress); |
| | | IsExecutingTask.SourceStation = IsExecutingTask.CurrentAddress=="1025"?10:7; |
| | | if (IsExecutingTask.TaskType == (int)TaskInboundTypeEnum.Inbound) |
| | | { |
| | | IsExecutingTask.TargetStation = station.stationRemark; |
| | | } |
| | | else |
| | | { |
| | | IsExecutingTask.TargetStation = station.remark; |
| | | } |
| | | IsExecutingTask.TaskState = (int)TaskInStatusEnum.RGV_TransFer; |
| | | _taskRepository.UpdateData(IsExecutingTask); |
| | | Thread.Sleep(1000); |
| | | } |
| | | else |
| | | { |
| | | IsExecutingTask.RGVName = FirstRgv.DeviceCode; |
| | | _taskRepository.UpdateData(IsExecutingTask); |
| | | _taskService.UpdateTaskStatusToNext(IsExecutingTask.TaskNum); |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var taskNew = DispatchTask(FirstRgv); |
| | | Dt_Task taskNew = null; |
| | | taskNew = GetTransFerTask(FirstRgv); |
| | | if (taskNew == null) |
| | | { |
| | | taskNew = DispatchTask(FirstRgv); |
| | | } |
| | | if (taskNew != null) |
| | | { |
| | | RGVTaskCommand? rgvTaskCommand = ConvertToRGVTaskCommand(taskNew); |
| | |
| | | bool sendFlag = SendCommand(FirstRgv, rgvTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | taskNew.RGVName = FirstRgv.DeviceCode; |
| | | _taskRepository.UpdateData(taskNew); |
| | | _taskService.UpdateTaskStatusToNext(taskNew.TaskNum); |
| | | Thread.Sleep(1000); |
| | | if (taskNew.TaskState == (int)TaskInStatusEnum.RGV_TransFerFInish) |
| | | { |
| | | taskNew.TaskState = (int)TaskInStatusEnum.RGV_InExecuting; |
| | | _taskRepository.UpdateData(taskNew); |
| | | Thread.Sleep(1000); |
| | | } |
| | | else if (taskNew.TaskState == (int)TaskOutStatusEnum.RGV_TransFerFInish) |
| | | { |
| | | taskNew.TaskState = (int)TaskOutStatusEnum.RGV_OutExecuting; |
| | | _taskRepository.UpdateData(taskNew); |
| | | Thread.Sleep(1000); |
| | | } |
| | | else if (taskNew.Remark != null) |
| | | { |
| | | taskNew.RGVName = "RGV02"; |
| | | taskNew.CurrentAddress = taskNew.Remark; |
| | | taskNew.Remark = ""; |
| | | taskNew.TaskState = (int)TaskOutStatusEnum.RGV_TransFer; |
| | | Dt_StationManager station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == taskNew.NextAddress); |
| | | taskNew.SourceStation = taskNew.CurrentAddress == "1025" ? 10 : 7; |
| | | if (taskNew.TaskType == (int)TaskInboundTypeEnum.Inbound) |
| | | { |
| | | taskNew.TargetStation = station.stationRemark; |
| | | } |
| | | else |
| | | { |
| | | taskNew.TargetStation = station.remark; |
| | | } |
| | | _taskRepository.UpdateData(taskNew); |
| | | Thread.Sleep(1000); |
| | | } |
| | | else |
| | | { |
| | | taskNew.RGVName = FirstRgv.DeviceCode; |
| | | _taskRepository.UpdateData(taskNew); |
| | | _taskService.UpdateTaskStatusToNext(taskNew.TaskNum); |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | bool sendFlag = SendCommand(SecondRgv, rgvTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | IsExecutingTask.RGVName = SecondRgv.DeviceCode; |
| | | _taskRepository.UpdateData(IsExecutingTask); |
| | | _taskService.UpdateTaskStatusToNext(IsExecutingTask.TaskNum); |
| | | Thread.Sleep(1000); |
| | | if (IsExecutingTask.Remark != null) |
| | | { |
| | | IsExecutingTask.RGVName = "RGV01"; |
| | | IsExecutingTask.CurrentAddress = IsExecutingTask.Remark; |
| | | IsExecutingTask.Remark = ""; |
| | | IsExecutingTask.TaskState = (int)TaskInStatusEnum.RGV_TransFer; |
| | | _taskRepository.UpdateData(IsExecutingTask); |
| | | Thread.Sleep(1000); |
| | | } |
| | | else |
| | | { |
| | | IsExecutingTask.RGVName = SecondRgv.DeviceCode; |
| | | _taskRepository.UpdateData(IsExecutingTask); |
| | | _taskService.UpdateTaskStatusToNext(IsExecutingTask.TaskNum); |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var taskNew = DispatchTask(SecondRgv); |
| | | Dt_Task taskNew = null; |
| | | taskNew = GetTransFerTask(SecondRgv); |
| | | if (taskNew == null) |
| | | { |
| | | taskNew = DispatchTask(SecondRgv); |
| | | } |
| | | |
| | | if (taskNew != null) |
| | | { |
| | | RGVTaskCommand? rgvTaskCommand = ConvertToRGVTaskCommand(taskNew); |
| | |
| | | bool sendFlag = SendCommand(SecondRgv, rgvTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | taskNew.RGVName = SecondRgv.DeviceCode; |
| | | _taskRepository.UpdateData(taskNew); |
| | | _taskService.UpdateTaskStatusToNext(taskNew.TaskNum); |
| | | Thread.Sleep(1000); |
| | | if (taskNew.TaskState == (int)TaskInStatusEnum.RGV_TransFerFInish) |
| | | { |
| | | taskNew.TaskState = (int)TaskInStatusEnum.RGV_InExecuting; |
| | | _taskRepository.UpdateData(taskNew); |
| | | Thread.Sleep(1000); |
| | | } |
| | | else if (taskNew.TaskState == (int)TaskOutStatusEnum.RGV_TransFerFInish) |
| | | { |
| | | taskNew.TaskState = (int)TaskOutStatusEnum.RGV_OutExecuting; |
| | | _taskRepository.UpdateData(taskNew); |
| | | Thread.Sleep(1000); |
| | | } |
| | | else if (taskNew.Remark != null) |
| | | { |
| | | taskNew.RGVName = "RGV01"; |
| | | taskNew.CurrentAddress = taskNew.Remark; |
| | | taskNew.Remark = ""; |
| | | taskNew.TaskState = (int)TaskOutStatusEnum.RGV_TransFer; |
| | | _taskRepository.UpdateData(taskNew); |
| | | Thread.Sleep(1000); |
| | | } |
| | | else |
| | | { |
| | | taskNew.RGVName = SecondRgv.DeviceCode; |
| | | _taskRepository.UpdateData(taskNew); |
| | | _taskService.UpdateTaskStatusToNext(taskNew.TaskNum); |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | 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)}ãã"); |
| | | 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) |
| | | { |
| | | return GetDispatchExecutingTask(taskSecond); |
| | | } |
| | | |
| | | return task; |
| | | } |
| | | } |
| | |
| | | { |
| | | if (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)}ãã"); |
| | | 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) |
| | | { |
| | | return GetDispatchExecutingTask(taskSecond); |
| | | } |
| | | return task; |
| | | } |
| | | } |
| | |
| | | }; |
| | | SendCommand(commonRGVSecond, command); |
| | | } |
| | | 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)}ãã"); |
| | | 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); |
| | | return task; |
| | | } |
| | |
| | | { |
| | | 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)}ãã"); |
| | | 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) |
| | | { |
| | | return GetDispatchExecutingTask(taskSecond); |
| | | } |
| | | return task; |
| | | } |
| | | } |
| | |
| | | { |
| | | if (task.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || task.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) |
| | | { |
| | | if (taskSecond.TargetStation-task.TargetStation >1 ) |
| | | if (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)}ãã"); |
| | | 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) |
| | | { |
| | | return GetDispatchExecutingTask(taskSecond); |
| | | } |
| | | return task; |
| | | } |
| | | } |
| | |
| | | }; |
| | | SendCommand(commonRGVFirst, command); |
| | | } |
| | | 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)}ãã"); |
| | | 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); |
| | | return task; |
| | | } |
| | |
| | | var taskSecond = _taskRepository.QueryFirst(x => x.RGVName == "RGV02" && x.TaskNum == commonRGVSecond.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum)); |
| | | 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) |
| | | { |
| | | #region |
| | | //if (taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_Outdispatch || taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) |
| | | //{ |
| | | |
| | | task = tasks.FirstOrDefault(x =>(x.SourceStation- taskSecond.TargetStation > 1 && x.SourceStation - taskSecond.SourceStation > 1&&x.TaskType==(int)TaskInboundTypeEnum.Inbound) ||(x.SourceStation - taskSecond.TargetStation > 1 && x.TargetStation - taskSecond.SourceStation > 1 && x.SourceStation - taskSecond.SourceStation > 1 && x.TargetStation - taskSecond.TargetStation > 1&&x.TaskType== (int)TaskOutboundTypeEnum.Outbound)); |
| | | if (task == null) |
| | | { |
| | | task = tasks.FirstOrDefault(x => (x.SourceStation - taskSecond.TargetStation > 1 && x.SourceStation - taskSecond.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - taskSecond.TargetStation > 1 && x.TargetStation - taskSecond.SourceStation > 1 && x.SourceStation - taskSecond.SourceStation > 1 && x.TargetStation - taskSecond.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); |
| | | } |
| | | LogAndWarn("æ§è¡è°åº¦ä»»å¡æ§å¶", $"ã{commonRGVSecond.DeviceCode}工使¨¡å¼ï¼ã{commonRGV.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}ã设å¤ç¶æï¼ã{commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Fault)}ãã{commonRGVSecond.DeviceCode}ãä»»å¡ã{JsonConvert.SerializeObject(taskSecond)}ã{commonRGVSecond.DeviceCode}è¿åä»»å¡ï¼ã{JsonConvert.SerializeObject(task.TaskNum)}ãã"); |
| | | // //task = tasks.FirstOrDefault(x =>(x.SourceStation- taskSecond.TargetStation > 1 && x.SourceStation - taskSecond.SourceStation > 1&&x.TaskType==(int)TaskInboundTypeEnum.Inbound) ||(x.SourceStation - taskSecond.TargetStation > 1 && x.TargetStation - taskSecond.SourceStation > 1 && x.SourceStation - taskSecond.SourceStation > 1 && x.TargetStation - taskSecond.TargetStation > 1&&x.TaskType== (int)TaskOutboundTypeEnum.Outbound)); |
| | | // //if (task == null) |
| | | // //{ |
| | | // // task = tasks.FirstOrDefault(x => (x.SourceStation - taskSecond.TargetStation > 1 && x.SourceStation - taskSecond.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - taskSecond.TargetStation > 1 && x.TargetStation - taskSecond.SourceStation > 1 && x.SourceStation - taskSecond.SourceStation > 1 && x.TargetStation - taskSecond.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); |
| | | // //} |
| | | |
| | | Thread.Sleep(1000); |
| | | return task; |
| | | } |
| | | else if (taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_InExecuting) |
| | | { |
| | | task = tasks.FirstOrDefault(x => x.SourceStation - taskSecond.TargetStation> 1 &&x.TargetStation - taskSecond.TargetStation > 1); |
| | | // 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); |
| | | return task; |
| | | } |
| | | return null; |
| | | // LogAndWarn("æ§è¡è°åº¦ä»»å¡æ§å¶", $"ã{commonRGVSecond.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); |
| | | // return task; |
| | | //} |
| | | //else if (taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_InExecuting) |
| | | //{ |
| | | // task = tasks.FirstOrDefault(x => x.SourceStation - taskSecond.TargetStation> 1 &&x.TargetStation - taskSecond.TargetStation > 1); |
| | | |
| | | // 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); |
| | | // return task; |
| | | //} |
| | | //return null; |
| | | #endregion |
| | | |
| | | 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); |
| | | |
| | | return task; |
| | | } |
| | | else |
| | | { |
| | | 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"))).ToList(); |
| | | 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(); |
| | | if (taskNews.Count== 0) |
| | | { |
| | | return null; |
| | |
| | | var taskFirst = _taskRepository.QueryFirst(x => x.RGVName == "RGV01" && x.TaskNum == commonRGVFirst.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum)); |
| | | if (taskFirst != null) |
| | | { |
| | | if (taskFirst.TaskState == (int)TaskOutStatusEnum.RGV_Outdispatch || taskFirst.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || taskFirst.TaskState == (int)TaskInStatusEnum.RGV_Indispatch || taskFirst.TaskState == (int)TaskInStatusEnum.RGV_InAwaitWMS || taskFirst.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) |
| | | { |
| | | #region |
| | | //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)); |
| | | // //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)); |
| | | |
| | | 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); |
| | | // task = GetDispatchTask(tasks, taskFirst); |
| | | |
| | | return task; |
| | | } |
| | | else if (taskFirst.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || taskFirst.TaskState == (int)TaskInStatusEnum.RGV_InExecuting) |
| | | { |
| | | task = tasks.FirstOrDefault(x => taskFirst.TargetStation - x.SourceStation > 1 && taskFirst.TargetStation - x.TargetStation > 1); |
| | | // 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); |
| | | |
| | | 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; |
| | | } |
| | | return null; |
| | | // return task; |
| | | //} |
| | | //else if (taskFirst.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || taskFirst.TaskState == (int)TaskInStatusEnum.RGV_InExecuting) |
| | | //{ |
| | | // task = tasks.FirstOrDefault(x => taskFirst.TargetStation - x.SourceStation > 1 && taskFirst.TargetStation - x.TargetStation > 1); |
| | | |
| | | // 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; |
| | | //} |
| | | //return null; |
| | | #endregion |
| | | |
| | | 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)}ãã"); |
| | | Thread.Sleep(1000); |
| | | |
| | | return task; |
| | | } |
| | | else |
| | | { |
| | | var taskNews = tasks.Where(x => (x.TaskType == (int)TaskInboundTypeEnum.Inbound && Convert.ToInt32(x.SourceAddress) > 1015) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound && (x.Roadway == "SC04" || x.Roadway == "SC05" || x.Roadway == "SC06"))).ToList(); |
| | | var taskNews = tasks.Where(x => (x.TaskType == (int)TaskInboundTypeEnum.Inbound && Convert.ToInt32(x.SourceAddress) > 1015) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound && (x.Roadway == "SC04" || x.Roadway == "SC05" || x.Roadway == "SC06"))||x.RGVName=="RGV02").ToList(); |
| | | if (taskNews.Count == 0) |
| | | { |
| | | return null; |
| | |
| | | } |
| | | } |
| | | |
| | | public Dt_Task GetTransFerTask(CommonRGV_FirstFloor commonRGV) |
| | | { |
| | | try |
| | | { |
| | | var tasks = _taskRepository.QueryData(x=>x.TaskState==(int)TaskInStatusEnum.RGV_TransFerFInish|| x.TaskState == (int)TaskOutStatusEnum.RGV_TransFerFInish); |
| | | Dt_Task task; |
| | | if (tasks.Count() == 0) |
| | | { |
| | | return null; |
| | | } |
| | | if (commonRGV.DeviceCode == "RGV01") |
| | | { |
| | | CommonRGV_FirstFloor? commonRGVSecond = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "RGV02") as CommonRGV_FirstFloor; |
| | | if (commonRGVSecond != 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)); |
| | | if (taskSecond != null) |
| | | { |
| | | if (taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_Outdispatch || taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) |
| | | { |
| | | task = tasks.FirstOrDefault(x => ((x.SourceStation - taskSecond.TargetStation > 1 && x.SourceStation - taskSecond.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - taskSecond.TargetStation > 1 && x.TargetStation - taskSecond.SourceStation > 1 && x.SourceStation - taskSecond.SourceStation > 1 && x.TargetStation - taskSecond.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound))&&x.RGVName=="RGV01"); |
| | | |
| | | |
| | | LogAndWarn("æ§è¡è°åº¦ä»»å¡æ§å¶", $"ã{commonRGVSecond.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); |
| | | return task; |
| | | } |
| | | else if (taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_InExecuting) |
| | | { |
| | | task = tasks.FirstOrDefault(x => x.SourceStation - taskSecond.TargetStation > 1 && x.TargetStation - taskSecond.TargetStation > 1 && x.RGVName == "RGV01"); |
| | | |
| | | 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); |
| | | return task; |
| | | } |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (commonRGVSecond.GetValue<RGVDBName, int>(RGVDBName.LevelPoint) > 35000) |
| | | { |
| | | RGVTaskCommand command = new RGVTaskCommand() |
| | | { |
| | | PickupLocation = (byte)Convert.ToSByte(15), |
| | | TaskNum = Convert.ToInt16(1000), |
| | | TaskType = (byte)Convert.ToSByte(1) |
| | | }; |
| | | SendCommand(commonRGVSecond, command); |
| | | } |
| | | if (tasks.FirstOrDefault(x => x.RGVName == "RGV01") != 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(tasks.FirstOrDefault(x => x.RGVName == "RGV01").TaskNum)}ãã"); |
| | | Thread.Sleep(1000); |
| | | return tasks.FirstOrDefault(x => x.RGVName == "RGV01"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (tasks.FirstOrDefault(x => x.RGVName == "RGV01") != 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(tasks.FirstOrDefault(x => x.RGVName == "RGV01").TaskNum)}ãã"); |
| | | Thread.Sleep(1000); |
| | | return tasks.FirstOrDefault(x => x.RGVName == "RGV01"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | 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"); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | CommonRGV_FirstFloor? commonRGVFirst = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "RGV01") as CommonRGV_FirstFloor; |
| | | if (commonRGVFirst != 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)); |
| | | 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 = 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)}ãã"); |
| | | Thread.Sleep(1000); |
| | | |
| | | return task; |
| | | } |
| | | else if (taskFirst.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || taskFirst.TaskState == (int)TaskInStatusEnum.RGV_InExecuting) |
| | | { |
| | | task = tasks.FirstOrDefault(x => taskFirst.TargetStation - x.SourceStation > 1 && taskFirst.TargetStation - x.TargetStation > 1 && 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)}ãã"); |
| | | Thread.Sleep(1000); |
| | | return task; |
| | | } |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (commonRGVFirst.GetValue<RGVDBName, int>(RGVDBName.LevelPoint) < 420000) |
| | | { |
| | | RGVTaskCommand command = new RGVTaskCommand() |
| | | { |
| | | PickupLocation = (byte)Convert.ToSByte(26), |
| | | TaskNum = Convert.ToInt16(1000), |
| | | TaskType = (byte)Convert.ToSByte(1) |
| | | }; |
| | | SendCommand(commonRGVFirst, command); |
| | | } |
| | | if (tasks.FirstOrDefault(x => x.RGVName == "RGV02") != 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(tasks.FirstOrDefault(x => x.RGVName == "RGV02").TaskNum)}ãã"); |
| | | |
| | | Thread.Sleep(1000); |
| | | return tasks.FirstOrDefault(x => x.RGVName == "RGV02"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (tasks.FirstOrDefault(x => x.RGVName == "RGV02") != 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(tasks.FirstOrDefault(x => x.RGVName == "RGV02").TaskNum)}ãã"); |
| | | Thread.Sleep(1000); |
| | | return tasks.FirstOrDefault(x => x.RGVName == "RGV02"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | 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"); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteInfo("è°åº¦ä»»å¡å¼å¸¸æ¥å¿", ex.Message + Environment.NewLine + ex.StackTrace); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// RGVä»»å¡å®æ |
| | | /// </summary> |
| | |
| | | |
| | | string Barcode = Encoding.UTF8.GetString(x); |
| | | |
| | | if (Barcode == null || Barcode == ""|| Barcode.Trim().Contains("\0")) |
| | | if (Barcode == null || Barcode == "" || Barcode.Trim().Contains("\0")) |
| | | { |
| | | commonRGV.SetValue(StackerCraneDBName.PutcargoLocation, Convert.ToSByte(stationManager.stationRemark)); |
| | | commonRGV.SetValue(StackerCraneDBName.TaskNum, Convert.ToInt16(task.TaskNum)); |
| | |
| | | |
| | | Dt_Task_Hty task_Hty = _mapper.Map<Dt_Task_Hty>(task); |
| | | task_Hty.TaskId = 0; |
| | | task_Hty.OperateType = (int)OperateTypeEnum.å¼å¸¸éå; |
| | | |
| | | _taskRepository.DeleteData(task); |
| | | _task_HtyRepository.AddData(task_Hty); |
| | |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | Thread.Sleep(100); |
| | | var Barcode = conveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.ConveyorLineBarcode, stationManager.stationChildCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, Convert.ToInt16(stationManager.stationNextChildCode), stationManager.stationChildCode); |
| | | Thread.Sleep(100); |
| | | conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTaskNum, Convert.ToInt16(1000), stationManager.stationChildCode); |
| | |
| | | return null; |
| | | } |
| | | |
| | | 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))).First(); |
| | | if (y == null) |
| | | { |
| | | 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.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); |
| | | } |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1001"); |
| | | if (device != null) |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | var stationManager = _stationManagerRepository.QueryData(x => x.stationType == 15); |
| | | if (stationManager.Count() > 0) |
| | | { |
| | | string next = null; |
| | | foreach (var item in stationManager) |
| | | { |
| | | short x = conveyorLine.GetValue<ConveyorLineDBName, short>(ConveyorLineDBName.InteractiveSignal, item.stationChildCode); |
| | | var structs = BitConverter.GetBytes(x).ToArray().ToBoolArray(); |
| | | if (structs[2]) |
| | | { |
| | | next = item.stationChildCode; |
| | | break; |
| | | } |
| | | } |
| | | if (next != null) |
| | | { |
| | | oldtask.Remark = next; |
| | | _taskRepository.UpdateData(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.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); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public Dt_Task? GetDispatchExecutingTask(Dt_Task oldtask) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1001"); |
| | | if (device != null) |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | var stationManager = _stationManagerRepository.QueryData(x => x.stationType == 15); |
| | | if (stationManager.Count() > 0) |
| | | { |
| | | string next = null; |
| | | foreach (var item in stationManager) |
| | | { |
| | | short x = conveyorLine.GetValue<ConveyorLineDBName, short>(ConveyorLineDBName.InteractiveSignal, item.stationChildCode); |
| | | var structs = BitConverter.GetBytes(x).ToArray().ToBoolArray(); |
| | | if (structs[2]) |
| | | { |
| | | next = item.stationChildCode; |
| | | break; |
| | | } |
| | | } |
| | | if (next != null) |
| | | { |
| | | oldtask.Remark = next; |
| | | _taskRepository.UpdateData(oldtask); |
| | | return oldtask; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®ä½è½¬æ¢æå½ä»¤Model |
| | | /// </summary> |
| | |
| | | rgvTaskCommand.TaskType = (byte)Convert.ToSByte(3); |
| | | rgvTaskCommand.PickupLocation = (byte)Convert.ToSByte(stationManager.stationRemark); |
| | | } |
| | | else if (task.TaskState == (int)TaskInStatusEnum.RGV_TransFerFInish) |
| | | { |
| | | Dt_StationManager stationManagerStart = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.CurrentAddress); |
| | | Dt_StationManager stationManagerEnd = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.NextAddress); |
| | | rgvTaskCommand.TaskType = (byte)Convert.ToSByte(5); |
| | | rgvTaskCommand.PickupLocation = (byte)Convert.ToSByte(stationManagerStart.stationRemark); |
| | | rgvTaskCommand.PutcargoLocation = (byte)Convert.ToSByte(stationManagerEnd.stationRemark); |
| | | } |
| | | else if (task.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) |
| | | { |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.NextAddress); |
| | | rgvTaskCommand.TaskType = (byte)Convert.ToSByte(4); |
| | | rgvTaskCommand.PutcargoLocation = (byte)Convert.ToSByte(stationManager.stationRemark); |
| | | if (task.Remark != null && (task.Roadway == "SC01" || task.Roadway == "SC06")) |
| | | { |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.Remark); |
| | | rgvTaskCommand.TaskType = (byte)Convert.ToSByte(4); |
| | | rgvTaskCommand.PutcargoLocation = (byte)Convert.ToSByte(stationManager.stationRemark); |
| | | } |
| | | else |
| | | { |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.NextAddress); |
| | | rgvTaskCommand.TaskType = (byte)Convert.ToSByte(4); |
| | | rgvTaskCommand.PutcargoLocation = (byte)Convert.ToSByte(stationManager.stationRemark); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if (task.TaskState == (int)TaskOutStatusEnum.Line_OutFinish) |
| | | { |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.CurrentAddress); |
| | | rgvTaskCommand.TaskType = (byte)Convert.ToSByte(3); |
| | | rgvTaskCommand.PickupLocation = (byte)Convert.ToSByte(stationManager.stationRemark); |
| | | if (task.Remark != null && (task.Roadway == "SC01" || task.Roadway == "SC06")) |
| | | { |
| | | Dt_StationManager stationManagerStart = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.CurrentAddress); |
| | | Dt_StationManager stationManagerEnd = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.Remark); |
| | | rgvTaskCommand.TaskType = (byte)Convert.ToSByte(5); |
| | | rgvTaskCommand.PickupLocation = (byte)Convert.ToSByte(stationManagerStart.stationRemark); |
| | | rgvTaskCommand.PutcargoLocation = (byte)Convert.ToSByte(stationManagerEnd.stationRemark); |
| | | } |
| | | else |
| | | { |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.CurrentAddress); |
| | | rgvTaskCommand.TaskType = (byte)Convert.ToSByte(3); |
| | | rgvTaskCommand.PickupLocation = (byte)Convert.ToSByte(stationManager.stationRemark); |
| | | } |
| | | } |
| | | else if (task.TaskState == (int)TaskOutStatusEnum.RGV_TransFerFInish) |
| | | { |
| | | Dt_StationManager stationManagerStart = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.CurrentAddress); |
| | | Dt_StationManager stationManagerEnd = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.NextAddress); |
| | | rgvTaskCommand.TaskType = (byte)Convert.ToSByte(5); |
| | | rgvTaskCommand.PickupLocation = (byte)Convert.ToSByte(stationManagerStart.stationRemark); |
| | | rgvTaskCommand.PutcargoLocation = (byte)Convert.ToSByte(stationManagerEnd.stationRemark); |
| | | } |
| | | else if (task.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish) |
| | | { |