ProductionUiCordonel: - ASBL: - prepare status
This commit is contained in:
parent
c3391bf922
commit
89ca4e0fc3
@ -130,6 +130,9 @@ namespace Xylem.Common.CommonCore.Configuration
|
||||
private static readonly String DefaultGenesisGetKeySetIdServiceUrl =
|
||||
$"{ServerDns}/MeterProcessState/api/Password/getkeysetid?PcbId=";
|
||||
|
||||
private static readonly String DefaultGenesisSetPickingStateServiceUrl =
|
||||
$"{ServerDns}/MeterProcessState/api/ProccesState/SetPickingState?PcbID=";
|
||||
|
||||
private static readonly String DefaultGenesisGetPasswordServiceUrl =
|
||||
$"{ServerDns}/MeterProcessState/api/Password/GetPassword?PcbId=";
|
||||
|
||||
@ -725,6 +728,16 @@ namespace Xylem.Common.CommonCore.Configuration
|
||||
DefaultGenesisGetKeySetIdServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genesis get password url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static String GenesisSetPickingStateServiceUrl()
|
||||
{
|
||||
return ConfigurationManager.AppSettings["GenesisSetPickingStateServiceUrl"] ??
|
||||
DefaultGenesisSetPickingStateServiceUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genesis get password url
|
||||
/// </summary>
|
||||
|
||||
@ -19,6 +19,39 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
|
||||
private const Int32 moderateTimeoutDbRequest = 10000;
|
||||
private const Int32 hugeTimeoutDbRequest = 30000;
|
||||
|
||||
/// <summary>
|
||||
/// Set the picking state:
|
||||
/// - reserved = null,
|
||||
/// - successfully finished = 1,
|
||||
/// - failed = 0.
|
||||
/// </summary>
|
||||
/// <param name="pcbId"></param>
|
||||
/// <param name="orderNumber"></param>
|
||||
/// <param name="state">null, 1, 0</param>
|
||||
/// <returns>true if successful</returns>
|
||||
/// <remarks date="2025-Sep-25" author="Roland Drabesch/Thomas Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
public static Boolean SetCordonelPickingStateToDb(String pcbId, Int64 orderNumber, Int32? state = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var strState = state == null ? "null" : $"{state}";
|
||||
var url = ServiceUrls.GenesisSetPickingStateServiceUrl();
|
||||
url += $@"{pcbId}&FertigungsauftragsNr={orderNumber}&successful={strState}";
|
||||
var retString = LocalWebRequest.PostRequestAsyncAndGetContent(url, moderateTimeoutDbRequest);
|
||||
if (bool.TryParse(retString, out var result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all Cordonel serial numbers of a specific order.
|
||||
/// </summary>
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Xylem.Common.CommonCore.Consts;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
|
||||
using Resources = Xylem.Common.Production.ProductionUiCordonel.Properties.Resources;
|
||||
|
||||
@ -38,23 +39,25 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki
|
||||
return StatusReturn.Failed;
|
||||
}
|
||||
|
||||
SignalRunningState();
|
||||
SignalRunningState(5);
|
||||
Meter.ReLogin();
|
||||
Meter.SetProcessState(DisplayCodes.PickingStarted);
|
||||
Meter.Logout();
|
||||
|
||||
// Check mapping information
|
||||
if (!OrderDetailsDb.GetCordonelMapping(Meter.PcbId, out var cordonelMapping) ||
|
||||
cordonelMapping == null || cordonelMapping.Count == 0)
|
||||
{
|
||||
ErrorMsgDispatcher(Resources.StrErrorMsgMissingMappingInformation);
|
||||
return StatusReturn.Failed;
|
||||
return ErrorExit(Resources.StrErrorMsgMissingMappingInformation);
|
||||
}
|
||||
ActualProcessProgress++;
|
||||
|
||||
// Check if this meter is mapped to a different order
|
||||
if (cordonelMapping[0].CordonelAssignedPicking_FertigungsAuftragsNr != null &&
|
||||
cordonelMapping[0].CordonelAssignedPicking_FertigungsAuftragsNr != Meter.OrderNumber)
|
||||
{
|
||||
ErrorMsgDispatcher(Resources.StrErrorMsgMeterForOtherOrderAssigned +
|
||||
$": {cordonelMapping[0].CordonelAssignedPicking_FertigungsAuftragsNr}");
|
||||
return StatusReturn.Failed;
|
||||
return ErrorExit(Resources.StrErrorMsgMeterForOtherOrderAssigned +
|
||||
$": {cordonelMapping[0].CordonelAssignedPicking_FertigungsAuftragsNr}");
|
||||
}
|
||||
|
||||
// Check if meter is already married to a serial number on a previous run
|
||||
@ -66,13 +69,22 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki
|
||||
|
||||
// Reserve picking for this device to lock other assembly line software to assign another Cordonel to
|
||||
// this order.
|
||||
//TODO THW deactivated until WebAPI is implemented
|
||||
//if (!OrderDetailsDb.SetCordonelPickingStateToDb(Meter.PcbId, Meter.OrderNumber))
|
||||
//{
|
||||
// return ErrorExit(Resources.StrErrorMsgPickingReservationFailed);
|
||||
//}
|
||||
ActualProcessProgress++;
|
||||
|
||||
//TODO THW Read reservation status with GetOrderOverview to update the display
|
||||
ActualProcessProgress++;
|
||||
|
||||
// Get detailed order information to set e.g. the correct meter size needed for LUT installation
|
||||
if (!OrderDetailsDb.GetOrderDetails(Meter.OrderNumber, Meter.PcbId, out var orderDetails))
|
||||
{
|
||||
ErrorMsgDispatcher(Resources.StrErrorMsgMissingOrderInformation);
|
||||
return StatusReturn.Failed;
|
||||
return ErrorExit(Resources.StrErrorMsgMissingOrderInformation);
|
||||
}
|
||||
ActualProcessProgress++;
|
||||
|
||||
// Meter has to be connected in advance being able to overwrite the meter size. The meterSize will be
|
||||
// read out from Cordonel at Connect. This may be reassigned dependent on the orderDetails.MeterSize.
|
||||
@ -82,15 +94,13 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki
|
||||
Meter.EnablePropertyChangeAbility(true);
|
||||
if (!Meter.SetMeterSize((MeterSize)orderDetails.MeterSize))
|
||||
{
|
||||
ErrorMsgDispatcher(Resources.StrErrorMsgChangingMeterSizeFromOrderFailed);
|
||||
return StatusReturn.Failed;
|
||||
return ErrorExit(Resources.StrErrorMsgChangingMeterSizeFromOrderFailed);
|
||||
}
|
||||
SuccessMsgDispatcher(Resources.StrSuccessMsgChangedMeterSizeFromOrder + $": {Meter.MeterSize}");
|
||||
|
||||
if (!Meter.SetPressureSensorAssembled(orderDetails.PressurePresent))
|
||||
{
|
||||
ErrorMsgDispatcher(Resources.StrErrorMsgPressureSensorSetupFromOrderFailed);
|
||||
return StatusReturn.Failed;
|
||||
return ErrorExit(Resources.StrErrorMsgPressureSensorSetupFromOrderFailed);
|
||||
}
|
||||
var pressurePresent = Meter.PressureSensorAssembled
|
||||
? Resources.StrMsgPressureSensorApplied
|
||||
@ -100,5 +110,19 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki
|
||||
|
||||
return StatusReturn.Okay;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Common error exit method.
|
||||
/// </summary>
|
||||
/// <param name="errorMsg"></param>
|
||||
/// <returns></returns>
|
||||
private StatusReturn ErrorExit(String errorMsg)
|
||||
{
|
||||
Meter.ReLogin();
|
||||
Meter.SetProcessState(DisplayCodes.PickingFailed);
|
||||
Meter.Logout();
|
||||
ErrorMsgDispatcher(errorMsg);
|
||||
return StatusReturn.Failed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xylem.Common.CommonCore.Consts;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
|
||||
using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using Xylem.Common.Production.ProductionUiCordonel.Properties;
|
||||
using Xylem.Common.Production.ProductionUiCordonel.UserControls;
|
||||
@ -47,25 +49,37 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki
|
||||
/// <remarks date="2025-Jul-08" author="Thomas Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
/// <remarks date="2025-Sep-25" author="Thomas Wiedebusch">
|
||||
/// - Final result message, display and push to database.
|
||||
/// </remarks>
|
||||
public override StatusReturn ExecuteProcess()
|
||||
{
|
||||
try
|
||||
{
|
||||
_waitOnUserFeedback = true;
|
||||
SignalRunningState(MaxActualProgressSteps);
|
||||
|
||||
var ucDialog = (UcDialog)UserControl;
|
||||
|
||||
// Push progress will publish all application versions and the core version
|
||||
var retVal = Meter.PushProgress("Assembly", Version.ToString());
|
||||
if (retVal == StatusReturn.Failed)
|
||||
{
|
||||
return retVal;
|
||||
}
|
||||
// Set picking for this device as finished successfully.
|
||||
//TODO THW deactivated until WebAPI is implemented
|
||||
//if (StatusReturn.Failed == Meter.PushProgress("Assembly", Version.ToString()) ||
|
||||
// !OrderDetailsDb.SetCordonelPickingStateToDb(Meter.PcbId, Meter.OrderNumber, 1))
|
||||
//{
|
||||
// OrderDetailsDb.SetCordonelPickingStateToDb(Meter.PcbId, Meter.OrderNumber, 0);
|
||||
// Meter.Login();
|
||||
// Meter.SetProcessState(DisplayCodes.PickingFailed);
|
||||
// Meter.Logout();
|
||||
// ErrorMsgDispatcher(Resources.StrErrorMsgPickingFinalizationFailed);
|
||||
// return StatusReturn.Failed;
|
||||
//}
|
||||
ActualProcessProgress++;
|
||||
|
||||
|
||||
Meter.ReLogin();
|
||||
Meter.SetProcessState(DisplayCodes.PickingTested);
|
||||
Meter.Logout();
|
||||
|
||||
// Initialize the ucDialog
|
||||
_waitOnUserFeedback = true;
|
||||
var ucDialog = (UcDialog)UserControl;
|
||||
ucDialog.SetHeadline(Resources.StrStateAssemblyLineRelease);
|
||||
ucDialog.SetMessage(Resources.StrInfoMeterBoxing);
|
||||
var OptionList = new List<UcDialog.DialogOption>();
|
||||
|
||||
@ -708,6 +708,24 @@ namespace Xylem.Common.Production.ProductionUiCordonel.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ERROR: Assembly ready reporting for this Cordonel failed.
|
||||
/// </summary>
|
||||
internal static string StrErrorMsgPickingFinalizationFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("StrErrorMsgPickingFinalizationFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ERROR: Order reservation failed for this Cordonel.
|
||||
/// </summary>
|
||||
internal static string StrErrorMsgPickingReservationFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("StrErrorMsgPickingReservationFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ERROR: Pre- and flow-test status unknown.
|
||||
/// </summary>
|
||||
|
||||
@ -492,6 +492,12 @@
|
||||
</data>
|
||||
<data name="StrErrorMsgMeterForOtherOrderAssigned" xml:space="preserve">
|
||||
<value>FEHLER: Dieser Cordonel ist einem anderen Fertigungsauftrag zugeordnet</value>
|
||||
</data>
|
||||
<data name="StrErrorMsgPickingReservationFailed" xml:space="preserve">
|
||||
<value>FEHLER: Auftragsreservierung für diesen Cordonel fehlgeschlagen</value>
|
||||
</data>
|
||||
<data name="StrErrorMsgPickingFinalizationFailed" xml:space="preserve">
|
||||
<value>FEHLER: Montageabschlußmeldung für diesen Cordonel fehlgeschlagen</value>
|
||||
</data>
|
||||
<data name="StrErrorMsgMissingMappingInformation" xml:space="preserve">
|
||||
<value>FEHLER: Dieser Cordonel kann keinem Auftrag zugeordnet werden</value>
|
||||
|
||||
@ -492,6 +492,12 @@
|
||||
</data>
|
||||
<data name="StrErrorMsgMeterForOtherOrderAssigned" xml:space="preserve">
|
||||
<value>ERROR: This Cordonel is assigned to another production order</value>
|
||||
</data>
|
||||
<data name="StrErrorMsgPickingReservationFailed" xml:space="preserve">
|
||||
<value>ERROR: Order reservation failed for this Cordonel</value>
|
||||
</data>
|
||||
<data name="StrErrorMsgPickingFinalizationFailed" xml:space="preserve">
|
||||
<value>ERROR: Assembly ready reporting for this Cordonel failed</value>
|
||||
</data>
|
||||
<data name="StrErrorMsgMissingMappingInformation" xml:space="preserve">
|
||||
<value>ERROR: This Cordonel cannot be mapped to an order</value>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user