林豪 左 1 tahun lalu
induk
melakukan
77f80368ba

+ 2 - 2
ServiceCenter/ServiceCenter.csproj

@@ -11,8 +11,8 @@
     <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.8" />
-    <PackageReference Include="WCS.Entity" Version="1.0.1.6" />
-    <PackageReference Include="WCS.Entity.Protocol" Version="1.0.0.5" />
+    <PackageReference Include="WCS.Entity" Version="1.0.1.7" />
+    <PackageReference Include="WCS.Entity.Protocol" Version="1.0.0.6" />
   </ItemGroup>
 
 </Project>

+ 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; }
+    }
 }

+ 31 - 31
WCS.Service/Worker.cs

@@ -97,15 +97,15 @@ namespace WCS.Service
                     {
                         case "WCSDB"://WCS基本数据库
                             SqlSugarHelper.SetDefault(connectionString.Key);
-                            _db.CodeFirst.InitTables(typeof(WCS_PlcSet));
-                            _db.CodeFirst.InitTables(typeof(WCS_PlcDataBlock));
+                            //_db.CodeFirst.InitTables(typeof(WCS_PlcSet));
+                            //_db.CodeFirst.InitTables(typeof(WCS_PlcDataBlock));
                             _db.CodeFirst.InitTables(typeof(WCS_PlcData));
-                            _db.CodeFirst.InitTables(typeof(WCS_DeviceInfo));
-                            _db.CodeFirst.InitTables(typeof(WCS_DeviceGrp));
-                            _db.CodeFirst.InitTables(typeof(WCS_DeviceProt));
-                            _db.CodeFirst.InitTables(typeof(WCS_PathInfo));
-                            _db.CodeFirst.InitTables(typeof(WCS_PathGrp));
-                            _db.CodeFirst.InitTables(typeof(WCS_Route));
+                            //_db.CodeFirst.InitTables(typeof(WCS_DeviceInfo));
+                            //_db.CodeFirst.InitTables(typeof(WCS_DeviceGrp));
+                            //_db.CodeFirst.InitTables(typeof(WCS_DeviceProt));
+                            //_db.CodeFirst.InitTables(typeof(WCS_PathInfo));
+                            //_db.CodeFirst.InitTables(typeof(WCS_PathGrp));
+                            //_db.CodeFirst.InitTables(typeof(WCS_Route));
                             _db.CodeFirst.InitTables(typeof(WCS_TaskInfo));
                             _db.CodeFirst.InitTables(typeof(WCS_TaskDtl));
                             _db.CodeFirst.InitTables(typeof(WCS_TaskOld));
@@ -146,29 +146,29 @@ namespace WCS.Service
 
             #region 创建虚拟PLC
 
-            var isOpenVirtualPlc = RedisHub.Default.Check("isOpenVirtualPLC") ?? throw new Exception("请在Redsi中配置是否启用虚拟PLC");
-            if (isOpenVirtualPlc == "1")
-            {
-                var plcDataConnectionString = RedisHub.Default.Check("plcDataConnectionString") ?? throw new Exception("请在Redsi中配置虚拟PLC使用的Redis连接字符串");
-
-                //从现有结构解析出需要的结构
-                var list = new List<PLCData>();
-                SqlSugarHelper.Do(db =>
-                {
-                    var _db = db.Connect;
-                    var dataBlocks = _db.Queryable<WCS_PlcDataBlock>().Includes(v => v.PLC).ToList();
-                    list.AddRange(dataBlocks.Select(dataBlock => new PLCData()
-                    {
-                        IP = dataBlock.PLC.IP,
-                        DB = dataBlock.NO,
-                        Length = dataBlock.Length,
-                        DataLength = dataBlock.DataLength,
-                    }));
-                });
-                PlcData.Init(plcDataConnectionString).InitPlcData(list);
-
-                ServiceHub.AddSystemMode(SystemMode.虚拟plc);
-            }
+            //var isOpenVirtualPlc = RedisHub.Default.Check("isOpenVirtualPLC") ?? throw new Exception("请在Redsi中配置是否启用虚拟PLC");
+            //if (isOpenVirtualPlc == "1")
+            //{
+            //    var plcDataConnectionString = RedisHub.Default.Check("plcDataConnectionString") ?? throw new Exception("请在Redsi中配置虚拟PLC使用的Redis连接字符串");
+
+            //    //从现有结构解析出需要的结构
+            //    var list = new List<PLCData>();
+            //    SqlSugarHelper.Do(db =>
+            //    {
+            //        var _db = db.Connect;
+            //        var dataBlocks = _db.Queryable<WCS_PlcDataBlock>().Includes(v => v.PLC).ToList();
+            //        list.AddRange(dataBlocks.Select(dataBlock => new PLCData()
+            //        {
+            //            IP = dataBlock.PLC.IP,
+            //            DB = dataBlock.NO,
+            //            Length = dataBlock.Length,
+            //            DataLength = dataBlock.DataLength,
+            //        }));
+            //    });
+            //    PlcData.Init(plcDataConnectionString).InitPlcData(list);
+
+            //    ServiceHub.AddSystemMode(SystemMode.虚拟plc);
+            //}
 
             #endregion 创建虚拟PLC
 

+ 4 - 3
WCS.WorkEngineering/DataStructure/StationData.cs

@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Runtime.Serialization;
 using System.Text;
+using WCS.Core;
 using WCS.Entity.Protocol.Station;
 
 namespace WCS.Entity.Protocol.DataStructure
@@ -10,13 +11,13 @@ namespace WCS.Entity.Protocol.DataStructure
     public class StationData : DeviceData
     {
         [DataMember(Order = 3)]
-        public WCS_Station520 D520 { get; set; }
+        public Device<IStation520> D520 { get; set; }
 
         [DataMember(Order = 4)]
-        public WCS_Station521 D521 { get; set; }
+        public Device<IStation521> D521 { get; set; }
 
         [DataMember(Order = 5)]
-        public WCS_Station523 D523 { get; set; }
+        public Device<IStation523> D523 { get; set; }
 
         //[DataMember(Order = 4)]
         //public WCS_RobotStation RobotStation { get; set; }

+ 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.13" />
+    <PackageReference Include="ServiceCenter" Version="1.0.1.15" />
   </ItemGroup>
 
 </Project>