林豪 左 1 tahun lalu
induk
melakukan
b2c0d591c1
22 mengubah file dengan 268 tambahan dan 287 penghapusan
  1. 56 8
      ServiceCenter/Logs/LogHub.cs
  2. 1 1
      ServiceCenter/ServiceCenter.csproj
  3. 1 1
      WCS.Core/ProtocolProxyBase.cs
  4. 20 0
      WCS.Entity/TDengineBaseEntity.cs
  5. 2 1
      WCS.Entity/WCS.Entity.csproj
  6. 32 0
      WCS.Entity/WCS_Log.cs
  7. 2 2
      WCS.Service/appsettings.json
  8. 3 3
      业务工程/分拣库/WCS.Entity.Protocol/TDengineBaseEntity.cs
  9. 2 2
      业务工程/分拣库/WCS.Entity.Protocol/WCS.Entity.Protocol.csproj
  10. 2 1
      业务工程/分拣库/WCS.WorkEngineering/Extensions/DeviceExtension.cs
  11. 3 3
      业务工程/分拣库/WCS.WorkEngineering/Systems/AgvSystems.cs
  12. 81 55
      业务工程/分拣库/WCS.WorkEngineering/Systems/DataCollectionSysyem.cs
  13. 2 2
      业务工程/分拣库/WCS.WorkEngineering/Systems/分拣主线/满轮主线预写入目标地址.cs
  14. 37 36
      业务工程/分拣库/WCS.WorkEngineering/Systems/分拣支线/桁架分流点.cs
  15. 2 2
      业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/创建二次码垛出库任务.cs
  16. 5 3
      业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/桁架.cs
  17. 3 3
      业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/桁架码垛区补空托盘任务生成.cs
  18. 1 1
      业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/桁架码垛工位任务结束处理.cs
  19. 2 1
      业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/桁架缓存放行点.cs
  20. 4 2
      业务工程/分拣库/WCS.WorkEngineering/Systems/环形库/机械臂cs.cs
  21. 6 159
      业务工程/分拣库/WCS.WorkEngineering/WorkStart.cs
  22. 1 1
      业务工程/时效库/WCS.WorkEngineering/Systems/DataCollectionSysyem.cs

+ 56 - 8
ServiceCenter/Logs/LogHub.cs

@@ -1,10 +1,12 @@
 using Newtonsoft.Json;
-using PlcSiemens.Core.Extension;
 using ServiceCenter.Extensions;
 using ServiceCenter.Redis;
+using ServiceCenter.SqlSugars;
 using System.Collections.Concurrent;
 using System.Diagnostics;
+using System.Text;
 using WCS.Core;
+using WCS.Entity.Protocol.RGV;
 
 namespace ServiceCenter.Logs
 {
@@ -19,20 +21,46 @@ namespace ServiceCenter.Logs
         {
             if (logs.Count > 0)
             {
+                //var sql = new StringBuilder();
+                //sql.Append("INSERT INTO ");
+                //var db = new SqlSugarHelper().PLC;
                 try
                 {
                     //每一条数据存入redis
                     foreach (var log in logs)
                     {
-                        var dir = $"D:\\WCSLogs\\{DateTime.Now.yyyyMMdd()}\\{log.Channel.World}\\{log.Channel.System}\\{log.Channel.Item}\\";
-                        var msg = $"{log.Time.yyyyMMddhhmmssf()}--[{Thread.CurrentThread.ManagedThreadId}]--{log}\n";
-                        RedisHub.Default.RPush("LogHub", JsonConvert.SerializeObject(new LogModel
+                        try
                         {
-                            path = dir,
-                            Title = $"{log.Log.Message.Split(":")[0]}.txt",
-                            Con = msg
-                        }));
+                            var dir = $"D:\\WCSLogs\\{DateTime.Now.yyyyMMdd()}\\{log.Channel.World}\\{log.Channel.System}\\{log.Channel.Item}\\";
+                            var msg = $"{log.Time.yyyyMMddhhmmssf()}--[{Thread.CurrentThread.ManagedThreadId}]--{log}\n";
+                            var title = $"{log.Log.Message.Split(":")[0]}.txt";
+                            RedisHub.Default.RPush("LogHub", JsonConvert.SerializeObject(new LogModel
+                            {
+                                path = dir,
+                                Title = title,
+                                Con = msg
+                            }));
+                            //sql.Append(GetString(db.Insertable(new WCS_Log()
+                            //{
+                            //    World = log.Channel.World,
+                            //    System = log.Channel.System,
+                            //    Code = log.Channel.Item.ToLower().Replace(".", ""),
+                            //    Title = log.Log.Message.Split(":")[0],
+                            //    ExTime = log.Time,
+                            //    ManagedThreadId = Thread.CurrentThread.ManagedThreadId,
+                            //    Content = log.Log.Message.RemoveEscapeCharacters().Substring(0, 254)
+                            //}).ToSqlString()));
+                        }
+                        catch (Exception e)
+                        {
+                        }
                     }
+                    //var sqlText = sql.ToString();
+                    //if (sqlText.Contains("russ1"))
+                    //{
+                    //    var a = 1;
+                    //}
+                    //db.Ado.ExecuteCommand(sql.ToString());
                     //存入业务报警内容
                     List<BusinessAlarm> businesses = logs.Where(v => v.Log.Level > LogLevelEnum.Low && v.Log.LogUpLoad == LogUpLoadEnum.UpLoadWMS).Select(v => new BusinessAlarm()
                     {
@@ -49,6 +77,26 @@ namespace ServiceCenter.Logs
             }
         }
 
+
+        /// <summary>
+        ///  去除转义字符
+        /// </summary>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        public static string RemoveEscapeCharacters(this string? value)
+        {
+            return value.Trim('\0', '\a', '\b', '\f', '\n', '\r', '\t', '\v').Trim();
+        }
+
+        public static string GetString(string value)
+        {
+            return value.Replace("INSERT INTO ", "")
+                .Replace(",N'", ",'")
+                .Replace("\0", "")
+                .Replace("wcs_", "")
+                .Replace("(N'", "('") + "\r";
+        }
+
         /// <summary>
         ///   执行记录
         /// </summary>

+ 1 - 1
ServiceCenter/ServiceCenter.csproj

@@ -18,7 +18,7 @@
   <ItemGroup>
     <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.5" />
     <PackageReference Include="PlcSiemens" Version="1.0.1" />
-    <PackageReference Include="SqlSugar.TDengineCore" Version="3.0.0" />
+    <PackageReference Include="SqlSugar.TDengineCore" Version="3.2.0" />
     <PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" />
     <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.5.0" />
   </ItemGroup>

+ 1 - 1
WCS.Core/ProtocolProxyBase.cs

@@ -126,7 +126,7 @@ namespace WCS.Core
             var item = Items[propertyName] as PlcItem<T>;
             var res = item.Value;
             var channel = Ltc.GetChannel();
-            if (channel != null && !ProtocolType.Name.Contains("525") && !ProtocolType.Name.Contains("83")) this.World.OnInternalLog(channel, $"获取值:{Device.Code}.{ProtocolType.Name}.{propertyName}:{res}");
+            //if (channel != null && !ProtocolType.Name.Contains("525") && !ProtocolType.Name.Contains("83")) this.World.OnInternalLog(channel, $"获取值:{Device.Code}.{ProtocolType.Name}.{propertyName}:{res}");
             return res;
         }
 

+ 20 - 0
WCS.Entity/TDengineBaseEntity.cs

@@ -0,0 +1,20 @@
+using System;
+using SqlSugar;
+using SqlSugar.TDengine;
+
+namespace WCS.Entity
+{
+    /// <summary>
+    ///  时序数据库TDengine基础实体
+    /// </summary>
+    public class TDengineBaseEntity : STable
+    {
+        [SugarColumn(IsPrimaryKey = true, InsertServerTime = true)]
+        public DateTime Frame { get; set; }
+
+        public string Code { get; set; }
+
+        [SugarColumn(IsIgnore = true)]
+        public string CreateSql { get; set; }
+    }
+}

+ 2 - 1
WCS.Entity/WCS.Entity.csproj

@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
     <TargetFramework>netstandard2.1</TargetFramework>
@@ -15,6 +15,7 @@
   </PropertyGroup>
   
   <ItemGroup>
+    <PackageReference Include="SqlSugar.TDengineCore" Version="3.2.0" />
     <PackageReference Include="SqlSugarCore" Version="5.1.4.114" />
     <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
   </ItemGroup>

+ 32 - 0
WCS.Entity/WCS_Log.cs

@@ -0,0 +1,32 @@
+using SqlSugar;
+using System;
+using System.Runtime.Serialization;
+
+namespace WCS.Entity.Protocol.RGV
+{
+    /// <summary>
+    ///  RGV
+    /// </summary>
+    [DataContract]
+    [SugarTable("Log")]
+    public class WCS_Log : TDengineBaseEntity
+    {
+        [DataMember(Order = 0)]
+        public string World { get; set; }
+
+        [DataMember(Order = 1)]
+        public string System { get; set; }
+
+        [DataMember(Order = 2)]
+        public string Title { get; set; }
+
+        [DataMember(Order = 3)]
+        public string Content { get; set; }
+
+        [DataMember(Order = 4)]
+        public DateTime ExTime { get; set; }
+
+        [DataMember(Order = 6)]
+        public int ManagedThreadId { get; set; }
+    }
+}

+ 2 - 2
WCS.Service/appsettings.json

@@ -7,7 +7,7 @@
     }
   },
   "ConnectionStrings": {
-    "Redis": "127.0.0.1,database=0,prefix=Sorting:",
-    //"Redis": "10.30.37.1,password=123456,database=0,prefix=Sorting:"
+    //"Redis": "127.0.0.1,database=0,prefix=Sorting:"
+    "Redis": "10.30.37.1,password=123456,database=0,prefix=Sorting:"
   }
 }

+ 3 - 3
业务工程/分拣库/WCS.Entity.Protocol/TDengineBaseEntity.cs

@@ -1,8 +1,8 @@
-using SqlSugar;
+using System;
+using SqlSugar;
 using SqlSugar.TDengine;
-using System;
 
-namespace WCS.Entity.Protocol
+namespace WCS.Entity
 {
     /// <summary>
     ///  时序数据库TDengine基础实体

+ 2 - 2
业务工程/分拣库/WCS.Entity.Protocol/WCS.Entity.Protocol.csproj

@@ -15,8 +15,8 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="SqlSugar.TDengineCore" Version="3.0.0" />
-    <PackageReference Include="SqlSugarCore" Version="5.1.4.114" />
+    <PackageReference Include="SqlSugar.TDengineCore" Version="3.2.0" />
+    <PackageReference Include="SqlSugarCore" Version="5.1.4.117" />
     <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
   </ItemGroup>
 

+ 2 - 1
业务工程/分拣库/WCS.WorkEngineering/Extensions/DeviceExtension.cs

@@ -56,7 +56,7 @@ namespace WCS.WorkEngineering.Extensions
                         Port = 102,
                         Rack = 0,
                         Slot = 1,
-                        //Type = PLCType.Siemens
+                        Type = PLCType.Siemens
                     }
                 }
             };
@@ -393,6 +393,7 @@ namespace WCS.WorkEngineering.Extensions
         桁架18缓存放行点 = 1L << 40,
         桁架09异常缓存放行点 = 1L << 41,
         二次码垛RGV取货口 = 1L << 42,
+        无交互触发设备 = 1L << 43,
     }
 
     /// <summary>

+ 3 - 3
业务工程/分拣库/WCS.WorkEngineering/Systems/AgvSystems.cs

@@ -29,7 +29,7 @@ namespace WCS.WorkEngineering.Systems
 
         public override void Do(Device<IStation520> obj)
         {
-            if (obj.Entity.Code == "2534")
+            if (obj.Entity.Code == "AGVOut")
             {
                 var agvTaskInfos = new List<WCS_AgvTaskInfo>();
                 //获取所有未结束的叫料及背负式补空AGV任务
@@ -112,7 +112,7 @@ namespace WCS.WorkEngineering.Systems
                     }
                 }
             }
-            else if (obj.Entity.Code == "2533")
+            else if (obj.Entity.Code == "AGVIn")
             {
                 List<WCS_AgvTaskInfo> agvTaskInfos = new List<WCS_AgvTaskInfo>();
                 //获取所有未结束的入库AGV任务
@@ -268,7 +268,7 @@ namespace WCS.WorkEngineering.Systems
 
         public override bool Select(Device dev)
         {
-            return dev.Code is "2533" or "2534";
+            return dev.Code is "AGVIn" or "AGVOut";
         }
     }
 }

+ 81 - 55
业务工程/分拣库/WCS.WorkEngineering/Systems/DataCollectionSysyem.cs

@@ -1,8 +1,10 @@
-using PlcSiemens.Core.Extension;
+using ServiceCenter.Extensions;
 using ServiceCenter.SqlSugars;
+using SqlSugar;
 using System.Collections.Concurrent;
 using System.ComponentModel;
 using System.Diagnostics;
+using System.Reflection;
 using System.Text;
 using WCS.Core;
 using WCS.Entity.Protocol.BCR;
@@ -14,13 +16,14 @@ using WCS.Entity.Protocol.Station;
 using WCS.Entity.Protocol.Truss;
 using WCS.WorkEngineering.Extensions;
 using WCS.WorkEngineering.Worlds;
+using DeviceFlags = WCS.WorkEngineering.Extensions.DeviceFlags;
 
 namespace WCS.WorkEngineering.Systems
 {
     /// <summary>
     ///  数据采集系统
     /// </summary>
-    [BelongTo(typeof(DataCollectionWorld))]
+   // [BelongTo(typeof(DataCollectionWorld))]
     [Description("数据采集系统")]
     public class DataCollectionSysyem : DeviceSystem<SRM>
     {
@@ -30,6 +33,8 @@ namespace WCS.WorkEngineering.Systems
 
         public DataCollectionSysyem()
         {
+            //var sw = new Stopwatch();
+            //sw.Start();
             var gs = Device.All.SelectMany(v => v.Protocols.Select(d => new { DB = $"{d.Value.DBInfo.No}:{d.Value.DBInfo.PLCInfo.IP}", d.Value.Position, TypeStr = d.Key, Dev = v }))
                 .GroupBy(v => v.DB);
             foreach (var g in gs)
@@ -40,6 +45,8 @@ namespace WCS.WorkEngineering.Systems
                 min.Dev.Protocol(t, this.World);
                 max.Dev.Protocol(t, this.World);
             }
+            //sw.Stop();
+            //World.Log($"获取所有设备:{sw.ElapsedMilliseconds}");
         }
 
         /// <summary>
@@ -60,62 +67,82 @@ namespace WCS.WorkEngineering.Systems
 
         public override void Do(SRM obj)
         {
-            var sw = new Stopwatch();
-            sw.Start();
-            var pack = new DeviceDataPack();
-            pack.Frame = DateTime.Now;
             var sql = new StringBuilder();
-            sql.Append("INSERT INTO ");
-            var ps = pack.GetType().GetProperties().OrderBy(x => x.Name);
-            foreach (var p in ps)
+            try
             {
-                if (!p.PropertyType.IsArray)
-                    continue;
-                var dev = p.PropertyType.GetElementType();
-                if (dev.GetInterfaces().Any(v => v.GetInterfaces().Any(d => d.Name == "IProtocol")))
+                var sw = new Stopwatch();
+                sw.Start();
+                var pack = new DeviceDataPack();
+                pack.Frame = DateTime.Now;
+                sql.Append("INSERT INTO ");
+                var ps = pack.GetType().GetProperties().OrderBy(x => x.Name);
+                var db = new SqlSugarHelper().PLC;
+                Parallel.ForEach(ps, p =>
                 {
-                    var t = p.PropertyType.GetElementType();
-                    var protType = GetProtocolType(t);
-                    var arr = Device.All.Where(v => v.HasProtocol(protType))
-                    .Select(v =>
+                    if (!p.PropertyType.IsArray) return;
+
+                    var dev = p.PropertyType.GetElementType();
+                    if (dev.GetInterfaces().Any(v => v.GetInterfaces().Any(d => d.Name == "IProtocol")))
                     {
-                        try
-                        {
-                            var obj = Activator.CreateInstance(t);
-                            t.GetProperty("Code").SetValue(obj, v.Code);
-                            dynamic protObj = v.Protocol(protType, World);
-                            protObj.Copy(obj);
-                            var value = GetSql(t, obj);
-                            t.GetProperty("Frame").SetValue(obj, protObj.Frame);
-                            //var value = ServiceCenter.Extensions.TypeExtension.Copy(protObj, t);
-                            //t.GetProperty("Data").SetValue(obj, value);
-                            sql.Append(value);
-                            return obj;
-                        }
-                        catch (Exception ex)
+                        var t = p.PropertyType.GetElementType();
+                        var protType = GetProtocolType(t);
+                        var devList = Device.All.Where(v => v.HasProtocol(protType) && !v.HasFlag(DeviceFlags.无交互触发设备));
+                        List<object> arr = new List<object>();
+                        Parallel.ForEach(devList, dev =>
                         {
-                            return null;
-                        }
-                    }).Where(v => v != null).ToArray();
-
-                    var m = typeof(Enumerable).GetMethod("OfType", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
-                    m = m.MakeGenericMethod(t);
-                    var arr2 = m.Invoke(null, new object[] { arr });
-
-                    m = typeof(Enumerable).GetMethod("ToArray", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
-                    m = m.MakeGenericMethod(t);
-                    var arr3 = m.Invoke(null, new object[] { arr2 });
-                    p.SetValue(pack, arr3);
-                }
+                            try
+                            {
+                                var obj = Activator.CreateInstance(t);
+                                t.GetProperty("Code").SetValue(obj, dev.Code);
+                                var protObj = dev.Protocol(protType, World);
+                                protObj.Copy(obj);
+                                var value = GetSql(t, obj, db);
+                                //t.GetProperty("Frame").SetValue(obj, );
+                                //var value = ServiceCenter.Extensions.TypeExtension.Copy(protObj, t);
+                                //t.GetProperty("Data").SetValue(obj, value);
+                                sql.Append(value);
+                                arr.Add(obj);
+                            }
+                            catch (Exception ex)
+                            {
+                                // ignored
+                            }
+                        });
+
+                        var m = typeof(Enumerable).GetMethod("OfType",
+                            BindingFlags.Static | BindingFlags.Public);
+                        m = m.MakeGenericMethod(t);
+                        var arr2 = m.Invoke(null, new object[] { arr.ToArray() });
+
+                        m = typeof(Enumerable).GetMethod("ToArray",
+                            BindingFlags.Static | BindingFlags.Public);
+                        m = m.MakeGenericMethod(t);
+                        var arr3 = m.Invoke(null, new object[] { arr2 });
+                        p.SetValue(pack, arr3);
+                    }
+                });
+
+                //Redis.RPush("Packs", pack);
+                //if (Redis.LLen("Packs") > 50000)
+                //{
+                //    Redis.LTrim("Packs", 5000, -1);
+                //}
+
+                var sw4 = new Stopwatch();
+                sw4.Start();
+                var sqlText = sql.ToString();
+                db.Ado.ExecuteCommand(sql.ToString());
+                sw4.Stop();
+                World.Log($"执行SQL耗时:{sw4.ElapsedMilliseconds}");
+
+                sw.Stop();
+
+                World.Log($"数据采集耗时:{sw.ElapsedMilliseconds}");
+            }
+            catch (Exception e)
+            {
+                World.Log($"异常SQL:{sql.ToString()}");
             }
-
-            //Redis.RPush("Packs", pack);
-            //if (Redis.LLen("Packs") > 50000)
-            //{
-            //    Redis.LTrim("Packs", 5000, -1);
-            //}
-
-            sw.Stop();
             //var sw = new Stopwatch();
             //sw.Start();
             //var pack = new DeviceDataPack();
@@ -263,7 +290,6 @@ namespace WCS.WorkEngineering.Systems
 
             //sw.Stop();
             //list.Add(new WorkTimes { Total = sw.ElapsedMilliseconds, Key = "采集数据" });
-            return;
             //var sw = new Stopwatch();
             //sw.Start();
             //try
@@ -397,10 +423,10 @@ namespace WCS.WorkEngineering.Systems
             return t;
         }
 
-        public string GetSql(Type type, object entity)
+        public string GetSql(Type type, object entity, SqlSugarScopeProvider db)
         {
             string sql = string.Empty;
-            var db = new SqlSugarHelper().PLC;
+
             var ty = entity.GetType().GetProperty("CreateSql");
             switch (type.Name)
             {

+ 2 - 2
业务工程/分拣库/WCS.WorkEngineering/Systems/分拣主线/满轮主线预写入目标地址.cs

@@ -49,12 +49,12 @@ namespace WCS.WorkEngineering.Systems
                 var mainlineDiversion = JsonConvert.DeserializeObject<MainlineDiversion>(value);
                 var srmCode = mainlineDiversion.WarehouseCode.WarehouseToSrm();
                 var path = DevicePath.GetPath(obj.Entity.Code, srmCode);
-                if (path is { Points.Count: < 2 })
+                if (path == null || path is { Points.Count: < 2 })
                 {
                     World.Log($"{bcrCode}:路径错误,当前位置{obj.Entity.Code},目标位置:{srmCode}", LogLevelEnum.High);
                     continue;
                 }
-                var next = DevicePath.GetPath(obj.Entity.Code, srmCode).Points[1].Code;
+                var next = path.Points[1].Code;
                 WCS_TaskInfo taskInfo = null;
 
                 try

+ 37 - 36
业务工程/分拣库/WCS.WorkEngineering/Systems/分拣支线/桁架分流点.cs

@@ -13,6 +13,8 @@ using WCS.WorkEngineering.Extensions;
 using WCS.WorkEngineering.Worlds;
 using DeviceFlags = WCS.WorkEngineering.Extensions.DeviceFlags;
 using TaskStatus = WCS.Entity.TaskStatus;
+using WCS_CacheLine = WCS.Entity.WCS_CacheLine;
+using WCS_CacheLineLoc = WCS.Entity.WCS_CacheLineLoc;
 
 namespace WCS.WorkEngineering.Systems
 {
@@ -127,24 +129,24 @@ namespace WCS.WorkEngineering.Systems
             if (devCode == 0)
             {
                 World.Log($"无可用线体:{taskInfo.ID}");
-                var endTime = DateTime.Now.AddMinutes(-10);
-                //找一个当前时间最早且已超过25分钟未码垛的码垛信息半托入库
-                //未结束且包含当前物料编号的垛形,按时间排序,创建时间早的优先分配,当前任务的仓库号必须要等于码垛信息绑定的仓库号
-                var palletizing = db.Queryable<WCS_Palletizing>()
-                    .Includes(x => x.Layers, r => r.Rows, l => l.Locs)
-                    .Where(x => !x.Finish && x.WarehouseCode == taskInfo.WarehouseCode && x.Layers.Any(l => l.Rows.Any(r => r.Finish)))
-                    .Where(x => x.EditTime < endTime).ToList()
-                    .MinBy(x => x.AddTime);
-                cacheLineList = db.Queryable<WCS_CacheLine>().Where(x => x.WarehouseCode == taskInfo.WarehouseCode && x.IsTruss).ToList();
-
-                if (palletizing != null && !cacheLineList.Any())
-                {
-                    var dev = Device.All.Where(x => x.Code == palletizing.PalletizingStation).Select(x => new Device<ITruss530>(x, World)).FirstOrDefault();
-                    if (dev != null && !dev.Data.CmdType.HasFlag(TrussCmdType.Two))
-                    {
-                        dev.Data.CmdType = TrussCmdType.Two;
-                    }
-                }
+                //var endTime = DateTime.Now.AddMinutes(-10);
+                ////找一个当前时间最早且已超过25分钟未码垛的码垛信息半托入库
+                ////未结束且包含当前物料编号的垛形,按时间排序,创建时间早的优先分配,当前任务的仓库号必须要等于码垛信息绑定的仓库号
+                //var palletizing = db.Queryable<WCS_Palletizing>()
+                //    .Includes(x => x.Layers, r => r.Rows, l => l.Locs)
+                //    .Where(x => !x.Finish && x.WarehouseCode == taskInfo.WarehouseCode && x.Layers.Any(l => l.Rows.Any(r => r.Finish)))
+                //    .Where(x => x.EditTime < endTime).ToList()
+                //    .MinBy(x => x.AddTime);
+                //cacheLineList = db.Queryable<WCS.Entity.WCS_CacheLine>().Where(x => x.WarehouseCode == taskInfo.WarehouseCode && x.IsTruss).ToList();
+
+                //if (palletizing != null && !cacheLineList.Any())
+                //{
+                //    var dev = Device.All.Where(x => x.Code == palletizing.PalletizingStation).Select(x => new Device<ITruss530>(x, World)).FirstOrDefault();
+                //    if (dev != null && !dev.Data.CmdType.HasFlag(TrussCmdType.Two))
+                //    {
+                //        dev.Data.CmdType = TrussCmdType.Two;
+                //    }
+                //}
                 return false;
             }
             var result = false;
@@ -179,7 +181,7 @@ namespace WCS.WorkEngineering.Systems
                 var palletizingRow = rows.MinBy(x => x.RowNo);
 
                 //开始初始化缓存位信息
-                cacheLine = new WCS_CacheLine()
+                cacheLine = new WCS.Entity.WCS_CacheLine()
                 {
                     LocationNo = devCode,
                     AddTime = DateTime.Now,
@@ -192,22 +194,6 @@ namespace WCS.WorkEngineering.Systems
                     WarehouseCode = taskInfo.WarehouseCode
                 };
 
-                var res = db.Insertable(cacheLine).ExecuteReturnEntity();
-                palletizingRow = db.Queryable<WCS_PalletizingRow>().Includes(x => x.Locs).Single(x => x.Id == palletizingRow.Id);
-                palletizingRow.Locs = palletizingRow.Locs.OrderBy(x => x.XYNo).ToList();
-                palletizingRow.CacheLineId = res.Id;
-                palletizingRow.EditTime = DateTime.Now;
-
-                var createCacheLoc = palletizingRow.Locs.Select((t, i) => new WCS_CacheLineLoc()
-                {
-                    XYNo = t.XYNo,
-                    InStock = i == 0,
-                    IsEmpty = t.IsEmpty,
-                    MatCode = t.MatCode,
-                    TaskId = i == 0 ? taskInfo.ID : 0,
-                    CacheLineId = res.Id
-                }).ToList();
-
                 if (palletizing.isItHalf) //当前任务被分配到了二次码垛托盘上了。
                 {
                     var twoDevCode = new List<string>();
@@ -239,7 +225,7 @@ namespace WCS.WorkEngineering.Systems
                     }
                     //找到一个对应的空置码垛位
                     var twoDevs = Device.All.Where(x => twoDevCode.Contains(x.Code)).Select(x => new Device<IStation520, IStation521, IStation523>(x, World)).Where(x => !x.Data3.Status.HasFlag(StationStatus.PH_Status)).Select(x => x.Entity.Code);
-                    if (!twoDevs.Any())
+                    if (twoDevs.Any())
                     {
                         World.Log("无可用的二次码垛工位");
                         continue;
@@ -262,6 +248,21 @@ namespace WCS.WorkEngineering.Systems
                     palletizing.TaskAddNext = devCode.ToString();
                     db.Updateable(palletizing).ExecuteCommand();
                 }
+                var res = db.Insertable(cacheLine).ExecuteReturnEntity();
+                palletizingRow = db.Queryable<WCS_PalletizingRow>().Includes(x => x.Locs).Single(x => x.Id == palletizingRow.Id);
+                palletizingRow.Locs = palletizingRow.Locs.OrderBy(x => x.XYNo).ToList();
+                palletizingRow.CacheLineId = res.Id;
+                palletizingRow.EditTime = DateTime.Now;
+
+                var createCacheLoc = palletizingRow.Locs.Select((t, i) => new WCS_CacheLineLoc()
+                {
+                    XYNo = t.XYNo,
+                    InStock = i == 0,
+                    IsEmpty = t.IsEmpty,
+                    MatCode = t.MatCode,
+                    TaskId = i == 0 ? taskInfo.ID : 0,
+                    CacheLineId = res.Id
+                }).ToList();
 
                 taskInfo.Status = TaskStatus.FinishOfShunt;
                 taskInfo.AddrNext = devCode.ToString();

+ 2 - 2
业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/创建二次码垛出库任务.cs

@@ -12,7 +12,7 @@ namespace WCS.WorkEngineering.Systems.桁架码垛
 {
     [BelongTo(typeof(NoInteractionWorld))]
     [Description("创建二次码垛出库任务")]
-    public class 创建二次码垛出库任务 : DeviceSystem<Device<IStation520>>
+    public class TrussCreateTwoOut : DeviceSystem<Device<IStation520>>
     {
         protected override bool ParallelDo => true;
 
@@ -47,7 +47,7 @@ namespace WCS.WorkEngineering.Systems.桁架码垛
 
         public override bool Select(Device dev)
         {
-            return dev.Code == nameof(创建二次码垛出库任务);
+            return dev.Code == nameof(TrussCreateTwoOut);
         }
     }
 }

+ 5 - 3
业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/桁架.cs

@@ -10,6 +10,8 @@ using WCS.WorkEngineering.Extensions;
 using WCS.WorkEngineering.WebApi.Controllers;
 using WCS.WorkEngineering.Worlds;
 using DeviceFlags = WCS.WorkEngineering.Extensions.DeviceFlags;
+using WCS_CacheLine = WCS.Entity.WCS_CacheLine;
+using WCS_CacheLineLoc = WCS.Entity.WCS_CacheLineLoc;
 
 namespace WCS.WorkEngineering.Systems
 {
@@ -43,14 +45,14 @@ namespace WCS.WorkEngineering.Systems
                     var palletizingRow = db.Queryable<WCS_PalletizingRow>().Includes(x => x.CacheLine, c => c.Locations)
                                                                                                 .Includes(x => x.Locs)
                                                                                                 .Includes(x => x.Palletizing).Where(x => ids.Contains(x.Id)).ToList();
-                    List<WCS_CacheLine> deleteCacheLine = new List<WCS_CacheLine>();
+                    List<WCS.Entity.WCS_CacheLine> deleteCacheLine = new List<WCS.Entity.WCS_CacheLine>();
                     List<WCS_PalletizingRow> upDateableRow = new List<WCS_PalletizingRow>();
                     List<WCS_PalletizingLoc> upDateableLoc = new List<WCS_PalletizingLoc>();
                     List<WCS_CacheLineLoc> deleteLoc = new List<WCS_CacheLineLoc>();
                     //更新行数据
                     foreach (var row in palletizingRow)
                     {
-                        var cacheLine = db.Queryable<WCS_CacheLine>().Includes(x => x.Locations).Single(x => x.Id == row.CacheLine.Id);
+                        var cacheLine = db.Queryable<WCS.Entity.WCS_CacheLine>().Includes(x => x.Locations).Single(x => x.Id == row.CacheLine.Id);
                         //先更新对应的位信息
                         try
                         {
@@ -133,7 +135,7 @@ namespace WCS.WorkEngineering.Systems
                 obj.Data.TaskSum2 = 0;
                 obj.Data.PalletizingRowId2 = 0;
             }
-            if (obj.Data2.CmdType == 0) obj.Data.CmdType = 0;
+            if (obj.Data2.CmdType == 0 && obj.Data.CmdType != 0) obj.Data.CmdType = 0;
             if (obj.Data2.CmdType != 0 || obj.Data.CmdType != 0) return;
             if (obj.Data2.Status != TrussStatus.Idle) throw new Exception($"桁架处于{obj.Data2.Status.GetDescription()}");
 

+ 3 - 3
业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/桁架码垛区补空托盘任务生成.cs

@@ -16,7 +16,7 @@ namespace WCS.WorkEngineering.Systems
     /// </summary>
     [BelongTo(typeof(SortingPalletizingWorld))]
     [Description("桁架码垛区补空托盘任务生成")]
-    public class 桁架码垛区补空托盘任务生成 : DeviceSystem<Device<IStation520>>
+    public class TrussCreateEmptyTray : DeviceSystem<Device<IStation520>>
     {
         protected override bool ParallelDo => true;
 
@@ -34,7 +34,7 @@ namespace WCS.WorkEngineering.Systems
                 //var palleTask = db.Queryable<WCS_TaskInfo>().First(x => x.ID == palletizingInfo.TaskId && (x.Status == TaskStatus.FinishOfShunt || x.Status == TaskStatus.ConveyorExecution));
                 //if (palleTask == null) throw new Exception($"未找到任务{palleTask.ID}");
                 //获取可以使用的放货站台信息
-                var taskAddNext = Device.All.FirstOrDefault(x => x.Code == palletizingInfo.TaskAddNext).Targets.FirstOrDefault().Targets.Where(x => x.HasFlag(DeviceFlags.桁架码垛位));
+                var taskAddNext = Device.All.FirstOrDefault(x => x.Code == palletizingInfo.TaskAddNext)?.Targets.FirstOrDefault()?.Targets.Where(x => x.HasFlag(DeviceFlags.桁架码垛位));
                 if (taskAddNext == null) throw new Exception($"未找到{palletizingInfo.TaskAddNext}可去的码垛工位");
                 var devs = Device.All.Where(x => taskAddNext.Contains(x)).Select(x => new Device<IStation520, IStation521, IStation523>(x, World)).ToList();
 
@@ -81,7 +81,7 @@ namespace WCS.WorkEngineering.Systems
 
         public override bool Select(Device dev)
         {
-            return dev.Code == nameof(桁架码垛区补空托盘任务生成);
+            return dev.Code == nameof(TrussCreateEmptyTray);
         }
     }
 }

+ 1 - 1
业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/桁架码垛工位任务结束处理.cs

@@ -87,7 +87,7 @@ namespace WCS.WorkEngineering.Systems
 
         public override bool Select(Device dev)
         {
-            var devCodes = new List<string>() { "1674", "1675", "1715", "1716" };
+            var devCodes = new List<string>() { "1670", "1671", "1715", "1716" };
             return dev.HasFlag(DeviceFlags.桁架码垛位) || devCodes.Contains(dev.Code);
         }
     }

+ 2 - 1
业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/桁架缓存放行点.cs

@@ -81,7 +81,8 @@ namespace WCS.WorkEngineering.Systems
                     var qty = lineCache.Locations.Count(x => x is { IsEmpty: false, InStock: true });
                     var devQty = _cacheDevices.FirstOrDefault(x => x.Key.Entity.Code == obj.Entity.Code).Value
                         .Count(x => x.Data2.Status.HasFlag(StationStatus.PH_Status));
-                    if (qty != devQty) throw new Exception($"当前缓存组工字轮未到齐"); //表示当前货物未全部到位
+                    if (qty != devQty && devQty < qty) throw new Exception($"当前缓存组工字轮未到齐"); //表示当前货物未全部到位
+
                     lineCache.Put = true;
                     db.Updateable(lineCache).ExecuteCommand();
 

+ 4 - 2
业务工程/分拣库/WCS.WorkEngineering/Systems/环形库/机械臂cs.cs

@@ -1,4 +1,5 @@
-using ServiceCenter.Extensions;
+using Newtonsoft.Json;
+using ServiceCenter.Extensions;
 using ServiceCenter.Logs;
 using ServiceCenter.SqlSugars;
 using System.ComponentModel;
@@ -89,7 +90,7 @@ namespace WCS.WorkEngineering.Systems
                                 task.EditTime = DateTime.Now;
                                 db.Default.Updateable(task).ExecuteCommand();
                                 task.AddWCS_TASK_DTL(db.Default, task.AddrTo, "出库任务结束");
-                              
+
                                 break;
 
                             case TaskType.TransferDepot:
@@ -304,6 +305,7 @@ namespace WCS.WorkEngineering.Systems
                             //两个工位同时码垛,并不会一个执行一次,只有一个托盘任务全部执行完毕,才会继续执行下一个,先生成任务的码垛工位会优先执行
                             var taskInfos = db.Default.Queryable<WCS_TaskInfo>().Where(v => v.Type == TaskType.OutDepot && v.Status == Entity.TaskStatus.WaitingToExecute)
                                                                                                     .Where(v => allOutCode.Contains(v.SrmStation)).ToList();
+                            if (!taskInfos.Any()) throw new KnownException($"未找到站台{JsonConvert.SerializeObject(allOutCode)}可用的出库任务", LogLevelEnum.Mid);
                             var srmStation = taskInfos.OrderBy(x => x.AddTime).First().SrmStation;
                             taskInfos = taskInfos.Where(x => x.SrmStation == srmStation).OrderBy(x => x.ProdLine).ToList();
 

+ 6 - 159
业务工程/分拣库/WCS.WorkEngineering/WorkStart.cs

@@ -27,23 +27,13 @@ namespace WCS.WorkEngineering
         {
             #region 无交互触发设备
 
-            var devs = new List<string>() { nameof(分线计算09), nameof(桁架码垛区补空托盘任务生成), "出库AGV", "入库AGV", nameof(NoInteractionSystems), nameof(UpLoadSystems), nameof(创建二次码垛出库任务) };
+            var devs = new List<string>() { nameof(TrussCreateEmptyTray), "AGVIn", "AGVOut", nameof(NoInteractionSystems), nameof(UpLoadSystems), nameof(TrussCreateTwoOut) };
             foreach (var conv in devs.Select(code => new Device(code)))
             {
                 conv.AddProtocol<IStation520>(0, 520, "1");
+                conv.AddFlag(DeviceFlags.无交互触发设备);
             }
 
-            //var devs1 = new DevDbConfig<string>()
-            //{
-            //    IP = "1",
-            //    DevCodeList = new List<string>() { nameof(分线计算09), nameof(桁架码垛区补空托盘任务生成), "出库AGV", "入库AGV", nameof(NoInteractionSystems), nameof(UpLoadSystems), nameof(创建二次码垛出库任务) }
-            //};
-            //Parallel.ForEach(devs1.DevCodeList, convCode =>
-            //{
-            //    var conv = new Device(convCode);
-            //    conv.AddProtocol<IStation520>(0, 520, devs1.IP);
-            //});
-
             #endregion 无交互触发设备
 
             #region 设置设备IP集合
@@ -73,23 +63,6 @@ namespace WCS.WorkEngineering
                 //conv.AddProtocol<IStation523>(, 523, item.IP);
             }
 
-            //var rgvInfo = new List<DevDbConfig<int>>()
-            //{
-            //    new("10.30.37.113",1),
-            //    new("10.30.37.118",2),
-            //    new("10.30.37.123",3),
-            //    new("10.30.37.128",4),
-            //    new("10.30.37.133",5),
-            //    new("10.30.37.138",6),
-            //};
-            //Parallel.ForEach(rgvInfo, dev =>
-            //{
-            //    var conv = new Device($"RGV{dev.Code}");
-            //    conv.AddFlag(DeviceFlags.RGV);
-            //    conv.AddProtocol<IRGV520>(0, 520, dev.IP);
-            //    conv.AddProtocol<IRGV521>(0, 521, dev.IP);
-            //});
-
             #endregion 初始化RGV相关信息
 
             #region 初始化输送机相关信息
@@ -149,35 +122,6 @@ namespace WCS.WorkEngineering
                 }
             }
 
-            //var devs2 = new List<DevDbConfig<int>>()
-            //{
-            //    new("10.30.37.89",new List<DevInterval<int>>(){new (1601,1620),new (2501, 2540),new (2701, 2740),new (1661, 1690) }),
-            //    new("10.30.37.97",new List<DevInterval<int>>(){new (1621, 1640),new (2901, 2940),new (3101, 3140),new (1691, 1720) }),
-            //    new("10.30.37.105",new List<DevInterval<int>>(){new (1641, 1660),new (3301, 3340),new (3501, 3540),new (1721, 1750) })
-            //};
-            //Parallel.ForEach(devs2, dev =>
-            //{
-            //    var db520 = 0;
-            //    var db521 = 0;
-            //    var db523 = 0;
-            //    foreach (var devInterval in dev.DevIntervalList)
-            //    {
-            //        for (var i = devInterval.StartCode; i <= devInterval.EndCode; i++)
-            //        {
-            //            var conv = new Device(i.ToString());
-            //            conv.AddFlag(DeviceFlags.输送机);
-
-            //            conv.AddProtocol<IStation520>(db520, 520, dev.IP);
-            //            conv.AddProtocol<IStation521>(db521, 521, dev.IP);
-            //            conv.AddProtocol<IStation523>(db523, 523, dev.IP);
-
-            //            db520 += 14;
-            //            db521 += 16;
-            //            db523 += 12;
-            //        }
-            //    }
-            //});
-
             #endregion 托盘线输送线
 
             #region 满轮输送线
@@ -223,31 +167,6 @@ namespace WCS.WorkEngineering
                 }
             }
 
-            //var devs3 = new List<DevDbConfig<int>>()
-            //{
-            //    new("10.30.37.166",new List<DevInterval<int>>(){new (1, 100),new (9001, 9010),new (401, 599),new (801, 999),new (1201, 1399) }),
-            //    new("10.30.37.198",new List<DevInterval<int>>(){new (101, 210),new (601, 799),new (1001, 1199),new (1401, 1599),new (341, 379) })
-            //};
-
-            //Parallel.ForEach(devs3, dev =>
-            //{
-            //    var db523 = 0;
-            //    var db524 = 0;
-            //    foreach (var devInterval in dev.DevIntervalList)
-            //    {
-            //        for (var i = devInterval.StartCode; i <= devInterval.EndCode; i++)
-            //        {
-            //            var conv = new Device(i.ToString());
-            //            conv.AddFlag(DeviceFlags.输送机);
-            //            conv.AddProtocol<IStation523>(db523, 523, dev.IP);
-            //            conv.AddProtocol<IStation524>(db524, 524, dev.IP);
-
-            //            db523 += 12;
-            //            db524 += 16;
-            //        }
-            //    }
-            //});
-
             #endregion DB523,所有线体都会有DB523
 
             #region 520、521 交互线体会有520、521
@@ -279,27 +198,6 @@ namespace WCS.WorkEngineering
                 }
             }
 
-            //var devs4 = new List<DevDbConfig<int>>()
-            //{
-            //    new ("10.30.37.166",new List<int>(){1,22,41,61,418,426,435,444,455,466,480,494,508,522,536,550,564,578,591,818,826,835,844,855,866,880,894,908,922,936,950,964,978,991,1218,1226,1235,1244,1255,1266,1280,1294,1308,1322,1336,1350,1364,1378,1391}),
-            //    new ("10.30.37.198",new List<int>(){101,122,141,161,618,626,635,644,655,666,680,694,708,722,736,750,764,778,791,1018,1026,1035,1044,1055,1066,1080,1094,1108,1122,1136,1150,1164,1178,1191,1418,1426,1435,1444,1455,1466,1480,1494,1508,1522,1536,1550,1564,1578,1591})
-            //};
-
-            //Parallel.ForEach(devs4, dev =>
-            //{
-            //    var db520 = 0;
-            //    var db521 = 0;
-            //    foreach (var devCode in dev.DevCodeList)
-            //    {
-            //        var device = Device.All.FirstOrDefault(v => v.Code == devCode.ToString());
-            //        device.AddProtocol<IStation520>(db520, 520, dev.IP);
-            //        device.AddProtocol<IStation521>(db521, 521, dev.IP);
-
-            //        db520 += 14;
-            //        db521 += 16;
-            //    }
-            //});
-
             #endregion 520、521 交互线体会有520、521
 
             #region 满轮扫码器
@@ -322,23 +220,6 @@ namespace WCS.WorkEngineering
                     db83 += 604;
                 }
             }
-            //var devs5 = new List<DevDbConfig<int>>()
-            //{
-            //    new("10.30.37.166",new List<int>(){3,14,18,22,38,323,41,58,61}) ,
-            //    new("10.30.37.198",new List<int>(){101,114,118,122,138,363,141,158,161})
-            //};
-
-            //Parallel.ForEach(devs5, dev =>
-            //{
-            //    var db83 = 0;
-            //    foreach (var devCode in dev.DevCodeList)
-            //    {
-            //        var device = Device.All.FirstOrDefault(v => v.Code == devCode.ToString());
-            //        device.AddProtocol<IBCR83>(db83, 83, dev.IP);
-
-            //        db83 += 604;
-            //    }
-            //});
 
             #endregion 满轮扫码器
 
@@ -362,23 +243,6 @@ namespace WCS.WorkEngineering
                 }
             }
 
-            //var devs6 = new List<DevDbConfig<int>>()
-            //{
-            //    new("10.30.37.166",new List<int>(){18,38,58}),
-            //    new("10.30.37.198",new List<int>(){118,138,158}),
-            //};
-
-            //Parallel.ForEach(devs6, dev =>
-            //{
-            //    var db525 = 0;
-            //    foreach (var devCode in dev.DevCodeList)
-            //    {
-            //        var device = Device.All.FirstOrDefault(v => v.Code == devCode.ToString());
-            //        device?.AddProtocol<IStation525>(db525, 525, dev.IP);
-            //        db525 += 3266;
-            //    }
-            //});
-
             #endregion 满轮线告诉分拣预分配
 
             #region 外检信息
@@ -401,23 +265,6 @@ namespace WCS.WorkEngineering
                 }
             }
 
-            //var devs7 = new List<DevDbConfig<int>>()
-            //{
-            //    new("10.30.37.166",new List<int>(){418,818,1218}),
-            //    new("10.30.37.198",new List<int>(){618,1018,1418})
-            //};
-
-            //Parallel.ForEach(devs7, dev =>
-            //{
-            //    var db91 = 0;
-            //    foreach (var devCode in dev.DevCodeList)
-            //    {
-            //        var device = Device.All.FirstOrDefault(v => v.Code == devCode.ToString());
-            //        device.AddProtocol<IStation91>(db91, 91, dev.IP);
-            //        db91 += 14;
-            //    }
-            //});
-
             #endregion 外检信息
 
             #endregion 满轮输送线
@@ -1243,7 +1090,7 @@ namespace WCS.WorkEngineering
                 { DeviceFlags.桁架取货点, new List<string>(){ "461", "475", "489", "503", "517", "531", "545", "559", "573", "586", "661", "675", "689", "703", "717", "731", "745", "759", "773", "786"/*, "861", "875", "889", "903", "917", "931", "945", "959", "973", "986", "1061", "1075", "1089", "1103", "1117", "1131", "1145", "1159", "1173", "1186", "1261", "1275", "1289", "1303", "1317", "1331", "1345", "1359", "1373", "1386" , "1461", "1475", "1489", "1503", "1517", "1531", "1545", "1559", "1573", "1586"*/ } },
                 //{ DeviceFlags.拆盘机09, new List<string>(){ /*"1606", "1616",*/"1626","1636","1646","1656" } },
                 { DeviceFlags.拆盘机, new List<string>(){ "1602", "1612"/*, "1622","1632","1642","1652"*/ } },
-                { DeviceFlags.桁架码垛位, new List<string>(){ "1670", "1671", "1672", "1673"/*, "1674", "1675"*/,"1664","1662","1663","1665","1677","1678","1679","1680","1685","1686","1687","1688","1689"/*,"1690", "1692", "1693", "1694", "1695", "1700", "1701", "1702", "1703", "1704", "1705", "1707", "1708", "1709", "1710", "1715", "1716", "1717", "1718", "1719", "1720", "1722", "1723", "1724", "1725", "1730", "1731", "1732", "1733", "1734", "1735", "1737", "1738", "1739", "1740", "1745", "1746", "1747", "1748", "1749", "1750"*/ } },
+                { DeviceFlags.桁架码垛位, new List<string>(){ /*"1670", "1671",*/ "1672", "1673", "1674", "1675", "1664","1662","1663","1665","1677","1678","1679","1680","1685","1686","1687","1688","1689"/*,"1690", "1692", "1693", "1694", "1695", "1700", "1701", "1702", "1703", "1704", "1705", "1707", "1708", "1709", "1710", "1715", "1716", "1717", "1718", "1719", "1720", "1722", "1723", "1724", "1725", "1730", "1731", "1732", "1733", "1734", "1735", "1737", "1738", "1739", "1740", "1745", "1746", "1747", "1748", "1749", "1750"*/ } },
                 { DeviceFlags.环形库码垛工位, new List<string>(){ "1666", "1661", "1676", "1681"/*, "1691", "1696", "1706", "1711", "1721", "1726", "1736", "1741"*/ } },
                 { DeviceFlags.AGV取货站台口, new List<string>(){ "2533", "2534", "2734", "2733"/*,"2934","2933","3133","3134","3333","3334","3533","3534" */} },
                 { DeviceFlags.Robot, new List<string>(){ "Robot1", "Robot2"/*, "Robot3","Robot4" , "Robot5", "Robot6"*/ } },
@@ -1301,10 +1148,10 @@ namespace WCS.WorkEngineering
 
                         case "PLC"://PLC
 
-                            //SqlSugarHelper.SetPLC(connectionString.Key);
+                            SqlSugarHelper.SetPLC(connectionString.Key);
 
                             //_db.DbMaintenance.CreateDatabase();
-
+                            //_db.CodeFirst.InitTables<WCS_Log>();
                             //_db.CodeFirst.InitTables<WCS_SRM520>();
                             //_db.CodeFirst.InitTables<WCS_SRM521>();
                             //_db.CodeFirst.InitTables<WCS_SRM537>();
@@ -1330,7 +1177,7 @@ namespace WCS.WorkEngineering
                             //_db.CodeFirst.InitTables<WCS_Robot522>();
                             //_db.CodeFirst.InitTables<WCS_Robot530>();
                             //_db.CodeFirst.InitTables<WCS_Robot531>();
-                            var a = false;
+                            //var a = false;
                             break;
 
                         default: //其他库

+ 1 - 1
业务工程/时效库/WCS.WorkEngineering/Systems/DataCollectionSysyem.cs

@@ -12,7 +12,7 @@ namespace WCS.WorkEngineering.Systems
     /// <summary>
     ///  数据采集系统
     /// </summary>
-    [BelongTo(typeof(DataCollectionWorld))]
+   // [BelongTo(typeof(DataCollectionWorld))]
     [Description("数据采集系统")]
     public class DataCollectionSysyem : DeviceSystem<SRM>
     {