Добавлена проверка заготовок в чистовой ст.250
This commit is contained in:
BIN
Microsoft.Data.SqlClient.dll
Normal file
BIN
Microsoft.Data.SqlClient.dll
Normal file
Binary file not shown.
BIN
Oracle.ManagedDataAccess.dll
Normal file
BIN
Oracle.ManagedDataAccess.dll
Normal file
Binary file not shown.
56
Program.cs
56
Program.cs
@@ -1,7 +1,8 @@
|
|||||||
using SendNotify;
|
using Oracle.ManagedDataAccess.Client;
|
||||||
using System.Data.SqlClient;
|
using SendNotify;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Data.SqlClient;
|
||||||
internal class Program
|
internal class Program
|
||||||
{
|
{
|
||||||
private static DateTime lastDate = DateTime.MinValue;
|
private static DateTime lastDate = DateTime.MinValue;
|
||||||
@@ -48,7 +49,7 @@ internal class Program
|
|||||||
{
|
{
|
||||||
#region check furnace 250
|
#region check furnace 250
|
||||||
DateTime now = DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
var result = CheckFurnace250Async().Result;
|
var result = CheckFurnace250().Result;
|
||||||
if (!result.status)
|
if (!result.status)
|
||||||
{
|
{
|
||||||
var notification = new
|
var notification = new
|
||||||
@@ -74,15 +75,58 @@ internal class Program
|
|||||||
lastDate = now;
|
lastDate = now;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region check billets 250
|
||||||
|
result = CheckRoughToFinishedBilletCount().Result;
|
||||||
|
if (!result.status)
|
||||||
|
{
|
||||||
|
var notification = new
|
||||||
|
{
|
||||||
|
title = "Статус мониторинга ст.250",
|
||||||
|
message = result.msg,
|
||||||
|
priority = 5
|
||||||
|
};
|
||||||
|
await SendNotify(url, token, notification, proxyUrl, proxyUsername, proxyPassword);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<(bool status, string msg)> CheckFurnace250Async()
|
private static async Task<(bool status, string msg)> CheckRoughToFinishedBilletCount()
|
||||||
|
{
|
||||||
|
int cntBillets = 0;
|
||||||
|
const string sqlConn = "User Id=main;Password=main;Data Source=10.14.18.50:1521/izl2;";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var conn = new OracleConnection(sqlConn))
|
||||||
|
{
|
||||||
|
await conn.OpenAsync();
|
||||||
|
using (var command = conn.CreateCommand())
|
||||||
|
{
|
||||||
|
command.CommandText = "SELECT COUNT(*) FROM V_TRACKING_MILL";
|
||||||
|
cntBillets = Convert.ToInt32(await command.ExecuteScalarAsync());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return (false, "Ошибка подключения к БД Oracle ст.250!");
|
||||||
|
}
|
||||||
|
if (cntBillets > 15)
|
||||||
|
{
|
||||||
|
return (false, $"Заготовок в стане - {cntBillets}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (true, "OK");
|
||||||
|
|
||||||
|
}
|
||||||
|
private static async Task<(bool status, string msg)> CheckFurnace250()
|
||||||
{
|
{
|
||||||
int cntEmptyPOID = 0;
|
int cntEmptyPOID = 0;
|
||||||
DateTime lastDT = DateTime.Now;
|
DateTime lastDT = DateTime.Now;
|
||||||
|
const string sqlConn = @"Password=WonderUser;User ID=WonderUser;Initial Catalog=Furnace_l2;Data Source=10.14.18.38\IZHSTALSQLSRVER;TrustServerCertificate=true;Encrypt=true;";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string sqlConn = @"Password=WonderUser;User ID=WonderUser;Initial Catalog=Furnace_l2;Data Source=10.14.18.38\IZHSTALSQLSRVER;TrustServerCertificate=true;Encrypt=true;";
|
|
||||||
using (var conn = new SqlConnection(sqlConn))
|
using (var conn = new SqlConnection(sqlConn))
|
||||||
{
|
{
|
||||||
await conn.OpenAsync();
|
await conn.OpenAsync();
|
||||||
@@ -110,7 +154,7 @@ internal class Program
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return (false, "Ошибка подключения к БД!");
|
return (false, "Ошибка подключения к БД sql server печи ПШП!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cntEmptyPOID > 15 && DateTime.Now - lastDT > new TimeSpan(0, 5, 0))
|
if (cntEmptyPOID > 15 && DateTime.Now - lastDT > new TimeSpan(0, 5, 0))
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<Platforms>AnyCPU</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
@@ -15,15 +16,26 @@
|
|||||||
<DebugType>embedded</DebugType>
|
<DebugType>embedded</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="4.9.0" />
|
<PackageReference Include="System.Data.SqlClient" Version="4.9.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Oracle.ManagedDataAccess">
|
||||||
|
<HintPath>Oracle.ManagedDataAccess.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="config.txt">
|
<None Update="config.txt">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Update="Oracle.ManagedDataAccess.dll">
|
||||||
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.13.35818.85 d17.13
|
VisualStudioVersion = 17.13.35818.85
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendNotify", "SendNotify.csproj", "{2F5A67A3-67F9-4DC4-B502-C2B3EF8C4305}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendNotify", "SendNotify.csproj", "{2F5A67A3-67F9-4DC4-B502-C2B3EF8C4305}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|||||||
Reference in New Issue
Block a user