| | |
| | | private string visualTestId; |
| | | private Sqlite3Helper helper; |
| | | |
| | | private void InitCurrentTestHelper() |
| | | { |
| | | if (helper == null) |
| | | { |
| | | var now = DateTime.Now; |
| | | string dateStr = now.ToString("yyyyMMdd"); |
| | | visualTestId = $"{title}_{now.ToString("yyyyMMddHHmmssfff")}"; |
| | | helper = CheckSqlHelper(dateStr); |
| | | } |
| | | } |
| | | |
| | | public void SetStatus(string status) |
| | | { |
| | | Dispatcher.Invoke(() => |
| | |
| | | if (oldStatus != "testing" && status == "testing") |
| | | { |
| | | UpdateProbeCount(ProbeCount + 1); |
| | | var now = DateTime.Now; |
| | | string dateStr = now.ToString("yyyyMMdd"); |
| | | visualTestId = $"{title}_{now.ToString("yyyyMMddHHmmssfff")}"; |
| | | helper = CheckSqlHelper(dateStr); |
| | | InsertARecourd(); |
| | | InitCurrentTestHelper(); |
| | | InsertARecord(); |
| | | } |
| | | |
| | | if (oldStatus != "ok" && status == "ok") |
| | |
| | | }); |
| | | } |
| | | |
| | | private void InsertARecourd() |
| | | private void InsertARecord() |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ViewControl.Logger.Error($"Cell[{title}] SaveToDB Error.", ex); |
| | | ViewControl.Logger.Error($"Cell[{title}] InsertARecord Error.", ex); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | try |
| | | { |
| | | InitCurrentTestHelper(); |
| | | string model = table?.CbProduct?.SelectedItem?.ToString(); |
| | | sql = $@"INSERT INTO serialData (sn,model,station,position,step,limitDown,limitUp,unit,value,status,finalStatus,time,resultId) |
| | | VALUES ('{sn}','{model}','','{this.title}','{info.step}','{info.limitDown}','{info.limitUp}','{info.unit}','{info.value}','{info.result}', |
| | |
| | | /// <param name="filePath"></param> |
| | | public void SaveInfoToDB() |
| | | { |
| | | Dispatcher.BeginInvoke(new Action(() => |
| | | Dispatcher.Invoke(() => |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | ViewControl.Logger.Error($"Cell[{title}] SaveToDB Error.", ex); |
| | | } |
| | | })); |
| | | }); |
| | | } |
| | | |
| | | private void MenuItem_Click(object sender, RoutedEventArgs e) |
| | |
| | | |
| | | public bool LightGreen(bool on, out string msg) |
| | | { |
| | | return S7Context.WriteData(RunTimeVariablePool.DEFAULT_PLC_NAME, |
| | | $"Oven{table.index + 1}_Cell{index + 1}_Light_OK", on, out msg); |
| | | string key = $"Oven{table.index + 1}_Cell{index + 1}_Light_OK"; |
| | | bool res = S7Context.WriteData(RunTimeVariablePool.DEFAULT_PLC_NAME, key, on, out msg); |
| | | if (res) |
| | | { |
| | | ViewControl.Logger.Debug($"Set Light [{key}] {on}."); |
| | | } |
| | | else |
| | | { |
| | | ViewControl.Logger.Debug($"Open Light [{key}] {on} Error.{msg}"); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | public bool LightRed(bool on, out string msg) |