using Admin.Core.IService; using Admin.Core.Model; using Admin.Core.Service; using Aucma.Core.Palletiz.Business; using Aucma.Core.Palletiz.Models; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using log4net; using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace Aucma.Core.Palletiz.ViewModels { public partial class HandPalletizViewModel : ObservableObject { private static readonly log4net.ILog log = LogManager.GetLogger(typeof(HandPalletizViewModel)); public static StackInfoModel tempStackInfo = new StackInfoModel(); private readonly IBaseSpaceInfoServices _baseSpaceInfoServices; private readonly IRecordInStoreServices _recordInstoreServices; public HandPalletizViewModel() { _baseSpaceInfoServices = App.ServiceProvider.GetService(); _recordInstoreServices = App.ServiceProvider.GetService(); Range = 1; SpaceNo ="001"; PromptInfo("请选择信息下传......", "White"); } #region 分垛信息下传 /// /// 分垛信息下传 /// [RelayCommand] public void Save() { try { DialogResult cr = MessageBox.Show("是否确认下传分垛信息?", "系统提醒", MessageBoxButtons.OKCancel); if (cr != DialogResult.OK) { return; } PromptInfo("分垛信息下传中......", "White"); int range = Range; int spaceNo =Convert.ToInt32(SpaceNo); if (spaceNo==0) { MessageBox.Show("请选择目的货道!","系统提醒"); return; } string hh = "FD01_" + SpaceNo; Admin.Core.Model.BaseSpaceInfo spaceInfo = _baseSpaceInfoServices.FirstAsync(X => X.StoreCode.Contains("FD") && X.SpaceCode == "FD01_"+SpaceNo).Result; if (spaceInfo == null) { MessageBox.Show("货道未创建!", "系统提醒"); return; } } catch (Exception ex) { PromptInfo($"分垛信息下传失败:{ex.Message}", "Red"); } } #endregion #region 提示信息 private string? msgTxt; public string? MsgTxt { get => msgTxt; set => SetProperty(ref msgTxt, value); } #endregion #region 字体颜色 private string? msgColor; public string? MsgColor { get => msgColor; set => SetProperty(ref msgColor, value); } #endregion #region 提示信息 /// /// 提示信息 /// /// 提示信息 /// 提示信息颜色 public void PromptInfo(string mesg, string color) { System.Windows.Application.Current.Dispatcher.Invoke((Action)(() => { MsgTxt = mesg; MsgColor = color; })); } #endregion #region 目的货道 private string spaceNo; public string SpaceNo { get => spaceNo; set => SetProperty(ref spaceNo, value); } #endregion #region 方向 private int range; public int Range { get => range; set => SetProperty(ref range, value); } #endregion } }