VSFM omni+ 02-07-2024
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Common.SqlExtensions;
|
||||
using Common.Logic.Extensions.SQL;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -8,7 +8,6 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Xylem.Common.Service.MeterProcessState.Controllers
|
||||
{
|
||||
using global::Common.SqlExtensions;
|
||||
using global::Common.Logic.Extensions.SQL;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -9,6 +9,7 @@
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web.Http;
|
||||
|
||||
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
|
||||
using Xylem.Common.Logic.ServiceCore;
|
||||
|
||||
@@ -17,19 +18,20 @@
|
||||
{
|
||||
public static class GlobalConfig
|
||||
{
|
||||
public static Lazy<String> connectionString = new Lazy<String>(()
|
||||
=>
|
||||
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
|
||||
);
|
||||
public static Lazy<String> connectionString = new Lazy<String>(() => ConfigurationManager.ConnectionStrings["default"].ConnectionString);
|
||||
}
|
||||
public static readonly Lazy<String> ConnectionString = new Lazy<String>(()
|
||||
=> ConfigurationManager.ConnectionStrings["default"].ConnectionString);
|
||||
|
||||
public static readonly Lazy<String> ConnectionString = new Lazy<String>(() => ConfigurationManager.ConnectionStrings["default"].ConnectionString);
|
||||
|
||||
/// <summary>
|
||||
/// SetMeterLogPathInfo
|
||||
/// </summary>
|
||||
/// <param name="SerialNumber">PcbID from Meter</param>
|
||||
///
|
||||
/// <param name="TestRunId"> </param>
|
||||
/// <param name="CalibrationRunId"> </param>
|
||||
/// <param name="BasePath"> </param>
|
||||
/// <param name="MainLogName"> </param>
|
||||
/// <param name="LEDName"> </param>
|
||||
/// <returns></returns>
|
||||
[Route("SetMeterLogPathInfo"), HttpGet]
|
||||
public IHttpActionResult SetMeterLogPathInfo(Int32 SerialNumber, Int32? TestRunId = null, Int32? CalibrationRunId = null, String BasePath = "", String MainLogName = "", String LEDName = "")
|
||||
@@ -76,46 +78,6 @@
|
||||
[Route("GetMeterInfoForTestBench"), HttpGet]
|
||||
public IHttpActionResult GetMeterInfoForTestBench(String PcbID)
|
||||
{
|
||||
var str = $@"
|
||||
SELECT DISTINCT
|
||||
[MapPcbIdToSerialNumber_SerialNumber] AS [SerialNr]
|
||||
, [MapOrder].[CordonelAssignedPicking_FertigungsAuftragsNr] AS [FertigungsNr]
|
||||
, [Meter].[Adresse] AS [RadioAddress]
|
||||
, [KundeneigeneSerienNr] AS [CustomerSerialNr]
|
||||
, (SELECT TOP 1 [ID]
|
||||
FROM [CordonelMeterCalibrationResults]
|
||||
WHERE [PcbId] = @{nameof(PcbID)}
|
||||
ORDER BY [Date] DESC) AS [CalibrationRunID]
|
||||
, (SELECT TOP 1 [StatusFertigung]
|
||||
FROM [AuftragPositionSerienNr]
|
||||
WHERE [SerienNr] = [MapPcbIdToSerialNumber_SerialNumber]
|
||||
ORDER BY [AnlageDatum] DESC) AS [LastProcessState]
|
||||
, [Nennweite] AS [Dn]
|
||||
, (SELECT TOP 1 [Dn_InternalId]
|
||||
FROM [CordonelMeterSizes]
|
||||
WHERE [Dn_VakoID] = SUBSTRING([Identnr].[VakoCode], 4, 2)) AS [NewNennweiteID]
|
||||
, [lut].[FileCrc] AS [LutCrc]
|
||||
FROM [Cordonel_AssignedPicking] AS [MapOrder]
|
||||
LEFT OUTER JOIN [MapPcbIdToSerialNumber] AS [map]
|
||||
ON [MapOrder].[CordonelAssignedPicking_PcbId] = [map].[MapPcbIdToSerialNumber_PcbId]
|
||||
AND [map].[MapPcbIdToSerialNumber_Deleted] = 0
|
||||
LEFT OUTER JOIN [AuftragPositionSerienNr] AS [mapSrn]
|
||||
ON [map].[MapPcbIdToSerialNumber_SerialNumber] = [mapSrn].[SerienNr]
|
||||
AND [mapSrn].[Pruefgangnr] = 0
|
||||
LEFT OUTER JOIN [AuftragPosition_gesamt] AS [auftraginfo]
|
||||
ON [auftraginfo].[AuftragNr] = [mapSrn].[AuftragNr]
|
||||
AND [auftraginfo].[PositionNr] = [mapSrn].[PositionNr]
|
||||
LEFT OUTER JOIN [Genesis_Meter] AS [Meter]
|
||||
ON [Meter].[Seriennummer] = [map].[MapPcbIdToSerialNumber_SerialNumber]
|
||||
LEFT OUTER JOIN [Identnr]
|
||||
ON [auftraginfo].[Identnr] = [Identnr].[IdentNr]
|
||||
LEFT OUTER JOIN [Cordonel_Lut] AS [lut]
|
||||
ON [lut].[MeterSize] = (SELECT TOP 1 [Dn_InternalId]
|
||||
FROM [CordonelMeterSizes]
|
||||
WHERE [Dn_VakoID] = SUBSTRING([Identnr].[VakoCode], 4, 2))
|
||||
AND [lut].[CurrentVersionForProd] = 1
|
||||
WHERE [MapOrder].[CordonelAssignedPicking_IsDeleted] = 0
|
||||
AND [MapOrder].[CordonelAssignedPicking_PcbId] = @{nameof(PcbID)} ";
|
||||
var results = SQLConnection
|
||||
.CreateSQLConnection(ConnectionString.Value)
|
||||
.CreateCommand($@"
|
||||
@@ -168,16 +130,16 @@
|
||||
.SetParameter(nameof(PcbID), PcbID)
|
||||
.ExecuteReader(x => new string[]
|
||||
{
|
||||
$"{x.GetInt()}", // SerialNr,
|
||||
$"{x.GetInt()}", // FertigungsNr,
|
||||
$"{x.GetLong()}", // RadioAddress,
|
||||
$"{x.GetValue<int?>()}", // CustomerSerialNr,
|
||||
$"{x.GetString()}", // CalibrationRunID,
|
||||
$"{x.GetValue<byte>()}", // LastProcessState,
|
||||
$"{x.GetInt()}", // Dn,
|
||||
$"{x.GetInt()}", // NewNennweiteID,
|
||||
$"{x.GetValue<int?>()}", // LutCrc
|
||||
$"{x.GetValue<int?>()}", // Fwversion
|
||||
$"{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<Byte>(5)}", // LastProcessState,
|
||||
$"{x.GetValue<Int32>(6)}", // Dn,
|
||||
$"{x.GetValue<Int32>(7)}", // NewNennweiteID,
|
||||
$"{x.GetValue<Int32?>(8)}", // LutCrc
|
||||
$"{x.GetValue<Int32?>(9)}", // Fwversion
|
||||
});
|
||||
|
||||
if (results.Count() == 1)
|
||||
@@ -203,9 +165,9 @@
|
||||
.SetParameter(nameof(pcbId), pcbId)
|
||||
.FirstOrDefault(x => new CordonelCalibration
|
||||
{
|
||||
PcbId = x.GetInt(),
|
||||
TestRunNr = x.GetInt(),
|
||||
Offset = x.GetValue<double>()
|
||||
PcbId = x.GetValue<Int32>(0),
|
||||
TestRunNr = x.GetValue<Int32>(1),
|
||||
Offset = x.GetValue<Double>(2)
|
||||
});
|
||||
|
||||
return this.Ok();
|
||||
|
||||
Reference in New Issue
Block a user