diff --git a/Microsoft.Data.SqlClient.dll b/Microsoft.Data.SqlClient.dll
new file mode 100644
index 0000000..ee5d780
Binary files /dev/null and b/Microsoft.Data.SqlClient.dll differ
diff --git a/Oracle.ManagedDataAccess.dll b/Oracle.ManagedDataAccess.dll
new file mode 100644
index 0000000..59db591
Binary files /dev/null and b/Oracle.ManagedDataAccess.dll differ
diff --git a/Program.cs b/Program.cs
index 6108e33..2ee58d1 100644
--- a/Program.cs
+++ b/Program.cs
@@ -1,7 +1,8 @@
-using SendNotify;
-using System.Data.SqlClient;
+using Oracle.ManagedDataAccess.Client;
+using SendNotify;
using System.Net;
using System.Text;
+using System.Data.SqlClient;
internal class Program
{
private static DateTime lastDate = DateTime.MinValue;
@@ -48,7 +49,7 @@ internal class Program
{
#region check furnace 250
DateTime now = DateTime.Now;
- var result = CheckFurnace250Async().Result;
+ var result = CheckFurnace250().Result;
if (!result.status)
{
var notification = new
@@ -74,15 +75,58 @@ internal class Program
lastDate = now;
}
#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;
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
{
- 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))
{
await conn.OpenAsync();
@@ -110,7 +154,7 @@ internal class Program
}
catch
{
- return (false, "Ошибка подключения к БД!");
+ return (false, "Ошибка подключения к БД sql server печи ПШП!");
}
if (cntEmptyPOID > 15 && DateTime.Now - lastDT > new TimeSpan(0, 5, 0))
diff --git a/SendNotify.csproj b/SendNotify.csproj
index bd06f1c..9a52065 100644
--- a/SendNotify.csproj
+++ b/SendNotify.csproj
@@ -5,6 +5,7 @@
net8.0
enable
enable
+ AnyCPU
@@ -15,15 +16,26 @@
embedded
+
+
+
+ Oracle.ManagedDataAccess.dll
+ True
+
+
+
Always
+
+ Never
+
diff --git a/SendNotify.sln b/SendNotify.sln
index 55f9fa7..146dd25 100644
--- a/SendNotify.sln
+++ b/SendNotify.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
-VisualStudioVersion = 17.13.35818.85 d17.13
+VisualStudioVersion = 17.13.35818.85
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendNotify", "SendNotify.csproj", "{2F5A67A3-67F9-4DC4-B502-C2B3EF8C4305}"
EndProject