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());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user