1
czw
2025-07-06 42178c2120a5595a57d8f3d5a394ad2caeac6585
2025Äê6ÔÂ12ÈÕ/AuxAllWCS/Build/Project/´úÂë/VS×Ô¶¨ÒåÀà/AutoThread.cs
@@ -77,8 +77,8 @@
            }
            // æ‰§è¡Œå§”托
            if (methodName != "TaskEverythingRun")
                return null;
            //if (methodName != "TaskEverythingRun")
            //    return null;
            return methodDelegate.DynamicInvoke(args);
        }
@@ -255,6 +255,8 @@
            if (VERX != null)
            {
                if (tag.wxr1.R44)
                    LogHelper.Info($"{VERX.deviceName} R44>{tag.wxr1.R44} R44LAST>{tag.wxr1.R44_LAST} R10>{tag.wxr1.R10}");
                if (tag.wxr1.R44 && !tag.wxr1.R44_LAST && tag.wxr1.R10)
                {
                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
@@ -293,16 +295,21 @@
                        if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                        {
                            //上报校验。
                            LogHelper.Info($"{VERX.deviceNo[0]} ä¸ŠæŠ¥æ ¡éªŒ>{traycode}");
                            ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
                            var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new
                            {
                                sceneType = 1,
                                cntrCode = traycode,
                            }));
                            if (str.Contains("true"))
                            var strr = JsonConvert.DeserializeObject<Mesrespone>(str);
                            if (strr != null && strr.success)
                            //if (str.Contains("true"))
                            {
                                //Conn.默认Redis.SetValue("维希尔抓臂1.R10", "true", "维希尔抓臂1Queue");
                                tag.wxr1.R10 = true;
                                //tag.wxr1.R10 = true;
                                Conn.默认Redis.SetValue(VERX.deviceName + ".R10", "true", VERX.deviceName + "Queue");
                                //tag.wxr1.R44_LAST = false;
                                RedisHelper.Add($"维希尔抓臂1.R44_LAST", "false", out string msg);
                            }
@@ -312,6 +319,10 @@
                            }
                        }
                        else { TcpServer.TcpServerSend(VERX.deviceNo[0], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E")); }
                    }
                    else if (!tag.wxr1.R10)
                    {
                        TcpServer.TrayIps.Remove(VERX.deviceNo[0]);
                    }
                }
            }
@@ -328,6 +339,8 @@
            if (VERX != null)
            {
                if (tag.wxr1.R46)
                    LogHelper.Info($"{VERX.deviceName} R44>{tag.wxr1.R46} R44LAST>{tag.wxr1.R46_LAST} R10>{tag.wxr1.R11}");
                if (tag.wxr1.R46 && !tag.wxr1.R46_LAST && tag.wxr1.R11)
                {
                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
@@ -365,16 +378,20 @@
                        if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                        {
                            //上报校验。
                            LogHelper.Info($"{VERX.deviceNo[1]} ä¸ŠæŠ¥æ ¡éªŒ>{traycode}");
                            ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
                            var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new
                            {
                                sceneType = 1,
                                cntrCode = traycode,
                            }));
                            if (str.Contains("true"))
                            var strr = JsonConvert.DeserializeObject<Mesrespone>(str);
                            if (strr != null && strr.success)
                                //if (str.Contains("true"))
                            {
                                //Conn.默认Redis.SetValue("维希尔抓臂1.R10", "true", "维希尔抓臂1Queue");
                                tag.wxr1.R11 = true;
                                //tag.wxr1.R11 = true;
                                Conn.默认Redis.SetValue(VERX.deviceName + ".R11", "true", VERX.deviceName + "Queue");
                                //tag.wxr1.R46_LAST = false;
                                RedisHelper.Add($"维希尔抓臂1.R46_LAST", "false", out string msg);
                            }
@@ -384,6 +401,10 @@
                            }
                        }
                        else { TcpServer.TcpServerSend(VERX.deviceNo[1], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E")); }
                    }
                    else if (!tag.wxr1.R11)
                    {
                        TcpServer.TrayIps.Remove(VERX.deviceNo[1]);
                    }
                }
            }
@@ -400,6 +421,8 @@
            if (VERX != null)
            {
                if (tag.wxr2.R44)
                    LogHelper.Info($"{VERX.deviceName} R44>{tag.wxr2.R44} R44LAST>{tag.wxr2.R44_LAST} R10>{tag.wxr2.R10}");
                if (tag.wxr2.R44 && !tag.wxr2.R44_LAST && tag.wxr2.R10)
                {
                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
@@ -437,16 +460,20 @@
                        if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                        {
                            //上报校验。
                            LogHelper.Info($"{VERX.deviceNo[0]} ä¸ŠæŠ¥æ ¡éªŒ>{traycode}");
                            ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
                            var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new
                            {
                                sceneType = 1,
                                cntrCode = traycode,
                            }));
                            if (str.Contains("true"))
                            var strr = JsonConvert.DeserializeObject<Mesrespone>(str);
                            if (strr != null && strr.success)
                                //if (str.Contains("true"))
                            {
                                //Conn.默认Redis.SetValue("维希尔抓臂1.R10", "true", "维希尔抓臂1Queue");
                                tag.wxr2.R10 = true;
                                //tag.wxr2.R10 = true;
                                Conn.默认Redis.SetValue(VERX.deviceName + ".R10", "true", VERX.deviceName + "Queue");
                                //tag.wxr2.R44_LAST = false;
                                RedisHelper.Add($"维希尔抓臂2.R44_LAST", "false", out string msg);
                            }
@@ -456,6 +483,10 @@
                            }
                        }
                        else { TcpServer.TcpServerSend(VERX.deviceNo[0], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E")); }
                    }
                    else if (!tag.wxr2.R10)
                    {
                        TcpServer.TrayIps.Remove(VERX.deviceNo[0]);
                    }
                }
            }
@@ -473,6 +504,8 @@
            if (VERX != null)
            {
                if (tag.wxr2.R46)
                    LogHelper.Info($"{VERX.deviceName} R44>{tag.wxr2.R46} R44LAST>{tag.wxr2.R46_LAST} R10>{tag.wxr2.R11}");
                if (tag.wxr2.R46 && !tag.wxr2.R46_LAST && tag.wxr2.R11)
                {
                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
@@ -511,7 +544,7 @@
                        else
                        if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                        {
                            LogHelper.Info($"Threadwxr2R ä¸ŠæŠ¥æ ¡éªŒ>{traycode}");
                            LogHelper.Info($"{VERX.deviceNo[1]} ä¸ŠæŠ¥æ ¡éªŒ>{traycode}");
                            //上报校验。
                            ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
                            var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new
@@ -519,12 +552,17 @@
                                sceneType = 1,
                                cntrCode = traycode,
                            }));
                            if (str.Contains("true"))
                            var strr = JsonConvert.DeserializeObject<Mesrespone>(str);
                            if (strr != null && strr.success)
                            {
                                //Conn.默认Redis.SetValue("维希尔抓臂1.R10", "true", "维希尔抓臂1Queue");
                                tag.wxr2.R11 = true;
                                //Conn.默认Redis.SetValue("维希尔抓臂1.R11", "true", "维希尔抓臂1Queue");
                                //tag.wxr2.R11 = true;
                                LogHelper.Info($"Threadwxr2R。。  -写R11 true");
                                Conn.默认Redis.SetValue(VERX.deviceName + ".R11", "true", VERX.deviceName + "Queue");
                                //tag.wxr2.R46_LAST = false;
                                RedisHelper.Add($"维希尔抓臂2.R46_LAST", "false", out string msg);
                                LogHelper.Info($"Threadwxr2R。。 æ ¡éªŒä¸‹æ–™å®Œæˆã€‚");
                            }
                            else
                            {
@@ -536,6 +574,10 @@
                            LogHelper.Info($"Threadwxr2R。。  -发送扫码");
                            TcpServer.TcpServerSend(VERX.deviceNo[1], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E"));
                        }
                    }
                    else if (!tag.wxr2.R11)
                    {
                        TcpServer.TrayIps.Remove(VERX.deviceNo[1]);
                    }
                }
            }
@@ -1585,6 +1627,10 @@
            foreach (var task in tasks)
            {
                LogHelper.Info($"解释MES任务 ->{task.S_TASK_NO} ");
                if (task.S_TYPE?.Trim() == "100")
                {
                    LogHelper.Info($"MES任务 S_TYPE 100->{task.S_TYPE} ");
                }
                var sx = VERXs?.Find(x => x.location.Contains(task.S_END_LOC));
                LogHelper.Info($"解释MES任务 ->{task.S_TASK_NO} {(sx == null ? "非" : "是")}总装机器人任务");
                if (sx == null)
@@ -2411,6 +2457,12 @@
        public Ddata data { get; set; }
        public object extra { get; set; }
    }
    class Mesrespone
    {
        public bool success { get; set; }
        public string msg { get; set; }
        public object extra { get; set; }
    }
    public class Ddata
    {