Files
wcs/货架标准上位机/Views/MatBaseInoScanGenarateMatInfoView.xaml.cs
hehaibing-1996 344158c722 提交代码
2024-06-29 17:30:54 +08:00

74 lines
2.1 KiB
C#

using HandyControl.Controls;
using HandyControl.Tools.Extension;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using WCS.BLL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel.MatBaseInfo;
using .Api;
using .Tool;
using .ViewModel;
using .Views.Controls;
namespace
{
public partial class MatBaseInoScanGenarateMatInfoView : System.Windows.Window
{
public MatBaseInoScanGenarateMatInfoViewModel viewModel = new MatBaseInoScanGenarateMatInfoViewModel();
public MatBaseInoScanGenarateMatInfoView()
{
InitializeComponent();
this.DataContext = viewModel;
viewModel.ChangelessCode = LocalFile.Config.ChangelessCode;
viewModel.ReservedCode = LocalFile.Config.ReservedCode;
this.Topmost = true;
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
}
private void btnOk_Click(object sender, RoutedEventArgs e)
{
var button = sender as Button;
this.DialogResult = true;
this.Close();
}
private void closeClick(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
private void txtMatBatch_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
{
e.Handled = !IsInputNumberAllowed(e.Text);
}
private bool IsInputNumberAllowed(string text)
{
Regex regex = new Regex("^[0-9]+$"); // 只允许数字
return regex.IsMatch(text);
}
private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
txtMatQty.Focus();
Thread.Sleep(1);
txtTotalCount.Focus();
}
}
}
}