This commit is contained in:
Georgy Khatuncev 2021-08-01 22:56:52 +05:00
parent cffb8a180b
commit 25f8be5f24
24 changed files with 16 additions and 13 deletions

Binary file not shown.

@ -40,11 +40,13 @@ namespace ClientCollector
static async void WorkPasport()
{
var IpSTP = "10.10.45.152";
var PortSTP = 1070;
var nameCurrDate = "pasport";
var currDate = GetCurrData(nameCurrDate);
if (!currDate.HasValue)
currDate = new DateTime(2001, 01, 01);
NETClient netClient = new NETClient("10.10.45.152", 1070);
NETClient netClient = new NETClient(IpSTP, PortSTP);
while (currDate.Value < DateTime.Now.AddDays(-1))
{
try
@ -58,6 +60,7 @@ namespace ClientCollector
if (!netClient.Connect())
{
netClient.Close();
netClient = new NETClient(IpSTP, PortSTP);
log.Warn("Can't connect to STP.");
await Task.Delay(10000);
}
@ -67,17 +70,17 @@ namespace ClientCollector
currPasports = Array.Empty<string>();
foreach (var paspDir in currPasports)
{
var count = 0;
do
{
try
{
log.Info("Get pasport: " + paspDir + " try " + (count + 1));
log.Info("Get pasport: " + paspDir);
while (!netClient.Connected())
if (!netClient.Connect())
{
log.Warn("Can't connect to STP.");
netClient.Close();
netClient = new NETClient(IpSTP, PortSTP);
await Task.Delay(10000);
}
var pasp = netClient.Full_Pasp_Download(paspDir);
@ -85,13 +88,11 @@ namespace ClientCollector
if (pasp == null || !pasp.HasData)
{
log.Warn("Can't get pasport.");
if (netClient.Connect())
count++;
netClient.Close();
netClient = new NETClient(IpSTP, PortSTP);
await Task.Delay(10000);
continue;
}
while (SendPasport(pasp))
while (!SendPasport(pasp))
{
log.Warn("Can't send pasp to API.");
await Task.Delay(10000);
@ -100,18 +101,20 @@ namespace ClientCollector
}
catch (Exception e)
{
log.Warn(e);
log.Warn(e.Message);
await Task.Delay(5000);
}
}
while (count < 5);
while (true);
}
log.Info("End day: " + currDir);
SaveCurrData(nameCurrDate, currDate.Value);
currDate = currDate.Value.AddDays(1);
await Task.Delay(60000);
}
catch (Exception e)
{
log.Warn(e);
log.Warn(e.Message);
await Task.Delay(1000 * 60 * 5);
}
}
@ -264,7 +267,7 @@ namespace ClientCollector
}
catch (Exception e)
{
log.Warn(e);
log.Warn(e.Message);
return false;
}
}
@ -299,7 +302,7 @@ namespace ClientCollector
}
catch (Exception e)
{
log.Warn(e);
log.Warn(e.Message);
return null;
}
}

@ -4,6 +4,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<History>True|2021-08-01T14:27:43.9900600Z;True|2021-08-01T19:18:48.8000969+05:00;True|2021-08-01T19:15:19.9257002+05:00;True|2021-08-01T19:08:17.1315589+05:00;True|2021-07-31T20:35:08.9408458+05:00;True|2021-07-31T20:20:29.0886405+05:00;</History>
<History>True|2021-08-01T17:53:02.2382201Z;True|2021-08-01T22:48:16.9658882+05:00;True|2021-08-01T22:40:58.1479436+05:00;True|2021-08-01T22:28:58.9840017+05:00;True|2021-08-01T20:16:20.5210616+05:00;True|2021-08-01T19:27:43.9900600+05:00;True|2021-08-01T19:18:48.8000969+05:00;True|2021-08-01T19:15:19.9257002+05:00;True|2021-08-01T19:08:17.1315589+05:00;True|2021-07-31T20:35:08.9408458+05:00;True|2021-07-31T20:20:29.0886405+05:00;</History>
</PropertyGroup>
</Project>