任务计划页面修改,登录页面修改
This commit is contained in:
commit
4a270b87b6
6 files changed
+127
-39
No files matched your search
+5
-2
@@ -20,6 +20,7 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
|
||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
||||
DataTable logindataTable = new DataTable(); //建立login缓存
|
||||
DataTable logindataT = new DataTable(); //建立login缓存
|
||||
|
||||
public Login()
|
||||
{
|
||||
@@ -61,7 +62,7 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
}
|
||||
else
|
||||
{
|
||||
var paw = logindataTable.Select("Name='" + user + "'").First().Field<string>("Password");
|
||||
string paw = logindataT.Select("Name='" + user + "'").First().Field<string>("Password");
|
||||
if (paw == null) paw = "";
|
||||
|
||||
if (paw == pasword)
|
||||
@@ -102,7 +103,9 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
logon.IsEnabled = false;
|
||||
SQLiteHelper db = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
db.Open(); //打开数据库
|
||||
logindataTable = db.ExecuteDataSet("select * from USER where Groups<>'CHIEF'", null).Tables[0]; //读取表写入缓存
|
||||
logindataTable = db.ExecuteDataSet("select * from USER where Groups<>'CHIEF'", null).Tables[0]; //读取表写入缓存
|
||||
|
||||
logindataT = db.ExecuteDataSet("select * from USER ", null).Tables[0];
|
||||
db.Close();
|
||||
User.ItemsSource = logindataTable.AsEnumerable().Select(rowdata => rowdata.Field<string>("Name"));//转换
|
||||
logon.IsEnabled = true; //允许登录按钮
|
||||
|
||||
+14
-11
@@ -29,12 +29,22 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public static string user_;
|
||||
public MainWindow()
|
||||
{
|
||||
DataContext = new MainWindowViewModel();
|
||||
InitializeComponent();
|
||||
CountDown();
|
||||
CDkey_();
|
||||
CDkey_();
|
||||
if (App.USER_Purview != "ENGINEER")
|
||||
{
|
||||
username.ItemsSource = MainWindowViewModel.USER_data.Select(
|
||||
"Groups='" + MainWindowViewModel.USER_data.Select("Name='" + App.USER_Purview + "'").
|
||||
First().Field<string>("Groups").ToString() + "'").
|
||||
AsEnumerable().Select(rowdata => rowdata.Field<string>("Name")).ToList();
|
||||
}
|
||||
user_ = App.USER_Purview;
|
||||
username.Text = user_;
|
||||
}
|
||||
|
||||
private void ButtonPopUpLogout_Click(object sender, RoutedEventArgs e)
|
||||
@@ -202,19 +212,12 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
private void username_DropDownClosed(object sender, EventArgs e)
|
||||
{
|
||||
MainWindowViewModel.USERCapacity(username.Text);
|
||||
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)//打开页面
|
||||
{
|
||||
if (App.USER_Purview != "ENGINEER")
|
||||
{
|
||||
username.ItemsSource = MainWindowViewModel.USER_data.Select(
|
||||
"Groups='" + MainWindowViewModel.USER_data.Select("Name='" + App.USER_Purview + "'").
|
||||
First().Field<string>("Groups").ToString() + "'").
|
||||
AsEnumerable().Select(rowdata => rowdata.Field<string>("Name")).ToList();
|
||||
}
|
||||
username.Text = App.USER_Purview;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -37,17 +37,21 @@
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,330,10,0" x:Name="TEXTClothSpecies" VerticalAlignment="Top" Width="270"
|
||||
FontSize="15" BorderBrush="#FF673AB7" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,380,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.BathRatio}"
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,380,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothWeight}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,380,10,0" x:Name="TEXTBathRatio" VerticalAlignment="Top" Width="270"
|
||||
FontSize="15" BorderBrush="#FF673AB7" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,430,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Total}"
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,380,10,0" x:Name="TEXTClothWeight" VerticalAlignment="Top" Width="270"
|
||||
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTClothWeight" InputMethod.IsInputMethodEnabled="False"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,430,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.BathRatio}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,430,10,0" x:Name="TEXTTotal" VerticalAlignment="Top" Width="270"
|
||||
FontSize="15" BorderBrush="#FF673AB7" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,480,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}"
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,430,10,0" x:Name="TEXTBathRatio" VerticalAlignment="Top" Width="270"
|
||||
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTBathRatio" InputMethod.IsInputMethodEnabled="False"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,480,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Total}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,480,10,0" x:Name="TEXTUSER" VerticalAlignment="Top" Width="270"
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,480,10,0" x:Name="TEXTTotal" VerticalAlignment="Top" Width="270"
|
||||
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTTotal" InputMethod.IsInputMethodEnabled="False"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,530,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,530,10,0" x:Name="TEXTUSER" VerticalAlignment="Top" Width="270"
|
||||
FontSize="15" BorderBrush="#FF673AB7" />
|
||||
|
||||
<ComboBox HorizontalAlignment="Right" Height="30" Margin="150,30,50,0" x:Name="comboBoxProgram" VerticalAlignment="Top" Width="470"
|
||||
@@ -92,7 +96,7 @@
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static lang:Resources.edit}" Click="MenuItem_edit"/>
|
||||
<MenuItem Header="{x:Static lang:Resources.Insert}" />
|
||||
<MenuItem Header="{x:Static lang:Resources.Insert}" Click="MenuItem_Insert"/>
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
<DataGrid.Columns>
|
||||
|
||||
@@ -47,8 +47,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
|
||||
comboBoxProgram.ItemsSource = ProgramName.AsEnumerable().Select(rowdata => rowdata.Field<string>("ProgramName")).ToList();//转换工艺代码
|
||||
|
||||
|
||||
TEXTUSER.Text = MainWindow.user_;
|
||||
}
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
@@ -81,6 +80,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
comboBoxDyelot.IsEnabled = false;
|
||||
}
|
||||
|
||||
|
||||
string color_ = "#FF336FA8";
|
||||
private void Button_Click(object sender, RoutedEventArgs e)//保存按钮
|
||||
{
|
||||
if (string.IsNullOrEmpty(comboBoxMachine.Text))
|
||||
@@ -171,7 +172,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
WorkOrder_new.Add("Dyelot", Dyelot_);
|
||||
WorkOrder_new.Add("Remark", null);
|
||||
WorkOrder_new.Add("lock", 0);
|
||||
// WorkOrder_new.Add("color", color_);
|
||||
WorkOrder_new.Add("color", color_);
|
||||
WorkOrder_new.Add("ColorNumber", TEXTColorNumber.Text);
|
||||
WorkOrder_new.Add("Client", TEXTClient.Text);
|
||||
WorkOrder_new.Add("ClothWeight", TEXTClothWeight.Text);
|
||||
WorkOrder_new.Add("ClothSpecies", TEXTClothSpecies.Text);
|
||||
WorkOrder_new.Add("BathRatio", TEXTBathRatio.Text);
|
||||
WorkOrder_new.Add("Total", TEXTTotal.Text);
|
||||
WorkOrder_new.Add("USER", TEXTUSER.Text);
|
||||
WorkOrder_new.Add("ColorName", TEXTColorName.Text);
|
||||
SQLiteHelpers.InsertData("WorkOrder", WorkOrder_new);// 执行插入
|
||||
|
||||
Dictionary<string, object> WorkOrder_DAT = new Dictionary<string, object>();//缓存函数
|
||||
@@ -313,6 +322,33 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
viewstop.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void MenuItem_Insert(object sender, RoutedEventArgs e)//右键插入
|
||||
{
|
||||
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
ID = (Grid_data.Columns[2].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||
|
||||
int d = 0;
|
||||
if (ID != null) { d = Convert.ToInt32(ID); } else { return; }
|
||||
string ProgramID = dat.Select().First().Field<string>("ProgramID").ToString();
|
||||
string ProgramNAME = dat.Select().First().Field<string>("Program").ToString();
|
||||
DataRow dr = dat.NewRow();//添加表数据
|
||||
dr["ProgramID"] = ProgramID;
|
||||
dr["Program"] = ProgramNAME;
|
||||
dat.Rows.InsertAt(dr, d - 1);
|
||||
|
||||
Dat();
|
||||
Grid_data.ItemsSource = dat.DefaultView;
|
||||
|
||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||
if (ID == null) ID = dat.Rows.Count.ToString();
|
||||
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5);
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void Grid_data_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
@@ -354,5 +390,43 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
|
||||
Grid_data.ItemsSource = dat.DefaultView;
|
||||
}
|
||||
public void Dat()//行号刷新
|
||||
{
|
||||
int a = dat.Rows.Count;
|
||||
for (int i = 0; i < a; i++)
|
||||
{
|
||||
DataRow dr = dat.Rows[i];
|
||||
dr.BeginEdit();
|
||||
dr["Step"] = i + 1;
|
||||
dr.EndEdit();
|
||||
}
|
||||
}
|
||||
private void Tb_KeyTEXTClothWeight(object sender, TextCompositionEventArgs e)//输入事件
|
||||
{
|
||||
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
|
||||
e.Handled =
|
||||
!numbeRegex.IsMatch(
|
||||
TEXTClothWeight.Text.Insert(
|
||||
TEXTClothWeight.SelectionStart, e.Text));
|
||||
TEXTClothWeight.Text = TEXTClothWeight.Text.Trim();
|
||||
}
|
||||
private void Tb_KeyTEXTBathRatio(object sender, TextCompositionEventArgs e)//输入事件
|
||||
{
|
||||
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
|
||||
e.Handled =
|
||||
!numbeRegex.IsMatch(
|
||||
TEXTBathRatio.Text.Insert(
|
||||
TEXTBathRatio.SelectionStart, e.Text));
|
||||
TEXTBathRatio.Text = TEXTBathRatio.Text.Trim();
|
||||
}
|
||||
private void Tb_KeyTEXTTotal(object sender, TextCompositionEventArgs e)//输入事件
|
||||
{
|
||||
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
|
||||
e.Handled =
|
||||
!numbeRegex.IsMatch(
|
||||
TEXTTotal.Text.Insert(
|
||||
TEXTTotal.SelectionStart, e.Text));
|
||||
TEXTTotal.Text = TEXTTotal.Text.Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,21 +121,21 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
Start = DateTime.Parse(dataRows[j].Field<string>("StartTime")),
|
||||
End = DateTime.Parse(dataRows[j].Field<string>("EndTime")),
|
||||
Name = Properties.Resources.ProcessName + ";" + dataRows[j].Field<string>("ProgramName"),
|
||||
Name = Properties.Resources.ProcessName + ": " + dataRows[j].Field<string>("ProgramName"),
|
||||
Background = colorBackground,
|
||||
Status = colorStatus,
|
||||
ID = Properties.Resources.WorkOrder + ";" + dataRows[j].Field<string>("WorkOrder").ToString(),
|
||||
Dyelot = Properties.Resources.Dyelot + ";" + dataRows[j].Field<string>("Dyelot"),
|
||||
Remark = Properties.Resources.Remark + ";" + dataRows[j].Field<string>("Remark"),
|
||||
ColorNumber = Properties.Resources.ColorNumber + ";" + dataRows[j].Field<string>("ColorNumber"),
|
||||
ColorName = Properties.Resources.ColorName + ";" + dataRows[j].Field<string>("ColorName"),
|
||||
Client = Properties.Resources.Client + ";" + dataRows[j].Field<string>("Client"),
|
||||
ClothSpecies = Properties.Resources.ClothSpecies + ";" + dataRows[j].Field<string>("ClothSpecies"),
|
||||
ClothWeight = Properties.Resources.ClothWeight + ";" + dataRows[j].Field<string>("ClothWeight"),
|
||||
BathRatio = Properties.Resources.BathRatio + ";" + dataRows[j].Field<string>("BathRatio"),
|
||||
Total = Properties.Resources.Total + ";" + dataRows[j].Field<string>("Total"),
|
||||
USER = Properties.Resources.USER + ";" + dataRows[j].Field<string>("user"),
|
||||
STATE = Properties.Resources.State + ";" +StatenClassConvert.Convert( dataRows[j].Field<Int32 >("State").ToString()),
|
||||
ID = Properties.Resources.WorkOrder + ": " + dataRows[j].Field<string>("WorkOrder").ToString(),
|
||||
Dyelot = Properties.Resources.Dyelot + ": " + dataRows[j].Field<string>("Dyelot"),
|
||||
Remark = Properties.Resources.Remark + ": " + dataRows[j].Field<string>("Remark"),
|
||||
ColorNumber = Properties.Resources.ColorNumber + ": " + dataRows[j].Field<string>("ColorNumber"),
|
||||
ColorName = Properties.Resources.ColorName + ": " + dataRows[j].Field<string>("ColorName"),
|
||||
Client = Properties.Resources.Client + ": " + dataRows[j].Field<string>("Client"),
|
||||
ClothSpecies = Properties.Resources.ClothSpecies + ": " + dataRows[j].Field<string>("ClothSpecies"),
|
||||
ClothWeight = Properties.Resources.ClothWeight + ": " + dataRows[j].Field<string>("ClothWeight"),
|
||||
BathRatio = Properties.Resources.BathRatio + ": " + dataRows[j].Field<string>("BathRatio"),
|
||||
Total = Properties.Resources.Total + ": " + dataRows[j].Field<string>("Total"),
|
||||
USER = Properties.Resources.USER + ": " + dataRows[j].Field<string>("user"),
|
||||
STATE = Properties.Resources.State + ": " +StatenClassConvert.Convert( dataRows[j].Field<Int32 >("State").ToString()),
|
||||
TaskProgressVisibility = System.Windows.Visibility.Hidden
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||
{
|
||||
@@ -113,7 +114,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||
|
||||
private void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
|
||||
{
|
||||
|
||||
SQLiteHelpers = new UserClass.SqliteHelper.SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Delete("USER", "Name='" + _Name.Text + "'", null);
|
||||
SQLiteHelpers.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user