You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.1 KiB
C#

using HighWayIot.Repository.domain;
using HighWayIot.Repository.service;
using HighWayIot.Repository.service.Impl;
using HighWayIot.TouchSocket;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace RFIDSocket
{
/// <summary>
/// 数据解析类
/// </summary>
public class ServerDataAnalysis
{
private static readonly Lazy<ServerDataAnalysis> lazy = new Lazy<ServerDataAnalysis>(() => new ServerDataAnalysis());
public static ServerDataAnalysis Instance => lazy.Value;
public List<RFIDContent> rFIDContents = new List<RFIDContent>();
/// <summary>
/// 获取数据解析
/// </summary>
public void GetData(string lineNo)
{
if(string.IsNullOrEmpty(lineNo))
{
rFIDContents = BaseContentServiceImpl.Instance.Get200Infos().ToList();
}
else
{
rFIDContents = BaseContentServiceImpl.Instance.Get200Infos(lineNo).ToList();
}
}
/// <summary>
/// 秒转时间
/// </summary>
/// <param name="t"></param>
/// <returns></returns>
private string SecondToTime(int t)
{
int m = t / 60;
int s = t % 60;
if (m == 0)
{
return "00 分 " + s.ToString("00") + " 秒";
}
return m.ToString("00") + " 分 " + s.ToString("00") + " 秒";
}
public List<RFIDContent> ChangeReadResult(List<RFIDContent> list)
{
foreach (var item in list)
{
if (item.ReadKind == "GR")
{
item.ReadKind = "正常";
}
else if (item.ReadKind == "MR")
{
item.ReadKind = "多标签";
}
else if (item.ReadKind == "NB")
{
item.ReadKind = "无读";
}
}
return list;
}
}
}