87 lines
2.7 KiB
C#
87 lines
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Windows.Controls;
|
|
using Newtonsoft.Json;
|
|
using ProductionUiCordonelLegacy.ProductionProcesses.Enum;
|
|
using ProductionUiCordonelLegacy.UserControls.FinalTest;
|
|
using Xylem.Common.CommonCore.Configuration;
|
|
using Xylem.Common.Logic.ProductionOrderCore;
|
|
using Xylem.Common.Logic.SoftwareAccessHelper;
|
|
|
|
namespace ProductionUiCordonelLegacy.ProductionProcesses.Actions
|
|
{
|
|
public class ProductionProcessGetFinalParametrizationVakoCsd : BaseProductionProcess
|
|
{
|
|
public IList<ProgrammingParameters> Result = new List<ProgrammingParameters>();
|
|
private UcPlain UserControl;
|
|
public ProductionProcessGetFinalParametrizationVakoCsd()
|
|
{
|
|
name = "Hole Kunden Parametrierung";
|
|
currentProcessState = ProductionProcessState.Waiting;
|
|
}
|
|
public override void InitUserControl()
|
|
{
|
|
UserControl = new UcPlain();
|
|
UserControl.lblHl.Content = name;
|
|
UserControl.lblText.Content = "Kann bis zu 1 Minute dauern!";
|
|
}
|
|
|
|
public override UserControl GetControl()
|
|
{
|
|
if (UserControl == null)
|
|
{
|
|
throw new Exception($"UserControl {GetType()} not Ready");
|
|
}
|
|
return UserControl;
|
|
}
|
|
|
|
|
|
public override void ProcessDone()
|
|
{
|
|
//clear
|
|
}
|
|
|
|
|
|
private void doStartProcessLoop()
|
|
{
|
|
var retriesRemaining = 2;
|
|
while (retriesRemaining >= 0)
|
|
{
|
|
try
|
|
{
|
|
Progress = 0;
|
|
//var url = $"http://localhost:56011/api/FinalCheck/GetProgrammingParameters?PcbID={Meter.PcbId}";
|
|
var url = $"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetProgrammingParameters?PcbID={Meter.PcbId}";
|
|
var csdRet = LocalWebRequest.GetRequest(url, 60000);
|
|
|
|
Result = JsonConvert.DeserializeObject<IList<ProgrammingParameters>>(csdRet);
|
|
|
|
Progress = 100;
|
|
|
|
if (!Result.Any())
|
|
{
|
|
currentProcessState = ProductionProcessState.Error;
|
|
}
|
|
else
|
|
{
|
|
currentProcessState = ProductionProcessState.Done;
|
|
return;
|
|
}
|
|
retriesRemaining -= 1;
|
|
}
|
|
catch (Exception )
|
|
{
|
|
currentProcessState = ProductionProcessState.Error;
|
|
retriesRemaining -= 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void StartProcess()
|
|
{
|
|
doStartProcessLoop();
|
|
}
|
|
}
|
|
}
|