Browse Source

锁功能生效,操作锁

master
sc 2 months ago
parent
commit
469d76f9b0
  1. 8
      DyeingComputer.csproj
  2. BIN
      Lmage/IconParkInfo.png
  3. 27
      Properties/Resources.Designer.cs
  4. 9
      Properties/Resources.en-US.resx
  5. 9
      Properties/Resources.resx
  6. 9
      Properties/Resources.zh-CN.resx
  7. 9
      Properties/Resources.zh-TW.resx
  8. 73
      UserClass/AsyncTcpServer.cs
  9. 3
      View/TechnologicalProcessView.xaml
  10. 240
      View/TechnologicalProcessView.xaml.cs
  11. 284
      View/WorkOrderView.xaml.cs
  12. 109
      ViewModel/MainWindowViewModel.cs
  13. 22
      Windows/UserInf.xaml
  14. 48
      Windows/UserInf.xaml.cs

8
DyeingComputer.csproj

@ -201,6 +201,9 @@
<Compile Include="Windows\Sampling.xaml.cs"> <Compile Include="Windows\Sampling.xaml.cs">
<DependentUpon>Sampling.xaml</DependentUpon> <DependentUpon>Sampling.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Windows\UserInf.xaml.cs">
<DependentUpon>UserInf.xaml</DependentUpon>
</Compile>
<Compile Include="Windows\UserCall.xaml.cs"> <Compile Include="Windows\UserCall.xaml.cs">
<DependentUpon>UserCall.xaml</DependentUpon> <DependentUpon>UserCall.xaml</DependentUpon>
</Compile> </Compile>
@ -282,6 +285,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="Windows\UserInf.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Windows\UserCall.xaml"> <Page Include="Windows\UserCall.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@ -425,6 +432,7 @@
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" /> <Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" />
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.min.css" /> <Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.min.css" />
<Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" /> <Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" />
<Resource Include="Lmage\IconParkInfo.png" />
<Resource Include="Lmage\ID051.png" /> <Resource Include="Lmage\ID051.png" />
<Resource Include="Lmage\ID050.png" /> <Resource Include="Lmage\ID050.png" />
<Resource Include="Lmage\ADD.jpg" /> <Resource Include="Lmage\ADD.jpg" />

BIN
Lmage/IconParkInfo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

27
Properties/Resources.Designer.cs

@ -699,6 +699,15 @@ namespace DyeingComputer.Properties {
} }
} }
/// <summary>
/// 查找类似 Locked state 的本地化字符串。
/// </summary>
public static string LockedState {
get {
return ResourceManager.GetString("LockedState", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Low-water level 的本地化字符串。 /// 查找类似 Low-water level 的本地化字符串。
/// </summary> /// </summary>
@ -897,6 +906,15 @@ namespace DyeingComputer.Properties {
} }
} }
/// <summary>
/// 查找类似 please continue after the restriction is lifted 的本地化字符串。
/// </summary>
public static string PCATRIL {
get {
return ResourceManager.GetString("PCATRIL", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 PHControl 的本地化字符串。 /// 查找类似 PHControl 的本地化字符串。
/// </summary> /// </summary>
@ -1338,6 +1356,15 @@ namespace DyeingComputer.Properties {
} }
} }
/// <summary>
/// 查找类似 The current operation is restricted 的本地化字符串。
/// </summary>
public static string TCOIR {
get {
return ResourceManager.GetString("TCOIR", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Process 的本地化字符串。 /// 查找类似 Process 的本地化字符串。
/// </summary> /// </summary>

9
Properties/Resources.en-US.resx

@ -591,4 +591,13 @@
<data name="Inspect" xml:space="preserve"> <data name="Inspect" xml:space="preserve">
<value>Waiting For Check</value> <value>Waiting For Check</value>
</data> </data>
<data name="LockedState" xml:space="preserve">
<value>Locked state</value>
</data>
<data name="TCOIR" xml:space="preserve">
<value>The current operation is restricted</value>
</data>
<data name="PCATRIL" xml:space="preserve">
<value>please continue after the restriction is lifted</value>
</data>
</root> </root>

9
Properties/Resources.resx

@ -591,4 +591,13 @@
<data name="Inspect" xml:space="preserve"> <data name="Inspect" xml:space="preserve">
<value>Inspect</value> <value>Inspect</value>
</data> </data>
<data name="LockedState" xml:space="preserve">
<value>Locked state</value>
</data>
<data name="TCOIR" xml:space="preserve">
<value>The current operation is restricted</value>
</data>
<data name="PCATRIL" xml:space="preserve">
<value>please continue after the restriction is lifted</value>
</data>
</root> </root>

9
Properties/Resources.zh-CN.resx

@ -591,4 +591,13 @@
<data name="Inspect" xml:space="preserve"> <data name="Inspect" xml:space="preserve">
<value>等待检查</value> <value>等待检查</value>
</data> </data>
<data name="LockedState" xml:space="preserve">
<value>锁定状态</value>
</data>
<data name="TCOIR" xml:space="preserve">
<value>当前操作已限制</value>
</data>
<data name="PCATRIL" xml:space="preserve">
<value>请解除限制后继续</value>
</data>
</root> </root>

9
Properties/Resources.zh-TW.resx

@ -591,4 +591,13 @@
<data name="Inspect" xml:space="preserve"> <data name="Inspect" xml:space="preserve">
<value>等待檢查</value> <value>等待檢查</value>
</data> </data>
<data name="LockedState" xml:space="preserve">
<value>锁定状态</value>
</data>
<data name="TCOIR" xml:space="preserve">
<value>目前操作已限制</value>
</data>
<data name="PCATRIL" xml:space="preserve">
<value>請解除限制後繼續</value>
</data>
</root> </root>

73
UserClass/AsyncTcpServer.cs

@ -1,30 +1,31 @@
using DyeingComputer.UserClass; using DyeingComputer.UserClass;
using DyeingComputer.View;
using DyeingComputer.ViewModel;
using Newtonsoft.Json;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Net.Sockets; using System.Net.Sockets;
using System.Reflection.Emit; using System.Reflection.Emit;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Diagnostics; using System.Windows;
using System.Windows.Controls;
using TouchSocket.Core; using TouchSocket.Core;
using TouchSocket.Sockets; using TouchSocket.Sockets;
using DyeingComputer.ViewModel;
using System.Runtime.InteropServices;
using static System.Windows.Forms.AxHost;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using Newtonsoft.Json;
using static DyeingComputer.UserClass.SqliteHelper; using static DyeingComputer.UserClass.SqliteHelper;
using DyeingComputer.View;
using System.Windows;
using System.Windows.Controls;
using static System.Net.WebRequestMethods; using static System.Net.WebRequestMethods;
using System.Collections; using static System.Windows.Forms.AxHost;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
namespace DyeingComputer.UserClass namespace DyeingComputer.UserClass
{/// <summary> {/// <summary>
@ -242,6 +243,7 @@ namespace DyeingComputer.UserClass
else if (dat_821.GetValue("INSTRUCTION").ToString() == "PAUSE") else if (dat_821.GetValue("INSTRUCTION").ToString() == "PAUSE")
{ {
MainWindowViewModel.WORK_RUN = 1;//暂停 MainWindowViewModel.WORK_RUN = 1;//暂停
MainWindowViewModel.errTabler.Clear();
client.SendAsync("SC821" + SYSKEY + SYSDAT); client.SendAsync("SC821" + SYSKEY + SYSDAT);
} }
@ -299,20 +301,14 @@ namespace DyeingComputer.UserClass
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 // SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
// SQLiteHelpers.Open(); //打开数据库 // SQLiteHelpers.Open(); //打开数据库
MainWindow.SQLiteHelpers.Delete("RUN", null, null); MainWindow.SQLiteHelpers.Delete("RUN", null, null);
DataTable data_t = MainWindowViewModel.dt_TP.Clone();
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++) for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
{ {
data_t.Clear();//清空
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换 DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
DataRow drT = data_t.NewRow(); dt.BeginEdit(); //添加订单号
drT.ItemArray = dt.ItemArray; dt["DYELOT"] = MainWindowViewModel.WorkNumder;
data_t.Rows.InsertAt(drT, 0); dt.EndEdit();
drT.BeginEdit(); //添加订单号
drT["DYELOT"] = MainWindowViewModel.WorkNumder; MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.ToDictionary(dt));//行插入
drT.EndEdit();
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
} }
//SQLiteHelpers.Close(); //关闭连接 //SQLiteHelpers.Close(); //关闭连接
@ -345,19 +341,13 @@ namespace DyeingComputer.UserClass
DataTable data_t = MainWindowViewModel.dt_TP.Clone(); DataTable data_t = MainWindowViewModel.dt_TP.Clone();
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++) for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
{ {
data_t.Clear();//清空
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换 DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
DataRow drT = data_t.NewRow(); dt.BeginEdit(); //添加订单号
drT.ItemArray = dt.ItemArray; dt["DYELOT"] = MainWindowViewModel.WorkNumder;
data_t.Rows.InsertAt(drT, 0); dt.EndEdit();
drT.BeginEdit(); //添加订单号
drT["DYELOT"] = MainWindowViewModel.WorkNumder; MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.ToDictionary(dt));//行插入
drT.EndEdit(); } //SQLiteHelpers.Close(); //关闭连接
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
}
//SQLiteHelpers.Close(); //关闭连接
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString()); client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString());
MainWindowViewModel.TX++; MainWindowViewModel.TX++;
@ -374,17 +364,12 @@ namespace DyeingComputer.UserClass
DataTable data_t = MainWindowViewModel.dt_TP.Clone(); DataTable data_t = MainWindowViewModel.dt_TP.Clone();
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++) for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
{ {
data_t.Clear();//清空
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换 DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
DataRow drT = data_t.NewRow(); dt.BeginEdit(); //添加订单号
drT.ItemArray = dt.ItemArray; dt["DYELOT"] = MainWindowViewModel.WorkNumder;
data_t.Rows.InsertAt(drT, 0); dt.EndEdit();
drT.BeginEdit(); //添加订单号
drT["DYELOT"] = MainWindowViewModel.WorkNumder; MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.ToDictionary(dt));//行插入
drT.EndEdit();
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
} }
//SQLiteHelpers.Close(); //关闭连接 //SQLiteHelpers.Close(); //关闭连接

3
View/TechnologicalProcessView.xaml

@ -209,7 +209,8 @@
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<DataGrid x:Name="Parameter_set" Visibility="Collapsed" AutoGenerateColumns="False" FontSize="15" AlternationCount="2" <DataGrid x:Name="Parameter_set" Visibility="Collapsed" AutoGenerateColumns="False" FontSize="15" AlternationCount="2"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" ColumnHeaderHeight="40" CellEditEnding="Parameter_set_CellEditEnding"> HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" ColumnHeaderHeight="40"
CellEditEnding="Parameter_set_CellEditEnding" BeginningEdit="Parameter_set_BeginningEdit" >
<DataGrid.RowStyle > <DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" /> <Setter Property="Height" Value="30" />

240
View/TechnologicalProcessView.xaml.cs

@ -196,6 +196,16 @@ namespace DyeingComputer.View
Parameter_set.ItemsSource = tblDatas.DefaultView; Parameter_set.ItemsSource = tblDatas.DefaultView;
} }
private void Parameter_set_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
{
if (MainWindowViewModel._Lock_bool)
{
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
return;
}
}
private void Parameter_set_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) private void Parameter_set_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{ {
string VID; string VID;
@ -234,7 +244,7 @@ namespace DyeingComputer.View
MainWindowViewModel.Updata_dtm(VID, i); MainWindowViewModel.Updata_dtm(VID, i);
} }
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Parameter", APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Parameter",
"ID=" + VID + ";Name=" + Vname + ";Value="+newValue); "ID=" + VID + ";Name=" + Vname + ";Value=" + newValue);
} }
catch { } catch { }
ParameterSet_d(); ParameterSet_d();
@ -323,15 +333,23 @@ namespace DyeingComputer.View
} }
private void ProgramgroupView_edit_Click(object sender, RoutedEventArgs e)//编辑按钮 private void ProgramgroupView_edit_Click(object sender, RoutedEventArgs e)//编辑按钮
{ {
// if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; } if (!MainWindowViewModel._Lock_bool)
if (ID == null) return;//ID = sql.Tables[0].Rows.Count.ToString(); {
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Edit", "STEP = " + ID); // if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
ViewStep viewstop = new ViewStep(Numder, MainWindowViewModel.dt_TP.Select("STEP = " + ID).First()); if (ID == null) return;//ID = sql.Tables[0].Rows.Count.ToString();
viewstop.boxNAME.IsEnabled=false; APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Edit", "STEP = " + ID);
//viewstop.no.IsEnabled = false; ViewStep viewstop = new ViewStep(Numder, MainWindowViewModel.dt_TP.Select("STEP = " + ID).First());
viewstop.data = ID; viewstop.boxNAME.IsEnabled = false;
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); //viewstop.no.IsEnabled = false;
viewstop.ShowDialog(); viewstop.data = ID;
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
viewstop.ShowDialog();
}
else
{
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
}
} }
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果 private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
{ {
@ -410,92 +428,109 @@ namespace DyeingComputer.View
} }
private void ProgramgroupView_del_Click(object sender, RoutedEventArgs e)//删除 private void ProgramgroupView_del_Click(object sender, RoutedEventArgs e)//删除
{ {
int d = 0; if (!MainWindowViewModel._Lock_bool)
int a = MainWindowViewModel.dt_TP.Rows.Count; {
int d = 0;
int a = MainWindowViewModel.dt_TP.Rows.Count;
if (ID != null) { d = Convert.ToInt16(ID); } else { return; } if (ID != null) { d = Convert.ToInt16(ID); } else { return; }
MainWindowViewModel.dt_TP.Rows.RemoveAt(d - 1); MainWindowViewModel.dt_TP.Rows.RemoveAt(d - 1);
Dat(); Dat();
GridSTEP.SelectedIndex = -1; GridSTEP.SelectedIndex = -1;
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 // SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
// SQLiteHelpers.Open(); //打开数据库 // SQLiteHelpers.Open(); //打开数据库
MainWindow.SQLiteHelpers.Delete("RUN", null, null); MainWindow.SQLiteHelpers.Delete("RUN", null, null);
DataTable data_t = MainWindowViewModel.dt_TP.Clone(); DataTable data_t = MainWindowViewModel.dt_TP.Clone();
a = MainWindowViewModel.dt_TP.Rows.Count; a = MainWindowViewModel.dt_TP.Rows.Count;
for (int i = 0; i < a; i++) for (int i = 0; i < a; i++)
{
data_t.Clear();//清空
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
DataRow drT = data_t.NewRow();
drT.ItemArray = dt.ItemArray;
data_t.Rows.InsertAt(drT, 0);
drT.BeginEdit(); //添加订单号
drT["DYELOT"] = MainWindowViewModel.WorkNumder;
drT.EndEdit();
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
}
//SQLiteHelpers.Close(); //关闭连接
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Delete", "STEP = " + ID);
MainWindowViewModel.User_Button = true;
}
else
{ {
data_t.Clear();//清空 MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换 Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
DataRow drT = data_t.NewRow();
drT.ItemArray = dt.ItemArray;
data_t.Rows.InsertAt(drT, 0);
drT.BeginEdit(); //添加订单号
drT["DYELOT"] = MainWindowViewModel.WorkNumder;
drT.EndEdit();
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
} }
//SQLiteHelpers.Close(); //关闭连接
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Delete", "STEP = " + ID);
MainWindowViewModel.User_Button = true;
} }
private void ProgramgroupView_Insert_Click(object sender, RoutedEventArgs e)//插入 private void ProgramgroupView_Insert_Click(object sender, RoutedEventArgs e)//插入
{ {
int d = 0; if (!MainWindowViewModel._Lock_bool)
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 {
//SQLiteHelpers.Open(); //打开数据库 int d = 0;
string ProgramID = MainWindow.SQLiteHelpers.ExecuteScalar("select ProgramID from RUN where Step = '1'", null).ToString(); //SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
string ProgramNAME = MainWindow.SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString(); //SQLiteHelpers.Open(); //打开数据库
// SQLiteHelpers.Close(); string ProgramID = MainWindow.SQLiteHelpers.ExecuteScalar("select ProgramID from RUN where Step = '1'", null).ToString();
string ProgramNAME = MainWindow.SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString();
// SQLiteHelpers.Close();
if (ID != null) { d = Convert.ToInt16(ID); } else { return; } if (ID != null) { d = Convert.ToInt16(ID); } else { return; }
DataRow dr = MainWindowViewModel.dt_TP.NewRow();//添加表数据 DataRow dr = MainWindowViewModel.dt_TP.NewRow();//添加表数据
// //
dr["WorkOrder"] = MainWindowViewModel.WorkNumder; dr["WorkOrder"] = MainWindowViewModel.WorkNumder;
dr["ProgramID"] = ProgramID; dr["ProgramID"] = ProgramID;
dr["Program"] = ProgramNAME; dr["Program"] = ProgramNAME;
dr["Parameter1"] = 0; dr["Parameter1"] = 0;
dr["Parameter2"] = 0; dr["Parameter2"] = 0;
dr["Parameter3"] = 0; dr["Parameter3"] = 0;
dr["Parameter4"] = 0; dr["Parameter4"] = 0;
dr["Parameter5"] = 0; dr["Parameter5"] = 0;
dr["Parameter6"] = 0; dr["Parameter6"] = 0;
dr["Parameter7"] = 0; dr["Parameter7"] = 0;
dr["Parameter8"] = 0; dr["Parameter8"] = 0;
dr["Parameter9"] = 0; dr["Parameter9"] = 0;
dr["Parameter10"] = 0; dr["Parameter10"] = 0;
dr["Parameter1_S1"] = 0; dr["Parameter1_S1"] = 0;
dr["Parameter2_S1"] = 0; dr["Parameter2_S1"] = 0;
dr["Parameter3_S1"] = 0; dr["Parameter3_S1"] = 0;
dr["Parameter4_S1"] = 0; dr["Parameter4_S1"] = 0;
dr["Parameter5_S1"] = 0; dr["Parameter5_S1"] = 0;
dr["Parameter1_S2"] = 0; dr["Parameter1_S2"] = 0;
dr["Parameter2_S2"] = 0; dr["Parameter2_S2"] = 0;
dr["Parameter3_S2"] = 0; dr["Parameter3_S2"] = 0;
dr["Parameter4_S2"] = 0; dr["Parameter4_S2"] = 0;
dr["Parameter5_S2"] = 0; dr["Parameter5_S2"] = 0;
dr["Parameter1_S3"] = 0; dr["Parameter1_S3"] = 0;
dr["Parameter2_S3"] = 0; dr["Parameter2_S3"] = 0;
dr["Parameter3_S3"] = 0; dr["Parameter3_S3"] = 0;
dr["Parameter4_S3"] = 0; dr["Parameter4_S3"] = 0;
dr["Parameter5_S3"] = 0; dr["Parameter5_S3"] = 0;
dr["StepName_S1"] = " "; dr["StepName_S1"] = " ";
dr["StepName_S2"] = " "; dr["StepName_S2"] = " ";
dr["StepName_S3"] = " "; dr["StepName_S3"] = " ";
dr["StepID_S1"] = "000"; dr["StepID_S1"] = "000";
dr["StepID_S2"] = "000"; dr["StepID_S2"] = "000";
dr["StepID_S3"] = "000"; dr["StepID_S3"] = "000";
MainWindowViewModel.dt_TP.Rows.InsertAt(dr, d - 1); MainWindowViewModel.dt_TP.Rows.InsertAt(dr, d - 1);
// ID = null; // ID = null;
Dat(); Dat();
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Insert", "STEP = "+ID); APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Insert", "STEP = " + ID);
if (ID == null) return;// ID = MainWindowViewModel.dt_TP.Rows.Count.ToString(); if (ID == null) return;// ID = MainWindowViewModel.dt_TP.Rows.Count.ToString();
ViewStep viewstop = new ViewStep(null, MainWindowViewModel.dt_TP.Select("STEP = " + ID).First()); ViewStep viewstop = new ViewStep(null, MainWindowViewModel.dt_TP.Select("STEP = " + ID).First());
viewstop.boxNAME.IsEnabled = false; viewstop.boxNAME.IsEnabled = false;
//viewstop.no.IsEnabled = false; //viewstop.no.IsEnabled = false;
viewstop.data = ID; viewstop.data = ID;
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_InsertClicked); viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_InsertClicked);
viewstop.ShowDialog(); viewstop.ShowDialog();
}
else
{
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
}
} }
private void Address_InsertClicked(object sender, AddressUpdateEventArgs e)//插入返回结果 private void Address_InsertClicked(object sender, AddressUpdateEventArgs e)//插入返回结果
{ {
@ -563,17 +598,24 @@ namespace DyeingComputer.View
} }
private void ProgramgroupView_Jump_Click(object sender, RoutedEventArgs e) private void ProgramgroupView_Jump_Click(object sender, RoutedEventArgs e)
{ {
DataRow dr = MainWindowViewModel.dt_TP.Select("Step='" + ID + "'").First(); if (!MainWindowViewModel._Lock_bool)
dr.BeginEdit(); {
dr["RUN"] = 2; DataRow dr = MainWindowViewModel.dt_TP.Select("Step='" + ID + "'").First();
dr.EndEdit(); dr.BeginEdit();
MainWindowViewModel.User_Button = true; dr["RUN"] = 2;
MainWindowViewModel.RUN_STEPID = Convert.ToInt16(ID);//插入步骤号 dr.EndEdit();
MainWindowViewModel.STEP_START(Numder, Convert.ToDouble(P1), Convert.ToDouble(P2), Convert.ToDouble(P3), MainWindowViewModel.User_Button = true;
Convert.ToDouble(P4), Convert.ToDouble(P5)); MainWindowViewModel.RUN_STEPID = Convert.ToInt16(ID);//插入步骤号
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Jump", "STEP = " + ID + MainWindowViewModel.STEP_START(Numder, Convert.ToDouble(P1), Convert.ToDouble(P2), Convert.ToDouble(P3),
";StepID=" + Numder + ";P1=" + P1 + ";P2=" + P2 + ";P3=" + P3 + ";P4=" + P4 + ";P5=" + P5); Convert.ToDouble(P4), Convert.ToDouble(P5));
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Jump", "STEP = " + ID +
";StepID=" + Numder + ";P1=" + P1 + ";P2=" + P2 + ";P3=" + P3 + ";P4=" + P4 + ";P5=" + P5);
}
else
{
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
}
}//跳步 }//跳步
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e) private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {

284
View/WorkOrderView.xaml.cs

@ -108,29 +108,45 @@ namespace DyeingComputer.View
private void WorkOrderView_lock_Click(object sender, RoutedEventArgs e)//锁定按钮 private void WorkOrderView_lock_Click(object sender, RoutedEventArgs e)//锁定按钮
{ {
if (WorkOrder_Numder == null) return; if (!MainWindowViewModel._Lock_bool)
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
// SQLiteHelpers.Open(); //打开数据库
updata_temp.Clear();//使用前清理缓存
if (_lock == "0") //改变lock的状态
{ {
updata_temp.Add("lock", 1); if (WorkOrder_Numder == null) return;
MainWindow.SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + WorkOrder_Numder + "'", null); //SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
// SQLiteHelpers.Open(); //打开数据库
updata_temp.Clear();//使用前清理缓存
if (_lock == "0") //改变lock的状态
{
updata_temp.Add("lock", 1);
MainWindow.SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + WorkOrder_Numder + "'", null);
}
else
{
updata_temp.Add("lock", 0);
MainWindow.SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + WorkOrder_Numder + "'", null);
}
//SQLiteHelpers.Close();
Workorder_sql();
} }
else else
{ {
updata_temp.Add("lock", 0); MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
MainWindow.SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + WorkOrder_Numder + "'", null); Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
} }
//SQLiteHelpers.Close();
Workorder_sql();
} }
private void WorkOrderView_new_Click(object sender, RoutedEventArgs e)//新建按钮 private void WorkOrderView_new_Click(object sender, RoutedEventArgs e)//新建按钮
{ {
ViewProgram viewProgram = new ViewProgram(); if (!MainWindowViewModel._Lock_bool)
viewProgram.AddressUpdated += new ViewProgram.AddressUpdateHandler(Address_ButtonClicked); {
viewProgram.ShowDialog(); ViewProgram viewProgram = new ViewProgram();
viewProgram.AddressUpdated += new ViewProgram.AddressUpdateHandler(Address_ButtonClicked);
viewProgram.ShowDialog();
}
else
{
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
}
} }
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//新建返回结果 private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//新建返回结果
{ {
@ -162,59 +178,71 @@ namespace DyeingComputer.View
/*获取转并插入步骤信息*/ /*获取转并插入步骤信息*/
DataTable step_dat = MainWindow.SQLiteHelpers.ExecuteDataSet( DataTable step_dat = MainWindow.SQLiteHelpers.ExecuteDataSet(
"select * from ProgramSteps where ProgramID='" + Process_id + "'", null).Tables[0]; //读取表写入缓存 "select * from ProgramSteps where ProgramID='" + Process_id + "'", null).Tables[0]; //读取表写入缓存
DataTable _t = step_dat.Clone(); step_dat.Columns.Add("WorkOrder", System.Type.GetType("System.String"));
_t.Columns.Add("WorkOrder", System.Type.GetType("System.String")); step_dat.Columns.Add("DYELOT", System.Type.GetType("System.String"));
_t.Columns.Add("DYELOT", System.Type.GetType("System.String"));
int a = step_dat.Rows.Count; int a = step_dat.Rows.Count;
for (int i = 0; i < a; i++) for (int i = 0; i < a; i++)
{ {
_t.Clear();//清空
DataRow dt = step_dat.Rows[i];//行转 DataRow dt = step_dat.Rows[i];//行转
DataRow dr = _t.NewRow(); dt.BeginEdit(); //添加订单号
dr.ItemArray = dt.ItemArray; dt["WorkOrder"] = WorkOrder_Numder;
dr.BeginEdit(); //添加订单号 dt["DYELOT"] = WorkOrder_Numder;
dr["WorkOrder"] = WorkOrder_Numder; dt.EndEdit();
dr["DYELOT"] = WorkOrder_Numder;
dr.EndEdit(); MainWindow.SQLiteHelpers.InsertData("WorkorderSteps", MainWindow.SQLiteHelpers.ToDictionary(dt));//行插入
_t.Rows.InsertAt(dr, 0); //行转换
MainWindow.SQLiteHelpers.InsertData("WorkorderSteps", MainWindow.SQLiteHelpers.DataTableToDictionary(_t));//行插入
} }
//SQLiteHelpers.Close(); //SQLiteHelpers.Close();
} }
private void WorkOrderView_del_Click(object sender, RoutedEventArgs e)//删除按钮 private void WorkOrderView_del_Click(object sender, RoutedEventArgs e)//删除按钮
{ {
if (WorkOrder_Numder == null) return; if (!MainWindowViewModel._Lock_bool)
///弹窗提示确认删除
if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm +
Properties.Resources.Delete + WorkOrder_Numder, "Delete ",
System.Windows.Forms.MessageBoxButtons.OKCancel,
System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
{ {
///执行删除 if (WorkOrder_Numder == null) return;
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 ///弹窗提示确认删除
// SQLiteHelpers.Open(); //打开数据库 if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm +
MainWindow.SQLiteHelpers.Delete("WorkOrder", "WorkOrder='" + WorkOrder_Numder + "'", null); Properties.Resources.Delete + WorkOrder_Numder, "Delete ",
//SQLiteHelpers.Close(); System.Windows.Forms.MessageBoxButtons.OKCancel,
Workorder_sql(); System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
{
///执行删除
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
// SQLiteHelpers.Open(); //打开数据库
MainWindow.SQLiteHelpers.Delete("WorkOrder", "WorkOrder='" + WorkOrder_Numder + "'", null);
//SQLiteHelpers.Close();
Workorder_sql();
}
SQL_UPDATE = false;
} }
SQL_UPDATE = false; else
} {
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
}
}
private void WorkOrderView_redy_Click(object sender, RoutedEventArgs e)//重染按钮 private void WorkOrderView_redy_Click(object sender, RoutedEventArgs e)//重染按钮
{ {
string WorkNum = MainWindowViewModel.WorkNumder.ToString(); if (!MainWindowViewModel._Lock_bool)
if (WorkNum != null)
{ {
if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm + string WorkNum = MainWindowViewModel.WorkNumder.ToString();
Properties.Resources.Redye + WorkNum, "Redye ", if (WorkNum != null)
System.Windows.Forms.MessageBoxButtons.OKCancel,
System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
{ {
///执行重染 if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm +
Properties.Resources.Redye + WorkNum, "Redye ",
System.Windows.Forms.MessageBoxButtons.OKCancel,
System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
{
///执行重染
}
} }
SQL_UPDATE = false;
}
else
{
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
} }
SQL_UPDATE = false;
} }
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)//表格选择事件 private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)//表格选择事件
@ -330,93 +358,101 @@ namespace DyeingComputer.View
} }
private void Image_MouseLeftButtonUp1(object sender, MouseButtonEventArgs e) private void Image_MouseLeftButtonUp1(object sender, MouseButtonEventArgs e)
{ {
SQL_UPDATE = false; if (!MainWindowViewModel._Lock_bool)
((System.Windows.Controls.Image)sender).RenderTransform = Transform.Identity;
if (string.IsNullOrEmpty(WorkOrder_Numder)) return;
if (_lock == "1")
{ {
MessageBoxResult messageBox = System.Windows.MessageBox.Show( SQL_UPDATE = false;
Properties.Resources.Process_lock, "800", MessageBoxButton.OK); ((System.Windows.Controls.Image)sender).RenderTransform = Transform.Identity;
return; if (string.IsNullOrEmpty(WorkOrder_Numder)) return;
} if (_lock == "1")
{
DataTable WorkorderSteps = new DataTable(); MessageBoxResult messageBox = System.Windows.MessageBox.Show(
int a; Properties.Resources.Process_lock, "800", MessageBoxButton.OK);
return;
}
/*检查并写入run信息*/ DataTable WorkorderSteps = new DataTable();
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 int a;
// SQLiteHelpers.Open(); //打开数据库
int R_D = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from RUN", null).Tables[0].Rows.Count; //读取表写入缓存 /*检查并写入run信息*/
if (R_D > 0)//判断是否有运行中工艺 //SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
{ // SQLiteHelpers.Open(); //打开数据库
//SQLiteHelpers.Close(); //关闭连接
MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show( int R_D = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from RUN", null).Tables[0].Rows.Count; //读取表写入缓存
Properties.Resources.RunningProcess, "800", MessageBoxButton.YesNo); if (R_D > 0)//判断是否有运行中工艺
if (messageBoxResult == MessageBoxResult.No) return;
if (messageBoxResult == MessageBoxResult.Yes)
{ {
if (MainWindowViewModel.S17 == 1) //拒绝操作 //SQLiteHelpers.Close(); //关闭连接
MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show(
Properties.Resources.RunningProcess, "800", MessageBoxButton.YesNo);
if (messageBoxResult == MessageBoxResult.No) return;
if (messageBoxResult == MessageBoxResult.Yes)
{ {
System.Windows.MessageBox.Show(Properties.Resources.refuse, "800", MessageBoxButton.OK); if (MainWindowViewModel.S17 == 1) //拒绝操作
return; {
System.Windows.MessageBox.Show(Properties.Resources.refuse, "800", MessageBoxButton.OK);
return;
}
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
// SQLiteHelpers.Open(); //打开数据库
} }
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
// SQLiteHelpers.Open(); //打开数据库
} }
}
updata_temp.Clear(); //使用前清缓存 updata_temp.Clear(); //使用前清缓存
updata_temp.Add("State", 205); updata_temp.Add("State", 205);
MainWindow.SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + WorkOrder_Numder + "'", null); MainWindow.SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + WorkOrder_Numder + "'", null);
MainWindowViewModel.Dyelot_dat = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Dyelot = '" + MainWindowViewModel.Dyelot_dat = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Dyelot = '" +
Dyelot + "'", null).Tables[0]; Dyelot + "'", null).Tables[0];
WorkorderSteps = MainWindow.SQLiteHelpers.ExecuteDataSet( WorkorderSteps = MainWindow.SQLiteHelpers.ExecuteDataSet(
"select * from WorkorderSteps where WorkOrder='" + WorkOrder_Numder + "'", null).Tables[0]; //读取表写入缓存 "select * from WorkorderSteps where WorkOrder='" + WorkOrder_Numder + "'", null).Tables[0]; //读取表写入缓存
MainWindowViewModel.ProgramName = Process_Name; MainWindowViewModel.ProgramName = Process_Name;
MainWindowViewModel.Dyelot = Dyelot; MainWindowViewModel.Dyelot = Dyelot;
MainWindow.SQLiteHelpers.Delete("RUN", null, null); //删除run信息 MainWindow.SQLiteHelpers.Delete("RUN", null, null); //删除run信息
a = WorkorderSteps.Rows.Count; a = WorkorderSteps.Rows.Count;
for (int i = 0; i < a; i++) for (int i = 0; i < a; i++)
{ {
DataRow dr = WorkorderSteps.Rows[i];//行转 DataRow dr = WorkorderSteps.Rows[i];//行转
dr.BeginEdit(); //添加订单号 dr.BeginEdit(); //添加订单号
dr["ProgramID"] = Process_id; dr["ProgramID"] = Process_id;
dr["Program"] = MainWindowViewModel.ProgramName; dr["Program"] = MainWindowViewModel.ProgramName;
dr.EndEdit(); dr.EndEdit();
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.ToDictionary(dr));//行插入 MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.ToDictionary(dr));//行插入
} }
updata_temp.Clear(); //使用前清缓存 updata_temp.Clear(); //使用前清缓存
updata_temp.Add("RUN", 1); updata_temp.Add("RUN", 1);
MainWindow.SQLiteHelpers.Update("RUN", updata_temp, "Step=1", null); MainWindow.SQLiteHelpers.Update("RUN", updata_temp, "Step=1", null);
//SQLiteHelpers.Close(); //关闭连接 //SQLiteHelpers.Close(); //关闭连接
/*触发启动*/ /*触发启动*/
string Numder = WorkorderSteps.Select("Step = 1").First().Field<string>("StepID");// string Numder = WorkorderSteps.Select("Step = 1").First().Field<string>("StepID");//
double P1 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter1"); double P1 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter1");
double P2 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter2"); double P2 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter2");
double P3 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter3"); double P3 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter3");
double P4 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter4"); double P4 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter4");
double P5 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter5"); double P5 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter5");
MainWindowViewModel.RUN_STEPID = Convert.ToInt16(1);//插入步骤号 MainWindowViewModel.RUN_STEPID = Convert.ToInt16(1);//插入步骤号
MainWindowViewModel.STEP_START(Numder, Convert.ToDouble(P1), Convert.ToDouble(P2), Convert.ToDouble(P3), MainWindowViewModel.STEP_START(Numder, Convert.ToDouble(P1), Convert.ToDouble(P2), Convert.ToDouble(P3),
Convert.ToDouble(P4), Convert.ToDouble(P5)); Convert.ToDouble(P4), Convert.ToDouble(P5));
MainWindowViewModel.WORK_RUN = 2; MainWindowViewModel.WORK_RUN = 2;
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Jump", "STEP = " + APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Jump", "STEP = " +
MainWindowViewModel.RUN_STEPID + ";StepID=" + Numder + ";P1=" + P1 + ";P2=" + P2 + ";P3=" + P3 + ";P4=" + P4 + ";P5=" + P5); MainWindowViewModel.RUN_STEPID + ";StepID=" + Numder + ";P1=" + P1 + ";P2=" + P2 + ";P3=" + P3 + ";P4=" + P4 + ";P5=" + P5);
/*选定工艺有效跳转准备 */ /*选定工艺有效跳转准备 */
if (Process_id != null) //选定工艺有效跳转准备 if (Process_id != null) //选定工艺有效跳转准备
{ {
MainWindowViewModel.WorkNumder = WorkOrder_Numder; MainWindowViewModel.WorkNumder = WorkOrder_Numder;
TechnologicalProcessView.workName = Process_id; TechnologicalProcessView.workName = Process_id;
MainWindowViewModel.SYS_REDYE = 0; MainWindowViewModel.SYS_REDYE = 0;
MainWindowViewModel.ViewID = 1; MainWindowViewModel.ViewID = 1;
var _mainWindow = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is MainWindow) as MainWindow;//跨页面 var _mainWindow = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is MainWindow) as MainWindow;//跨页面
_mainWindow.container.Content = new TechnologicalProcessView();//获取控件 _mainWindow.container.Content = new TechnologicalProcessView();//获取控件
}
}
else
{
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
} }
}//开始 }//开始

109
ViewModel/MainWindowViewModel.cs

@ -38,6 +38,7 @@ using static DyeingComputer.UserClass.SqliteHelper;
using static DyeingComputer.ViewModel.MainWindowViewModel; using static DyeingComputer.ViewModel.MainWindowViewModel;
using static DyeingComputer.Windows.ViewStep; using static DyeingComputer.Windows.ViewStep;
using static System.Net.WebRequestMethods; using static System.Net.WebRequestMethods;
using static System.Windows.Forms.AxHost;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button; using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window; using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
@ -443,55 +444,69 @@ namespace DyeingComputer.ViewModel
} }
private void ProgramgroupView_run_()////运行/暂停 private void ProgramgroupView_run_()////运行/暂停
{ {
if (WORK_RUN == 2) if (!_Lock_bool)
{
UserButton = true;
IsInteractive = true;
WORK_RUN = 1;// 运行时停止键为暂停
errTabler.Clear();
APILog.LOGlog(WorkNumder.ToString(), "UserActions", "WORK_RUN = Pause", WORK_RUN.ToString());
}
else
if (WORK_RUN == 1)
{ {
UserButton = false; if (WORK_RUN == 2)
IsInteractive = false; {
WORK_RUN = 2;// UserButton = true;
SETP_runtime = true; IsInteractive = true;
TechnologicalProcess_view(); WORK_RUN = 1;// 运行时停止键为暂停
APILog.LOGlog(WorkNumder.ToString(), "UserActions", "WORK_RUN = RUN", WORK_RUN.ToString()); errTabler.Clear();
APILog.LOGlog(WorkNumder.ToString(), "UserActions", "WORK_RUN = Pause", WORK_RUN.ToString());
}
else
if (WORK_RUN == 1)
{
UserButton = false;
IsInteractive = false;
WORK_RUN = 2;//
SETP_runtime = true;
TechnologicalProcess_view();
APILog.LOGlog(WorkNumder.ToString(), "UserActions", "WORK_RUN = RUN", WORK_RUN.ToString());
}
else
{
UserButton = true;
IsInteractive = true;
}
} }
else else
{ {
UserButton = true; USERinf(Resources.LockedState+"\n"+ Resources.TCOIR+"\n"+Resources.PCATRIL);
IsInteractive = true;
} }
} }
public ICommand ProgramgroupView_run { get; } public ICommand ProgramgroupView_run { get; }
private void ProgramgroupView_stop_()//结束 private void ProgramgroupView_stop_()//结束
{ {
APILog.LOGlog(WorkNumder.ToString(), "UserActions", "WORK_RUN = STOP", WORK_RUN.ToString()); if (!_Lock_bool)
{
MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show(Properties.Resources.StopProcess, "800", MessageBoxButton.OKCancel); APILog.LOGlog(WorkNumder.ToString(), "UserActions", "WORK_RUN = STOP", WORK_RUN.ToString());
if (messageBoxResult == MessageBoxResult.OK)
{ MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show(Properties.Resources.StopProcess, "800", MessageBoxButton.OKCancel);
Dictionary<string, object> _temp = new Dictionary<string, object>();//缓存函数 if (messageBoxResult == MessageBoxResult.OK)
_temp.Clear(); //使用前清缓存 {
_temp.Add("State", 301); Dictionary<string, object> _temp = new Dictionary<string, object>();//缓存函数
WORK_RUN = 0;// 运行时停止键为 _temp.Clear(); //使用前清缓存
DIDETime = 0; _temp.Add("State", 301);
APILog.LOGlog(WorkNumder.ToString(), "UserActions", "PROCESS_END", WORK_RUN.ToString()); WORK_RUN = 0;// 运行时停止键为
dt_TP.Rows.Clear(); DIDETime = 0;
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 APILog.LOGlog(WorkNumder.ToString(), "UserActions", "PROCESS_END", WORK_RUN.ToString());
//SQLiteHelpers.Open(); //打开数据库 dt_TP.Rows.Clear();
MainWindow.SQLiteHelpers.Delete("RUN", null, null); //SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
MainWindow.SQLiteHelpers.Update("WorkOrder", _temp, "WorkOrder='" + WorkNumder + "'", null); //SQLiteHelpers.Open(); //打开数据库
//SQLiteHelpers.Close(); //关闭连接 MainWindow.SQLiteHelpers.Delete("RUN", null, null);
MainWindow.SQLiteHelpers.Update("WorkOrder", _temp, "WorkOrder='" + WorkNumder + "'", null);
UserButton = false; //SQLiteHelpers.Close(); //关闭连接
IsInteractive = false;
ProgramName = null; UserButton = false;
WorkNumder = "----------"; IsInteractive = false;
ProgramName = null;
WorkNumder = "----------";
}
}
else
{
USERinf(Resources.LockedState + "\n" + Resources.TCOIR + "\n" + Resources.PCATRIL);
} }
} }
public void CountDown() public void CountDown()
@ -742,8 +757,18 @@ namespace DyeingComputer.ViewModel
public static bool Alert_bell = false; //警报铃声 public static bool Alert_bell = false; //警报铃声
static Dictionary<string, object> updata_RUN = new Dictionary<string, object>();// static Dictionary<string, object> updata_RUN = new Dictionary<string, object>();//
/**提示步骤页面信息**/
/**提示页面信息**/ static UserInf userInf = null;
public static void USERinf(string DAT)
{
if (userInf == null || !userInf.IsLoaded)
{
userInf = new UserInf();
userInf.Inf_DAT = DAT;
userInf.Show();
}
}
/**提示步骤页面信息**/
static UserCall userCall = null; static UserCall userCall = null;
static Sampling sampling = null; static Sampling sampling = null;
public static void USERcall(string ID, string DAT) public static void USERcall(string ID, string DAT)

22
Windows/UserInf.xaml

@ -0,0 +1,22 @@
<Window x:Class="DyeingComputer.Windows.UserInf"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DyeingComputer.Windows"
xmlns:lang="clr-namespace:DyeingComputer.Properties"
WindowStartupLocation="CenterScreen"
Loaded ="Window_Loaded"
ResizeMode="NoResize"
mc:Ignorable="d"
Title="SUNLIGHT 800" Height="400" Width="400">
<Grid>
<TextBox x:Name="INF_DATA" Margin="5,5,5,150" TextWrapping="Wrap" FontSize="30" IsReadOnly="True" />
<Image Height="100" Width="100" VerticalAlignment="Bottom" FlowDirection="LeftToRight"
HorizontalAlignment="Left" Margin="25,0,0,27" Source="/Lmage/IconParkInfo.png"/>
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Right" Height="35" Margin="50,70,20,20"
VerticalAlignment="Bottom" Width="80" Click="YES_Click"/>
</Grid>
</Window>

48
Windows/UserInf.xaml.cs

@ -0,0 +1,48 @@
using DyeingComputer.ViewModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
using System.Xml.Linq;
using static DyeingComputer.UserClass.SqliteHelper;
using static DyeingComputer.Windows.ViewStep;
namespace DyeingComputer.Windows
{
/// <summary>
/// ViewProgram.xaml 的交互逻辑
/// </summary>
public partial class UserInf : Window
{
public string Inf_DAT;//信息
public UserInf()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
INF_DATA.Text = Inf_DAT;
}
private void YES_Click(object sender, RoutedEventArgs e)//确认
{
this.Close(); //关闭窗口
}
}
}
Loading…
Cancel
Save