This commit is contained in:
Stoyan Zlatev
2024-08-06 15:57:35 +02:00
33 changed files with 422 additions and 134 deletions
@@ -523,7 +523,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
var sbQuery = new StringBuilder();
sbQuery.AppendLine($" SELECT ");
sbQuery.AppendLine($" SELECT distinct ");
sbQuery.AppendLine($" [Seriennummer] ");
sbQuery.AppendLine($" ,mps.MapPcbIdToSerialNumber_PcbId ");
sbQuery.AppendLine($" ,[Adresse] ");
@@ -536,6 +536,8 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
sbQuery.AppendLine($" ,passwordtbl.Password ");
sbQuery.AppendLine($" ,passwordtbl.KitronSkeletonKey as Skeleton ");
sbQuery.AppendLine($" ,passwordtbl.ProcessorID as ProcessorUid ");
sbQuery.AppendLine($" ,passwordtbl.radioAdress ");
sbQuery.AppendLine($" FROM [Auftrag].[dbo].[Genesis_Meter] meter ");
sbQuery.AppendLine($" inner join MapPcbIdToSerialNumber mps" +
$" on mps.MapPcbIdToSerialNumber_SerialNumber = meter.Seriennummer and mps.MapPcbIdToSerialNumber_Deleted = 0 ");
@@ -556,13 +558,26 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
using (var dataAccess = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var dt = dataAccess.ExecuteQuery(sbQuery.ToString());
if (dt.Rows.Count != 1)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, new PcbIdNotException("Pcb not unique, mapping problem", new Guid("160B4C44-6EF7-41DC-A48D-4B4105B4779B")));
}
foreach (var item in dt.Select())
{
result.OrderNumber = (Int32)item["FertigungsauftragNr"];
result.RadioAddress = (Int64)item["Adresse"];
result.Skeleton = (String)item["Skeleton"];
result.Password = (String)item["Password"];
result.PasswordFileIdent = (result.RadioAddress.HasValue && result.RadioAddress.Value != 0) ? result.RadioAddress.Value.ToString() : PcbId;
if (item["radioAdress"].GetType() != typeof(System.DBNull))
{
result.PasswordFileIdent = (String)item["radioAdress"].ToString();
}
else
{
result.PasswordFileIdent = (result.RadioAddress.HasValue && result.RadioAddress.Value != 0) ? result.RadioAddress.Value.ToString() : PcbId;
}
if (item["KeySetId"].GetType() != typeof(System.DBNull))
{
result.KeySetId = (String)item["KeySetId"];
@@ -864,10 +879,10 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
return LocalWebRequest.PostRequestAsyncAndGetContent(url: Url, header: header, json: helpArray.ToArray(), timeoutMs: 20000);
}
catch (Exception)
catch (Exception ex)
{
throw;
return ex.Message;
}
}
@@ -133,8 +133,8 @@
$"{x.GetValue<Int32>(0)}", // SerialNr,
$"{x.GetValue<Int32>(1)}", // FertigungsNr,
$"{x.GetValue<Int64>(2)}", // RadioAddress,
$"{x.GetValue<Int32?>(3)}", // CustomerSerialNr,
$"{x.GetValue<String>(4)}", // CalibrationRunID,
$"{x.GetValue<String>(3)}", // CustomerSerialNr,
$"{x.GetValue<Int32?>(4)}", // CalibrationRunID,
$"{x.GetValue<Byte>(5)}", // LastProcessState,
$"{x.GetValue<Int32>(6)}", // Dn,
$"{x.GetValue<Int32>(7)}", // NewNennweiteID,