This commit is contained in:
Thomas Wiedebusch
2022-09-01 10:10:47 +02:00
29 changed files with 417 additions and 391 deletions
+1 -1
View File
@@ -155,7 +155,7 @@
</site> </site>
<site name="MeterProcessState" id="2"> <site name="MeterProcessState" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool"> <application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\laa_production\Common\Service\MeterProcessState" /> <virtualDirectory path="/" physicalPath="C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:56011:localhost" /> <binding protocol="http" bindingInformation="*:56011:localhost" />
+2 -2
View File
@@ -6,13 +6,13 @@
<appSettings> <appSettings>
<add key="PickingSlot" value="1"/> <add key="PickingSlot" value="1"/>
<add key="PickingBarcode" value="COM22"/> <add key="PickingBarcode" value="COM20"/>
<add key="LeakSlot" value="2"/> <add key="LeakSlot" value="2"/>
<add key="LeakStationId" value="1"/> <add key="LeakStationId" value="1"/>
<add key="MarriageSlot" value="4"/> <add key="MarriageSlot" value="4"/>
<add key="MarriageBarcode" value="COM19"/> <add key="MarriageBarcode" value="COM21"/>
</appSettings> </appSettings>
@@ -24,6 +24,8 @@ namespace Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol
public abstract List<Byte> DecodeDataForLogicLayer(List<Byte> rawData); public abstract List<Byte> DecodeDataForLogicLayer(List<Byte> rawData);
public abstract List<byte> DecodeDataForPhysicalLayerUI1236(byte[] payload);
} }
} }
@@ -22,6 +22,8 @@ namespace Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol
/// </summary> /// </summary>
void SetDefaultResponseTimeout(); void SetDefaultResponseTimeout();
List<byte> DecodeDataForPhysicalLayerUI1236(byte[] payload);
/// <summary> /// <summary>
/// Send out data (including transport protocol specific data like CRC) to physical port (like UART or IrDA) /// Send out data (including transport protocol specific data like CRC) to physical port (like UART or IrDA)
/// </summary> /// </summary>
@@ -169,5 +169,25 @@ namespace Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol
return irdaRecord; return irdaRecord;
} }
public override List<byte> DecodeDataForPhysicalLayerUI1236(byte[] requestProtocolPayload)
{
List<byte> collection = new List<byte>()
{
(byte) 35,
(byte) (requestProtocolPayload.Length / 2)
};
collection.AddRange((IEnumerable<byte>)requestProtocolPayload);
ushort reversedLsb8408 = Xylem.Common.Utils.Crc16Ccitt.Crc16Ccitt.CalculateReversedLsb8408(collection.ToArray());
List<byte> byteList = new List<byte>()
{
(byte) 155
};
byteList.AddRange((IEnumerable<byte>)collection);
byteList.Add((byte)((uint)reversedLsb8408 & (uint)byte.MaxValue));
byteList.Add((byte)((uint)reversedLsb8408 >> 8));
this.Logger.Info("DecodeDataForPhysicalLayerUI1236 PC->Cordonel(" + BitConverter.ToString(byteList.ToArray()) + ")");
return byteList;
}
} }
} }
@@ -47,5 +47,7 @@ namespace Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol
{ {
return rawData; return rawData;
} }
public override List<byte> DecodeDataForPhysicalLayerUI1236(byte[] payload) => throw new ApplicationException("Streaming port cannot send data");
} }
} }
@@ -144,7 +144,22 @@ namespace Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol
return uartRecord; return uartRecord;
} }
public override List<byte> DecodeDataForPhysicalLayerUI1236(byte[] requestProtocolPayload)
{
List<byte> byteList1 = new List<byte>();
List<byte> list = ((IEnumerable<byte>)requestProtocolPayload).ToList<byte>();
List<byte> byteList2 = new List<byte>();
byteList1.Add((byte)(requestProtocolPayload.Length + 4 + 2));
byteList1.Add((byte)0);
byteList1.Add((byte)0);
ushort num = this.CrcCalc(byteList1, list);
byteList2.Add((byte)91);
byteList2.AddRange((IEnumerable<byte>)byteList1);
byteList2.Add((byte)((uint)num & (uint)byte.MaxValue));
byteList2.Add((byte)((uint)num >> 8));
byteList2.AddRange((IEnumerable<byte>)list);
return byteList2;
}
} }
} }
@@ -1878,6 +1878,16 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
} }
} }
public byte[] SendUI1236Command(byte[] UI1236Frame,bool waitForResult = true,bool checkRegister = false,ushort skipRetryErrorCode = 4)
{
this._logger.Info(string.Format("Slot:{0} - Sending Ui-1236 frame: {1} ", (object)this.Slot, (object)UI1236Frame));
RequestRecord sendFifoUi1236 = this.RequestProtocol.AddRecordToSendFifoUI1236(UI1236Frame);
this.RequestProtocolProcess();
return sendFifoUi1236.ResponsePayload.ToArray();
}
#endregion #endregion
#region Class handling #region Class handling
@@ -11,6 +11,8 @@ using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.ProtocolCore; using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.ProtocolCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol.Consts; using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers; using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol;
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol namespace Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol
{ {
@@ -305,6 +307,27 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol
return recordForSendFifo; return recordForSendFifo;
} }
public RequestRecord AddRecordToSendFifoUI1236(
byte[] payload,
RegisterDefinition register = null,
bool hideDataInLog = false,
ushort skipRetryErrorCode = 4)
{
byte maxValue = byte.MaxValue;
List<byte> requestProtocolData = new List<byte>()
{
maxValue
};
requestProtocolData.AddRange((IEnumerable<byte>)payload);
ITransmitProtocol transmitProtocol = this.GetTransmitProtocol();
List<byte> encodedRequestData = transmitProtocol.DecodeDataForPhysicalLayerUI1236(payload);
TransmitPortSettings transmitPortSettings = transmitProtocol.GetTransmitPortSettings();
RequestRecord sendFifoUi1236 = new RequestRecord(maxValue, requestProtocolData, encodedRequestData, transmitPortSettings.ResponseTimeoutMs, register, hideDataInLog, skipRetryErrorCode);
this._recordsSendFifo.Enqueue(sendFifoUi1236);
return sendFifoUi1236;
}
/// <summary> /// <summary>
/// Called after successful response. /// Called after successful response.
/// Decode and check record, handle Errors and dispatch result. /// Decode and check record, handle Errors and dispatch result.
@@ -1 +1 @@
5ed75d99ee45ff67821090f1b3dbb001dd9e4fe3 46bd00889699f5a20a4981a22f62b66368323855
@@ -3,7 +3,9 @@ namespace Xylem.Common.Logic.ProductionOrderCore.KitronTestResults
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
public partial class RadioTest public partial class RadioTest
@@ -271,305 +273,75 @@ namespace Xylem.Common.Logic.ProductionOrderCore.KitronTestResults
} }
alternateReturnObj.StartDt = newFromat.JsonObject.StartDT; alternateReturnObj.StartDt = newFromat.JsonObject.StartDT;
alternateReturnObj.TestStepLoopCalibrate = new TestStep(); alternateReturnObj.TestStepLoopCalibrate = new TestStep();
alternateReturnObj.TestStepLoopCalibrate.Values = new Value[12]; alternateReturnObj.TestStepLoopCalibrate.Values = new Value[23];
var add = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value(); var TestStepLoopCalibrateToAdd = new List<Value>();
add.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop1;
add.LengthCode = newFromat.JsonObject.LengthCodeLoop1; JObject joResponse = JObject.Parse(json);
add.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop1; var Hit = true;
add.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop1;
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add, 0);
var add2 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value(); int loopCount = 0;
add2.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop2; foreach (var item in joResponse["JsonObject"].Children())
add2.LengthCode = newFromat.JsonObject.LengthCodeLoop2;
add2.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add2.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop2;
add2.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop2;
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add2, 1);
var add3 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add3.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop3;
add3.LengthCode = newFromat.JsonObject.LengthCodeLoop3;
add3.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add3.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop3;
add3.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop3;
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add3, 2);
var add4 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add4.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop4;
add4.LengthCode = newFromat.JsonObject.LengthCodeLoop4;
add4.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add4.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop4;
add4.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop4;
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add4, 3);
var add5 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add5.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop5;
add5.LengthCode = newFromat.JsonObject.LengthCodeLoop5;
add5.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add5.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop5;
add5.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop5;
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add5, 4);
var add6 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add6.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop6;
add6.LengthCode = newFromat.JsonObject.LengthCodeLoop6;
add6.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add6.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop6;
add6.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop6;
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add6, 5);
var add7 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add7.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop7;
add7.LengthCode = newFromat.JsonObject.LengthCodeLoop7;
add7.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add7.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop7;
add7.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop7;
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add7, 6);
var add8 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add8.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop8;
add8.LengthCode = newFromat.JsonObject.LengthCodeLoop8;
add8.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add8.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop8;
add8.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop8;
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add8, 7);
var add9 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add9.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop9;
add9.LengthCode = newFromat.JsonObject.LengthCodeLoop9;
add9.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add9.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop9;
add9.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop9;
if (add9.ResultCalibration == null)
{ {
return alternateReturnObj;
if (item is JProperty pitem)
{
if (pitem.Name == $"ResultCalibration Loop_{loopCount +1}")
{
if (pitem.Value.ToString() == "ok")
{
TestStepLoopCalibrateToAdd.Add(new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value());
TestStepLoopCalibrateToAdd[loopCount].ResultCalibration = pitem.Value.ToString();
TestStepLoopCalibrateToAdd[loopCount].SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
loopCount = loopCount + 1;
}
}
if (pitem.Name == $"LengthCode Loop_{loopCount}")
{
if (TestStepLoopCalibrateToAdd.Count == loopCount)
{
TestStepLoopCalibrateToAdd[loopCount-1].LengthCode = pitem.Value.ToString();
}
}
if (pitem.Name == $"PowerLevelCalculated Loop_{loopCount}")
{
if (TestStepLoopCalibrateToAdd.Count == loopCount)
{
TestStepLoopCalibrateToAdd[loopCount-1].IPowerLevelCalculated = pitem.Value.ToString();
}
}
if (pitem.Name == $"AntennaMatching Loop_{loopCount}")
{
if (TestStepLoopCalibrateToAdd.Count == loopCount)
{
TestStepLoopCalibrateToAdd[loopCount-1].IAntennaMatching = pitem.Value.ToString();
}
}
}
//if (item.Name
//{
//}
} }
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add9, 8); int i = 0;
foreach (var item in TestStepLoopCalibrateToAdd)
var add10 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add10.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop10;
add10.LengthCode = newFromat.JsonObject.LengthCodeLoop10;
add10.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add10.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop10;
add10.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop10;
if (add10.ResultCalibration == null)
{ {
return alternateReturnObj; alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(item, i);
i = i + 1;
} }
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add10, 9);
var add11 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add11.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop11;
add11.LengthCode = newFromat.JsonObject.LengthCodeLoop11;
add11.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add11.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop11;
add11.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop11;
if (add11.ResultCalibration == null)
{
return alternateReturnObj;
}
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add11, 10);
var add12 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add12.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop12;
add12.LengthCode = newFromat.JsonObject.LengthCodeLoop12;
add12.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add12.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop12;
add12.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop12;
if (add12.ResultCalibration == null)
{
return alternateReturnObj;
}
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add12, 11);
var add13 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add13.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop13;
add13.LengthCode = newFromat.JsonObject.LengthCodeLoop13;
add13.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add13.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop13;
add13.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop13;
if (add13.ResultCalibration == null)
{
return alternateReturnObj;
}
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add13, 12);
var add14 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add14.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop14;
add14.LengthCode = newFromat.JsonObject.LengthCodeLoop14;
add14.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add14.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop14;
add14.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop14;
if (add14.ResultCalibration == null)
{
return alternateReturnObj;
}
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add14, 13);
var add15 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add15.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop15;
add15.LengthCode = newFromat.JsonObject.LengthCodeLoop15;
add15.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add15.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop15;
add15.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop15;
if (add15.ResultCalibration == null)
{
return alternateReturnObj;
}
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add15, 14);
var add16 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add16.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop16;
add16.LengthCode = newFromat.JsonObject.LengthCodeLoop16;
add16.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add16.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop16;
add16.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop16;
if (add16.ResultCalibration == null)
{
return alternateReturnObj;
}
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add16, 15);
var add17 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add17.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop17;
add17.LengthCode = newFromat.JsonObject.LengthCodeLoop17;
add17.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add17.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop17;
add17.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop17;
if (add17.ResultCalibration == null)
{
return alternateReturnObj;
}
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add17, 16);
var add18 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add18.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop18;
add18.LengthCode = newFromat.JsonObject.LengthCodeLoop18;
add18.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add18.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop18;
add18.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop18;
if (add18.ResultCalibration == null)
{
return alternateReturnObj;
}
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add18, 17);
var add19 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add19.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop19;
add19.LengthCode = newFromat.JsonObject.LengthCodeLoop19;
add19.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add19.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop19;
add19.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop19;
if (add19.ResultCalibration == null)
{
return alternateReturnObj;
}
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add19, 18);
var add20 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add20.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop20;
add20.LengthCode = newFromat.JsonObject.LengthCodeLoop20;
add20.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add20.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop20;
add20.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop20;
if (add20.ResultCalibration == null)
{
return alternateReturnObj;
}
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add20, 19);
var add21 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add21.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop21;
add21.LengthCode = newFromat.JsonObject.LengthCodeLoop21;
add21.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add21.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop21;
add21.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop21;
if (add21.ResultCalibration == null)
{
return alternateReturnObj;
}
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add21, 20);
var add22 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add22.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop22;
add22.LengthCode = newFromat.JsonObject.LengthCodeLoop22;
add22.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add22.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop22;
add22.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop22;
if (add22.ResultCalibration == null)
{
return alternateReturnObj;
}
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add22, 21);
var add23 = new Xylem.Common.Logic.ProductionOrderCore.KitronTestResults.Value();
add23.ResultCalibration = newFromat.JsonObject.ResultCalibrationLoop23;
add23.LengthCode = newFromat.JsonObject.LengthCodeLoop23;
add23.SLookupTablePower = newFromat.JsonObject.AttachmentFile.ToLower();
add23.IPowerLevelCalculated = newFromat.JsonObject.PowerLevelCalculatedLoop23;
add23.IAntennaMatching = newFromat.JsonObject.AntennaMatchingLoop23;
if (add23.ResultCalibration == null)
{
return alternateReturnObj;
}
alternateReturnObj.TestStepLoopCalibrate.Values.SetValue(add23, 22);
return alternateReturnObj; return alternateReturnObj;
} }
+18 -13
View File
@@ -6,8 +6,8 @@
xmlns:local="clr-namespace:ProductionUiCordonel" xmlns:local="clr-namespace:ProductionUiCordonel"
xmlns:uc="clr-namespace:ProductionUiCordonel" xmlns:uc="clr-namespace:ProductionUiCordonel"
mc:Ignorable="d" mc:Ignorable="d"
Title="FinalTest" MinHeight="500" MinWidth="400" Height="603" Width="646" Initialized="Window_Initialized" Closing="Window_Closing"> Title="FinalTest" MinHeight="500" MinWidth="600" Height="638" Width="800" Initialized="Window_Initialized" Closing="Window_Closing" PreviewKeyDown="Window_PreviewKeyDown">
<DockPanel HorizontalAlignment="Stretch" Width="634" Height="569" VerticalAlignment="Top" Margin="0,0,2,0"> <DockPanel HorizontalAlignment="Stretch" Width="800" Height="600" VerticalAlignment="Top" Margin="0,0,2,0">
<ToolBarTray DockPanel.Dock="Top" Visibility="Collapsed"> <ToolBarTray DockPanel.Dock="Top" Visibility="Collapsed">
<ToolBar> <ToolBar>
<Label>Slot:</Label> <Label>Slot:</Label>
@@ -75,18 +75,19 @@
<RowDefinition Height="30"/> <RowDefinition Height="30"/>
<RowDefinition Height="30"/> <RowDefinition Height="30"/>
<RowDefinition Height="30"/> <RowDefinition Height="30"/>
<RowDefinition Height="238" MinHeight="150"/> <RowDefinition Height="255" MinHeight="150"/>
<RowDefinition Height="28"/> <RowDefinition Height="38"/>
<RowDefinition Height="28"/> <RowDefinition Height="34"/>
<RowDefinition MinHeight="50"/> <RowDefinition MinHeight="50"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="125" Width="125*"/> <ColumnDefinition MinWidth="125" Width="125*"/>
<ColumnDefinition MinWidth="148" Width="158*"/> <ColumnDefinition MinWidth="148" Width="158*"/>
<ColumnDefinition MinWidth="125" Width="221*" /> <ColumnDefinition MinWidth="125" Width="172*" />
<ColumnDefinition Width="49*"/>
<ColumnDefinition MinWidth="100" Width="130*"/> <ColumnDefinition MinWidth="100" Width="130*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Button Name="btnStart" IsEnabled="False" Content="Start" Click="ButtonBase_OnClick" HorizontalAlignment="Left" Height="58" Margin="0,0,0,1" VerticalAlignment="Bottom" Width="122" Grid.Row="0" Grid.Column="3" Grid.RowSpan="2" /> <!--<Button Name="btnStart" IsEnabled="False" Content="Start" Click="ButtonBase_OnClick" HorizontalAlignment="Left" Height="58" Margin="0,0,0,1" VerticalAlignment="Bottom" Width="122" Grid.Row="0" Grid.Column="4" Grid.RowSpan="2" />-->
<Label Content="SerialNumber" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" Height="26" Width="82" /> <Label Content="SerialNumber" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" Height="26" Width="82" />
<Label Content="RadioAdress" HorizontalAlignment="Left" Margin="10,2,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" Height="26" Width="76" /> <Label Content="RadioAdress" HorizontalAlignment="Left" Margin="10,2,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" Height="26" Width="76" />
<Label Content="OrderNumber" HorizontalAlignment="Left" Margin="10,3,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" Height="26" Width="84" /> <Label Content="OrderNumber" HorizontalAlignment="Left" Margin="10,3,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" Height="26" Width="84" />
@@ -95,16 +96,20 @@
<Label Content="" Name="lblSerialNumber" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="0" Grid.Column="1" Height="26" Width="240" Grid.ColumnSpan="2" /> <Label Content="" Name="lblSerialNumber" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="0" Grid.Column="1" Height="26" Width="240" Grid.ColumnSpan="2" />
<Label Content="" Name="lblRadioAdress" HorizontalAlignment="Left" Margin="10,2,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="1" Height="26" Width="221" Grid.ColumnSpan="2" /> <Label Content="" Name="lblRadioAdress" HorizontalAlignment="Left" Margin="10,2,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="1" Height="26" Width="221" Grid.ColumnSpan="2" />
<Label Content="" Name="lblOrderNumber" HorizontalAlignment="Left" Margin="10,3,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="1" Height="26" Width="221" Grid.ColumnSpan="2" /> <Label Content="" Name="lblOrderNumber" HorizontalAlignment="Left" Margin="10,3,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="1" Height="26" Width="221" Grid.ColumnSpan="2" />
<TextBox Text="" Name="txtInputHidden" HorizontalAlignment="Left" Margin="10,3,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="3" Height="26" Width="6" />
<Label Content="Status" HorizontalAlignment="Left" Margin="10,3,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" Height="26" Width="84" /> <Label Content="Status" HorizontalAlignment="Left" Margin="10,3,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" Height="26" Width="84" />
<Label Content="Warte auf Zähler" Name="lblCurrentProcess" Margin="10,3,10,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" Height="26" RenderTransformOrigin="0.607,0.577" /> <Label Content="Warte auf Zähler" Name="lblCurrentProcess" Margin="10,3,10,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="4" Height="26" RenderTransformOrigin="0.607,0.577" />
<DataGrid Name="dgTotalProcess" ItemsSource="{Binding}" AutoGenerateColumns="True" HorizontalAlignment="Left" Margin="10,4,0,5" Width="267" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="2" Grid.RowSpan="2" SelectionMode="Single" IsReadOnly="True" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserSortColumns="False" IsEnabled="False"/> <DataGrid Name="dgTotalProcess" ItemsSource="{Binding}" AutoGenerateColumns="True" Margin="10,4,30,5" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="2" Grid.RowSpan="2" SelectionMode="Single" IsReadOnly="True" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserSortColumns="False" IsEnabled="False"/>
<DockPanel Name="dpSubProcess" Grid.Column="2" Margin="18,12,8,8" Grid.Row="4" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.ColumnSpan="2"/> <StackPanel Name="dpSubProcess" Grid.Column="2" Margin="18,12,8,8" Grid.Row="4" VerticalAlignment="Stretch" HorizontalAlignment="Left" Grid.ColumnSpan="3">
</StackPanel>
<TextBox Name="txtLog" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="7" TextWrapping="Wrap" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,73,10" /> <TextBox Name="txtLog" Grid.Column="0" Grid.ColumnSpan="5" Grid.Row="7" TextWrapping="Wrap" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,10,73,38" />
<ProgressBar Name="pbTotalProgress" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="6" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,73,0" /> <ProgressBar Name="pbTotalProgress" Grid.Column="0" Grid.ColumnSpan="5" Grid.Row="6" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,73,0" />
<ProgressBar Name="pbSubProgress" Grid.ColumnSpan="2" Grid.Column="2" Grid.Row="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,73,0"/> <ProgressBar Name="pbSubProgress" Grid.ColumnSpan="3" Grid.Column="2" Grid.Row="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,73,0"/>
<Button x:Name="btnDetect" IsEnabled="false" Content="Detect" Click="BtnDetect_Click" HorizontalAlignment="Left" Height="58" Margin="97,0,0,0" VerticalAlignment="Bottom" Width="114" Grid.Row="0" Grid.Column="2" Grid.RowSpan="2" /> <Button x:Name="btnDetect" IsEnabled="false" Content="Detect" Click="BtnDetect_Click" HorizontalAlignment="Left" Height="58" Margin="97,0,0,0" VerticalAlignment="Bottom" Width="114" Grid.Row="0" Grid.Column="2" Grid.RowSpan="2" />
</Grid> </Grid>
+89 -24
View File
@@ -2,12 +2,14 @@
using ProductionUiCordonel.ProductionProcesses; using ProductionUiCordonel.ProductionProcesses;
using ProductionUiCordonel.ProductionProcesses.Actions; using ProductionUiCordonel.ProductionProcesses.Actions;
using ProductionUiCordonel.ProductionProcesses.Enum; using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Timers; using System.Timers;
using System.Windows; using System.Windows;
@@ -30,6 +32,7 @@ namespace ProductionUiCordonel
public event EventHandler OnLockMeter; public event EventHandler OnLockMeter;
public event EventHandler OnReleaseMeter; public event EventHandler OnReleaseMeter;
public event EventHandler OrderHasChanged; public event EventHandler OrderHasChanged;
public event EventHandler KeyInputMainFrom;
#region prop #region prop
private GenesisMeter genesisMeter; private GenesisMeter genesisMeter;
@@ -129,7 +132,7 @@ namespace ProductionUiCordonel
public FinalRadioTest() public FinalRadioTest()
{ {
InitializeComponent(); InitializeComponent();
SetUpBlank(); SetUpBlank(false);
@@ -413,9 +416,9 @@ namespace ProductionUiCordonel
} }
tmrAutoDetect.Enabled = Settings.AutoDetect; tmrAutoDetect.Enabled = Settings.AutoDetect;
} }
ProductionProcessCheckOrderNumber orderBarcode;
ProductionProcessCheckSerialNumber serialBarcode;
public void SetUpBlank() public void SetUpBlank(bool retry, bool abort =false)
{ {
pc.Processes = new List<IProductionProcess>(); pc.Processes = new List<IProductionProcess>();
@@ -428,13 +431,17 @@ namespace ProductionUiCordonel
var CheckOrder = new ProductionProcessCheckOrderNumber(OrderNumber); orderBarcode = new ProductionProcessCheckOrderNumber(OrderNumber);
CheckOrder.isDone += CheckOrder_isDone;
pc.Processes.Add(CheckOrder); //[x] [x] [x] orderBarcode.isDone += CheckOrder_isDone;
pc.Processes.Add(new ProductionProcessCheckSerialNumber(SerialNumber)); //[x] [x] [x]
pc.Processes.Add(orderBarcode); //[x] [x] [x]
serialBarcode = new ProductionProcessCheckSerialNumber(SerialNumber);
pc.Processes.Add(serialBarcode); //[x] [x] [x]
//pc.Processes.Add(new ProductionProcessFullReadOut()); //[x] [x] [x] //pc.Processes.Add(new ProductionProcessFullReadOut()); //[x] [x] [x]
pc.Processes.Add(new ProductionCheckShippingState()); //[x] [x] [x] pc.Processes.Add(new ProductionCheckShippingState()); //[x] [x] [x]
pc.Processes.Add(new ProductionProcessPasswordFile()); //[x] [x] [x] pc.Processes.Add(new ProductionProcessPasswordFile()); //[x] [x] [x]
@@ -443,7 +450,7 @@ namespace ProductionUiCordonel
//pc.Processes.Add(new ProductionProcessFinalParameterizationFix()); //[x] [x] [] //pc.Processes.Add(new ProductionProcessFinalParameterizationFix()); //[x] [x] []
pc.Processes.Add(new ProductionProcessFinalParameterizationVakoCsd(connectProcess)); //[x] [x] [] pc.Processes.Add(new ProductionProcessFinalParameterizationVakoCsd(connectProcess)); //[x] [x] []
var radioCheck = new ProductionProcessRadioCheck(); var radioCheck = new ProductionProcessRadioCheck();
CheckOrder.isDone += delegate (object sender, EventArgs e) orderBarcode.isDone += delegate (object sender, EventArgs e)
{ {
radioCheck.Ordernumber = ((ProductionProcessCheckOrderNumber)sender).Ordernumber; radioCheck.Ordernumber = ((ProductionProcessCheckOrderNumber)sender).Ordernumber;
}; };
@@ -460,7 +467,7 @@ namespace ProductionUiCordonel
pc.Processes.Add(new ProductionProcessLogOff()); //[] [] [] pc.Processes.Add(new ProductionProcessLogOff()); //[] [] []
var checkAttach = new ProductionProcessCheckAttachment(OrderNumber); var checkAttach = new ProductionProcessCheckAttachment(OrderNumber);
CheckOrder.isDone += (x, g) => orderBarcode.isDone += (x, g) =>
{ {
checkAttach.OrderNumber = ((ProductionProcessCheckOrderNumber)x).Ordernumber; ; checkAttach.OrderNumber = ((ProductionProcessCheckOrderNumber)x).Ordernumber; ;
}; };
@@ -473,13 +480,21 @@ namespace ProductionUiCordonel
var successeP = new ProductionProcessDone(false); var successeP = new ProductionProcessDone(false);
successeP.isDone += allProcessesDone; successeP.isDone += allProcessesDone;
pc.DoneProcess = successeP; pc.DoneProcess = successeP;
updateStatusGrid(); updateStatusGrid();
UiElmEnable(btnDetect, true); UiElmEnable(btnDetect, true);
if (retry)
{
runDetect();
}
else if(abort)
{
dpSubProcess.Children.Clear();
}
} }
private void CheckOrder_isDone(object sender, EventArgs e) private void CheckOrder_isDone(object sender, EventArgs e)
@@ -497,12 +512,20 @@ namespace ProductionUiCordonel
OrderHasChanged?.Invoke(this, e); OrderHasChanged?.Invoke(this, e);
} }
private void allProcessesDone(object sender, EventArgs e)
private void allProcessesDone(object sender, Tuple<bool,bool, bool> e)
{ {
detectIsLocked = false; detectIsLocked = false;
SetUpBlank(); if (e.Item3)
{
printErrorNote();
}
SetUpBlank(e.Item1,e.Item2);
} }
private void meterHasChanged(GenesisMeter oldMeter, GenesisMeter newMeter) private void meterHasChanged(GenesisMeter oldMeter, GenesisMeter newMeter)
{ {
if (newMeter == null && oldMeter == null) if (newMeter == null && oldMeter == null)
@@ -513,7 +536,6 @@ namespace ProductionUiCordonel
{ {
//remove all //remove all
CurrentProcess = "Warte auf Zähler"; CurrentProcess = "Warte auf Zähler";
UiElmEnable(btnStart, false);
UiElmEnable(btnDetect, true); UiElmEnable(btnDetect, true);
Task.Run(() => { LoadDetails(); }); Task.Run(() => { LoadDetails(); });
return; return;
@@ -524,7 +546,6 @@ namespace ProductionUiCordonel
return; return;
} }
UiElmEnable(btnStart, true);
UiElmEnable(btnDetect, false); UiElmEnable(btnDetect, false);
CurrentProcess = "Bitte den Startknopf drücken"; CurrentProcess = "Bitte den Startknopf drücken";
Task.Run(() => { LoadDetails(); }); Task.Run(() => { LoadDetails(); });
@@ -554,7 +575,7 @@ namespace ProductionUiCordonel
{ {
if (e != null) if (e != null)
{ {
txtLog.Text = e.Data; txtLog.Text = e.Data + System.Environment.NewLine + txtLog.Text;
} }
} }
)); ));
@@ -635,7 +656,7 @@ namespace ProductionUiCordonel
{ {
dpSubProcess.Children.Clear(); dpSubProcess.Children.Clear();
dpSubProcess.Children.Add(c); dpSubProcess.Children.Add(c);
DockPanel.SetDock(c, Dock.Top & Dock.Left & Dock.Right); DockPanel.SetDock(c, Dock.Top & Dock.Left);
} }
)); ));
@@ -657,11 +678,7 @@ namespace ProductionUiCordonel
private void ButtonBase_OnClick(Object sender, RoutedEventArgs e) private void ButtonBase_OnClick(Object sender, RoutedEventArgs e)
{ {
OnLockMeter?.Invoke(sender, EventArgs.Empty);
btnStart.IsEnabled = false;
CurrentGenesisMeter.SerialNumber = SerialNumber;
CurrentProcess = "gestartet";
pc.Start(CurrentGenesisMeter);
} }
@@ -704,10 +721,58 @@ namespace ProductionUiCordonel
Settings.Slot = (int)cbxSlotBox.SelectedValue; Settings.Slot = (int)cbxSlotBox.SelectedValue;
storeSetting(); storeSetting();
} }
private void runDetect()
{
var hasDetect = Detect(true, 1);
btnDetect.IsEnabled = false;
if (hasDetect)
{
OnLockMeter?.Invoke(null, EventArgs.Empty);
CurrentGenesisMeter.SerialNumber = SerialNumber;
CurrentProcess = "gestartet";
pc.Start(CurrentGenesisMeter);
}
}
private void BtnDetect_Click(object sender, RoutedEventArgs e) private void BtnDetect_Click(object sender, RoutedEventArgs e)
{ {
var hasDetect = Detect(true,1); runDetect();
}
private void printErrorNote()
{
var sb = new StringBuilder();
var fileName = $"{DateTime.Now.ToString("yyyyMMddHHmmss")}_ReturnNoteTxt_{lblPcbID.Content}.txt";
sb.AppendLine($"Aufallschein {DateTime.Now}");
sb.AppendLine($"----------------------------------");
sb.AppendLine($"PcbId {lblPcbID.Content}");
sb.AppendLine($"Auftrag {lblOrderNumber.Content}");
sb.AppendLine($"Seriennummer {lblSerialNumber.Content}");
sb.AppendLine($"Status {lblMessage.Text}");
sb.AppendLine($"-------------Meldung---------------");
sb.Append($"{txtLog.Text}");
File.WriteAllText(fileName, sb.ToString());
//txtLog.Text
System.Diagnostics.Process.Start(fileName);
}
private void Window_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
txtInputHidden.Focus();
if (e.Key == System.Windows.Input.Key.Enter)
{
if (serialBarcode?.GetUserControl() is UcBarcodeInput bar)
{
bar?.inputKey(txtInputHidden.Text);
}
if (orderBarcode?.GetUserControl() is UcBarcodeInput obar)
{
obar?.inputKey(txtInputHidden.Text);
}
txtInputHidden.Clear();
}
} }
} }
} }
@@ -425,7 +425,7 @@ namespace ProductionUiCordonel
private void UcFinalRadioTest_OnReleaseMeter(object sender, EventArgs e) private void UcFinalRadioTest_OnReleaseMeter(object sender, EventArgs e)
{ {
detectIsLocked = false; detectIsLocked = false;
ucFinalRadioTest.SetUpBlank(); ucFinalRadioTest.SetUpBlank(false);
} }
@@ -76,14 +76,15 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
UserControl.SetDesc(msg); UserControl.SetDesc(msg);
UserControl.SetFocusMe(); UserControl.SetFocusMe();
//UserControl.Focus(); //UserControl.Focus();
base.NewStatus(msg);
UserControl.BarcodeInput += UserControl_KeyDown; UserControl.BarcodeInput += UserControl_KeyDown;
} }
private void UserControl_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) private void UserControl_KeyDown(object sender, string input)
{ {
var a = UserControl.txtHiddenInput.Text; var a = input;
UserControl.txtHiddenInput.Text = ""; UserControl.txtHiddenInput.Text = "";
if (OldOrderNumber.HasValue && a == Ordernumber.ToString()) if (OldOrderNumber.HasValue && a == Ordernumber.ToString())
@@ -72,15 +72,16 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void StepMismatch(string msg) private void StepMismatch(string msg)
{ {
base.currentProcessState = ProductionProcessState.Error; base.currentProcessState = ProductionProcessState.Error;
base.NewStatus(msg);
isDone?.Invoke(this, EventArgs.Empty); isDone?.Invoke(this, EventArgs.Empty);
} }
private void UserControl_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) private void UserControl_KeyDown(object sender, string input)
{ {
var a = UserControl.txtHiddenInput.Text; var a = input;
UserControl.txtHiddenInput.Text = ""; UserControl.txtHiddenInput.Text = "";
if (a.Trim().Contains(PcbSerialNumber.Trim())) if (a.Trim().Contains(PcbSerialNumber.Trim()))
@@ -102,7 +103,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
} }
else else
{ {
StepMismatch($"Falsche oder fehlerhafter Scan! {Environment.NewLine} Dieser Zähler müsste die ({PcbSerialNumber}) haben"); StepMismatch($"Falsche oder fehlerhafter Scan! {Environment.NewLine} Dieser Zähler müsste die ({PcbSerialNumber}) haben. gescannt wurde {a}");
} }
} }
@@ -14,7 +14,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{ {
public class ProductionProcessDone : BaseProductionProcess public class ProductionProcessDone : BaseProductionProcess
{ {
public event EventHandler isDone; public event EventHandler<Tuple<bool,bool, bool>> isDone;
private UcDialog UserControl; private UcDialog UserControl;
public DialogResult Result = DialogResult.None; public DialogResult Result = DialogResult.None;
public enum DialogResult public enum DialogResult
@@ -56,13 +56,35 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void StepDone() private void StepDone()
{ {
base.currentProcessState = ProductionProcessState.Done; base.currentProcessState = ProductionProcessState.Done;
isDone?.Invoke(null, EventArgs.Empty); var retry = false;
var abort = false;
var print = false;
if (Error)
{
switch (Result)
{
case DialogResult.Retry:
retry = true;
break;
case DialogResult.Print:
abort = true;
print = true;
break;
case DialogResult.Abort:
abort = true;
break;
default:
break;
}
}
isDone?.Invoke(null, new Tuple<bool, bool,bool>(retry, abort, print));
} }
private void StepError() private void StepError(string ErrorText = "Ein Fehler ist aufgetreten")
{ {
UserControl.SetDesc("Errors occur"); UserControl.SetDesc(ErrorText);
var errorOptionList = new List<UcDialog.DialogOption>(); var errorOptionList = new List<UcDialog.DialogOption>();
var retry = new UcDialog.DialogOption("Wiederholen", "Alle Schritte werden wiederholt", () => var retry = new UcDialog.DialogOption("Wiederholen", "Alle Schritte werden wiederholt", () =>
{ {
@@ -79,7 +101,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}); });
var print = new UcDialog.DialogOption("Rückläuferschein drucken", "Rückläuferschein beim Zähler lassen und auf Klärung durch QS warten", () => var print = new UcDialog.DialogOption("Rückläuferschein drucken", "Rückläuferschein beim Zähler lassen und auf Klärung durch QS warten", () =>
{ {
Result = DialogResult.Retry; Result = DialogResult.Print;
StepDone(); StepDone();
}); });
@@ -6,6 +6,7 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Windows.Controls; using System.Windows.Controls;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
namespace ProductionUiCordonel.ProductionProcesses.Actions namespace ProductionUiCordonel.ProductionProcesses.Actions
{ {
@@ -71,7 +72,45 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
var SENSUSRADIO_ExtendedAlarmMask = Meter.ReadRegister("SENSUSRADIO_ExtendedAlarmMask"); var SENSUSRADIO_ExtendedAlarmMask = Meter.ReadRegister("SENSUSRADIO_ExtendedAlarmMask");
if (radioResetSuccess[0] == 0x02 && writeList.All(a => a == true) && SENSUSRADIO_MainAlarmMask[0] != 0) if (radioResetSuccess[0] == 0x02 && writeList.All(a => a == true) && SENSUSRADIO_MainAlarmMask[0] != 0)
{ {
base.currentProcessState = ProductionProcessState.Done; var _meterResetPsu = new MeterResetPsu(Meter)
{
StoreConfigEnable = true
};
var rebootSucceeded = _meterResetPsu.MeterResetPsuExecute();
var CheckValuesAufterBoot = new List<Tuple<string, byte[]>>();
CheckValuesAufterBoot.Add(new Tuple<string, byte[]>("METROLOGYASST_PulseLength", Meter.ReadRegister("METROLOGYASST_PulseLength")));
CheckValuesAufterBoot.Add(new Tuple<string, byte[]>("POWERMON_BatteryQuantity", Meter.ReadRegister("POWERMON_BatteryQuantity")));
CheckValuesAufterBoot.Add(new Tuple<string, byte[]>("GENESISFLOW_MeterSize", Meter.ReadRegister("GENESISFLOW_MeterSize")));
CheckValuesAufterBoot.Add(new Tuple<string, byte[]>("GENESISFLOW_CalFactor1", Meter.ReadRegister("GENESISFLOW_CalFactor1")));
CheckValuesAufterBoot.Add(new Tuple<string, byte[]>("SENSUSRADIO_RadioAddress", Meter.ReadRegister("SENSUSRADIO_RadioAddress")));
bool? hasDiffrences = null;
foreach (var item in CheckValuesAufterBoot)
{
if (!item.Item2.SequenceEqual(Meter.ReadRegister(item.Item1)))
{
hasDiffrences = true;
}
else
{
if (!hasDiffrences.HasValue)
{
hasDiffrences = false;
}
}
}
if (rebootSucceeded && hasDiffrences.HasValue && !hasDiffrences.Value)
{
base.currentProcessState = ProductionProcessState.Done;
}
else
{
Meter.WriteLog("reboot compare failed");
base.currentProcessState = ProductionProcessState.Error;
}
} }
else else
{ {
@@ -57,8 +57,12 @@ namespace ProductionUiCordonel.ProductionProcesses
AddProccessEvents(showLastStep); AddProccessEvents(showLastStep);
showLastStep.Start(meter, canncelToken.Token); showLastStep.Start(meter, canncelToken.Token);
RemoveProccessEvents(showLastStep); RemoveProccessEvents(showLastStep);
CalcAndPushOverAllProcess(); CalcAndPushOverAllProcess();
}); });
t.Start(); t.Start();
@@ -5,12 +5,12 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ProductionUiCordonel.UserControls.FinalTest" xmlns:local="clr-namespace:ProductionUiCordonel.UserControls.FinalTest"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="180" d:DesignWidth="320" MouseDown="UserControl_MouseDown" Background="AliceBlue"> d:DesignHeight="300" d:DesignWidth="420" MouseDown="UserControl_MouseDown">
<Grid Margin="0,0,0,0"> <Grid Margin="0,0,0,0">
<Label Content="" HorizontalAlignment="Left" Height="7" VerticalAlignment="Top" Width="264" Margin="10,0,0,0"/> <Label Content="" HorizontalAlignment="Left" Height="7" VerticalAlignment="Top" Width="264" Margin="10,0,0,0"/>
<Label Name="lblDescription" Content="" Margin="0,0,26,10" HorizontalAlignment="Right" Width="284" Height="129" VerticalAlignment="Bottom"/> <Label Name="lblDescription" Content="" Margin="17,53,0,0" HorizontalAlignment="Left" Width="423" Height="237" VerticalAlignment="Top"/>
<Label Content="Scanner Input" Margin="0,0,227,144" RenderTransformOrigin="0.5,0.5" MaxHeight="25" FontSize="10" Height="29" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="83" /> <Label Content="Scanner Input" Margin="0,0,334,259" RenderTransformOrigin="0.5,0.5" MaxHeight="25" FontSize="10" Height="29" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="83" />
<Label Name="lblInput" Background="Beige" Content="" Margin="0,0,74,144" FontSize="10" MaxHeight="25" MouseDown="LblInput_MouseDown" Height="24" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="168"/> <Label Name="lblInput" Background="Beige" Content="" Margin="0,0,161,259" FontSize="10" MaxHeight="25" MouseDown="LblInput_MouseDown" Height="24" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="168"/>
<TextBox Name="txtHiddenInput" KeyDown="txtHiddenInput_KeyDown" Margin="118,29,125,25" Width="0" > <TextBox Name="txtHiddenInput" KeyDown="txtHiddenInput_KeyDown" Margin="118,29,125,25" Width="0" >
@@ -1,18 +1,7 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading; using System.Windows.Threading;
namespace ProductionUiCordonel.UserControls.FinalTest namespace ProductionUiCordonel.UserControls.FinalTest
@@ -22,9 +11,9 @@ namespace ProductionUiCordonel.UserControls.FinalTest
/// </summary> /// </summary>
public partial class UcBarcodeInput : UserControl public partial class UcBarcodeInput : UserControl
{ {
public event EventHandler<KeyEventArgs> BarcodeInput; public event EventHandler<string> BarcodeInput;
public UcBarcodeInput() public UcBarcodeInput()
{ {
InitializeComponent(); InitializeComponent();
@@ -85,18 +74,28 @@ namespace ProductionUiCordonel.UserControls.FinalTest
)); ));
} }
public void inputKey(string input)
{
this.Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
{
BarcodeInput?.Invoke(this,input);
}
));
}
private void txtHiddenInput_KeyDown(object sender, KeyEventArgs e) private void txtHiddenInput_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Key == Key.Enter) //if (e.Key == Key.Enter)
{ //{
BarcodeInput?.Invoke(sender, e); // BarcodeInput?.Invoke(sender, e);
} //}
else //else
{ //{
lblInput.Content = txtHiddenInput.Text; // lblInput.Content = txtHiddenInput.Text;
} //}
} }
@@ -105,7 +104,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest
this.Dispatcher.Invoke(DispatcherPriority.Send, this.Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() => new Action(() =>
{ {
txtHiddenInput.Focus(); //txtHiddenInput.Focus();
} }
)); ));
} }
@@ -115,7 +114,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest
this.Dispatcher.Invoke(DispatcherPriority.Send, this.Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() => new Action(() =>
{ {
txtHiddenInput.Focus(); //txtHiddenInput.Focus();
} }
)); ));
} }
@@ -43,7 +43,7 @@
<Label Name="lblCordMax" Content="-" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="2" Grid.Column="3" VerticalAlignment="Top" Width="50" Grid.ColumnSpan="2"/> <Label Name="lblCordMax" Content="-" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="2" Grid.Column="3" VerticalAlignment="Top" Width="50" Grid.ColumnSpan="2"/>
<Label Name="lblSirtMax" Content="-" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="3" Grid.Column="3" VerticalAlignment="Top" Width="50"/> <Label Name="lblSirtMax" Content="-" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="3" Grid.Column="3" VerticalAlignment="Top" Width="50"/>
<Button Content="Done" IsEnabled="False" Name="BtnDone" HorizontalAlignment="Left" Height="25" Grid.Row="5" VerticalAlignment="Top" Width="100" Click="BtnDone_Click"/> <Button Content="Done" IsEnabled="False" Name="BtnDone" HorizontalAlignment="Left" Height="25" Grid.Row="5" VerticalAlignment="Top" Width="100" Click="BtnDone_Click"/>
<Button Content="Skip" IsEnabled="True" x:Name="BtnDone_Copy" HorizontalAlignment="Left" Height="25" Grid.Row="4" VerticalAlignment="Top" Width="100" Click="BtnDone_Copy_Click" /> <Button Content="Skip" IsEnabled="True" Visibility="Hidden" x:Name="BtnDone_Copy" HorizontalAlignment="Left" Height="25" Grid.Row="4" VerticalAlignment="Top" Width="100" Click="BtnDone_Copy_Click" />
<Button x:Name="btnfrocePam" Content="Force a PAM" Click="BtnfrocePam_Click" HorizontalAlignment="Left" Width="72" Grid.Row="5" Grid.Column="2" Margin="1,0,0,0" Grid.ColumnSpan="2"/> <Button x:Name="btnfrocePam" Content="Force a PAM" Click="BtnfrocePam_Click" HorizontalAlignment="Left" Width="72" Grid.Row="5" Grid.Column="2" Margin="1,0,0,0" Grid.ColumnSpan="2"/>
@@ -127,11 +127,16 @@ namespace Service.MeterProcessState.Controllers
var radio = OrderRadioParameter.GetRadioPramas(PcbID, GlobalConfig.connectionString.Value, withPressure ? "p" : ""); var radio = OrderRadioParameter.GetRadioPramas(PcbID, GlobalConfig.connectionString.Value, withPressure ? "p" : "");
if (radio != null) if (radio != null)
{ {
var builder = new StringBuilder();
foreach (var t in radio.EncryptionKey) if (radio.EncryptionKey != null)
{ {
builder.Append(t.ToString("x2")); var builder = new StringBuilder();
foreach (var t in radio.EncryptionKey)
{
builder.Append(t.ToString("x2"));
}
} }
return Request.CreateResponse(HttpStatusCode.OK, radio); return Request.CreateResponse(HttpStatusCode.OK, radio);
} }
else else
@@ -735,7 +735,7 @@ namespace Service.MeterProcessState.Controllers
ret.SkipRadioParameters = (bool)item["SkipRadioParameters"]; ret.SkipRadioParameters = (bool)item["SkipRadioParameters"];
ret.SkipFWCheck = (bool)item["SkipFWCheck"]; ret.SkipFWCheck = (bool)item["SkipFWCheck"];
ret.SkipBatteyCheck = (bool)item["SkipBatteyCheck"]; ret.SkipBatteyCheck = (bool)item["SkipBatteyCheck"];
ret.SkipBatteyCheck = (bool)item["SkipLUT"]; ret.SkipLUT = (bool)item["SkipLUT"];
ret.Date = (DateTime)item["Date"]; ret.Date = (DateTime)item["Date"];
ret.Name = item["Name"].ToString(); ret.Name = item["Name"].ToString();
} }
@@ -97,7 +97,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// <returns></returns> /// <returns></returns>
private bool GetLimitsFromDB(Int16 Frequenz, Int16 Nennweite, Int16 Baulaenge, Int16 BoxHead, int Variant_o, int Variant_p, out byte RSSI_Pam_Min, out byte RSSI_Pam_Max, out byte RSSI_SEMI_Min, out byte RSSI_SEMI_Max, out UInt32 LimitId) private bool GetLimitsFromDB(Int16 Frequenz, Int16 Nennweite, Int16 Baulaenge, Int16 BoxHead, int Variant_o, int Variant_p, out byte RSSI_Pam_Min, out byte RSSI_Pam_Max, out byte RSSI_SEMI_Min, out byte RSSI_SEMI_Max, out UInt32 LimitId)
{ {
string sql = $"SELECT top 1 * FROM [Cordonel_Radio_RSSI_Limits] WHERE [Box_Head]={BoxHead} and [Frequency] = {Frequenz} and [Nennweite] = {Nennweite} and [Baulaenge] = {Baulaenge} order by id desc "; //and [Variant_o] = {Variant_o} and [Variant_p] = {Variant_p} "; string sql = $"SELECT top 1 * FROM [Cordonel_Radio_RSSI_Limits] WHERE [Box_Head]={BoxHead} and [Frequency] = {Frequenz} and [Nennweite] = {Nennweite} and ([Baulaenge] = {Baulaenge} or [Baulaenge] = 0) order by id desc "; //and [Variant_o] = {Variant_o} and [Variant_p] = {Variant_p} ";
using (SqlCommand sqlcommand = new SqlCommand(sql, connection)) using (SqlCommand sqlcommand = new SqlCommand(sql, connection))
{ {
@@ -80,7 +80,7 @@ namespace Xylem.Common.Logic.SoftwareAccessHelper
{ {
var client = new RestClient(Url); var client = new RestClient(Url);
WebRequest.DefaultWebProxy = null;
var request = new RestRequest(Method.POST); var request = new RestRequest(Method.POST);
ServicePointManager.Expect100Continue = false; ServicePointManager.Expect100Continue = false;
@@ -124,7 +124,7 @@ namespace Xylem.Common.Logic.SoftwareAccessHelper
{ {
var client = new RestClient(Url); var client = new RestClient(Url);
WebRequest.DefaultWebProxy = null;
var request = new RestRequest(Method.POST); var request = new RestRequest(Method.POST);
ServicePointManager.Expect100Continue = false; ServicePointManager.Expect100Continue = false;
@@ -167,7 +167,7 @@ namespace Xylem.Common.Logic.SoftwareAccessHelper
{ {
var client = new RestClient(Url); var client = new RestClient(Url);
WebRequest.DefaultWebProxy = null;
var request = new RestRequest(Method.POST); var request = new RestRequest(Method.POST);
ServicePointManager.Expect100Continue = false; ServicePointManager.Expect100Continue = false;
@@ -217,6 +217,7 @@ namespace Xylem.Common.Logic.SoftwareAccessHelper
{ {
var client = new RestClient(Url); var client = new RestClient(Url);
WebRequest.DefaultWebProxy = null;
ServicePointManager.Expect100Continue = false; ServicePointManager.Expect100Continue = false;
var request = new RestRequest(Method.POST); var request = new RestRequest(Method.POST);
@@ -275,7 +276,7 @@ namespace Xylem.Common.Logic.SoftwareAccessHelper
{ {
var client = new RestClient(Url); var client = new RestClient(Url);
WebRequest.DefaultWebProxy = null;
var request = new RestRequest(Method.GET); var request = new RestRequest(Method.GET);
ServicePointManager.Expect100Continue = false; ServicePointManager.Expect100Continue = false;
if (!TimeoutMS.HasValue) if (!TimeoutMS.HasValue)
@@ -1 +1 @@
f64d563def603c89cafafa61a3219ba97e1e344c 81d60b90addc793525740e9993e19bf6665bd401
+2 -2
View File
@@ -15,7 +15,8 @@ namespace XylemCommonUiLegacyGenCtl
void AddMeter(string serialNumber, int slot); void AddMeter(string serialNumber, int slot);
void AddAllMeters(); void AddAllMeters();
void MeterDone(int slot, bool Succeed); void MeterDone(int slot, bool Succeed);
void MeterDoneWithDetails(int slot, bool Succeed, out string LutCrc, out bool MeterHasPreadjustment);
void SetErrorFrame(int slot, double errorFrame = 0.0); void SetErrorFrame(int slot, double errorFrame = 0.0);
void PrepareMeters(string meterDn = "-", double refPulseValence = 0.0, double predictedQFlow = 0.0, double predictedTs = 0.0, double refError = 0.0, bool isAdjustment = false, bool IsFlyingStartStop = true); void PrepareMeters(string meterDn = "-", double refPulseValence = 0.0, double predictedQFlow = 0.0, double predictedTs = 0.0, double refError = 0.0, bool isAdjustment = false, bool IsFlyingStartStop = true);
@@ -48,7 +49,6 @@ namespace XylemCommonUiLegacyGenCtl
bool IsBusy(); bool IsBusy();
void Dispose(bool fromCode); void Dispose(bool fromCode);
void SetTestSetupContainer(dynamic container); void SetTestSetupContainer(dynamic container);
+41 -3
View File
@@ -1,4 +1,5 @@
using ByteArrayStyle; using ByteArrayStyle;
using Newtonsoft.Json;
using NLog; using NLog;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
@@ -14,9 +15,11 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers; using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore; using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
using Xylem.Common.Logic.SoftwareAccessHelper;
using Xylem.Common.Metrology.Measurements; using Xylem.Common.Metrology.Measurements;
using Xylem.Common.Metrology.Measurements.Consts; using Xylem.Common.Metrology.Measurements.Consts;
using Xylem.Common.Utils.Logging; using Xylem.Common.Utils.Logging;
@@ -700,9 +703,39 @@ namespace XylemCommonUiLegacyGenCtl
} }
} }
public void MeterDoneWithDetails(int slot, bool Succeed, out string LutCrc, out bool MeterHasPreadjustment)
{
LutCrc = "";
MeterHasPreadjustment = false;
MeterDone(slot, Succeed);
var meter = batch.ListOfMeters.First(f => f.Slot == slot);
if (meter != null && meter is GenesisMeter gen)
{
LutCrc = gen.LutCrc;
try
{
var responseJson = LocalWebRequest.GetRequest($"{ServiceUrls.MeterInfoForTestBench()}{gen.PcbId}");
var a = JsonConvert.DeserializeObject<string[]>(responseJson);
var SerialNumber = a[0];
if (!String.IsNullOrEmpty(SerialNumber))
{
int tmp;
MeterHasPreadjustment = int.TryParse(a[4], out tmp);
}
}
catch (Exception)
{
throw;
}
}
}
public void MeterDone(int slot, bool Succeed)
public void MeterDone(int slot, bool Succeed)
{ {
try try
{ {
@@ -750,14 +783,19 @@ namespace XylemCommonUiLegacyGenCtl
if (!genMeter.IsLoggedOn) if (!genMeter.IsLoggedOn)
{ {
genMeter.Login(); genMeter.Login();
} }
genMeter.WriteRegister(Register.Genesisflow.SampleRate, 2); genMeter.WriteRegister(Register.Genesisflow.SampleRate, 2);
genMeter.WriteRegister(Register.Genesisflow.LedMode, 0,true); genMeter.WriteRegister(Register.Genesisflow.LedMode, 0,true);
meter.WriteLog($"MeterIsDone {state} {genMeter.LutCrc }");
}
else
{
meter.WriteLog($"MeterIsDone {state} ");
} }
meter.WriteLog($"MeterIsDone {state}");
}).ContinueWith(delegate }).ContinueWith(delegate
{ {