Clear Binaries
Clear binaries and start create logger
This commit is contained in:
86
Mailing/NTC1.cs
Normal file
86
Mailing/NTC1.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using DataClients;
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.DocumentObjectModel.Tables;
|
||||
using MigraDoc.Rendering;
|
||||
using PdfSharp.Drawing;
|
||||
using PdfSharp.Fonts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Mailing
|
||||
{
|
||||
public static class GenNTC1
|
||||
{
|
||||
public static void GetNTC1(DateTime datestart, DateTime dateend)
|
||||
{
|
||||
var w = new STPClient();
|
||||
var s = datestart;
|
||||
var e = dateend;
|
||||
var r1 = new List<Tuple<string, string>>();
|
||||
var r2 = new List<Pasport>();
|
||||
|
||||
for (var i = s; i < e; i = i.AddDays(1))
|
||||
{
|
||||
Console.WriteLine(i.ToString(@"yyyy.MM.dd"));
|
||||
var a = w.GetListPasport(i);
|
||||
foreach (var b in a)
|
||||
{
|
||||
Console.WriteLine(b.Item1.ToString() + " | " + b.Item2.ToString());
|
||||
|
||||
var c = w.GetPasport(b.Item2);
|
||||
var d = w.GetIshData(c.time_start, c.time_end, c.numVDP);
|
||||
var flag = false;
|
||||
foreach (var f in d)
|
||||
{
|
||||
if (f.id != 0) continue;
|
||||
//Console.Write(f.time.ToString(@"yyyy.MM.dd HH:mm:ss.ff") + '\t' + b.Item1 + '\t' + f.value);
|
||||
Regex r = new Regex(@"(\w*)-(\w{3})-32-031(\w*)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
//Console.WriteLine('\t' + r.IsMatch(f.value).ToString());
|
||||
flag = flag || r.IsMatch(f.value);
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
r1.Add(b); r2.Add(c);
|
||||
/*Console.WriteLine(b.Item1 + '\t' +
|
||||
c.time_start.ToString(@"yyyy.MM.dd HH:mm:ss.ff") + '\t' +
|
||||
c.time_end.ToString(@"yyyy.MM.dd HH:mm:ss.ff"));*/
|
||||
/*foreach (var f in d)
|
||||
{
|
||||
if (f.id != 0) continue;
|
||||
Console.WriteLine(f.time.ToString(@"yyyy.MM.dd HH:mm:ss.ff") + '\t' + f.value);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine("Write To File.");
|
||||
Directory.CreateDirectory(Directory.GetCurrentDirectory() + '/' + "NTC1");
|
||||
for (var i = 0; i < r1.Count; i++)
|
||||
{
|
||||
var a = w.GetProtectData(r2[i].time_start, r2[i].time_end, r2[i].numVDP);
|
||||
var b = new List<Protect>();
|
||||
foreach (var c in a)
|
||||
if (c.id == 72) b.Add(c);
|
||||
if (b.Count > 0)
|
||||
{
|
||||
var fs = new StreamWriter(Directory.GetCurrentDirectory() + "/NTC1/" + s.ToString(@"yyyyMMdd") + "-" + e.ToString(@"yyyyMMdd") + ".txt", true);
|
||||
/*Console.WriteLine(r1[i].Item1 + '\t' +
|
||||
r2[i].time_start.ToString(@"yyyy.MM.dd HH:mm:ss.ff") + '\t' +
|
||||
r2[i].time_end.ToString(@"yyyy.MM.dd HH:mm:ss.ff"));*/
|
||||
fs.WriteLine(r1[i].Item1 + '\t' +
|
||||
r2[i].time_start.ToString(@"yyyy.MM.dd HH:mm:ss.ff") + '\t' +
|
||||
r2[i].time_end.ToString(@"yyyy.MM.dd HH:mm:ss.ff"));
|
||||
foreach (var d in b)
|
||||
{
|
||||
/*Console.WriteLine(d.time.ToString(@"yyyy.MM.dd HH:mm:ss.ff") + '\t' + d.id.ToString("D2") + '\t' + d.value);*/
|
||||
fs.WriteLine(d.time.ToString(@"yyyy.MM.dd HH:mm:ss.ff") + '\t' + d.value);
|
||||
}
|
||||
fs.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -14,7 +14,10 @@ namespace Mailing
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
{
|
||||
Console.WriteLine("Need params.");
|
||||
return;
|
||||
}
|
||||
var mailList = new List<string>();
|
||||
{
|
||||
var strings = File.ReadAllLines(args.Last());
|
||||
@@ -61,11 +64,48 @@ namespace Mailing
|
||||
}
|
||||
}
|
||||
GenSZO.GetPDF(time);
|
||||
var file = Directory.GetCurrentDirectory() + "/" + time.ToString("yyyy-MM-dd") + ".pdf";
|
||||
var fileszo = Directory.GetCurrentDirectory() + "/SZO/" + time.ToString("yyyy-MM-dd") + ".pdf";
|
||||
foreach (var e in mailList)
|
||||
Mailing.SendMail(new MailAddress(e), file);
|
||||
Mailing.SendMail(new MailAddress(e), fileszo);
|
||||
break;
|
||||
|
||||
case "NTC1":
|
||||
if (args.Length != 4)
|
||||
{
|
||||
Console.WriteLine("Wrong format");
|
||||
Console.WriteLine("Example: Maling NTC1 2020.07.07 2020.07.14 /mail.list");
|
||||
return;
|
||||
}
|
||||
|
||||
var timestart = DateTime.Now.AddDays(-7);
|
||||
var timeend = DateTime.Now;
|
||||
{
|
||||
try
|
||||
{
|
||||
var s = args[1].Split('.');
|
||||
timestart = new DateTime(
|
||||
Convert.ToInt32(s[0]),
|
||||
Convert.ToInt32(s[1]),
|
||||
Convert.ToInt32(s[2]));
|
||||
|
||||
s = args[2].Split('.');
|
||||
timeend = new DateTime(
|
||||
Convert.ToInt32(s[0]),
|
||||
Convert.ToInt32(s[1]),
|
||||
Convert.ToInt32(s[2]));
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("Wrong format data");
|
||||
Console.WriteLine("Example: 2020.07.14");
|
||||
return;
|
||||
}
|
||||
}
|
||||
GenNTC1.GetNTC1(timestart, timeend);
|
||||
var filentc1 = Directory.GetCurrentDirectory() + "/NTC1/" + timestart.ToString(@"yyyyMMdd") + "-" + timeend.ToString(@"yyyyMMdd") + ".txt";
|
||||
foreach (var e in mailList)
|
||||
Mailing.SendMailNTC1(new MailAddress(e), filentc1);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,5 +127,27 @@ namespace Mailing
|
||||
Smtp.Send(m);
|
||||
|
||||
}
|
||||
public static void SendMailNTC1(MailAddress to, string file)
|
||||
{
|
||||
MailMessage m = new MailMessage(From, to)
|
||||
{
|
||||
Subject = "Список плавок с низской скоростью штока",
|
||||
Body = "Еженедельная рассылка списка плавок " +
|
||||
"с низкой скоростью штока."
|
||||
};
|
||||
try
|
||||
{
|
||||
m.Attachments.Add(new Attachment(file));
|
||||
}
|
||||
catch
|
||||
{
|
||||
m.Body = m.Body + "\n В заданный период времени не было найдено подходящих плавок.";
|
||||
Console.WriteLine("Отсутствует файл для отправки.");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Smtp.Send(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
"profiles": {
|
||||
"Mailing": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "SZO 2020.08.28 F:\\Projects1\\Mailing\\bin\\Debug\\netcoreapp3.1\\mailing_SZO.list"
|
||||
"commandLineArgs": "NTC1 2020.07.22 2020.10.09 D:\\GIT\\ASCKU_PC\\Mailing\\bin\\Debug\\netcoreapp3.1\\mailing_NTC1.list"
|
||||
}
|
||||
}
|
||||
}
|
@@ -79,16 +79,16 @@ namespace Mailing
|
||||
var t2 = d.Item1 > e.end ? e.end : d.Item1;
|
||||
var res = t2 - t1;
|
||||
currstat = d;
|
||||
if (chk1.Contains((int)e.index) && res.TotalMinutes < 15)
|
||||
if (res.TotalMinutes < 15)
|
||||
continue;
|
||||
if (!resFull.ContainsKey(i))
|
||||
resFull.Add(i, new List<SZOWork>());
|
||||
resFull[i].Add(new SZOWork()
|
||||
{
|
||||
oper = e.index,
|
||||
techCycleStart = e.start,
|
||||
WorkTime = res
|
||||
});
|
||||
resFull[i].Add(new SZOWork()
|
||||
{
|
||||
oper = e.index,
|
||||
techCycleStart = e.start,
|
||||
WorkTime = res.Subtract(new TimeSpan(00, 15, 00))
|
||||
});
|
||||
}
|
||||
currstat = d;
|
||||
}
|
||||
@@ -203,7 +203,8 @@ namespace Mailing
|
||||
|
||||
public static void Print(DateTime time)
|
||||
{
|
||||
var file = Directory.GetCurrentDirectory() + '/' + time.ToString("yyyy-MM-dd") + ".pdf";
|
||||
Directory.CreateDirectory(Directory.GetCurrentDirectory() + '/' + "SZO");
|
||||
var file = Directory.GetCurrentDirectory() + '/' + "SZO" + '/' + time.ToString("yyyy-MM-dd") + ".pdf";
|
||||
if (File.Exists(file))
|
||||
File.Delete(file);
|
||||
var pdfRenderer = new PdfDocumentRenderer(true) { Document = doc };
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
27
Mailing/bin/Debug/netcoreapp3.1/NTC1/20200722-20201009.txt
Normal file
27
Mailing/bin/Debug/netcoreapp3.1/NTC1/20200722-20201009.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
9-34-09660 2020.07.28 03:46:45.00 2020.07.28 17:52:06.00
|
||||
2020.07.28 10:59:08.08 1
|
||||
2020.07.28 15:59:50.47 0
|
||||
9-35-09607 2020.08.07 23:01:25.00 2020.08.08 17:06:56.00
|
||||
2020.08.08 11:43:11.08 1
|
||||
2020.08.08 15:19:57.95 0
|
||||
9-39-09484 2020.08.17 22:57:38.00 2020.08.18 15:43:11.00
|
||||
2020.08.18 07:28:02.10 1
|
||||
2020.08.18 13:53:53.48 0
|
||||
9-35-09621 2020.08.19 05:19:14.00 2020.08.19 21:56:11.00
|
||||
2020.08.19 14:22:07.15 1
|
||||
2020.08.19 20:09:50.22 0
|
||||
9-02-05210 2020.08.26 01:34:35.00 2020.08.26 13:03:29.00
|
||||
2020.08.26 05:25:30.08 1
|
||||
2020.08.26 11:09:50.92 0
|
||||
9-35-09641 2020.09.04 09:46:24.00 2020.09.05 03:10:27.00
|
||||
2020.09.04 19:58:29.12 1
|
||||
2020.09.05 01:24:40.76 0
|
||||
9-45-11544 2020.09.09 02:55:02.00 2020.09.10 01:30:59.00
|
||||
2020.09.09 18:38:06.97 1
|
||||
2020.09.09 23:41:17.67 0
|
||||
9-10-11235 2020.09.10 07:09:31.00 2020.09.11 01:56:32.00
|
||||
2020.09.10 18:22:25.17 1
|
||||
2020.09.11 00:04:03.86 0
|
||||
9-04-10138 2020.09.27 16:45:11.00 2020.09.28 08:19:21.00
|
||||
2020.09.28 00:05:40.15 1
|
||||
2020.09.28 06:22:32.82 0
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1
Mailing/bin/Debug/netcoreapp3.1/mailing_NTC1.list
Normal file
1
Mailing/bin/Debug/netcoreapp3.1/mailing_NTC1.list
Normal file
@@ -0,0 +1 @@
|
||||
hatuncev_gd@vsmpo.ru
|
@@ -1 +1 @@
|
||||
b02eda345f31d2d14534071229c79baee93aee8f
|
||||
e79626e0af92f8b473bc98f42f0bd95f726cf733
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -68,7 +68,7 @@
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.402\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.403\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -144,7 +144,7 @@
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.402\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.403\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -208,7 +208,7 @@
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.402\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.403\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -282,7 +282,7 @@
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.402\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.403\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -350,7 +350,7 @@
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.402\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.403\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -414,7 +414,7 @@
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.402\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.403\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -393,7 +393,7 @@
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.402\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.403\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "JhSZzmYttQLpb/GGrRG41X411bHVP6MsnlK+LD7MbGjC4ML7JSnnlOUo1fQ8WpRLIvwvQfNev2CRVWlrJqdJXQ==",
|
||||
"dgSpecHash": "SpajZEf7/VRQUrDXoiTHU8aXoyHn3smrZZdD0UCJW8X2gPLouW0OsXdBb8ylFplsopwQkajR3U66biGjk4fcOQ==",
|
||||
"success": true,
|
||||
"projectFilePath": "D:\\GIT\\ASCKU_PC\\Mailing\\Mailing.csproj",
|
||||
"expectedPackageFiles": [
|
||||
|
Reference in New Issue
Block a user