林豪 左 1 rok temu
rodzic
commit
89615cc0d4

+ 12 - 2
WCS.WorkEngineering/Systems/MainSysyem.cs

@@ -135,7 +135,12 @@ namespace WCS.WorkEngineering.Systems
                         {
                             if (pack.Robot522.Any())
                             {
-                                var value = pack.Robot522.Select(x => x.Data).ToList();
+                                var value = pack.Robot522.Select(x => new QuestDb_Robot522()
+                                {
+                                    Alarm = Convert.ToString(x.Data.Alarm),
+                                    Code = x.Data.Code,
+                                    Frame = x.Data.Frame
+                                }).ToList();
                                 var sql = db.Insertable(value).ToSqlString();
                                 db.Ado.ExecuteCommand(sql);
                                 typeName = typeof(WCS_Robot522).Name;
@@ -185,7 +190,12 @@ namespace WCS.WorkEngineering.Systems
                         {
                             if (pack.SRM537.Any())
                             {
-                                var value = pack.SRM537.Select(x => x.Data).ToList();
+                                var value = pack.SRM537.Select(x => new QuestDb_SRM537()
+                                {
+                                    Alarm = Convert.ToString(x.Data.Alarm),
+                                    Code = x.Data.Code,
+                                    Frame = x.Data.Frame
+                                }).ToList();
                                 var sql = db.Insertable(value).ToSqlString();
                                 db.Ado.ExecuteCommand(sql);
                                 typeName = typeof(WCS_SRM537).Name;

+ 25 - 784
WCS.WorkEngineering/WorkStart.cs

@@ -424,750 +424,6 @@ namespace WCS.WorkEngineering
             }
 
             #endregion 初始化堆垛机相关信息
-
-            //var toao = 100;
-            //Task.Run(() =>
-            //{
-            //    while (true)
-            //    {
-            //        //var sw = new Stopwatch();
-            //        //sw.Start();
-            //        //var sw1 = new Stopwatch();
-            //        //sw1.Start();
-
-            //        //try
-            //        //{
-            //        //    var db = new SqlSugarHelper().PLC;
-            //        //    var pack = RedisHub.Monitor.BLPop<DeviceDataPack>("DataCollectionpacks", 0); ;
-
-            //        //    var sw4 = new Stopwatch();
-            //        //    sw4.Start();
-
-            //        //    Parallel.ForEach(pack.GetType().GetProperties().OrderBy(x => x.Name), ps =>
-            //        //    {
-            //        //        var sw10 = new Stopwatch();
-            //        //        sw10.Start();
-            //        //        var typeName = "";
-            //        //        try
-            //        //        {
-            //        //            if (ps.PropertyType == typeof(ProtocolData<WCS_BCR80>[]))
-            //        //            {
-            //        //                if (pack.BCR80.Any())
-            //        //                {
-            //        //                    var value = pack.BCR80.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_BCR80).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_BCR81>[]))
-            //        //            {
-            //        //                if (pack.BCR81.Any())
-            //        //                {
-            //        //                    var value = pack.BCR81.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_BCR81).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_BCR83>[]))
-            //        //            {
-            //        //                if (pack.BCR83.Any())
-            //        //                {
-            //        //                    var value = pack.BCR83.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_BCR83).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_RGV520>[]))
-            //        //            {
-            //        //                if (pack.RGV520.Any())
-            //        //                {
-            //        //                    var value = pack.RGV520.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_RGV520).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_RGV521>[]))
-            //        //            {
-            //        //                if (pack.RGV521.Any())
-            //        //                {
-            //        //                    var value = pack.RGV521.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_RGV521).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Robot520>[]))
-            //        //            {
-            //        //                if (pack.Robot520.Any())
-            //        //                {
-            //        //                    var value = pack.Robot520.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Robot520).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Robot521>[]))
-            //        //            {
-            //        //                if (pack.Robot521.Any())
-            //        //                {
-            //        //                    var value = pack.Robot521.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Robot521).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Robot522>[]))
-            //        //            {
-            //        //                if (pack.Robot522.Any())
-            //        //                {
-            //        //                    var value = pack.Robot522.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    var sql = db.Insertable(value).ToSqlString();
-            //        //                    db.Ado.ExecuteCommand(sql);
-            //        //                    typeName = typeof(WCS_Robot522).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Robot530>[]))
-            //        //            {
-            //        //                if (pack.Robot530.Any())
-            //        //                {
-            //        //                    var value = pack.Robot530.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Robot530).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Robot531>[]))
-            //        //            {
-            //        //                if (pack.Robot531.Any())
-            //        //                {
-            //        //                    var value = pack.Robot531.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Robot531).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_SRM520>[]))
-            //        //            {
-            //        //                if (pack.SRM520.Any())
-            //        //                {
-            //        //                    var value = pack.SRM520.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_SRM520).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_SRM521>[]))
-            //        //            {
-            //        //                if (pack.SRM521.Any())
-            //        //                {
-            //        //                    var value = pack.SRM521.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_SRM521).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_SRM537>[]))
-            //        //            {
-            //        //                if (pack.SRM537.Any())
-            //        //                {
-            //        //                    var value = pack.SRM537.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    var sql = db.Insertable(value).ToSqlString();
-            //        //                    db.Ado.ExecuteCommand(sql);
-            //        //                    typeName = typeof(WCS_SRM537).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Station520>[]))
-            //        //            {
-            //        //                if (pack.Station520.Any())
-            //        //                {
-            //        //                    var value = pack.Station520.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Station520).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Station521>[]))
-            //        //            {
-            //        //                if (pack.Station521.Any())
-            //        //                {
-            //        //                    var value = pack.Station521.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Station521).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Station523>[]))
-            //        //            {
-            //        //                if (pack.Station523.Any())
-            //        //                {
-            //        //                    var value = pack.Station523.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Station523).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Station524>[]))
-            //        //            {
-            //        //                if (pack.Station524.Any())
-            //        //                {
-            //        //                    var value = pack.Station524.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Station524).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Station525>[]))
-            //        //            {
-            //        //                if (pack.Station525.Any())
-            //        //                {
-            //        //                    var value = pack.Station525.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Station525).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Station90>[]))
-            //        //            {
-            //        //                if (pack.Station90.Any())
-            //        //                {
-            //        //                    var value = pack.Station90.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Station90).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Station91>[]))
-            //        //            {
-            //        //                if (pack.Station91.Any())
-            //        //                {
-            //        //                    var value = pack.Station91.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Station91).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Truss520>[]))
-            //        //            {
-            //        //                if (pack.Truss520.Any())
-            //        //                {
-            //        //                    var value = pack.Truss520.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Truss520).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Truss521>[]))
-            //        //            {
-            //        //                if (pack.Truss521.Any())
-            //        //                {
-            //        //                    var value = pack.Truss521.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Truss521).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Truss523>[]))
-            //        //            {
-            //        //                if (pack.Truss523.Any())
-            //        //                {
-            //        //                    var value = pack.Truss523.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Truss523).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Truss530>[]))
-            //        //            {
-            //        //                if (pack.Truss530.Any())
-            //        //                {
-            //        //                    var value = pack.Truss530.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Truss530).Name;
-            //        //                }
-            //        //            }
-            //        //            else if (ps.PropertyType == typeof(ProtocolData<WCS_Truss531>[]))
-            //        //            {
-            //        //                if (pack.Truss531.Any())
-            //        //                {
-            //        //                    var value = pack.Truss531.Select(x =>
-            //        //                    {
-            //        //                        var data = x.Data;
-            //        //                        data.Frame = x.Frame;
-            //        //                        data.Code = x.Code;
-            //        //                        return data;
-            //        //                    }).ToList();
-            //        //                    db.Insertable(value).ExecuteCommand();
-            //        //                    typeName = typeof(WCS_Truss531).Name;
-            //        //                }
-            //        //            }
-            //        //        }
-            //        //        catch (Exception e)
-            //        //        {
-            //        //            LogHub.InterfacePublish(e.Message, e.StackTrace);
-            //        //        }
-            //        //        finally
-            //        //        {
-            //        //            sw10.Stop();
-            //        //            LogHub.InterfacePublish("执行耗时", $"执行耗时:{typeName}:{sw10.ElapsedMilliseconds}");
-            //        //        }
-            //        //    });
-
-            //        //    sw4.Stop();
-            //        //    LogHub.InterfacePublish("执行SQL耗时", $"执行SQL耗时:{sw4.ElapsedMilliseconds}");
-            //        //}
-            //        //catch (Exception e)
-            //        //{
-            //        //    LogHub.InterfacePublish("错误内容", $"错误内容:{e.Message}");
-            //        //}
-            //        //sw.Stop();
-            //        //if (sw.ElapsedMilliseconds >= toao)
-            //        //{
-            //        //    Console.WriteLine($"数据处理耗时:{sw.ElapsedMilliseconds}");
-            //        //    LogHub.InterfacePublish("数据处理耗时", $"数据处理耗时:{sw.ElapsedMilliseconds}");
-            //        //    continue;
-            //        //}
-
-            //        //var time = toao - sw.ElapsedMilliseconds.ToInt();
-            //        //Thread.Sleep(time);
-            //        //sw1.Stop();
-            //        //Console.ForegroundColor = ConsoleColor.Red;
-            //        //Console.WriteLine($"数据处理耗时:{sw1.ElapsedMilliseconds}");
-            //        //Console.ResetColor();
-            //        //LogHub.InterfacePublish("数据处理耗时", $"数据处理耗时:{sw1.ElapsedMilliseconds}");
-
-            //        var sw = new Stopwatch();
-            //        sw.Start();
-            //        var sw1 = new Stopwatch();
-            //        sw1.Start();
-
-            //        try
-            //        {
-            //            var db = new SqlSugarHelper().PLC;
-            //            var pack = RedisHub.Monitor.BLPop<DeviceDataPack>("DataCollectionpacks", 0); ;
-
-            //            var sw4 = new Stopwatch();
-            //            sw4.Start();
-
-            //            Parallel.ForEach(pack.GetType().GetProperties().OrderBy(x => x.Name), ps =>
-            //            {
-            //                var sw10 = new Stopwatch();
-            //                sw10.Start();
-            //                var typeName = "";
-            //                try
-            //                {
-            //                    if (ps.PropertyType == typeof(ProtocolData<WCS_BCR80>[]))
-            //                    {
-            //                        if (pack.BCR80.Any())
-            //                        {
-            //                            var value = pack.BCR80.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_BCR80).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_BCR81>[]))
-            //                    {
-            //                        if (pack.BCR81.Any())
-            //                        {
-            //                            var value = pack.BCR81.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_BCR81).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_BCR83>[]))
-            //                    {
-            //                        if (pack.BCR83.Any())
-            //                        {
-            //                            var value = pack.BCR83.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_BCR83).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_RGV520>[]))
-            //                    {
-            //                        if (pack.RGV520.Any())
-            //                        {
-            //                            var value = pack.RGV520.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_RGV520).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_RGV521>[]))
-            //                    {
-            //                        if (pack.RGV521.Any())
-            //                        {
-            //                            var value = pack.RGV521.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_RGV521).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Robot520>[]))
-            //                    {
-            //                        if (pack.Robot520.Any())
-            //                        {
-            //                            var value = pack.Robot520.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Robot520).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Robot521>[]))
-            //                    {
-            //                        if (pack.Robot521.Any())
-            //                        {
-            //                            var value = pack.Robot521.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Robot521).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Robot522>[]))
-            //                    {
-            //                        if (pack.Robot522.Any())
-            //                        {
-            //                            var value = pack.Robot522.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Robot522).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Robot530>[]))
-            //                    {
-            //                        if (pack.Robot530.Any())
-            //                        {
-            //                            var value = pack.Robot530.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Robot530).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Robot531>[]))
-            //                    {
-            //                        if (pack.Robot531.Any())
-            //                        {
-            //                            var value = pack.Robot531.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Robot531).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_SRM520>[]))
-            //                    {
-            //                        if (pack.SRM520.Any())
-            //                        {
-            //                            var value = pack.SRM520.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_SRM520).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_SRM521>[]))
-            //                    {
-            //                        if (pack.SRM521.Any())
-            //                        {
-            //                            var value = pack.SRM521.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_SRM521).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_SRM537>[]))
-            //                    {
-            //                        if (pack.SRM537.Any())
-            //                        {
-            //                            var value = pack.SRM537.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_SRM537).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Station520>[]))
-            //                    {
-            //                        if (pack.Station520.Any())
-            //                        {
-            //                            var value = pack.Station520.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Station520).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Station521>[]))
-            //                    {
-            //                        if (pack.Station521.Any())
-            //                        {
-            //                            var value = pack.Station521.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Station521).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Station523>[]))
-            //                    {
-            //                        if (pack.Station523.Any())
-            //                        {
-            //                            var value = pack.Station523.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Station523).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Station524>[]))
-            //                    {
-            //                        if (pack.Station524.Any())
-            //                        {
-            //                            var value = pack.Station524.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Station524).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Station525>[]))
-            //                    {
-            //                        if (pack.Station525.Any())
-            //                        {
-            //                            var value = pack.Station525.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Station525).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Station90>[]))
-            //                    {
-            //                        if (pack.Station90.Any())
-            //                        {
-            //                            var value = pack.Station90.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Station90).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Station91>[]))
-            //                    {
-            //                        if (pack.Station91.Any())
-            //                        {
-            //                            var value = pack.Station91.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Station91).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Truss520>[]))
-            //                    {
-            //                        if (pack.Truss520.Any())
-            //                        {
-            //                            var value = pack.Truss520.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Truss520).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Truss521>[]))
-            //                    {
-            //                        if (pack.Truss521.Any())
-            //                        {
-            //                            var value = pack.Truss521.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Truss521).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Truss523>[]))
-            //                    {
-            //                        if (pack.Truss523.Any())
-            //                        {
-            //                            var value = pack.Truss523.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Truss523).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Truss530>[]))
-            //                    {
-            //                        if (pack.Truss530.Any())
-            //                        {
-            //                            var value = pack.Truss530.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Truss530).Name;
-            //                        }
-            //                    }
-            //                    else if (ps.PropertyType == typeof(ProtocolData<WCS_Truss531>[]))
-            //                    {
-            //                        if (pack.Truss531.Any())
-            //                        {
-            //                            var value = pack.Truss531.Select(x => x.Data).ToList();
-            //                            var sql = db.Insertable(value).ToSqlString();
-            //                            db.Ado.ExecuteCommand(sql);
-            //                            typeName = typeof(WCS_Truss531).Name;
-            //                        }
-            //                    }
-            //                }
-            //                catch (Exception e)
-            //                {
-            //                    LogHub.InterfacePublish(e.Message, e.StackTrace);
-            //                }
-            //                finally
-            //                {
-            //                    sw10.Stop();
-            //                    LogHub.InterfacePublish("执行耗时", $"执行耗时:{typeName}:{sw10.ElapsedMilliseconds}");
-            //                }
-            //            });
-
-            //            sw4.Stop();
-            //            LogHub.InterfacePublish("执行SQL耗时", $"执行SQL耗时:{sw4.ElapsedMilliseconds}");
-            //        }
-            //        catch (Exception e)
-            //        {
-            //            LogHub.InterfacePublish("错误内容", $"错误内容:{e.Message}");
-            //        }
-            //        sw.Stop();
-            //        if (sw.ElapsedMilliseconds >= toao)
-            //        {
-            //            Console.WriteLine($"数据处理耗时:{sw.ElapsedMilliseconds}");
-            //            LogHub.InterfacePublish("数据处理耗时", $"数据处理耗时:{sw.ElapsedMilliseconds}");
-            //            continue;
-            //        }
-
-            //        var time = toao - sw.ElapsedMilliseconds.ToInt();
-            //        Thread.Sleep(time);
-            //        sw1.Stop();
-            //        Console.ForegroundColor = ConsoleColor.Red;
-            //        Console.WriteLine($"数据处理耗时:{sw1.ElapsedMilliseconds}");
-            //        Console.ResetColor();
-            //        LogHub.InterfacePublish("数据处理耗时", $"数据处理耗时:{sw1.ElapsedMilliseconds}");
-            //    }
-            //});
         }
 
         /// <summary>
@@ -1185,18 +441,6 @@ namespace WCS.WorkEngineering
                     switch (connectionString.Key)
                     {
                         case "WCSDB"://WCS基本数据库
-                            //SqlSugarHelper.SetDefault(connectionString.Key);
-                            //_db.CodeFirst.InitTables(typeof(WCS_PlcData));
-                            //_db.CodeFirst.InitTables(typeof(WCS_TaskInfo));
-                            //_db.CodeFirst.InitTables(typeof(WCS_TaskDtl));
-                            //_db.CodeFirst.InitTables(typeof(WCS_TaskOld));
-                            //_db.CodeFirst.InitTables(typeof(WCS_AgvTaskInfo));
-                            //_db.CodeFirst.InitTables(typeof(WCS_Palletizing));
-                            //_db.CodeFirst.InitTables(typeof(WCS_PalletizingLayer));
-                            //_db.CodeFirst.InitTables(typeof(WCS_PalletizingRow));
-                            //_db.CodeFirst.InitTables(typeof(WCS_PalletizingLoc));
-                            //_db.CodeFirst.InitTables(typeof(WCS_CacheLine));
-                            //_db.CodeFirst.InitTables(typeof(WCS_CacheLineLoc));
 
                             break;
 
@@ -1208,34 +452,31 @@ namespace WCS.WorkEngineering
 
                             SqlSugarHelper.SetPLC(connectionString.Key);
 
-                            //_db.DbMaintenance.CreateDatabase();
-                            //_db.CodeFirst.InitTables<WCS_Log>();
-                            //_db.CodeFirst.InitTables<DevRunInfo>();
-                            //_db.CodeFirst.InitTables<WCS_SRM520>();
-                            //_db.CodeFirst.InitTables<WCS_SRM521>();
-                            //_db.CodeFirst.InitTables<WCS_SRM537>();
-                            //_db.CodeFirst.InitTables<WCS_RGV520>();
-                            //_db.CodeFirst.InitTables<WCS_RGV521>();
-                            //_db.CodeFirst.InitTables<WCS_BCR80>();
-                            //_db.CodeFirst.InitTables<WCS_BCR81>();
-                            //_db.CodeFirst.InitTables<WCS_BCR83>();
-                            //_db.CodeFirst.InitTables<WCS_Station520>();
-                            //_db.CodeFirst.InitTables<WCS_Station521>();
-                            //_db.CodeFirst.InitTables<WCS_Station523>();
-                            //_db.CodeFirst.InitTables<WCS_Station524>();
-                            //_db.CodeFirst.InitTables<WCS_Station525>();
-                            //_db.CodeFirst.InitTables<WCS_Station90>();
-                            //_db.CodeFirst.InitTables<WCS_Station91>();
-                            //_db.CodeFirst.InitTables<WCS_Truss520>();
-                            //_db.CodeFirst.InitTables<WCS_Truss521>();
-                            //_db.CodeFirst.InitTables<WCS_Truss523>();
-                            //_db.CodeFirst.InitTables<WCS_Truss530>();
-                            //_db.CodeFirst.InitTables<WCS_Truss531>();
-                            //_db.CodeFirst.InitTables<WCS_Robot520>();
-                            //_db.CodeFirst.InitTables<WCS_Robot521>();
-                            //_db.CodeFirst.InitTables<WCS_Robot522>();
-                            //_db.CodeFirst.InitTables<WCS_Robot530>();
-                            //_db.CodeFirst.InitTables<WCS_Robot531>();
+                            _db.CodeFirst.InitTables<WCS_SRM520>();
+                            _db.CodeFirst.InitTables<WCS_SRM521>();
+                            _db.CodeFirst.InitTables<QuestDb_SRM537>();
+                            _db.CodeFirst.InitTables<WCS_RGV520>();
+                            _db.CodeFirst.InitTables<WCS_RGV521>();
+                            _db.CodeFirst.InitTables<WCS_BCR80>();
+                            _db.CodeFirst.InitTables<WCS_BCR81>();
+                            _db.CodeFirst.InitTables<WCS_BCR83>();
+                            _db.CodeFirst.InitTables<WCS_Station520>();
+                            _db.CodeFirst.InitTables<WCS_Station521>();
+                            _db.CodeFirst.InitTables<WCS_Station523>();
+                            _db.CodeFirst.InitTables<WCS_Station524>();
+                            _db.CodeFirst.InitTables<WCS_Station525>();
+                            _db.CodeFirst.InitTables<WCS_Station90>();
+                            _db.CodeFirst.InitTables<WCS_Station91>();
+                            _db.CodeFirst.InitTables<WCS_Truss520>();
+                            _db.CodeFirst.InitTables<WCS_Truss521>();
+                            _db.CodeFirst.InitTables<WCS_Truss523>();
+                            _db.CodeFirst.InitTables<WCS_Truss530>();
+                            _db.CodeFirst.InitTables<WCS_Truss531>();
+                            _db.CodeFirst.InitTables<WCS_Robot520>();
+                            _db.CodeFirst.InitTables<WCS_Robot521>();
+                            _db.CodeFirst.InitTables<QuestDb_Robot522>();
+                            _db.CodeFirst.InitTables<WCS_Robot530>();
+                            _db.CodeFirst.InitTables<WCS_Robot531>();
                             var a = false;
                             break;