Commit 2320e31d by Neo Turing

优化

parent 9a13ddf3
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<connectionStrings>
<!--<add name="Database" providerName="Sqlite" connectionString="$ROOT\AppData\primary.sqlite"/>-->
</connectionStrings>
</configuration>
\ No newline at end of file
</connectionStrings></configuration>
\ No newline at end of file
......@@ -128,7 +128,7 @@ namespace Kivii.Client.Finances.Icbc
task.Success(resp =>
{
initK5FormCtl(false);
setDefault(tbxServiceUrl, tbxUserName, tbxPassword, tbxNcAcc, tbxNcCertId, tbxNcGroupId, nudxNcInterval, tbxNcPort, tbxNcUrl, tbxNcVersion);
setDefault(tbxServiceUrl, tbxUserName, tbxPassword, tbxNcAcc, tbxNcCertId, tbxNcGroupId, nudxNcInterval, tbxNcPort, tbxNcUrl, tbxNcVersion, dtpCurrentTime);
outputMessage($"登录成功:{resp.FullName}");
Thread.Sleep(100);
}, true);
......@@ -179,6 +179,7 @@ namespace Kivii.Client.Finances.Icbc
{
_timer = new Timer();
_timer.Interval = (int)(nudxNcInterval.Value * 60 * 1000);
//_timer.Interval = (int)(nudxNcInterval.Value * 1000);
_timer.Tick += _timer_Tick;
}
_timer.Start();
......@@ -208,7 +209,7 @@ namespace Kivii.Client.Finances.Icbc
private void btnNcSync_Click(object sender, EventArgs e)
{
SyncPayments();
executeSync();
}
private void _timer_Tick(object sender, EventArgs e)
......@@ -216,7 +217,7 @@ namespace Kivii.Client.Finances.Icbc
try
{
_timer.Stop();
SyncPayments();
executeSync();
}
catch (Exception ex)
{
......@@ -228,13 +229,22 @@ namespace Kivii.Client.Finances.Icbc
}
}
private void SyncPayments()
private void executeSync()
{
if (InvokeRequired)
var th = KiviiContext.NewThread(() =>
{
this.Invoke(new Action(SyncPayments));
return;
syncICBC();
});
th.Start();
}
private void syncICBC()
{
//if (InvokeRequired)
//{
// this.Invoke(new Action(SyncPayments));
// return;
//}
if (!int.TryParse(tbxNcPort.Text, out int port))
{
outputMessage("NC端口号设置错误");
......@@ -282,7 +292,7 @@ namespace Kivii.Client.Finances.Icbc
try
{
var rtns = _client.Post(request);
outputMessage($"New:{DateTime.Now:yyyy-MM-dd HH:mm:ss}成功查询{rtns.Total}条收款,插入{rtns.Insert}条,跳过重复{rtns.Skip}条!");
outputMessage($"New:查询日期:{beginTime:yyyy-MM-dd}成功查询{rtns.Total}条收款,插入{rtns.Insert}条,跳过重复{rtns.Skip}条!");
DateTime maxTime = DateTime.MinValue;
foreach (var item in items)
......@@ -295,13 +305,22 @@ namespace Kivii.Client.Finances.Icbc
}
if (maxTime != DateTime.MinValue)
{
this.Invoke(new Action(() =>
{
dtpCurrentTime.Value = maxTime;
setDefault(dtpCurrentTime);
}));
}
}
catch (Exception ex)
{
outputMessage($"请求同步流水失败,原因:{ex.Message}");
var resp = ex.GetResponseStatus();
if (resp == null) outputMessage($"请求同步流水失败,原因:{ex.Message}");
else
{
var msg = resp.Message;
outputMessage($"请求同步流水失败,原因:{msg}");
}
}
}
}
......
......@@ -33,16 +33,16 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Kivii.Common.V4.0, Version=5.6.2024.1160, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kivii.Common.5.6.2024.1160\lib\net40\Kivii.Common.V4.0.dll</HintPath>
<HintPath>..\..\packages\Kivii.Common.5.6.2024.1160\lib\net40\Kivii.Common.V4.0.dll</HintPath>
</Reference>
<Reference Include="Kivii.Core.V4.0, Version=5.6.2023.9000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kivii.Core.5.6.2023.9000\lib\net40\Kivii.Core.V4.0.dll</HintPath>
<HintPath>..\..\packages\Kivii.Core.5.6.2023.9000\lib\net40\Kivii.Core.V4.0.dll</HintPath>
</Reference>
<Reference Include="Kivii.Linq.Sqlite.V4.0, Version=5.6.2023.3000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kivii.Linq.Sqlite.5.6.2023.3000\lib\net40\Kivii.Linq.Sqlite.V4.0.dll</HintPath>
<HintPath>..\..\packages\Kivii.Linq.Sqlite.5.6.2023.3000\lib\net40\Kivii.Linq.Sqlite.V4.0.dll</HintPath>
</Reference>
<Reference Include="Kivii.Linq.V4.0, Version=5.6.2024.2000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kivii.Linq.5.6.2024.2000\lib\net40\Kivii.Linq.V4.0.dll</HintPath>
<HintPath>..\..\packages\Kivii.Linq.5.6.2024.2000\lib\net40\Kivii.Linq.V4.0.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment