Browse Source

物料管理添加刷新功能

master
Nah 1 year ago
parent
commit
47fed2a18f
4 changed files with 36 additions and 4 deletions
  1. +6
    -0
      BPA.SingleDevice/View/RawMaterialManagementView.xaml
  2. +3
    -2
      BPA.SingleDevice/ViewModel/NewRecipeViewModel.cs
  3. +25
    -2
      BPA.SingleDevice/ViewModel/RawMaterialManagementViewModel.cs
  4. +2
    -0
      BPA.SingleDevice/ViewModel/RecipeManagementViewModel.cs

+ 6
- 0
BPA.SingleDevice/View/RawMaterialManagementView.xaml View File

@@ -29,6 +29,12 @@
HorizontalAlignment="Right"
bpa:PanelHelper.Spacing="15"
Orientation="Horizontal">
<Button
Width="120"
HorizontalAlignment="Right"
Command="{Binding RefreshCommand}"
Content="刷新"
Style="{DynamicResource DarkButton}" />
<Button
Width="120"
HorizontalAlignment="Right"


+ 3
- 2
BPA.SingleDevice/ViewModel/NewRecipeViewModel.cs View File

@@ -23,10 +23,11 @@ namespace BPA.SingleDevice.ViewModel

SqlHelper.GetInstance.GetListAsync<RawMaterTB>().Result.OnSuccess(s =>
{
s.ForEach(item =>
var result = s.OrderBy(r => r.DeviceNum).ThenBy(r => r.WarehouseNum);
foreach (var item in result)
{
NewRecipeModels.Add(new NewRecipeModel() { Name = item.Name, Id = item.Id });
});
}
});

SaveCommand = new BPARelayCommand(() =>


+ 25
- 2
BPA.SingleDevice/ViewModel/RawMaterialManagementViewModel.cs View File

@@ -1,4 +1,5 @@
using BPA.SingleDevice.Services;
using System.DirectoryServices.Protocols;

namespace BPA.SingleDevice.ViewModel
{
@@ -13,12 +14,13 @@ namespace BPA.SingleDevice.ViewModel
{
SqlHelper.GetInstance.GetListAsync<RawMaterTB>().Result.OnSuccess(s =>
{
var result = s.OrderBy(r=>r.DeviceNum).ThenBy(r=>r.WarehouseNum);
App.Current.Dispatcher.Invoke(() =>
{
s.ForEach(item =>
foreach (var item in result)
{
RawMaterInfos.Add(new RawMaterInfo(item.Id, item.Name, item.DeviceNum, item.WarehouseNum, item.LastModified));
});
}
});
});
});
@@ -110,6 +112,25 @@ namespace BPA.SingleDevice.ViewModel
}
}
});

RefreshCommand = new(() =>
{
RawMaterInfos.Clear();
Task.Run(() =>
{
SqlHelper.GetInstance.GetListAsync<RawMaterTB>().Result.OnSuccess(s =>
{
var result = s.OrderBy(r => r.DeviceNum).ThenBy(r => r.WarehouseNum);
App.Current.Dispatcher.Invoke(() =>
{
foreach (var item in result)
{
RawMaterInfos.Add(new RawMaterInfo(item.Id, item.Name, item.DeviceNum, item.WarehouseNum, item.LastModified));
}
});
});
});
});
}

@@ -120,5 +141,7 @@ namespace BPA.SingleDevice.ViewModel
public BPARelayCommand<object> CopyCommand { get; set; }
public BPARelayCommand<object> EditCommand { get; set; }
public BPARelayCommand<object> RemoveCommand { get; set; }

public BPARelayCommand RefreshCommand { get; set; }
}
}

+ 2
- 0
BPA.SingleDevice/ViewModel/RecipeManagementViewModel.cs View File

@@ -1,4 +1,5 @@
using BPA.SingleDevice.Services;
using BPA.UIControl;
using System.Xml.Linq;

namespace BPA.SingleDevice.ViewModel
@@ -117,6 +118,7 @@ namespace BPA.SingleDevice.ViewModel
RecipeInfos[index].Name = name;
RecipeInfos[index].LastModified = time;
logService.LogUserInfo($"修改配方【{name}】成功。");
Message.Success("RecipeManagementView", $"修改配方成功。");
}).OnFail(s => { Message.Error("RecipeManagementView", $"更新添加失败:{s}"); });
}).OnFail(s => { Message.Error("RecipeManagementView", $"更新时删除失败:{s}"); });
}).OnFail(s => { Message.Error("RecipeManagementView", $"更新失败:{s}"); });


Loading…
Cancel
Save