You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.1 KiB
87 lines
2.1 KiB
11 months ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using System.Text.RegularExpressions;
|
||
|
using System.Windows;
|
||
|
using System.Windows.Controls;
|
||
|
using System.Windows.Data;
|
||
|
using System.Windows.Documents;
|
||
|
using System.Windows.Input;
|
||
|
using System.Windows.Media;
|
||
|
using System.Windows.Media.Imaging;
|
||
|
using System.Windows.Navigation;
|
||
|
using System.Windows.Shapes;
|
||
|
|
||
|
namespace SiaSun.LMS.WPFClient.UC
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// ucDetailQuery.xaml 的交互逻辑
|
||
|
/// </summary>
|
||
|
public partial class ucDetailQuery : UserControl
|
||
|
{
|
||
|
public ucDetailQuery()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
}
|
||
|
|
||
|
public List<string> DetailList
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
List<string> lsDetal = new List<string>();
|
||
|
foreach(string item in lbDetailList.Items)
|
||
|
{
|
||
|
lsDetal.Add(item.ToString());
|
||
|
}
|
||
|
|
||
|
return lsDetal;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void txtDetail_KeyDown(object sender, KeyEventArgs e)
|
||
|
{
|
||
|
if( e.Key == Key.Enter)
|
||
|
{
|
||
|
string sGOODS_CODE = this.GetGOODS_CODE(this.txtDetail.Text.TrimEnd());
|
||
|
|
||
|
if (!lbDetailList.Items.Contains(sGOODS_CODE) && !string.IsNullOrEmpty(sGOODS_CODE))
|
||
|
{
|
||
|
lbDetailList.Items.Add(sGOODS_CODE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void btnClear_Click(object sender, RoutedEventArgs e)
|
||
|
{
|
||
|
|
||
|
this.lbDetailList.Items.Clear();
|
||
|
}
|
||
|
|
||
|
private void lbDetailList_KeyDown(object sender, KeyEventArgs e)
|
||
|
{
|
||
|
if (e.Key == Key.Delete)
|
||
|
{
|
||
|
lbDetailList.Items.Remove(this.lbDetailList.SelectedItem);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public string GetGOODS_CODE(string MATNR)
|
||
|
{
|
||
|
if (this.isExists(MATNR))
|
||
|
{
|
||
|
return MATNR;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return MATNR.PadLeft(18, '0');
|
||
|
}
|
||
|
}
|
||
|
public bool isExists(string str)
|
||
|
{
|
||
|
return Regex.Matches(str, "[a-zA-Z]").Count > 0;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|