src/Bro.M141.Process/MyMQTT.cs
@@ -61,7 +61,6 @@
            _connection = _factory.CreateConnection();
            _sendChannel = _connection.CreateModel();
            if (channel == 0)
            {
                _receiveChannel1 = _connection.CreateModel();
@@ -159,7 +158,7 @@
        }
        int num = 0;
        public async Task<string> MESForBasketAsync(string ztype, string zlsn, string zlpn, string zstatus, string zversion, int timeoutMes = 30000)
        public async Task<string> MESForBasketAsync(string ztype, string zlsn, string zlpn, string zstatus, string zversion, int timeoutMes = 60000)
        {
            string keystr = ztype + "_" + zlsn + "_" + zlpn + "_" + zstatus;
@@ -168,29 +167,28 @@
            {
                CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"{keystr}匹配成功");
                num++;
                //var tem = MSGClasses.FirstOrDefault(u => u.key == keystr);
                var tem = MSGClasses.Where(u => u.key == "1" && !string.IsNullOrEmpty(u.receive)).ToList();
                //DateTime dt = DateTime.Now;
                var tem = MSGClasses.Where(u => u.key == keystr && !string.IsNullOrEmpty(u.receive)).ToList();
                if (num < 10)
                {
                    //while ((DateTime.Now - dt).TotalMilliseconds < timeoutMes)
                    //{
                        if (!string.IsNullOrEmpty(tem[0].receive))
                    if (tem!=null)
                    {
                        if (tem.Count()>0)
                        {
                            CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ {keystr}二次接收 返回值正常 {tem[0].receive}");
                            return tem[0].receive;
                        }
                        Thread.Sleep(1000);
                    //}
                            if (!string.IsNullOrEmpty(tem[0].receive))
                            {
                                CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ {keystr}二次接收 返回值正常 {tem[0].receive}");
                                return tem[0].receive;
                            }
                            Thread.Sleep(1000);
                        }
                    }
                }
                else 
                {
                    num = 0;
                    CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ超时处理次数超过十次");
                    //return null;
                }
                CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ二次接收数据接收为空");
                //return null;
            }
            var guid = Guid.NewGuid().ToString();
@@ -215,7 +213,6 @@
            _sendChannel.BasicPublish("", "auto_line_mac_queue", null, body);
            var completed = await Task.WhenAny(tcs.Task, Task.Delay(timeoutMes));
            _pendingTask1.TryRemove(guid, out _);
            if (completed == tcs.Task)
@@ -272,8 +269,6 @@
            string zr = DefectCodeMap.TryGetValue(pro.Result, out var code) ? code : DefaultErrorCode;
            var msgObj = new AutoLineMacBarcodeQueue
            {
                zbguid = guid,
@@ -317,11 +312,8 @@
    public class MSGClass
    {
        public string key { get; set; }
        public string zguid { get; set; }
        public string receive { get; set; }
    }