林豪 左 2 years ago
parent
commit
813c5235af

+ 6 - 0
ServiceCenter/ServiceCenter.cs

@@ -1,4 +1,5 @@
 using SqlSugar;
+using WCS.Entity;
 
 namespace ServiceCenter
 {
@@ -19,6 +20,11 @@ namespace ServiceCenter
         /// </summary>
         public static List<DataBaseConnectionString>? RedisConnectionStrings { get; set; } = null!;
 
+        /// <summary>
+        /// 设备信息集合
+        /// </summary>
+        public static List<WCS_DeviceInfo> deviceInfos { get; set; } = null!;
+
         /// <summary>
         /// 仓库名称
         /// </summary>

+ 1 - 1
ServiceCenter/ServiceCenter.csproj

@@ -11,7 +11,7 @@
     <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.5" />
     <PackageReference Include="PlcSiemens" Version="1.0.0.2" />
     <PackageReference Include="WCS.Core" Version="1.0.0.7" />
-    <PackageReference Include="WCS.Entity" Version="1.0.1.1" />
+    <PackageReference Include="WCS.Entity" Version="1.0.1.2" />
   </ItemGroup>
 
 </Project>

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

@@ -7,7 +7,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="WCS.Entity" Version="1.0.1.1" />
+    <PackageReference Include="WCS.Entity" Version="1.0.1.2" />
   </ItemGroup>
 
 </Project>

+ 15 - 2
WCS.Entity/WCS_AgvTaskInfo.cs

@@ -1,5 +1,6 @@
 using SqlSugar;
 using System;
+using System.ComponentModel;
 using System.Runtime.Serialization;
 
 namespace WCS.Entity
@@ -116,55 +117,65 @@ namespace WCS.Entity
         /// <summary>
         /// 新建
         /// </summary>
+        [Description("新建")]
         NewBuild = 0,
 
         /// <summary>
         /// 确认
         /// </summary>
+        [Description("确认")]
         Confirm = 5,
 
         /// <summary>
         /// 执行
         /// </summary>
+        [Description("执行")]
         Execution = 10,
 
         /// <summary>
-        /// 请求/允许 AGV请求,WCS允许 根据任务类型判断取放货
+        /// 请求/允许1 AGV请求,WCS允许 根据任务类型判断取放货
         /// 工位一
         /// </summary>
+        [Description("请求/允许1")]
         RequestOrPermission1 = 20,
 
         /// <summary>
-        /// 取放完成
+        /// 取放完成1
         /// 工位一
         /// </summary>
+        [Description("取放完成1")]
         Complete1 = 21,
 
         /// <summary>
         /// 请求/允许 AGV请求,WCS允许 根据任务类型判断取放货
         /// 工位二
         /// </summary>
+        [Description("请求/允许2")]
         RequestOrPermission2 = 30,
 
         /// <summary>
         /// 取放完成
         /// 工位二
         /// </summary>
+        [Description("取放完成2")]
         Complete2 = 31,
 
         /// <summary>
         /// 任务完成
         /// </summary>
+        [Description("任务完成")]
         MissionCompleted = 99,
 
         /// <summary>
         /// 完成扫码
         /// </summary>
+        [Description("完成扫码")]
         CompleteScanCode = 100,
 
         /// <summary>
         ///  取消
         /// </summary>
+        [Description("取消")]
         Cancel = 106
     }
 
@@ -176,11 +187,13 @@ namespace WCS.Entity
         /// <summary>
         /// 入库
         /// </summary>
+        [Description("入库")]
         EnterDepot = 1,
 
         /// <summary>
         /// 叫料
         /// </summary>
+        [Description("叫料")]
         CallForMaterial = 2
     }
 }

+ 12 - 0
WCS.Entity/WCS_PlcSet.cs

@@ -1,5 +1,6 @@
 using SqlSugar;
 using System;
+using System.ComponentModel;
 
 namespace WCS.Entity
 {
@@ -70,26 +71,31 @@ namespace WCS.Entity
         /// <summary>
         /// 西门子
         /// </summary>
+        [Description("西门子")]
         Siemens = 1,
 
         /// <summary>
         /// 三菱
         /// </summary>
+        [Description("三菱")]
         Mitsubishi = 2,
 
         /// <summary>
         /// AB
         /// </summary>
+        [Description("AB")]
         AB = 3,
 
         /// <summary>
         /// 欧姆龙
         /// </summary>
+        [Description("欧姆龙")]
         OMRON = 4,
 
         /// <summary>
         /// 汇川
         /// </summary>
+        [Description("汇川")]
         INOVANCE = 5,
     }
 
@@ -103,31 +109,37 @@ namespace WCS.Entity
         /// <summary>
         /// 1200系列
         /// </summary>
+        [Description("1200系列")]
         S1200 = 1,
 
         /// <summary>
         /// 300系列
         /// </summary>
+        [Description("300系列")]
         S300 = 2,
 
         /// <summary>
         /// 400系列
         /// </summary>
+        [Description("400系列")]
         S400 = 3,
 
         /// <summary>
         /// 1500系列PLC
         /// </summary>
+        [Description("1500系列PLC")]
         S1500 = 4,
 
         /// <summary>
         /// 200的smart系列
         /// </summary>
+        [Description("200的smart系列")]
         S200Smart = 5,
 
         /// <summary>
         /// 200系统,需要额外配置以太网模块
         /// </summary>
+        [Description("200系统")]
         S200 = 6
 
         #endregion 西门子

+ 23 - 4
WCS.Entity/WCS_TaskInfo.cs

@@ -1,5 +1,6 @@
 using SqlSugar;
 using System;
+using System.ComponentModel;
 
 namespace WCS.Entity
 {
@@ -226,26 +227,31 @@ namespace WCS.Entity
         /// <summary>
         /// 组盘
         /// </summary>
+        [Description("组盘")]
         SetPlate = 0,
 
         /// <summary>
         /// 入库
         /// </summary>
+        [Description("入库")]
         EnterDepot = 1,
 
         /// <summary>
         /// 出库
         /// </summary>
+        [Description("出库")]
         OutDepot = 2,
 
         /// <summary>
         /// 移库
         /// </summary>
+        [Description("移库")]
         TransferDepot = 3,
 
         /// <summary>
         /// 输送
         /// </summary>
+        [Description("输送")]
         Delivery = 5,
     }
 
@@ -257,36 +263,49 @@ namespace WCS.Entity
         /// <summary>
         /// 新建
         /// </summary>
+        [Description("新建")]
         NewBuild = 0,
 
+        /// <summary>
+        /// 待执行
+        /// </summary>
+        [Description("待执行")]
+        WaitingToExecute = 1,
+
         /// <summary>
         /// 输送机执行中
         /// </summary>
-        ConveyorInProgress = 2,
+        [Description("输送机执行中")]
+        ConveyorInProgress = 10,
 
         /// <summary>
         /// 堆垛机执行
         /// </summary>
-        StackerExecution = 5,
+        [Description("堆垛机执行")]
+        StackerExecution = 20,
 
         /// <summary>
         /// 堆垛机完成
         /// </summary>
-        StackerCompleted = 6,
+        [Description("堆垛机完成")]
+        StackerCompleted = 30,
 
         /// <summary>
         /// AGV执行中
         /// </summary>
-        AGVInProgress = 10,
+        [Description("AGV执行中")]
+        AGVInProgress = 40,
 
         /// <summary>
         /// 已完成
         /// </summary>
+        [Description("已完成")]
         Finish = 99,
 
         /// <summary>
         /// 已取消
         /// </summary>
+        [Description("已取消")]
         Cancel = 106
     }
 }

+ 18 - 2
WCS.Service/Worker.cs

@@ -137,6 +137,20 @@ namespace WCS.Service
 
             #endregion 初始化数据库连接
 
+            #region 初始化设备信息
+
+            SqlSugarHelper.Do(db =>
+            {
+                ServiceHub.deviceInfos = db.Default.Queryable<WCS_DeviceInfo>()
+                                                   .Includes(v => v.Routes)
+                                                   .Includes(v => v.Paths)
+                                                   .Includes(v => v.DeviceGroup)
+                                                   .Includes(v => v.DeviceProtocol)
+                                                   .ToList();
+            });
+
+            #endregion 初始化设备信息
+
             #region 创建虚拟PLC
 
             var isOpenVirtualPlc = RedisHub.Default.Check("isOpenVirtualPLC") ?? throw new Exception("请在Redsi中配置是否启用虚拟PLC");
@@ -167,6 +181,8 @@ namespace WCS.Service
 
             var a = typeof(IStation520);
 
+            #region 初始化PLC访问器及PLC读取协议
+
             //创建PLC访问器
             Configs.PLCAccessorCreater = new PLCAccessors.PLCAccessorsCreater();
             try
@@ -178,9 +194,7 @@ namespace WCS.Service
                     var dbProtocols = _db.Queryable<WCS_DeviceProt>().Includes(v => v.DB, p => p.PLC).ToList();
                     foreach (var dbProtocol in dbProtocols)
                     {
-#pragma warning disable CS8604 // 引用类型参数可能为 null。
                         Add(Type.GetType(dbProtocol.DB.Protocol), dbProtocol.DeviceCode, dbProtocol.Position, dbProtocol.DB, dbProtocol.DB.PLC);
-#pragma warning restore CS8604 // 引用类型参数可能为 null。
                     }
                 });
 
@@ -205,6 +219,8 @@ namespace WCS.Service
             {
                 _logger.LogError("WCS启动失败{0}", ex.Message);
             }
+
+            #endregion 初始化PLC访问器及PLC读取协议
         }
 
         /// <summary>

+ 2 - 0
WCS.WorkEngineering/Systems/SrmSystems.cs

@@ -189,6 +189,8 @@ namespace WCS.WorkEngineering.Systems
                 var floor = obj.Entity.Get<int>("Floor");
                 floor = floor % 2 + 1;
                 obj.Entity.Set("Floor", floor);
+                
+                //获取当前堆垛机所有的取货站台
             }
             else if (enterOrOut == 3 || !lastIsOut) //出库任务
             {

+ 1 - 1
WCS.WorkEngineering/WCS.WorkEngineering.csproj

@@ -8,7 +8,7 @@
 
   <ItemGroup>
     <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.5" />
-    <PackageReference Include="ServiceCenter" Version="1.0.1.4" />
+    <PackageReference Include="ServiceCenter" Version="1.0.1.6" />
   </ItemGroup>
 
   <ItemGroup>