Browse Source

助剂手动输送页面

master
sc 7 months ago
parent
commit
9001efee9c
  1. 90
      EX/ManualDyelot.xaml
  2. 282
      EX/ManualDyelot.xaml.cs
  3. 18
      Properties/Resources.Designer.cs
  4. 6
      Properties/Resources.en-US.resx
  5. 6
      Properties/Resources.resx
  6. 8
      Properties/Resources.zh-CN.resx
  7. 10
      Properties/Resources.zh-TW.resx
  8. 2
      SunlightCentralizedControlManagement_SCCM_.csproj
  9. 5
      UserControls/DispenseMacInfo.xaml
  10. 4
      UserControls/DispenseMacInfo.xaml.cs
  11. 12
      View/DispenseMachinesSet.xaml.cs
  12. 1
      View/DispenseView.xaml.cs
  13. 1
      View/ProgramgroupView.xaml.cs
  14. 108
      ViewModel/ManualDyelotModel.cs
  15. 7
      ViewModel/ViewModelLocator.cs

90
EX/ManualDyelot.xaml

@ -6,19 +6,26 @@
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.EX"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
xmlns:System="clr-namespace:System;assembly=mscorlib"
xmlns:core="clr-namespace:System;assembly=netstandard"
d:DataContext="{d:DesignInstance Type=viewmodel:ManualDyelotModel}"
mc:Ignorable="d" ResizeMode="NoResize" WindowStyle="None" WindowStartupLocation="CenterScreen"
Title="ManualDyelot" Height="960" Width="1280">
<Window.Resources>
<viewmodel:ManualDyelotModel x:Key="ManualDyelotModel"/>
</Window.Resources>
<Grid Background="#FFC9C9C9">
<Grid Margin="5,5,5,5" Background="White">
<DataGrid x:Name="Grid_data" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=99}"
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"
GridLinesVisibility="All" ColumnHeaderHeight="50"
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single" FontSize="20" Margin="0,0,400,0">
<DataGrid x:Name="Grid_data" AlternationCount="2" d:ItemsSource="{d:SampleData ItemCount=99}"
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"
GridLinesVisibility="All" ColumnHeaderHeight="50" BorderThickness="0,0,5,0"
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column"
SelectionMode="Single" FontSize="20" Margin="5,5,500,5">
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="55" />
<Setter Property="FontSize" Value="35" />
<Setter Property="Height" Value="35" />
<Setter Property="FontSize" Value="20" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
@ -45,12 +52,73 @@ CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" Sel
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="{x:Static lang:Resources.ProductCode}" Binding="{Binding ProductCode}" Width="300" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.ProductName}" Binding="{Binding ProductName}" Width="300" IsReadOnly="True" />
<DataGridTextColumn Header="KG" Binding="{Binding Weight}" Width="*" />
<DataGridTemplateColumn Header="{x:Static lang:Resources.ProductCode}" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="CP_PRODUCT_CODE" BorderThickness="0,0,0,0"
ItemsSource="{Binding stuff_Product, Source={StaticResource ManualDyelotModel}}"
DisplayMemberPath="ProductCode"
Text="{Binding PRODUCT_CODE}" IsTextSearchEnabled="True" StaysOpenOnEdit="True"
BorderBrush="{x:Null}" Background="{x:Null}"
DropDownClosed="CP_PRODUCT_CODE_DropDownClosed">
</ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.ProcessName}" Width="200" MaxWidth="400" MinWidth="100" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="CP_PRODUCT_NAME" BorderThickness="0,0,0,0"
ItemsSource="{Binding stuff_Product, Source={StaticResource ManualDyelotModel}}"
DisplayMemberPath="ProductName"
Text="{Binding PRODUCT_NAME}"
DropDownClosed="CP_PRODUCT_NAME_DropDownClosed"
BorderBrush="{x:Null}" Background="{x:Null}" Focusable="True" IsTabStop="False"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Grams}" Width="200" MaxWidth="400" MinWidth="100" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox x:Name="CP_CONC" BorderThickness="0,0,0,0" Text="{Binding CONC}"
BorderBrush="{x:Null}" Background="{x:Null}"
KeyDown="CP_CONC_KeyDown" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<Button x:Name="State" Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Right" Height="55" Margin="0,0,15,10" VerticalAlignment="Bottom" Width="200" Click="State_Click" Padding="0,4,0,4" FontSize="20"/>
<Button x:Name="State" Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Right" Height="55" Margin="0,0,280,10" VerticalAlignment="Bottom" Width="200" Click="State_Click" Padding="0,4,0,4" FontSize="20"/>
<Button x:Name="Cancel" Content="{x:Static lang:Resources.Cancel}" HorizontalAlignment="Right" Height="55" Margin="0,0,15,10" VerticalAlignment="Bottom" Width="200" Click="Cancel_Click" Padding="0,4,0,4" FontSize="20"/>
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,100,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.orders}"
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,100,15,0" TextWrapping="Wrap" x:Name="orders"
VerticalAlignment="Top" Width="350" FontSize="35"/>
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,150,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Dyelot}"
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,150,15,0" TextWrapping="Wrap" x:Name="dyelot"
VerticalAlignment="Top" Width="350" FontSize="35"/>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="50" VerticalAlignment="Top" Margin="150,200,15,0" HorizontalAlignment="Right" Width="350">
<ComboBox Height="50" x:Name="comboBoxMachine" VerticalAlignment="Stretch"
FontSize="35" DropDownClosed="comboBoxMachine_DropDownClosed" />
</Border>
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,200,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}"
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="50" VerticalAlignment="Top" Margin="150,250,15,0" HorizontalAlignment="Right" Width="350">
<ComboBox Height="50" x:Name="comboBoxtank" VerticalAlignment="Stretch" FontSize="35" />
</Border>
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,250,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Tank}"
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="50" VerticalAlignment="Top" Margin="150,300,15,0" HorizontalAlignment="Right" Width="350">
<TextBox Height="50" x:Name="comboBoxTotal" VerticalAlignment="Stretch" FontSize="35" />
</Border>
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,300,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Total}"
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
</Grid>
</Grid>
</Window>

282
EX/ManualDyelot.xaml.cs

@ -16,6 +16,15 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.Reflection;
using System.Xml.Linq;
using DyeingComputer.UserClass;
using System.Windows.Forms;
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
using OpenTK.Graphics.OpenGL;
using ScottPlot.TickGenerators.TimeUnits;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
namespace SunlightCentralizedControlManagement_SCCM_.EX
{
@ -24,15 +33,62 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
/// </summary>
public partial class ManualDyelot : Window
{
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
DataTable dyelotdat = new DataTable();
public static string Machines;
DataTable mach = new DataTable();
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT缓存
int ID_N = 1;
int type_;
DateTime time = DateTime.Now;
public ManualDyelot()
{
InitializeComponent();
State.IsEnabled = false;
string[] strings = { "0", "1", "2", "3" };
comboBoxtank.ItemsSource = strings;
comboBoxtank.Text = "0";
comboBoxTotal.Text = "0";
int mrc = MainWindowViewModel.Machines.Rows.Count;
string[] stringsM = new string[mrc];
for (int i = 0; i < mrc; i++)
{
stringsM[i] = MainWindowViewModel.Machines.Rows[i]["name"].ToString();
}
comboBoxMachine.ItemsSource = stringsM;
dyelot.Text = "00_" + DateTime.Now.ToString("yyMMddHHmmss");
RRODUCTdataTable.Columns.Add("ID", typeof(int));
RRODUCTdataTable.Columns.Add("DYELOT", typeof(string));
RRODUCTdataTable.Columns.Add("ReDye", typeof(int));
RRODUCTdataTable.Columns.Add("STEP", typeof(int));
RRODUCTdataTable.Columns.Add("ProductType", typeof(int));
RRODUCTdataTable.Columns.Add("Created", typeof(string));
RRODUCTdataTable.Columns.Add("PRODUCT_CODE", typeof(string));
RRODUCTdataTable.Columns.Add("PRODUCT_NAME", typeof(string));
RRODUCTdataTable.Columns.Add("TARGET_WT", typeof(float));
RRODUCTdataTable.Columns.Add("Amount", typeof(string));
RRODUCTdataTable.Columns.Add("UNIT", typeof(string));
DataRow row = RRODUCTdataTable.NewRow(); //ID列
row["ID"] = ID_N;
row["DYELOT"] = dyelot.Text;
row["ReDye"] = 0;
row["STEP"] = "1";
row["ProductType"] = type_;
row["Created"] = time;
row["UNIT"] = "g";
RRODUCTdataTable.Rows.Add(row);
Grid_data.ItemsSource = RRODUCTdataTable.DefaultView;
}
public async void MAC(object Machines)
public void MAC(object Mac,int t)
{
string Connstr_SC;
Machines = Mac.ToString();
type_ = t;
/* string Connstr_SC;
string sql = "SELECT * FROM [dbo].[Pipes] WHERE Dispenser = '" + Machines + "'";
try
{
if (MainWindowViewModel.SQMOD == "Windows Authentication")
@ -45,22 +101,232 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
}
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
await conn_SC.OpenAsync(); //连接数据库
SqlDataAdapter _data = new SqlDataAdapter(sql, Connstr_SC); //查询
new SqlDataAdapter(sql, Connstr_SC).Fill(dyelotdat);
// SqlDataAdapter _data = new SqlDataAdapter(sql, Connstr_SC); //查询
conn_SC.Close();
DataTable ds = new DataTable();//载入信息
_data.Fill(ds);
Grid_data.ItemsSource = ds.DefaultView;
for (int i = 0; i < dyelotdat.Rows.Count; i++)
{
SelectProductCode.Add(dyelotdat.Rows[i].Field<string>("ProductCode"));
SelectProductName.Add(dyelotdat.Rows[i].Field<string>("ProductName"));
}
}
catch (Exception ex)
{
LogGing.ERRDATA(ex);
}*/
}
private async void State_Click(object sender, RoutedEventArgs e)//确认按键
{
int t = RRODUCTdataTable.Rows.Count; //获取数据行包含空白行
RRODUCTdataTable.Rows[t - 1].Delete();
RRODUCTdataTable.AcceptChanges();
if (string.IsNullOrEmpty(comboBoxMachine.Text)) return;//未输入机台时返回
try
{
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
Dictionary<string, object> Dyelot_DAT = new Dictionary<string, object>();//缓存函数
for (int x = 0; x < RRODUCTdataTable.Rows.Count; x++)
{
Dyelot_DAT.Add("WorkOrder", orders.Text);
Dyelot_DAT.Add("Dyelot", RRODUCTdataTable.Rows[x]["Dyelot"]);
Dyelot_DAT.Add("Redye", RRODUCTdataTable.Rows[x]["Redye"]);
Dyelot_DAT.Add("Step", RRODUCTdataTable.Rows[x]["Step"]);
Dyelot_DAT.Add("TIME", RRODUCTdataTable.Rows[x]["Created"]);
Dyelot_DAT.Add("Tank", comboBoxtank.Text);
Dyelot_DAT.Add("State", "201");
Dyelot_DAT.Add("Machine", comboBoxMachine.Text);
Dyelot_DAT.Add("ProductCode", RRODUCTdataTable.Rows[x]["PRODUCT_CODE"]);
Dyelot_DAT.Add("ProductName", RRODUCTdataTable.Rows[x]["PRODUCT_NAME"]);
Dyelot_DAT.Add("ProductType", RRODUCTdataTable.Rows[x]["ProductType"]);
Dyelot_DAT.Add("DispenseStartTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
Dyelot_DAT.Add("Grams", RRODUCTdataTable.Rows[x]["TARGET_WT"]);
Dyelot_DAT.Add("Amount", RRODUCTdataTable.Rows[x]["Amount"]);
SQLiteHelpers.InsertData("Dyelot", Dyelot_DAT);//行插入
Dyelot_DAT.Clear();
}
SQLiteHelpers.Close(); //关闭连接
LogGing.ExchangeDATA("Dyelot=" + dyelot.Text + ";Machine=" + comboBoxMachine.Text +
";Program=------;User=" + MainWindowViewModel.USER_data + ";");
string Connstr_SC;
if (MainWindowViewModel.SQMOD == "Windows Authentication")
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD;
}
SqlConnection destinationConnection = new SqlConnection(Connstr_SC); //创建一个数据库连接;
await destinationConnection.OpenAsync(); //打开连接
//写总览
string dyelots_sql = string.Format("INSERT INTO [dbo].[DYELOTS]([Dyelot] ,[ReDye] , [OrderNo] , [Machine] ,[DispenseMachine] ,[UserAccount] ) " +
"VALUES ('" + dyelot.Text + "','0','" + orders.Text + "','" + comboBoxMachine.Text + "','" + comboBoxMachine.Text + "','" + MainWindow.user_ + "')");
SqlCommand INSERT_cmd = new SqlCommand(dyelots_sql, destinationConnection);
int dyelots_sqlIN = INSERT_cmd.ExecuteNonQuery(); //执行语句
//写明细
SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection);// 实例化 sqlbulkcopy;
bulkCopy.DestinationTableName = "dbo.DyelotsBulkedRecipe";// 目标表名称/
bulkCopy.ColumnMappings.Add("DYELOT", "Dyelot");
bulkCopy.ColumnMappings.Add("ReDye", "ReDye");
bulkCopy.ColumnMappings.Add("STEP", "StepNumber");
bulkCopy.ColumnMappings.Add("PRODUCT_CODE", "ProductCode");
bulkCopy.ColumnMappings.Add("PRODUCT_NAME", "ProductName");
bulkCopy.ColumnMappings.Add("ProductType", "ProductType");
bulkCopy.ColumnMappings.Add("Created", "Created");
bulkCopy.ColumnMappings.Add("Amount", "Amount");
bulkCopy.ColumnMappings.Add("TARGET_WT", "Grams");
bulkCopy.WriteToServer(RRODUCTdataTable); //将传入的数据写到数据库;
string mac_sql = string.Format("UPDATE [dbo].[Machines] SET DispenseDyelot='" + dyelot.Text
+ "',DispenseReDye='0',ChemicalCallOff=1,ChemicalState=201,ChemicalTank='" + comboBoxtank.Text
+ "' WHERE NAME='" + comboBoxMachine.Text + "'");
SqlCommand UPDATE_mac = new SqlCommand(mac_sql, destinationConnection);
int mac_ = UPDATE_mac.ExecuteNonQuery(); //执行语句
if (mac_ == 0) System.Windows.Forms.MessageBox.Show(Properties.Resources.Not_M);
destinationConnection.Close();
this.Close();//退出页面
}
catch (Exception ex)
{
LogGing.ERRDATA(ex);
System.Windows.Forms.MessageBox.Show(ex.Message.ToString());
}
}
private void State_Click(object sender, RoutedEventArgs e)
private void comboBoxMachine_DropDownClosed(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(comboBoxMachine.Text))
{
if (MainWindowViewModel.Machines.Select("NAME = '" + comboBoxMachine.Text + "'").First().Field<string>("WorkOrder") != "------")
{ orders.Text = MainWindowViewModel.Machines.Select("NAME = '" + comboBoxMachine.Text + "'").First().Field<string>("WorkOrder"); }
else { orders.Text = dyelot.Text; }
}
}
private void Cancel_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
public ObservableCollection<string> SelectProductCode
{
get { return _selectProductCode; }
set { _selectProductCode = value; }
}
private ObservableCollection<string> _selectProductCode = new ObservableCollection<string>();
public ObservableCollection<string> SelectProductName
{
get { return _selectProductName; }
set { _selectProductName = value; }
}
private ObservableCollection<string> _selectProductName = new ObservableCollection<string>();
string Code_;
string Name_;
private void CP_PRODUCT_CODE_DropDownClosed(object sender, EventArgs e)//代码选择事件
{
State.IsEnabled = false;
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
int grid_row = Grid_data.SelectedIndex; //获取当前行
Code_ = curComboBox.Text.TrimEnd();
DataRow[] r = ManualDyelotModel.STUFFdataTable.Select("ProductCode ='" + Code_ + "'"); //查询判断原料代码是否有效
if (!r.Any()) //检查原料信息
{
return;
}
int ID_ = grid_row + 1;
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'and ID <> '" + ID_ + "'");//查询判断原料代码是否重复
if (c.Any())
{
curComboBox.Text = null;
System.Windows.MessageBox.Show(Properties.Resources.RTRM);
return;
}
Name_ = r[0].ItemArray[1].ToString();
if (grid_row == -1) grid_row = 0;
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
row.BeginEdit();
row["PRODUCT_CODE"] = Code_;
row["PRODUCT_NAME"] = Name_;
row.EndEdit();
DataGridHelper.SetRealTimeCommit(Grid_data, true); //实时更新datagrid
}
private void CP_PRODUCT_NAME_DropDownClosed(object sender, EventArgs e)//选择原料事件
{
State.IsEnabled = false;
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
int grid_row = Grid_data.SelectedIndex; //获取当前行
if (curComboBox.Text != "")
{
Name_ = curComboBox.Text.TrimEnd();
DataRow[] r = ManualDyelotModel.STUFFdataTable.Select("ProductName ='" + Name_ + "'"); //查询判断原料代码是否有效
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_NAME ='" + Name_ + "'");//查询判断原料代码是否重复
if (c.Any())
{
curComboBox.Text = null;
System.Windows.MessageBox.Show(Properties.Resources.RTRM);
return;
}
Code_ = r[0].ItemArray[0].ToString();
if (grid_row == -1) grid_row = 0;
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
row.BeginEdit();
row["PRODUCT_CODE"] = Code_;
row["PRODUCT_NAME"] = Name_;
row.EndEdit();
}
}
private void CP_CONC_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)//输入目标量事件
{
System.Windows.Controls.TextBox textBox = sender as System.Windows.Controls.TextBox;
int grid_row = Grid_data.SelectedIndex; //获取当前行
if (string.IsNullOrEmpty(textBox.Text)) return;
if (e.Key == Key.Enter)
{
if (grid_row == -1) grid_row = 0;
DataRow row = RRODUCTdataTable.Rows[grid_row];
if (string.IsNullOrEmpty(row["PRODUCT_CODE"].ToString()))
{
textBox.Text = null;
return;
}
row.BeginEdit();
row["Amount"] = textBox.Text + "g";
row["TARGET_WT"] = textBox.Text;
row.EndEdit();
ID_N++;
DataRow rowadd = RRODUCTdataTable.NewRow(); //ID列
rowadd["ID"] = ID_N;
rowadd["DYELOT"] = dyelot.Text;
rowadd["ReDye"] = 0;
rowadd["STEP"] = "1";
row["ProductType"] = type_;
rowadd["Created"] = time;
rowadd["UNIT"] = "g";
RRODUCTdataTable.Rows.Add(rowadd);
State.IsEnabled = true;
}
}
}
}

18
Properties/Resources.Designer.cs

@ -1500,6 +1500,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 NOT Machine 的本地化字符串。
/// </summary>
public static string Not_M {
get {
return ResourceManager.GetString("Not_M", resourceCulture);
}
}
/// <summary>
/// 查找类似 Notimplementation 的本地化字符串。
/// </summary>
@ -2211,6 +2220,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 Repeat the raw material 的本地化字符串。
/// </summary>
public static string RTRM {
get {
return ResourceManager.GetString("RTRM", resourceCulture);
}
}
/// <summary>
/// 查找类似 RunningTime 的本地化字符串。
/// </summary>

6
Properties/Resources.en-US.resx

@ -1032,4 +1032,10 @@
<data name="Information" xml:space="preserve">
<value>Information</value>
</data>
<data name="RTRM" xml:space="preserve">
<value>Repeat the raw material</value>
</data>
<data name="Not_M" xml:space="preserve">
<value>Machine does not exist</value>
</data>
</root>

6
Properties/Resources.resx

@ -1032,4 +1032,10 @@
<data name="Information" xml:space="preserve">
<value>Information</value>
</data>
<data name="RTRM" xml:space="preserve">
<value>Repeat the raw material</value>
</data>
<data name="Not_M" xml:space="preserve">
<value>NOT Machine</value>
</data>
</root>

8
Properties/Resources.zh-CN.resx

@ -586,7 +586,7 @@
<value>速率</value>
</data>
<data name="Tank" xml:space="preserve">
<value></value>
<value></value>
</data>
<data name="Tank1" xml:space="preserve">
<value>缸</value>
@ -1032,4 +1032,10 @@
<data name="Information" xml:space="preserve">
<value>信息</value>
</data>
<data name="RTRM" xml:space="preserve">
<value>重复原料</value>
</data>
<data name="Not_M" xml:space="preserve">
<value>机台不存在</value>
</data>
</root>

10
Properties/Resources.zh-TW.resx

@ -586,7 +586,7 @@
<value>速率</value>
</data>
<data name="Tank" xml:space="preserve">
<value></value>
<value></value>
</data>
<data name="Tank1" xml:space="preserve">
<value>缸</value>
@ -1030,6 +1030,12 @@
<value>運行模組</value>
</data>
<data name="Information" xml:space="preserve">
<value />
<value>訊息</value>
</data>
<data name="RTRM" xml:space="preserve">
<value>重複原料</value>
</data>
<data name="Not_M" xml:space="preserve">
<value>機台不存在</value>
</data>
</root>

2
SunlightCentralizedControlManagement_SCCM_.csproj

@ -136,6 +136,7 @@
<Compile Include="ViewModel\CurveTempModel.cs" />
<Compile Include="ViewModel\CurveDiagramViewModel.cs" />
<Compile Include="ViewModel\MainWindowViewModel.cs" />
<Compile Include="ViewModel\ManualDyelotModel.cs" />
<Compile Include="ViewModel\ViewModelLocator.cs" />
<Compile Include="View\CurveTemp.xaml.cs">
<DependentUpon>CurveTemp.xaml</DependentUpon>
@ -479,6 +480,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="ControlUse\" />
<Folder Include="EX\EXModel\" />
</ItemGroup>
<ItemGroup>
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" />

5
UserControls/DispenseMacInfo.xaml

@ -24,9 +24,12 @@
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,0,0,0" HorizontalAlignment="Right" Width="80">
<TextBlock x:Name="macg" TextWrapping="Wrap" Text="------" FontSize="16" />
</Border>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,30,0,0">
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,30,80,0">
<TextBlock x:Name="state" TextWrapping="Wrap" Text="------" FontSize="16" />
</Border>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,30,0,0" HorizontalAlignment="Right" Width="80">
<TextBlock x:Name="type_" TextWrapping="Wrap" Text="------" FontSize="16" />
</Border>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,60,0,0">
<TextBlock x:Name="WorkingStatus" TextWrapping="Wrap" Text="------" FontSize="16" />
</Border>

4
UserControls/DispenseMacInfo.xaml.cs

@ -50,9 +50,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserControls
{
MessageBox.Show(Properties.Resources.Not_a, "Dispense", MessageBoxButton.OK);
return;
}
}
ManualDyelot manualDyelot = new ManualDyelot();
manualDyelot.MAC(mac.Text);
manualDyelot.MAC(mac.Text,Convert.ToInt16(type_.Text));
manualDyelot.Show();
}

12
View/DispenseMachinesSet.xaml.cs

@ -30,6 +30,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
/// </summary>
public partial class DispenseMachinesSet : UserControl
{
int type_;
public DispenseMachinesSet()
{
InitializeComponent();
@ -82,6 +83,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dr_new.Add("Groups", TextMachineGroup.Text);
dr_new.Add("IP", IP.Text);
dr_new.Add("PORT", PORT.Text);
dr_new.Add("type", type_);
dr_new.Add("State", "899");
dr_new.Add("User", User.Text);
dr_new.Add("Passsword", Password.Text);
@ -188,41 +190,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
uri = new Uri("pack://application:,,,/LOGO/252-2t.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 1;
break;
case "252-2T":
uri = new Uri("pack://application:,,,/LOGO/252-2t.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 1;
break;
case "252RB":
uri = new Uri("pack://application:,,,/LOGO/252RB.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 1;
break;
case "252RDRM":
uri = new Uri("pack://application:,,,/LOGO/252RMRD.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 1;
break;
case "242W":
uri = new Uri("pack://application:,,,/LOGO/242w.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 1;
break;
case "302":
uri = new Uri("pack://application:,,,/LOGO/302.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 2;
break;
case "303":
uri = new Uri("pack://application:,,,/LOGO/303.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 3;
break;
case "303PDW":
case "302PDW":
uri = new Uri("pack://application:,,,/LOGO/303pdw.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 3;
break;
default:
break;

1
View/DispenseView.xaml.cs

@ -63,6 +63,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dispenseMacInfo[i].Margin = new Thickness(5, 5, 0, 5);
dispenseMacInfo[i].Width = 400;
dispenseMacInfo[i].Height = 600;
dispenseMacInfo[i].type_.Text= DispenseMac.AsEnumerable().Select(row => row.Field<int>("type")).ElementAt(i).ToString();
dispenseMacInfo[i].mac.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("name")).ElementAt(i);
dispenseMacInfo[i].macg.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("Groups")).ElementAt(i);
dispenseMacInfo[i].state.Text = StatenClassConvert.Convert(x);

1
View/ProgramgroupView.xaml.cs

@ -24,7 +24,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
DataSet sql; //内存数据缓存
string[] group_data;
public void Programgroup_sql()
{

108
ViewModel/ManualDyelotModel.cs

@ -0,0 +1,108 @@
using SunlightCentralizedControlManagement_SCCM_.EX;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
{
public class ManualDyelotModel : ViewModelBase
{
public static DataTable STUFFdataTable = new DataTable(); //建立STUFF
public ManualDyelotModel()
{
string Connstr_SC;
string sql = "SELECT * FROM [dbo].[Pipes] WHERE Dispenser = '" + ManualDyelot.Machines + "'";
try
{
if (MainWindowViewModel.SQMOD == "Windows Authentication")
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD;
}
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
conn_SC.Open(); //连接数据库
new SqlDataAdapter(sql, Connstr_SC).Fill(STUFFdataTable);
// SqlDataAdapter _data = new SqlDataAdapter(sql, Connstr_SC); //查询
conn_SC.Close();
}
catch (Exception ex)
{
LogGing.ERRDATA(ex);
}
stuff_Product = ToObservableCollection<Product>(STUFFdataTable); //stuff_Product表转换
}
public ObservableCollection<Product> stuff_Product { get; set; } //stuff_Product动态表实力化
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new() //DataTable FOR ObservableCollection转换器
{
Type t = typeof(T);
PropertyInfo[] propertys = t.GetProperties();
ObservableCollection<T> lst = new ObservableCollection<T>();
string typeName = string.Empty;
foreach (DataRow dr in dt.Rows)
{
T entity = new T();
foreach (PropertyInfo pi in propertys)
{
typeName = pi.Name;
if (dt.Columns.Contains(typeName))
{
if (!pi.CanWrite) continue;
object value = dr[typeName];
if (value == DBNull.Value) continue;
if (pi.PropertyType == typeof(string))
{
pi.SetValue(entity, value.ToString(), null);
}
else if (pi.PropertyType == typeof(int) || pi.PropertyType == typeof(int?))
{
pi.SetValue(entity, int.Parse(value.ToString()), null);
}
else if (pi.PropertyType == typeof(DateTime?) || pi.PropertyType == typeof(DateTime))
{
pi.SetValue(entity, DateTime.Parse(value.ToString()), null);
}
else if (pi.PropertyType == typeof(float))
{
pi.SetValue(entity, float.Parse(value.ToString()), null);
}
else if (pi.PropertyType == typeof(double))
{
pi.SetValue(entity, double.Parse(value.ToString()), null);
}
else
{
pi.SetValue(entity, value, null);
}
}
}
lst.Add(entity);
}
return lst;
} //DataTable FOR ObservableCollection转换器
public class Product //stuff_Product
{
public string ProductCode { get; set; }
public string ProductName { get; set; }
public int ProductType { get; set; }
public int Concentration { get; set; }
public override string ToString()
{
return ProductCode;
}
}
}
}

7
ViewModel/ViewModelLocator.cs

@ -36,5 +36,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
return ServiceLocator.Current.GetInstance<CurveTempModel>();
}
}
public ManualDyelotModel ManualDM
{
get
{
return ServiceLocator.Current.GetInstance<ManualDyelotModel>();
}
}
}
}

Loading…
Cancel
Save