|
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.CustomResource.UserControls;
- using BPASmartClient.CustomResource.UserControls.MessageShow;
- using BPA.Helper;
- using BPASmartClient.JXJFoodSmallStation.Model;
- using BPASmartClient.JXJFoodSmallStation.Model.RawMaterial;
- using BPA.Helper;
-
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
-
- namespace BPASmartClient.JXJFoodSmallStation.ViewModel
- {
- public class StockBinRawMaterialViewModel : NotifyBase
- {
- public StockBinRawMaterialViewModel()
- {
- RawMaterialInfo = Json<DevicePar>.Data.rawMaterialStockBin;
- RemoveCommand = new BPARelayCommand<Object>((loc) =>
- {
- if (loc is int pos)
- {
- var res = RawMaterialInfo.FirstOrDefault(p => p.RawMaterialLocation == pos);
- if (res != null) RawMaterialInfo.Remove(res);
- MessageNotify.GetInstance.ShowUserLog($"删除一条料仓物料配置信息,原料料仓位置:【{res.RawMaterialLocation}】,原料编号:【{res.RawMaterialName}】");
- }
- });
- SaveRawMaterialPara = new BPARelayCommand(() =>
- {
- Json<DevicePar>.Save();
- ProcessControl.GetInstance.StockBinNameWithPos();
- foreach (var item in Json<DevicePar>.Data.rawMaterialStockBin)
- {
- MessageNotify.GetInstance.ShowUserLog($"料仓位置:"+ item.RawMaterialLocation+ ",物料编码:" + item.RawMaterialName);
- }
- MessageNotify.GetInstance.ShowUserLog($"原料与料仓对应关系保存成功");
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功");
- });
- UpdateRawMaterial = new BPARelayCommand(() =>
- {
- RawMaterialInfo.Add(new RawMaterialStockBin() { RawMaterialCount = (short)(RawMaterialInfo.Count + 1)});
- MessageNotify.GetInstance.ShowUserLog($"新增一条料仓物料配置信息。");
- });
- }
- public ObservableCollection<RawMaterialStockBin> RawMaterialInfo { get; set; } = new ObservableCollection<RawMaterialStockBin>();
- public BPARelayCommand<Object> RemoveCommand { get; set; }
- public BPARelayCommand SaveRawMaterialPara { get; set; }
- public BPARelayCommand UpdateRawMaterial { get; set; }
- }
- }
|