laatzen/Common/CommonConsole/Program.cs
2024-03-19 15:46:25 +01:00

208 lines
5.5 KiB
C#

namespace CommonConsole
{
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using Xylem.Common.Logic.SoftwareAccessHelper;
public class Program
{
public static void Main()
{
foreach (var drive in Directory.GetLogicalDrives())
{
try
{
foreach (var vbpFile in Directory.GetFiles(drive, "*.vbp", SearchOption.AllDirectories))
{
Console.WriteLine(vbpFile);
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
}
//const string BASE_URL = "http://localhost:52822/LaaProductionWeb/api/cordonels/eolprogress";
//public static void Main()
//{
// var pcbid = 1000000001;
// var model = new EOLProgressModel { PcbId = pcbid };
// var response = $"{BASE_URL}/{pcbid}".GetAsJson<EOLProgressModel>();
// model = response.Value ?? new EOLProgressModel();
// LogErrors(response.Errors);
// LogModel(model);
// model.RebootDone = "OK";
// model.ExportDone = "OK";
// model.ParameterizationDone = "OK";
// model.ProductionStatusChecked = "FAIL";
// response = model.PutAsJson<EOLProgressModel>(BASE_URL);
// model = response.Value ?? new EOLProgressModel();
// LogErrors(response.Errors);
// LogModel(model);
// model.RebootDone = "FAIL";
// model.ExportDone = "FAIL";
// model.ParameterizationDone = "FAIL";
// model.ProductionStatusChecked = "OK";
// response = model.PutAsJson<EOLProgressModel>(BASE_URL);
// model = response.Value ?? new EOLProgressModel();
// LogErrors(response.Errors);
// LogModel(model);
// model.SentinelDate = DateTime.Now;
// model.PasswordFileInstalled = "OK";
// model.RequirementChecked = "OK";
// model.StoreConfigurationDone = "NA";
// response = model.PutAsJson<EOLProgressModel>(BASE_URL);
// model = response.Value ?? new EOLProgressModel();
// LogErrors(response.Errors);
// LogModel(model);
// response = $"{BASE_URL}/{model.PcbId}/OK".PostAsJson<EOLProgressModel>();
// model = response.Value ?? new EOLProgressModel();
// LogErrors(response.Errors);
// LogModel(model);
// response = $"{BASE_URL}/{model.PcbId}".DeleteAsJson<EOLProgressModel>();
// model = response.Value ?? new EOLProgressModel();
// LogErrors(response.Errors);
// LogModel(model);
//}
private static void LogModel(EOLProgressModel model)
{
if (model != null)
{
Console.WriteLine(JsonConvert.SerializeObject(model, Formatting.Indented));
}
}
private static void LogErrors(Dictionary<String, String> errors)
{
if (errors != null)
{
foreach (var kvp in errors)
{
Console.WriteLine($"{kvp.Key}: {kvp.Value}");
}
}
}
}
public class EOLProgressModel
{
public Int32 Id { get; set; }
public Int32 PcbId { get; set; }
public Int32? RequirementId { get; set; }
public String RequirementChecked { get; set; }
public String PasswordFileInstalled { get; set; }
public String ProductionStatusChecked { get; set; }
public String ParameterizationDone { get; set; }
public String RebootDone { get; set; }
public String StoreConfigurationDone { get; set; }
public String ExportDone { get; set; }
public Int64? RaioCheckId { get; set; }
public DateTime? SentinelDate { get; set; }
public String Completed { get; set; }
public DateTime? CompleteDate { get; set; }
public String CompleteHost { get; set; }
public DateTime AddDate { get; set; }
public String AddHost { get; set; }
}
}
//--- Connected: COM9, 2400, 8, None, One
//>>> 01
//<<< 01-39-34-37-30-35-36-38-36-00
//>>> 07
//<<< 01-00
//>>> 13
//<<< 01-30-30-30-30-30-31-30-31-00
//>>> FD-3D
//<<< 01-87-F2-BA-00
//>>> FD-64-00-F2-BA-BD-51-33-44-07-00
//<<< 01
//>>> FD-02
//<<< 01-00-00-E1-84-06-00
//>>> FD-25-00-00-E1-84-06-00-00-00-30-00-00-00-07
//<<< 01
//--- Connected: COM9, 2400, 8, None, One
//>>> 01
//<<< 01-39-34-37-30-35-36-38-33-00
//>>> 07
//<<< 01-00
//>>> 13
//<<< 01-30-30-30-30-30-33-37-38-00
//>>> FD-3D
//<<< 01-0D-24-B3-00
//>>> FD-64-00-24-B3-18-01-33-44-09-00
//<<< 02
//>>> 17
//<<< 01-38-31-36-32-33-33-35-30-30-39-32-31-00
//>>> FD-08
//<<< 01-00
//>>> FD-02
//<<< 01-00-00-E1-84-06-00
//>>> FD-25-00-00-E1-84-06-00-00-00-30-00-00-00-07
//<<< 01
//--- Disconnected: COM9, 2400, 8, None, One
//--- Connected: COM9, 2400, 8, None, One
//>>> 01
//<<< 01-39-34-37-30-35-36-38-32-00
//>>> 07
//<<< 01-00
//>>> 13
//<<< 01-30-30-30-30-30-30-39-39-00
//>>> FD-3D
//<<< 01-CA-12-B3-00
//>>> FD-64-00-12-B3-39-11-33-44-06-00
//<<< 01
//>>> 17
//<<< 01-38-31-36-32-33-33-35-31-35-32-34-37-00
//>>> FD-08
//<<< 01-31
//>>> FD-02
//<<< 01-00-00-E1-84-06-00
//>>> FD-25-00-00-E1-84-06-00-00-00-30-00-00-00-07
//<<< 01
//--- Disconnected: COM9, 2400, 8, None, One