1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using Newtonsoft.Json;
- using ServiceCenter;
- using ServiceCenter.Helpers;
- using ServiceCenter.SqlSugars;
- using System.ComponentModel;
- using WCS.Core;
- using WCS.Entity;
- using WCS.Entity.Protocol.DataStructure;
- using WCS.Entity.Protocol.Station;
- using WCS.Service.Worlds;
- using WCS.WorkEngineering.Extensions;
- namespace WCS.Service.Systems
- {
- /// <summary>
- /// 数据采集系统
- /// </summary>
- [BelongTo(typeof(DataCollectionWorld))]
- [Description("数据采集系统")]
- public class DataCollectionSysyem : ServiceSystem<bool, bool>
- {
- public List<Station> ConvList;
- public DataCollectionSysyem()
- {
- ConvList = Device.All.Where(v => v.HasProtocol(typeof(IStation523))).Select(v => new Station(v, this.World)).ToList();
- }
- protected override bool Do(bool obj)
- {
- //SqlSugarHelper.Do(db =>
- //{
- // DeviceDataPack pack = new DeviceDataPack();
- // pack.Frame = DateTime.Now;
- // //pack.
- // //byte[] bytes = System.Text.Encoding.Default.GetBytes(JsonConvert.SerializeObject(ConvList, null, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }));
- // var plcData = new WCS_PlcData()
- // {
- // AddWho = "WCS",
- // WAREHOUSE = ServiceHub.WarehouseName,
- // CONTENT = JsonConvert.SerializeObject(ConvList, null, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }),
- // };
- // var a = TypeConversionHelper.SerializeRedisValue(ConvList);
- // //对bytes进行数据压缩
- // //plcData.CONTENT = bytes.Compress();
- // db.Default.Insertable(plcData).ExecuteCommand();
- //});
- //return true;
- }
- }
- }
|