数据读写逻辑修改
This commit is contained in:
commit
fb1b024944
6 files changed
+40
-55
No files matched your search
@@ -384,18 +384,13 @@ namespace DyeingComputer.View
|
||||
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 = 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));//行插入
|
||||
dt.BeginEdit(); //添加订单号
|
||||
dt["DYELOT"] = MainWindowViewModel.Dyelot;
|
||||
dt.EndEdit();
|
||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.ToDictionary(dt));//行插入
|
||||
}
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "EDIT STEP = " + n,
|
||||
@@ -553,18 +548,13 @@ namespace DyeingComputer.View
|
||||
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 = 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));//行插入
|
||||
dt.BeginEdit(); //添加订单号
|
||||
dt["DYELOT"] = MainWindowViewModel.Dyelot;
|
||||
dt.EndEdit();
|
||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.ToDictionary(dt));//行插入
|
||||
}
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Insert STEP = " + n,
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.ProcessName}" Width="350" Binding="{Binding ProgramName}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="ProcessID" Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Header="lock" Binding="{Binding lock}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Header="DYELOT" Binding="{Binding Dyelot}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.State}" Width="120" IsReadOnly="True">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
|
||||
@@ -83,6 +83,7 @@ namespace DyeingComputer.View
|
||||
string Process_Name;
|
||||
string Process_id;
|
||||
string _lock;
|
||||
string Dyelot;
|
||||
bool SQL_UPDATE = false;
|
||||
int inf_cont = 0;
|
||||
|
||||
@@ -225,6 +226,7 @@ namespace DyeingComputer.View
|
||||
Process_Name = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
Process_id = (Grid.Columns[2].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||
_lock = (Grid.Columns[3].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
Dyelot = (Grid.Columns[4].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
|
||||
SQL_UPDATE = true;
|
||||
|
||||
@@ -339,7 +341,6 @@ namespace DyeingComputer.View
|
||||
}
|
||||
|
||||
DataTable WorkorderSteps = new DataTable();
|
||||
DataTable data_t = new DataTable();
|
||||
int a;
|
||||
|
||||
/*检查并写入run信息*/
|
||||
@@ -369,27 +370,23 @@ namespace DyeingComputer.View
|
||||
updata_temp.Clear(); //使用前清缓存
|
||||
updata_temp.Add("State", 205);
|
||||
SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + WorkOrder_Numder + "'", null);
|
||||
MainWindowViewModel.Dyelot_dat = SQLiteHelpers.ExecuteDataSet("select * from Dyelot where WorkOrder = '" +
|
||||
WorkOrder_Numder + "'", null).Tables[0];
|
||||
MainWindowViewModel.Dyelot_dat = SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Dyelot = '" +
|
||||
Dyelot + "'", null).Tables[0];
|
||||
WorkorderSteps = SQLiteHelpers.ExecuteDataSet(
|
||||
"select * from WorkorderSteps where WorkOrder='" + WorkOrder_Numder + "'", null).Tables[0]; //读取表写入缓存
|
||||
MainWindowViewModel.ProgramName = Process_Name;
|
||||
SQLiteHelpers.Delete("RUN", null, null); //删除run信息
|
||||
data_t = WorkorderSteps.Clone();
|
||||
MainWindowViewModel.Dyelot = Dyelot;
|
||||
SQLiteHelpers.Delete("RUN", null, null); //删除run信息
|
||||
a = WorkorderSteps.Rows.Count;
|
||||
for (int i = 0; i < a; i++)
|
||||
{
|
||||
data_t.Clear();//清空
|
||||
DataRow dt = WorkorderSteps.Rows[i];//行转
|
||||
DataRow dr = data_t.NewRow();
|
||||
dr.ItemArray = dt.ItemArray;
|
||||
DataRow dr = WorkorderSteps.Rows[i];//行转
|
||||
dr.BeginEdit(); //添加订单号
|
||||
dr["ProgramID"] = Process_id;
|
||||
dr["Program"] = MainWindowViewModel.ProgramName;
|
||||
dr.EndEdit();
|
||||
data_t.Rows.InsertAt(dr, 0); //行转换
|
||||
|
||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.ToDictionary(dr));//行插入
|
||||
}
|
||||
updata_temp.Clear(); //使用前清缓存
|
||||
updata_temp.Add("RUN", 1);
|
||||
|
||||
Reference in new issue
Block a user