|
|
|
@ -28,6 +28,7 @@ using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; |
|
|
|
using static System.Net.Mime.MediaTypeNames; |
|
|
|
//using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
|
|
|
|
|
|
|
|
|
|
namespace formula_manage |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
@ -54,12 +55,14 @@ namespace formula_manage |
|
|
|
|
|
|
|
public MainWindow() |
|
|
|
{ |
|
|
|
// DataContext =new MainWindow();
|
|
|
|
|
|
|
|
int ID_N = 1; |
|
|
|
|
|
|
|
WindowStartupLocation = WindowStartupLocation.CenterScreen; |
|
|
|
InitializeComponent(); |
|
|
|
this.Closing += Window_Closing; //添加窗口关闭事件
|
|
|
|
|
|
|
|
|
|
|
|
USER.Text = App.USER_Purview; |
|
|
|
|
|
|
|
RecipedataTable.Columns.Add("DYELOT", typeof(int)); |
|
|
|
@ -119,84 +122,151 @@ namespace formula_manage |
|
|
|
|
|
|
|
Grid_RRODUCT.ItemsSource = RRODUCTdataTable.DefaultView; |
|
|
|
|
|
|
|
this.DataContext = STUFFdataTable; |
|
|
|
DataView defaultView = MACHINEdataTable.DefaultView; |
|
|
|
// UnitList = defaultView;
|
|
|
|
|
|
|
|
/* DataGridTemplateColumn tempColumn = Grid_RRODUCT.Columns[1] as DataGridTemplateColumn; |
|
|
|
FrameworkElement element1 = Grid_RRODUCT.Columns[1].GetCellContent(Grid_RRODUCT.Items[1]); |
|
|
|
System.Windows.Controls.ComboBox comboBox1 = tempColumn.CellTemplate.FindName("CP_PRODUCT_CODE", element1) as System.Windows.Controls.ComboBox; |
|
|
|
|
|
|
|
// DataContext = MACHINEdataTable.DefaultView;
|
|
|
|
|
|
|
|
comboBox1.ItemsSource = STUFFdataTable.DefaultView;*/ |
|
|
|
} |
|
|
|
// CP_PRODUCT_CODE.ItemsSource= STUFFdataTable.;
|
|
|
|
/* DataGridTemplateColumn tempColumn = Grid_RRODUCT.Columns[1] as DataGridTemplateColumn; |
|
|
|
FrameworkElement element1 = Grid_RRODUCT.Columns[1].GetCellContent(Grid_RRODUCT.Items[1]); |
|
|
|
System.Windows.Controls.ComboBox comboBox1 = tempColumn.CellTemplate.FindName("CP_PRODUCT_CODE", element1) as System.Windows.Controls.ComboBox; |
|
|
|
|
|
|
|
comboBox1.ItemsSource = STUFFdataTable.DefaultView;*/ |
|
|
|
|
|
|
|
/* private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) |
|
|
|
{ |
|
|
|
var cb = (sender as System.Windows.Controls.ComboBox); |
|
|
|
if (cb == null || cb.Tag == null) return; |
|
|
|
int idx = int.Parse(cb.Tag.ToString()); |
|
|
|
// var bindDataGridDatas = this.Grid_RRODUCT.ItemsSource as BindDataGridData[];//成员变量和这里转换都可以。
|
|
|
|
// bindDataGridDatas[idx].UnitStr = (string)cb.SelectedItem;//手动保存到数据结构
|
|
|
|
// bindDataGridDatas[idx].UpdateKBValue(); //联动CoefK值
|
|
|
|
} |
|
|
|
/* SelectionList.Add("Name1"); |
|
|
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged; |
|
|
|
SelectionList.Add("Name2");*/ |
|
|
|
|
|
|
|
|
|
|
|
private void PropertiesC([CallerMemberName] string propertyName = "") |
|
|
|
{ |
|
|
|
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
|
|
|
} |
|
|
|
|
|
|
|
public int Idx { get; set; } = 0; |
|
|
|
public string[] UnitList { get; set; } |
|
|
|
|
|
|
|
string unitstr = "Pa"; |
|
|
|
private int g_TypeNameDicNo =123; //枪型号名
|
|
|
|
|
|
|
|
public string UnitStr |
|
|
|
public int G_TypeNameDicNo |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return this.unitstr; |
|
|
|
return g_TypeNameDicNo; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
this.unitstr = value; |
|
|
|
this.PropertiesC(); |
|
|
|
g_TypeNameDicNo = value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public string[] UnitList { get; set; } = new string[] { "Pa", "kPa", "MPa" }; |
|
|
|
|
|
|
|
public static readonly float[][] KBList = new float[][] { new float[] { 1, 1 }, new float[] { 1000, 2 }, new float[] { 1000000, 3 } }; |
|
|
|
|
|
|
|
float coefK { get; set; } = 1f; |
|
|
|
|
|
|
|
public float CoefK |
|
|
|
public string G_TypeNameDicNoStr |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return this.coefK; |
|
|
|
return gunNameTypeDic[g_TypeNameDicNo]; //查找Dictionary返回它的Value
|
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
this.coefK = value; |
|
|
|
this.PropertiesC(); |
|
|
|
int selectedIndex = 0; |
|
|
|
foreach (KeyValuePair<int, string> pair in gunNameTypeDic) |
|
|
|
{ |
|
|
|
if (pair.ToString().Equals(value)) //对比键值对
|
|
|
|
{ |
|
|
|
selectedIndex = pair.Key; |
|
|
|
} |
|
|
|
} |
|
|
|
G_TypeNameDicNo = selectedIndex; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void UpdateKBValue() |
|
|
|
private Dictionary<int, string> gunNameTypeDic; |
|
|
|
public Dictionary<int, string> GunNameTypeDic |
|
|
|
{ |
|
|
|
int idx = -1; |
|
|
|
for (int j = 0; j < this.UnitList.Length; j++) |
|
|
|
get |
|
|
|
{ |
|
|
|
if (this.UnitList[j] == this.unitstr) |
|
|
|
{ |
|
|
|
idx = j; break; |
|
|
|
} |
|
|
|
return gunNameTypeDic; |
|
|
|
} |
|
|
|
if (idx == -1) return; |
|
|
|
//throw new System.Exception("no Unit in UnitList: unit " + this.UnitStr + " UnitList {" + string.Join(", ", this.UnitList)+"}");
|
|
|
|
} |
|
|
|
|
|
|
|
public ObservableCollection<string> SelectionList //ObservableCollection这是一个类,需引用(using System.Collections.ObjectModel)
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
get { return _selectionList; } |
|
|
|
|
|
|
|
set { _selectionList = value; } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private ObservableCollection<string> _selectionList = new ObservableCollection<string>(); //这个是实现的重要一步
|
|
|
|
|
|
|
|
/* private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) |
|
|
|
{ |
|
|
|
var cb = (sender as System.Windows.Controls.ComboBox); |
|
|
|
if (cb == null || cb.Tag == null) return; |
|
|
|
int idx = int.Parse(cb.Tag.ToString()); |
|
|
|
// var bindDataGridDatas = this.Grid_RRODUCT.ItemsSource as BindDataGridData[];//成员变量和这里转换都可以。
|
|
|
|
// bindDataGridDatas[idx].UnitStr = (string)cb.SelectedItem;//手动保存到数据结构
|
|
|
|
// bindDataGridDatas[idx].UpdateKBValue(); //联动CoefK值
|
|
|
|
} |
|
|
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged; |
|
|
|
|
|
|
|
private void PropertiesC([CallerMemberName] string propertyName = "") |
|
|
|
{ |
|
|
|
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
|
|
|
} |
|
|
|
|
|
|
|
public int Idx { get; set; } = 0; |
|
|
|
|
|
|
|
string unitstr = "Pa"; |
|
|
|
|
|
|
|
public string UnitStr |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return this.unitstr; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
this.unitstr = value; |
|
|
|
this.PropertiesC(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public string[] UnitList { get; set; } = new string[] { "Pa", "kPa", "MPa" }; |
|
|
|
|
|
|
|
public static readonly float[][] KBList = new float[][] { new float[] { 1, 1 }, new float[] { 1000, 2 }, new float[] { 1000000, 3 } }; |
|
|
|
|
|
|
|
float coefK { get; set; } = 1f; |
|
|
|
|
|
|
|
public float CoefK |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return this.coefK; |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
this.coefK = value; |
|
|
|
this.PropertiesC(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void UpdateKBValue() |
|
|
|
{ |
|
|
|
int idx = -1; |
|
|
|
for (int j = 0; j < this.UnitList.Length; j++) |
|
|
|
{ |
|
|
|
if (this.UnitList[j] == this.unitstr) |
|
|
|
{ |
|
|
|
idx = j; break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (idx == -1) return; |
|
|
|
//throw new System.Exception("no Unit in UnitList: unit " + this.UnitStr + " UnitList {" + string.Join(", ", this.UnitList)+"}");
|
|
|
|
|
|
|
|
//this.CoefK = BindDataGridData.KBList[idx][0];
|
|
|
|
}*/ |
|
|
|
//this.CoefK = BindDataGridData.KBList[idx][0];
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -520,7 +590,7 @@ namespace formula_manage |
|
|
|
|
|
|
|
Procedures_N.Text = "1"; |
|
|
|
Procedures_P.Text = "1"; |
|
|
|
// RecipedataTable = RRODUCTdataTable;
|
|
|
|
RecipedataTable = RRODUCTdataTable; |
|
|
|
} |
|
|
|
|
|
|
|
private void Button_NewOrder(object sender, RoutedEventArgs e) //新料单按钮
|
|
|
|
|