change - 修改

master
wenjy 8 months ago
parent 662cefd95d
commit f239838c22

@ -1,6 +1,7 @@
using SlnMesnac.RfidUpload.Analysis;
using SlnMesnac.RfidUpload.Common;
using SlnMesnac.RfidUpload.Model;
using SlnMesnac.RfidUpload.Model.config;
using SlnMesnac.RfidUpload.TouchSocket;
using System;
using System.Collections.Generic;
@ -16,6 +17,7 @@ namespace SlnMesnac.RfidUpload.Business
private JsonChange _jsonChange = JsonChange.Instance;
private InstructionAdapter adapter = InstructionAdapter.Instance;
private WebApiClientApp _webApiClientApp = WebApiClientApp.Instance;
private readonly AppConfig appConfig = AppConfig.Instance;
private List<InstructionInfo> instructionInfoList = new List<InstructionInfo>();
@ -147,7 +149,14 @@ namespace SlnMesnac.RfidUpload.Business
TimeSpan timeDifference = instructionInfo.recordtime.Subtract(lastInstructionInfo.recordtime);
double minutesDifference = timeDifference.TotalMinutes;
if (minutesDifference < 1)
if (string.IsNullOrEmpty(appConfig.filterInterval))
{
appConfig.filterInterval = "1";
}
int filterInterval = Convert.ToInt32(appConfig.filterInterval);
if (minutesDifference < filterInterval)
{
return false;
}

@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2024 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* SlnMesnac.RfidUpload.Common
* b9e73772-16f9-40b7-92cc-4a95c4c34e6d
*
* WenJY
*
* 2024-05-28 14:10:36
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.RfidUpload.Common
{
/// <summary>
/// 配置操作类
/// </summary>
public class INIFile
{
public string path;
public INIFile(string INIPath)
{
path = INIPath;
}
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string defVal, Byte[] retVal, int size, string filePath);
/// <summary>
/// 写INI文件
/// </summary>
/// <param name="Section"></param>
/// <param name="Key"></param>
/// <param name="Value"></param>
public void IniWriteValue(string Section, string Key, string Value)
{
WritePrivateProfileString(Section, Key, Value, this.path);
}
/// <summary>
/// 读取INI文件
/// </summary>
/// <param name="Section"></param>
/// <param name="Key"></param>
/// <returns></returns>
public string IniReadValue(string Section, string Key)
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section, Key, "", temp, 255, this.path);
return temp.ToString();
}
public byte[] IniReadValues(string section, string key)
{
byte[] temp = new byte[255];
int i = GetPrivateProfileString(section, key, "", temp, 255, this.path);
return temp;
}
/// <summary>
/// 删除ini文件下所有段落
/// </summary>
public void ClearAllSection()
{
IniWriteValue(null, null, null);
}
/// <summary>
/// 删除ini文件下personal段落下的所有键
/// </summary>
/// <param name="Section"></param>
public void ClearSection(string Section)
{
IniWriteValue(Section, null, null);
}
}
}

@ -9,4 +9,8 @@
<PackageReference Include="MiniExcel" Version="1.31.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SlnMesnac.RfidUpload.Common\SlnMesnac.RfidUpload.Common.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,62 @@
using SlnMesnac.RfidUpload.Common;
using System;
using System.Collections.Generic;
using System.Text;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2024 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* SlnMesnac.RfidUpload.Model.config
* 8dc07598-dc8a-4ae3-9f67-bc77314a266e
*
* WenJY
*
* 2024-05-28 14:09:03
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.RfidUpload.Model.config
{
public class AppConfig
{
private static readonly Lazy<AppConfig> lazy = new Lazy<AppConfig>(() => new AppConfig());
//private static StringChange stringChange = StringChange.Instance;
public static AppConfig Instance
{
get
{
return lazy.Value;
}
}
private AppConfig()
{
}
private static INIFile iNIFile = new INIFile(System.Environment.CurrentDirectory + "/App.InI");
/// <summary>
/// 过滤间隔
/// </summary>
public string filterInterval
{
get { return iNIFile.IniReadValue("SystemConfig", "FilterInterval"); }
set { iNIFile.IniWriteValue("SystemConfig", "FilterInterval", value.ToString()); }
}
}
}

@ -7,6 +7,7 @@ using MiniExcelLibs;
using NLog;
using SlnMesnac.RfidUpload.Business;
using SlnMesnac.RfidUpload.Model;
using SlnMesnac.RfidUpload.Model.config;
using System;
using System.Collections;
using System.Collections.Generic;
@ -25,6 +26,7 @@ namespace SlnMesnac.RfidUpload.UI.viewModel
private ObservableCollection<dynamic> listItems = new ObservableCollection<dynamic>();
private ObservableCollection<InstructionInfo> labelItems = new ObservableCollection<InstructionInfo>();
#region 参数定义
/// <summary>
@ -126,7 +128,7 @@ namespace SlnMesnac.RfidUpload.UI.viewModel
foreach (byte[] package in dataPackages)
{
_business.LabelHandle(package);
LabelCountParam += 1;
//LabelCountParam += 1;
}
};

Loading…
Cancel
Save