using HighWayIot.Repository.domain; using HighWayIot.Repository.service.Impl; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace RFIDSocket { public partial class RFIDLog : Form { List rFIDContents = new List(); List AfterSelect = new List(); BaseContentServiceImpl sql = new BaseContentServiceImpl(); List listStatus = new List { "", "NR", "GR", }; Dictionary listTips = new Dictionary { {"", ""}, {"正常", "ok"}, {"无读", "noread"}, {"近距离", "near"}, {"包过短", "short"}, {"多标签", "multi"}, }; public RFIDLog() { InitializeComponent(); Init(); } private void Init() { rFIDContents = sql.GetContentInfos(); StartTime.Value = DateTime.Now.AddDays(-3); AllIP.DataSource = ServerConnect.Names; StatusText.DataSource = listStatus; TipsText.DataSource = listTips.Keys.ToArray(); } private void TimeSelect_Click(object sender, EventArgs e) { rFIDContents = LogControl.LogIPSelect(sql.GetContentInfos(), ServerConnect.IPConfig[AllIP.Text]); AfterSelect = LogControl.LogTimeSelect(rFIDContents, StartTime.Value, EndTime.Value); DataCount(); if (LogContent != null) { LogContent.DataSource = null; LogContent.DataSource = AfterSelect; } } private void SelectByCondition_Click(object sender, EventArgs e) { rFIDContents = LogControl.LogIPSelect(sql.GetContentInfos(), ServerConnect.IPConfig[AllIP.Text]); AfterSelect = SelectCondition(rFIDContents); DataCount(); if (LogContent != null) { LogContent.DataSource = null; LogContent.DataSource = AfterSelect; } } private void SelectAll_Click(object sender, EventArgs e) { rFIDContents = LogControl.LogIPSelect(sql.GetContentInfos(), ServerConnect.IPConfig[AllIP.Text]); AfterSelect = LogControl.LogTimeSelect(SelectCondition(rFIDContents), StartTime.Value, EndTime.Value); DataCount(); if (LogContent != null) { LogContent.DataSource = null; LogContent.DataSource = AfterSelect; } } private List SelectCondition(List content) { AfterSelect = LogControl.LogLengthSelect( LogControl.LogIntervalSelect( LogControl.LogStatusSelect( LogControl.LogTipsSelect( LogControl.LogSNSelect( LogControl.LogEPCSelect(content, EPCText.Text), SNText.Text), listTips[TipsText.Text]), StatusText.Text), int.TryParse(MinInterval.Text, out int c) ? c : -1, int.TryParse(MaxInterval.Text, out int d) ? d : -1), int.TryParse(MinLength.Text, out int a) ? a : -1, int.TryParse(MaxLength.Text, out int b) ? b : -1); DataCount(); return AfterSelect; } private void DataCount() { TotalCount.Text = AfterSelect.Count.ToString(); NormalCount.Text = AfterSelect.Where(x => x.Tips == "ok").Count().ToString(); WarningCount.Text = AfterSelect.Where(x => x.Tips != "ok").Count().ToString(); NoReadCount.Text = AfterSelect.Where(x => x.Tips == "noread").Count().ToString(); NearCount.Text = AfterSelect.Where(x => x.Tips == "near").Count().ToString(); ShortCount.Text = AfterSelect.Where(x => x.Tips == "short").Count().ToString(); MultiCount.Text = AfterSelect.Where(x => x.Tips == "multi").Count().ToString(); } } }