Browse Source

...

一拖四味魔方配料系统
ZhaoGang 11 months ago
parent
commit
2bc4c46f84
3 changed files with 9 additions and 8 deletions
  1. +3
    -2
      DosingSystem/App.xaml.cs
  2. +4
    -3
      DosingSystem/ExcuteControl .cs
  3. +2
    -3
      DosingSystem/ViewModel/SendCtrlViewModel.cs

+ 3
- 2
DosingSystem/App.xaml.cs View File

@@ -107,10 +107,11 @@ namespace BPASmartClient.DosingSystem
MainWindow = mv;
}

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

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


+ 4
- 3
DosingSystem/ExcuteControl .cs View File

@@ -380,7 +380,7 @@ namespace BPASmartClient.DosingSystem

int dd = 0;

public async Task ShutDownHandler()
public void ShutDownHandler()
{
TaskManage.GetInstance.StopTask("设备下发配方");
TaskManage.GetInstance.StopTask("下发设备参数");
@@ -392,7 +392,7 @@ namespace BPASmartClient.DosingSystem
{
tasks.Add( item.modbusTcp.WriteAsync<ushort>(DeviceAddress.TranspportSwitch.ToAdd(), 0));
}
await Task.WhenAll(tasks);
Task.WaitAll(tasks.ToArray(),TimeSpan.FromSeconds(5));
}
private void MatchRun()
{
@@ -419,9 +419,10 @@ namespace BPASmartClient.DosingSystem
{
int index = 0;
int recipeNameNum = doDeviceCount[DeviceInquire.GetInstance.devices[i].IpAddress];
//设备已执行的配方必须小于已经下发的配方。所以每次开启软件时 必须清零设备上的数据。
if (recipeNameNum == DeviceInquire.GetInstance.DeviceLists[DeviceInquire.GetInstance.devices[i].IpAddress].deviceStatus.DoRecipeCount && recipeNameNum < RecipeNames.Count)
{
//查找
//查找配方。根据名称查找。
index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == RecipeNames.ElementAt(recipeNameNum));
if (index >= 0 && index < Recipes.Count)
{


+ 2
- 3
DosingSystem/ViewModel/SendCtrlViewModel.cs View File

@@ -19,8 +19,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
public SendCtrlViewModel()
{
SendCtrlModel = new();
SendCtrlModel = SimensSend.GetInstance.sendCtrlModel.ToJson().FromJSON<SendCtrlModel>();
}

@@ -28,7 +27,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
/// 传送带状态显示
/// </summary>
public SendCtrlModel SendCtrlModel { get { return sendCtrlModel; } set { sendCtrlModel = value; OnPropertyChanged(); } }
private SendCtrlModel sendCtrlModel;
private SendCtrlModel sendCtrlModel = SimensSend.GetInstance.sendCtrlModel;

public SendCtrl SendCtrl { get { return _sendCtrl; } set { _sendCtrl = value; OnPropertyChanged(); } }
private SendCtrl _sendCtrl = new SendCtrl();


Loading…
Cancel
Save