You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Aucma.Scada/Aucma.Scada.UI/Page/InStoreInfo/InStoreInfoControl.xaml.cs

69 lines
2.2 KiB
C#

using Aucma.Scada.Business;
using Aucma.Scada.UI.viewModel.InStoreInfo;
using HighWayIot.Config;
using System;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
namespace Aucma.Scada.UI.Page.InStoreInfo
{
/// <summary>
/// InStoreInfoControl.xaml 的交互逻辑
/// </summary>
public partial class InStoreInfoControl : UserControl
{
//异常入库
public delegate void ExceptionInstore(string materialCodeStr);
public static event ExceptionInstore ExceptionInstoreEvent;
public InStoreInfoControl()
{
InitializeComponent();
InStoreInfoViewModel inStoreInfoViewModel = new InStoreInfoViewModel();
this.DataContext = inStoreInfoViewModel;
}
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
try
{
if (string.IsNullOrEmpty(SpaceCodeText.Text))
{
MessageBox.Show("请输入1-9的货道编号!");
}
else
{
// 定义正则表达式模式
string pattern = "^[1-9]$";
// 创建正则表达式对象
Regex regex = new Regex(pattern);
// 使用 IsMatch 方法检查字符串
bool isMatch = regex.IsMatch(SpaceCodeText.Text);
if (isMatch)
{
MessageBoxResult result = MessageBox.Show($"确认异常入{SpaceCodeText.Text}库吗", "删除确认", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
// 入库
InStoreBusiness.Instance.ExceptionInstore("PH_00" + SpaceCodeText.Text);
}
}
else
{
MessageBox.Show("请输入1-9的货道编号!");
}
}
}catch (Exception ex)
{
}
}
}
}