wanghan 3 months ago
parent
commit
6185d42ff6
1 changed files with 20 additions and 20 deletions
  1. 20 20
      LogForceTestApp.Modules.MainModule/ViewModels/MainPageViewModel.cs

+ 20 - 20
LogForceTestApp.Modules.MainModule/ViewModels/MainPageViewModel.cs

@@ -1359,6 +1359,21 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
             myBackUpThread = new Thread(_timer_Elapsed1) { IsBackground = true };
             myBackUpThread.Start();
 
+            var allnumbers = _repository.GetFirstDefault<AllNumber>(c => c.DateA == DateTime.Today);
+            if (allnumbers == null)
+            {
+                var al = new AllNumber()
+                {
+                    Id = Guid.NewGuid(),
+                    DateA = DateTime.Today,
+                    PlanA = 0,
+                    RealityA = 0,
+                    OkA = 0,
+                    NgA = 0,
+                    ErrA = 0
+                };
+                _repository.Add(al);
+            }
         }
 
         public void Bind(string procode)
@@ -1563,19 +1578,19 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     _repository.Update(list);
                 }
                 var allnumbers = _repository.GetFirstDefault<AllNumber>(c => c.DateA == DateTime.Today);
-                //if (allnumbers != null)
-                //{
+                if (allnumbers != null)
+                {
                     allnumbers.RealityA++;
                     _repository.Update(allnumbers);
-                _logger.Information("RealityA++");
-                //}
+                }
+
+                Quest(Order);
 
                 var d1 = tcpNet.ReadInt(1090);
                 var d2 = tcpNet.ReadInt(1091);
                 var d3 = tcpNet.ReadInt(1092);
                 soleNum = d1.ToString() + d2.ToString() + d3.ToString();
 
-                Quest(Order);
                 tcpNet.Write("1026.4", false);
             }
             catch (Exception ex)
@@ -1643,21 +1658,6 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                                     allnumbers.PlanA = allnumbers.PlanA + plan;
                                     _repository.Update(allnumbers);
                                 }
-                                else
-                                {
-                                    var al = new AllNumber()
-                                    {
-                                        Id = Guid.NewGuid(),
-                                        DateA = DateTime.Today,
-                                        PlanA = plan,
-                                        RealityA = 0,
-                                        OkA = 0,
-                                        NgA = 0,
-                                        ErrA = 0
-                                    };
-                                    _repository.Add(al);
-                                    _logger.Information("RealityA = 0");
-                                }
                             }
                         }
                         catch (Exception ex)