Przeglądaj źródła

。。。

一拖四味魔方配料系统
ZhaoGang 11 miesięcy temu
rodzic
commit
6e5303cfa6
2 zmienionych plików z 34 dodań i 2 usunięć
  1. +1
    -2
      DosingSystem/App.xaml.cs
  2. +33
    -0
      DosingSystem/ExcuteControl .cs

+ 1
- 2
DosingSystem/App.xaml.cs Wyświetl plik

@@ -109,9 +109,8 @@ namespace BPASmartClient.DosingSystem

protected override void OnExit(ExitEventArgs e)
{
excute.ShutDownHandler();

base.OnExit(e);
excute.ShutDown();
//excute?.MqttDisConnect();
Json<LocalRecipe>.Save();
Json<DevicePar>.Save();


+ 33
- 0
DosingSystem/ExcuteControl .cs Wyświetl plik

@@ -394,6 +394,39 @@ namespace BPASmartClient.DosingSystem
}
Task.WaitAll(tasks.ToArray(),TimeSpan.FromSeconds(5));
}

public void ShutDown()
{
TaskManage.GetInstance.StopTask("设备下发配方");
TaskManage.GetInstance.StopTask("下发设备参数");
TaskManage.GetInstance.StopTask("控制传送带");
List<Task> tasks = new();
tasks.Add(SimensSend.GetInstance.SendSimens.WriteAsync("M0.0", false));
tasks.Add(SimensSend.GetInstance.SendSimens.WriteAsync("M0.1", false));
var writeTasks = DeviceInquire.GetInstance.DeviceLists.Values.Select(async item =>
{
bool writeSuccessful = false;
int maxRetries = 3;
int retryCount = 0;

while (!writeSuccessful && retryCount < maxRetries)
{
var result = await item.modbusTcp.WriteAsync<ushort>(DeviceAddress.TranspportSwitch.ToAdd(), 0);

if (result.IsSuccess)
{
writeSuccessful = true;
}
else
{
retryCount++;
}
}
});

tasks.AddRange(writeTasks);
Task.WaitAll(tasks.ToArray(), TimeSpan.FromSeconds(5));
}
private void MatchRun()
{



Ładowanie…
Anuluj
Zapisz