林豪 左 2 năm trước cách đây
mục cha
commit
9015fd0a82
46 tập tin đã thay đổi với 816 bổ sung841 xóa
  1. 0 6
      ServiceCenter/ServiceCenter.cs
  2. 3 2
      ServiceCenter/ServiceCenter.csproj
  3. 1 1
      WCS.Core/WCS.Core.csproj
  4. 1 4
      WCS.Entity.Protocol/BCR/WCS_BCR80.cs
  5. 1 4
      WCS.Entity.Protocol/BCR/WCS_BCR81.cs
  6. 0 0
      WCS.Entity.Protocol/IProtocol.cs
  7. 0 0
      WCS.Entity.Protocol/IgnoreChangingAttribute.cs
  8. 8 8
      WCS.Entity.Protocol/SRM/ISRM520.cs
  9. 12 12
      WCS.Entity.Protocol/SRM/ISRM521.cs
  10. 1 9
      WCS.Entity.Protocol/Station/WCS_Station520.cs
  11. 1 10
      WCS.Entity.Protocol/Station/WCS_Station521.cs
  12. 1 7
      WCS.Entity.Protocol/Station/WCS_Station523.cs
  13. 1 7
      WCS.Entity.Protocol/Station/WCS_Station91.cs
  14. 1 1
      WCS.Entity.Protocol/WCS.Entity.Protocol.csproj
  15. 30 0
      WCS.Entity.Protocol/WCS_PROTOCOLDATA.cs
  16. 27 27
      WCS.Entity/WCS_DeviceGrp.cs
  17. 56 56
      WCS.Entity/WCS_DeviceInfo.cs
  18. 32 32
      WCS.Entity/WCS_DeviceProt.cs
  19. 0 45
      WCS.Entity/WCS_PROTOCOLDATA.cs
  20. 32 32
      WCS.Entity/WCS_PathGrp.cs
  21. 57 57
      WCS.Entity/WCS_PathInfo.cs
  22. 34 34
      WCS.Entity/WCS_PlcData.cs
  23. 62 62
      WCS.Entity/WCS_PlcDataBlock.cs
  24. 140 140
      WCS.Entity/WCS_PlcSet.cs
  25. 27 27
      WCS.Entity/WCS_ROUTE.cs
  26. 1 63
      WCS.Service/Worker.cs
  27. 0 0
      WCS.WorkEngineering/DataStructure/DeviceData.cs
  28. 0 0
      WCS.WorkEngineering/DataStructure/DeviceDataCollection.cs
  29. 0 0
      WCS.WorkEngineering/DataStructure/DeviceDataPack.cs
  30. 0 0
      WCS.WorkEngineering/DataStructure/ProdLineData.cs
  31. 0 0
      WCS.WorkEngineering/DataStructure/RGVData.cs
  32. 0 0
      WCS.WorkEngineering/DataStructure/RobotData.cs
  33. 0 0
      WCS.WorkEngineering/DataStructure/SRMData.cs
  34. 0 0
      WCS.WorkEngineering/DataStructure/StationData.cs
  35. 1 1
      WCS.WorkEngineering/Extensions/BCRExtension.cs
  36. 125 137
      WCS.WorkEngineering/Extensions/DeviceExtension.cs
  37. 2 9
      WCS.WorkEngineering/Extensions/SRMExtension.cs
  38. 1 1
      WCS.WorkEngineering/Extensions/StationExtension.cs
  39. 2 3
      WCS.WorkEngineering/ProtocolProxy.cs
  40. 1 1
      WCS.WorkEngineering/Systems/DataCollectionSysyem.cs
  41. 22 20
      WCS.WorkEngineering/Systems/SrmSystems.cs
  42. 1 1
      WCS.WorkEngineering/Systems/StorageSysyem.cs
  43. 1 5
      WCS.WorkEngineering/WCS.WorkEngineering.csproj
  44. 0 16
      WCS.WorkEngineering/WorkConfigHub.cs
  45. 130 0
      WCS.WorkEngineering/WorkStart.cs
  46. 1 1
      WcsFramework.sln

+ 0 - 6
ServiceCenter/ServiceCenter.cs

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

+ 3 - 2
ServiceCenter/ServiceCenter.csproj

@@ -10,8 +10,9 @@
   <ItemGroup>
     <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.4" />
+    <PackageReference Include="WCS.Core" Version="1.0.0.8" />
+    <PackageReference Include="WCS.Entity" Version="1.0.1.6" />
+    <PackageReference Include="WCS.Entity.Protocol" Version="1.0.0.5" />
   </ItemGroup>
 
 </Project>

+ 1 - 1
WCS.Core/WCS.Core.csproj

@@ -7,7 +7,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="FreeRedis" Version="1.0.8" />
+    <PackageReference Include="FreeRedis" Version="1.1.1" />
   </ItemGroup>
 
 </Project>

+ 1 - 4
WCS.Entity.Protocol/BCR/WCS_BCR80.cs

@@ -1,19 +1,16 @@
-using SqlSugar;
-using System.Runtime.Serialization;
+using System.Runtime.Serialization;
 
 namespace WCS.Entity.Protocol.BCR
 {
     /// <summary>
     /// 读码器读取协议
     /// </summary>
-    [SugarTable(nameof(WCS_BCR80), "读码器读取协议")]
     [DataContract]
     public class WCS_BCR80 : WCS_PROTOCOLDATA, IBCR80
     {
         /// <summary>
         /// 内容
         /// </summary>
-        [SugarColumn(ColumnDescription = "内容", Length = 130)]
         [DataMember(Order = 0)]
         public string Content { get; set; }
     }

+ 1 - 4
WCS.Entity.Protocol/BCR/WCS_BCR81.cs

@@ -1,19 +1,16 @@
-using SqlSugar;
-using System.Runtime.Serialization;
+using System.Runtime.Serialization;
 
 namespace WCS.Entity.Protocol.BCR
 {
     /// <summary>
     /// 读码器写入协议81
     /// </summary>
-    [SugarTable(nameof(WCS_BCR80), "读码器读取协议")]
     [DataContract]
     public class WCS_BCR81 : WCS_PROTOCOLDATA, IBCR80
     {
         /// <summary>
         /// 内容
         /// </summary>
-        [SugarColumn(ColumnDescription = "内容", Length = 130)]
         [DataMember(Order = 0)]
         public string Content { get; set; }
     }

+ 0 - 0
WCS.Entity/IProtocol.cs → WCS.Entity.Protocol/IProtocol.cs


+ 0 - 0
WCS.Entity/IgnoreChangingAttribute.cs → WCS.Entity.Protocol/IgnoreChangingAttribute.cs


+ 8 - 8
WCS.Entity.Protocol/SRM/ISRM520.cs

@@ -44,49 +44,49 @@ namespace WCS.Entity.Protocol.SRM
         ///  任务起始行
         /// </summary>
         [Description("任务起始行")]
-        short RowPos1 { get; set; }
+        short SLine { get; set; }
 
         /// <summary>
         ///  任务起始列
         /// </summary>
         [Description("任务起始列")]
-        short TravelPos1 { get; set; }
+        short SCol { get; set; }
 
         /// <summary>
         ///  任务起始层
         /// </summary>
         [Description("任务起始层")]
-        short LiftPos1 { get; set; }
+        short SLayer { get; set; }
 
         /// <summary>
         ///  任务起始深度
         /// </summary>
         [Description("任务起始深度")]
-        ForkPosition ForkStartPos1 { get; set; }
+        ForkPosition SDepth { get; set; }
 
         /// <summary>
         ///  任务目标行
         /// </summary>
         [Description("任务目标行")]
-        short RowPos2 { get; set; }
+        short ELine { get; set; }
 
         /// <summary>
         ///  任务目标列
         /// </summary>
         [Description("任务目标列")]
-        short TravelPos2 { get; set; }
+        short ECol { get; set; }
 
         /// <summary>
         ///  任务目标层
         /// </summary>
         [Description("任务目标层")]
-        short LiftPos2 { get; set; }
+        short ELayer { get; set; }
 
         /// <summary>
         ///  任务目标深度
         /// </summary>
         [Description("任务目标深度")]
-        ForkPosition ForkStartPos2 { get; set; }
+        ForkPosition EDepth { get; set; }
 
         /// <summary>
         ///  任务号

+ 12 - 12
WCS.Entity.Protocol/SRM/ISRM521.cs

@@ -32,49 +32,49 @@ namespace WCS.Entity.Protocol.SRM
         ///  任务起始行
         /// </summary>
         [Description("任务起始行")]
-        short RowPos1 { get; set; }
+        short SLine { get; set; }
 
         /// <summary>
         ///  任务起始列
         /// </summary>
         [Description("任务起始列")]
-        short TravelPos1 { get; set; }
+        short SCol { get; set; }
 
         /// <summary>
         ///  任务起始层
         /// </summary>
         [Description("任务起始层")]
-        short LiftPos1 { get; set; }
+        short SLayer { get; set; }
 
         /// <summary>
         ///  任务起始深度
         /// </summary>
         [Description("任务起始深度")]
-        ForkPosition ForkDestPos1 { get; set; }
+        ForkPosition SDepth { get; set; }
 
         /// <summary>
         ///  任务目标行
         /// </summary>
         [Description("任务目标行")]
-        short RowPos2 { get; set; }
+        short ELine { get; set; }
 
         /// <summary>
         ///  任务目标列
         /// </summary>
         [Description("任务目标列")]
-        short TravelPos2 { get; set; }
+        short ECol { get; set; }
 
         /// <summary>
         ///  任务目标层
         /// </summary>
         [Description("任务目标层")]
-        short LiftPos2 { get; set; }
+        short ELayer { get; set; }
 
         /// <summary>
         ///  任务目标深度
         /// </summary>
         [Description("任务目标深度")]
-        ForkPosition ForkDestPos2 { get; set; }
+        ForkPosition EDepth { get; set; }
 
         /// <summary>
         ///  任务号
@@ -92,19 +92,19 @@ namespace WCS.Entity.Protocol.SRM
         ///  当前行
         /// </summary>
         [Description("当前行")]
-        short SrmRow { get; set; }
+        short Line { get; set; }
 
         /// <summary>
         ///  当前列
         /// </summary>
         [Description("当前列")]
-        short SrmTravel { get; set; }
+        short Col { get; set; }
 
         /// <summary>
         ///  当前层
         /// </summary>
         [Description("当前层")]
-        short SrmLayer { get; set; }
+        short Layer { get; set; }
 
         /// <summary>
         ///  完成任务号
@@ -128,7 +128,7 @@ namespace WCS.Entity.Protocol.SRM
         ///  货叉当前位置 MM
         /// </summary>
         [Description("货叉当前位置 MM")]
-        int ForkPos1 { get; set; }
+        int ForkPos { get; set; }
 
         /// <summary>
         ///  运行速度

+ 1 - 9
WCS.Entity.Protocol/Station/WCS_Station520.cs

@@ -1,5 +1,4 @@
-using SqlSugar;
-using System.ComponentModel;
+using System.ComponentModel;
 using System.Runtime.Serialization;
 
 namespace WCS.Entity.Protocol.Station
@@ -7,14 +6,12 @@ namespace WCS.Entity.Protocol.Station
     /// <summary>
     /// 站台交互信号 写记录表
     /// </summary>
-    [SugarTable(nameof(WCS_Station520), "站台交互信号 写记录表")]
     [DataContract]
     public class WCS_Station520 : WCS_PROTOCOLDATA, IStation520
     {
         /// <summary>
         /// 任务号
         /// </summary>
-        [SugarColumn(ColumnDescription = "任务号")]
         [Description("任务号")]
         [DataMember(Order = 0)]
         public int TaskNumber { get; set; }
@@ -22,7 +19,6 @@ namespace WCS.Entity.Protocol.Station
         /// <summary>
         /// 起始地址
         /// </summary>
-        [SugarColumn(ColumnDescription = "起始地址")]
         [Description("起始地址")]
         [DataMember(Order = 1)]
         public short GoodsStart { get; set; }
@@ -30,7 +26,6 @@ namespace WCS.Entity.Protocol.Station
         /// <summary>
         /// 目标地址
         /// </summary>
-        [SugarColumn(ColumnDescription = "目标地址")]
         [Description("目标地址")]
         [DataMember(Order = 2)]
         public short GoodsEnd { get; set; }
@@ -38,7 +33,6 @@ namespace WCS.Entity.Protocol.Station
         /// <summary>
         /// 运行模式
         /// </summary>
-        [SugarColumn(ColumnDescription = "运行模式")]
         [Description("运行模式")]
         [DataMember(Order = 3)]
         public ModeEunm Mode { get; set; }
@@ -46,7 +40,6 @@ namespace WCS.Entity.Protocol.Station
         /// <summary>
         /// 指令类型
         /// </summary>
-        [SugarColumn(ColumnDescription = "指令类型")]
         [Description("指令类型")]
         [DataMember(Order = 4)]
         public CmdTypeEnum CmdType { get; set; }
@@ -54,7 +47,6 @@ namespace WCS.Entity.Protocol.Station
         /// <summary>
         /// 凭证号
         /// </summary>
-        [SugarColumn(ColumnDescription = "凭证号")]
         [Description("凭证号")]
         [DataMember(Order = 5)]
         public short VoucherNo { get; set; }

+ 1 - 10
WCS.Entity.Protocol/Station/WCS_Station521.cs

@@ -1,17 +1,14 @@
-using SqlSugar;
-using System.ComponentModel;
+using System.ComponentModel;
 using System.Runtime.Serialization;
 
 namespace WCS.Entity.Protocol.Station
 {
-    [SugarTable(nameof(WCS_Station521), "输送机交互信号 读记录表")]
     [DataContract]
     public class WCS_Station521 : WCS_PROTOCOLDATA, IStation521
     {
         /// <summary>
         /// 任务号
         /// </summary>
-        [SugarColumn(ColumnDescription = "任务号")]
         [Description("任务号")]
         [DataMember(Order = 0)]
         public int TaskNumber { get; set; }
@@ -19,7 +16,6 @@ namespace WCS.Entity.Protocol.Station
         /// <summary>
         /// 起始地址
         /// </summary>
-        [SugarColumn(ColumnDescription = "起始地址")]
         [Description("起始地址")]
         [DataMember(Order = 1)]
         public short GoodsStart { get; set; }
@@ -27,7 +23,6 @@ namespace WCS.Entity.Protocol.Station
         /// <summary>
         /// 目标地址
         /// </summary>
-        [SugarColumn(ColumnDescription = "目标地址")]
         [Description("目标地址")]
         [DataMember(Order = 2)]
         public short GoodsEnd { get; set; }
@@ -35,7 +30,6 @@ namespace WCS.Entity.Protocol.Station
         /// <summary>
         /// 运行模式
         /// </summary>
-        [SugarColumn(ColumnDescription = "运行模式")]
         [Description("运行模式")]
         [DataMember(Order = 3)]
         public ModeEunm Mode { get; set; }
@@ -43,7 +37,6 @@ namespace WCS.Entity.Protocol.Station
         /// <summary>
         /// 指令回复
         /// </summary>
-        [SugarColumn(ColumnDescription = "指令回复")]
         [Description("指令回复")]
         [DataMember(Order = 4)]
         public CmdReplyEnum CmdType { get; set; }
@@ -51,7 +44,6 @@ namespace WCS.Entity.Protocol.Station
         /// <summary>
         /// 凭证号
         /// </summary>
-        [SugarColumn(ColumnDescription = "凭证号")]
         [Description("凭证号")]
         [DataMember(Order = 5)]
         public short VoucherNo { get; set; }
@@ -59,7 +51,6 @@ namespace WCS.Entity.Protocol.Station
         /// <summary>
         /// 请求
         /// </summary>
-        [SugarColumn(ColumnDescription = "请求")]
         [Description("请求")]
         [DataMember(Order = 6)]
         short IStation521.Request { get; set; }

+ 1 - 7
WCS.Entity.Protocol/Station/WCS_Station523.cs

@@ -1,40 +1,34 @@
-using SqlSugar;
-using System.Runtime.Serialization;
+using System.Runtime.Serialization;
 
 namespace WCS.Entity.Protocol.Station
 {
     /// <summary>
     /// 站台状态读取记录表
     /// </summary>
-    [SugarTable(nameof(WCS_Station523), "站台状态读取记录表")]
     [DataContract]
     public class WCS_Station523 : WCS_PROTOCOLDATA, IStation523
     {
         /// <summary>
         /// 警报
         /// </summary>
-        [SugarColumn(ColumnDescription = "警报")]
         [DataMember(Order = 0)]
         public AlarmEunm Alarm { get; set; }
 
         /// <summary>
         /// 备用
         /// </summary>
-        [SugarColumn(ColumnDescription = "备用")]
         [DataMember(Order = 1)]
         public short RES { get; set; }
 
         /// <summary>
         /// 状态
         /// </summary>
-        [SugarColumn(ColumnDescription = "状态")]
         [DataMember(Order = 2)]
         public StatusEunm Status { get; set; }
 
         /// <summary>
         /// 运行时间
         /// </summary>
-        [SugarColumn(ColumnDescription = "运行时间")]
         [DataMember(Order = 3)]
         public float RunTime { get; set; }
     }

+ 1 - 7
WCS.Entity.Protocol/Station/WCS_Station91.cs

@@ -1,40 +1,34 @@
-using SqlSugar;
-using System.Runtime.Serialization;
+using System.Runtime.Serialization;
 
 namespace WCS.Entity.Protocol.Station
 {
     /// <summary>
     /// 外检读取数据
     /// </summary>
-    [SugarTable(nameof(WCS_Station91), "外检读取数据")]
     [DataContract]
     public class WCS_Station91 : WCS_PROTOCOLDATA, IStation91
     {
         /// <summary>
         /// 外检故障
         /// </summary>
-        [SugarColumn(ColumnDescription = "外检故障")]
         [DataMember(Order = 0)]
         public ShapeAlarmEunm ShapeAlarm { get; set; }
 
         /// <summary>
         /// 重量
         /// </summary>
-        [SugarColumn(ColumnDescription = "重量")]
         [DataMember(Order = 1)]
         public float Weight { get; set; }
 
         /// <summary>
         /// 长度
         /// </summary>
-        [SugarColumn(ColumnDescription = "长度")]
         [DataMember(Order = 2)]
         public float Length { get; set; }
 
         /// <summary>
         /// 宽度
         /// </summary>
-        [SugarColumn(ColumnDescription = "宽度")]
         [DataMember(Order = 3)]
         public float Width { get; set; }
     }

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

@@ -7,7 +7,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="WCS.Entity" Version="1.0.1.4" />
+    <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
   </ItemGroup>
 
 </Project>

+ 30 - 0
WCS.Entity.Protocol/WCS_PROTOCOLDATA.cs

@@ -0,0 +1,30 @@
+using System;
+
+namespace WCS.Entity
+{
+    /// <summary>
+    /// 协议数据抽象类,所有的设备具体协议信息都需继承该类
+    /// </summary>
+    public abstract class WCS_PROTOCOLDATA
+    {
+        /// <summary>
+        /// 设备编号
+        /// </summary>
+        public string DEVICECOD { get; set; }
+
+        /// <summary>
+        /// 确认时间
+        /// </summary>
+        public DateTime FRAME { get; set; }
+
+        /// <summary>
+        /// 最后更新
+        /// </summary>
+        public bool ISLAST { get; set; }
+
+        /// <summary>
+        /// WCS版本号
+        /// </summary>
+        public int WCSVERSION { get; set; }
+    }
+}

+ 27 - 27
WCS.Entity/WCS_DeviceGrp.cs

@@ -2,34 +2,34 @@
 
 namespace WCS.Entity
 {
-    /// <summary>
-    /// 设备组
-    /// </summary>
-    [SugarTable(nameof(WCS_DeviceGrp), "设备组")]
-    public class WCS_DeviceGrp : OBJ
-    {
-        /// <summary>
-        /// 组设备编号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "组设备编号")]
-        public string GroupCode { get; set; }
+    ///// <summary>
+    ///// 设备组
+    ///// </summary>
+    //[SugarTable(nameof(WCS_DeviceGrp), "设备组")]
+    //public class WCS_DeviceGrp : OBJ
+    //{
+    //    /// <summary>
+    //    /// 组设备编号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "组设备编号")]
+    //    public string GroupCode { get; set; }
 
-        /// <summary>
-        /// 组设备信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, nameof(GroupCode))]
-        public WCS_DeviceInfo Group { get; set; }
+    //    /// <summary>
+    //    /// 组设备信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToOne, nameof(GroupCode))]
+    //    public WCS_DeviceInfo Group { get; set; }
 
-        /// <summary>
-        /// 子设备编号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "子设备编号")]
-        public string MemberCode { get; set; }
+    //    /// <summary>
+    //    /// 子设备编号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "子设备编号")]
+    //    public string MemberCode { get; set; }
 
-        /// <summary>
-        /// 子设备信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, nameof(MemberCode))]
-        public WCS_DeviceInfo Member { get; set; }
-    }
+    //    /// <summary>
+    //    /// 子设备信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToOne, nameof(MemberCode))]
+    //    public WCS_DeviceInfo Member { get; set; }
+    //}
 }

+ 56 - 56
WCS.Entity/WCS_DeviceInfo.cs

@@ -3,60 +3,60 @@ using System.Collections.Generic;
 
 namespace WCS.Entity
 {
-    /// <summary>
-    /// 设备列表
-    /// </summary>
-    [SugarTable(nameof(WCS_DeviceInfo), "设备列表")]
-    public class WCS_DeviceInfo : OBJ
-    {
-        [SugarColumn(IsIgnore = true)]
-        public override int ID { get; set; }
-
-        /// <summary>
-        /// 设备编号
-        /// </summary>
-        [SugarColumn(IsPrimaryKey = true, ColumnDescription = "设备编号", Length = 50)]
-        public string Code { get; set; }
-
-        /// <summary>
-        /// 设备名称
-        /// </summary>
-        [SugarColumn(Length = 50, ColumnDescription = "设备名称")]
-        public string Name { get; set; }
-
-        /// <summary>
-        /// 设备可用协议集合
-        /// </summary>
-        [Navigate(NavigateType.OneToMany, nameof(WCS_DeviceProt.DeviceCode))]
-        public List<WCS_DeviceProt> DeviceProtocol { get; set; }
-
-        /// <summary>
-        /// 上一个设备集合
-        /// </summary>
-        [Navigate(NavigateType.OneToMany, nameof(WCS_Route.NextCode))]
-        public List<WCS_Route> FormerRoutes { get; set; }
-
-        /// <summary>
-        /// 下一个设备集合
-        /// </summary>
-        [Navigate(NavigateType.OneToMany, nameof(WCS_Route.DeviceCode))]
-        public List<WCS_Route> NextRoutes { get; set; }
-
-        /// <summary>
-        /// 设备可用路径集合
-        /// </summary>
-        [Navigate(NavigateType.OneToMany, nameof(WCS_PathGrp.StartCode))]
-        public List<WCS_PathGrp> Paths { get; set; }
-
-        /// <summary>
-        /// 设备对应设备组信息
-        /// </summary>
-        [Navigate(NavigateType.OneToMany, nameof(WCS_DeviceGrp.GroupCode))]
-        public List<WCS_DeviceGrp> DeviceGroup { get; set; }
-
-        public override string ToString()
-        {
-            return Code;
-        }
-    }
+    ///// <summary>
+    ///// 设备列表
+    ///// </summary>
+    //[SugarTable(nameof(WCS_DeviceInfo), "设备列表")]
+    //public class WCS_DeviceInfo : OBJ
+    //{
+    //    [SugarColumn(IsIgnore = true)]
+    //    public override int ID { get; set; }
+
+    //    /// <summary>
+    //    /// 设备编号
+    //    /// </summary>
+    //    [SugarColumn(IsPrimaryKey = true, ColumnDescription = "设备编号", Length = 50)]
+    //    public string Code { get; set; }
+
+    //    /// <summary>
+    //    /// 设备名称
+    //    /// </summary>
+    //    [SugarColumn(Length = 50, ColumnDescription = "设备名称")]
+    //    public string Name { get; set; }
+
+    //    /// <summary>
+    //    /// 设备可用协议集合
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToMany, nameof(WCS_DeviceProt.DeviceCode))]
+    //    public List<WCS_DeviceProt> DeviceProtocol { get; set; }
+
+    //    /// <summary>
+    //    /// 上一个设备集合
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToMany, nameof(WCS_Route.NextCode))]
+    //    public List<WCS_Route> FormerRoutes { get; set; }
+
+    //    /// <summary>
+    //    /// 下一个设备集合
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToMany, nameof(WCS_Route.DeviceCode))]
+    //    public List<WCS_Route> NextRoutes { get; set; }
+
+    //    /// <summary>
+    //    /// 设备可用路径集合
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToMany, nameof(WCS_PathGrp.StartCode))]
+    //    public List<WCS_PathGrp> Paths { get; set; }
+
+    //    /// <summary>
+    //    /// 设备对应设备组信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToMany, nameof(WCS_DeviceGrp.GroupCode))]
+    //    public List<WCS_DeviceGrp> DeviceGroup { get; set; }
+
+    //    public override string ToString()
+    //    {
+    //        return Code;
+    //    }
+    //}
 }

+ 32 - 32
WCS.Entity/WCS_DeviceProt.cs

@@ -2,40 +2,40 @@
 
 namespace WCS.Entity
 {
-    /// <summary>
-    /// DB块读写协议
-    /// </summary>
-    [SugarTable(nameof(WCS_DeviceProt), "DB块读写协议")]
-    public class WCS_DeviceProt : OBJ
-    {
-        /// <summary>
-        /// 设备编号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "设备")]
-        public string DeviceCode { get; set; }
+    ///// <summary>
+    ///// DB块读写协议
+    ///// </summary>
+    //[SugarTable(nameof(WCS_DeviceProt), "DB块读写协议")]
+    //public class WCS_DeviceProt : OBJ
+    //{
+    //    /// <summary>
+    //    /// 设备编号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "设备")]
+    //    public string DeviceCode { get; set; }
 
-        /// <summary>
-        /// 设备信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, nameof(DeviceCode))]
-        public WCS_DeviceInfo Device { get; set; }
+    //    /// <summary>
+    //    /// 设备信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToOne, nameof(DeviceCode))]
+    //    public WCS_DeviceInfo Device { get; set; }
 
-        /// <summary>
-        /// DB编号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "DB编号")]
-        public string DataBlockCode { get; set; }
+    //    /// <summary>
+    //    /// DB编号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "DB编号")]
+    //    public string DataBlockCode { get; set; }
 
-        /// <summary>
-        /// DB信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, nameof(DataBlockCode))]
-        public WCS_PlcDataBlock DB { get; set; }
+    //    /// <summary>
+    //    /// DB信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToOne, nameof(DataBlockCode))]
+    //    public WCS_PlcDataBlock DB { get; set; }
 
-        /// <summary>
-        /// 起始位置
-        /// </summary>
-        [SugarColumn(ColumnDescription = "起始位置")]
-        public short Position { get; set; }
-    }
+    //    /// <summary>
+    //    /// 起始位置
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "起始位置")]
+    //    public short Position { get; set; }
+    //}
 }

+ 0 - 45
WCS.Entity/WCS_PROTOCOLDATA.cs

@@ -1,45 +0,0 @@
-using SqlSugar;
-using System;
-
-namespace WCS.Entity
-{
-    /// <summary>
-    /// 协议数据抽象类,所有的设备具体协议信息都需继承该类
-    /// </summary>
-    public abstract class WCS_PROTOCOLDATA : OBJ
-    {
-        /// <inheritdoc/>
-        [SugarColumn(IsPrimaryKey = true, ColumnDescription = "ID")]
-        public override int ID { get; set; }
-
-        /// <summary>
-        /// 设备编号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "设备编号")]
-        public string DEVICECOD { get; set; }
-
-        /// <summary>
-        /// 设备详细信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, nameof(DEVICECOD))]
-        public WCS_DeviceInfo DEVICE { get; set; }
-
-        /// <summary>
-        /// 确认时间
-        /// </summary>
-        [SugarColumn(ColumnDescription = "确认时间")]
-        public DateTime FRAME { get; set; }
-
-        /// <summary>
-        /// 最后更新
-        /// </summary>
-        [SugarColumn(ColumnDescription = "最后更新")]
-        public bool ISLAST { get; set; }
-
-        /// <summary>
-        /// WCS版本号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "WCS版本号")]
-        public int WCSVERSION { get; set; }
-    }
-}

+ 32 - 32
WCS.Entity/WCS_PathGrp.cs

@@ -2,40 +2,40 @@
 
 namespace WCS.Entity
 {
-    /// <summary>
-    /// 设备路径头表
-    /// </summary>
-    [SugarTable(nameof(WCS_PathGrp), "设备路径头表")]
-    public class WCS_PathGrp : OBJ
-    {
-        /// <summary>
-        /// 起点地址编号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "起点")]
-        public string? StartCode { get; set; }
+    ///// <summary>
+    ///// 设备路径头表
+    ///// </summary>
+    //[SugarTable(nameof(WCS_PathGrp), "设备路径头表")]
+    //public class WCS_PathGrp : OBJ
+    //{
+    //    /// <summary>
+    //    /// 起点地址编号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "起点")]
+    //    public string? StartCode { get; set; }
 
-        /// <summary>
-        /// 起始点设备信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, "STARTCODE")]
-        public WCS_DeviceInfo? Start { get; set; }
+    //    /// <summary>
+    //    /// 起始点设备信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToOne, "STARTCODE")]
+    //    public WCS_DeviceInfo? Start { get; set; }
 
-        /// <summary>
-        /// 终点设备编号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "终点")]
-        public string? EndCode { get; set; }
+    //    /// <summary>
+    //    /// 终点设备编号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "终点")]
+    //    public string? EndCode { get; set; }
 
-        /// <summary>
-        /// 终点设备信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, "ENDCODE")]
-        public WCS_DeviceInfo? End { get; set; }
+    //    /// <summary>
+    //    /// 终点设备信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToOne, "ENDCODE")]
+    //    public WCS_DeviceInfo? End { get; set; }
 
-        /// <summary>
-        /// 路径
-        /// </summary>
-        [SugarColumn(ColumnDescription = "路径")]
-        public string? Path { get; set; }
-    }
+    //    /// <summary>
+    //    /// 路径
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "路径")]
+    //    public string? Path { get; set; }
+    //}
 }

+ 57 - 57
WCS.Entity/WCS_PathInfo.cs

@@ -2,70 +2,70 @@
 
 namespace WCS.Entity
 {
-    /// <summary>
-    /// 设备路径明细表
-    /// </summary>
-    [SugarTable(nameof(WCS_PathInfo), "设备路径明细表")]
-    public class WCS_PathInfo
-    {
-        /// <summary>
-        /// 起始地址设备号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "起始地址设备号")]
-        public string? StartCode { get; set; }
+    ///// <summary>
+    ///// 设备路径明细表
+    ///// </summary>
+    //[SugarTable(nameof(WCS_PathInfo), "设备路径明细表")]
+    //public class WCS_PathInfo
+    //{
+    //    /// <summary>
+    //    /// 起始地址设备号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "起始地址设备号")]
+    //    public string? StartCode { get; set; }
 
-        /// <summary>
-        /// 起点设备详细信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, nameof(StartCode))]
-        public WCS_DeviceInfo? Start { get; set; }
+    //    /// <summary>
+    //    /// 起点设备详细信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToOne, nameof(StartCode))]
+    //    public WCS_DeviceInfo? Start { get; set; }
 
-        /// <summary>
-        /// 终点地址设备号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "终点地址设备号")]
-        public string? EndCode { get; set; }
+    //    /// <summary>
+    //    /// 终点地址设备号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "终点地址设备号")]
+    //    public string? EndCode { get; set; }
 
-        /// <summary>
-        /// 终点设备详细信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, nameof(EndCode))]
-        public WCS_DeviceInfo? End { get; set; }
+    //    /// <summary>
+    //    /// 终点设备详细信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToOne, nameof(EndCode))]
+    //    public WCS_DeviceInfo? End { get; set; }
 
-        /// <summary>
-        /// 路径点设备号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "路径点设备号", IsNullable = true)]
-        public string? DeviceCode { get; set; }
+    //    /// <summary>
+    //    /// 路径点设备号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "路径点设备号", IsNullable = true)]
+    //    public string? DeviceCode { get; set; }
 
-        /// <summary>
-        /// 路径点详细信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, nameof(DeviceCode))]
-        public WCS_DeviceInfo? Device { get; set; }
+    //    /// <summary>
+    //    /// 路径点详细信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToOne, nameof(DeviceCode))]
+    //    public WCS_DeviceInfo? Device { get; set; }
 
-        /// <summary>
-        /// 前路径点设备号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "前路径点设备号")]
-        public string? PREVCODE { get; set; }
+    //    /// <summary>
+    //    /// 前路径点设备号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "前路径点设备号")]
+    //    public string? PREVCODE { get; set; }
 
-        /// <summary>
-        /// 前路径点详细信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, nameof(PREVCODE))]
-        public WCS_DeviceInfo? PREV { get; set; }
+    //    /// <summary>
+    //    /// 前路径点详细信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToOne, nameof(PREVCODE))]
+    //    public WCS_DeviceInfo? PREV { get; set; }
 
-        /// <summary>
-        /// 后路径点设备号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "后路径点设备号", IsNullable = true)]
-        public string? NEXTCODE { get; set; }
+    //    /// <summary>
+    //    /// 后路径点设备号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "后路径点设备号", IsNullable = true)]
+    //    public string? NEXTCODE { get; set; }
 
-        /// <summary>
-        /// 后路径点详细信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, nameof(NEXTCODE))]
-        public WCS_DeviceInfo? NEXT { get; set; }
-    }
+    //    /// <summary>
+    //    /// 后路径点详细信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToOne, nameof(NEXTCODE))]
+    //    public WCS_DeviceInfo? NEXT { get; set; }
+    //}
 }

+ 34 - 34
WCS.Entity/WCS_PlcData.cs

@@ -4,42 +4,42 @@ using System.ComponentModel.DataAnnotations.Schema;
 
 namespace WCS.Entity
 {
-    /// <summary>
-    /// 设备信息表
-    /// </summary>
-    [SugarTable(nameof(WCS_PlcData), "路径")]
-    public class WCS_PlcData
-    {
-        /// <summary>
-        /// ID
-        /// </summary>
-        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "ID")]
-        [Column(Order = 0)]
-        public virtual int ID { get; set; }
+    ///// <summary>
+    ///// 设备信息表
+    ///// </summary>
+    //[SugarTable(nameof(WCS_PlcData), "路径")]
+    //public class WCS_PlcData
+    //{
+    //    /// <summary>
+    //    /// ID
+    //    /// </summary>
+    //    [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "ID")]
+    //    [Column(Order = 0)]
+    //    public virtual int ID { get; set; }
 
-        /// <summary>
-        /// 仓库
-        /// </summary>
-        [SugarColumn(ColumnDescription = "仓库")]
-        public string WAREHOUSE { get; set; }
+    //    /// <summary>
+    //    /// 仓库
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "仓库")]
+    //    public string WAREHOUSE { get; set; }
 
-        /// <summary>
-        /// 内容
-        /// </summary>
-        [SugarColumn(ColumnDescription = "内容", ColumnDataType = "text")]
-        public string CONTENT { get; set; }
+    //    /// <summary>
+    //    /// 内容
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "内容", ColumnDataType = "text")]
+    //    public string CONTENT { get; set; }
 
-        /// <summary>
-        /// 创建用户
-        /// 仅记录用户ID
-        /// </summary>
-        [SugarColumn(ColumnDescription = "创建用户", Length = 50)]
-        public string AddWho { get; set; }
+    //    /// <summary>
+    //    /// 创建用户
+    //    /// 仅记录用户ID
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "创建用户", Length = 50)]
+    //    public string AddWho { get; set; }
 
-        /// <summary>
-        /// 创建时间
-        /// </summary>
-        [SugarColumn(ColumnDescription = "创建时间", InsertServerTime = true)]
-        public DateTime AddTime { get; set; }
-    }
+    //    /// <summary>
+    //    /// 创建时间
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "创建时间", InsertServerTime = true)]
+    //    public DateTime AddTime { get; set; }
+    //}
 }

+ 62 - 62
WCS.Entity/WCS_PlcDataBlock.cs

@@ -3,76 +3,76 @@ using System;
 
 namespace WCS.Entity
 {
-    /// <summary>
-    /// PLC DB块配置表
-    /// </summary>
-    [SugarTable(nameof(WCS_PlcDataBlock), "PLC DB块配置表")]
-    public class WCS_PlcDataBlock : OBJ
-    {
-        /// <summary>
-        /// ID
-        /// </summary>
-        [SugarColumn(IsIgnore = true)]
-        [Obsolete]
-        public override int ID { get; set; }
+    ///// <summary>
+    ///// PLC DB块配置表
+    ///// </summary>
+    //[SugarTable(nameof(WCS_PlcDataBlock), "PLC DB块配置表")]
+    //public class WCS_PlcDataBlock : OBJ
+    //{
+    //    /// <summary>
+    //    /// ID
+    //    /// </summary>
+    //    [SugarColumn(IsIgnore = true)]
+    //    [Obsolete]
+    //    public override int ID { get; set; }
 
-        /// <summary>
-        /// 编号
-        /// </summary>
-        [SugarColumn(IsPrimaryKey = true, Length = 20, ColumnDescription = "编号")]
-        public string Code { get; set; }
+    //    /// <summary>
+    //    /// 编号
+    //    /// </summary>
+    //    [SugarColumn(IsPrimaryKey = true, Length = 20, ColumnDescription = "编号")]
+    //    public string Code { get; set; }
 
-        /// <summary>
-        /// 名称
-        /// </summary>
-        [SugarColumn(Length = 20, ColumnDescription = "名称")]
-        public string Name { get; set; }
+    //    /// <summary>
+    //    /// 名称
+    //    /// </summary>
+    //    [SugarColumn(Length = 20, ColumnDescription = "名称")]
+    //    public string Name { get; set; }
 
-        /// <summary>
-        /// 关联PLC信息编号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "关联PLC信息编号")]
-        public string PlcCode { get; set; }
+    //    /// <summary>
+    //    /// 关联PLC信息编号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "关联PLC信息编号")]
+    //    public string PlcCode { get; set; }
 
-        /// <summary>
-        /// 关联PLC信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, nameof(PlcCode))]
-        public WCS_PlcSet PLC { get; set; }
+    //    /// <summary>
+    //    /// 关联PLC信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToOne, nameof(PlcCode))]
+    //    public WCS_PlcSet PLC { get; set; }
 
-        /// <summary>
-        /// 西门子:DB520,其它:D0
-        /// </summary>
-        [SugarColumn(ColumnDescription = "编号")]
-        public int NO { get; set; }
+    //    /// <summary>
+    //    /// 西门子:DB520,其它:D0
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "编号")]
+    //    public int NO { get; set; }
 
-        /// <summary>
-        /// 总长度
-        /// </summary>
-        [SugarColumn(ColumnDescription = "总长度")]
-        public int Length { get; set; }
+    //    /// <summary>
+    //    /// 总长度
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "总长度")]
+    //    public int Length { get; set; }
 
-        /// <summary>
-        /// 结构体长度
-        /// </summary>
-        [SugarColumn(ColumnDescription = "结构体长度")]
-        public int DataLength { get; set; }
+    //    /// <summary>
+    //    /// 结构体长度
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "结构体长度")]
+    //    public int DataLength { get; set; }
 
-        /// <summary>
-        /// 协议类型
-        /// </summary>
-        [SugarColumn(Length = 200, ColumnDescription = "协议类型")]
-        public string Protocol { get; set; }
+    //    /// <summary>
+    //    /// 协议类型
+    //    /// </summary>
+    //    [SugarColumn(Length = 200, ColumnDescription = "协议类型")]
+    //    public string Protocol { get; set; }
 
-        /// <summary>
-        /// 无更新
-        /// </summary>
-        [SugarColumn(ColumnDescription = "无更新")]
-        public bool NoUpDate { get; set; }
+    //    /// <summary>
+    //    /// 无更新
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "无更新")]
+    //    public bool NoUpDate { get; set; }
 
-        public Type GetProtocolType()
-        {
-            return Type.GetType(Protocol);
-        }
-    }
+    //    public Type GetProtocolType()
+    //    {
+    //        return Type.GetType(Protocol);
+    //    }
+    //}
 }

+ 140 - 140
WCS.Entity/WCS_PlcSet.cs

@@ -4,144 +4,144 @@ using System.ComponentModel;
 
 namespace WCS.Entity
 {
-    /// <summary>
-    /// WCS_PLC
-    /// </summary>
-    [SugarTable(nameof(WCS_PlcSet), "PLC信息")]
-    public class WCS_PlcSet : OBJ
-    {
-        [SugarColumn(IsIgnore = true)]
-        [Obsolete]
-        public override int ID { get; set; }
-
-        /// <summary>
-        /// 编号
-        /// </summary>
-        [SugarColumn(IsPrimaryKey = true, ColumnDescription = "编号", Length = 20)]
-        public string Code { get; set; }
-
-        /// <summary>
-        /// 名称
-        /// </summary>
-        [SugarColumn(ColumnDescription = "名称", Length = 20)]
-        public string Name { get; set; }
-
-        /// <summary>
-        /// IP
-        /// </summary>
-        [SugarColumn(ColumnDescription = "IP", Length = 20)]
-        public string IP { get; set; }
-
-        /// <summary>
-        /// 端口
-        /// </summary>
-        [SugarColumn(ColumnDescription = "端口")]
-        public int Port { get; set; } = 102;
-
-        /// <summary>
-        /// 插槽号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "插槽号")]
-        public int Slot { get; set; }
-
-        /// <summary>
-        /// 机架号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "机架号")]
-        public int Rack { get; set; }
-
-        /// <summary>
-        /// 厂商
-        /// </summary>
-        [SugarColumn(ColumnDescription = "厂商")]
-        public PLCType Type { get; set; }
-
-        /// <summary>
-        /// 型号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "型号")]
-        public PLCMODEL Model { get; set; }
-    }
-
-    /// <summary>
-    /// 设备厂商
-    /// </summary>
-    public enum PLCType
-    {
-        /// <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,
-    }
-
-    /// <summary>
-    /// PLC型号
-    /// </summary>
-    public enum PLCMODEL
-    {
-        #region 西门子
-
-        /// <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 西门子
-    }
+    ///// <summary>
+    ///// WCS_PLC
+    ///// </summary>
+    //[SugarTable(nameof(WCS_PlcSet), "PLC信息")]
+    //public class WCS_PlcSet : OBJ
+    //{
+    //    [SugarColumn(IsIgnore = true)]
+    //    [Obsolete]
+    //    public override int ID { get; set; }
+
+    //    /// <summary>
+    //    /// 编号
+    //    /// </summary>
+    //    [SugarColumn(IsPrimaryKey = true, ColumnDescription = "编号", Length = 20)]
+    //    public string Code { get; set; }
+
+    //    /// <summary>
+    //    /// 名称
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "名称", Length = 20)]
+    //    public string Name { get; set; }
+
+    //    /// <summary>
+    //    /// IP
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "IP", Length = 20)]
+    //    public string IP { get; set; }
+
+    //    /// <summary>
+    //    /// 端口
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "端口")]
+    //    public int Port { get; set; } = 102;
+
+    //    /// <summary>
+    //    /// 插槽号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "插槽号")]
+    //    public int Slot { get; set; }
+
+    //    /// <summary>
+    //    /// 机架号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "机架号")]
+    //    public int Rack { get; set; }
+
+    //    /// <summary>
+    //    /// 厂商
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "厂商")]
+    //    public PLCType Type { get; set; }
+
+    //    /// <summary>
+    //    /// 型号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "型号")]
+    //    public PLCMODEL Model { get; set; }
+    //}
+
+    ///// <summary>
+    ///// 设备厂商
+    ///// </summary>
+    //public enum PLCType
+    //{
+    //    /// <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,
+    //}
+
+    ///// <summary>
+    ///// PLC型号
+    ///// </summary>
+    //public enum PLCMODEL
+    //{
+    //    #region 西门子
+
+    //    /// <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 西门子
+    //}
 }

+ 27 - 27
WCS.Entity/WCS_ROUTE.cs

@@ -2,34 +2,34 @@
 
 namespace WCS.Entity
 {
-    /// <summary>
-    /// 设备路由表
-    /// </summary>
-    [SugarTable(nameof(WCS_Route), "设备路由表")]
-    public class WCS_Route : OBJ
-    {
-        /// <summary>
-        /// 设备编号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "设备编号")]
-        public string DeviceCode { get; set; }
+    ///// <summary>
+    ///// 设备路由表
+    ///// </summary>
+    //[SugarTable(nameof(WCS_Route), "设备路由表")]
+    //public class WCS_Route : OBJ
+    //{
+    //    /// <summary>
+    //    /// 设备编号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "设备编号")]
+    //    public string DeviceCode { get; set; }
 
-        /// <summary>
-        /// 所属设备信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, nameof(DeviceCode))]
-        public WCS_DeviceInfo Device { get; set; }
+    //    /// <summary>
+    //    /// 所属设备信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToOne, nameof(DeviceCode))]
+    //    public WCS_DeviceInfo Device { get; set; }
 
-        /// <summary>
-        /// 下一个设备的编号
-        /// </summary>
-        [SugarColumn(ColumnDescription = "下一个设备的编号")]
-        public string NextCode { get; set; }
+    //    /// <summary>
+    //    /// 下一个设备的编号
+    //    /// </summary>
+    //    [SugarColumn(ColumnDescription = "下一个设备的编号")]
+    //    public string NextCode { get; set; }
 
-        /// <summary>
-        /// 下一个设备的信息
-        /// </summary>
-        [Navigate(NavigateType.OneToOne, "NEXTCODE")]
-        public WCS_DeviceInfo Next { get; set; }
-    }
+    //    /// <summary>
+    //    /// 下一个设备的信息
+    //    /// </summary>
+    //    [Navigate(NavigateType.OneToOne, "NEXTCODE")]
+    //    public WCS_DeviceInfo Next { get; set; }
+    //}
 }

+ 1 - 63
WCS.Service/Worker.cs

@@ -140,16 +140,7 @@ namespace WCS.Service
 
             #region 初始化设备信息
 
-            SqlSugarHelper.Do(db =>
-            {
-                ServiceHub.deviceInfos = db.Default.Queryable<WCS_DeviceInfo>()
-                                                   .Includes(v => v.NextRoutes)
-                                                   .Includes(v => v.FormerRoutes)
-                                                   .Includes(v => v.Paths)
-                                                   .Includes(v => v.DeviceGroup)
-                                                   .Includes(v => v.DeviceProtocol)
-                                                   .ToList();
-            });
+            WorkStart.InitializeDeviceInfo();
 
             #endregion 初始化设备信息
 
@@ -189,23 +180,6 @@ namespace WCS.Service
             Configs.PLCAccessorCreater = new PLCAccessors.PLCAccessorsCreater();
             try
             {
-                SqlSugarHelper.Do(db =>
-                {
-                    var _db = db.Connect;
-                    //获取所有DB块读写协议
-                    var dbProtocols = _db.Queryable<WCS_DeviceProt>().Includes(v => v.DB, p => p.PLC).ToList();
-                    foreach (var dbProtocol in dbProtocols)
-                    {
-                        Add(Type.GetType(dbProtocol.DB.Protocol), dbProtocol.DeviceCode, dbProtocol.Position, dbProtocol.DB, dbProtocol.DB.PLC);
-                    }
-                });
-
-                #region 初始化业务工程中的配置
-
-                WorkConfigHub.Init();
-
-                #endregion 初始化业务工程中的配置
-
                 #region 唤醒所有的世界
 
                 World.StartAll();
@@ -230,41 +204,5 @@ namespace WCS.Service
 
             #endregion 初始化PLC访问器及PLC读取协议
         }
-
-        /// <summary>
-        ///  添加协议
-        /// </summary>
-        /// <param name="type">协议类型</param>
-        /// <param name="code">设备号</param>
-        /// <param name="position">地址</param>
-        /// <param name="db">db</param>
-        /// <param name="plc">PLC</param>
-        public static void Add(Type type, string code, int position, WCS_PlcDataBlock db, WCS_PlcSet plc)
-        {
-            var info = new ProtocolInfo
-            {
-                Position = position,
-                DBInfo = new DBInfo
-                {
-                    No = (ushort)db.NO,
-                    PLCInfo = new PLCInfo
-                    {
-                        IP = plc.IP,
-                        Port = plc.Port,
-                        Rack = plc.Rack,
-                        Slot = plc.Slot,
-                        Type = Core.PLCType.Siemens
-                    }
-                }
-            };
-            try
-            {
-                Protocols.Add(type, code, info);
-            }
-            catch (Exception ex)
-            {
-                var a = ex;
-            }
-        }
     }
 }

+ 0 - 0
WCS.Entity.Protocol/DataStructure/DeviceData.cs → WCS.WorkEngineering/DataStructure/DeviceData.cs


+ 0 - 0
WCS.Entity.Protocol/DataStructure/DeviceDataCollection.cs → WCS.WorkEngineering/DataStructure/DeviceDataCollection.cs


+ 0 - 0
WCS.Entity.Protocol/DataStructure/DeviceDataPack.cs → WCS.WorkEngineering/DataStructure/DeviceDataPack.cs


+ 0 - 0
WCS.Entity.Protocol/DataStructure/ProdLineData.cs → WCS.WorkEngineering/DataStructure/ProdLineData.cs


+ 0 - 0
WCS.Entity.Protocol/DataStructure/RGVData.cs → WCS.WorkEngineering/DataStructure/RGVData.cs


+ 0 - 0
WCS.Entity.Protocol/DataStructure/RobotData.cs → WCS.WorkEngineering/DataStructure/RobotData.cs


+ 0 - 0
WCS.Entity.Protocol/DataStructure/SRMData.cs → WCS.WorkEngineering/DataStructure/SRMData.cs


+ 0 - 0
WCS.Entity.Protocol/DataStructure/StationData.cs → WCS.WorkEngineering/DataStructure/StationData.cs


+ 1 - 1
WCS.WorkEngineering/Extensions/BCRExtension.cs

@@ -14,7 +14,7 @@ namespace WCS.WorkEngineering.Extensions
         ///  BCR扩展
         /// </summary>
         /// <param name="device"></param>
-        public BCR(Device device) : base(device)
+        public BCR(Device device, World world) : base(device, world)
         {
         }
 

+ 125 - 137
WCS.WorkEngineering/Extensions/DeviceExtension.cs

@@ -1,7 +1,5 @@
-using System.Collections.Concurrent;
-using WCS.Core;
-using WCS.Entity;
-using WCS.Entity.Protocol.Station;
+using WCS.Core;
+using PLCType = WCS.Core.PLCType;
 
 namespace WCS.WorkEngineering.Extensions
 {
@@ -12,196 +10,186 @@ namespace WCS.WorkEngineering.Extensions
     {
         #region 设备类型
 
-        /// <summary>
-        ///  是否是输送线
-        /// </summary>
-        /// <param name="source">设备信息</param>
-        /// <returns></returns>
-        public static bool IsConv(this Device source)
-        {
-            return source.HasProtocol(typeof(IStation521)) || source.HasProtocol(typeof(IStation520)) || source.HasProtocol(typeof(IStation523));
-        }
-
         /// <summary>
         ///  是否是巷道
         /// </summary>
         /// <param name="source">设备信息</param>
         /// <returns></returns>
-        public static bool IsTunnel(this WCS_DeviceInfo source)
+        public static bool IsTunnel(this Device source)
         {
-            return source.Code.Contains("TY");
+            return source.HasFlag(DeviceFlags.巷道);
         }
 
-        /// <summary>
-        ///  是否是BCR
-        /// </summary>
-        /// <param name="source">设备信息</param>
-        /// <returns></returns>
-        public static bool IsBCR(this Device source)
+        #endregion 设备类型
+
+        #region 协议操作扩展
+
+        public static void AddProtocol<T>(this Device device, int position, ushort db, string ip)
         {
-            return source.Code.Contains("BCR");
+            var info = new ProtocolInfo
+            {
+                Position = position,
+                DBInfo = new DBInfo
+                {
+                    No = db,
+                    PLCInfo = new PLCInfo
+                    {
+                        IP = ip,
+                        Port = 102,
+                        Rack = 0,
+                        Slot = 1,
+                        Type = PLCType.Siemens
+                    }
+                }
+            };
+            device.AddProtocol<T>(info);
         }
 
-        #endregion 设备类型
+        #endregion 协议操作扩展
+    }
+
+    /// <summary>
+    ///  设备标签
+    /// </summary>
+    [Flags]
+    public enum DeviceFlags
+    {
+        扫码 = 1 << 0,
+        称重 = 1 << 1,
+        外检 = 1 << 2,
+
+        顶升 = 1 << 3,
+        移栽 = 1 << 4,
+        旋转 = 1 << 5,
 
+        入库 = 1 << 6,
+        出库 = 1 << 7,
+
+        巷道口 = 1 << 8,
+        RGV口 = 1 << 9,
+        AGV口 = 1 << 10,
+
+        直轨 = 1 << 11,
+        弯轨 = 1 << 12,
+        环轨 = 1 << 13,
+
+        巷道 = 1 << 14,
+        堆垛机 = 1 << 15,
+        输送机 = 1 << 16,
+    }
+
+    /// <summary>
+    /// 输送机段信息
+    /// </summary>
+    public class StationSegmentInfo
+    {
         /// <summary>
-        ///  获取下一个地址
+        ///  构造函数
         /// </summary>
-        /// <param name="source">设备信息</param>
-        /// <param name="addto">目标地址</param>
-        /// <returns></returns>
-        public static string GetNextAdd(this WCS_DeviceInfo source, string addto)
+        /// <param name="start">起始设备号</param>
+        /// <param name="end">结束设备号</param>
+        /// <param name="ip">ip</param>
+        public StationSegmentInfo(int start, int end, string ip)
         {
-            var path = source.Paths.First(p => p.EndCode == addto).Path;
-            return path.Split('-')[0];
+            Start = start;
+            End = end;
+            IP = ip;
         }
 
         /// <summary>
-        ///  获取到达目标地址需要的路径信息
+        /// 起始设备编号
         /// </summary>
-        /// <param name="source">设备信息</param>
-        /// <param name="addto">目标地址</param>
-        /// <returns></returns>
-        public static string GetAddtoPath(this WCS_DeviceInfo source, string addto)
-        {
-            return source.Paths.First(p => p.EndCode == addto).Path;
-        }
-
-        #region WCS_DEVICE扩展数据
+        public int Start { get; set; }
 
         /// <summary>
-        ///  设备标识字典
+        ///结束设备编号
         /// </summary>
-        private static ConcurrentDictionary<string, object> DeviceValues = new ConcurrentDictionary<string, object>();
+        public int End { get; set; }
 
         /// <summary>
-        /// 添加设备标识
+        ///  输送机段所属IP
         /// </summary>
-        /// <param name="source">设备信息</param>
-        /// <param name="flag">标识</param>
-        public static void AddFlag(this Device source, DF flag)
-        {
-            var df = source.Get<DF>("DeviceFlag");
-            df = df | flag;
-            source.Set("DeviceFlag", df);
-        }
+        public string IP { get; set; }
+    }
 
+    /// <summary>
+    ///  扫码器信息
+    /// </summary>
+    public class BcrInfo
+    {
         /// <summary>
-        ///  当前设备是否包含标识
+        ///  构造函数
         /// </summary>
-        /// <param name="source">设备信息</param>
-        /// <param name="flag">标识</param>
-        /// <returns></returns>
-        public static bool Is(this Device source, DF flag)
+        /// <param name="deviceNo">设备编号</param>
+        /// <param name="ip">ip</param>
+        public BcrInfo(int[] deviceNo, string ip)
         {
-            var df = source.Get<DF>("DeviceFlag");
-            return (df & flag) == flag;
+            DeviceNo = deviceNo;
+            IP = ip;
         }
 
         /// <summary>
-        ///  为设备写入标识
+        ///  设备编号
         /// </summary>
-        /// <typeparam name="T">写入值类型</typeparam>
-        /// <param name="source">设备信息</param>
-        /// <param name="key">标识类型</param>
-        /// <param name="value">写入值</param>
-        public static void Set<T>(this Device source, string key, T value)
-        {
-            DeviceValues[source.Code + key] = value;
-        }
+        public int[] DeviceNo { get; set; }
 
         /// <summary>
-        ///  获取设备标识
+        ///  ip
         /// </summary>
-        /// <typeparam name="T">写入值类型</typeparam>
-        /// <param name="source">设备信息</param>
-        /// <param name="key">标识类型</param>
-        /// <returns></returns>
-        public static T Get<T>(this Device source, string key)
-        {
-            if (!DeviceValues.ContainsKey(source.Code + key))
-                return default(T);
-            return (T)DeviceValues[source.Code + key];
-        }
+        public string IP { get; set; }
+    }
 
+    /// <summary>
+    ///  外形信息
+    /// </summary>
+    public class ShapeInfo
+    {
         /// <summary>
-        ///  获取short类型的设备号
+        ///  构造函数
         /// </summary>
-        /// <param name="source">设备信息</param>
-        /// <returns></returns>
-        public static short Code(this Device source)
+        /// <param name="deviceNo">设备编号</param>
+        /// <param name="ip">ip</param>
+        public ShapeInfo(int[] deviceNo, string ip)
         {
-            return short.Parse(source.Code);
+            DeviceNo = deviceNo;
+            IP = ip;
         }
 
         /// <summary>
-        ///  获取巷道
+        ///  设备编号
         /// </summary>
-        /// <param name="source">设备信息</param>
-        /// <returns>返回巷道Code</returns>
-        public static string Tunnel(this Device source)
-        {
-            return source.Get<string>("Tunnel");
-        }
+        public int[] DeviceNo { get; set; }
 
         /// <summary>
-        ///  获取巷道号
+        ///  ip
         /// </summary>
-        /// <param name="source">设备信息</param>
-        /// <returns>返回巷道号</returns>
-        public static int TunnelNum(this Device source)
-        {
-            return int.Parse(source.Tunnel().Last().ToString());
-        }
+        public string IP { get; set; }
+    }
 
+    /// <summary>
+    /// 路径信息
+    /// </summary>
+    public class RouteInfo
+    {
         /// <summary>
-        ///  获取设备楼层信息
+        ///  构造函数
         /// </summary>
-        /// <param name="source">设备信息</param>
-        /// <returns></returns>
-        public static int Floor(this Device source)
+        /// <param name="deviceCode">起始点设备号</param>
+        /// <param name="nextList">下一个设备集合</param>
+        public RouteInfo(string deviceCode, string[] nextList)
         {
-            return source.Get<int>("Floor");
+            DeviceCode = deviceCode;
+            NextList = nextList;
         }
 
         /// <summary>
-        ///  获取堆垛机
+        ///  设备号
         /// </summary>
-        /// <param name="source">设备信息</param>
-        /// <returns></returns>
-        public static Device SRM(this Device source)
-        {
-            return source.Get<Device>("SRM");
-        }
+        public string DeviceCode { get; set; }
 
         /// <summary>
-        ///  获取RGV
+        ///  下一个设备
         /// </summary>
-        /// <param name="source">设备信息</param>
-        /// <returns></returns>
-        public static Device RGV(this Device source)
-        {
-            return source.Get<Device>("RGV");
-        }
-
-        //public static void AddFlag(DF flag, params string[] devices)
-        //{
-        //    var arr = LogicHandler.AllObjects.OfType<WCS_DEVICE>().Where(v => devices.Contains(v.CODE)).ToArray();
-        //    Parallel.ForEach(arr, v =>
-        //    {
-        //        v.AddFlag(flag);
-        //    });
-        //}
-
-        #endregion WCS_DEVICE扩展数据
-    }
-
-    /// <summary>
-    /// 设备配置
-    /// </summary>
-    [Flags]
-    public enum DF
-    {
-        无 = 0,
+        public string[] NextList { get; set; }
     }
 }

+ 2 - 9
WCS.WorkEngineering/Extensions/SRMExtension.cs

@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using WCS.Core;
+using WCS.Core;
 using WCS.Entity.Protocol.SRM;
 
 namespace WCS.WorkEngineering.Extensions
@@ -13,10 +8,8 @@ namespace WCS.WorkEngineering.Extensions
     /// </summary>
     public class SRM : Device<ISRM520, ISRM521, ISRM523>
     {
-        public SRM(Device device) : base(device)
+        public SRM(Device device, World world) : base(device, world)
         {
         }
     }
-
-
 }

+ 1 - 1
WCS.WorkEngineering/Extensions/StationExtension.cs

@@ -7,7 +7,7 @@ namespace WCS.WorkEngineering.Extensions
 {
     public class Station : Device<IStation520, IStation521, IStation523>
     {
-        public Station(Device device) : base(device)
+        public Station(Device device, World world) : base(device, world)
         {
         }
 

+ 2 - 3
WCS.Service/ProtocolProxy.cs → WCS.WorkEngineering/ProtocolProxy.cs

@@ -5,14 +5,13 @@ namespace WCS.Service
 {
     public class ProtocolProxy : ProtocolProxyBase
     {
-        public ProtocolProxy(Device dev, ProtocolInfo info, Type protocolType) : base(dev, info, protocolType)
+        public ProtocolProxy(Device dev, ProtocolInfo info, Type protocolType, World world) : base(dev, info, protocolType, world)
         {
-           
         }
 
         protected override void DataChanged()
         {
-            //Console.WriteLine($"{Device.Code} Changed");
+            Console.WriteLine($"{Device.Code} Changed");
         }
     }
 }

+ 1 - 1
WCS.WorkEngineering/Systems/DataCollectionSysyem.cs

@@ -22,7 +22,7 @@ namespace WCS.Service.Systems
 
         public DataCollectionSysyem()
         {
-            ConvList = World.Devices.Where(v => v.IsConv()).Select(v => new Station(v)).ToList();
+            ConvList = Device.All.Where(v => v.IsConv()).Select(v => new Station(v, this.World)).ToList();
         }
 
         protected override bool Do(bool obj)

+ 22 - 20
WCS.WorkEngineering/Systems/SrmSystems.cs

@@ -10,6 +10,7 @@ using WCS.WorkEngineering.Extensions;
 using WCS.WorkEngineering.WebApi.Controllers;
 using WCS.WorkEngineering.Worlds;
 using WCS.WorkEngineering.Worlds.Logs;
+using DeviceFlags = WCS.WorkEngineering.Extensions.DeviceFlags;
 using KnownException = WCS.WorkEngineering.Worlds.Logs.KnownException;
 using TaskStatus = WCS.Entity.TaskStatus;
 
@@ -34,18 +35,19 @@ namespace WCS.WorkEngineering.Systems
 
         public SrmSystems()
         {
+            var devices = Device.All.Where(v => v.HasFlag(DeviceFlags.巷道口));
+            PickUpDevices = devices.Where(v => v.HasFlag(DeviceFlags.入库)).Select(v => new Station(v, this.World)).ToList();
             //获取所有的巷道集合
-            var devices = ServiceHub.deviceInfos.Where(x => x.IsTunnel());
 
             //开始分配
             foreach (var item in devices)
             {
                 //取货设备
-                var deviceCode = item.FormerRoutes.Select(v => v.DeviceCode).ToList();
-                PickUpDevices.Add(item.NextRoutes.First().DeviceCode, World.Devices.Where(v => deviceCode.Contains(v.Code)).Select(v => new Station(v)).ToList());
+                var deviceCode = item;
+                PickUpDevices.Add(item.NextRoutes.First().DeviceCode, Device.All.Where(v => deviceCode.Contains(v.Code)).Select(v => new Station(v, this.World)).ToList());
                 //放货设备
                 deviceCode = ServiceHub.deviceInfos.First(x => item.NextRoutes.First().DeviceCode == x.Code).NextRoutes.Select(v => v.NextCode).ToList();
-                PutDevices.Add(item.NextRoutes.First().DeviceCode, World.Devices.Where(v => deviceCode.Contains(v.Code)).Select(v => new Station(v)).ToList());
+                PutDevices.Add(item.NextRoutes.First().DeviceCode, Device.All.Where(v => deviceCode.Contains(v.Code)).Select(v => new Station(v, this.World)).ToList());
             }
         }
 
@@ -165,12 +167,12 @@ namespace WCS.WorkEngineering.Systems
                 var addrTo = taskInfo.AddrTo.Split("-");
                 //下发任务
                 obj.Data.TaskNumber = taskInfo.ID;
-                obj.Data.RowPos1 = addrFrom[0].ToShort();
-                obj.Data.TravelPos1 = addrFrom[1].ToShort();
-                obj.Data.LiftPos1 = addrFrom[2].ToShort();
-                obj.Data.RowPos2 = addrTo[0].ToShort();
-                obj.Data.TravelPos2 = addrTo[1].ToShort();
-                obj.Data.LiftPos2 = addrTo[2].ToShort();
+                obj.Data.SLine = addrFrom[0].ToShort();
+                obj.Data.SCol = addrFrom[1].ToShort();
+                obj.Data.SLayer = addrFrom[2].ToShort();
+                obj.Data.ELine = addrTo[0].ToShort();
+                obj.Data.ECol = addrTo[1].ToShort();
+                obj.Data.ELayer = addrTo[2].ToShort();
                 obj.Data.VoucherNo++;
             }
 
@@ -179,7 +181,7 @@ namespace WCS.WorkEngineering.Systems
             #region 出入库
 
             //上一个周期是不是出库任务 第一次获取返回结果会是false
-            var lastIsOut = obj.Entity.Get<bool>("LastIsOut");
+            var lastIsOut = obj.Entity.GetFlag("LastIsOut").ToInt();
             obj.Entity.Set("LastIsOut", !lastIsOut);
 
             //入库任务优先 或 上一个周期是出库任务并且出库任务无优先
@@ -223,10 +225,10 @@ namespace WCS.WorkEngineering.Systems
                 var addrTo = taskInfo.AddrTo.Split("-");
                 //下发任务
                 obj.Data.TaskNumber = taskInfo.ID;
-                obj.Data.RowPos1 = station.Entity.Code.ToShort();
-                obj.Data.RowPos2 = addrTo[0].ToShort();
-                obj.Data.TravelPos2 = addrTo[1].ToShort();
-                obj.Data.LiftPos2 = addrTo[2].ToShort();
+                obj.Data.SLine = station.Entity.Code.ToShort();
+                obj.Data.ELine = addrTo[0].ToShort();
+                obj.Data.ECol = addrTo[1].ToShort();
+                obj.Data.ELayer = addrTo[2].ToShort();
                 obj.Data.VoucherNo++;
             }
             else if (enterOrOut == 3 || !lastIsOut) //出库任务
@@ -271,11 +273,11 @@ namespace WCS.WorkEngineering.Systems
                 });
 
                 obj.Data.TaskNumber = taskInfo.ID;
-                obj.Data.RowPos1 = addrFrom[0].ToShort();
-                obj.Data.TravelPos1 = addrFrom[1].ToShort();
-                obj.Data.LiftPos1 = addrFrom[2].ToShort();
-                obj.Data.RowPos2 = taskInfo.SrmStation.ToShort();
-                obj.Data.TravelPos2 = taskInfo.AddrNext.ToShort();
+                obj.Data.SLine = addrFrom[0].ToShort();
+                obj.Data.SCol = addrFrom[1].ToShort();
+                obj.Data.SLayer = addrFrom[2].ToShort();
+                obj.Data.ELine = taskInfo.SrmStation.ToShort();
+                obj.Data.ECol = taskInfo.AddrNext.ToShort();
                 obj.Data.VoucherNo++;
             }
 

+ 1 - 1
WCS.WorkEngineering/Systems/StorageSysyem.cs

@@ -21,7 +21,7 @@ namespace WCS.WorkEngineering.Systems
 
         public StorageSysyem()
         {
-            BCRS = World.Devices.Where(v => v.IsBCR()).Select(v => new BCR(v)).ToList() as BCRList;
+            BCRS = Device.All.Where(v => v.IsBCR()).Select(v => new BCR(v, World)).ToList() as BCRList;
         }
 
         public override void Do(Station obj)

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

@@ -8,11 +8,7 @@
 
   <ItemGroup>
     <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.5" />
-    <PackageReference Include="ServiceCenter" Version="1.0.1.9" />
-  </ItemGroup>
-
-  <ItemGroup>
-    <ProjectReference Include="..\WCS.Entity.Protocol\WCS.Entity.Protocol.csproj" />
+    <PackageReference Include="ServiceCenter" Version="1.0.1.13" />
   </ItemGroup>
 
 </Project>

+ 0 - 16
WCS.WorkEngineering/WorkConfigHub.cs

@@ -1,16 +0,0 @@
-namespace WCS.WorkEngineering
-{
-    /// <summary>
-    /// 业务工程配置信息
-    /// </summary>
-    public static class WorkConfigHub
-    {
-        /// <summary>
-        ///  初始化业务工程
-        /// </summary>
-
-        public static void Init()
-        {
-        }
-    }
-}

+ 130 - 0
WCS.WorkEngineering/WorkStart.cs

@@ -0,0 +1,130 @@
+using PlcSiemens.Core.Extension;
+using WCS.Core;
+using WCS.Entity.Protocol.BCR;
+using WCS.Entity.Protocol.SRM;
+using WCS.Entity.Protocol.Station;
+using WCS.WorkEngineering.Extensions;
+using DeviceFlags = WCS.WorkEngineering.Extensions.DeviceFlags;
+
+namespace WCS.WorkEngineering
+{
+    /// <summary>
+    /// 业务工程配置信息
+    /// </summary>
+    public static class WorkStart
+    {
+        /// <summary>
+        ///  初始化 设备信息
+        /// </summary>
+
+        public static void InitializeDeviceInfo()
+        {
+            #region 初始化输送机相关信息
+
+            #region 基本信息
+
+            List<StationSegmentInfo> segmentInfo = new List<StationSegmentInfo>();
+            segmentInfo.Add(new StationSegmentInfo(1011, 1026, "10.30.36.51"));
+
+            foreach (var item in segmentInfo)
+            {
+                for (int i = item.Start; i < item.End; i++)
+                {
+                    var conv = new Device(i.ToString());
+                    conv.AddFlag(DeviceFlags.输送机);
+                    conv.AddProtocol<IStation520>((i - item.Start) * 14, 520, item.IP);
+                    conv.AddProtocol<IStation521>((i - item.Start) * 16, 521, item.IP);
+                    conv.AddProtocol<IStation523>((i - item.Start) * 14, 523, item.IP);
+                }
+            }
+
+            #endregion 基本信息
+
+            #region 扫码器
+
+            List<BcrInfo> bcrInfo = new List<BcrInfo>();
+            bcrInfo.Add(new BcrInfo(new int[] { 1011, 1013, 1015, 1022, 1024, 1026 }, "10.30.36.51"));
+
+            foreach (var item in bcrInfo)
+            {
+                for (int i = 0; i < item.DeviceNo.Length; i++)
+                {
+                    var conv = new Device("BCR" + item.DeviceNo[i]);
+                    conv.AddFlag(DeviceFlags.扫码);
+                    int pos = i * 14;
+                    conv.AddProtocol<IBCR80>(pos, 80, item.IP);
+                    conv.AddProtocol<IBCR81>(pos, 81, item.IP);
+                }
+            }
+
+            #endregion 扫码器
+
+            #region 外检信息
+
+            List<ShapeInfo> shapeInfo = new List<ShapeInfo>();
+            shapeInfo.Add(new ShapeInfo(new int[] { 1012, 1014, 1016, 1025 }, "10.30.36.51"));
+
+            foreach (var item in shapeInfo)
+            {
+                for (int i = 0; i < item.DeviceNo.Length; i++)
+                {
+                    var conv = Device.All.FirstOrDefault(x => x.Code == item.DeviceNo[i].ToString());
+                    conv.AddFlag(DeviceFlags.称重);
+                    int pos = i * 14;
+                    conv.AddProtocol<IStation91>(pos, 91, item.IP);
+                }
+            }
+
+            #endregion 外检信息
+
+            #endregion 初始化输送机相关信息
+
+            #region 初始化堆垛机相关信息
+
+            for (int i = 1; i <= 3; i++)
+            {
+                var srm = new Device($"SRM{i}");
+                srm.AddFlag(DeviceFlags.堆垛机);
+
+                //三台堆垛机IP主机位分别是 21 31 41
+                srm.AddProtocol<ISRM520>(0, 520, $"10.30.36.{(i * 10) + 10 + 1}");
+                srm.AddProtocol<ISRM521>(0, 521, $"10.30.36.{(i * 10) + 10 + 1}");
+                srm.AddProtocol<ISRM523>(0, 523, $"10.30.36.{(i * 10) + 10 + 1}");
+
+                //增加巷道
+                var tunnel = new Device($"TY{i}");
+                tunnel.AddFlag(DeviceFlags.巷道);
+            }
+
+            #endregion 初始化堆垛机相关信息
+
+            #region 配置路径信息
+
+            List<RouteInfo> routeInfos = new List<RouteInfo>();
+            routeInfos.Add(new RouteInfo("SRM1", new string[] { "TY1" }));
+            routeInfos.Add(new RouteInfo("SRM2", new string[] { "TY2" }));
+            routeInfos.Add(new RouteInfo("SRM3", new string[] { "TY3" }));
+
+            #endregion 配置路径信息
+
+            #region 标签配置
+
+            Dictionary<DeviceFlags, List<string>> devices = new Dictionary<DeviceFlags, List<string>>();
+
+            devices.Add(DeviceFlags.巷道口, new List<string>() { "1011", "1012", "1013", "1014", "1015", "1016", "1021", "1022", "1023", "1024", "1025", "1026" });
+            devices.Add(DeviceFlags.入库, new List<string>() { "1011", "1013", "1015", "1022", "1024", "1026" });
+            devices.Add(DeviceFlags.出库, new List<string>() { "1012", "1014", "1016", "1021", "1023", "1025", });
+
+            devices.ForEach(item =>
+            {
+                item.Value.ForEach(code =>
+                {
+                    var device = Device.All.FirstOrDefault(v => v.Code == code);
+                    device.AddFlag(item.Key);
+                });
+            });
+
+            #endregion 标签配置
+        }
+    }
+}

+ 1 - 1
WcsFramework.sln

@@ -78,7 +78,7 @@ Global
 		{A869A35B-8811-4660-90E8-A143D168D894} = {C783651F-7EB6-40BA-8E68-525F93B8FCED}
 		{99AB1CD4-1242-4A1B-AE90-ADD7674848B2} = {C783651F-7EB6-40BA-8E68-525F93B8FCED}
 		{1E0F2030-48C6-4C09-8D4D-0C7F02761C3B} = {FD3B782A-4A24-458C-B77F-6F46106AE2B4}
-		{B87B1360-D8D2-4416-83BE-C6BC27679EA3} = {FD3B782A-4A24-458C-B77F-6F46106AE2B4}
+		{B87B1360-D8D2-4416-83BE-C6BC27679EA3} = {C783651F-7EB6-40BA-8E68-525F93B8FCED}
 		{4678DE65-23AD-4907-B752-E7F1F99195BA} = {C783651F-7EB6-40BA-8E68-525F93B8FCED}
 		{977B3F9A-1CB4-4CF2-A0A2-B95A6011933A} = {C783651F-7EB6-40BA-8E68-525F93B8FCED}
 		{DB454F36-DE7B-4A9B-9A8B-8E2C3C4F81B7} = {C783651F-7EB6-40BA-8E68-525F93B8FCED}