Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage
This commit is contained in:
commit
64e43048a2
7 files changed
+207
-69
No files matched your search
@@ -2,8 +2,13 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
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>
|
||||
|
||||
<ResourceDictionary>
|
||||
<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" xmlns:vm="clr-namespace:formula_manage.ViewModel" />
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
+14
-2
@@ -6,7 +6,12 @@
|
||||
xmlns:local="clr-namespace:formula_manage"
|
||||
mc:Ignorable="d" Loaded="Window_MIN"
|
||||
Title="SUNLIGHT" Height="720" Width="1280" MinHeight="720" MinWidth="1280"
|
||||
DataContext="{Binding Source={StaticResource Locator}, Path=Main}"
|
||||
BorderBrush="White" Background="#FFE0E0E0">
|
||||
<Window.Resources>
|
||||
<CollectionViewSource x:Key="BarCollectionSource" Source="{Binding Path=BarCollection}"/>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid>
|
||||
<Menu IsTabStop="False">
|
||||
<MenuItem x:Name="tab" Header="_文件" FontSize="16" Focusable ="False" >
|
||||
@@ -71,7 +76,7 @@
|
||||
<ComboBoxItem Content="正常单"></ComboBoxItem>
|
||||
<ComboBoxItem Content="追加单"></ComboBoxItem>
|
||||
</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"/>
|
||||
<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"/>
|
||||
@@ -157,7 +162,14 @@
|
||||
<DataGridTemplateColumn Header="原料代码" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<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>
|
||||
</DataTemplate>
|
||||
|
||||
+60
-26
@@ -2,11 +2,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
@@ -126,48 +128,79 @@ namespace formula_manage
|
||||
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
|
||||
{
|
||||
return g_TypeNameDicNo;
|
||||
return this.unitstr;
|
||||
}
|
||||
set
|
||||
{
|
||||
g_TypeNameDicNo = value;
|
||||
}
|
||||
}
|
||||
public string G_TypeNameDicNoStr
|
||||
{
|
||||
get
|
||||
{
|
||||
return gunNameTypeDic[g_TypeNameDicNo]; //查找Dictionary返回它的Value
|
||||
}
|
||||
set
|
||||
{
|
||||
int selectedIndex = 0;
|
||||
foreach (KeyValuePair<int, string> pair in gunNameTypeDic)
|
||||
{
|
||||
if (pair.ToString().Equals(value)) //对比键值对
|
||||
{
|
||||
selectedIndex = pair.Key;
|
||||
}
|
||||
}
|
||||
G_TypeNameDicNo = selectedIndex;
|
||||
this.unitstr = value;
|
||||
this.PropertiesC();
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<int, string> gunNameTypeDic;
|
||||
public Dictionary<int, string> GunNameTypeDic
|
||||
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 gunNameTypeDic;
|
||||
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];
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
private async void sql_()
|
||||
{
|
||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||
@@ -487,6 +520,7 @@ namespace formula_manage
|
||||
|
||||
Procedures_N.Text = "1";
|
||||
Procedures_P.Text = "1";
|
||||
// RecipedataTable = RRODUCTdataTable;
|
||||
}
|
||||
|
||||
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="UserClass\IniFile.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">
|
||||
<DependentUpon>Formula.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
Reference in new issue
Block a user