Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
102e07dbe2
3 files changed
+71
-77
No files matched your search
+54
-52
@@ -24,6 +24,7 @@ using static DyeingComputer.UserClass.SqliteHelper;
|
||||
using DyeingComputer.View;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using static System.Net.WebRequestMethods;
|
||||
|
||||
namespace DyeingComputer.UserClass
|
||||
{/// <summary>
|
||||
@@ -66,6 +67,8 @@ namespace DyeingComputer.UserClass
|
||||
return rt;
|
||||
}
|
||||
|
||||
public static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||
public static readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||
public static async Task Main()
|
||||
{
|
||||
NetFwManger.AllowPort(7790,"TCP");//开放7790端口
|
||||
@@ -186,7 +189,7 @@ namespace DyeingComputer.UserClass
|
||||
}
|
||||
else if (dat_821.GetValue("INSTRUCTION").ToString() == "JUMP")
|
||||
{
|
||||
MainWindowViewModel.RUN_DATATABLE = TechnologicalProcessView.sql.Tables[0];//缓存表
|
||||
MainWindowViewModel.RUN_DATATABLE = MainWindowViewModel.dt_TP;//缓存表
|
||||
MainWindowViewModel.RUN_STEPID = Convert.ToInt16(dat_821.GetValue("ID").ToString());//插入步骤号
|
||||
MainWindowViewModel.STEP_START(dat_821.GetValue("Numder").ToString(), Convert.ToDouble(dat_821.GetValue("P1")),
|
||||
Convert.ToDouble(dat_821.GetValue("P2")), Convert.ToDouble(dat_821.GetValue("P3")),
|
||||
@@ -195,27 +198,20 @@ namespace DyeingComputer.UserClass
|
||||
else if (dat_821.GetValue("INSTRUCTION").ToString() == "INSERT")
|
||||
{
|
||||
int d = Convert.ToInt16(dat_821.GetValue("ID"));
|
||||
TechnologicalProcessView.SQLiteHelpers = new SQLiteHelper(TechnologicalProcessView.DBAddress); //数据库连接路径
|
||||
TechnologicalProcessView.SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
/**插入行**/
|
||||
string ProgramID = TechnologicalProcessView.SQLiteHelpers.ExecuteScalar("select ProgramID from RUN where Step = '1'", null).ToString();
|
||||
string ProgramNAME = TechnologicalProcessView.SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString();
|
||||
string ProgramID = SQLiteHelpers.ExecuteScalar("select ProgramID from RUN where Step = '1'", null).ToString();
|
||||
string ProgramNAME = SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString();
|
||||
// TechnologicalProcessView.SQLiteHelpers.Close();
|
||||
DataRow dr = TechnologicalProcessView.sql.Tables[0].NewRow();//添加表数据
|
||||
DataRow dr = MainWindowViewModel.dt_TP.NewRow();//添加表数据
|
||||
dr["ProgramID"] = ProgramID;
|
||||
dr["Program"] = ProgramNAME;
|
||||
TechnologicalProcessView.sql.Tables[0].Rows.InsertAt(dr, d - 1);
|
||||
MainWindowViewModel.dt_TP.Rows.InsertAt(dr, d - 1);
|
||||
/**编辑行号**/
|
||||
int a = TechnologicalProcessView.sql.Tables[0].Rows.Count;
|
||||
for (int i = 0; i < a; i++)
|
||||
{
|
||||
DataRow drt = TechnologicalProcessView.sql.Tables[0].Rows[i];
|
||||
drt.BeginEdit();
|
||||
drt["Step"] = i + 1;
|
||||
drt.EndEdit();
|
||||
}
|
||||
TechnologicalProcessView.Dat();
|
||||
/**编辑行信息**/
|
||||
DataRow drtt = TechnologicalProcessView.sql.Tables[0].Rows[d - 1];
|
||||
DataRow drtt = MainWindowViewModel.dt_TP.Rows[d - 1];
|
||||
drtt.BeginEdit();
|
||||
drtt["StepID"] = dat_821.GetValue("StepID").ToString();
|
||||
drtt["StepName"] = dat_821.GetValue("StepName").ToString();
|
||||
@@ -234,23 +230,26 @@ namespace DyeingComputer.UserClass
|
||||
// _TechnologicalProcessView.Grid.ItemsSource = TechnologicalProcessView.sql.Tables[0].DefaultView;
|
||||
//_TechnologicalProcessView.Grid.SelectedIndex = -1;
|
||||
/**存入信息**/
|
||||
TechnologicalProcessView.SQLiteHelpers.Delete("RUN", null, null);
|
||||
DataTable data_t = new DataTable();
|
||||
data_t.Columns.Add("DYELOT", typeof(string)); //添加列
|
||||
data_t = TechnologicalProcessView.sql.Tables[0].Clone();
|
||||
a = TechnologicalProcessView.sql.Tables[0].Rows.Count;
|
||||
for (int i = 0; i < a; i++)
|
||||
/**存入信息**/
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Delete("RUN", null, null);
|
||||
DataTable data_t = MainWindowViewModel.dt_TP.Clone();
|
||||
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
|
||||
{
|
||||
data_t.Clear();//清空
|
||||
|
||||
DataRow dt = TechnologicalProcessView.sql.Tables[0].Rows[i];//行转换
|
||||
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();
|
||||
|
||||
TechnologicalProcessView.SQLiteHelpers.InsertData("RUN", TechnologicalProcessView.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||
}
|
||||
TechnologicalProcessView.SQLiteHelpers.Close(); //关闭连接
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
|
||||
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString());
|
||||
}//插入
|
||||
@@ -258,7 +257,7 @@ namespace DyeingComputer.UserClass
|
||||
{
|
||||
int n = Convert.ToInt16(dat_821.GetValue("ID").ToString());
|
||||
/**编辑行信息**/
|
||||
DataRow dr = TechnologicalProcessView.sql.Tables[0].Rows[n - 1];
|
||||
DataRow dr =MainWindowViewModel.dt_TP.Rows[n - 1];
|
||||
dr.BeginEdit();
|
||||
dr["StepID"] = dat_821.GetValue("StepID").ToString();
|
||||
dr["StepName"] = dat_821.GetValue("StepName").ToString();
|
||||
@@ -271,21 +270,18 @@ namespace DyeingComputer.UserClass
|
||||
dr.EndEdit();
|
||||
|
||||
var _TechnologicalProcessView = Application.Current.Windows.Cast<UserControl>().FirstOrDefault(window => window is TechnologicalProcessView) as TechnologicalProcessView;//跨页面
|
||||
_TechnologicalProcessView.Grid.ItemsSource = TechnologicalProcessView.sql.Tables[0].DefaultView;
|
||||
// _TechnologicalProcessView.Grid.ItemsSource = TechnologicalProcessView.sql.Tables[0].DefaultView;
|
||||
_TechnologicalProcessView.Grid.SelectedIndex = -1;
|
||||
/**存入信息**/
|
||||
TechnologicalProcessView.SQLiteHelpers = new SQLiteHelper(TechnologicalProcessView.DBAddress); //数据库连接路径
|
||||
TechnologicalProcessView.SQLiteHelpers.Open(); //打开数据库
|
||||
TechnologicalProcessView.SQLiteHelpers.Delete("RUN", null, null);
|
||||
DataTable data_t = new DataTable();
|
||||
data_t.Columns.Add("DYELOT", typeof(string)); //添加列
|
||||
data_t = TechnologicalProcessView.sql.Tables[0].Clone();
|
||||
int a = TechnologicalProcessView.sql.Tables[0].Rows.Count;
|
||||
for (int i = 0; i < a; i++)
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Delete("RUN", null, null);
|
||||
DataTable data_t = MainWindowViewModel.dt_TP.Clone();
|
||||
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
|
||||
{
|
||||
data_t.Clear();//清空
|
||||
|
||||
DataRow dt = TechnologicalProcessView.sql.Tables[0].Rows[i];//行转换
|
||||
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
|
||||
DataRow drT = data_t.NewRow();
|
||||
drT.ItemArray = dt.ItemArray;
|
||||
data_t.Rows.InsertAt(drT, 0);
|
||||
@@ -293,31 +289,37 @@ namespace DyeingComputer.UserClass
|
||||
drT["DYELOT"] = MainWindowViewModel.WorkNumder;
|
||||
drT.EndEdit();
|
||||
|
||||
TechnologicalProcessView.SQLiteHelpers.InsertData("RUN", TechnologicalProcessView.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||
}
|
||||
TechnologicalProcessView.SQLiteHelpers.Close(); //关闭连接
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
|
||||
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString());
|
||||
}//编辑
|
||||
else if (dat_821.GetValue("INSTRUCTION").ToString() == "DELETE")
|
||||
{
|
||||
int d = Convert.ToInt16(dat_821.GetValue("ID"));
|
||||
|
||||
int a = TechnologicalProcessView.sql.Tables[0].Rows.Count;
|
||||
if (a != d)//如果删除不是最后一行执行
|
||||
MainWindowViewModel.dt_TP.Rows.RemoveAt(d - 1);
|
||||
TechnologicalProcessView.Dat();
|
||||
/**存入信息**/
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Delete("RUN", null, null);
|
||||
DataTable data_t = MainWindowViewModel.dt_TP.Clone();
|
||||
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
|
||||
{
|
||||
TechnologicalProcessView.sql.Tables[0].Rows.RemoveAt(d - 1);
|
||||
data_t.Clear();//清空
|
||||
|
||||
for (int i = 0; i < a; i++)
|
||||
{
|
||||
DataRow drt = TechnologicalProcessView.sql.Tables[0].Rows[i];
|
||||
drt.BeginEdit();
|
||||
drt["Step"] = i + 1;
|
||||
drt.EndEdit();
|
||||
}
|
||||
var _TechnologicalProcessView = Application.Current.Windows.Cast<UserControl>().FirstOrDefault(window => window is TechnologicalProcessView) as TechnologicalProcessView;//跨页面
|
||||
_TechnologicalProcessView.Grid.ItemsSource = TechnologicalProcessView.sql.Tables[0].DefaultView; //转换显示计划表
|
||||
}
|
||||
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();
|
||||
|
||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||
}
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
|
||||
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString());
|
||||
}
|
||||
|
||||
@@ -167,15 +167,12 @@ namespace DyeingComputer.View
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Delete("RUN", null, null);
|
||||
DataTable data_t = new DataTable();
|
||||
data_t.Columns.Add("DYELOT", typeof(string)); //添加列
|
||||
data_t = sql.Tables[0].Clone();
|
||||
int a = sql.Tables[0].Rows.Count;
|
||||
for (int i = 0; i < a; i++)
|
||||
DataTable data_t = dt_TP.Clone();
|
||||
for (int i = 0; i < dt_TP.Rows.Count; i++)
|
||||
{
|
||||
data_t.Clear();//清空
|
||||
|
||||
DataRow dt = sql.Tables[0].Rows[i];//行转换
|
||||
DataRow dt = dt_TP.Rows[i];//行转换
|
||||
DataRow drT = data_t.NewRow();
|
||||
drT.ItemArray = dt.ItemArray;
|
||||
data_t.Rows.InsertAt(drT, 0);
|
||||
@@ -185,15 +182,14 @@ namespace DyeingComputer.View
|
||||
|
||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||
}
|
||||
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
}
|
||||
public void Dat()//行号刷新
|
||||
public static void Dat()//行号刷新
|
||||
{
|
||||
int a = sql.Tables[0].Rows.Count;
|
||||
int a = dt_TP.Rows.Count;
|
||||
for (int i = 0; i < a; i++)
|
||||
{
|
||||
DataRow dr = sql.Tables[0].Rows[i];
|
||||
DataRow dr = dt_TP.Rows[i];
|
||||
dr.BeginEdit();
|
||||
dr["Step"] = i + 1;
|
||||
dr.EndEdit();
|
||||
@@ -202,12 +198,10 @@ namespace DyeingComputer.View
|
||||
private void ProgramgroupView_del_Click(object sender, RoutedEventArgs e)//删除
|
||||
{
|
||||
int d = 0;
|
||||
int a = sql.Tables[0].Rows.Count;
|
||||
int a = dt_TP.Rows.Count;
|
||||
|
||||
if (ID != null) { d = Convert.ToInt16(ID); } else { return; }
|
||||
if (a != d)//如果删除不是最后一行执行
|
||||
{
|
||||
sql.Tables[0].Rows.RemoveAt(d - 1);
|
||||
dt_TP.Rows.RemoveAt(d - 1);
|
||||
|
||||
Dat();
|
||||
Grid.SelectedIndex = -1;
|
||||
@@ -215,15 +209,13 @@ namespace DyeingComputer.View
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Delete("RUN", null, null);
|
||||
DataTable data_t = new DataTable();
|
||||
data_t.Columns.Add("DYELOT", typeof(string)); //添加列
|
||||
data_t = sql.Tables[0].Clone();
|
||||
a = sql.Tables[0].Rows.Count;
|
||||
DataTable data_t = dt_TP.Clone();
|
||||
a = dt_TP.Rows.Count;
|
||||
for (int i = 0; i < a; i++)
|
||||
{
|
||||
data_t.Clear();//清空
|
||||
|
||||
DataRow dt = sql.Tables[0].Rows[i];//行转换
|
||||
DataRow dt = dt_TP.Rows[i];//行转换
|
||||
DataRow drT = data_t.NewRow();
|
||||
drT.ItemArray = dt.ItemArray;
|
||||
data_t.Rows.InsertAt(drT, 0);
|
||||
@@ -235,8 +227,8 @@ namespace DyeingComputer.View
|
||||
}
|
||||
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
dt_TP = sql.Tables[0]; //转换显示计划表
|
||||
}
|
||||
// dt_TP = sql.Tables[0]; //转换显示计划表
|
||||
|
||||
}
|
||||
|
||||
private void ProgramgroupView_Insert_Click(object sender, RoutedEventArgs e)//插入
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace DyeingComputer.ViewModel
|
||||
get { return work_Numder; }
|
||||
set { work_Numder = value; OnPropertyChanged("Work_Numder"); }
|
||||
}
|
||||
public string status_Str; //显示状态
|
||||
public string status_Str ="-"; //显示状态
|
||||
public string Status_Str //通知UI控件参数改变
|
||||
{
|
||||
get { return status_Str; }
|
||||
@@ -220,9 +220,9 @@ namespace DyeingComputer.ViewModel
|
||||
public static int ViewID = 0;//页面id
|
||||
|
||||
public static object Name_err = "";
|
||||
public static object SYSTime;
|
||||
public static object WorkNumder;
|
||||
public static object StatusStr;
|
||||
public static object SYSTime = "-----";
|
||||
public static object WorkNumder ="-----";
|
||||
public static object StatusStr = "-----";
|
||||
public static object Process_step = "-----";
|
||||
public static string ProgramName = "-----";//工艺名
|
||||
public static Int32 DIDETime; //空闲计时器
|
||||
|
||||
Reference in new issue
Block a user