|
|
@@ -1,5 +1,6 @@
|
|
|
using ICSharpCode.AvalonEdit.Search;
|
|
|
using MaterialDesignThemes.Wpf;
|
|
|
+using Newtonsoft.Json;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
using Opc.Ua;
|
|
|
using Prism.Commands;
|
|
|
@@ -412,6 +413,27 @@ namespace TeamAAS_VP.ViewModels
|
|
|
get { return _DeviceInfoList; }
|
|
|
set { SetProperty(ref _DeviceInfoList, value); }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private string _Product;
|
|
|
+
|
|
|
+ public string Product
|
|
|
+ {
|
|
|
+ get { return _Product; }
|
|
|
+ set { SetProperty(ref _Product, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private ObservableCollection<string> _productLoadList = new ObservableCollection<string>();
|
|
|
+ /// <summary>
|
|
|
+ /// 产品集合
|
|
|
+ /// </summary>
|
|
|
+ // ComboBox数据源集合(要用ObservableCollection,UI才自动刷新)
|
|
|
+ public ObservableCollection<string> ProductLoadList
|
|
|
+ {
|
|
|
+ get => _productLoadList;
|
|
|
+ set { SetProperty(ref _productLoadList, value); }
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 命令
|
|
|
@@ -536,7 +558,22 @@ namespace TeamAAS_VP.ViewModels
|
|
|
private DelegateCommand _RemoveDeviceInfoCommand;
|
|
|
public DelegateCommand RemoveDeviceInfoCommand => _RemoveDeviceInfoCommand ?? (_RemoveDeviceInfoCommand = new DelegateCommand(ExecuteRemoveDeviceInfoCommand));
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ private DelegateCommand _DeleteProductMesCommand;
|
|
|
+ /// <summary>
|
|
|
+ /// 删除产品
|
|
|
+ /// </summary>
|
|
|
+ public DelegateCommand DeleteProductMesCommand =>
|
|
|
+ _DeleteProductMesCommand ?? (_DeleteProductMesCommand = new DelegateCommand(DeleteEProWithMesCommand));
|
|
|
+
|
|
|
+ private DelegateCommand _AddProWithMesCommand;
|
|
|
+ /// <summary>
|
|
|
+ /// 增加产品
|
|
|
+ /// </summary>
|
|
|
+ public DelegateCommand AddProWithMesCommand =>
|
|
|
+ _AddProWithMesCommand ?? (_AddProWithMesCommand = new DelegateCommand(AddEProWithMesCommand));
|
|
|
+
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
@@ -546,7 +583,7 @@ namespace TeamAAS_VP.ViewModels
|
|
|
|
|
|
public SettingViewModel(IRegionManager regionManager, IEventAggregator ea, IContainerProvider container, IDialogService dialogService,
|
|
|
IConfigService configService, IRobotService robotService, ICameraService cameraService, IFeederService feederService, IPlcService plcService,
|
|
|
- IProductService productService, ISystemDatabaseService systemDatabaseService,IScannerService scannerService)
|
|
|
+ IProductService productService, ISystemDatabaseService systemDatabaseService, IScannerService scannerService)
|
|
|
{
|
|
|
_regionManager = regionManager;
|
|
|
_eventAggregator = ea;
|
|
|
@@ -1365,7 +1402,7 @@ namespace TeamAAS_VP.ViewModels
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
|
public async void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
{
|
|
|
- if (_systemDatabaseService.GetCurrentUser().userPart == Enums.UserPart.Operator|| _systemDatabaseService.GetCurrentUser().userPart == Enums.UserPart.Engineer)
|
|
|
+ if (_systemDatabaseService.GetCurrentUser().userPart == Enums.UserPart.Operator || _systemDatabaseService.GetCurrentUser().userPart == Enums.UserPart.Engineer)
|
|
|
{
|
|
|
IsAllowEdit = false;
|
|
|
}
|
|
|
@@ -1815,6 +1852,41 @@ namespace TeamAAS_VP.ViewModels
|
|
|
|
|
|
#region 产品与mes绑定
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 增加产品国别
|
|
|
+ /// </summary>
|
|
|
+ private void AddEProWithMesCommand()
|
|
|
+ {
|
|
|
+ if (string.IsNullOrWhiteSpace(Product))
|
|
|
+ return;
|
|
|
+
|
|
|
+ // 不存在才添加,去重
|
|
|
+ if (!ProductLoadList.Contains(Product))
|
|
|
+ {
|
|
|
+ ProductLoadList.Add(Product);
|
|
|
+ // 同步更新存储字符串
|
|
|
+ ProMesInfo.ProductLoad = JsonConvert.SerializeObject(ProductLoadList);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 删除产品国别
|
|
|
+ /// </summary>
|
|
|
+ private void DeleteEProWithMesCommand()
|
|
|
+ {
|
|
|
+ if (string.IsNullOrWhiteSpace(Product))
|
|
|
+ return;
|
|
|
+
|
|
|
+ if (ProductLoadList.Contains(Product))
|
|
|
+ {
|
|
|
+ ProductLoadList.Remove(Product);
|
|
|
+ ProMesInfo.ProductLoad = JsonConvert.SerializeObject(ProductLoadList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
private async void ExecuteGetProWithMesCommand()
|
|
|
{
|
|
|
var v = await _systemDatabaseService.QueryProductWithMesAsync(SelectProduct);
|
|
|
@@ -1824,6 +1896,8 @@ namespace TeamAAS_VP.ViewModels
|
|
|
ProMesInfo.ProductColor = "";
|
|
|
ProMesInfo.ProductKBSN = "";
|
|
|
ProMesInfo.ProductLoadMode = 0;
|
|
|
+ ProMesInfo.ProductLoad = "";
|
|
|
+ ProductLoadList = new ObservableCollection<string>();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1831,6 +1905,14 @@ namespace TeamAAS_VP.ViewModels
|
|
|
ProMesInfo.ProductColor = v.ProductColor;
|
|
|
ProMesInfo.ProductKBSN = v.ProductKBSN;
|
|
|
ProMesInfo.ProductLoadMode = v.ProductLoadMode;
|
|
|
+ ProMesInfo.ProductLoad = v.ProductLoad;
|
|
|
+ // 先清空原有数据
|
|
|
+ //ProductLoadList.Clear();
|
|
|
+ ProductLoadList = JsonConvert.DeserializeObject<ObservableCollection<string>>(v.ProductLoad);
|
|
|
+ if (ProductLoadList==null)
|
|
|
+ {
|
|
|
+ ProductLoadList = new ObservableCollection<string>();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1847,6 +1929,7 @@ namespace TeamAAS_VP.ViewModels
|
|
|
ProMesInfo.ProductColor = "";
|
|
|
ProMesInfo.ProductKBSN = "";
|
|
|
ProMesInfo.ProductLoadMode = 0;
|
|
|
+ ProMesInfo.ProductLoad = "";
|
|
|
}
|
|
|
}
|
|
|
}
|