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.

171 lines
5.4 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; //料单前置
string PreposeT; //料单时间
private void Window_MIN(object sender, RoutedEventArgs e)
{
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
Prepose = Configini.IniReadvalue("SOFTWARE_SET", "T1"); //自定义料单前缀
PreposeT = Configini.IniReadvalue("SOFTWARE_SET", "T2"); //自定义料单时间
Number.Text = Prepose + System.DateTime.Now.ToString(PreposeT); //生成料单号
}
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_NewOrder(object sender, RoutedEventArgs e)
{
Number.Text = Prepose + System.DateTime.Now.ToString(PreposeT);
}
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_StepUp(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_StepDow(object sender, RoutedEventArgs e)
{
int P = int.Parse(Procedures_P.Text);
if (P > 1) Procedures_P.Text = (P - 1).ToString();
}
private void Button_Technology(object sender, RoutedEventArgs e)
{
Deputy.Content = new View.ViewProcess(); //打开工艺选择
}
private void Button_Formula(object sender, RoutedEventArgs e)
{
Deputy.Content = new View.Formula(); //打开配方选择
}
private void DataGrid_InitializingNewItem(object sender, InitializingNewItemEventArgs e)
{
}
private void DataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
}
}