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.

149 lines
4.7 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace formula_manage
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
WindowStartupLocation = WindowStartupLocation.CenterScreen;
InitializeComponent();
}
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini";
string Prepose; //料单前置
private void Window_MIN(object sender, RoutedEventArgs e)
{
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
Prepose = Configini.IniReadvalue("SOFTWARE_SET", "L3"); //自定义料单前缀
Number.Text = Prepose + System.DateTime.Now.ToString("yyyyMMddHHmmss"); //生成料单号
}
private void Tb_KeyPress(object sender, TextCompositionEventArgs e)//正则表达式只允许数字
{
//Regex re = new Regex("[^0-9.-]+");
Regex re = new Regex(@"^[0-9]+(.[0-9]{1,3})?$");
e.Handled = !re.IsMatch(e.Text);
}
private void SQL(object sender, RoutedEventArgs e)
{
Windows.Sql sql= new Windows.Sql();
sql.ShowDialog();//实例化并置顶打开数据库设置窗口
}
private void SQLBAK(object sender, RoutedEventArgs e)
{
MessageBoxResult sql_bak = System.Windows.MessageBox.Show("注意此功能仅作用与本地数据库(Dispensing)对于远端数据库的操作可能失败如果需要继续操作单击确定", "SQL", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); //连接失败提示
if( sql_bak == MessageBoxResult.OK)
{
Windows.SQL_BAK sqlbak = new Windows.SQL_BAK();
sqlbak.ShowDialog();//实例化并置顶打开数据库备份窗口
}
}
private void SOFTWARE_SET(object sender, RoutedEventArgs e)
{
Windows.APP_set APP_set = new Windows.APP_set();
APP_set.ShowDialog();//实例化并置顶打开设置窗口
}
private void USER_SET(object sender, RoutedEventArgs e)
{
}
private void HELP(object sender, RoutedEventArgs e)
{
Help help_page = new Help();
help_page.ShowDialog();//实例化并置顶打开信息窗口
}
private void MAC_SET(object sender, RoutedEventArgs e)
{
}
private void STUFF(object sender, RoutedEventArgs e)
{
Windows.Stuff stuff = new Windows.Stuff();
stuff.ShowDialog();//实例化并置顶打开设置窗口
}
private void print(object sender, RoutedEventArgs e)
{
}
private void confirm(object sender, RoutedEventArgs e)
{
}
private void delete(object sender, RoutedEventArgs e)
{
}
private void save(object sender, RoutedEventArgs e)
{
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Number.Text = Prepose + System.DateTime.Now.ToString("yyyyMMddHHmmss"); ;
}
private void Button_up(object sender, RoutedEventArgs e)
{
int i = int.Parse(Procedures_N.Text);
if (i < 999) Procedures_N.Text = ( i + 1).ToString();
}
private void Button_dow(object sender, RoutedEventArgs e)
{
int i = int.Parse(Procedures_N.Text);
int P = int.Parse(Procedures_P.Text);
if (i > 1) Procedures_N.Text = (i - 1).ToString();
if (P >= i) Procedures_P.Text = Procedures_N.Text;
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
int I = int.Parse(Procedures_N.Text);
int P = int.Parse(Procedures_P.Text);
if (P < I) Procedures_P.Text = (P + 1).ToString();
}
private void Button_Click_2(object sender, RoutedEventArgs e)
{
int P = int.Parse(Procedures_P.Text);
if (P > 1) Procedures_P.Text = (P - 1).ToString();
}
}
}