计划任务料单相关逻辑,添加数据库料单相关栏,添加设置连接输送设备
This commit is contained in:
commit
4ea3785f05
12 files changed
+228
-42
No files matched your search
Binary file not shown.
Binary file not shown.
Generated
+27
@@ -1122,6 +1122,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 LinkDispenser 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string LinkDispenser {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("LinkDispenser", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 LnsufficientPower 的本地化字符串。
|
/// 查找类似 LnsufficientPower 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -2454,6 +2463,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 The picking list has been used 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TPLHBU {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TPLHBU", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 trce 的本地化字符串。
|
/// 查找类似 trce 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -2463,6 +2481,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 The ticket already exists 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TTAE {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TTAE", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Type 的本地化字符串。
|
/// 查找类似 Type 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -981,4 +981,13 @@
|
|||||||
<data name="DNotSent" xml:space="preserve">
|
<data name="DNotSent" xml:space="preserve">
|
||||||
<value>Details Were Not Sent</value>
|
<value>Details Were Not Sent</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LinkDispenser" xml:space="preserve">
|
||||||
|
<value>Link Dispenser</value>
|
||||||
|
</data>
|
||||||
|
<data name="TPLHBU" xml:space="preserve">
|
||||||
|
<value>The picking list has been used</value>
|
||||||
|
</data>
|
||||||
|
<data name="TTAE" xml:space="preserve">
|
||||||
|
<value>The ticket already exists</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -981,4 +981,13 @@
|
|||||||
<data name="DNotSent" xml:space="preserve">
|
<data name="DNotSent" xml:space="preserve">
|
||||||
<value>Details were not sent</value>
|
<value>Details were not sent</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LinkDispenser" xml:space="preserve">
|
||||||
|
<value>LinkDispenser</value>
|
||||||
|
</data>
|
||||||
|
<data name="TPLHBU" xml:space="preserve">
|
||||||
|
<value>The picking list has been used</value>
|
||||||
|
</data>
|
||||||
|
<data name="TTAE" xml:space="preserve">
|
||||||
|
<value>The ticket already exists</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -981,4 +981,13 @@
|
|||||||
<data name="DNotSent" xml:space="preserve">
|
<data name="DNotSent" xml:space="preserve">
|
||||||
<value>未发送明细</value>
|
<value>未发送明细</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LinkDispenser" xml:space="preserve">
|
||||||
|
<value>连接染料助剂分配器</value>
|
||||||
|
</data>
|
||||||
|
<data name="TPLHBU" xml:space="preserve">
|
||||||
|
<value>领料单已使用</value>
|
||||||
|
</data>
|
||||||
|
<data name="TTAE" xml:space="preserve">
|
||||||
|
<value>工单已经存在</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -981,4 +981,13 @@
|
|||||||
<data name="DNotSent" xml:space="preserve">
|
<data name="DNotSent" xml:space="preserve">
|
||||||
<value>未發送明細</value>
|
<value>未發送明細</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LinkDispenser" xml:space="preserve">
|
||||||
|
<value>連接染料助劑分配器</value>
|
||||||
|
</data>
|
||||||
|
<data name="TPLHBU" xml:space="preserve">
|
||||||
|
<value>領料單已使用</value>
|
||||||
|
</data>
|
||||||
|
<data name="TTAE" xml:space="preserve">
|
||||||
|
<value>工單已經存在</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,30,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.orders}"
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,30,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.orders}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,80,10,0" x:Name="comboBoxDyelot" VerticalAlignment="Top" Width="270"
|
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,80,10,0" x:Name="comboBoxDyelot" VerticalAlignment="Top" Width="270"
|
||||||
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" Background="White" />
|
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" KeyDown="comboBoxDyelot_KeyDown" />
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,80,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Dyelot}"
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,80,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Dyelot}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,130,10,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270"
|
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,130,10,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270"
|
||||||
|
|||||||
+122
-27
@@ -40,6 +40,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
DataTable WorkOrder =new DataTable();
|
DataTable WorkOrder =new DataTable();
|
||||||
DataTable dat = new DataTable();
|
DataTable dat = new DataTable();
|
||||||
DataTable TEMPTable = new DataTable();
|
DataTable TEMPTable = new DataTable();
|
||||||
|
DataTable DyelotsBulkedRecipe=new DataTable();
|
||||||
public string WorkOrder_n;
|
public string WorkOrder_n;
|
||||||
public DyeingPlanView()
|
public DyeingPlanView()
|
||||||
{
|
{
|
||||||
@@ -72,21 +73,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
comboBoxDyelot.ItemsSource = DatDyelot.AsEnumerable().Select(rowdata => rowdata.Field<string>("Dyelot")).ToList();//转换代码
|
comboBoxDyelot.ItemsSource = DatDyelot.AsEnumerable().Select(rowdata => rowdata.Field<string>("Dyelot")).ToList();//转换代码
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void Multi_Click(object sender, RoutedEventArgs e)//机台组
|
|
||||||
{
|
|
||||||
MachineSelection machineSelection = new MachineSelection();
|
|
||||||
machineSelection.AddressUpdated += new MachineSelection.AddressUpdateHandler(Address_Multi_Click);
|
|
||||||
//machineSelection.data = "ID";
|
|
||||||
machineSelection.ShowDialog();
|
|
||||||
}
|
|
||||||
private void Address_Multi_Click(object sender, MachineSelection.AddressUpdateEventArgs e)//机台组返回结果
|
|
||||||
{
|
|
||||||
if(!string.IsNullOrEmpty(e.Groups)) comboBoxMachine.Text = e.Groups;
|
|
||||||
comboBoxDyelot.Text = null;
|
|
||||||
comboBoxDyelot.IsEnabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
string color_ = "#FF336FA8";
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)//保存按钮
|
private void Button_Click(object sender, RoutedEventArgs e)//保存按钮
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(comboBoxMachine.Text))
|
if (string.IsNullOrEmpty(comboBoxMachine.Text))
|
||||||
@@ -211,6 +197,32 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
SQLiteHelpers.InsertData("WorkorderSteps", WorkOrder_DAT);//行插入
|
SQLiteHelpers.InsertData("WorkorderSteps", WorkOrder_DAT);//行插入
|
||||||
WorkOrder_DAT.Clear();
|
WorkOrder_DAT.Clear();
|
||||||
}
|
}
|
||||||
|
if (!String.IsNullOrEmpty(comboBoxDyelot.Text))//料单信息
|
||||||
|
{
|
||||||
|
for (int x = 0; x < DyelotsBulkedRecipe.Rows.Count; x++)
|
||||||
|
{
|
||||||
|
WorkOrder_DAT.Add("WorkOrder", comboBoxWorkOrder.Text);
|
||||||
|
WorkOrder_DAT.Add("Dyelot", DyelotsBulkedRecipe.Rows[x]["Dyelot"]);
|
||||||
|
WorkOrder_DAT.Add("Redye", DyelotsBulkedRecipe.Rows[x]["Redye"]);
|
||||||
|
WorkOrder_DAT.Add("Step", DyelotsBulkedRecipe.Rows[x]["StepNumber"]);
|
||||||
|
WorkOrder_DAT.Add("TIME", DyelotsBulkedRecipe.Rows[x]["Created"]);
|
||||||
|
WorkOrder_DAT.Add("Tank", DyelotsBulkedRecipe.Rows[x]["TankNo"]);
|
||||||
|
WorkOrder_DAT.Add("State", DyelotsBulkedRecipe.Rows[x]["DispenseResult"]);
|
||||||
|
WorkOrder_DAT.Add("Machine", comboBoxMachine.Text);
|
||||||
|
WorkOrder_DAT.Add("ProductCode", DyelotsBulkedRecipe.Rows[x]["ProductCode"]);
|
||||||
|
WorkOrder_DAT.Add("ProductName", DyelotsBulkedRecipe.Rows[x]["ProductName"]);
|
||||||
|
WorkOrder_DAT.Add("ProductType", DyelotsBulkedRecipe.Rows[x]["ProductType"]);
|
||||||
|
WorkOrder_DAT.Add("Grams", DyelotsBulkedRecipe.Rows[x]["Grams"]);
|
||||||
|
WorkOrder_DAT.Add("Amount", DyelotsBulkedRecipe.Rows[x]["Amount"]);
|
||||||
|
WorkOrder_DAT.Add("DispenseStartTime", DyelotsBulkedRecipe.Rows[x]["DispenseStartTime"]);
|
||||||
|
WorkOrder_DAT.Add("DispenseEndTime", DyelotsBulkedRecipe.Rows[x]["DispenseEndTime"]);
|
||||||
|
WorkOrder_DAT.Add("DispenseGrams", DyelotsBulkedRecipe.Rows[x]["DispenseGrams"]);
|
||||||
|
WorkOrder_DAT.Add("Dispense", DyelotsBulkedRecipe.Rows[x]["Dispenser"]);
|
||||||
|
WorkOrder_DAT.Add("UserAccount", DyelotsBulkedRecipe.Rows[x]["UserAccount"]);
|
||||||
|
SQLiteHelpers.InsertData("Dyelot", WorkOrder_DAT);//行插入
|
||||||
|
WorkOrder_DAT.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
LogGing.ExchangeDATA("Dyelot=" + comboBoxWorkOrder.Text + ";Machine=" + comboBoxMachine.Text +
|
LogGing.ExchangeDATA("Dyelot=" + comboBoxWorkOrder.Text + ";Machine=" + comboBoxMachine.Text +
|
||||||
@@ -248,7 +260,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
Grid_data.ItemsSource = dat.DefaultView;
|
Grid_data.ItemsSource = dat.DefaultView;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void comboBoxProgram_TextChanged(object sender, TextChangedEventArgs e)
|
private void comboBoxProgram_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
dat.Clear();
|
dat.Clear();
|
||||||
@@ -260,6 +271,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
string[] sArray = Regex.Split(text, @"\+", RegexOptions.IgnoreCase);
|
string[] sArray = Regex.Split(text, @"\+", RegexOptions.IgnoreCase);
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
|
/* if (!string.IsNullOrEmpty(WorkOrder_n))
|
||||||
|
{
|
||||||
|
dat = SQLiteHelpers.ExecuteDataSet(
|
||||||
|
"select * from WorkorderSteps where WorkOrder='" + WorkOrder_n + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存
|
||||||
|
}//插入工单不为空时载入细节信息*/
|
||||||
for (int i = 0; i < sArray.Length; i++)
|
for (int i = 0; i < sArray.Length; i++)
|
||||||
{
|
{
|
||||||
DataTable temp = SQLiteHelpers.ExecuteDataSet(
|
DataTable temp = SQLiteHelpers.ExecuteDataSet(
|
||||||
@@ -270,11 +286,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
dat.Rows.Add(drT.ItemArray);
|
dat.Rows.Add(drT.ItemArray);
|
||||||
}
|
}
|
||||||
}//以工艺名组合工艺细节
|
}//以工艺名组合工艺细节
|
||||||
if (!string.IsNullOrEmpty(WorkOrder_n))
|
|
||||||
{
|
|
||||||
dat = SQLiteHelpers.ExecuteDataSet(
|
|
||||||
"select * from WorkorderSteps where WorkOrder='" + WorkOrder_n + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存
|
|
||||||
}//插入工单不为空时载入细节信息
|
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
SQLiteHelpers.Close(); //关闭连接
|
||||||
DatSteps(dat);
|
DatSteps(dat);
|
||||||
Grid_data.ItemsSource = dat.DefaultView;
|
Grid_data.ItemsSource = dat.DefaultView;
|
||||||
@@ -395,7 +407,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}
|
}
|
||||||
Grid_data.ItemsSource = dat.DefaultView;
|
Grid_data.ItemsSource = dat.DefaultView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TEMP()
|
private void TEMP()
|
||||||
{
|
{
|
||||||
//处理计划温度图表
|
//处理计划温度图表
|
||||||
@@ -461,14 +472,26 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Picture.Content = new View.CurveTemp(TEMPTable);
|
Picture.Content = new View.CurveTemp(TEMPTable);
|
||||||
}
|
} //计划温度图表
|
||||||
|
|
||||||
private async void comboBoxWorkOrder_KeyDown(object sender, KeyEventArgs e)//工单输入
|
private async void comboBoxWorkOrder_KeyDown(object sender, KeyEventArgs e)//工单输入
|
||||||
{
|
{
|
||||||
if (e.Key == Key.Enter)
|
if (e.Key == Key.Enter && MainWindowViewModel.DyelotsDispenser)
|
||||||
{
|
{
|
||||||
|
SQLiteHelpers = new SQLiteHelper(DBAddress);
|
||||||
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
|
int dat_c = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where WorkOrder = '" + comboBoxWorkOrder.Text + "'", null).Tables[0].Rows.Count;//缓存
|
||||||
|
SQLiteHelpers.Close();
|
||||||
|
|
||||||
|
if (dat_c > 0)//查询料单是否可用
|
||||||
|
{
|
||||||
|
comboBoxWorkOrder.Text = null;
|
||||||
|
MessageBox.Show(Properties.Resources.TTAE, "WorkOrder", MessageBoxButton.OK, MessageBoxImage.Information); //连接成功提示是否保存
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string Connstr_SC;
|
string Connstr_SC;
|
||||||
string DYELOTS_sql = "SELECT * FROM [dbo].[DYELOTS] WHERE Dyelot = '" + comboBoxWorkOrder.Text + "'";//单号查询语句
|
string DYELOTS_sql = "SELECT * FROM [dbo].[DYELOTS] WHERE Dyelot = '" + comboBoxWorkOrder.Text + "'";//单号查询语句
|
||||||
|
string DyelotsBulkedRecipe_sql = "SELECT * FROM [dbo].[DyelotsBulkedRecipe] WHERE Dyelot = '" + comboBoxWorkOrder.Text + "'";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (MainWindowViewModel.SQMOD == "Windows Authentication")
|
if (MainWindowViewModel.SQMOD == "Windows Authentication")
|
||||||
@@ -482,9 +505,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
||||||
await conn_SC.OpenAsync(); //连接数据库
|
await conn_SC.OpenAsync(); //连接数据库
|
||||||
SqlDataAdapter DYELOTS_data = new SqlDataAdapter(DYELOTS_sql, Connstr_SC); //查询
|
SqlDataAdapter DYELOTS_data = new SqlDataAdapter(DYELOTS_sql, Connstr_SC); //查询
|
||||||
|
SqlDataAdapter DyelotsBulkedRecipe_ = new SqlDataAdapter(DyelotsBulkedRecipe_sql, Connstr_SC);
|
||||||
conn_SC.Close();
|
conn_SC.Close();
|
||||||
|
DyelotsBulkedRecipe_.Fill(DyelotsBulkedRecipe);
|
||||||
|
|
||||||
DataTable ds = new DataTable();
|
|
||||||
|
DataTable ds = new DataTable();//载入信息
|
||||||
DYELOTS_data.Fill(ds);
|
DYELOTS_data.Fill(ds);
|
||||||
TEXTColorNumber.Text = ds.AsEnumerable().Select(row => row.Field<string>("ColorNo")).First();
|
TEXTColorNumber.Text = ds.AsEnumerable().Select(row => row.Field<string>("ColorNo")).First();
|
||||||
TEXTColorName.Text = ds.AsEnumerable().Select(row => row.Field<string>("ColorName")).First();
|
TEXTColorName.Text = ds.AsEnumerable().Select(row => row.Field<string>("ColorName")).First();
|
||||||
@@ -514,7 +540,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
color.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(
|
color.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(
|
||||||
"#FF" + colorValue.Substring(4, 2) + colorValue.Substring(2, 2) + colorValue.Substring(0, 2)));
|
"#FF" + colorValue.Substring(4, 2) + colorValue.Substring(2, 2) + colorValue.Substring(0, 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -522,7 +547,77 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private async void comboBoxDyelot_KeyDown(object sender, KeyEventArgs e)//料单输入
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Enter && MainWindowViewModel.DyelotsDispenser)
|
||||||
|
{
|
||||||
|
string Connstr_SC;
|
||||||
|
string DYELOTS_sql = "SELECT * FROM [dbo].[DYELOTS] WHERE Dyelot = '" + comboBoxDyelot.Text + "'";//单号查询语句
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SQLiteHelpers = new SQLiteHelper(DBAddress);
|
||||||
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
|
int dat_c = SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Dyelot = '" + comboBoxDyelot.Text + "'", null).Tables[0].Rows.Count;//缓存
|
||||||
|
SQLiteHelpers.Close();
|
||||||
|
|
||||||
|
if (dat_c > 0)//查询料单是否可用
|
||||||
|
{
|
||||||
|
comboBoxDyelot.Text = null;
|
||||||
|
MessageBox.Show(Properties.Resources.TPLHBU, "Dyelot", MessageBoxButton.OK, MessageBoxImage.Information); //连接成功提示是否保存
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
await conn_SC.OpenAsync(); //连接数据库
|
||||||
|
SqlDataAdapter DYELOTS_data = new SqlDataAdapter(DYELOTS_sql, Connstr_SC); //查询
|
||||||
|
conn_SC.Close();
|
||||||
|
|
||||||
|
DataTable ds = new DataTable();//载入信息
|
||||||
|
DYELOTS_data.Fill(ds);
|
||||||
|
TEXTColorNumber.Text = ds.AsEnumerable().Select(row => row.Field<string>("ColorNo")).First();
|
||||||
|
TEXTColorName.Text = ds.AsEnumerable().Select(row => row.Field<string>("ColorName")).First();
|
||||||
|
TEXTClient.Text = ds.AsEnumerable().Select(row => row.Field<string>("CustomerName")).First();
|
||||||
|
TEXTClothSpecies.Text = ds.AsEnumerable().Select(row => row.Field<string>("FabricName")).First();
|
||||||
|
TEXTClothWeight.Text = ds.AsEnumerable().Select(row => row.Field<Double>("TotalWeight")).First().ToString();
|
||||||
|
TEXTBathRatio.Text = ds.AsEnumerable().Select(row => row.Field<string>("LiquidRatio")).First();
|
||||||
|
TEXTTotal.Text = ds.AsEnumerable().Select(row => row.Field<string>("TotalVolume")).First();
|
||||||
|
// comboBoxDyelot.Text = ds.AsEnumerable().Select(row => row.Field<string>("Dyelot")).First();
|
||||||
|
|
||||||
|
string machine_ = ds.AsEnumerable().Select(row => row.Field<string>("Machine")).First();//机台
|
||||||
|
if (MainWindowViewModel.Machines.Select("Name ='" + machine_ + "'").Length == 0)
|
||||||
|
{
|
||||||
|
comboBoxMachine.Text = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
comboBoxMachine.Text = machine_;
|
||||||
|
}
|
||||||
|
string user_ = ds.AsEnumerable().Select(row => row.Field<string>("UserAccount")).First();//用户名
|
||||||
|
if (!String.IsNullOrEmpty(user_)) TEXTUSER.Text = user_;
|
||||||
|
comboBoxProgram.Text = ds.AsEnumerable().Select(row => row.Field<string>("Program")).First();
|
||||||
|
|
||||||
|
if (ds.AsEnumerable().Select(row => row.Field<int>("color")).First() > 0)//颜色
|
||||||
|
{
|
||||||
|
string colorValue = string.Format("{0:X6}", ds.AsEnumerable().Select(row => row.Field<int>("color")).First());//十进制RGB数值转十六进制六位RGB并补0位例“C0C0C0”
|
||||||
|
color.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(
|
||||||
|
"#FF" + colorValue.Substring(4, 2) + colorValue.Substring(2, 2) + colorValue.Substring(0, 2)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogGing.ERRDATA(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
private void Tb_KeyTEXTClothWeight(object sender, TextCompositionEventArgs e)//输入事件
|
private void Tb_KeyTEXTClothWeight(object sender, TextCompositionEventArgs e)//输入事件
|
||||||
{
|
{
|
||||||
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
|
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
<TextBox x:Name="TEXT_SQLPASWORD" HorizontalAlignment="Left" Height="40" Margin="150,330,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="16"/>
|
<TextBox x:Name="TEXT_SQLPASWORD" HorizontalAlignment="Left" Height="40" Margin="150,330,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="16"/>
|
||||||
<Button Content="{x:Static lang:Resources.Test}" HorizontalAlignment="Left" Height="35" Margin="270,375,0,0" VerticalAlignment="Top" Width="80" Click="Test_Click"/>
|
<Button Content="{x:Static lang:Resources.Test}" HorizontalAlignment="Left" Height="35" Margin="270,375,0,0" VerticalAlignment="Top" Width="80" Click="Test_Click"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,375,0,0" x:Name="textlog" TextWrapping="Wrap" Text="------------" VerticalAlignment="Top" Width="140" FontSize="20"/>
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,375,0,0" x:Name="textlog" TextWrapping="Wrap" Text="------------" VerticalAlignment="Top" Width="140" FontSize="20"/>
|
||||||
|
<CheckBox x:Name="dDispenser" Content="{x:Static lang:Resources.LinkDispenser}" HorizontalAlignment="Left" Height="35 " Margin="410,10,0,0" VerticalAlignment="Top" Width="200"
|
||||||
|
Checked="dDispenser_Checked" Unchecked="dDispenser_Checked" FontSize="20"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||||
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
@@ -40,12 +41,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
string[] SQMOD = { "Windows Authentication", "SQL SERVER"};
|
string[] SQMOD = { "Windows Authentication", "SQL SERVER"};
|
||||||
comboBoxLanguage.ItemsSource = Language;
|
comboBoxLanguage.ItemsSource = Language;
|
||||||
TEXT_SQMOD.ItemsSource = SQMOD;
|
TEXT_SQMOD.ItemsSource = SQMOD;
|
||||||
comboBoxLanguage.Text = Configini.IniReadvalue("SYS", "Language");
|
try
|
||||||
TEXT_SQLIP.Text = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
{
|
||||||
TEXT_SQLNAME.Text = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
comboBoxLanguage.Text = Configini.IniReadvalue("SYS", "Language");
|
||||||
TEXT_SQMOD.Text = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
TEXT_SQLIP.Text = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||||
TEXT_SQLUSER.Text = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
TEXT_SQLNAME.Text = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||||
TEXT_SQLPASWORD.Text = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
TEXT_SQMOD.Text = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||||
|
TEXT_SQLUSER.Text = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||||
|
TEXT_SQLPASWORD.Text = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||||
|
dDispenser.IsChecked = Convert.ToBoolean(Configini.IniReadvalue("SYS", "DyelotsDispenser"));
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.ERRDATA(ex); }
|
||||||
}
|
}
|
||||||
//调用配置文件
|
//调用配置文件
|
||||||
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
||||||
@@ -106,5 +112,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
MainWindowViewModel.SQL_LINK();//更新设定
|
MainWindowViewModel.SQL_LINK();//更新设定
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void dDispenser_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Configini.IniWritevalue("SYS", "DyelotsDispenser", dDispenser.IsChecked.ToString());
|
||||||
|
MainWindowViewModel.DyelotsDispenser = (bool)dDispenser.IsChecked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,13 +55,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
{
|
{
|
||||||
//调用配置文件
|
//调用配置文件
|
||||||
private static UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
private static UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
||||||
public static string SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
public static string SQLIP; //读配置文件
|
||||||
public static string SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
public static string SQLNAME;
|
||||||
public static string SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
public static string SQMOD;
|
||||||
public static string SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
public static string SQLUSER;
|
||||||
public static string SQLPASWORD = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
public static string SQLPASWORD;
|
||||||
public static string SN_ID = Configini.IniReadvalue("SN", "SN2");
|
public static string SN_ID;
|
||||||
public static string SN_KEY = Configini.IniReadvalue("SN", "SN1");
|
public static string SN_KEY;
|
||||||
|
public static bool DyelotsDispenser;
|
||||||
public static SqlConnection conn_SC =new SqlConnection();//数据库
|
public static SqlConnection conn_SC =new SqlConnection();//数据库
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
||||||
@@ -73,6 +74,19 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
|
|
||||||
public MainWindowViewModel()
|
public MainWindowViewModel()
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||||
|
SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||||
|
SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||||
|
SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||||
|
SQLPASWORD = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||||
|
SN_ID = Configini.IniReadvalue("SN", "SN2");
|
||||||
|
SN_KEY = Configini.IniReadvalue("SN", "SN1");
|
||||||
|
DyelotsDispenser = Convert.ToBoolean(Configini.IniReadvalue("SYS", "DyelotsDispenser"));
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.ERRDATA(ex); }
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
Machines = SQLiteHelpers.ExecuteDataSet("select * from Machines Order by id", null).Tables[0]; //读取表写入缓存
|
Machines = SQLiteHelpers.ExecuteDataSet("select * from Machines Order by id", null).Tables[0]; //读取表写入缓存
|
||||||
|
|||||||
Reference in new issue
Block a user