huangxiaoqiang
2025-07-28 b31d961a3f0bcd2e555ea12b76c30c453826deba
ÏîÄ¿´úÂë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob/CommonRGVJob.cs
@@ -116,20 +116,32 @@
                    }
                    var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList();
                    var userIds = tokenInfos?.Select(x => x.UserId).ToList();
                    string RGVAutoStatus(bool AutoStatus) => AutoStatus switch
                    {
                        true => "联机模式",
                        false => "单机模式",
                    };
                    string RGVWorkStatus(bool WorkStatus) => WorkStatus switch
                    {
                        true => "运行中",
                        false => "待机",
                    };
                    string RGVStatus(bool Status) => Status switch
                    {
                        true => "故障",
                        false => "正常",
                    };
                    object obj = new
                    {
                        Automatic = commonRGV.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.Automatic),
                        Fault = commonRGV.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.Fault),
                        Running = commonRGV.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.Running),
                        //commonRGV.StackerCraneAutoStatusDes,
                        //commonRGV.StackerCraneWorkStatusDes,
                        //commonRGV.DeviceCode,
                        //commonRGV.DeviceName,
                        //commonRGV.CurrentTaskNum,
                        //commonRGV.LastTaskNum,
                        Automatic = RGVAutoStatus(commonRGV.GetValue<RGVDBName, bool>(RGVDBName.Automatic)),
                        Fault = RGVStatus(commonRGV.GetValue<RGVDBName, bool>(RGVDBName.Fault)),
                        Running = RGVWorkStatus(commonRGV.GetValue<RGVDBName, bool>(RGVDBName.Running)),
                        LevelPoint = commonRGV.GetValue<RGVDBName, int>(RGVDBName.LevelPoint),
                        CurrentTaskNum = commonRGV.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum),
                        commonRGV.DeviceCode,
                        commonRGV.DeviceName,
                    };
                    _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { commonRGV.DeviceName, data = obj });
                    _noticeService.RGVData(userIds?.FirstOrDefault(), userTokenIds, new { commonRGV.DeviceName, data = obj });
                    #endregion è°ƒç”¨äº‹ä»¶æ€»çº¿é€šçŸ¥å‰ç«¯
                }
@@ -146,15 +158,6 @@
        {
            if (commonRGV != null)
            {
                #region æ—¥å¿—记录
                ConsoleHelper.WriteColorLine($"【{commonRGV.DeviceName}】堆垛机作业状态:【】时间【{DateTime.Now}】", ConsoleColor.Magenta);
                string str = $"【{commonRGV.DeviceName}】任务完成,任务号:【{TaskNum}】时间【{DateTime.Now}】";
                WriteInfo(commonRGV.DeviceName, str);
                ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue);
                #endregion
                var task = _taskRepository.QueryFirst(x => x.TaskNum == TaskNum);
                if (task != null)
                {
@@ -167,12 +170,11 @@
                            if (device != null)
                            {
                                CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
                                //var x = conveyorLine.Communicator.Read<string>("DB1103.16");
                                Thread.Sleep(100);
                                
                                var Barcode = conveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.ConveyorLineBarcode, stationManager.stationChildCode);
                                if (Barcode == null)
                                if (Barcode == null||Barcode=="")
                                {
                                    return;
                                }
@@ -184,7 +186,7 @@
                    {
                        if (task.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting)
                        {
                            Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress&&x.stationType==7);
                            Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress && x.stationType == 7);
                            if (stationManager != null)
                            {
                                IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManager.stationPLC);