工艺运行时间计算
This commit is contained in:
commit
69e9c1c501
2 files changed
+39
No files matched your search
@@ -67,6 +67,7 @@
|
||||
<DataGridTextColumn Binding="{Binding Parameter8}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Binding="{Binding Parameter9}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Binding="{Binding Parameter10}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Binding="{Binding StepTime}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<StackPanel x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,400,0">
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
string Numder = null;
|
||||
string ID = null;
|
||||
string P1, P2, P3, P4, P5;
|
||||
string StepTime = null;
|
||||
public void Programgroup_sql()
|
||||
{
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
@@ -126,6 +127,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
P3 = (Grid.Columns[8].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第8列,
|
||||
P4 = (Grid.Columns[9].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第9列,
|
||||
P5 = (Grid.Columns[10].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第10列,
|
||||
StepTime = (Grid.Columns[16].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +146,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
P3 = (Grid.Columns[8].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第8列,
|
||||
P4 = (Grid.Columns[9].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第9列,
|
||||
P5 = (Grid.Columns[10].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第10列,
|
||||
StepTime = (Grid.Columns[16].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//
|
||||
|
||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||
if (ID == null) ID = sql.Tables[0].Rows.Count.ToString();
|
||||
@@ -185,6 +188,37 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
ID = (n + 1).ToString();
|
||||
}
|
||||
|
||||
int steptime=0;//时间秒
|
||||
string[] time_D = { "001", "013", "015", "017", "065" };
|
||||
string[] time_J = { "031", "093" };
|
||||
string[] time_T = { "054", "055","056" };
|
||||
foreach (var item in time_D)
|
||||
{
|
||||
if (item == e.StepID)
|
||||
{
|
||||
steptime = Convert.ToUInt16(e.P3)*60;
|
||||
}
|
||||
}
|
||||
foreach (var item in time_J)
|
||||
{
|
||||
if (item == e.StepID)
|
||||
{
|
||||
steptime = Convert.ToUInt16(e.P1) * 60;
|
||||
}
|
||||
}
|
||||
foreach (var item in time_T)
|
||||
{
|
||||
if (item == e.StepID)
|
||||
{
|
||||
steptime = 5;
|
||||
}
|
||||
}
|
||||
if (steptime==0)
|
||||
{
|
||||
steptime = 300;
|
||||
}
|
||||
|
||||
|
||||
DataRow dr = sql.Tables[0].Rows[n - 1];
|
||||
dr.BeginEdit();
|
||||
dr["StepID"] = e.StepID;
|
||||
@@ -195,6 +229,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
dr["Parameter3"] = e.P3;
|
||||
dr["Parameter4"] = e.P4;
|
||||
dr["Parameter5"] = e.P5;
|
||||
dr["StepTime"] =steptime;//
|
||||
dr.EndEdit();
|
||||
|
||||
Grid.ItemsSource = sql.Tables[0].DefaultView;
|
||||
@@ -243,8 +278,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
r = SQLiteHelpers.InsertData("ProgramSteps", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||
}
|
||||
|
||||
int time =Convert.ToUInt16( sql.Tables[0].Compute("sum(StepTime)", ""))/60;
|
||||
string time_ =DateTime.Parse( TimeSpan.FromMinutes(time).ToString()).ToString("HH:mm");// DateTime.Parse(time.ToString()).ToString("HH:mm");
|
||||
Dictionary<string, object> Program_Step = new Dictionary<string, object>();//缓存函数
|
||||
Program_Step.Add("Step", a - 1);
|
||||
Program_Step.Add("Time", time_);
|
||||
SQLiteHelpers.Update("ProgramName", Program_Step, "ProgramID='" + ProgramID + "'", null);
|
||||
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
|
||||
Reference in new issue
Block a user