calibration valkues commitestttt
This commit is contained in:
@@ -1,33 +1,67 @@
|
||||
namespace Xylem.Common.Service.MeterProcessState.Controllers
|
||||
{
|
||||
using global::Common.Logic.Extensions.SQL;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
|
||||
[RoutePrefix("api/configurationjson")]
|
||||
[RoutePrefix("configurationjson")]
|
||||
public class ConfigurationJsonController : ApiController
|
||||
{
|
||||
[HttpGet]
|
||||
[Route]
|
||||
public IHttpActionResult Get()
|
||||
{
|
||||
var message = String.Empty;
|
||||
var configurationText = String.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
var currentDirectory = HttpContext.Current.Request.MapPath("..");
|
||||
var files = Directory.GetFiles(currentDirectory);
|
||||
var configurationJsonFilePath = Path.Combine(currentDirectory, "configuration.json");
|
||||
var configurationJsonContent = File.ReadAllText(configurationJsonFilePath);
|
||||
var configurationJson = JsonConvert.DeserializeObject(configurationJsonContent);
|
||||
var serializerSettings = new JsonSerializerSettings();
|
||||
|
||||
return this.Json(configurationJson, serializerSettings, Encoding.UTF8);
|
||||
var connectionString = ConfigurationManager.ConnectionStrings["Default"].ConnectionString;
|
||||
var configurationBytes = SQLConnection
|
||||
.CreateSQLConnection(connectionString)
|
||||
.CreateCommand(@"
|
||||
SELECT TOP 1 f.FileContent
|
||||
FROM FileClusterStore AS fcs
|
||||
JOIN FileMapToCluster AS fmc
|
||||
ON fcs.FileId = fmc.FileMapToCluster_FileClusterId
|
||||
JOIN [File] AS f
|
||||
ON fmc.FileMapToCluster_FileId = f.FileId
|
||||
WHERE FileCategoryID = 2
|
||||
ORDER BY f.FileId DESC")
|
||||
.FirstOrDefault(x => x.GetValue<Byte[]>(0));
|
||||
configurationText = Encoding.ASCII.GetString(configurationBytes);
|
||||
}
|
||||
catch
|
||||
catch (Exception dbe)
|
||||
{
|
||||
return this.BadRequest("Unable to find or load ...\\configuration.json");
|
||||
message = dbe.Message;
|
||||
|
||||
try
|
||||
{
|
||||
var configurationPath = HttpContext.Current.Request.MapPath("configuration.json");
|
||||
configurationText = File.ReadAllText(configurationPath);
|
||||
}
|
||||
catch (Exception fe)
|
||||
{
|
||||
message = fe.Message;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var configurationJson = JsonConvert.DeserializeObject(configurationText);
|
||||
|
||||
return this.Json(configurationJson, new JsonSerializerSettings(), Encoding.UTF8);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return this.BadRequest($"{e.Message}{Environment.NewLine}{message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ using System.Web.Http;
|
||||
using Xylem.Common.Logic.ProductionOrderCore;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.KitronTestResults;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.Vako;
|
||||
using Xylem.Common.Logic.ServiceCore;
|
||||
|
||||
@@ -1306,25 +1307,25 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
|
||||
AND PcbId = @{nameof(pcbId)}
|
||||
ORDER BY date DESC")
|
||||
.SetParameter(nameof(pcbId), pcbId)
|
||||
.FirstOrDefault(x => new
|
||||
.FirstOrDefault(x => new CalibrationResults
|
||||
{
|
||||
Id = x.GetValue<Int32>(0),
|
||||
PcbId = x.GetValue<String>(1),
|
||||
CalFactor1 = x.GetValue<Int32>(2),
|
||||
CalFactor2 = x.GetValue<Int32>(3),
|
||||
CalFactor3 = x.GetValue<Int32>(4),
|
||||
CalFactor1 = x.GetValue<UInt16>(2),
|
||||
CalFactor2 = x.GetValue<UInt16>(3),
|
||||
CalFactor3 = x.GetValue<UInt16>(4),
|
||||
ZeroOffset1 = x.GetValue<Int32>(5),
|
||||
ZeroOffset2 = x.GetValue<Int32>(6),
|
||||
ZeroOffset3 = x.GetValue<Int32>(7),
|
||||
FirstHitUpdatePeriod = x.GetValue<Int32>(8),
|
||||
FirstHitShift = x.GetValue<Int32>(9),
|
||||
FirstHitPercent1 = x.GetValue<Int32>(10),
|
||||
FirstHitPercent2 = x.GetValue<Int32>(11),
|
||||
FirstHitPercent3 = x.GetValue<Int32>(12),
|
||||
FirstHitUpdatePeriod = x.GetValue<Byte>(8),
|
||||
FirstHitShift = x.GetValue<Byte>(9),
|
||||
FirstHitPercent1 = x.GetValue<Byte>(10),
|
||||
FirstHitPercent2 = x.GetValue<Byte>(11),
|
||||
FirstHitPercent3 = x.GetValue<Byte>(12),
|
||||
ToFTempOffset1 = x.GetValue<Int32>(13),
|
||||
ToFTempOffset2 = x.GetValue<Int32>(14),
|
||||
ToFTempOffset3 = x.GetValue<Int32>(15),
|
||||
MeterSize = x.GetValue<Int32>(16),
|
||||
MeterSize = x.GetValue<Byte>(16),
|
||||
Date = x.GetValue<DateTime>(17),
|
||||
Succeeded = x.GetValue<Boolean>(18),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user