1
czw
2025-07-08 9ca7e0307c853871aa984c25eacee18eee01e02d
2025Äê6ÔÂ12ÈÕ/AuxAllWCS/Build/Project/´úÂë/VS×Ô¶¨ÒåÀà/AutoThread.cs
@@ -26,6 +26,7 @@
using System.Net;
using System.Threading;
using System.IO;
using GZ.Device.Agv;
namespace GZ.Projects.AuxAllWCS
{
@@ -77,8 +78,8 @@
            }
            // æ‰§è¡Œå§”托
            //if (methodName != "TaskEverythingRun")
            //    return null;
            if (methodName != "TaskEverythingRun")
                return null;
            return methodDelegate.DynamicInvoke(args);
        }
@@ -647,11 +648,18 @@
                }
                if (tag.RGV.taskend == 125)
                {
                    LogHelper.Info($"RGV æœ‰125命令未执行。");
                    LogHelper.Info($"RGV æœ‰125命令未执行。 ");
                    LogHelper.Info($"RGV125命令未执行 ä»»åŠ¡æ•°æ® workmode:{tag.RGV.workMod}\n taskmod{tag.RGV.taskmod} \n t1No:{tag.RGV.taskno1}\n t1do:{tag.RGV.task1do} \n t2No:{tag.RGV.taskno2}\n t2do:{tag.RGV.task2do}\n taskend:{tag.RGV.taskend} ");
                    if (tag.RGV.workMod == 0 && tag.RGV.taskmod == 0 && tag.RGV.taskno1 == tag.RGV.ReadTask1No && tag.RGV.taskno2 == tag.RGV.ReadTask2No)
                    {
                        LogHelper.Info($"RGV125命令未执行 tag.RGV.workMod == 0 && tag.RGV.taskmod == 0 && tag.RGV.taskno1 == tag.RGV.ReadTask1No && tag.RGV.taskno2 == tag.RGV.ReadTask2No  è‡ªåŠ¨æ¸…é™¤125");
                        Conn.默认Redis.SetValue("RGV.taskend", "0", "RGVQueue", false);
                    }
                    System.Threading.Thread.Sleep(3000);
                    return;
                }
                LogHelper.Info($"任务下发 Rgv ä»»åŠ¡ è¿›å…¥ Rgv信息 W1状态{tag.RGV.w1status} ReadTask1No>{tag.RGV.ReadTask1No} bit1taskOver>{tag.RGV.bit1taskOver} W2状态{tag.RGV.w2status} ReadTask2No>{tag.RGV.ReadTask2No} bit2taskOver>{tag.RGV.bit2taskOver}");
                LogHelper.Info($"任务下发 Rgv ä»»åŠ¡ è¿›å…¥ Rgv信息 W1状态{tag.RGV.w1status} ReadTask1No>{tag.RGV.ReadTask1No} 1工位条码:{tag.RGV.bit1Code} bit1taskOver>{tag.RGV.bit1taskOver} W2状态{tag.RGV.w2status} ReadTask2No>{tag.RGV.ReadTask2No} 2工位条码:{tag.RGV.bit2Code} bit2taskOver>{tag.RGV.bit2taskOver}");
                TaskEntity task1 = null;
                TaskEntity task2 = null;
                var task1Isrun = false;
@@ -713,7 +721,7 @@
                                task1.S_B_STATE = "取货完成";
                            }
                            //tag.RGV.bit1taskOver = 0;
                            LogHelper.Info($"RGV 1工位任务{task1.S_TASK_NO} çŠ¶æ€åˆ‡æ¢ä¸º{task1.S_B_STATE}");
                            LogHelper.Info($"RGV 1工位任务{task1.S_TASK_NO} æ¡ç ï¼š{tag.RGV.bit1Code} çŠ¶æ€åˆ‡æ¢ä¸º{task1.S_B_STATE}");
                            //tag.RGV.bit1taskOver_LAST = 1;
                            RedisHelper.Add($"RGV.bit1taskOver_LAST", "1", out string msg);
                            LogHelper.Info($"RGV 1工位任务写处理");
@@ -755,7 +763,7 @@
                                task2.S_B_STATE = "取货完成";
                            }
                            //tag.RGV.bit2taskOver = 0;
                            LogHelper.Info($"RGV 2工位任务{task2.S_TASK_NO} çŠ¶æ€åˆ‡æ¢ä¸º{task2.S_B_STATE}");
                            LogHelper.Info($"RGV 2工位任务{task2.S_TASK_NO} æ¡ç ï¼š{tag.RGV.bit2Code} çŠ¶æ€åˆ‡æ¢ä¸º{task2.S_B_STATE}");
                            RedisHelper.Add($"RGV.bit2taskOver_LAST", "1", out string msg);
                            LogHelper.Info($"RGV 2工位任务写处理");
                            taskservice.Update(task2);
@@ -996,7 +1004,18 @@
            var taskCOdes = new List<string> { "Sarrive", "Srelease", "Earrive", "Erelease" };
            TaskActRepository taskActRepository = new TaskActRepository();
            TaskRepository taskRepository = new TaskRepository();
            var requires = taskActRepository.FindList(x => DateTime.Now.Subtract(x.T_CREATE).TotalHours < 1 && taskCOdes.Contains(x.S_ACTION_CODE) && x.N_CREATEMETHOD == 0).OrderBy(x => x.T_CREATE);
            var requires = taskActRepository.FindList(x => taskCOdes.Contains(x.S_ACTION_CODE) && x.N_CREATEMETHOD == 0).OrderBy(x => x.T_CREATE).ToList();
            var timeMorhours = requires.FindAll(x => DateTime.Now.Subtract(x.T_CREATE).TotalHours > 1);
            if (timeMorhours.Any())
            {
                foreach (var mor in timeMorhours)
                {
                    mor.N_CREATEMETHOD = 2;
                    mor.S_REVIEW_COMMENT = "超时不处理";
                    taskActRepository.Update(mor);
                }
                requires = requires.Except(timeMorhours).ToList();
            }
            foreach (var item in requires)
            {
                LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE}光栅处理 =================> ");
@@ -1004,6 +1023,7 @@
                if (tin == -1)
                {
                    item.N_CREATEMETHOD = -1;
                    item.S_REVIEW_COMMENT = $"信号未知{item.S_ACTION_CODE}不处理";
                    taskActRepository.Update(item);
                    continue;
                }
@@ -1011,6 +1031,7 @@
                if (task == null)
                {
                    item.N_CREATEMETHOD = -1;
                    item.S_REVIEW_COMMENT = $"任务丢失不处理";
                    taskActRepository.Update(item);
                    continue;
                }
@@ -1051,6 +1072,7 @@
                        LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} è®¾å¤‡æ˜¯{dev.deviceName} å¼€å¯å…‰æ …处理完成 =================> ");
                        item.N_CREATEMETHOD = 1;
                        item.S_REVIEW_COMMENT = $"光栅开启完成";
                        taskActRepository.Update(item);
                    }
                    //车要进入交互。
@@ -1108,6 +1130,7 @@
                        taskCode = item.S_TASK_NO
                    });
                    item.N_CREATEMETHOD = 1;
                    item.S_REVIEW_COMMENT = $"车子继续任务OK";
                    taskActRepository.Update(item);
                }
            }
@@ -1171,7 +1194,7 @@
                        var listtep = new List<string>();
                        if (Bssx == "1020")
                        {
                            if (tag.SF下料位.RArrive1003 == 1)
                            if (!string.IsNullOrEmpty(tag.SFT下料口托盘.R1003Barcode) && string.IsNullOrEmpty(tag.SFT下料口托盘.R1011Barcode))
                            {
                                listtep = new List<string> { "1012", "1004" };
                            }
@@ -1182,7 +1205,8 @@
                        }
                        else
                        {
                            if (tag.SF下料位.RArrive1005 == 1)
                            //if (tag.SF下料位.RArrive1005 == 1)
                            if (!string.IsNullOrEmpty(tag.SFT下料口托盘.R1005Barcode) && string.IsNullOrEmpty(tag.SFT下料口托盘.R1013Barcode))
                            {
                                listtep = new List<string> { "1014", "1006" };
                            }