Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage
This commit is contained in:
commit
64e43048a2
7 files changed
+202
-64
No files matched your search
@@ -2,8 +2,13 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="clr-namespace:formula_manage"
|
xmlns:local="clr-namespace:formula_manage"
|
||||||
StartupUri="Login.xaml">
|
StartupUri="Login.xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
d1p1:Ignorable="d" xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
>
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" xmlns:vm="clr-namespace:formula_manage.ViewModel" />
|
||||||
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
+14
-2
@@ -6,7 +6,12 @@
|
|||||||
xmlns:local="clr-namespace:formula_manage"
|
xmlns:local="clr-namespace:formula_manage"
|
||||||
mc:Ignorable="d" Loaded="Window_MIN"
|
mc:Ignorable="d" Loaded="Window_MIN"
|
||||||
Title="SUNLIGHT" Height="720" Width="1280" MinHeight="720" MinWidth="1280"
|
Title="SUNLIGHT" Height="720" Width="1280" MinHeight="720" MinWidth="1280"
|
||||||
|
DataContext="{Binding Source={StaticResource Locator}, Path=Main}"
|
||||||
BorderBrush="White" Background="#FFE0E0E0">
|
BorderBrush="White" Background="#FFE0E0E0">
|
||||||
|
<Window.Resources>
|
||||||
|
<CollectionViewSource x:Key="BarCollectionSource" Source="{Binding Path=BarCollection}"/>
|
||||||
|
</Window.Resources>
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Menu IsTabStop="False">
|
<Menu IsTabStop="False">
|
||||||
<MenuItem x:Name="tab" Header="_文件" FontSize="16" Focusable ="False" >
|
<MenuItem x:Name="tab" Header="_文件" FontSize="16" Focusable ="False" >
|
||||||
@@ -71,7 +76,7 @@
|
|||||||
<ComboBoxItem Content="正常单"></ComboBoxItem>
|
<ComboBoxItem Content="正常单"></ComboBoxItem>
|
||||||
<ComboBoxItem Content="追加单"></ComboBoxItem>
|
<ComboBoxItem Content="追加单"></ComboBoxItem>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<TextBox x:Name="Procedures_N" HorizontalAlignment="Left" Height="30" Margin="300,140,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="80" FontSize="20"
|
<TextBox x:Name="Procedures_N" HorizontalAlignment="Left" Height="30" Margin="300,140,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="85" FontSize="20"
|
||||||
KeyUp="SearchBox_OnKeyDownd" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False"/>
|
KeyUp="SearchBox_OnKeyDownd" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False"/>
|
||||||
<Button Content="+" HorizontalAlignment="Left" Height="15" Width="20" Margin="385,140,0,0" VerticalAlignment="Top" FontSize="10"
|
<Button Content="+" HorizontalAlignment="Left" Height="15" Width="20" Margin="385,140,0,0" VerticalAlignment="Top" FontSize="10"
|
||||||
Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" Click="Button_up" IsTabStop="False" Focusable ="False"/>
|
Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" Click="Button_up" IsTabStop="False" Focusable ="False"/>
|
||||||
@@ -157,7 +162,14 @@
|
|||||||
<DataGridTemplateColumn Header="原料代码" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
|
<DataGridTemplateColumn Header="原料代码" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ComboBox x:Name="CP_PRODUCT_CODE" BorderThickness="0,0,0,0" ItemsSource="{Binding RRODUCTdataTable}" DisplayMemberPath="{Binding Path=ProductCode}" BorderBrush="{x:Null}" Background="{x:Null}" IsEditable="True" KeyDown="CP_PRODUCT_CODE_KeyUp"
|
<ComboBox x:Name="CP_PRODUCT_CODE" BorderThickness="0,0,0,0"
|
||||||
|
|
||||||
|
DisplayMemberPath="Name"
|
||||||
|
SelectedItem="{Binding Bar, UpdateSourceTrigger=LostFocus}"
|
||||||
|
ItemsSource="{Binding Source={StaticResource BarCollectionSource}}"
|
||||||
|
|
||||||
|
Text="{Binding PRODUCT_CODE}"
|
||||||
|
BorderBrush="{x:Null}" Background="{x:Null}" IsEditable="True" KeyDown="CP_PRODUCT_CODE_KeyUp"
|
||||||
>
|
>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|||||||
+55
-21
@@ -2,11 +2,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -126,48 +128,79 @@ namespace formula_manage
|
|||||||
comboBox1.ItemsSource = STUFFdataTable.DefaultView;*/
|
comboBox1.ItemsSource = STUFFdataTable.DefaultView;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private int g_TypeNameDicNo; //枪型号名
|
|
||||||
|
|
||||||
public int G_TypeNameDicNo
|
/* 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
|
get
|
||||||
{
|
{
|
||||||
return g_TypeNameDicNo;
|
return this.unitstr;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
g_TypeNameDicNo = value;
|
this.unitstr = value;
|
||||||
|
this.PropertiesC();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string G_TypeNameDicNoStr
|
|
||||||
|
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
|
get
|
||||||
{
|
{
|
||||||
return gunNameTypeDic[g_TypeNameDicNo]; //查找Dictionary返回它的Value
|
return this.coefK;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
int selectedIndex = 0;
|
this.coefK = value;
|
||||||
foreach (KeyValuePair<int, string> pair in gunNameTypeDic)
|
this.PropertiesC();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateKBValue()
|
||||||
|
{
|
||||||
|
int idx = -1;
|
||||||
|
for (int j = 0; j < this.UnitList.Length; j++)
|
||||||
|
{
|
||||||
|
if (this.UnitList[j] == this.unitstr)
|
||||||
{
|
{
|
||||||
if (pair.ToString().Equals(value)) //对比键值对
|
idx = j; break;
|
||||||
{
|
|
||||||
selectedIndex = pair.Key;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
G_TypeNameDicNo = selectedIndex;
|
|
||||||
}
|
}
|
||||||
}
|
if (idx == -1) return;
|
||||||
|
//throw new System.Exception("no Unit in UnitList: unit " + this.UnitStr + " UnitList {" + string.Join(", ", this.UnitList)+"}");
|
||||||
|
|
||||||
private Dictionary<int, string> gunNameTypeDic;
|
//this.CoefK = BindDataGridData.KBList[idx][0];
|
||||||
public Dictionary<int, string> GunNameTypeDic
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return gunNameTypeDic;
|
|
||||||
}
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private async void sql_()
|
private async void sql_()
|
||||||
{
|
{
|
||||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||||
@@ -487,6 +520,7 @@ namespace formula_manage
|
|||||||
|
|
||||||
Procedures_N.Text = "1";
|
Procedures_N.Text = "1";
|
||||||
Procedures_P.Text = "1";
|
Procedures_P.Text = "1";
|
||||||
|
// RecipedataTable = RRODUCTdataTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_NewOrder(object sender, RoutedEventArgs e) //新料单按钮
|
private void Button_NewOrder(object sender, RoutedEventArgs e) //新料单按钮
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
using formula_manage.SQLModels;
|
||||||
|
using formula_manage.Windows;
|
||||||
|
using GalaSoft.MvvmLight;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace formula_manage.ViewModel
|
||||||
|
{
|
||||||
|
///<Summary>
|
||||||
|
/// RRODUCTiewModel
|
||||||
|
///</Summary>
|
||||||
|
public class MainWindowViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public MainWindowViewModel()
|
||||||
|
{
|
||||||
|
BarCollection = new ObservableCollection<BarModel>
|
||||||
|
{
|
||||||
|
new BarModel { Id = 1, Name = "Bar 1", },
|
||||||
|
new BarModel { Id = 2, Name = "Bar 2", },
|
||||||
|
new BarModel { Id = 3, Name = "Bar 3", },
|
||||||
|
};
|
||||||
|
|
||||||
|
FooCollection = new ObservableCollection<FooViewModel>
|
||||||
|
{
|
||||||
|
new FooViewModel{ Id = 1, },
|
||||||
|
new FooViewModel{ Id = 2, },
|
||||||
|
new FooViewModel{ Id = 3, },
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableCollection<BarModel> BarCollection { get; set; }
|
||||||
|
public ObservableCollection<FooViewModel> FooCollection { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FooViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
private BarModel _bar;
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
public BarModel Bar { get => _bar; set => Set(ref _bar, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BarModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// StuffViewModeldl
|
||||||
|
/// </summary>
|
||||||
|
/* public RRODUCTiewModel()
|
||||||
|
{
|
||||||
|
//products = new ProductProvider().Select();
|
||||||
|
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
|
||||||
|
{
|
||||||
|
Interval = TimeSpan.FromSeconds(0.1)
|
||||||
|
};
|
||||||
|
timer.Tick += Tick_Event;
|
||||||
|
timer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
|
||||||
|
{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
using formula_manage.SQLModels;
|
|
||||||
using formula_manage.Windows;
|
|
||||||
using GalaSoft.MvvmLight;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Threading;
|
|
||||||
|
|
||||||
namespace formula_manage.ViewModel
|
|
||||||
{
|
|
||||||
///<Summary>
|
|
||||||
/// RRODUCTiewModel
|
|
||||||
///</Summary>
|
|
||||||
public class RRODUCTiewModel : ViewModelBase
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// StuffViewModeldl
|
|
||||||
/// </summary>
|
|
||||||
public RRODUCTiewModel()
|
|
||||||
{
|
|
||||||
//products = new ProductProvider().Select();
|
|
||||||
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
|
|
||||||
{
|
|
||||||
Interval = TimeSpan.FromSeconds(0.1)
|
|
||||||
};
|
|
||||||
timer.Tick += Tick_Event;
|
|
||||||
timer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
using CommonServiceLocator;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using GalaSoft.MvvmLight;
|
||||||
|
using GalaSoft.MvvmLight.Ioc;
|
||||||
|
|
||||||
|
namespace formula_manage.ViewModel
|
||||||
|
{
|
||||||
|
public class ViewModelLocator
|
||||||
|
{
|
||||||
|
public ViewModelLocator()
|
||||||
|
{
|
||||||
|
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
|
||||||
|
|
||||||
|
////if (ViewModelBase.IsInDesignModeStatic)
|
||||||
|
////{
|
||||||
|
//// // Create design time view services and models
|
||||||
|
//// SimpleIoc.Default.Register<IDataService, DesignDataService>();
|
||||||
|
////}
|
||||||
|
////else
|
||||||
|
////{
|
||||||
|
//// // Create run time view services and models
|
||||||
|
//// SimpleIoc.Default.Register<IDataService, DataService>();
|
||||||
|
////}
|
||||||
|
|
||||||
|
SimpleIoc.Default.Register<MainWindowViewModel>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MainWindowViewModel Main
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ServiceLocator.Current.GetInstance<MainWindowViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -178,7 +178,8 @@
|
|||||||
<Compile Include="SQLModels\STUFF_Product.cs" />
|
<Compile Include="SQLModels\STUFF_Product.cs" />
|
||||||
<Compile Include="UserClass\IniFile.cs" />
|
<Compile Include="UserClass\IniFile.cs" />
|
||||||
<Compile Include="UserClass\PressKey.cs" />
|
<Compile Include="UserClass\PressKey.cs" />
|
||||||
<Compile Include="ViewModel\RRODUCTViewModel.cs" />
|
<Compile Include="ViewModel\MainWindowViewModel.cs" />
|
||||||
|
<Compile Include="ViewModel\ViewModelLocator.cs" />
|
||||||
<Compile Include="View\Formula.xaml.cs">
|
<Compile Include="View\Formula.xaml.cs">
|
||||||
<DependentUpon>Formula.xaml</DependentUpon>
|
<DependentUpon>Formula.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
Reference in new issue
Block a user